Skip to content

Commit

Permalink
Add mempool nonce into response of getBalance rpc method (#779)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidenaio authored Aug 25, 2021
1 parent ab9c2e1 commit 39ae2f1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions api/dna_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ func (api *DnaApi) GetCoinbaseAddr() common.Address {
}

type Balance struct {
Stake decimal.Decimal `json:"stake"`
Balance decimal.Decimal `json:"balance"`
Nonce uint32 `json:"nonce"`
Stake decimal.Decimal `json:"stake"`
Balance decimal.Decimal `json:"balance"`
Nonce uint32 `json:"nonce"`
MempoolNonce uint32 `json:"mempoolNonce"`
}

func (api *DnaApi) GetBalance(address common.Address) Balance {
Expand All @@ -64,9 +65,10 @@ func (api *DnaApi) GetBalance(address common.Address) Balance {
}

return Balance{
Stake: blockchain.ConvertToFloat(state.State.GetStakeBalance(address)),
Balance: blockchain.ConvertToFloat(state.State.GetBalance(address)),
Nonce: nonce,
Stake: blockchain.ConvertToFloat(state.State.GetStakeBalance(address)),
Balance: blockchain.ConvertToFloat(state.State.GetBalance(address)),
Nonce: nonce,
MempoolNonce: state.NonceCache.GetNonce(address, currentEpoch),
}
}

Expand Down

0 comments on commit 39ae2f1

Please sign in to comment.