Skip to content

Commit

Permalink
Merge pull request #7 from greymass/displaying-link-to-metamask-page
Browse files Browse the repository at this point in the history
Displaying link to metamask page on install
  • Loading branch information
aaroncox authored Nov 6, 2024
2 parents 8c6c780 + 1152ed5 commit 8dd8f22
Show file tree
Hide file tree
Showing 2 changed files with 28 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": "iEJ7CemKEeAOmtZ498XwcHFmbbvt03stmFemnlNXPe0=",
"shasum": "z/QPz6VfJGBcZasdKxKYS59JsqR02aco3e9O1n1MkvQ=",
"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
26 changes: 26 additions & 0 deletions packages/snap/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
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 = 'EOS Wallet';
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 () => {
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 8dd8f22

Please sign in to comment.