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!: made deployContract a non-blocking call #2597

Merged
merged 82 commits into from
Jul 10, 2024

Conversation

Torres-ssf
Copy link
Contributor

@Torres-ssf Torres-ssf commented Jun 24, 2024

Release notes

In this release, we:

  • Made the contract's deployContract method a non-blocking call

Summary

This PR refactors the deployContract method to be non-blocking. As a result, the method no longer returns the contract instance directly. Instead, it returns an object containing the transactionId and a waitForResult function. This change improves the flexibility and control over contract deployment but introduces a breaking change that requires updates to existing implementations.

Breaking Changes

The deployContract method no longer returns the contract instance directly. Instead, it returns an object containing the transactionId , the contractId, and a waitForResult function.

// before
const factory = new ContractFactory(contractByteCode, contractAbi, wallet);

const contract = await factory.deployContract();

const { value } = await contract.functions.xyz().call();
// after
const factory = new ContractFactory(contractByteCode, contractAbi, wallet);

const { waitForResult, transactionId, contractId } = await factory.deployContract();

const { contract, transactionResult } = await waitForResult();

const { value } = await contract.functions.xyz().call();

Checklist

  • I addedtests to prove my changes
  • I updated — all the necessary docs
  • I reviewed — the entire PR myself, using the GitHub UI
  • I described — all breaking changes and the Migration Guide

@Torres-ssf Torres-ssf added feat Issue is a feature p0 High priority labels Jun 24, 2024
@Torres-ssf Torres-ssf added this to the 0.x mainnet milestone Jun 24, 2024
@Torres-ssf Torres-ssf self-assigned this Jun 24, 2024
Copy link
Contributor

@danielbate danielbate left a comment

Choose a reason for hiding this comment

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

Nice one, couple comments

apps/docs/src/guide/contracts/deploying-contracts.md Outdated Show resolved Hide resolved
apps/docs/src/guide/contracts/deploying-contracts.md Outdated Show resolved Hide resolved
packages/contract/src/contract-factory.ts Outdated Show resolved Hide resolved
packages/contract/src/contract-factory.ts Outdated Show resolved Hide resolved
@Torres-ssf Torres-ssf marked this pull request as draft July 9, 2024 03:17
@Torres-ssf Torres-ssf changed the title feat: add a non-blocking call for deploy contract feat!: add a non-blocking call for deploy contract Jul 9, 2024
@Torres-ssf Torres-ssf changed the title feat!: add a non-blocking call for deploy contract feat!: made deployContract a non-blocking call Jul 9, 2024
@Torres-ssf Torres-ssf marked this pull request as ready for review July 9, 2024 11:54
arboleya
arboleya previously approved these changes Jul 9, 2024
@Torres-ssf Torres-ssf enabled auto-merge (squash) July 10, 2024 13:11
Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

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

Small suggestion - rest looks good to me!

apps/docs/src/guide/contracts/deploying-contracts.md Outdated Show resolved Hide resolved
Co-authored-by: Peter Smith <[email protected]>
Copy link
Contributor

@petertonysmith94 petertonysmith94 left a comment

Choose a reason for hiding this comment

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

💚

Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
79.66%(+0.04%) 71.4%(+0%) 77.33%(+0.05%) 79.75%(+0.04%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/transaction-response/transaction-response.ts 72.72%
(+0.5%)
50%
(+0%)
88.88%
(+1.38%)
72.72%
(+0.5%)
🔴 packages/contract/src/contract-factory.ts 58.62%
(+7.6%)
46.15%
(+0%)
54.54%
(+17.04%)
58.62%
(+7.6%)
🔴 packages/contract/src/test-utils/launch-test-node.ts 97.5%
(+0.14%)
96.42%
(+0%)
100%
(+0%)
97.56%
(+0.13%)

@Torres-ssf Torres-ssf merged commit 17bd929 into master Jul 10, 2024
19 checks passed
@Torres-ssf Torres-ssf deleted the st/feat/make-deploy-contract-async branch July 10, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature p0 High priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make deployContract method a non-blocking call
7 participants