New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@saberhq/solana-contrib

Package Overview
Dependencies
Maintainers
2
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@saberhq/solana-contrib - npm Package Compare versions

Comparing version 1.12.13 to 1.12.14

dist/cjs/transaction/parseTransactionLogs.d.ts

2

dist/cjs/interfaces.d.ts

@@ -137,3 +137,3 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js";

* @param tx The transaction to send.
* @param signers The set of signers in addition to the provdier wallet that
* @param signers The set of signers in addition to the provider wallet that
* will sign the transaction.

@@ -140,0 +140,0 @@ * @param opts Transaction confirmation options.

@@ -0,4 +1,7 @@

export * from "./parseTransactionLogs";
export * from "./PendingTransaction";
export * from "./programErr";
export * from "./TransactionEnvelope";
export * from "./TransactionReceipt";
export * from "./utils";
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
(0, tslib_1.__exportStar)(require("./parseTransactionLogs"), exports);
(0, tslib_1.__exportStar)(require("./PendingTransaction"), exports);
(0, tslib_1.__exportStar)(require("./programErr"), exports);
(0, tslib_1.__exportStar)(require("./TransactionEnvelope"), exports);
(0, tslib_1.__exportStar)(require("./TransactionReceipt"), exports);
(0, tslib_1.__exportStar)(require("./utils"), exports);
//# sourceMappingURL=index.js.map

@@ -1,49 +0,17 @@

