0.0.1 • Published 1 year ago

test-uat-mina-snap v0.0.1

Weekly downloads
-
License
(MIT-0 OR Apache-...
Repository
github
Last release
1 year ago

Mina Snap

This snap helps you interact with Mina protocol using Metamask Flask

Important

This snap only works with Metamask Flask. If you have normal Metamask enabled, please disable it and install Metamask Flask before using this snap.

Setup

yarn install

Building

Run yarn build to build this snap

Run yarn build:clean to remove old dist folder and re-build snap

Start local snap

Run yarn serve to start local snap

The snap will be running on http://localhost:8080. You can change port number in snap.config.js as well

Your DApp now can connect to the snap by calling wallet_requestSnaps method with http://localhost:8080 as the snapId

(Reference: https://docs.metamask.io/guide/snaps-rpc-api.html#wallet-requestsnaps)

Using published snap

Connect to the snap by calling wallet_requestSnaps method with npm:test-mina-snap as the snapId

Notes

  • Babel is used for transpiling TypeScript to JavaScript, so when building with the CLI, transpilationMode must be set to localOnly (default) or localAndDeps.
  • For the global wallet type to work, you have to add the following to your tsconfig.json:
    {
      "files": ["./node_modules/@metamask/snap-types/global.d.ts"]
    }
  • This snap uses a patched version of mina-signer. It may need to update if there's a new version of mina-signer. We are using this repo as the dependency http://www.github.com/sotatek-dev/mina-signer-for-snap

Methods

MethodDescription
mina_accountInfoGet current account info
mina_accountListReturn account list
mina_createAccountCreate new account
mina_changeAccountChange Address
mina_changeNetworkChange Network
mina_importAccountByPrivateKeyImport account by private key
mina_exportPrivateKeyReturn private key of the current account
mina_editAccountNameEdit account name
mina_networkConfigReturn current network config
mina_signMessageSign custom message
mina_sendPaymentTransfer Mina Token
mina_resetSnapConfigReset snap config to default
mina_getTxHistoryReturn transaction history by user address
mina_getTxDetailReturn transaction detail by transaction hash
mina_getTxStatusReturn transaciton status by transaction id
mina_sendStakeDelegationSend stake delegation
mina_verifyMessageVerify signed message
mina_requestNetworkRequest network