@saberhq/solana-contrib
Advanced tools
Comparing version 1.12.14 to 1.12.15
@@ -27,4 +27,7 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, RpcResponseAndContext, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
*/ | ||
simulate(tx: Transaction, commitment?: Commitment): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulate(tx: Transaction, { commitment, verifySigners, }?: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
}): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
} | ||
//# sourceMappingURL=broadcaster.d.ts.map |
@@ -44,5 +44,8 @@ "use strict"; | ||
*/ | ||
simulate(tx, commitment = "recent") { | ||
simulate(tx, { commitment = "recent", verifySigners = true, } = { | ||
commitment: "recent", | ||
verifySigners: true, | ||
}) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () { | ||
if (tx.signatures.length === 0) { | ||
if (verifySigners && tx.signatures.length === 0) { | ||
throw new Error("Transaction must be signed before simulating."); | ||
@@ -49,0 +52,0 @@ } |
@@ -72,3 +72,6 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
*/ | ||
simulate(tx: Transaction, commitment?: Commitment): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulate(tx: Transaction, opts: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
}): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
} | ||
@@ -75,0 +78,0 @@ /** |
@@ -180,3 +180,6 @@ "use strict"; | ||
} | ||
return yield this.broadcaster.simulate(simTX, opts.commitment); | ||
return yield this.broadcaster.simulate(simTX, { | ||
verifySigners: signers !== undefined, | ||
commitment: opts.commitment, | ||
}); | ||
}); | ||
@@ -183,0 +186,0 @@ } |
@@ -81,3 +81,3 @@ import type { Cluster, ConfirmOptions, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js"; | ||
*/ | ||
simulateUnchecked(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulateUnchecked(opts: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
/** | ||
@@ -84,0 +84,0 @@ * Simulates the transaction and prints a fancy table in the console. |
@@ -72,4 +72,6 @@ "use strict"; | ||
*/ | ||
simulate(opts) { | ||
return this.provider.simulate(this.build(), (opts === null || opts === void 0 ? void 0 : opts.verifySigners) ? this.signers : undefined, opts); | ||
simulate(opts = { | ||
verifySigners: true, | ||
}) { | ||
return this.provider.simulate(this.build(), opts.verifySigners ? this.signers : undefined, opts); | ||
} | ||
@@ -84,3 +86,3 @@ /** | ||
simulateUnchecked(opts) { | ||
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: true })); | ||
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: false })); | ||
} | ||
@@ -87,0 +89,0 @@ /** |
@@ -27,4 +27,7 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, RpcResponseAndContext, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
*/ | ||
simulate(tx: Transaction, commitment?: Commitment): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulate(tx: Transaction, { commitment, verifySigners, }?: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
}): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
} | ||
//# sourceMappingURL=broadcaster.d.ts.map |
@@ -41,5 +41,8 @@ import { __awaiter } from "tslib"; | ||
*/ | ||
simulate(tx, commitment = "recent") { | ||
simulate(tx, { commitment = "recent", verifySigners = true, } = { | ||
commitment: "recent", | ||
verifySigners: true, | ||
}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (tx.signatures.length === 0) { | ||
if (verifySigners && tx.signatures.length === 0) { | ||
throw new Error("Transaction must be signed before simulating."); | ||
@@ -46,0 +49,0 @@ } |
@@ -72,3 +72,6 @@ import type { Blockhash, Commitment, ConfirmOptions, Connection, KeyedAccountInfo, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, Transaction } from "@solana/web3.js"; | ||
*/ | ||
simulate(tx: Transaction, commitment?: Commitment): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulate(tx: Transaction, opts: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
}): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
} | ||
@@ -75,0 +78,0 @@ /** |
@@ -175,3 +175,6 @@ import { __awaiter } from "tslib"; | ||
} | ||
return yield this.broadcaster.simulate(simTX, opts.commitment); | ||
return yield this.broadcaster.simulate(simTX, { | ||
verifySigners: signers !== undefined, | ||
commitment: opts.commitment, | ||
}); | ||
}); | ||
@@ -178,0 +181,0 @@ } |
@@ -81,3 +81,3 @@ import type { Cluster, ConfirmOptions, PublicKey, RpcResponseAndContext, Signer, SimulatedTransactionResponse, TransactionInstruction } from "@solana/web3.js"; | ||
*/ | ||
simulateUnchecked(opts?: TXEnvelopeSimulateOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
simulateUnchecked(opts: ConfirmOptions): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
/** | ||
@@ -84,0 +84,0 @@ * Simulates the transaction and prints a fancy table in the console. |
@@ -69,4 +69,6 @@ import { __awaiter } from "tslib"; | ||
*/ | ||
simulate(opts) { | ||
return this.provider.simulate(this.build(), (opts === null || opts === void 0 ? void 0 : opts.verifySigners) ? this.signers : undefined, opts); | ||
simulate(opts = { | ||
verifySigners: true, | ||
}) { | ||
return this.provider.simulate(this.build(), opts.verifySigners ? this.signers : undefined, opts); | ||
} | ||
@@ -81,3 +83,3 @@ /** | ||
simulateUnchecked(opts) { | ||
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: true })); | ||
return this.simulate(Object.assign(Object.assign({}, opts), { verifySigners: false })); | ||
} | ||
@@ -84,0 +86,0 @@ /** |
{ | ||
"name": "@saberhq/solana-contrib", | ||
"version": "1.12.14", | ||
"version": "1.12.15", | ||
"description": "Common types and libraries for Solana", | ||
@@ -42,3 +42,3 @@ "author": "Ian Macalinao <ian@saber.so>", | ||
}, | ||
"gitHead": "523e5bf295d031b823dc7c03f85eb6c6bdbb6537", | ||
"gitHead": "fe99b0b1638f321ca6ef5fc01fc0a6c73a0d1e98", | ||
"publishConfig": { | ||
@@ -45,0 +45,0 @@ "access": "public" |
@@ -61,5 +61,14 @@ import type { | ||
tx: Transaction, | ||
commitment: Commitment = "recent" | ||
{ | ||
commitment = "recent", | ||
verifySigners = true, | ||
}: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
} = { | ||
commitment: "recent", | ||
verifySigners: true, | ||
} | ||
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> { | ||
if (tx.signatures.length === 0) { | ||
if (verifySigners && tx.signatures.length === 0) { | ||
throw new Error("Transaction must be signed before simulating."); | ||
@@ -66,0 +75,0 @@ } |
@@ -98,3 +98,6 @@ import type { | ||
tx: Transaction, | ||
commitment?: Commitment | ||
opts: { | ||
commitment?: Commitment; | ||
verifySigners?: boolean; | ||
} | ||
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>>; | ||
@@ -101,0 +104,0 @@ } |
@@ -264,3 +264,6 @@ import type { | ||
} | ||
return await this.broadcaster.simulate(simTX, opts.commitment); | ||
return await this.broadcaster.simulate(simTX, { | ||
verifySigners: signers !== undefined, | ||
commitment: opts.commitment, | ||
}); | ||
} | ||
@@ -267,0 +270,0 @@ } |
@@ -100,7 +100,9 @@ import type { | ||
simulate( | ||
opts?: TXEnvelopeSimulateOptions | ||
opts: TXEnvelopeSimulateOptions = { | ||
verifySigners: true, | ||
} | ||
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> { | ||
return this.provider.simulate( | ||
this.build(), | ||
opts?.verifySigners ? this.signers : undefined, | ||
opts.verifySigners ? this.signers : undefined, | ||
opts | ||
@@ -118,5 +120,5 @@ ); | ||
simulateUnchecked( | ||
opts?: TXEnvelopeSimulateOptions | ||
opts: ConfirmOptions | ||
): Promise<RpcResponseAndContext<SimulatedTransactionResponse>> { | ||
return this.simulate({ ...opts, verifySigners: true }); | ||
return this.simulate({ ...opts, verifySigners: false }); | ||
} | ||
@@ -123,0 +125,0 @@ |
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
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
479482
6784