Skip to content

Support getAccount mode #47

Open
@mattsse

Description

@mattsse

with alloy-rs/alloy#2402 we have a way to fetch the entire account info which would do these 3 requests

let balance = provider.get_balance(address).block_id(block_id).into_future();
let nonce = provider.get_transaction_count(address).block_id(block_id).into_future();
let code = provider.get_code_at(address).block_id(block_id).into_future();

in one request

however this isn't supported by all clients, so we need to introduce some kind of

enum GetAccountMode {
    /// The provider supports `eth_getAccountInfo`
    EthGetAccountInfo,
    /// It doesn't support, and we have to fetch balance, nonce, and code concurrently
    AccountCodeNonce,
}

and the first time we send an account request we try to also fetch the acc info via eth_getAccountInfo if this doesn't return an error we can use this fn for future requests

TODO

  • add mode enum
  • implement this logic, so we need to track the state wich mode should be used in the BackendHandler type

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions