Skip to content

Commit

Permalink
Simulate: Don't attempt to sign transaction (#2331)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm authored Jan 17, 2023
1 parent 6e776c5 commit e3fe24f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ The minor version will be incremented upon a breaking change and the patch versi

### Fixes

- cli: Don't regenerate idl in read_all_programs(). ([#2332](https://github.com/coral-xyz/anchor/pull/2332))
- cli: Don't regenerate idl in read_all_programs(). ([#2332](https://github.com/coral-xyz/anchor/pull/2332)).
- ts: `provider.simulate` will send the transaction with `sigVerify: false` if no `signers` are present ([#2331](https://github.com/coral-xyz/anchor/pull/2331)).

### Breaking

Expand Down
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

1 comment on commit e3fe24f

@vercel
Copy link

@vercel vercel bot commented on e3fe24f Jan 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-200ms.vercel.app
anchor-docs-git-master-200ms.vercel.app
www.anchor-lang.com
anchor-lang.com

Please sign in to comment.