Skip to content

Commit

Permalink
shovel-config-ts: update types to match documentation (#279)
Browse files Browse the repository at this point in the history
also: add bun install command to build instructions

---------

Co-authored-by: nathanhleung <[email protected]>
  • Loading branch information
nathanhleung and nathanhleung authored Dec 6, 2024
1 parent cb9264e commit 3286204
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 2 additions & 0 deletions shovel-config-ts/build-instructions.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Here are set of commonly used commands for this project:

bun install

bun run build
bun link @indexsupply/shovel-config

Expand Down
27 changes: 21 additions & 6 deletions shovel-config-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ export type Table = {
index?: IndexStatment[];
};

export type FilterOp = "contains" | "!contains";
export type FilterRefOp = "contains" | "!contains";

export type FilterArgOp = FilterRefOp | "eq" | "ne" | "gt" | "lt";

export type FilterReference = {
integration: string;
column: string;
};

export type Filter = {
op: FilterOp;
op: FilterRefOp;
arg: Hex[];
};

Expand All @@ -65,6 +67,13 @@ export type BlockDataOptions =
| "tx_type"
| "tx_status"
| "log_idx"
| "tx_gas_used"
| "tx_gas_price"
| "tx_effective_gas_price"
| "tx_contract_address"
| "tx_max_priority_fee_per_gas"
| "tx_max_fee_per_gas"
| "tx_nonce"
| "log_addr"
| "trace_action_call_type"
| "trace_action_idx"
Expand All @@ -81,10 +90,13 @@ export type BlockData = {
name: BlockDataOptions;

column: string;
filter_op?: FilterOp;
} & ({
filter_op?: FilterArgOp;
filter_arg?: Hex[];
} | {
filter_op?: FilterRefOp;
filter_ref?: FilterReference;
};
});

/**
* EventInput is a superset of the ABI JSON defintion for event
Expand All @@ -108,10 +120,13 @@ export type EventInput = {
readonly components?: EventInput[];

column?: string;
filter_op?: FilterOp;
} & ({
filter_op?: FilterArgOp;
filter_arg?: Hex[];
} | {
filter_op?: FilterRefOp;
filter_ref?: FilterReference;
};
});

export type Event = {
readonly name: string;
Expand Down

0 comments on commit 3286204

Please sign in to comment.