Skip to content

Commit

Permalink
chore: added messagesTypes to JsonAbi (#2332)
Browse files Browse the repository at this point in the history
* Added `messagesTypes` to `JsonAbi`

* Changeset

* feat: added `messagesTypes` to the `abi-typegen` package

* Updated changeset
  • Loading branch information
petertonysmith94 authored May 20, 2024
1 parent 685829b commit f76aa57
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/wicked-socks-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@fuel-ts/abi-coder": patch
"@fuel-ts/abi-typegen": patch
---

chore: added `messagesTypes` to `JsonAbi`
11 changes: 11 additions & 0 deletions packages/abi-coder/src/types/JsonAbi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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[];
Expand Down
2 changes: 2 additions & 0 deletions packages/abi-typegen/src/types/interfaces/IRawAbi.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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 {
types: IRawAbiTypeRoot[];
functions: IRawAbiFunction[];
loggedTypes: IRawAbiLoggedTypes[];
configurables: IRawAbiConfigurable[];
messagesTypes: IRawAbiMessagesType[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface IRawAbiMessagesType {
messageDataType: IRawAbiMessageDataType;
}

export interface IRawAbiMessageDataType {
type: number;
typeArguments: null | IRawAbiMessageDataType[];
}
1 change: 1 addition & 0 deletions packages/account/test/fixtures/predicate-abi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ export const predicateAbi: JsonAbi = {
},
],
loggedTypes: [],
messagesTypes: [],
configurables: [],
};
1 change: 1 addition & 0 deletions packages/account/test/fixtures/transaction-summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ export const MOCK_ABI_MAP: AbiMap = {
},
],
loggedTypes: [],
messagesTypes: [],
configurables: [],
},
};
Expand Down
1 change: 1 addition & 0 deletions packages/account/test/fuel-wallet-connector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ describe('Fuel Connector', () => {
types: [],
loggedTypes: [],
functions: [],
messagesTypes: [],
configurables: [],
});
expect(isAdded).toEqual(true);
Expand Down
1 change: 1 addition & 0 deletions packages/program/src/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ABI: JsonAbi = {
},
],
loggedTypes: [],
messagesTypes: [],
configurables: [],
};

Expand Down
2 changes: 2 additions & 0 deletions packages/script/test/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { JsonAbi } from '@fuel-ts/abi-coder';
export const jsonAbiFragmentMock: JsonAbi = {
configurables: [],
loggedTypes: [],
messagesTypes: [],
types: [
{
typeId: 0,
Expand Down Expand Up @@ -88,5 +89,6 @@ export const jsonAbiMock: JsonAbi = {
},
],
loggedTypes: [],
messagesTypes: [],
configurables: [],
};

0 comments on commit f76aa57

Please sign in to comment.