Class MeteorWallet

This class is used in conjunction with near-api-js and BrowserLocalStorageKeyStore. It directs users to the Meteor Extension or (if not available) a popup of the Meteor Wallet website for key management.

Example

import { MeteorWallet } from "@meteorwallet/sdk";

// create new MeteorWallet instance (passing in your initialized Near connection)
const meteorWallet = new MeteorWallet({ near: connectedNear, appKeyPrefix: 'my-app' });

// -- or -- (for a quick and default Near connection config)
const meteorWallet = MeteorWallet.init({ networkId: "testnet" });

// If not signed in, start the sign-in flow with Meteor Wallet.
// Keys will be stored in the BrowserLocalStorageKeyStore
if(!meteorWallet.isSignedIn()) {
const { accountId } = await meteorWallet.requestSignIn();
}

Hierarchy

  • MeteorWallet

Constructors

  • Construct MeteorWallet. If you'd a quick and default way, you can also use init

    Example

    // create new MeteorWallet instance (passing in your initialized Near connection)
    const meteorWallet = new MeteorWallet({ near: connectedNear, appKeyPrefix: 'my-app' });

    if(!meteorWallet.isSignedIn()) {
    const { accountId } = await meteorWallet.requestSignIn();
    }

    Parameters

    Returns MeteorWallet

Methods

  • getAccountId(): string
  • Returns authorized Account ID.

    Example

    const wallet = new MeteorWallet(near, 'my-app');
    const accountId = wallet.getAccountId();

    Returns string

  • isExtensionInstalled(): boolean
  • Returns boolean

  • isSignedIn(): boolean
  • Returns true, if this app is authorized with an account in the wallet.

    Example

    const wallet = new MeteorWallet({ near: connectedNear, appKeyPrefix: 'my-app' });
    wallet.isSignedIn();

    Returns boolean

  • Sign transactions using Meteor Wallet. Will return a promise with an array of FinalExecutionOutcome of the given transactions.

    Returns Promise<FinalExecutionOutcome[]>

  • signOut(): void
  • Sign out from the current account

    Returns void

  • The easiest way to set up the SDK. Returns an instance of MeteorWallet, automatically connected to the Near API.

    If you need more control over the Near Network configuration- rather use new MeteorWallet

    Example

    const wallet = await MeteorWallet.init({ networkId: "testnet" });
    

    Parameters

    Returns Promise<MeteorWallet>

Generated using TypeDoc