Skip to content

Commit

Permalink
Merge pull request #112 from alejoacosta74/fix/get-balance
Browse files Browse the repository at this point in the history
fix getaddressbalance req type and serialization
  • Loading branch information
alejoacosta74 authored May 8, 2024
2 parents a0736f3 + 28208e1 commit e06ac22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pkg/qtum/rpc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ type (
}
*/
GetAddressBalanceRequest struct {
Address string
Addresses []string `json:"addresses"`
}

GetAddressBalanceResponse struct {
Expand All @@ -1764,8 +1764,8 @@ type (
)

func (req *GetAddressBalanceRequest) MarshalJSON() ([]byte, error) {
params := []interface{}{
req.Address,
params := []map[string][]string{
{"addresses": req.Addresses},
}
return json.Marshal(params)
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/transformer/eth_getBalance.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func (p *ProxyETHGetBalance) Request(rawreq *eth.JSONRPCRequest, c echo.Context)
return nil, eth.NewCallbackError(err.Error())
}

qtumreq := qtum.GetAddressBalanceRequest{Address: base58Addr}
qtumreq := qtum.GetAddressBalanceRequest{
Addresses: []string{base58Addr},
}
qtumresp, err := p.GetAddressBalance(c.Request().Context(), &qtumreq)
if err != nil {
if err == qtum.ErrInvalidAddress {
Expand Down

0 comments on commit e06ac22

Please sign in to comment.