-
Notifications
You must be signed in to change notification settings - Fork 288
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
AccountInterface methods should be async #11078
Comments
const provider = new ethers.JsonRpcProvider(...);
const signer = await provider.getSigner();
signer.address // type: string The reason is that the address of the account should be fixed to avoid problems with user switching accounts. I.e., it should NOT be possible to have this code fail: const signer = await provider.getSigner();
const currentAddress = signer.address;
// user switches accounts in wallet UI
await sleep(10_000);
assert(signer.address === currentAddress); // should never fail |
@twt-- do you need all methods or are |
I would prefer everything be async - having it consistent for everything in that interface would be nice, and that would also mean i don't have to throw an error if i haven't managed to cache the value yet! to @olehmisar's point, my use case is a bit different, but i don't necessarily disagree... I want to prompt the user to ask if they are willing to share the address, and if not, throw an error (or send a fake address), and after that it will always resolve to the same value. Having everything async would make it a lot easier to handle. thanks! |
@twt-- it should happen when you request the account ( |
@olehmisar I get what you're saying, but it also sounds like you're making different assumptions about the intent of the interfaces/types than I am. |
@twt-- I am making a point that |
Why? I was planning on having a Perhaps this speaks to a larger issue: maybe the |
@twt-- it's to make code less error-prone. One instance of Also, looks like the ecosystem as a whole is aligned with my vision (ethers, viem). So, unless there is a reason to move away from the standard, I wouldn't do it |
Right, one instance of
I disagree, but I think this is a jargon/naming problem, not an actual disagreement. Viem supports the concept of a Wallet without an account, and also has async The single, static address is an add-on, not a defining characteristic, of a more generic "wallet". In Viem the static address add-on is called an |
Let's get terminology defined:
it's fine for wallets to have multiple addresses but not for accounts. |
I am attempting to build a @aztec/aztec.js
Wallet
that uses a remote implementation on a separate web site for all of its functionality.The
AccountInterface
method definitions are all synchronous, unlike everything else in the wallet/account interfaces which are async. Can you switchAccountInterface
methods to be async?The text was updated successfully, but these errors were encountered: