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

@solflare-wallet/sdk

Package Overview
Dependencies
Maintainers
7
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solflare-wallet/sdk

## Example

  • 1.4.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
49K
increased by17.42%
Maintainers
7
Weekly downloads
 
Created
Source

@solflare-wallet/sdk

Example

import Solflare from '@solflare-wallet/sdk';
import { Transaction } from '@solana/web3.js';

const wallet = new Solflare();

wallet.on('connect', () => console.log('connected', wallet.publicKey.toString()));
wallet.on('disconnect', () => console.log('disconnected'));

try {
  await wallet.connect();

  const signature = await wallet.signAndSendTransaction(new Transaction());

  const transaction = await wallet.signTransaction(new Transaction());

  const transactions = await wallet.signAllTransactions([ new Transaction(), new Transaction() ]);

  const encoder = new TextEncoder();
  const messageBytes = encoder.encode('Test message');
  const messageSignature = await wallet.signMessage(messageBytes, 'utf8');

  await wallet.disconnect();
} catch (err) {
  console.log(err);
}

API

class Solflare extends EventEmitter {
  publicKey: PublicKey | null;
  isConnected: boolean;
  connected: boolean; // for SOL Wallet Adapter compatibility
  autoApprove: boolean; // for SOL Wallet Adapter compatibility

  constructor(config: { network?: string });

  connect(): Promise<void>;
  disconnect(): Promise<void>;

  signAndSendTransaction(transaction: TransactionOrVersionedTransaction, options: SendOptions | undefined): Promise<string>;
  signTransaction(transaction: TransactionOrVersionedTransaction): Promise<TransactionOrVersionedTransaction>;
  signAllTransactions(transactions: TransactionOrVersionedTransaction[]): Promise<TransactionOrVersionedTransaction[]>;
  signMessage(data: Uint8Array, display: 'hex' | 'utf8' = 'utf8'): Promise<Uint8Array>;
  sign(data: Uint8Array, display: 'hex' | 'utf8' = 'utf8'): Promise<Uint8Array>; // for SOL Wallet Adapter compatibility
}

FAQs

Package last updated on 25 Jan 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