wevm / abitype

Strict TypeScript types for Ethereum ABIs
https://abitype.dev
MIT License
480 stars 45 forks source link

playground: ethers example implementation #214

Closed Raiden1411 closed 11 months ago

Raiden1411 commented 11 months ago

Description

This PR aims to add support for folks that relied on Typechain and are now using Abitype with ethers. By creating a working playground this should give a starting point for anyone that might need this. This is essentially a updated port of wagmi's pre 1.0 code but having it here makes more sense in my opinion.

Additional Information

Before submitting this issue, please make sure you do the following.


PR-Codex overview

This PR focuses on adding a playground example of using abitype with ethers.

Detailed summary

The following files were skipped due to too many changes: playgrounds/functions/src/ethers.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: c0b2c32e3a05f06c3be6ddb980c9e5806b8c7f2d

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

vercel[bot] commented 11 months ago

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 Nov 27, 2023 2:40pm
github-actions[bot] commented 11 months ago

Size Change: 0 B

Total Size: 98.8 kB

ℹ️ View Unchanged | Filename | Size | Change | | | :--- | :---: | :---: | :---: | | `packages/abitype/dist` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs` | 123 B | 0 B | | | `packages/abitype/dist/cjs/abi.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/abis` | 3.6 kB | 0 B | | | `packages/abitype/dist/cjs/abis/human-readable.js` | 5.93 kB | 0 B | | | `packages/abitype/dist/cjs/abis/json.js` | 577 B | 0 B | | | `packages/abitype/dist/cjs/errors.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/exports` | 589 B | 0 B | | | `packages/abitype/dist/cjs/exports/abis.js` | 743 B | 0 B | | | `packages/abitype/dist/cjs/exports/index.js` | 566 B | 0 B | | | `packages/abitype/dist/cjs/exports/zod.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/human-readable` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/human-readable/errors` | 537 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/errors/abiItem.js` | 804 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/errors/abiParameter.js` | 420 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/errors/signature.js` | 404 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/errors/splitParameters.js` | 338 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/errors/struct.js` | 294 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/formatAbi.js` | 420 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/formatAbiItem.js` | 487 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/formatAbiParameter.js` | 313 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/formatAbiParameters.js` | 348 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/parseAbi.js` | 440 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/parseAbiItem.js` | 471 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/parseAbiParameter.js` | 528 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/parseAbiParameters.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/human-readable/runtime` | 616 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/runtime/cache.js` | 782 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/runtime/signatures.js` | 1.03 kB | 0 B | | | `packages/abitype/dist/cjs/human-readable/runtime/structs.js` | 2.12 kB | 0 B | | | `packages/abitype/dist/cjs/human-readable/runtime/utils.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/cjs/human-readable/types` | 127 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/types/signatures.js` | 127 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/types/structs.js` | 124 B | 0 B | | | `packages/abitype/dist/cjs/human-readable/types/utils.js` | 169 B | 0 B | | | `packages/abitype/dist/cjs/narrow.js` | 40 B | 0 B | | | `packages/abitype/dist/cjs/package.json` | 362 B | 0 B | | | `packages/abitype/dist/cjs/regex.js` | 125 B | 0 B | | | `packages/abitype/dist/cjs/register.js` | 5.77 kB | 0 B | | | `packages/abitype/dist/cjs/tsconfig.build.tsbuildinfo` | 124 B | 0 B | | | `packages/abitype/dist/cjs/types.js` | 124 B | 0 B | | | `packages/abitype/dist/cjs/utils.js` | 149 B | 0 B | | | `packages/abitype/dist/cjs/version.js` | 2.1 kB | 0 B | | | `packages/abitype/dist/cjs/zod.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm` | 62 B | 0 B | | | `packages/abitype/dist/esm/abi.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/abis` | 3.96 kB | 0 B | | | `packages/abitype/dist/esm/abis/human-readable.js` | 6.27 kB | 0 B | | | `packages/abitype/dist/esm/abis/json.js` | 524 B | 0 B | | | `packages/abitype/dist/esm/errors.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/exports` | 259 B | 0 B | | | `packages/abitype/dist/esm/exports/abis.js` | 363 B | 0 B | | | `packages/abitype/dist/esm/exports/index.js` | 242 B | 0 B | | | `packages/abitype/dist/esm/exports/zod.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/human-readable` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/human-readable/errors` | 454 B | 0 B | | | `packages/abitype/dist/esm/human-readable/errors/abiItem.js` | 674 B | 0 B | | | `packages/abitype/dist/esm/human-readable/errors/abiParameter.js` | 339 B | 0 B | | | `packages/abitype/dist/esm/human-readable/errors/signature.js` | 345 B | 0 B | | | `packages/abitype/dist/esm/human-readable/errors/splitParameters.js` | 282 B | 0 B | | | `packages/abitype/dist/esm/human-readable/errors/struct.js` | 274 B | 0 B | | | `packages/abitype/dist/esm/human-readable/formatAbi.js` | 408 B | 0 B | | | `packages/abitype/dist/esm/human-readable/formatAbiItem.js` | 570 B | 0 B | | | `packages/abitype/dist/esm/human-readable/formatAbiParameter.js` | 380 B | 0 B | | | `packages/abitype/dist/esm/human-readable/formatAbiParameters.js` | 481 B | 0 B | | | `packages/abitype/dist/esm/human-readable/parseAbi.js` | 597 B | 0 B | | | `packages/abitype/dist/esm/human-readable/parseAbiItem.js` | 562 B | 0 B | | | `packages/abitype/dist/esm/human-readable/parseAbiParameter.js` | 639 B | 0 B | | | `packages/abitype/dist/esm/human-readable/parseAbiParameters.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/human-readable/runtime` | 855 B | 0 B | | | `packages/abitype/dist/esm/human-readable/runtime/cache.js` | 618 B | 0 B | | | `packages/abitype/dist/esm/human-readable/runtime/signatures.js` | 1.02 kB | 0 B | | | `packages/abitype/dist/esm/human-readable/runtime/structs.js` | 2.24 kB | 0 B | | | `packages/abitype/dist/esm/human-readable/runtime/utils.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/esm/human-readable/types` | 69 B | 0 B | | | `packages/abitype/dist/esm/human-readable/types/signatures.js` | 66 B | 0 B | | | `packages/abitype/dist/esm/human-readable/types/structs.js` | 64 B | 0 B | | | `packages/abitype/dist/esm/human-readable/types/utils.js` | 265 B | 0 B | | | `packages/abitype/dist/esm/narrow.js` | 58 B | 0 B | | | `packages/abitype/dist/esm/package.json` | 496 B | 0 B | | | `packages/abitype/dist/esm/regex.js` | 67 B | 0 B | | | `packages/abitype/dist/esm/register.js` | 7.31 kB | 0 B | | | `packages/abitype/dist/esm/tsconfig.build.tsbuildinfo` | 64 B | 0 B | | | `packages/abitype/dist/esm/types.js` | 64 B | 0 B | | | `packages/abitype/dist/esm/utils.js` | 83 B | 0 B | | | `packages/abitype/dist/esm/version.js` | 2.47 kB | 0 B | | | `packages/abitype/dist/esm/zod.js` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types` | 1.82 kB | 0 B | | | `packages/abitype/dist/types/abi.d.ts` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/abis` | 3.88 kB | 0 B | | | `packages/abitype/dist/types/abis/human-readable.d.ts` | 5.98 kB | 0 B | | | `packages/abitype/dist/types/abis/json.d.ts` | 271 B | 0 B | | | `packages/abitype/dist/types/errors.d.ts` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/exports` | 261 B | 0 B | | | `packages/abitype/dist/types/exports/abis.d.ts` | 661 B | 0 B | | | `packages/abitype/dist/types/exports/index.d.ts` | 245 B | 0 B | | | `packages/abitype/dist/types/exports/zod.d.ts` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/human-readable` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/human-readable/errors` | 229 B | 0 B | | | `packages/abitype/dist/types/human-readable/errors/abiItem.d.ts` | 375 B | 0 B | | | `packages/abitype/dist/types/human-readable/errors/abiParameter.d.ts` | 244 B | 0 B | | | `packages/abitype/dist/types/human-readable/errors/signature.d.ts` | 204 B | 0 B | | | `packages/abitype/dist/types/human-readable/errors/splitParameters.d.ts` | 174 B | 0 B | | | `packages/abitype/dist/types/human-readable/errors/struct.d.ts` | 316 B | 0 B | | | `packages/abitype/dist/types/human-readable/formatAbi.d.ts` | 649 B | 0 B | | | `packages/abitype/dist/types/human-readable/formatAbiItem.d.ts` | 673 B | 0 B | | | `packages/abitype/dist/types/human-readable/formatAbiParameter.d.ts` | 460 B | 0 B | | | `packages/abitype/dist/types/human-readable/formatAbiParameters.d.ts` | 648 B | 0 B | | | `packages/abitype/dist/types/human-readable/parseAbi.d.ts` | 761 B | 0 B | | | `packages/abitype/dist/types/human-readable/parseAbiItem.d.ts` | 739 B | 0 B | | | `packages/abitype/dist/types/human-readable/parseAbiParameter.d.ts` | 783 B | 0 B | | | `packages/abitype/dist/types/human-readable/parseAbiParameters.d.ts` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/human-readable/runtime` | 489 B | 0 B | | | `packages/abitype/dist/types/human-readable/runtime/cache.d.ts` | 372 B | 0 B | | | `packages/abitype/dist/types/human-readable/runtime/signatures.d.ts` | 157 B | 0 B | | | `packages/abitype/dist/types/human-readable/runtime/structs.d.ts` | 682 B | 0 B | | | `packages/abitype/dist/types/human-readable/runtime/utils.d.ts` | 0 B | 0 B | 🆕 | | `packages/abitype/dist/types/human-readable/types` | 1.77 kB | 0 B | | | `packages/abitype/dist/types/human-readable/types/signatures.d.ts` | 737 B | 0 B | | | `packages/abitype/dist/types/human-readable/types/structs.d.ts` | 2.06 kB | 0 B | | | `packages/abitype/dist/types/human-readable/types/utils.d.ts` | 424 B | 0 B | | | `packages/abitype/dist/types/narrow.d.ts` | 159 B | 0 B | | | `packages/abitype/dist/types/regex.d.ts` | 794 B | 0 B | | | `packages/abitype/dist/types/register.d.ts` | 1.84 kB | 0 B | | | `packages/abitype/dist/types/types.d.ts` | 2.38 kB | 0 B | | | `packages/abitype/dist/types/utils.d.ts` | 93 B | 0 B | | | `packages/abitype/dist/types/version.d.ts` | 2.13 kB | 0 B | | | `packages/abitype/dist/types/zod.d.ts` | 0 B | 0 B | 🆕 |

compressed-size-action

tmm commented 11 months ago

Nice! Might be worth just keeping this as a PR and not merging it in so folks can reference, but we aren't responsible for keeping updating it for future ethers releases. Wdyt?

Raiden1411 commented 11 months ago

I like that idea. Saves us the trouble of refactoring in case ethers does some breaking changes while also providing help.

Raiden1411 commented 11 months ago

Converted to a draft so it fits the whole idea better