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

chore: add full abi coder tests #3349

Draft
wants to merge 41 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
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
0c2769e
Merge branch 'master' into ps/chore/add-full-abi-coder-tests
Torres-ssf Nov 4, 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
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 @@
---
---
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ abi MyContract {
fn types_vector_geo(x: Vec<MyStruct>) -> Vec<MyStruct>;
fn types_vector_option(x: Vec<StructWithMultiOption>) -> Vec<StructWithMultiOption>;
fn types_option(x: Option<u8>) -> Option<u8>;
fn types_option_geo(x: Option<MyStruct>) -> Option<MyStruct>;
fn types_option_struct(x: Option<MyStruct>) -> Option<MyStruct>;
fn types_evm_address(x: EvmAddress) -> EvmAddress;
fn types_bytes(x: Bytes) -> Bytes;
fn types_raw_slice(x: raw_slice) -> raw_slice;
fn types_str_slice(x: str) -> str;
fn types_std_string(x: String) -> String;
fn types_result(x: Result<u64, u32>) -> Result<u64, str[10]>;
fn type_address(x: Address) -> Address;
fn type_contract_id(x: ContractId) -> ContractId;
fn types_address(x: Address) -> Address;
fn types_contract_id(x: ContractId) -> ContractId;
fn type_identity(x: Identity) -> Identity;
fn type_external_struct(x: ExternalStruct) -> ExternalStruct;
fn type_external_enum(x: ExternalEnum) -> ExternalEnum;
Expand Down Expand Up @@ -182,7 +182,7 @@ impl MyContract for Contract {
fn types_option(x: Option<u8>) -> Option<u8> {
x
}
fn types_option_geo(x: Option<MyStruct>) -> Option<MyStruct> {
fn types_option_struct(x: Option<MyStruct>) -> Option<MyStruct> {
x
}
fn types_evm_address(x: EvmAddress) -> EvmAddress {
Expand Down Expand Up @@ -211,10 +211,10 @@ impl MyContract for Contract {
Err(MyContractError::DivisionByZero) => Err(__to_str_array("DivisError")),
}
}
fn type_address(x: Address) -> Address {
fn types_address(x: Address) -> Address {
x
}
fn type_contract_id(x: ContractId) -> ContractId {
fn types_contract_id(x: ContractId) -> ContractId {
x
}
fn type_identity(x: Identity) -> Identity {
Expand Down
58 changes: 29 additions & 29 deletions packages/abi-typegen/test/fixtures/templates/contract/main.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -685,28 +685,6 @@ const abi = {
"output": "a95e1fcceb1451b8a76471f593f66c4a52ca04bde3c227c746ad7aaf988de5c6",
"attributes": null
},
{
"inputs": [
{
"name": "x",
"concreteTypeId": "f597b637c3b0f588fb8d7086c6f4735caa3122b85f0423b82e489f9bb58e2308"
}
],
"name": "type_address",
"output": "f597b637c3b0f588fb8d7086c6f4735caa3122b85f0423b82e489f9bb58e2308",
"attributes": null
},
{
"inputs": [
{
"name": "x",
"concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54"
}
],
"name": "type_contract_id",
"output": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54",
"attributes": null
},
{
"inputs": [
{
Expand Down Expand Up @@ -740,6 +718,17 @@ const abi = {
"output": "ab7cd04e05be58e3fc15d424c2c4a57f824a2a2d97d67252440a3925ebdc1335",
"attributes": null
},
{
"inputs": [
{
"name": "x",
"concreteTypeId": "f597b637c3b0f588fb8d7086c6f4735caa3122b85f0423b82e489f9bb58e2308"
}
],
"name": "types_address",
"output": "f597b637c3b0f588fb8d7086c6f4735caa3122b85f0423b82e489f9bb58e2308",
"attributes": null
},
{
"inputs": [
{
Expand Down Expand Up @@ -806,6 +795,17 @@ const abi = {
"output": "cdd87b7d12fe505416570c294c884bca819364863efe3bf539245fa18515fbbb",
"attributes": null
},
{
"inputs": [
{
"name": "x",
"concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54"
}
],
"name": "types_contract_id",
"output": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54",
"attributes": null
},
{
"inputs": [
{
Expand Down Expand Up @@ -905,7 +905,7 @@ const abi = {
"concreteTypeId": "3597e0782bd4dbaf5c8025b40ff3a325845ee34caa713a6d664bda034a31d02a"
}
],
"name": "types_option_geo",
"name": "types_option_struct",
"output": "3597e0782bd4dbaf5c8025b40ff3a325845ee34caa713a6d664bda034a31d02a",
"attributes": null
},
Expand Down Expand Up @@ -1157,17 +1157,17 @@ export class MyContractInterface extends Interface {

declare functions: {
alias_types_tuple_with_native_types: FunctionFragment;
type_address: FunctionFragment;
type_contract_id: FunctionFragment;
type_external_enum: FunctionFragment;
type_external_struct: FunctionFragment;
type_identity: FunctionFragment;
types_address: FunctionFragment;
types_array: FunctionFragment;
types_asset_id: FunctionFragment;
types_b256: FunctionFragment;
types_b512: FunctionFragment;
types_bool: FunctionFragment;
types_bytes: FunctionFragment;
types_contract_id: FunctionFragment;
types_empty: FunctionFragment;
types_empty_then_value: FunctionFragment;
types_enum: FunctionFragment;
Expand All @@ -1176,7 +1176,7 @@ export class MyContractInterface extends Interface {
types_generic_enum: FunctionFragment;
types_generic_struct: FunctionFragment;
types_option: FunctionFragment;
types_option_geo: FunctionFragment;
types_option_struct: FunctionFragment;
types_raw_slice: FunctionFragment;
types_result: FunctionFragment;
types_std_string: FunctionFragment;
Expand Down Expand Up @@ -1206,17 +1206,17 @@ export class MyContract extends Contract {
declare interface: MyContractInterface;
declare functions: {
alias_types_tuple_with_native_types: InvokeFunction<[x: [AssetIdInput, AssetIdInput, boolean]], [AssetIdOutput, AssetIdOutput, boolean]>;
type_address: InvokeFunction<[x: AddressInput], AddressOutput>;
type_contract_id: InvokeFunction<[x: ContractIdInput], ContractIdOutput>;
type_external_enum: InvokeFunction<[x: ExternalEnumInput], ExternalEnumOutput>;
type_external_struct: InvokeFunction<[x: ExternalStructInput], ExternalStructOutput>;
type_identity: InvokeFunction<[x: IdentityInput], IdentityOutput>;
types_address: InvokeFunction<[x: AddressInput], AddressOutput>;
types_array: InvokeFunction<[x: [BigNumberish, BigNumberish, BigNumberish]], [number, number, number]>;
types_asset_id: InvokeFunction<[x: AssetIdInput], AssetIdOutput>;
types_b256: InvokeFunction<[x: string], string>;
types_b512: InvokeFunction<[x: string], string>;
types_bool: InvokeFunction<[x: boolean], boolean>;
types_bytes: InvokeFunction<[x: Bytes], Bytes>;
types_contract_id: InvokeFunction<[x: ContractIdInput], ContractIdOutput>;
types_empty: InvokeFunction<[x?: undefined], void>;
types_empty_then_value: InvokeFunction<[x: undefined, y: BigNumberish], void>;
types_enum: InvokeFunction<[x: MyEnumInput], MyEnumOutput>;
Expand All @@ -1225,7 +1225,7 @@ export class MyContract extends Contract {
types_generic_enum: InvokeFunction<[x: GenericEnumInput<BigNumberish, BigNumberish>], GenericEnumOutput<number, number>>;
types_generic_struct: InvokeFunction<[x: GenericStructWithEnumInput<BigNumberish, BigNumberish>], GenericStructWithEnumOutput<number, number>>;
types_option: InvokeFunction<[x?: Option<BigNumberish>], Option<number>>;
types_option_geo: InvokeFunction<[x?: Option<MyStructInput>], Option<MyStructOutput>>;
types_option_struct: InvokeFunction<[x?: Option<MyStructInput>], Option<MyStructOutput>>;
types_raw_slice: InvokeFunction<[x: RawSlice], RawSlice>;
types_result: InvokeFunction<[x: Result<BigNumberish, BigNumberish>], Result<BN, string>>;
types_std_string: InvokeFunction<[x: StdString], StdString>;
Expand Down
Loading
Loading