0.3.0 • Published 6 days ago

@drift-labs/snap-wallet-adapter v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 days ago

@drift-labs/snap-wallet-adapter

This is a wallet adapter for the Connect by Drift MetaMask Snap that implements the Solana Wallet Standard. Installing and adding this snap to your application gives your users the ability to use MetaMask to interact with Solana!

Snap Version: 0.3.0

The wallet adapter is locked to this version of the Connect by Drift snap.

Installation

To install: npm install --save @drift-labs/snap-wallet-adapter

To use the adapter in your application, create a new wallet adapter using the SnapWalletAdapter constructor that is exported from this package:

import { SnapWalletAdapter } from '@drift-labs/snap-wallet-adapter';

const driftSnapWalletAdapter = new SnapWalletAdapter();

To listen to events and connect, use the same interface as other Wallet Standard adapters:

  driftSnapWalletAdapter.on('connect', handleConnect);
  driftSnapWalletAdapter.on('disconnect', handleDisconnect);
  driftSnapWalletAdapter.on('error', handleError);

  await driftSnapWAlletAdapter.connet();

To display the name of the adapter and the icon you can use the icon and name properties of the wallet adapter instance (react example):

const jsx = (
  <div>
    <img src={driftSnapWalletAdapter.icon} />
    {driftSnapWalletAdapter.name}
  </div>
);

This allows the snap wallet adapter instance to be appended to an array of other Wallet Standard adapters, and seamlessly be displayed and interacted with without code changes.

The icon will display the MetaMask icon, and the name will disply as Connect by Drift which is the name of the snap.

When the user connects to this wallet, MetaMask will open and either directly connect to the Connect by Drift snap, or will prompt the user to install the Connect by Drift snap if they haven't done so before.

0.3.0

6 days ago

0.2.5

22 days ago

0.2.4

6 months ago

0.2.3

6 months ago

0.2.2

8 months ago

0.2.1

9 months ago