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

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

View file

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

View file

@ -785,6 +785,7 @@ var helpDescsEnUS = map[string]string{
"getclaimsfornameresult-claims": "All the active claims on the given name",
"getclaimsfornameresult-normalizedname": "Lower-case version of the passed-in name",
"getclaimsfornameresult-height": "Height 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",
@ -806,9 +807,9 @@ var helpDescsEnUS = map[string]string{
"claimresult-n": "The output (TXO) index",
"claimresult-address": "The destination address for 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-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-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",