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

feat(aztec-js): Return contract instance when awaiting deploy tx #1360

Merged
merged 3 commits into from
Aug 2, 2023

Conversation

spalladino
Copy link
Collaborator

@spalladino spalladino commented Aug 1, 2023

Overrides the send method of DeployMethod so it returns a DeploySentTx. This tx can be waited to return a receipt with the contract instance, and also provides a deployed method that returns just the contract. The wallet used for the instance can be set when creating the DeployMethod or passed as an argument to wait/deployed. Typed contracts return a typed version of DeployMethod that returns a typed contract instance.

Example usage:

const contract = await ZkTokenContract.deploy(wallet, initialBalance, owner).send().deployed();

Does not modify existing APIs except for converting timeout and interval in wait from positional to option-like arguments.

Fixes #1341

Copy link
Contributor

@benesjan benesjan left a comment

Choose a reason for hiding this comment

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

It's a very nice improvement. LGTM!

@benesjan benesjan force-pushed the palla/deploy-api branch 3 times, most recently from a28010a to 76e8b4c Compare August 2, 2023 09:52
@benesjan benesjan enabled auto-merge (squash) August 2, 2023 10:02
@benesjan benesjan merged commit e9c945c into master Aug 2, 2023
@benesjan benesjan deleted the palla/deploy-api branch August 2, 2023 15:14
spalladino added a commit that referenced this pull request 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.
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 this pull request may close these issues.

Better API for getting a contract instance after deploying it
2 participants