Esc

Quickstart

@megaeth-labs/wallet-sdk@megaeth-labs/wallet-sdk-react

Install#

MOSS provides different SDKs depending on your environment: Pure JS, React and a Wagmi connector. Each SDK is available via NPM and support all functionality.

npm install @megaeth-labs/wallet-sdk

Initialise#

Once installed, the wallet must be initialised before calling the SDK functionality. This differs depending on the SDK being used.

import { mega } from '@megaeth-labs/wallet-sdk';

const status = await mega.initialise({
    network: 'testnet'
});

Learn more

Status#

Check the current connection status on loading your app either from the response of initialise, a call to the status method or the React hook useStatus.

import { mega } from '@megaeth-labs/wallet-sdk';

const { status, address, network } = await mega.status();
Runs on testnet with your wallet

Learn more

Connect#

Trigger the connect flow for a user to create a new wallet or restore an existing one.

import { mega } from '@megaeth-labs/wallet-sdk';

const { status, address } = await mega.connect();

if (status === 'connected') {
    console.log('Wallet connected:', address);
}
Runs on testnet with your wallet