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

chore: added method to duplicate predicate #3395

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

YaTut1901
Copy link
Contributor

Closes #3392

Summary

Added method toNewInstance which returns new instance of predicate with same abi, loaderBytecode, provider and different configurableConstants and data to be passed:

toNewInstance(params: {
  configurableConstants?: TConfigurables;
  data?: TData;
}): Predicate<TData, TConfigurables> { }

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
ts-docs-api ⬜️ Ignored (Inspect) Nov 14, 2024 1:56pm

Copy link

vercel bot commented Nov 14, 2024

@YaTut1901 is attempting to deploy a commit to the Fuel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@Torres-ssf Torres-ssf changed the title chore(): added method to duplicate predicate chore: added method to duplicate predicate Nov 15, 2024
@github-actions github-actions bot added the chore Issue is a chore label Nov 15, 2024
@Torres-ssf
Copy link
Contributor

Hi @YaTut1901,

Great work on this! We really appreciate your help.

Could you edit the PR description, specifically this part:

Closes https://github.com/FuelLabs/fuels-ts/issues/3392

and change it to:

- Closes https://github.com/FuelLabs/fuels-ts/issues/3392

Thank you!

provider: this.provider,
data: params.data ?? this.predicateData,
configurableConstants: params.configurableConstants,
loaderBytecode: this.loaderBytecode,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
loaderBytecode: this.loaderBytecode,

The loaderBytecode is no longer a field on the Predicate class (after #3389).

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we check the data + configurableConstants have been set initially (on the first Predicate instantiation) and then set again after using toNewInstance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable creating a new predicate from an existing one
3 participants