github.com/lbryio/lbcd@v0.22.119/btcjson/claimcmds.go (about)

     1  package btcjson
     2  
     3  func init() {
     4  	// No special flags for commands in this file.
     5  	flags := UsageFlag(0)
     6  
     7  	MustRegisterCmd("getchangesinblock", (*GetChangesInBlockCmd)(nil), flags)
     8  	MustRegisterCmd("getclaimsforname", (*GetClaimsForNameCmd)(nil), flags)
     9  	MustRegisterCmd("getclaimsfornamebyid", (*GetClaimsForNameByIDCmd)(nil), flags)
    10  	MustRegisterCmd("getclaimsfornamebybid", (*GetClaimsForNameByBidCmd)(nil), flags)
    11  	MustRegisterCmd("getclaimsfornamebyseq", (*GetClaimsForNameBySeqCmd)(nil), flags)
    12  	MustRegisterCmd("normalize", (*GetNormalizedCmd)(nil), flags)
    13  }
    14  
    15  // optional inputs are required to be pointers, but they support things like `jsonrpcdefault:"false"`
    16  // optional inputs have to be at the bottom of the struct
    17  // optional outputs require ",omitempty"
    18  // traditional bitcoin fields are all lowercase
    19  
    20  type GetChangesInBlockCmd struct {
    21  	HashOrHeight *string `json:"hashorheight" jsonrpcdefault:""`
    22  }
    23  
    24  type GetChangesInBlockResult struct {
    25  	Hash   string   `json:"hash"`
    26  	Height int32    `json:"height"`
    27  	Names  []string `json:"names"`
    28  }
    29  
    30  type GetClaimsForNameCmd struct {
    31  	Name          string  `json:"name"`
    32  	HashOrHeight  *string `json:"hashorheight" jsonrpcdefault:""`
    33  	IncludeValues *bool   `json:"includevalues" jsonrpcdefault:"false"`
    34  }
    35  
    36  type GetClaimsForNameByIDCmd struct {
    37  	Name            string   `json:"name"`
    38  	PartialClaimIDs []string `json:"partialclaimids"`
    39  	HashOrHeight    *string  `json:"hashorheight" jsonrpcdefault:""`
    40  	IncludeValues   *bool    `json:"includevalues" jsonrpcdefault:"false"`
    41  }
    42  
    43  type GetClaimsForNameByBidCmd struct {
    44  	Name          string  `json:"name"`
    45  	Bids          []int32 `json:"bids"`
    46  	HashOrHeight  *string `json:"hashorheight" jsonrpcdefault:""`
    47  	IncludeValues *bool   `json:"includevalues" jsonrpcdefault:"false"`
    48  }
    49  
    50  type GetClaimsForNameBySeqCmd struct {
    51  	Name          string  `json:"name"`
    52  	Sequences     []int32 `json:"sequences" jsonrpcusage:"[sequence,...]"`
    53  	HashOrHeight  *string `json:"hashorheight" jsonrpcdefault:""`
    54  	IncludeValues *bool   `json:"includevalues" jsonrpcdefault:"false"`
    55  }
    56  
    57  type GetClaimsForNameResult struct {
    58  	Hash               string        `json:"hash"`
    59  	Height             int32         `json:"height"`
    60  	LastTakeoverHeight int32         `json:"lasttakeoverheight"`
    61  	NormalizedName     string        `json:"normalizedname"`
    62  	Claims             []ClaimResult `json:"claims"`
    63  	// UnclaimedSupports []SupportResult `json:"supportswithoutclaim"` how would this work with other constraints?
    64  }
    65  
    66  type SupportResult struct {
    67  	TXID          string `json:"txid"`
    68  	N             uint32 `json:"n"`
    69  	Height        int32  `json:"height"`
    70  	ValidAtHeight int32  `json:"validatheight"`
    71  	Amount        int64  `json:"amount"`
    72  	Address       string `json:"address,omitempty"`
    73  	Value         string `json:"value,omitempty"`
    74  }
    75  
    76  type ClaimResult struct {
    77  	ClaimID         string          `json:"claimid"`
    78  	TXID            string          `json:"txid"`
    79  	N               uint32          `json:"n"`
    80  	Bid             int32           `json:"bid"`
    81  	Sequence        int32           `json:"sequence"`
    82  	Height          int32           `json:"height"`
    83  	ValidAtHeight   int32           `json:"validatheight"`
    84  	Amount          int64           `json:"amount"`
    85  	EffectiveAmount int64           `json:"effectiveamount"`
    86  	Supports        []SupportResult `json:"supports,omitempty"`
    87  	Address         string          `json:"address,omitempty"`
    88  	Value           string          `json:"value,omitempty"`
    89  }
    90  
    91  type GetNormalizedCmd struct {
    92  	Name string `json:"name"`
    93  }
    94  
    95  type GetNormalizedResult struct {
    96  	NormalizedName string `json:"normalizedname"`
    97  }