diff --git a/.changeset/pretty-phones-worry.md b/.changeset/pretty-phones-worry.md new file mode 100644 index 0000000..bd57977 --- /dev/null +++ b/.changeset/pretty-phones-worry.md @@ -0,0 +1,5 @@ +--- +"@gobob/sats-wagmi": patch +--- + +fix: faulty window access mm-snap diff --git a/packages/sats-wagmi/src/connectors/mm-snap.ts b/packages/sats-wagmi/src/connectors/mm-snap.ts index 857c782..ef6835e 100644 --- a/packages/sats-wagmi/src/connectors/mm-snap.ts +++ b/packages/sats-wagmi/src/connectors/mm-snap.ts @@ -82,8 +82,6 @@ declare global { } } -const { ethereum } = window; - const snapId = 'npm:@gobob/bob-snap'; // TODO: distinguish between payment and ordinals address @@ -101,7 +99,7 @@ class MMSnapConnector extends SatsConnector { async connect(): Promise { try { - const result: any = await ethereum.request({ + const result: any = await window.ethereum.request({ method: 'wallet_requestSnaps', params: { [snapId]: { @@ -132,7 +130,7 @@ class MMSnapConnector extends SatsConnector { } async isReady(): Promise { - const snaps = await ethereum.request({ + const snaps = await window.ethereum.request({ method: 'wallet_getSnaps' }); @@ -269,7 +267,7 @@ class MMSnapConnector extends SatsConnector { errMsg: string; }): Promise { try { - return (await ethereum.request({ + return (await window.ethereum.request({ method: 'wallet_invokeSnap', params: { snapId,