added missing takeover height and amount RPC fields

This commit is contained in:
Brannon King 2021-11-09 14:59:07 -05:00
parent 53f79b0979
commit a1771466b7
3 changed files with 34 additions and 26 deletions

View file

@ -55,11 +55,12 @@ type GetClaimsForNameBySeqCmd struct {
} }
type GetClaimsForNameResult struct { type GetClaimsForNameResult struct {
Hash string `json:"hash"` Hash string `json:"hash"`
Height int32 `json:"height"` Height int32 `json:"height"`
NormalizedName string `json:"normalizedname"` LastTakeoverHeight int32 `json:"lasttakeoverheight"`
Claims []ClaimResult `json:"claims"` NormalizedName string `json:"normalizedname"`
// UnclaimedSupports []SupportResult `json:"unclaimedSupports"` how would this work with other constraints? Claims []ClaimResult `json:"claims"`
// UnclaimedSupports []SupportResult `json:"supportswithoutclaim"` how would this work with other constraints?
} }
type SupportResult struct { type SupportResult struct {
@ -80,6 +81,7 @@ type ClaimResult struct {
Sequence int32 `json:"sequence"` Sequence int32 `json:"sequence"`
Height int32 `json:"height"` Height int32 `json:"height"`
ValidAtHeight int32 `json:"validatheight"` ValidAtHeight int32 `json:"validatheight"`
Amount int64 `json:"amount"`
EffectiveAmount int64 `json:"effectiveamount"` EffectiveAmount int64 `json:"effectiveamount"`
Supports []SupportResult `json:"supports,omitempty"` Supports []SupportResult `json:"supports,omitempty"`
Address string `json:"address,omitempty"` Address string `json:"address,omitempty"`

View file

@ -117,10 +117,11 @@ func handleGetClaimsForName(s *rpcServer, cmd interface{}, _ <-chan struct{}) (i
} }
return btcjson.GetClaimsForNameResult{ return btcjson.GetClaimsForNameResult{
Hash: hash, Hash: hash,
Height: height, Height: height,
NormalizedName: name, LastTakeoverHeight: n.TakenOverAt,
Claims: results, NormalizedName: name,
Claims: results,
}, nil }, nil
} }
@ -155,10 +156,11 @@ func handleGetClaimsForNameByID(s *rpcServer, cmd interface{}, _ <-chan struct{}
} }
return btcjson.GetClaimsForNameResult{ return btcjson.GetClaimsForNameResult{
Hash: hash, Hash: hash,
Height: height, Height: height,
NormalizedName: name, LastTakeoverHeight: n.TakenOverAt,
Claims: results, NormalizedName: name,
Claims: results,
}, nil }, nil
} }
@ -190,10 +192,11 @@ func handleGetClaimsForNameByBid(s *rpcServer, cmd interface{}, _ <-chan struct{
} }
return btcjson.GetClaimsForNameResult{ return btcjson.GetClaimsForNameResult{
Hash: hash, Hash: hash,
Height: height, Height: height,
NormalizedName: name, LastTakeoverHeight: n.TakenOverAt,
Claims: results, NormalizedName: name,
Claims: results,
}, nil }, nil
} }
@ -230,10 +233,11 @@ func handleGetClaimsForNameBySeq(s *rpcServer, cmd interface{}, _ <-chan struct{
} }
return btcjson.GetClaimsForNameResult{ return btcjson.GetClaimsForNameResult{
Hash: hash, Hash: hash,
Height: height, Height: height,
NormalizedName: name, LastTakeoverHeight: n.TakenOverAt,
Claims: results, NormalizedName: name,
Claims: results,
}, nil }, nil
} }
@ -248,6 +252,7 @@ func toClaimResult(s *rpcServer, i int32, node *node.Node, includeValues *bool)
TXID: claim.OutPoint.Hash.String(), TXID: claim.OutPoint.Hash.String(),
N: claim.OutPoint.Index, N: claim.OutPoint.Index,
Bid: i, // assuming sorted by bid Bid: i, // assuming sorted by bid
Amount: claim.Amount,
EffectiveAmount: claim.Amount + node.SupportSums[claim.ClaimID.Key()], EffectiveAmount: claim.Amount + node.SupportSums[claim.ClaimID.Key()],
Sequence: claim.Sequence, Sequence: claim.Sequence,
Supports: supports, Supports: supports,

View file

@ -782,10 +782,11 @@ var helpDescsEnUS = map[string]string{
"getclaimsfornamebybid-includevalues": "Return the metadata and address", "getclaimsfornamebybid-includevalues": "Return the metadata and address",
"getclaimsfornamebyid-includevalues": "Return the metadata and address", "getclaimsfornamebyid-includevalues": "Return the metadata and address",
"getclaimsfornameresult-claims": "All the active claims on the given name", "getclaimsfornameresult-claims": "All the active claims on the given name",
"getclaimsfornameresult-normalizedname": "Lower-case version of the passed-in name", "getclaimsfornameresult-normalizedname": "Lower-case version of the passed-in name",
"getclaimsfornameresult-height": "Height of the requested block", "getclaimsfornameresult-height": "Height of the requested block",
"getclaimsfornameresult-hash": "Hash of the requested block", "getclaimsfornameresult-lasttakeoverheight": "Height of the most recent name takeover",
"getclaimsfornameresult-hash": "Hash of the requested block",
"getchangesinblock--synopsis": "Returns a list of names affected by a given block", "getchangesinblock--synopsis": "Returns a list of names affected by a given block",
"getchangesinblockresult-names": "Names that changed (or were at least checked for change) on the given height", "getchangesinblockresult-names": "Names that changed (or were at least checked for change) on the given height",
@ -806,9 +807,9 @@ var helpDescsEnUS = map[string]string{
"claimresult-n": "The output (TXO) index", "claimresult-n": "The output (TXO) index",
"claimresult-address": "The destination address for the claim", "claimresult-address": "The destination address for the claim",
"claimresult-supports": "The list of supports active on the claim", "claimresult-supports": "The list of supports active on the claim",
"claimresult-amount": "LBC staked",
"claimresult-validatheight": "The height when the stake becomes valid", "claimresult-validatheight": "The height when the stake becomes valid",
"claimresult-height": "The height when the stake was created or updated", "claimresult-height": "The height when the stake was created or updated",
"claimresult-amount": "The stake amount in sats",
"claimresult-effectiveamount": "The stake amount plus the active supports' amounts", "claimresult-effectiveamount": "The stake amount plus the active supports' amounts",
"claimresult-sequence": "The order this claim was created compared to other claims on this name", "claimresult-sequence": "The order this claim was created compared to other claims on this name",
"claimresult-bid": "Bid of 0 means that this claim currently owns the name", "claimresult-bid": "Bid of 0 means that this claim currently owns the name",