Open noahsilencelab opened 3 months ago
Hi, please update your dapp connect code to use a string as the key for the Snap ID instead of an array, like so:
await window.ethereum.request({
"method": "wallet_requestSnaps",
"params": [
{
`${SNAP_ID}`: {
"version": `^${snapVersion}`
}
}
]
});
Please let me know if you still see the error after making this change.
Hi, its not an array but a Computed property names syntax. It's actually a string key.
What is the value of SNAP_ID? Usually this error is the result of an invalid ID.
The value of SNAP_ID local:http://localhost:8080
And just to be certain, snapVersion
is resolving to a string?
snapVersion
is an empty string in this case
Hmmm... what happens if you remove it entirely? Just:
return await provider.request({
method: 'wallet_requestSnaps',
params: {
[SNAP_ID]: {},
} as any,
});
Also, sorry, I'm noticing one other things that may or may not be an issue, we have params
for wallet_requestSnaps
as an array of objects in our docs, may be just optional but you can try:
return await provider.request({
method: 'wallet_requestSnaps',
params: [ {
[SNAP_ID]: {},
} ] as Array<any>,
});
If I have params
as an array, I will face the error '"params" must be an object.'
Hmmm... what happens if you remove it entirely? Just:
The same error happened.
RPC Error: Expected caveat to have a value property of a non-empty object of snap IDs.: At path: value.type -- Expected the value to satisfy a union of
intersection | string, but received: "type".
Hi team,
Today, I tried your new feature https://docs.metamask.io/snaps/how-to/allow-automatic-connections/ but immediately got some weird error that I couldn't debug myself. Please shed some light for my debugging. The error is thrown after I send RPC
wallet_requestSnaps
like below:The error:
Environment:
Metamask dependencies
package.json
:Snap Manifest: