From 879d5536f1fd60cde6458b7e22f98b2748be28d1 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 17 May 2024 16:22:15 +0100 Subject: [PATCH 1/4] Added `messagesTypes` to `JsonAbi` --- packages/abi-coder/src/types/JsonAbi.ts | 11 +++++++++++ packages/account/test/fixtures/predicate-abi.ts | 1 + packages/account/test/fixtures/transaction-summary.ts | 1 + packages/account/test/fuel-wallet-connector.test.ts | 1 + packages/program/src/contract.test.ts | 1 + packages/script/test/mocks.ts | 2 ++ 6 files changed, 17 insertions(+) diff --git a/packages/abi-coder/src/types/JsonAbi.ts b/packages/abi-coder/src/types/JsonAbi.ts index 6df0b2d9d6e..2e481d27aaf 100644 --- a/packages/abi-coder/src/types/JsonAbi.ts +++ b/packages/abi-coder/src/types/JsonAbi.ts @@ -6,6 +6,7 @@ export interface JsonAbi { readonly types: readonly JsonAbiType[]; readonly loggedTypes: readonly JsonAbiLoggedType[]; readonly functions: readonly JsonAbiFunction[]; + readonly messagesTypes: readonly JsonAbiMessagesType[]; readonly configurables: readonly JsonAbiConfigurable[]; readonly encoding?: string; } @@ -16,17 +17,27 @@ export interface JsonAbiType { readonly components: readonly JsonAbiArgument[] | null; readonly typeParameters: readonly number[] | null; } + export interface JsonAbiArgument { readonly type: number; readonly name: string; readonly typeArguments: readonly JsonAbiArgument[] | null; } +export interface JsonAbiArgumentWithoutName { + readonly type: number; + readonly typeArguments: readonly JsonAbiArgumentWithoutName[] | null; +} + export interface JsonAbiLoggedType { readonly logId: string; readonly loggedType: JsonAbiArgument; } +export interface JsonAbiMessagesType { + readonly messageDataType: JsonAbiArgumentWithoutName; +} + export interface JsonAbiFunction { readonly name: string; readonly inputs: readonly JsonAbiArgument[]; diff --git a/packages/account/test/fixtures/predicate-abi.ts b/packages/account/test/fixtures/predicate-abi.ts index df0ab35435b..c1f6d092238 100644 --- a/packages/account/test/fixtures/predicate-abi.ts +++ b/packages/account/test/fixtures/predicate-abi.ts @@ -34,5 +34,6 @@ export const predicateAbi: JsonAbi = { }, ], loggedTypes: [], + messagesTypes: [], configurables: [], }; diff --git a/packages/account/test/fixtures/transaction-summary.ts b/packages/account/test/fixtures/transaction-summary.ts index 1410ae72831..1b0b3e8c2a1 100644 --- a/packages/account/test/fixtures/transaction-summary.ts +++ b/packages/account/test/fixtures/transaction-summary.ts @@ -256,6 +256,7 @@ export const MOCK_ABI_MAP: AbiMap = { }, ], loggedTypes: [], + messagesTypes: [], configurables: [], }, }; diff --git a/packages/account/test/fuel-wallet-connector.test.ts b/packages/account/test/fuel-wallet-connector.test.ts index 4653a92a21d..5ac5b2af478 100644 --- a/packages/account/test/fuel-wallet-connector.test.ts +++ b/packages/account/test/fuel-wallet-connector.test.ts @@ -286,6 +286,7 @@ describe('Fuel Connector', () => { types: [], loggedTypes: [], functions: [], + messagesTypes: [], configurables: [], }); expect(isAdded).toEqual(true); diff --git a/packages/program/src/contract.test.ts b/packages/program/src/contract.test.ts index 78e3aa3123c..d861b27d4d0 100644 --- a/packages/program/src/contract.test.ts +++ b/packages/program/src/contract.test.ts @@ -33,6 +33,7 @@ const ABI: JsonAbi = { }, ], loggedTypes: [], + messagesTypes: [], configurables: [], }; diff --git a/packages/script/test/mocks.ts b/packages/script/test/mocks.ts index dbb32496a4b..6c7b8a9516f 100644 --- a/packages/script/test/mocks.ts +++ b/packages/script/test/mocks.ts @@ -3,6 +3,7 @@ import type { JsonAbi } from '@fuel-ts/abi-coder'; export const jsonAbiFragmentMock: JsonAbi = { configurables: [], loggedTypes: [], + messagesTypes: [], types: [ { typeId: 0, @@ -88,5 +89,6 @@ export const jsonAbiMock: JsonAbi = { }, ], loggedTypes: [], + messagesTypes: [], configurables: [], }; From 4f082f79a0a5cfd062ebd702a66719ec68e1945f Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Fri, 17 May 2024 16:23:18 +0100 Subject: [PATCH 2/4] Changeset --- .changeset/wicked-socks-breathe.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wicked-socks-breathe.md diff --git a/.changeset/wicked-socks-breathe.md b/.changeset/wicked-socks-breathe.md new file mode 100644 index 00000000000..ca6a449b67b --- /dev/null +++ b/.changeset/wicked-socks-breathe.md @@ -0,0 +1,5 @@ +--- +"@fuel-ts/abi-typegen": patch +--- + +chore: added `messagesTypes` to `JsonAbi` From bbe6dccfa1edbfce741c744a4811d6354c2edca3 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 20 May 2024 10:18:45 +0100 Subject: [PATCH 3/4] feat: added `messagesTypes` to the `abi-typegen` package --- packages/abi-typegen/src/types/interfaces/IRawAbi.ts | 2 ++ .../src/types/interfaces/IRawAbiMessagesType.ts | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 packages/abi-typegen/src/types/interfaces/IRawAbiMessagesType.ts diff --git a/packages/abi-typegen/src/types/interfaces/IRawAbi.ts b/packages/abi-typegen/src/types/interfaces/IRawAbi.ts index a0c46accbde..ee8753614f6 100644 --- a/packages/abi-typegen/src/types/interfaces/IRawAbi.ts +++ b/packages/abi-typegen/src/types/interfaces/IRawAbi.ts @@ -1,6 +1,7 @@ import type { IRawAbiConfigurable } from './IRawAbiConfigurable'; import type { IRawAbiFunction } from './IRawAbiFunction'; import type { IRawAbiLoggedTypes } from './IRawAbiLoggedTypes'; +import type { IRawAbiMessagesType } from './IRawAbiMessagesType'; import type { IRawAbiTypeRoot } from './IRawAbiType'; export interface IRawAbi { @@ -8,4 +9,5 @@ export interface IRawAbi { functions: IRawAbiFunction[]; loggedTypes: IRawAbiLoggedTypes[]; configurables: IRawAbiConfigurable[]; + messagesTypes: IRawAbiMessagesType[]; } diff --git a/packages/abi-typegen/src/types/interfaces/IRawAbiMessagesType.ts b/packages/abi-typegen/src/types/interfaces/IRawAbiMessagesType.ts new file mode 100644 index 00000000000..4d6993cb35f --- /dev/null +++ b/packages/abi-typegen/src/types/interfaces/IRawAbiMessagesType.ts @@ -0,0 +1,8 @@ +export interface IRawAbiMessagesType { + messageDataType: IRawAbiMessageDataType; +} + +export interface IRawAbiMessageDataType { + type: number; + typeArguments: null | IRawAbiMessageDataType[]; +} From ff2d7289000ac9eb1aa1adb23e97938aa50f9d91 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 20 May 2024 11:22:28 +0100 Subject: [PATCH 4/4] Updated changeset --- .changeset/wicked-socks-breathe.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.changeset/wicked-socks-breathe.md b/.changeset/wicked-socks-breathe.md index ca6a449b67b..c142bd311f0 100644 --- a/.changeset/wicked-socks-breathe.md +++ b/.changeset/wicked-socks-breathe.md @@ -1,4 +1,5 @@ --- +"@fuel-ts/abi-coder": patch "@fuel-ts/abi-typegen": patch ---