-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: add Script ABIs support to Typegen #747
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
Merged
Merged
Changes from 116 commits
Commits
Show all changes
127 commits
Select commit
Hold shift + click to select a range
5698534
Adjusting interface and typings for `loggedTypes` ABI property
arboleya 6bb183a
Exporting all interfaces on package index
arboleya 9569380
Adding new dependency
arboleya 6a21da2
Drafting `ScriptWrapper` class
arboleya af6a7b8
Adding new enum
arboleya 431185d
Individualizing file’s assemblers for Contract and Script
arboleya 567062a
Improving regex
arboleya 11ec5b6
Trimming non-essential bridges, sub-methods should be used directly
arboleya 8e7fd02
Configuring new options for Typegen CLI; updating programmatic API
arboleya ce1ebd7
Drafting initial templates for Scripts
arboleya f5c9850
Updating lock file
arboleya 65d50bd
Rendering templates directly
arboleya 7ae14fb
Start using standalone file assemblers
arboleya 7cca75f
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya ce87784
Untangling variables from the main `Abi` class
arboleya dcf7223
Adding changeset
arboleya a371db3
Externalizing shared testing utility
arboleya bf45f0c
Refactoring test, deleting unrelated parts from old implementation
arboleya 4d36174
Tyop
arboleya e9f7025
Implementing tests for newly added file assemblers
arboleya 31bd761
Temporarily hard-coding place-holder data for templates
arboleya c10dfde
Adding test stubs
arboleya 6afa35f
Improving CLI options, validating conflicting parameters
arboleya 35bfc30
Tyop
arboleya 0654739
Removing extra conditional, reducing case scenarios
arboleya 570d468
Refactoring existent CLI tests and adding missing ones
arboleya 4f848bb
Adding missing test for `AbiTypegen`
arboleya 0194767
Drafting template rendering test, adding TODOs
arboleya cad9eca
Remodeling function interfaces
arboleya 0253092
Tyop
arboleya d998dc2
Fixing template
arboleya 50eee28
Adding placeholder code for reading script `bin` file from disk
arboleya bd52bb4
Switching variable class name to `ScriptFactory`
arboleya 49b246e
Fixing script factory renderer method, gathering prop definitions
arboleya fd5ba8c
Adding missing import to template
arboleya bae23f4
Adjusting test fixture
arboleya d85b30c
Improving test helper, adding extra options
arboleya c3d518f
Adjusting missing test case
arboleya e02a372
Removing log call
arboleya 69ed225
Fixing test, dealing with mocked instances’ state
arboleya 3765c9a
Removing duplicates, moving templates around
arboleya fe5d2bb
Lintfix
arboleya 3871de1
Tidying up, lint fixing, spell checking, remodeling directory structure
arboleya f91127f
Improving test validations, checking for parameters incompatibility
arboleya b7ddc50
Docs
arboleya d5bb2df
Fixing scripts URL for Sway docs
arboleya ebf77f7
Removing extraneous configs
arboleya 515cb99
Updating help usage, fixing tyop
arboleya 06f51c3
Removing useless options
arboleya ee6b41b
Purging dead code
arboleya debc9d3
Removing temporary draft / placeholder
arboleya 5840c8c
Fixing template; updating test fixture to match
arboleya 1fa9f46
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 51863bf
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya d5cb1b7
Extracting code chunks into separate utilities
arboleya d3e5cf3
Adding `@ethersproject/bytes` to the mix
arboleya 6f5627c
Updating script/factory template, adjusting data format and rendering
arboleya 2359d18
Adding new validation utility
arboleya 6f8535a
Start handling BIN files alongside their ABI counterparts
arboleya 7ec043d
Adding test stubs/placeholders
arboleya 4a5399d
Adjusting virtual filename for Script in tests
arboleya 7568660
Updating template fixture
arboleya f74f65e
Temporarily skipping broken tests, adding TODOs
arboleya 980e741
Improving test utility, adding options required for dealing w/ Scripts
arboleya 7baa1f6
Resolving TODOs, fixing and un-skipping broken tests
arboleya c64545d
Adding new Sway Script test fixture
arboleya 7d70f86
Narrowing Script conditional
arboleya b1fe166
Updating error message
arboleya ad0a8c9
Making parameter required
arboleya 7cfe832
Adding missing test cases; stressing errors related to Scripts
arboleya 5817051
Resolving TODO, using Sway script sample, fixing ABI instantiation
arboleya d7631e0
Updating rendered template fixture
arboleya dcc38c7
Removing useless conditional
arboleya 4c086d3
Fine-tuning new utility, adding tests
arboleya d0f85d6
Removing needless type definitions; improving auto-complete
arboleya 4894ee9
Implementing tests for new template utilities
arboleya 49dd990
Renaming files and updating their references
arboleya ce81949
Renaming files and updating their references, again
arboleya 710cc80
Adding new property to Abi classes
arboleya 922d93f
Adjusting index template, adding exception for Contracts
arboleya dc51d04
Adjusting Script factory template
arboleya 6b16903
Fixing usages of Abi class; updating constructor signature
arboleya 241af51
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya ba81ac3
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 508b41a
Improving test for Script factory template
arboleya 573721e
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 17665ae
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 5f33bcb
Adding new flag to denote items that need to be imported from `fuels`
arboleya 56748d1
Updating tests for all types
arboleya ddc8a44
Adding new template utility
arboleya b4e3447
Improving array sorting by running it in a case-insensitive manner
arboleya 1cba768
Adding `lodash.uniq` to the mix
arboleya 03e0940
Updating Contract `dts` template, render, and tests
arboleya a1980ea
Updating Script `factory` template, render, and tests
arboleya a86dfa9
Fixing broken test
arboleya 7245b92
Tyop
arboleya 77bf91f
Updating docs on programmatic usage
arboleya 818f129
Merge branch 'master' of github.com:FuelLabs/fuels-ts into aa/feat/sc…
arboleya f7ff311
Adjusting enum CASE
arboleya 51b3005
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 9fb3077
Docs
arboleya a8a9dc0
Merge branch 'aa/feat/script-abi-typegen' of github.com:FuelLabs/fuel…
arboleya bfe1450
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya c4075fd
Updating fixture utility
arboleya a3dabc1
Restoring mocks before assertions
arboleya 1f220ef
Updating Sway script fixture
arboleya 8ef07b9
Returning additional property.
arboleya 171f230
DRY; considering [hexlified] bin files
arboleya 2feed02
Updating sub-method signature; expanding outputs
arboleya 672f91d
Renaming method
arboleya e7a6970
Renaming file to match inner method
arboleya 57b71f0
Merge branch 'master' of github.com:FuelLabs/fuels-ts into aa/feat/sc…
arboleya 5ebe886
Lintfix
arboleya 4d5f0cf
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 274ce42
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya ebeba26
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 0bb6adf
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya fc55b61
Renaming enum, updating refs
arboleya d6aaa04
Adjusting semantics of category x programType in more places
arboleya 6cd300d
Dedupe; adding correct link to related doc section
arboleya 8abe9c1
Adjusting link
arboleya 695f221
Docs; updating nomenclatures on `packages/abi-typegen` README
arboleya 342b43c
Docs, adjusting links again
arboleya d1dac3d
Reality check, exorcizing code smells
arboleya 834a7ef
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya 7af22b9
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya c327b03
Merge branch 'master' into aa/feat/script-abi-typegen
arboleya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@fuel-ts/abi-typegen": minor | ||
--- | ||
|
||
Adding support for generating types from Script ABIs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
docs/_guide/abi-typegen/generate-contract-types-from-abi.md
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[nav_order: 0] | ||
|
||
# Generating Types from ABI | ||
|
||
## Installation | ||
|
||
First we install `fuels` to our project: | ||
|
||
```sh | ||
yarn add fuels | ||
``` | ||
|
||
## Help | ||
|
||
A first glance at the docs: | ||
|
||
```console | ||
$ yarn exec fuels typegen -h | ||
|
||
Usage: fuels typegen [options] | ||
|
||
generate typescript from contract abi json files | ||
|
||
Options: | ||
-i, --inputs <path|glob... input paths/globals to your abi json files | ||
-o, --output <dir> directory path for generated files | ||
-c, --contract generate code for contracts [default] | ||
-s, --script generate code for scripts | ||
--silent omit output messages | ||
-h, --help display help for command | ||
``` | ||
|
||
## Generating Types for Contracts | ||
|
||
We can omit the `--contract` option here; its the default: | ||
|
||
```console | ||
yarn exec fuels -i ./abis/*-abi.json -o ./types | ||
``` | ||
|
||
**Notes** | ||
|
||
- `-i`: the relative path/global to the ABI JSON file(s) | ||
- `-o`: the output directory for the generated types | ||
- `-c, --contract`: tells we want to generate types for contracts _(default, can be omitted)_ | ||
|
||
## Generating Types for Scripts | ||
|
||
Note how we make use of the option `--script` in this case: | ||
|
||
```console | ||
yarn exec fuels -i ./abis/*-abi.json -o ./types --script | ||
``` | ||
|
||
**Notes** | ||
|
||
- `-s, --script`: Tells we want to generate types for scripts | ||
|
||
--- | ||
|
||
See also: | ||
|
||
- [Using Generated Contract Types](./using-generated-types.md#using-generated-contract-types) | ||
- [Using Generated Script Types](./using-generated-types.md#using-generated-script-types) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.