Socket
Socket
Sign inDemoInstall

@solana/wallet-adapter-base

Package Overview
Dependencies
Maintainers
11
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/wallet-adapter-base - npm Package Compare versions

Comparing version 0.8.1 to 0.9.0

lib/cjs/adapter.d.ts

23

package.json
{
"name": "@solana/wallet-adapter-base",
"version": "0.8.1",
"version": "0.9.0",
"author": "Solana Maintainers <maintainers@solana.foundation>",

@@ -9,4 +9,9 @@ "repository": "https://github.com/solana-labs/wallet-adapter",

"sideEffects": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/esm/index.d.ts",
"exports": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
},
"files": [

@@ -22,14 +27,10 @@ "lib",

"clean": "shx rm -rf lib/*",
"build": "yarn clean && tsc"
"build": "yarn clean && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"postbuild": "echo '{\"type\":\"commonjs\"}' | npx json > lib/cjs/package.json && echo '{\"type\":\"module\"} ' | npx json > lib/esm/package.json"
},
"peerDependencies": {
"@solana/web3.js": "^1.20.0"
},
"dependencies": {
"@solana/web3.js": "^1.20.0",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@solana/web3.js": "^1.20.0"
},
"gitHead": "c118a6597db711e8a1f89f3f47accd4de6d5aaf6"
"gitHead": "d26322bf91216583bcb983dab677f000c2c2d941"
}

@@ -8,5 +8,6 @@ import { Connection, PublicKey, SendOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js';

export interface WalletAdapterEvents {
connect(): void;
connect(publicKey: PublicKey): void;
disconnect(): void;
error(error: WalletError): void;
readyStateChange(readyState: WalletReadyState): void;
}

@@ -18,3 +19,11 @@

// WalletName is a nominal type that wallet adapters should use, e.g. `'MyCryptoWallet' as WalletName`
// https://medium.com/@KevinBGreene/surviving-the-typescript-ecosystem-branding-and-type-tagging-6cf6e516523d
export type WalletName = string & { __brand__: 'WalletName' };
export interface WalletAdapterProps {
name: WalletName;
url: string;
icon: string;
readyState: WalletReadyState;
publicKey: PublicKey | null;

@@ -24,3 +33,2 @@ connecting: boolean;

ready(): Promise<boolean>;
connect(): Promise<void>;

@@ -37,3 +45,36 @@ disconnect(): Promise<void>;

/**
* A wallet's readiness describes a series of states that the wallet can be in,
* depending on what kind of wallet it is. An installable wallet (eg. a browser
* extension like Phantom) might be `Installed` if we've found the Phantom API
* in the global scope, or `NotDetected` otherwise. A loadable, zero-install
* runtime (eg. Torus Wallet) might simply signal that it's `Loadable`. Use this
* metadata to personalize the wallet list for each user (eg. to show their
* installed wallets first).
*/
export enum WalletReadyState {
/**
* User-installable wallets can typically be detected by scanning for an API
* that they've injected into the global context. If such an API is present,
* we consider the wallet to have been installed.
*/
Installed = 'Installed',
NotDetected = 'NotDetected',
/**
* Loadable wallets are always available to you. Since you can load them at
* any time, it's meaningless to say that they have been detected.
*/
Loadable = 'Loadable',
/**
* If a wallet is not supported on a given platform (eg. server-rendering, or
* mobile) then it will stay in the `Unsupported` state.
*/
Unsupported = 'Unsupported',
}
export abstract class BaseWalletAdapter extends EventEmitter<WalletAdapterEvents> implements WalletAdapter {
abstract name: WalletName;
abstract url: string;
abstract icon: string;
abstract readyState: WalletReadyState;
abstract publicKey: PublicKey | null;

@@ -46,3 +87,2 @@ abstract connecting: boolean;

abstract ready(): Promise<boolean>;
abstract connect(): Promise<void>;

@@ -57,6 +97,13 @@ abstract disconnect(): Promise<void>;

export enum WalletAdapterNetwork {
Mainnet = 'mainnet-beta',
Testnet = 'testnet',
Devnet = 'devnet',
export function scopePollingDetectionStrategy(performDetection: () => boolean): void {
if (typeof window === 'undefined' || typeof document === 'undefined') return;
if (document.readyState === 'complete') {
performDetection();
return;
}
function listener() {
window.removeEventListener('load', listener);
performDetection();
}
window.addEventListener('load', listener);
}
export * from './adapter';
export * from './errors';
export * from './signer';
export * from './wallet';
export * from './types';

@@ -21,4 +21,5 @@ import { Connection, Transaction, TransactionSignature } from '@solana/web3.js';

try {
transaction.feePayer ||= this.publicKey || undefined;
transaction.recentBlockhash ||= (await connection.getRecentBlockhash('finalized')).blockhash;
transaction.feePayer = transaction.feePayer || this.publicKey || undefined;
transaction.recentBlockhash =
transaction.recentBlockhash || (await connection.getRecentBlockhash('finalized')).blockhash;

@@ -25,0 +26,0 @@ const { signers, ...sendOptions } = options;

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