-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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!: prettify typegen
api
#2824
Conversation
5855776
Coverage Report:
Changed Files:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arboleya after this change, whenever I rebuild locally, the old factories remain in place: contracts/factories/TestContractAbi__factory.ts Then I have experienced type errors: template-nextjs:build: Type error: Property 'deployContract' does not exist on type 'ContractFactory'.
template-nextjs:build:
template-nextjs:build: 102 | const factory = new ContractFactory(bytecode, _abi, wallet);
template-nextjs:build: 103 |
template-nextjs:build: > 104 | return factory.deployContract<TestContractAbi>({
template-nextjs:build: | ^
template-nextjs:build: 105 | storageSlots: _storageSlots,
template-nextjs:build: 106 | ...options,
template-nextjs:build: 107 | }); May it be worth deleting the typegen folder before a typegen build? |
@petertonysmith94 Deleting things is always very dangerous. However, these old files should not be a problem if they're just there and never imported. The error you pasted looks valid, no? The |
@arboleya You're right - deleting does seem dangerous. The error is valid and will cause issues if consumers have TS checking across their project. Maybe we could add an advisory in the release notes that this |
Oh, this is a very specific tip. Would you mind editing the PR description and adding this mention? It will be re-fetched and used in the changelog before the next release. |
bytecode
to factory outputted bytypegen
#2707Release notes
In this release, we:
typegen
API more straightforward and ergonomicSummary
Parts of our great experience are shipped through the Typegend files, which contain part of the boilerplate necessary to make some things work. This PR revisits and trims these templates nicely to support a more ergonomic and intuitive API.
All main Typegen templates have changed:
Contract
ContractFactory
⁽¹⁾Script
Predicate
To follow these changes, we also modified:
launchTestNode
utilityPredicate
classSpecial thanks ❤️
Goes to @petertonysmith94, for the rigorous reviews and additional API prettification via:
Thanks also to @nedsalk for all the involvement, not letting this fade out, the original issues, reviews, and also for:
Interface.test.ts
#2873Releasing this will undoubtedly pave the way for other good things to happen!
Breaking Changes
Predicate
classPredicate
class constructor parameters renamed:inputData
>data
Predicate
now accepts a single parameter for initializationlaunchTestNode
utilitycontractsConfigs[].deployer
tocontractsConfigs[].factory
contractsConfigs[].bytecode
and.hex.ts
fileThe bytecode is now saved within the factory class, so you don't have to deal with it.
Renamed method
deployContract
todeploy
Removed the redundant suffix on the
ContractFactory
class method name.Typegen
Contract
templateAbi__factory
suffix from class names<name>.hex
was removed (access it via<Name>.bytecode
)<name>__factory.ts
and<name>.d.dts
were merged into<name>.ts
<Name>
and the interface<Name>Abi
are now just<Name>
<Name>Factory.deployContract()
renamed to<Name>Factory.deploy()
<typegenDir>/contracts/factories
directoryTypegen
Predicate
templateAbi__factory
suffix from class names<typegenDir>/predicates/factories
directoryTypegen
Script
templateAbi__factory
suffix from class names<typegenDir>/scripts/factories
directoryChecklist
tests
to prove my changesdocs