Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API to aztec.js for batching actions #1343

Closed
spalladino opened this issue Aug 1, 2023 · 0 comments · Fixed by #1415
Closed

Add API to aztec.js for batching actions #1343

spalladino opened this issue Aug 1, 2023 · 0 comments · Fixed by #1415
Assignees

Comments

@spalladino
Copy link
Collaborator

While our account contracts support batching actions, the API for this is super awkward. It should be easier to go from a set of ExecutionRequests to a SentTx object.

const actions = [
  contract.methods.transfer(10, owner, recipient).request(),
  contract.methods.withdraw(owner, 20, recipient).request(),
];

const nodeInfo = await wallet.getNodeInfo();
const txContext = TxContext.empty(new Fr(nodeInfo.chainId), new Fr(nodeInfo.version));
const txRequest = await wallet.createAuthenticatedTxRequest(actions, txContext);
const tx = await wallet.simulateTx(txRequest);
const sentTx = new SentTx(aztecRpcServer, wallet.sendTx(tx));
await sentTx.isMined();
@spalladino spalladino added this to A3 Aug 1, 2023
@spalladino spalladino converted this from a draft issue Aug 1, 2023
@spalladino spalladino moved this from Todo to In Progress in A3 Aug 2, 2023
@spalladino spalladino self-assigned this Aug 2, 2023
spalladino added a commit that referenced this issue Aug 4, 2023
…#1415)

A few clean ups in aztec-js:
- Remove `from` in `ExecutionRequest` and rename it to `FunctionCall` to
avoid confusion with `TxExecutionRequest` and
`CallStackItem.isExecutionRequest`.
- Remove `TxContext` argument from `AccountImp.createAuthenticatedTx`
and rename it to `createTxExecutionRequest`.
- Remove unused `nonce` in method send options.
- Remove unused function to get a contract instance in deploy method
given we now have #1360.
- Extracts a base class for `contract_function_interaction` and
`deploy_method` so we can remove the `DeployWallet`.
- Adds a new `BatchCall` method for nicer batch calls. Fixes #1343.
@github-project-automation github-project-automation bot moved this from In Progress to Done in A3 Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants