Skip to content

Commit

Permalink
fix: faulty window access mm-snap (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsimao authored Oct 9, 2024
1 parent a3b24a1 commit f473d23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-phones-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gobob/sats-wagmi": patch
---

fix: faulty window access mm-snap
8 changes: 3 additions & 5 deletions packages/sats-wagmi/src/connectors/mm-snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ declare global {
}
}

const { ethereum } = window;

const snapId = 'npm:@gobob/bob-snap';

// TODO: distinguish between payment and ordinals address
Expand All @@ -101,7 +99,7 @@ class MMSnapConnector extends SatsConnector {

async connect(): Promise<void> {
try {
const result: any = await ethereum.request({
const result: any = await window.ethereum.request({
method: 'wallet_requestSnaps',
params: {
[snapId]: {
Expand Down Expand Up @@ -132,7 +130,7 @@ class MMSnapConnector extends SatsConnector {
}

async isReady(): Promise<boolean> {
const snaps = await ethereum.request({
const snaps = await window.ethereum.request({
method: 'wallet_getSnaps'
});

Expand Down Expand Up @@ -269,7 +267,7 @@ class MMSnapConnector extends SatsConnector {
errMsg: string;
}): Promise<T> {
try {
return (await ethereum.request({
return (await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId,
Expand Down

0 comments on commit f473d23

Please sign in to comment.