import type { AccountMeta, Cluster, ConfirmOptions, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js";
import { PublicKey, Transaction } from "@solana/web3.js";
import type { Cluster, ConfirmOptions, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import type { Provider } from "../interfaces";
import type { PendingTransaction } from "./PendingTransaction";
import type { TransactionReceipt } from "./TransactionReceipt";
import type { SerializableInstruction } from "./utils";
/**
* Instruction that can be serialized to JSON.
* Options for simulating a transaction.
*/
export interface SerializableInstruction {
programId: string;
keys: (Omit<AccountMeta, "pubkey"> & {
publicKey: string;
})[];
data: string;
export interface TXEnvelopeSimulateOptions extends ConfirmOptions {
/**
* Verify that the signers of the TX enveloper are valid.
*/
verifySigners?: boolean;
}
/**
* Stub of a recent blockhash that can be used to simulate transactions.
*/
export declare const RECENT_BLOCKHASH_STUB = "GfVcyD4kkTrj4bKc7WA9sZCin9JDbdT4Zkd3EittNR1W";
/**
* Builds a transaction with a fake `recentBlockhash` and `feePayer` for the purpose
* of simulating a sequence of instructions.
*
* @param cluster
* @param ixs
* @returns
*/
export declare const buildStubbedTransaction: (cluster: Cluster, ixs: TransactionInstruction[]) => Transaction;
/**
* Serializes a {@link Transaction} to base64 format without checking signatures.
* @param tx
* @returns
*/
export declare const serializeToBase64Unchecked: (tx: Transaction) => string;
/**
* Generates a link for inspecting the contents of a transaction.
*
* @returns URL
*/
export declare const generateInspectLinkFromBase64: (cluster: Cluster, base64TX: string) => string;
/**
* Generates a link for inspecting the contents of a transaction, not checking for
* or requiring valid signatures.
*
* @returns URL
*/
export declare const generateUncheckedInspectLink: (cluster: Cluster, tx: Transaction) => string;
/**
* Contains a Transaction that is being built.

@@ -105,9 +73,11 @@ */

*/
simulate(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulate(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**
* Simulates the transaction, without validating signers.
*
* @deprecated Use {@link TXEnvelope#simulate} instead.
* @param opts
* @returns
*/
simulateUnchecked(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulateUnchecked(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**

@@ -118,3 +88,3 @@ * Simulates the transaction and prints a fancy table in the console.

*/
simulateTable(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulateTable(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**

@@ -121,0 +91,0 @@ * Sends the transaction without confirming it.

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TransactionEnvelope = exports.generateUncheckedInspectLink = exports.generateInspectLinkFromBase64 = exports.serializeToBase64Unchecked = exports.buildStubbedTransaction = exports.RECENT_BLOCKHASH_STUB = void 0;
exports.TransactionEnvelope = void 0;
const tslib_1 = require("tslib");
const web3_js_1 = require("@solana/web3.js");
const __1 = require("..");
const utils_1 = require("./utils");
/**
* Stub of a recent blockhash that can be used to simulate transactions.
*/
exports.RECENT_BLOCKHASH_STUB = "GfVcyD4kkTrj4bKc7WA9sZCin9JDbdT4Zkd3EittNR1W";
/**
* Builds a transaction with a fake `recentBlockhash` and `feePayer` for the purpose
* of simulating a sequence of instructions.
*
* @param cluster
* @param ixs
* @returns
*/
const buildStubbedTransaction = (cluster, ixs) => {
const tx = new web3_js_1.Transaction();
tx.recentBlockhash = exports.RECENT_BLOCKHASH_STUB;
// random keys that have money in them
tx.feePayer =
cluster === "devnet"
? new web3_js_1.PublicKey("A2jaCHPzD6346348JoEym2KFGX9A7uRBw6AhCdX7gTWP")
: new web3_js_1.PublicKey("9u9iZBWqGsp5hXBxkVZtBTuLSGNAG9gEQLgpuVw39ASg");
tx.instructions = ixs;
return tx;
};
exports.buildStubbedTransaction = buildStubbedTransaction;
/**
* Serializes a {@link Transaction} to base64 format without checking signatures.
* @param tx
* @returns
*/
const serializeToBase64Unchecked = (tx) => tx
.serialize({
requireAllSignatures: false,
verifySignatures: false,
})
.toString("base64");
exports.serializeToBase64Unchecked = serializeToBase64Unchecked;
/**
* Generates a link for inspecting the contents of a transaction.
*
* @returns URL
*/
const generateInspectLinkFromBase64 = (cluster, base64TX) => {
return `https://explorer.solana.com/tx/inspector?cluster=${cluster}&message=${encodeURIComponent(base64TX)}`;
};
exports.generateInspectLinkFromBase64 = generateInspectLinkFromBase64;
/**
* Generates a link for inspecting the contents of a transaction, not checking for
* or requiring valid signatures.
*
* @returns URL
*/
const generateUncheckedInspectLink = (cluster, tx) => {
return (0, exports.generateInspectLinkFromBase64)(cluster, (0, exports.serializeToBase64Unchecked)(tx));
};
exports.generateUncheckedInspectLink = generateUncheckedInspectLink;
/**
* Contains a Transaction that is being built.

@@ -117,5 +63,5 @@ */

const t = this.build();
t.recentBlockhash = exports.RECENT_BLOCKHASH_STUB;
t.recentBlockhash = utils_1.RECENT_BLOCKHASH_STUB;
const str = t.serializeMessage().toString("base64");
return (0, exports.generateInspectLinkFromBase64)(cluster, str);
return (0, utils_1.generateInspectLinkFromBase64)(cluster, str);
}

@@ -128,6 +74,8 @@ /**

simulate(opts) {
return this.provider.simulate(this.build(), this.signers, opts);
return this.provider.simulate(this.build(), (opts === null || opts === void 0 ? void 0 : opts.verifySigners) ? this.signers : undefined, opts);
}
/**
* Simulates the transaction, without validating signers.
*
* @deprecated Use {@link TXEnvelope#simulate} instead.
* @param opts

@@ -137,3 +85,3 @@ * @returns

simulateUnchecked(opts) {
return this.provider.simulate(this.build(), undefined, opts);
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: true }));
}

@@ -140,0 +88,0 @@ /**

@@ -137,3 +137,3 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js";

* @param tx The transaction to send.
* @param signers The set of signers in addition to the provdier wallet that
* @param signers The set of signers in addition to the provider wallet that
* will sign the transaction.

@@ -140,0 +140,0 @@ * @param opts Transaction confirmation options.

@@ -0,4 +1,7 @@

export * from "./parseTransactionLogs";
export * from "./PendingTransaction";
export * from "./programErr";
export * from "./TransactionEnvelope";
export * from "./TransactionReceipt";
export * from "./utils";
//# sourceMappingURL=index.d.ts.map

@@ -0,4 +1,7 @@

export * from "./parseTransactionLogs";
export * from "./PendingTransaction";
export * from "./programErr";
export * from "./TransactionEnvelope";
export * from "./TransactionReceipt";
export * from "./utils";
//# sourceMappingURL=index.js.map

@@ -1,49 +0,17 @@

import type { AccountMeta, Cluster, ConfirmOptions, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js";
import { PublicKey, Transaction } from "@solana/web3.js";
import type { Cluster, ConfirmOptions, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import type { Provider } from "../interfaces";
import type { PendingTransaction } from "./PendingTransaction";
import type { TransactionReceipt } from "./TransactionReceipt";
import type { SerializableInstruction } from "./utils";
/**
* Instruction that can be serialized to JSON.
* Options for simulating a transaction.
*/
export interface SerializableInstruction {
programId: string;
keys: (Omit<AccountMeta, "pubkey"> & {
publicKey: string;
})[];
data: string;
export interface TXEnvelopeSimulateOptions extends ConfirmOptions {
/**
* Verify that the signers of the TX enveloper are valid.
*/
verifySigners?: boolean;
}
/**
* Stub of a recent blockhash that can be used to simulate transactions.
*/
export declare const RECENT_BLOCKHASH_STUB = "GfVcyD4kkTrj4bKc7WA9sZCin9JDbdT4Zkd3EittNR1W";
/**
* Builds a transaction with a fake `recentBlockhash` and `feePayer` for the purpose
* of simulating a sequence of instructions.
*
* @param cluster
* @param ixs
* @returns
*/
export declare const buildStubbedTransaction: (cluster: Cluster, ixs: TransactionInstruction[]) => Transaction;
/**
* Serializes a {@link Transaction} to base64 format without checking signatures.
* @param tx
* @returns
*/
export declare const serializeToBase64Unchecked: (tx: Transaction) => string;
/**
* Generates a link for inspecting the contents of a transaction.
*
* @returns URL
*/
export declare const generateInspectLinkFromBase64: (cluster: Cluster, base64TX: string) => string;
/**
* Generates a link for inspecting the contents of a transaction, not checking for
* or requiring valid signatures.
*
* @returns URL
*/
export declare const generateUncheckedInspectLink: (cluster: Cluster, tx: Transaction) => string;
/**
* Contains a Transaction that is being built.

@@ -105,9 +73,11 @@ */

*/
simulate(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulate(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**
* Simulates the transaction, without validating signers.
*
* @deprecated Use {@link TXEnvelope#simulate} instead.
* @param opts
* @returns
*/
simulateUnchecked(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulateUnchecked(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**

@@ -118,3 +88,3 @@ * Simulates the transaction and prints a fancy table in the console.

*/
simulateTable(opts?: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
simulateTable(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>;
/**

@@ -121,0 +91,0 @@ * Sends the transaction without confirming it.

import { __awaiter } from "tslib";
import { PublicKey, Transaction } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";
import { printTXTable } from "..";
import { generateInspectLinkFromBase64, RECENT_BLOCKHASH_STUB } from "./utils";
/**
* Stub of a recent blockhash that can be used to simulate transactions.
*/
export const RECENT_BLOCKHASH_STUB = "GfVcyD4kkTrj4bKc7WA9sZCin9JDbdT4Zkd3EittNR1W";
/**
* Builds a transaction with a fake `recentBlockhash` and `feePayer` for the purpose
* of simulating a sequence of instructions.
*
* @param cluster
* @param ixs
* @returns
*/
export const buildStubbedTransaction = (cluster, ixs) => {
const tx = new Transaction();
tx.recentBlockhash = RECENT_BLOCKHASH_STUB;
// random keys that have money in them
tx.feePayer =
cluster === "devnet"
? new PublicKey("A2jaCHPzD6346348JoEym2KFGX9A7uRBw6AhCdX7gTWP")
: new PublicKey("9u9iZBWqGsp5hXBxkVZtBTuLSGNAG9gEQLgpuVw39ASg");
tx.instructions = ixs;
return tx;
};
/**
* Serializes a {@link Transaction} to base64 format without checking signatures.
* @param tx
* @returns
*/
export const serializeToBase64Unchecked = (tx) => tx
.serialize({
requireAllSignatures: false,
verifySignatures: false,
})
.toString("base64");
/**
* Generates a link for inspecting the contents of a transaction.
*
* @returns URL
*/
export const generateInspectLinkFromBase64 = (cluster, base64TX) => {
return `https://explorer.solana.com/tx/inspector?cluster=${cluster}&message=${encodeURIComponent(base64TX)}`;
};
/**
* Generates a link for inspecting the contents of a transaction, not checking for
* or requiring valid signatures.
*
* @returns URL
*/
export const generateUncheckedInspectLink = (cluster, tx) => {
return generateInspectLinkFromBase64(cluster, serializeToBase64Unchecked(tx));
};
/**
* Contains a Transaction that is being built.

@@ -120,6 +70,8 @@ */

simulate(opts) {
return this.provider.simulate(this.build(), this.signers, opts);
return this.provider.simulate(this.build(), (opts === null || opts === void 0 ? void 0 : opts.verifySigners) ? this.signers : undefined, opts);
}
/**
* Simulates the transaction, without validating signers.
*
* @deprecated Use {@link TXEnvelope#simulate} instead.
* @param opts

@@ -129,3 +81,3 @@ * @returns

simulateUnchecked(opts) {
return this.provider.simulate(this.build(), undefined, opts);
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: true }));
}

@@ -132,0 +84,0 @@ /**

{
"name": "@saberhq/solana-contrib",
"version": "1.12.13",
"version": "1.12.14",
"description": "Common types and libraries for Solana",

@@ -36,2 +36,3 @@ "author": "Ian Macalinao <ian@saber.so>",

"@solana/web3.js": "^1.31.0",
"@types/jest": "^27.4.0",
"@types/node": "^16.11.17"

@@ -42,3 +43,3 @@ },

},
"gitHead": "068eb76e788519483f01f850614b1bd2a64193be",
"gitHead": "523e5bf295d031b823dc7c03f85eb6c6bdbb6537",
"publishConfig": {

@@ -45,0 +46,0 @@ "access": "public"

@@ -189,3 +189,3 @@ import type {

* @param tx The transaction to send.
* @param signers The set of signers in addition to the provdier wallet that
* @param signers The set of signers in addition to the provider wallet that
* will sign the transaction.

@@ -192,0 +192,0 @@ * @param opts Transaction confirmation options.

@@ -0,3 +1,6 @@

export * from "./parseTransactionLogs";
export * from "./PendingTransaction";
export * from "./programErr";
export * from "./TransactionEnvelope";
export * from "./TransactionReceipt";
export * from "./utils";
import type {
AccountMeta,
Cluster,
ConfirmOptions,
PublicKey,
RpcResponseAndContext,

@@ -10,3 +10,3 @@ Signer,

} from "@solana/web3.js";
import { PublicKey, Transaction } from "@solana/web3.js";
import { Transaction } from "@solana/web3.js";

@@ -17,83 +17,16 @@ import { printTXTable } from "..";

import type { TransactionReceipt } from "./TransactionReceipt";
import type { SerializableInstruction } from "./utils";
import { generateInspectLinkFromBase64, RECENT_BLOCKHASH_STUB } from "./utils";
/**
* Instruction that can be serialized to JSON.
* Options for simulating a transaction.
*/
export interface SerializableInstruction {
programId: string;
keys: (Omit<AccountMeta, "pubkey"> & { publicKey: string })[];
data: string;
export interface TXEnvelopeSimulateOptions extends ConfirmOptions {
/**
* Verify that the signers of the TX enveloper are valid.
*/
verifySigners?: boolean;
}
/**
* Stub of a recent blockhash that can be used to simulate transactions.
*/
export const RECENT_BLOCKHASH_STUB =
"GfVcyD4kkTrj4bKc7WA9sZCin9JDbdT4Zkd3EittNR1W";
/**
* Builds a transaction with a fake `recentBlockhash` and `feePayer` for the purpose
* of simulating a sequence of instructions.
*
* @param cluster
* @param ixs
* @returns
*/
export const buildStubbedTransaction = (
cluster: Cluster,
ixs: TransactionInstruction[]
): Transaction => {
const tx = new Transaction();
tx.recentBlockhash = RECENT_BLOCKHASH_STUB;
// random keys that have money in them
tx.feePayer =
cluster === "devnet"
? new PublicKey("A2jaCHPzD6346348JoEym2KFGX9A7uRBw6AhCdX7gTWP")
: new PublicKey("9u9iZBWqGsp5hXBxkVZtBTuLSGNAG9gEQLgpuVw39ASg");
tx.instructions = ixs;
return tx;
};
/**
* Serializes a {@link Transaction} to base64 format without checking signatures.
* @param tx
* @returns
*/
export const serializeToBase64Unchecked = (tx: Transaction): string =>
tx
.serialize({
requireAllSignatures: false,
verifySignatures: false,
})
.toString("base64");
/**
* Generates a link for inspecting the contents of a transaction.
*
* @returns URL
*/
export const generateInspectLinkFromBase64 = (
cluster: Cluster,
base64TX: string
): string => {
return `https://explorer.solana.com/tx/inspector?cluster=${cluster}&message=${encodeURIComponent(
base64TX
)}`;
};
/**
* Generates a link for inspecting the contents of a transaction, not checking for
* or requiring valid signatures.
*
* @returns URL
*/
export const generateUncheckedInspectLink = (
cluster: Cluster,
tx: Transaction
): string => {
return generateInspectLinkFromBase64(cluster, serializeToBase64Unchecked(tx));
};
/**
* Contains a Transaction that is being built.

@@ -169,5 +102,9 @@ */

simulate(
opts?: ConfirmOptions
opts?: TXEnvelopeSimulateOptions
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
return this.provider.simulate(this.build(), this.signers, opts);
return this.provider.simulate(
this.build(),
opts?.verifySigners ? this.signers : undefined,
opts
);
}

@@ -177,2 +114,4 @@

* Simulates the transaction, without validating signers.
*
* @deprecated Use {@link TXEnvelope#simulate} instead.
* @param opts

@@ -182,5 +121,5 @@ * @returns

simulateUnchecked(
opts?: ConfirmOptions
opts?: TXEnvelopeSimulateOptions
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {
return this.provider.simulate(this.build(), undefined, opts);
return this.simulate({ ...opts, verifySigners: true });
}

@@ -194,3 +133,3 @@

simulateTable(
opts?: ConfirmOptions
opts?: TXEnvelopeSimulateOptions
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> {

@@ -197,0 +136,0 @@ return this.simulate(opts).then((simulation) => {

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

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