Skip to content

Commit

Permalink
Simulate: Only sign when signers is non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Dec 26, 2022
1 parent 4bef8c4 commit 9a4d8e3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ts/packages/anchor/src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,10 @@ export class AnchorProvider implements Provider {
* Simulates the given transaction, returning emitted logs from execution.
*
* @param tx The transaction to send.
* @param signers The signers of the transaction.
* @param signers The signers of the transaction. If unset, the transaction
* will be simulated with the "sigVerify: false" option. This
* allows for simulation of transactions without asking the
* wallet for a signature.
* @param opts Transaction confirmation options.
*/
async simulate(
Expand All @@ -263,7 +266,9 @@ export class AnchorProvider implements Provider {
)
).blockhash;

tx = await this.wallet.signTransaction(tx);
if (signers) {
tx = await this.wallet.signTransaction(tx);
}
const result = await simulateTransaction(
this.connection,
tx,
Expand Down

0 comments on commit 9a4d8e3

Please sign in to comment.