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

Displaying link to metamask page on install #7

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
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
Loading