Skip to content

Commit

Permalink
enhancement: displaying link to metamask page on install
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Aug 22, 2024
1 parent 6e8d2f1 commit 7ffd33d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -20,6 +20,7 @@
"initialPermissions": {
"snap_dialog": {},
"endowment:network-access": {},
"endowment:lifecycle-hooks": {},
"endowment:rpc": {
"dapps": true,
"snaps": false
Expand Down
27 changes: 27 additions & 0 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
@@ -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`.
*
Expand Down

0 comments on commit 7ffd33d

Please sign in to comment.