diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index e018fb9..b048954 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/@greymass/antelope-snap.git" }, "source": { - "shasum": "ZRXhKVwCKT0RTuBwE7IcYbge2YkMkQ5ogyteqFnmuwc=", + "shasum": "S3lSL22yC9SssAHUsf+6Evsbpd/kufVgjBPlFHm5Vps=", "location": { "npm": { "filePath": "dist/bundle.js", @@ -20,6 +20,7 @@ "initialPermissions": { "snap_dialog": {}, "endowment:network-access": {}, + "endowment:lifecycle-hooks": {}, "endowment:rpc": { "dapps": true, "snaps": false diff --git a/packages/snap/src/index.ts b/packages/snap/src/index.ts index 69f9a28..b3febc1 100644 --- a/packages/snap/src/index.ts +++ b/packages/snap/src/index.ts @@ -1,11 +1,38 @@ import { type OnRpcRequestHandler, + type OnInstallHandler, MethodNotFoundError, + text, + panel, } from '@metamask/snaps-sdk'; import { getPublicKey, signTransaction } from './rpc'; import { AntelopeRequest, AntelopeSignatureRequest } from './types'; +const SNAP_NAME = 'Antelope MetaMask'; +const HELP_URL = 'https://unicove.com/eos/metamask'; + +/** + * Handle the installation of the snap. + * + * @returns A confirmation message to the user. + */ +export const onInstall: OnInstallHandler = async () => { + console.log('onINSTALL'); + await snap.request({ + method: 'snap_dialog', + params: { + type: 'alert', + content: panel([ + text(`Welcome to the ${SNAP_NAME} Snap!`), + text( + `For help setting up an account, please visit our [MetaMask setup page](${HELP_URL}).`, + ), + ]), + }, + }); +}; + /** * Handle incoming JSON-RPC requests, sent through `wallet_invokeSnap`. *