From 28208e19e9a0ddd6f8f86debc696295a0099ac1b Mon Sep 17 00:00:00 2001 From: Alejo Acosta Date: Tue, 7 May 2024 12:39:49 -0300 Subject: [PATCH] fix getaddressbalance req type and serialization --- pkg/qtum/rpc_types.go | 6 +++--- pkg/transformer/eth_getBalance.go | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/qtum/rpc_types.go b/pkg/qtum/rpc_types.go index 510c21bc..9f798767 100644 --- a/pkg/qtum/rpc_types.go +++ b/pkg/qtum/rpc_types.go @@ -1753,7 +1753,7 @@ type ( } */ GetAddressBalanceRequest struct { - Address string + Addresses []string `json:"addresses"` } GetAddressBalanceResponse struct { @@ -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) } diff --git a/pkg/transformer/eth_getBalance.go b/pkg/transformer/eth_getBalance.go index a4aa7249..2cb204b9 100644 --- a/pkg/transformer/eth_getBalance.go +++ b/pkg/transformer/eth_getBalance.go @@ -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 {