Skip to content

Support getAccount mode #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mattsse opened this issue May 10, 2025 · 1 comment · May be fixed by #48
Open

Support getAccount mode #47

mattsse opened this issue May 10, 2025 · 1 comment · May be fixed by #48
Assignees

Comments

@mattsse
Copy link
Member

mattsse commented May 10, 2025

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
@Rimeeeeee
Copy link

May I look into this :)

@DaniPopes DaniPopes changed the title Suppert getAccount mode Support getAccount mode May 10, 2025
@Rimeeeeee Rimeeeeee linked a pull request May 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants