Skip to content

Commit

Permalink
optional simulate & wallet, editable TransactionBuilder
Browse files Browse the repository at this point in the history
- Can now pass an `account` OR `wallet` when constructing the
  ContractClient, or none! If you pass none, you can still make view
  calls, since they don't need a signer. You will need to pass a
  `wallet` when calling things that need it, like `signAndSend`.

- You can now pass `simulate: false` when first creating your
  transaction to skip simulation. You can then modify the transaction
  using the TransactionBuilder at `tx.raw` before manually calling
  `simulate`. Example:

      const tx = await myContract.myMethod(
        { args: 'for', my: 'method', ... },
        { simulate: false }
      );
      tx.raw.addMemo(Memo.text('Nice memo, friend!'))
      await tx.simulate();

- Error types are now collected under `AssembledTransaction.Errors` and
  `SentTransaction.Errors`.
  • Loading branch information
chadoh committed Feb 8, 2024
1 parent ac5545b commit b22af74
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 170 deletions.
2 changes: 1 addition & 1 deletion src/contract_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ export class ContractSpec {
args: Record<string, any>,
options: MethodOptions
) => {
return await AssembledTransaction.fromSimulation({
return await AssembledTransaction.build({
method: name,
args: spec.funcArgsToScVals(name, args),
...options,
Expand Down
Loading

0 comments on commit b22af74

Please sign in to comment.