Skip to content

reef-chain/metamask-snap

Repository files navigation

Reef Chain Wallet Snap

The Reef Chain Wallet Snap allows users to interact with the Reef Chain using MetaMask.

API

The Reef Chain Wallet Snap provides a set of custom end-points that can be accessed with the wallet_invokeSnap MetaMask method.

Example of use:

await window.ethereum.request({
  "method": "wallet_invokeSnap",
  "params": [
    {
      "snapId": "npm:@reef-chain/reef-snap",
      "request": {
        "method": "selectNetwork",
        "params": {
          "network": "mainnet"
        }
      }
    }
  ]
});
Method Params Returns Description
getNetwork { network: string, rpcUrl: string } Returns the current network.
selectNetwork { network: string } { name: string, rpcUrl: string } Selects the network to use.
createSeed { address: string, seed: string } Generates a 12-word mnemonic and its associated Reef native address.
createAccountWithSeed { seed: string, name: string } { address: string } Creates a Reef account from a 12-word mnemonic.
renameAccount { addressRename: string, name: string } boolean Renames an account.
importAccount { json: string, password: string } boolean Imports an account from a backup JSON file.
exportAccount { addressExport: string, passwordExport: string } JSON Exports an account to a backup JSON file.
forgetAccount { addressForget: string } boolean Removes an account from the wallet.
listAccounts { address: string, name: string, isSelected: boolean }[] Lists all accounts in the wallet.
selectAccount { addressSelect: string } boolean Selects an account to use.
requestSignature SignerPayloadJSON | SignerPayloadRaw { signature: string } Requests a signature for a transaction or a raw message. This method is meant to be called by the signer implementation.
getMetadata { genesisHash: string} MetadataDef Returns the metadata of a network.
listMetadata MetadataDef[] Lists all available metadata definitions.
provideMetadata MetadataDef boolean Provides a metadata definition.

Development

This project has been created from the MetaMask template-snap-monorepo repository.

For more information about Snap development see the MetaMask documentation.

Getting Started

Set up the development environment:

yarn install && yarn start

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT-0 licenses found

Licenses found

Apache-2.0
LICENSE.APACHE2
MIT-0
LICENSE.MIT0

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published