MetaMask / snaps

Extend the functionality of MetaMask using Snaps
https://metamask.io/snaps/
Other
711 stars 546 forks source link

Error for invoke-snap example #2365

Open huweihong opened 2 months ago

huweihong commented 2 months ago

I installed two snaps in https://github.com/MetaMask/snaps/tree/main/packages/examples/packages/invoke-snap and using the following code to revoke @metamask/consumer-signer-example-snap, but there is the same error as https://github.com/MetaMask/snaps/issues/2340 :

 await window.ethereum.request({
    method: 'wallet_requestSnaps',
    params: {
      'npm:@metamask/consumer-signer-example-snap': {},
    },
  });

  const response = await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
      snapId: 'npm:@metamask/consumer-signer-example-snap',
      request: {
        method: 'signMessage',
        params: { message: 'test' },
      },
    },
  });
image
Montoya commented 2 months ago

Both Snaps need to be installed into your MetaMask Flask and then one Snap needs to call wallet_requestSnaps to the other Snap to get permission to communicate with it.