Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove duplicate snap installation prompt in get-starknet if it has installed #407

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/get-starknet/src/snap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,15 +424,23 @@ export class MetaMaskSnap {
}

async installIfNot(): Promise<boolean> {
// if the snap is already installed, return true, to bypass the prompt
if (await this.isInstalled()) {
return true;
}

const response = (await this.#provider.request({
method: 'wallet_requestSnaps',
params: {
[this.#snapId]: { version: this.#version },
},
})) as RequestSnapResponse;

// if the snap installation is deined by end user, return false
if (!response?.[this.#snapId]?.enabled) {
return false;
}

return true;
}

Expand Down
Loading