-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
An Account Request
popup is triggered every time the metamask signer calls Signer.publicKey
to retrieve the users pubkey. There can be 2 of these when submitting a transaction resulting in 3 prompts to sign a transactions.
The Account Request
prompt was added due to an action item resulting from the audit - we need to explicitly ask the users permission to access their public key.
We could cache the account details on first call instead of prompting the user every time. This is an example provided to nebula team:
export const cachedMetaMask = (opts: MetaMaskSnapSignerOpt): Signer => {
const base = newMetaMaskSnapSigner(opts);
let cachedPubKey: Uint8Array | undefined = undefined;
return {
...base,
async publicKey() {
if (cachedPubKey) {
return cachedPubKey;
}
cachedPubKey = await base.publicKey();
return cachedPubKey;
},
};
};
While this works it won't be cached across page navigation so could still result in an annoying amount of prompts, might be better to also store the key in local storage.
Metadata
Metadata
Assignees
Labels
No labels