From 9afaab7deae1f1278751b7a2cb4e3a5bb8e2a439 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 20 Dec 2024 09:04:47 -0800 Subject: [PATCH 1/3] Remove eth_getAssetBalance API --- ethclient/ethclient.go | 8 -------- internal/ethapi/api.go | 12 ------------ 2 files changed, 20 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 5861210aca..3cb4e89036 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -467,14 +467,6 @@ func (ec *client) BalanceAt(ctx context.Context, account common.Address, blockNu return (*big.Int)(&result), err } -// AssetBalanceAt returns the [assetID] balance of the given account -// The block number can be nil, in which case the balance is taken from the latest known block. -func (ec *client) AssetBalanceAt(ctx context.Context, account common.Address, assetID ids.ID, blockNumber *big.Int) (*big.Int, error) { - var result hexutil.Big - err := ec.c.CallContext(ctx, &result, "eth_getAssetBalance", account, ToBlockNumArg(blockNumber), assetID) - return (*big.Int)(&result), err -} - // BalanceAtHash returns the wei balance of the given account. func (ec *client) BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error) { var result hexutil.Big diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 3b72aeae33..93aadbe14c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -35,7 +35,6 @@ import ( "strings" "time" - "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/coreth/accounts" "github.com/ava-labs/coreth/accounts/keystore" "github.com/ava-labs/coreth/accounts/scwallet" @@ -646,17 +645,6 @@ func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, return (*hexutil.Big)(b), state.Error() } -// GetAssetBalance returns the amount of [assetID] for the given address in the state of the -// given block number. The rpc.LatestBlockNumber, rpc.PendingBlockNumber, and -// rpc.AcceptedBlockNumber meta block numbers are also allowed. -func (s *BlockChainAPI) GetAssetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash, assetID ids.ID) (*hexutil.Big, error) { - state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) - if state == nil || err != nil { - return nil, err - } - return (*hexutil.Big)(state.GetBalanceMultiCoin(address, common.Hash(assetID))), state.Error() -} - // AccountResult structs for GetProof type AccountResult struct { Address common.Address `json:"address"` From 15378d3f61838df33767a0782b3e33324a0f1691 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 20 Dec 2024 09:07:23 -0800 Subject: [PATCH 2/3] update RELEASES.md --- RELEASES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index bbe2c02a09..b977d63812 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,7 +1,7 @@ # Release Notes ## [v0.14.1](https://github.com/ava-labs/coreth/releases/tag/v0.14.1) -- TBD +- Remove API eth_getAssetBalance that was used to query ANT balances (deprecated since v0.10.0) ## [v0.14.0](https://github.com/ava-labs/coreth/releases/tag/v0.14.0) - Minor version update to correspond to avalanchego v1.12.0 / Etna. From 1781eabbfe9142470c69fb6ce51606ca68907564 Mon Sep 17 00:00:00 2001 From: Darioush Jalali Date: Fri, 20 Dec 2024 09:08:52 -0800 Subject: [PATCH 3/3] remove from interface --- ethclient/ethclient.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 3cb4e89036..422cf37fcb 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -34,7 +34,6 @@ import ( "fmt" "math/big" - "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/coreth/accounts/abi/bind" "github.com/ava-labs/coreth/core/types" "github.com/ava-labs/coreth/interfaces" @@ -90,7 +89,6 @@ type Client interface { SubscribeNewHead(context.Context, chan<- *types.Header) (interfaces.Subscription, error) NetworkID(context.Context) (*big.Int, error) BalanceAt(context.Context, common.Address, *big.Int) (*big.Int, error) - AssetBalanceAt(context.Context, common.Address, ids.ID, *big.Int) (*big.Int, error) BalanceAtHash(ctx context.Context, account common.Address, blockHash common.Hash) (*big.Int, error) StorageAt(context.Context, common.Address, common.Hash, *big.Int) ([]byte, error) StorageAtHash(ctx context.Context, account common.Address, key common.Hash, blockHash common.Hash) ([]byte, error)