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 coder #3402

Draft
wants to merge 151 commits into
base: ns/feat/abi-parser
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
2f46562
chore: synced types with ps/feat/abi-parser
petertonysmith94 Sep 10, 2024
38f67de
add matchers and PoC
nedsalk Sep 10, 2024
82223f8
Merge branch 'ns/feat/abi-parser-ps-tidy' into ps/feat/abi-coder
petertonysmith94 Sep 10, 2024
9bce9ad
chore: added exhaustive examples project
petertonysmith94 Sep 10, 2024
ee83ffd
add "full" flow
nedsalk Sep 10, 2024
d429d45
chore: added AbiSpecification export for parser
petertonysmith94 Sep 10, 2024
d464a59
chore: added parser export for abi
petertonysmith94 Sep 10, 2024
838ebe0
feat: added basic AbiCoder barebones (WIP)
petertonysmith94 Sep 10, 2024
d14d69a
extract relevant regexes into variables
nedsalk Sep 10, 2024
8e59b83
update generics
nedsalk Sep 10, 2024
d7ea3de
fix tupleRegex
nedsalk Sep 10, 2024
d2b1707
Update sway-type-matchers.ts
nedsalk Sep 10, 2024
3912386
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ns…
petertonysmith94 Sep 10, 2024
d0aaf52
Merge branch 'ns/feat/abi-parser' of https://github.com/FuelLabs/fuel…
petertonysmith94 Sep 10, 2024
bb5ba36
Merge branch 'ns/feat/abi-parser-ps-tidy' of https://github.com/FuelL…
petertonysmith94 Sep 10, 2024
19f793d
refactor out parameterized tests
nedsalk Sep 10, 2024
7efdf8d
add test tags
nedsalk Sep 10, 2024
7ef45a3
Update packages/abi/src/matchers/sway-type-matchers.ts
nedsalk Sep 11, 2024
530a28d
add `createMatcher` utility
nedsalk Sep 11, 2024
8c4c906
remove typers and coders
nedsalk Sep 11, 2024
43f35b3
remove irrelevant changes
nedsalk Sep 11, 2024
185c46b
fix test
nedsalk Sep 11, 2024
8fee7a2
rename `empty` to `void`
nedsalk Sep 11, 2024
98debae
Update packages/abi/src/matchers/sway-type-matchers.ts
nedsalk Sep 11, 2024
1995501
fix compilation
nedsalk Sep 11, 2024
3c03047
chore: added library
petertonysmith94 Sep 12, 2024
7d4a73b
WIP
petertonysmith94 Sep 12, 2024
8c8ccc2
WIP
petertonysmith94 Sep 12, 2024
a3c9076
Merge branch 'np/feat/abi-refactor' into ns/feat/abi-matchers
nedsalk Sep 12, 2024
f09c239
Merge branch 'ns/feat/abi-parser' of https://github.com/FuelLabs/fuel…
petertonysmith94 Sep 12, 2024
f1f9abd
Merge branch 'ns/feat/abi-parser-ps-tidy' into ps/feat/abi-coder
petertonysmith94 Sep 12, 2024
2a82d8a
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Sep 12, 2024
6b9e0da
Merge branch 'ns/feat/abi-matchers' of https://github.com/FuelLabs/fu…
petertonysmith94 Sep 12, 2024
2545ea8
chore: allowed mapping to undefined
petertonysmith94 Sep 15, 2024
d4a4b94
WIP
petertonysmith94 Sep 15, 2024
153c9b4
chore: added errors
petertonysmith94 Sep 16, 2024
56cb395
chore: keep name of vector buf
petertonysmith94 Sep 16, 2024
74c7007
feat: implemented encodedLength for coders
petertonysmith94 Sep 16, 2024
631cef5
Merge branch 'np/feat/abi-refactor' of https://github.com/FuelLabs/fu…
petertonysmith94 Sep 16, 2024
40a5a1a
chore: consistent matcher type
petertonysmith94 Sep 16, 2024
2f02316
chore: added missing string slice matcher
petertonysmith94 Sep 17, 2024
9a1b5fc
feat: finalize structure
petertonysmith94 Sep 17, 2024
d547c46
feat: attempt to add vitest matcher `toEqualBn`
petertonysmith94 Sep 17, 2024
534f3fb
feat: encoding tests (bool, u8, u16, u32, u64, u256)
petertonysmith94 Sep 17, 2024
2861ef9
feat: added b256 and b512 tests
petertonysmith94 Sep 17, 2024
ef9b16a
Merge branch 'np/feat/abi-refactor' of https://github.com/FuelLabs/fu…
petertonysmith94 Sep 17, 2024
bf7e633
chore: finalized test structure
petertonysmith94 Sep 17, 2024
1ab55cd
chore: added void test
petertonysmith94 Sep 17, 2024
a69ac9b
chore: finalized enum
petertonysmith94 Sep 17, 2024
c73a21c
chore: finalized heap types
petertonysmith94 Sep 17, 2024
c591ed5
chore: added struct tests
petertonysmith94 Sep 18, 2024
84a6c10
chore: added tuple
petertonysmith94 Sep 18, 2024
372a97e
chore: vector tests
petertonysmith94 Sep 18, 2024
d291e27
chore: added multi-argument tests
petertonysmith94 Sep 18, 2024
4245f9e
chore: added type-fest
petertonysmith94 Sep 20, 2024
a5aaf12
chore: fixed raw slice matcher
petertonysmith94 Sep 20, 2024
eab265d
chore: testing WIP
petertonysmith94 Sep 20, 2024
2cdb71b
feat: couple coder fixes
petertonysmith94 Sep 20, 2024
a7de7ae
chore: tests
petertonysmith94 Sep 20, 2024
d7d4f46
chore: reverting back external packages (@fuel-ts/abi-*)
petertonysmith94 Sep 20, 2024
2e4aeef
chore: seperated string from fixed
petertonysmith94 Sep 21, 2024
d42abc7
Merge remote-tracking branch 'origin' into ps/feat/abi-coder
petertonysmith94 Oct 1, 2024
dfe11d6
Merge branch 'next' of https://github.com/FuelLabs/fuels-ts into ps/f…
petertonysmith94 Oct 1, 2024
f8748cb
chore: added most coder tests
petertonysmith94 Oct 2, 2024
8244965
chore: removed old interface test
petertonysmith94 Oct 2, 2024
231683c
chore: added switch for abi-coder tests
petertonysmith94 Oct 2, 2024
66c97b7
chore: encoding WIP
petertonysmith94 Oct 2, 2024
1643856
Merge branch 'next' of https://github.com/FuelLabs/fuels-ts into ps/f…
petertonysmith94 Oct 2, 2024
6b23067
chore: added tests around all `abi-contract` tests
petertonysmith94 Oct 3, 2024
b000281
chore: changeset
petertonysmith94 Oct 3, 2024
96a74ea
fix Eq for ExternalEnum
Torres-ssf Oct 4, 2024
0932fd6
fix equals use
Torres-ssf Oct 4, 2024
d91f6fc
linting
Torres-ssf Oct 4, 2024
801c02d
minor fixes within contract code
Torres-ssf Oct 4, 2024
d8b58e5
fix comparison at types_value_then_value_then_void_then_void
Torres-ssf Oct 4, 2024
f6f6cd4
implementing missing Eq
Torres-ssf Oct 4, 2024
54af3cc
using let for heap types
Torres-ssf Oct 4, 2024
fa6e12a
rename vec_32_from
Torres-ssf Oct 4, 2024
e2cb4cc
rename some functions
Torres-ssf Oct 4, 2024
33dd29d
rename types_option_geo
Torres-ssf Oct 4, 2024
15453dc
type_struct_external
Torres-ssf Oct 4, 2024
dd7108d
rename contract abi
Torres-ssf Oct 4, 2024
b2df95f
fix test case types_enum_external
Torres-ssf Oct 4, 2024
fba792f
implement Eqs related to types_struct_with_implicit_generics fn
Torres-ssf Oct 4, 2024
f0cd0ed
implementing types_struct_with_implicit_generics
Torres-ssf Oct 4, 2024
7687b3a
add test for types_struct_with_implicit_generics
Torres-ssf Oct 4, 2024
6de8b99
unskip test
Torres-ssf Oct 4, 2024
767821b
use let instead of const to avoid run-time compile error
Torres-ssf Oct 4, 2024
2dd95c5
fixing some tests
Torres-ssf Oct 4, 2024
cbd8b13
fix multi_arg_b256_bool fn and its test
Torres-ssf Oct 4, 2024
f8e8d7a
unskip multi_arg_vector_vector
Torres-ssf Oct 4, 2024
18ffc35
unskip multi_arg_vector_b256
Torres-ssf Oct 4, 2024
d9b30d2
unskip multi_arg_struct_vector
Torres-ssf Oct 4, 2024
23385f0
implement multi_arg_u64_struct
Torres-ssf Oct 4, 2024
f54a2a2
add test for multi_arg_u64_struct
Torres-ssf Oct 4, 2024
84ae89c
implement multi_arg_str_str
Torres-ssf Oct 4, 2024
978ad9b
add test for multi_arg_str_str
Torres-ssf Oct 4, 2024
411ca8f
implement Eq for Vec<u64>
Torres-ssf Oct 4, 2024
50ab5a8
implement fn multi_arg_u32_vector_vector
Torres-ssf Oct 4, 2024
eef5009
add test for multi_arg_u32_vector_vector
Torres-ssf Oct 4, 2024
9b6913f
remove wrong async
Torres-ssf Oct 4, 2024
9ec7574
adding multiple equalies func
Torres-ssf Oct 7, 2024
0f32f15
fixing fn return type
Torres-ssf Oct 7, 2024
6536404
implement multi_arg_complex
Torres-ssf Oct 7, 2024
db4a6c0
add test case
Torres-ssf Oct 7, 2024
4b4f912
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Oct 21, 2024
d639b0a
chore: fix typegen tests
petertonysmith94 Oct 22, 2024
00c5d8d
chore: removed un-need `@ts-expect-error` from `abi-coder.test.ts`
petertonysmith94 Oct 22, 2024
976e057
chore: fix failing type checking
petertonysmith94 Oct 22, 2024
ae93d99
chore: added whitespace between each describe block
petertonysmith94 Oct 22, 2024
8eb0a46
chore: added whitespace (main.sw)
petertonysmith94 Oct 22, 2024
3c5599b
chore: implemented `types_struct_with_vector`
petertonysmith94 Oct 23, 2024
97fd8ba
chore: tidy up/linting
petertonysmith94 Oct 23, 2024
abd994f
chore: implemented `types_struct_with_array_of_enums`
petertonysmith94 Oct 23, 2024
cc2cea7
chore: implemented `types_struct_with_single_option` test
petertonysmith94 Oct 27, 2024
9f57edc
chore: added missing test
petertonysmith94 Oct 31, 2024
0c2769e
Merge branch 'master' into ps/chore/add-full-abi-coder-tests
Torres-ssf Nov 4, 2024
da14c65
Merge branch 'ps/chore/add-full-abi-coder-tests' of https://github.co…
petertonysmith94 Nov 6, 2024
2bc8a1a
Merge branch 'master' into ps/chore/add-full-abi-coder-tests
Torres-ssf Nov 6, 2024
f5e6074
feat: added Equality for `StructWithSingleOption`
petertonysmith94 Nov 8, 2024
0ab3c0f
chore: skip failing test
petertonysmith94 Nov 8, 2024
659e0ed
feat: implemented configurables tests
petertonysmith94 Nov 8, 2024
68340ab
Merge branch 'ps/chore/add-full-abi-coder-tests' of https://github.co…
petertonysmith94 Nov 8, 2024
5528237
chore: fixed typegen tests
petertonysmith94 Nov 8, 2024
a73a146
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Nov 8, 2024
a8ad3ef
chore: pull over abi-coder integration test
petertonysmith94 Nov 8, 2024
2c0822a
Merge branch 'ps/chore/add-full-abi-coder-tests' into ps/feat/abi-coder
petertonysmith94 Nov 8, 2024
79ebaf4
Merge remote-tracking branch 'origin' into ps/chore/add-full-abi-code…
petertonysmith94 Nov 8, 2024
b881bac
Merge branch 'ps/chore/add-full-abi-coder-tests' into ps/feat/abi-coder
petertonysmith94 Nov 11, 2024
c45b8b2
chore: added missing dep
petertonysmith94 Nov 12, 2024
059e2e2
feat: added function signature, selector, selector bytes attributes
petertonysmith94 Nov 12, 2024
1bf27d6
feat: added configurables to the coder
petertonysmith94 Nov 12, 2024
46f3a9c
Merge branch 'ns/feat/abi-parser' of https://github.com/FuelLabs/fuel…
petertonysmith94 Nov 17, 2024
384de74
chore:str
petertonysmith94 Nov 17, 2024
6e52334
chore: added missing type to fragment
petertonysmith94 Nov 17, 2024
1f4da15
chore: added test for potential issue with EnumCoder
petertonysmith94 Nov 17, 2024
459715f
chore: fixed native enum
petertonysmith94 Nov 17, 2024
2b85293
feat: implemented option coder
petertonysmith94 Nov 17, 2024
822a4c6
feat: implemented adapter for encode/decoding using existing Interface
petertonysmith94 Nov 17, 2024
02a8327
chore: skipped potentially broken functionality
petertonysmith94 Nov 17, 2024
b7f7f80
chore: use ContractFactory for setting configurables
petertonysmith94 Nov 17, 2024
894ca66
chore: throw error for generic match
petertonysmith94 Nov 17, 2024
9399b2c
feat: implemented logged types
petertonysmith94 Nov 17, 2024
23d5514
feat: added tests around function properties
petertonysmith94 Nov 18, 2024
cdb2b87
Merge branch 'ns/feat/abi-parser' into ps/feat/abi-coder
petertonysmith94 Nov 18, 2024
c904a98
chore: added noImplicitOverride option to config (#3384)
YaTut1901 Nov 18, 2024
6ab3e6b
feat: better typegen contract factory integration with `launchTestNod…
nedsalk Nov 19, 2024
7f92490
docs: contributing guide update (#3409)
petertonysmith94 Nov 20, 2024
30585c1
chore: move type:check to lint hook (#3381)
Rohit-Bhetal Nov 20, 2024
c04f2b1
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Nov 21, 2024
a1d8d0f
feat: implement function signature
petertonysmith94 Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/large-points-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@fuel-ts/abi-typegen": patch
"@fuel-ts/abi-coder": patch
"@fuel-ts/account": patch
"@fuel-ts/address": patch
"@fuel-ts/program": patch
"@fuel-ts/script": patch
"@fuel-ts/math": patch
---

chore: added noImplicitOverride option to config
2 changes: 2 additions & 0 deletions .changeset/long-ducks-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 4 additions & 0 deletions .changeset/polite-seas-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

chore: move type:check to lint hook
5 changes: 5 additions & 0 deletions .changeset/twenty-needles-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/contract": patch
---

feat: better typegen contract factory integration with `launchTestNode`
85 changes: 85 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,85 @@ See also:

- [Developing](#developing)

# Working with Unreleased Forc and Fuel-Core Functionality

When you need to work with unreleased versions of `forc` or `fuel-core`, you can specify a git branch instead of a version number in the respective `VERSION` file.

## Using Unreleased Forc

To use an unreleased version of `forc`:

1. **Edit the `VERSION` File**
Open the `internal/forc/VERSION` file and replace the version number (e.g., `0.59.0`) with the desired git branch:

```text
git:some/branch-name
```

1. **Install and Build**
To download and build `forc` from the specified branch after updating `VERSION` file, run:

```sh
pnpm install
pnpm build
```

The following directory will be updated or created: `internal/forc/sway-repo`

## Using Unreleased Fuel-Core

Similarly, to use an unreleased version of `fuel-core`:

1. **Edit the `VERSION` file:**
Open the `internal/fuel-core/VERSION` file and replace the version number with the desired git branch:

```text
git:some/branch-name
```

1. **Install and Build**
To download and build `fuel-core` from the specified branch after updating `VERSION` file, run:

```sh
pnpm install
pnpm build
```

> [!Note]
> The `internal/forc/sway-repo` and `internal/fuel-core/fuel-core-repo` directory will contain a local clone of the Sway and Fuel Core repository respectively, at the specific version or git branch you have specified in the `internal/forc/VERSION` and `internal/fuel-core/VERSION` file.

## Unreleased Files and Directories Created After Installation

After running `pnpm install` and `pnpm build`, the following files and directories are created:

- Forc Repository:

- Located at `internal/forc/sway-repo`.
- Contains the source code for the version of `forc` you are using.

- Fuel-Core Repository:
- Located at `internal/fuel-core/fuel-core-repo`.
- Contains the source code for the version of `fuel-core` you are using.

## Switching Back to Standard Binaries

If you switch back to using standard binaries you might encounter issues where the SDK still uses the previously downloaded unreleased binaries.

To resolve the issue and ensure the SDK uses the correct binaries:

1. **Delete the downloaded repositories**

```sh
rm -rf internal/forc/sway-repo
rm -rf internal/fuel-core/fuel-core-repo
```

1. **Reinstall and build**
```sh
pnpm install
pnpm build
```

# Testing

In order to run tests locally, you can run the following commands:
Expand Down Expand Up @@ -182,6 +261,12 @@ DEVNET_WALLET_PVT_KEY=0x...
TESTNET_WALLET_PVT_KEY=0x...
```

This will enable you to run the e2e test locally against the live network:

```sh
pnpm test:filter e2e-script
```

<!-- TODO: add/fix block explorer URL after testnet support- Checking Wallet Balance: https://fuellabs.github.io/block-explorer-v2/beta-5/?#/address/fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg -->

# Commit Convention
Expand Down
3 changes: 2 additions & 1 deletion apps/docs-snippets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"private": true,
"scripts": {
"pretest": "./scripts/pretest.sh"
"pretest": "./scripts/pretest.sh",
"type:check": "tsc --noEmit"
},
"devDependencies": {
"@fuel-ts/account": "workspace:*",
Expand Down
3 changes: 0 additions & 3 deletions apps/docs-snippets/scripts/pretest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ pnpm fuels build

# Deploys projects (needed for loader bytecode)
pnpm fuels deploy

# Checks for type errors
pnpm tsc --noEmit
2 changes: 1 addition & 1 deletion apps/docs-snippets2/src/testing/launching-a-test-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ customLaunchTestNode.cleanup();
import { CounterFactory } from '../typegend/contracts/CounterFactory';

using launchedContractNode = await launchTestNode({
contractsConfigs: [{ factory: CounterFactory }],
contractsConfigs: [CounterFactory],
});

const {
Expand Down
4 changes: 2 additions & 2 deletions apps/docs-snippets2/src/wallets/connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ metadata = {

class WalletConnector extends FuelConnector {
// #region fuel-connector-name
name: string = 'My Wallet Connector';
public override name: string = 'My Wallet Connector';
// #endregion fuel-connector-name

// #region fuel-connector-metadata
metadata = {
public override metadata = {
install: metadata.install,
image: metadata.image,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Fuel, FuelConnector } from 'fuels';

class WalletConnector extends FuelConnector {
name: string = 'My Wallet Connector';
public override name: string = 'My Wallet Connector';
}

const defaultConnectors = (_opts: {
Expand Down
2 changes: 1 addition & 1 deletion internal/benchmarks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"scripts": {
"type:check": "tsc --noEmit",
"pretest": "run-s build:forc type:check",
"pretest": "run-s build:forc ",
"build:forc": "pnpm fuels build"
},
"license": "Apache-2.0",
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
"clinic:doctor": "clinic doctor --autocannon [ / ] -- node packages/${npm_config_package_name}/dist/profile.js",
"clinic:heap": "clinic heapprofiler --autocannon [ / ] -- node packages/${npm_config_package_name}/dist/profile.js",
"test:integration": "vitest --run --config vitest.node.config.mts $(scripts/tests-find.sh --integration)",
"lint": "run-s type:check-tests lint:check prettier:check",
"lint": "run-s type:check-tests lint:check prettier:check type:check",
"lint:check": "eslint . --ext .ts --max-warnings 0",
"lint:fix": "pnpm lint:check --fix",
"lint:md-links": "tsx ./scripts/lint-md-links",
"lint:package-jsons": "tsx ./scripts/lint-package-jsons",
"type:check": "turbo run type:check",
"type:check-tests": "tsc -p tsconfig.test.json",
"prettier:check": "prettier --check packages --check apps/docs-snippets",
"prettier:format": "prettier --write packages --check apps/docs-snippets",
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/src/FunctionFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class FunctionFragment {
return new TupleCoder(coders).encode(argumentValues);
}

decodeArguments(data: BytesLike) {
decodeArguments(data: BytesLike): unknown[] | undefined {
const bytes = arrayify(data);
const nonVoidInputs = findNonVoidInputs(this.jsonAbiOld, this.jsonFnOld.inputs);

Expand Down
15 changes: 14 additions & 1 deletion packages/abi-coder/src/encoding/coders/EnumCoder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('EnumCoder', () => {
expect(actual).toStrictEqual(expected);
});

it('encodes a native enum', () => {
it('encodes a native enum (void)', () => {
const nativeCoder = new EnumCoder('Native', {
One: new BooleanCoder(),
Two: new BigNumberCoder('u64'),
Expand All @@ -46,6 +46,19 @@ describe('EnumCoder', () => {
expect(actual).toStrictEqual(expected);
});

it('encodes a native enum (u64)', () => {
const nativeCoder = new EnumCoder('Native', {
One: new BooleanCoder(),
Two: new BigNumberCoder('u64'),
Three: new VoidCoder(),
});

const expected = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 2]);
// @ts-expect-error native
const actual = nativeCoder.encode('Two');
expect(actual).toStrictEqual(expected);
});

it('should throw an error when encoding if no enum key is provided', async () => {
await expectToThrowFuelError(
() => coder.encode({} as never),
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/src/encoding/coders/EnumCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class EnumCoder<TCoders extends Record<string, Coder>> extends Coder<
InputValueOf<TCoders>,
DecodedValueOf<TCoders>
> {
name: string;
override name: string;
coders: TCoders;
#caseIndexCoder: BigNumberCoder;
#encodedValueSize: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/abi-coder/src/encoding/coders/OptionCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type SwayOption<T> = { None: [] } | { Some: T };
export type Option<T> = T | undefined;

export class OptionCoder<TCoders extends Record<string, Coder>> extends EnumCoder<TCoders> {
encode(value?: Option<unknown>): Uint8Array {
override encode(value?: Option<unknown>): Uint8Array {
const result = super.encode(this.toSwayOption(value) as unknown as InputValueOf<TCoders>);
return result;
}
Expand All @@ -19,7 +19,7 @@ export class OptionCoder<TCoders extends Record<string, Coder>> extends EnumCode
return { None: [] };
}

decode(data: Uint8Array, offset: number): [DecodedValueOf<TCoders>, number] {
override decode(data: Uint8Array, offset: number): [DecodedValueOf<TCoders>, number] {
const [decoded, newOffset] = super.decode(data, offset);
return [this.toOption(decoded) as DecodedValueOf<TCoders>, newOffset];
}
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-coder/src/encoding/coders/StructCoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class StructCoder<TCoders extends Record<string, Coder>> extends Coder<
InputValueOf<TCoders>,
DecodedValueOf<TCoders>
> {
name: string;
override name: string;
coders: TCoders;
#hasNestedOption: boolean;

Expand Down
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/AssetIdType.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { B256Type } from './B256Type';

export class AssetIdType extends B256Type {
public static swayType = 'struct AssetId';
public static override swayType = 'struct AssetId';

public name = 'AssetId';
public override name = 'AssetId';

static MATCH_REGEX = /^struct AssetId$/m;
static override MATCH_REGEX = /^struct AssetId$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return AssetIdType.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/B256Type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { StrType } from './StrType';

export class B256Type extends StrType {
public static swayType = 'b256';
public static override swayType = 'b256';

public name = 'b256';
public override name = 'b256';

static MATCH_REGEX = /^b256$/m;
static override MATCH_REGEX = /^b256$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return B256Type.MATCH_REGEX.test(params.type);
}
}
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/B512Type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { B256Type } from './B256Type';

export class B512Type extends B256Type {
public static swayType = 'struct B512';
public static override swayType = 'struct B512';

public name = 'b512';
public override name = 'b512';

static MATCH_REGEX = /^struct (std::b512::)?B512$/m;
static override MATCH_REGEX = /^struct (std::b512::)?B512$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return B512Type.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/BytesType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import type { IType } from '../../types/interfaces/IType';
import { ArrayType } from './ArrayType';

export class BytesType extends ArrayType {
public static swayType = 'struct Bytes';
public static override swayType = 'struct Bytes';

public name = 'bytes';
public override name = 'bytes';

static MATCH_REGEX: RegExp = /^struct (std::bytes::)?Bytes/m;
static override MATCH_REGEX: RegExp = /^struct (std::bytes::)?Bytes/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return BytesType.MATCH_REGEX.test(params.type);
}

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
const capitalizedName = 'Bytes';

this.attributes = {
Expand Down
8 changes: 4 additions & 4 deletions packages/abi-typegen/src/abi/types/RawUntypedPtr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import type { IType } from '../../types/interfaces/IType';
import { U64Type } from './U64Type';

export class RawUntypedPtr extends U64Type implements IType {
public static swayType = 'raw untyped ptr';
public static override swayType = 'raw untyped ptr';

public name = 'rawUntypedPtr';
public override name = 'rawUntypedPtr';

public static MATCH_REGEX: RegExp = /^raw untyped ptr$/m;
public static override MATCH_REGEX: RegExp = /^raw untyped ptr$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return RawUntypedPtr.MATCH_REGEX.test(params.type);
}
}
10 changes: 5 additions & 5 deletions packages/abi-typegen/src/abi/types/RawUntypedSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import type { IType } from '../../types/interfaces/IType';
import { ArrayType } from './ArrayType';

export class RawUntypedSlice extends ArrayType {
public static swayType = 'raw untyped slice';
public static override swayType = 'raw untyped slice';

public name = 'rawUntypedSlice';
public override name = 'rawUntypedSlice';

public static MATCH_REGEX: RegExp = /^raw untyped slice$/m;
public static override MATCH_REGEX: RegExp = /^raw untyped slice$/m;

static isSuitableFor(params: { type: string }) {
static override isSuitableFor(params: { type: string }) {
return RawUntypedSlice.MATCH_REGEX.test(params.type);
}

public parseComponentsAttributes(_params: { types: IType[] }) {
public override parseComponentsAttributes(_params: { types: IType[] }) {
const capitalizedName = 'RawSlice';

this.attributes = {
Expand Down
Loading
Loading