Socket
Socket
Sign inDemoInstall

@solana/wallet-adapter-base

Package Overview
Dependencies
Maintainers
14
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.9.6 to 0.9.7

21

lib/cjs/adapter.js
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -9,2 +18,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

exports.EventEmitter = eventemitter3_1.default;
const errors_1 = require("./errors");
/**

@@ -43,2 +53,13 @@ * A wallet's readiness describes a series of states that the wallet can be in,

}
prepareTransaction(transaction, connection) {
return __awaiter(this, void 0, void 0, function* () {
const publicKey = this.publicKey;
if (!publicKey)
throw new errors_1.WalletNotConnectedError();
transaction.feePayer = transaction.feePayer || publicKey;
transaction.recentBlockhash =
transaction.recentBlockhash || (yield connection.getRecentBlockhash('finalized')).blockhash;
return transaction;
});
}
}

@@ -45,0 +66,0 @@ exports.BaseWalletAdapter = BaseWalletAdapter;

6

lib/cjs/signer.js

@@ -32,5 +32,3 @@ "use strict";

try {
transaction.feePayer = transaction.feePayer || this.publicKey || undefined;
transaction.recentBlockhash =
transaction.recentBlockhash || (yield connection.getRecentBlockhash('finalized')).blockhash;
transaction = yield this.prepareTransaction(transaction, connection);
const { signers } = options, sendOptions = __rest(options, ["signers"]);

@@ -44,3 +42,3 @@ (signers === null || signers === void 0 ? void 0 : signers.length) && transaction.partialSign(...signers);

// If the error was thrown by `signTransaction`, rethrow it and don't emit a duplicate event
if (error instanceof errors_1.WalletError) {
if (error instanceof errors_1.WalletSignTransactionError) {
emit = false;

@@ -47,0 +45,0 @@ throw error;

@@ -69,3 +69,4 @@ import { Connection, PublicKey, SendOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js';

abstract sendTransaction(transaction: Transaction, connection: Connection, options?: SendTransactionOptions): Promise<TransactionSignature>;
protected prepareTransaction(transaction: Transaction, connection: Connection): Promise<Transaction>;
}
export declare function scopePollingDetectionStrategy(detect: () => boolean): void;
{
"name": "@solana/wallet-adapter-base",
"version": "0.9.6",
"version": "0.9.7",
"author": "Solana Maintainers <maintainers@solana.foundation>",

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

},
"gitHead": "b4e2ac67dab0d8dadb4b0d49a456c63aa29b5663"
"gitHead": "3647ee8dbe5f19aa4821dd97e58b0be02ae50646"
}
import { Connection, PublicKey, SendOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js';
import EventEmitter from 'eventemitter3';
import { WalletError } from './errors';
import { WalletError, WalletNotConnectedError } from './errors';

@@ -90,2 +90,13 @@ export { EventEmitter };

): Promise<TransactionSignature>;
protected async prepareTransaction(transaction: Transaction, connection: Connection): Promise<Transaction> {
const publicKey = this.publicKey;
if (!publicKey) throw new WalletNotConnectedError();
transaction.feePayer = transaction.feePayer || publicKey;
transaction.recentBlockhash =
transaction.recentBlockhash || (await connection.getRecentBlockhash('finalized')).blockhash;
return transaction;
}
}

@@ -92,0 +103,0 @@

import { Connection, Transaction, TransactionSignature } from '@solana/web3.js';
import { BaseWalletAdapter, SendTransactionOptions, WalletAdapter } from './adapter';
import { WalletError, WalletSendTransactionError } from './errors';
import { WalletError, WalletSendTransactionError, WalletSignTransactionError } from './errors';

@@ -21,8 +21,5 @@ export interface SignerWalletAdapterProps {

try {
transaction.feePayer = transaction.feePayer || this.publicKey || undefined;
transaction.recentBlockhash =
transaction.recentBlockhash || (await connection.getRecentBlockhash('finalized')).blockhash;
transaction = await this.prepareTransaction(transaction, connection);
const { signers, ...sendOptions } = options;
signers?.length && transaction.partialSign(...signers);

@@ -37,3 +34,3 @@

// If the error was thrown by `signTransaction`, rethrow it and don't emit a duplicate event
if (error instanceof WalletError) {
if (error instanceof WalletSignTransactionError) {
emit = false;

@@ -40,0 +37,0 @@ throw error;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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