Replies: 2 comments 1 reply
-
|
Does MetaMask offer an API (via JSON-RPC)? I don’t know of any yet, but if one exists I can add the convenience method. If they provide an API, you can also just the raw But I don’t believe there is any plan for them to expose a public API that can be used by dapps. There is a lot of security and predictability issues with a standard wallet allowing Auth transactions (could render the wallet unusable, might break UX and nonce calculations, etc), so I don’t think that will be common. If you have a private key that you want to authorize, you would use that private key to authorize and then pass that to the authorization in a separate tx, possibly to MetaMask. I’m actually not sure if MetaMask even allows 7702 transactions, but if you try it out, please report back here. :) |
Beta Was this translation helpful? Give feedback.
-
|
@ricmoo This is an example from Metamask on how to run EIP7702 transaction with Viem. From what I understand they only allow their delegator to be used: I'm trying to implement the const provider = new BrowserProvider(...);
const signer = provider.getSigner();
const auth = {
address: metaMaskEip7702Delegator,
nonce,
chainId
};
// signer.authorize(auth); // not working
// Workaround (not working either ^^)
const signature = await signer.signMessage(hashAuthorization(auth));
const signedAuthorization = {
address: getAddress(auth.address),
nonce: getBigInt(auth.nonce || 0),
chainId: getBigInt(auth.chainId || 0),
signature
};
signer.sendTransaction({
...tx,
type: 4,
authorizationList: [signedAuthorization],
}); |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have a requirement to sign the authorization for EIP7702 with metamask (revoke delegation), but I get the error: authorization not implemented for this signer (operation="authorize", code=UNSUPPORTED_OPERATION, version=6.15.0)
Is there any way to sign authorization payload to be sent through another address using browser provider?
Beta Was this translation helpful? Give feedback.
All reactions