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

Better API for getting a contract instance after deploying it #1341

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

Better API for getting a contract instance after deploying it #1341

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

Comments

@spalladino
Copy link
Collaborator

spalladino commented Aug 1, 2023

Deploying a contract using one of the ts wrappers produces redundant code, since the user needs to use a static method of the contract class to create the deployment, and then manually create an instance of that same class. The deployment should just return a Contract instance.

const contract = await ZkTokenContract.deploy(aztecRpcServer, 100n, owner)
      .send()
      .wait()
      .then(r => new ZkTokenContract(r.contractAddress!, wallet)); // Should not be necessary to refer to ZkTokenContract again!

Same goes when using the ContractDeployer:

const deployer = new ContractDeployer(abi, aztecRpcServer);
const tx = deployer.deploy().send();
await tx.isMined(0, 0.1);
const receipt = await tx.getReceipt();
const contract = new Contract(receipt.contractAddress!, abi, wallet); // Should not be necessary to create an instance manually using the same `abi`!
@spalladino spalladino added this to A3 Aug 1, 2023
@spalladino spalladino converted this from a draft issue Aug 1, 2023
@spalladino spalladino self-assigned this Aug 1, 2023
@spalladino spalladino moved this from Todo to In Progress in A3 Aug 1, 2023
@spalladino spalladino moved this from In Progress to In Review in A3 Aug 2, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in A3 Aug 2, 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