Skip to content

Commit 4d96ada

Browse files
committed
Adds Get Address BEP20 Token Holding for bscscan
1 parent 4bf649f commit 4d96ada

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

account.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,15 @@ func (c *Client) TokenBalance(contractAddress, address string) (balance *BigInt,
144144
err = c.call("account", "tokenbalance", param, &balance)
145145
return
146146
}
147+
148+
// AddressTokenBalance gets the BEP-20 tokens and amount held by an address.
149+
func (c *Client) AddressTokenBalance(address string, page int, offset int) (balance []TokenBalance, err error) {
150+
param := M{
151+
"address": address,
152+
"page": page,
153+
"offset": offset,
154+
}
155+
156+
err = c.call("account", "addresstokenbalance", param, &balance)
157+
return
158+
}

response.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ type AccountBalance struct {
2525
Balance *BigInt `json:"balance"`
2626
}
2727

28+
// TokenBalance token and its balance in pair
29+
type TokenBalance struct {
30+
TokenContractAddress string `json:"token_contract_address"`
31+
Balance *BigInt `json:"balance"`
32+
}
33+
2834
// NormalTx holds info from normal tx query
2935
type NormalTx struct {
3036
BlockNumber int `json:"blockNumber,string"`

0 commit comments

Comments
 (0)