@amax/amaxsnap

0.0.5 • Public • Published

Amax MetaMask Snap

Manage your account, tokens and NFTs and access DAPPs (xChain, Swap, TrueDEX etc.) of Armonia Meta Chain from your MetaMask EVM wallet.

Install & Initialize

// Check if the Snap is installed
let result = await window.ethereum.request({ method: 'wallet_getSnaps' });
const installed = Object.keys(result).includes("npm:@amax/amaxsnap");

// Install Snap
if (!installed) {
    const result = await window.ethereum.request({
        method: 'wallet_requestSnaps',
        params: {
            'npm:@amax/amaxsnap': {
            version: '^0.0.5', // please select last version
            },
        },
    });
}

Get Accounts

await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
        snapId: 'npm:@amax/amaxsnap',
        request: {
            method: 'getAccounts',
            params: {
                paths: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 100] // get accounts by derive path 
            }
        },
    },
});

Sign or Push Transaction

await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
        snapId: 'npm:@amax/amaxsnap',
        request: {
            method: 'signTransaction',
            params: {
              actions: [], // action array
              network: '', // network
              path: 0, // signer derive path 
              transactConfig: { // config: @amax/amaxjs-v2/dist/eosjs-api-interfaces
                 broadcast: false,
                 ...
              } 
            },
        },
    },
});

Sign Message

await window.ethereum.request({
    method: 'wallet_invokeSnap',
    params: {
        snapId: 'npm:@amax/amaxsnap',
        request: {
            method: 'signMessage',
            params: {
              message: '', // sign string
              path: 0, // signer derive path 
            },
        },
    },
});

Readme

Keywords

none

Package Sidebar

Install

npm i @amax/amaxsnap

Weekly Downloads

568

Version

0.0.5

License

(MIT-0 OR Apache-2.0)

Unpacked Size

4 MB

Total Files

8

Last publish

Collaborators

  • armoniametachain