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!: ABI Gen #3249

Draft
wants to merge 154 commits into
base: ns/feat/abi-parser
Choose a base branch
from
Draft

feat!: ABI Gen #3249

wants to merge 154 commits into from

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Oct 4, 2024

Summary

This PR introduces AbiGen as a new way of typegen-ing. The implementation can be split into two parts:

  1. AbiGen and its type generation
  2. the CLI using the outputs of AbiGen

The next step would be to remove the abi-typegen package in a new PR.

TODO

  • Figure out why browser tests are timing out

Breaking Changes

Note

These will need to be combined into the final PR (#3085)

fuels typegen no longer accepts -s, -p and -c flags

pnpm fuels typegen can now automatically recognize the type of program it's building so the flags --script, --predicate and --contract and their shorthands have been removed.

the storageSlots static field has been moved from a typegen'd contract into its factory

// before
import { MyContract } from './typegend/contracts'

const defaultStorageSlots = MyContract.storageSlots;

// now
import { MyContractFactory } from './typegend/contracts'

const defaultStorageSlots = MyContractFactory.storageSlots;

Typegen'd simple sway enums don't have the Input/Output suffix anymore

Given the following enum:

enum Color {
    Red: (),
    Green: (),
}

The outputted type looks like this:

// before
import { ColorInput, ColorOutput } from './typegend/contracts/MyContract';

// after
import { Color } from './typegend/contracts/MyContract';

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)

@petertonysmith94 petertonysmith94 added the feat Issue is a feature label Oct 4, 2024
Copy link

vercel bot commented Oct 4, 2024

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

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 0:46am
ts-api-docs ❌ Failed (Inspect) Dec 31, 2024 0:46am
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 0:46am
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 31, 2024 0:46am

Copy link

codspeed-hq bot commented Oct 11, 2024

CodSpeed Performance Report

Merging #3249 will improve performances by ×2.4

Comparing ns/feat/abi-typegen (a96bfa0) with ns/feat/abi-parser (a2f0004)

Summary

⚡ 1 improvements
✅ 17 untouched benchmarks

Benchmarks breakdown

Benchmark ns/feat/abi-parser ns/feat/abi-typegen Change
should successfully conduct a custom transfer between wallets (x20 times) 120 ms 50.1 ms ×2.4

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

Successfully merging this pull request may close these issues.

3 participants