Skip to content

fix: export abi types #1145

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

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Changes from all 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
24 changes: 13 additions & 11 deletions src/types/api/rpcspec_0_6/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ABI = Array<
FUNCTION | CONSTRUCTOR | L1_HANDLER | EVENT | STRUCT | ENUM | INTERFACE | IMPL
>;

type FUNCTION = {
export type FUNCTION = {
type: 'function';
name: string;
inputs: Array<{
Expand All @@ -24,7 +24,7 @@ type FUNCTION = {
state_mutability: 'view' | 'external';
};

type CONSTRUCTOR = {
export type CONSTRUCTOR = {
type: 'constructor';
name: 'constructor';
inputs: Array<{
Expand All @@ -33,7 +33,7 @@ type CONSTRUCTOR = {
}>;
};

type L1_HANDLER = {
export type L1_HANDLER = {
type: 'l1_handler';
name: string;
inputs: Array<{
Expand All @@ -46,22 +46,22 @@ type L1_HANDLER = {
state_mutability: 'view' | 'external';
};

type EVENT = {
export type EVENT = {
type: 'event';
name: string;
} & (ENUM_EVENT | STRUCT_EVENT);

type STRUCT_EVENT = {
export type STRUCT_EVENT = {
kind: 'struct';
members: Array<EVENT_FIELD>;
};

type ENUM_EVENT = {
export type ENUM_EVENT = {
kind: 'enum';
variants: Array<EVENT_FIELD>;
};

type STRUCT = {
export type STRUCT = {
type: 'struct';
name: string;
members: Array<{
Expand All @@ -70,7 +70,7 @@ type STRUCT = {
}>;
};

type ENUM = {
export type ENUM = {
type: 'enum';
name: string;
variants: Array<{
Expand All @@ -79,19 +79,21 @@ type ENUM = {
}>;
};

type INTERFACE = {
export type INTERFACE = {
type: 'interface';
name: string;
items: Array<FUNCTION>;
};

type IMPL = {
export type IMPL = {
type: 'impl';
name: string;
interface_name: string;
};

type EVENT_FIELD = {
export type EVENT_KIND = 'struct' | 'enum';

export type EVENT_FIELD = {
name: string;
type: string;
kind: 'key' | 'data' | 'nested';
Expand Down