Skip to content

Commit

Permalink
fix getaddressbalance req type and serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoacosta74 committed May 7, 2024
1 parent a0736f3 commit 28208e1
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 28208e1

Please sign in to comment.