abitype
abitype copied to clipboard
fix: normalize `AbiFallback.inputs` type between `abitype` and `zod`
Description
This PR aligns the following AbiFallback.inputs
type between Zod schema and abitype
type Left = AbiFallback['inputs']; // readonly []
type Right = z.infer<typeof AbiFallbackSchema>['inputs']; // never[]
After:
type Left = AbiFallback['inputs']; // readonly never[]
type Right = z.infer<typeof AbiFallbackSchema>['inputs']; readonly never[]
Additional Information
Before submitting this issue, please make sure you do the following.
- [X] Read the contributing guide
- [X] Added documentation related to the changes made.
- [X] Added or updated tests (and snapshots) related to the changes made.
PR-Codex overview
Focus of the PR:
This PR focuses on normalizing the AbiFallback.inputs
type and zod
.
Detailed summary:
- Normalize
AbiFallback.inputs
type andzod
- Update
packages/abitype/src/abi.ts
to usereadonly never[]
instead ofreadonly []
forAbiFallback.inputs
- Update
packages/abitype/src/zod.ts
to usez.tuple([]).readonly().optional()
forAbiFallback.inputs
- Add
AbiFallback
andAbiFunction
topackages/abitype/src/zod.test-d.ts
- Update imports in
packages/abitype/src/zod.test-d.ts
- Add tests for
AbiFunction
andAbiFallback
inpackages/abitype/src/zod.test-d.ts
✨ Ask PR-Codex anything about this PR by commenting with
/codex {your question}
🦋 Changeset detected
Latest commit: d5dadf7135838c998d35099adb7f31670fca4470
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
Name | Type |
---|---|
abitype | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
abitype | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Oct 14, 2023 8:26am |
Bug Fixes
- normalize AbiFallback.inputs type and zod (d5dadf7)
Contributors
Commit-Lint commands
You can trigger Commit-Lint actions by commenting on this PR:
-
@Commit-Lint merge patch
will merge dependabot PR on "patch" versions (X.X.Y - Y change) -
@Commit-Lint merge minor
will merge dependabot PR on "minor" versions (X.Y.Y - Y change) -
@Commit-Lint merge major
will merge dependabot PR on "major" versions (Y.Y.Y - Y change) -
@Commit-Lint merge disable
will desactivate merge dependabot PR -
@Commit-Lint review
will approve dependabot PR -
@Commit-Lint stop review
will stop approve dependabot PR
Codecov Report
All modified lines are covered by tests :white_check_mark:
Comparison is base (
32cf12d
) 99.83% compared to head (d5dadf7
) 99.83%.
Additional details and impacted files
@@ Coverage Diff @@
## main #203 +/- ##
=======================================
Coverage 99.83% 99.83%
=======================================
Files 26 26
Lines 6082 6082
Branches 195 195
=======================================
Hits 6072 6072
Misses 8 8
Partials 2 2
Files | Coverage Δ | |
---|---|---|
packages/abitype/src/zod.ts | 100.00% <100.00%> (ø) |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I've tested the ABI output of the fallback
function on every major solidity compiler and the ABI JSON output does not have the inputs
property. I think instead of normalizing the type between TS and Zod we should remove this property all together. I also believe that Vyper doesn't support fallback functions.
So you mean completely removing AbiFallback['input']
?
If @tmm agrees I would say so
@Raiden1411 @tmm just wanted to know your opinion about removing fallback from fallback function
@Raiden1411's comment is spot on! Wasn't able to push to this PR for some reason so created a new one here https://github.com/wevm/abitype/pull/248