Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@drift-labs/snap-wallet-adapter

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drift-labs/snap-wallet-adapter

A Solana Wallet Standard wallet adapter for the Connect by Drift MetaMask Snap.

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
185
increased by69.72%
Maintainers
6
Weekly downloads
 
Created
Source

@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.

FAQs

Package last updated on 16 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc