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 3 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": "ZRXhKVwCKT0RTuBwE7IcYbge2YkMkQ5ogyteqFnmuwc=",
"shasum": "DO2u8z8wwHC+xK77dt/oD+F7tAyOPyP2c1hbRsRif4c=",
"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 = 'Antelope MetaMask';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be "EOS Wallet" I believe.

While the plugin itself is generally Antelope-compatible, the release I think we will do is EOS-focused, and to line up with the other Snaps, we can just call them "CHAIN Wallet".

I'm not sure if there are other places in the app that call it an "Antelope" product, but if there are - if we could make them all reference this variable (to easily rename the release), that'd be awesome

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the snap 👍 The other place where Antelope is used is in the package name which is currently @greymass/antelope-snap. I guess that should be @greymass/eos-snap as we'll probably need a different repo for each chain? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense. I renamed the repo to:

https://github.com/greymass/eos-wallet-snap

Yeah we may need a repo for each chain. Unsure of what the best structure is. We could:

  • Clone this codebase a number of times, once for each chain
  • Use branches on this repo, one branch for each chain
  • Setup one core Antelope repo, and then make a fork for each chain

That last option could be the best? It would let us pull changes from upstream (the Antelope repo) into each chain repo, as changes become available.

Copy link
Contributor Author

@dafuga dafuga Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree that using branches may be the easiest. If we go that route then should we rename the repo to @greymass/antelope-snap?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one argument I can think of for using forks instead of branches would be more fine grained permissions, like if we wanted to be able to allow specific collaborators from specific chains.

Another argument might be around CI/CD, if we want to go that route 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The advantage of going the branch route is that we won't have to worry about having to explain why we have different packages to the consensys folks.

They have to be different packages no matter what we do. Did you mean different repositories?

It also might be just as confusing to them to have one repo with different branches 😓

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sorry, I meant repositories. I think that sticking with the single repository that was already audited will be simpler than trying to submit a fork of a repository that was audited.

Copy link
Contributor Author

@dafuga dafuga Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm not against submitting a fork and seeing if it works though. I could be overthinking this 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, we agree that we should rename this repo to greymass/antelope-snap? From there, we could either create a new branch or fork for each new network wallet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll rename it back to what it was - and we can create a branch.

The audit also specifically says greymass/antelope-snap, and even renaming it might cause some confusion.

The package we release however should be named eos-wallet (or similar) when we publish to NPM/etc.

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