Socket
Socket
Sign inDemoInstall

@marinade.finance/web3js-common

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marinade.finance/web3js-common - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

6

package.json
{
"name": "@marinade.finance/web3js-common",
"version": "2.1.2",
"version": "2.1.3",
"description": "Web3 JS reusable utilities",

@@ -25,3 +25,3 @@ "repository": {

"@solana/web3.js": "^1.78.5",
"@marinade.finance/ts-common": "2.1.2",
"@marinade.finance/ts-common": "2.1.3",
"bn.js": "^5.2.1",

@@ -33,3 +33,3 @@ "borsh": "^0.7.0",

"@solana/web3.js": "^1.78.5",
"@marinade.finance/ts-common": "2.1.2",
"@marinade.finance/ts-common": "2.1.3",
"bn.js": "^5.2.1",

@@ -36,0 +36,0 @@ "borsh": "^0.7.0",

@@ -1,5 +0,9 @@

import { Connection, Transaction, VersionedTransactionResponse, SimulatedTransactionResponse, Keypair, Signer, TransactionInstruction, TransactionResponse, PublicKey, SendOptions, VersionedTransaction } from '@solana/web3.js';
import { Connection, Transaction, VersionedTransactionResponse, SimulatedTransactionResponse, Keypair, Signer, TransactionInstruction, TransactionResponse, PublicKey, SendOptions, VersionedTransaction, Commitment } from '@solana/web3.js';
import { Wallet } from './wallet';
import { LoggerPlaceholder } from '@marinade.finance/ts-common';
export declare function executeTx({ connection, transaction, signers, errMessage, simulate, printOnly, logger, sendOpts, }: {
export type ConfirmTransactionOptions = {
commitment?: Commitment;
timeoutMs?: number;
};
export declare function executeTx({ connection, transaction, signers, errMessage, simulate, printOnly, logger, sendOpts, confirmOpts, }: {
connection: Connection;

@@ -13,4 +17,6 @@ transaction: Transaction;

sendOpts?: SendOptions;
confirmOpts?: ConfirmTransactionOptions;
}): Promise<VersionedTransactionResponse | SimulatedTransactionResponse | undefined>;
export declare function executeTxSimple(connection: Connection, transaction: Transaction, signers?: (Wallet | Keypair | Signer)[], sendOpts?: SendOptions): Promise<VersionedTransactionResponse | SimulatedTransactionResponse | undefined>;
export declare function executeTxSimple(connection: Connection, transaction: Transaction, signers?: (Wallet | Keypair | Signer)[], sendOpts?: SendOptions, confirmOpts?: ConfirmTransactionOptions): Promise<VersionedTransactionResponse | SimulatedTransactionResponse | undefined>;
export declare function executeTxFinalized(connection: Connection, transaction: Transaction, signers?: (Wallet | Keypair | Signer)[], sendOpts?: SendOptions): Promise<VersionedTransactionResponse | SimulatedTransactionResponse | undefined>;
/**

@@ -36,3 +42,3 @@ * Type guard for TransactionResponse and SimulatedTransactionResponse. It does not accept `undefined` as a valid input.

*/
export declare function splitAndExecuteTx({ connection, transaction, errMessage, signers, feePayer, simulate, printOnly, logger, exceedBudget, sendOpts, }: {
export declare function splitAndExecuteTx({ connection, transaction, errMessage, signers, feePayer, simulate, printOnly, logger, exceedBudget, sendOpts, confirmOpts, }: {
connection: Connection;

@@ -48,2 +54,3 @@ transaction: Transaction;

sendOpts?: SendOptions;
confirmOpts?: ConfirmTransactionOptions;
}): Promise<{

@@ -50,0 +57,0 @@ result: VersionedTransactionResponse[] | SimulatedTransactionResponse[] | [];

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.debugStr = exports.splitAndExecuteTx = exports.TRANSACTION_SAFE_SIZE = exports.filterSignersForInstruction = exports.isVersionedTransaction = exports.isSimulatedTransactionResponse = exports.executeTxSimple = exports.executeTx = void 0;
exports.debugStr = exports.splitAndExecuteTx = exports.TRANSACTION_SAFE_SIZE = exports.filterSignersForInstruction = exports.isVersionedTransaction = exports.isSimulatedTransactionResponse = exports.executeTxFinalized = exports.executeTxSimple = exports.executeTx = void 0;
const web3_js_1 = require("@solana/web3.js");

@@ -9,3 +9,3 @@ const wallet_1 = require("./wallet");

const ts_common_1 = require("@marinade.finance/ts-common");
async function executeTx({ connection, transaction, signers = [], errMessage, simulate = false, printOnly = false, logger, sendOpts = {}, }) {
async function executeTx({ connection, transaction, signers = [], errMessage, simulate = false, printOnly = false, logger, sendOpts = {}, confirmOpts = {}, }) {
var _a, _b;

@@ -57,13 +57,17 @@ let result = undefined;

if (res.value.err) {
throw new Error(`Failure confirming transaction ${txSig}, confirm result: ${JSON.stringify(res)}`);
throw new Error(`Transaction ${txSig} failure, result: ${JSON.stringify(res)}`);
}
let txSearchConnection = connection;
let timeout = 0;
if (connection.commitment === 'processed') {
if (confirmOpts) {
timeout = confirmOpts.timeoutMs || 0;
txSearchConnection = new web3_js_1.Connection(connection.rpcEndpoint, {
commitment: confirmOpts.commitment || connection.commitment,
});
}
else if (connection.commitment === 'processed') {
txSearchConnection = new web3_js_1.Connection(connection.rpcEndpoint, {
commitment: 'confirmed',
});
// TODO: this could be parametrized, max supported version too
// if commitment was 'processed' for sending we await for 'confirmed'
timeout = 1000 * 7; // 7 seconds
timeout = 1000 * 7;
}

@@ -100,3 +104,3 @@ let txRes = await txSearchConnection.getTransaction(txSig, {

exports.executeTx = executeTx;
async function executeTxSimple(connection, transaction, signers, sendOpts) {
async function executeTxSimple(connection, transaction, signers, sendOpts, confirmOpts) {
return await executeTx({

@@ -107,2 +111,3 @@ connection,

sendOpts,
confirmOpts,
errMessage: 'Error executing transaction',

@@ -112,2 +117,14 @@ });

exports.executeTxSimple = executeTxSimple;
async function executeTxFinalized(connection, transaction, signers, sendOpts) {
return await executeTx({
connection,
transaction,
signers,
sendOpts,
// a blockhash is valid for 150 slots, ~ 60 seconds
confirmOpts: { commitment: 'finalized', timeoutMs: 70 * 1000 },
errMessage: 'Error executing transaction',
});
}
exports.executeTxFinalized = executeTxFinalized;
/**

@@ -167,3 +184,3 @@ * Type guard for TransactionResponse and SimulatedTransactionResponse. It does not accept `undefined` as a valid input.

*/
async function splitAndExecuteTx({ connection, transaction, errMessage, signers = [], feePayer, simulate = false, printOnly = false, logger, exceedBudget = false, sendOpts = {}, }) {
async function splitAndExecuteTx({ connection, transaction, errMessage, signers = [], feePayer, simulate = false, printOnly = false, logger, exceedBudget = false, sendOpts = {}, confirmOpts = {}, }) {
const result = [];

@@ -182,2 +199,3 @@ const resultTransactions = [];

sendOpts,
confirmOpts,
});

@@ -184,0 +202,0 @@ resultTransactions.push(transaction);

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