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: added messagesTypes to JsonAbi #2332

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/wicked-socks-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/abi-typegen": patch
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
---

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: [],
};
Loading