Skip to content

Commit

Permalink
Add more tests, consolidate types
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangoree committed Nov 29, 2024
1 parent 4c2c643 commit c31860a
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 146 deletions.
18 changes: 9 additions & 9 deletions packages/drift/src/adapter/types/Adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ export interface WriteAdapter {

export interface ReadWriteAdapter extends ReadAdapter, WriteAdapter {}

export interface ContractParams<TAbi extends Abi = Abi> {
abi: TAbi;
address: Address;
}

export type FunctionArgsParam<
TAbi extends Abi = Abi,
TFunctionName extends FunctionName<TAbi> = FunctionName<TAbi>,
Expand All @@ -82,19 +87,16 @@ export type ReadParams<
TAbi,
"pure" | "view"
>,
> = {
abi: TAbi;
address: Address;
> = ContractParams<TAbi> & {
fn: TFunctionName;
} & FunctionArgsParam<TAbi, TFunctionName> &
ContractReadOptions;

export interface GetEventsParams<
TAbi extends Abi = Abi,
TEventName extends EventName<TAbi> = EventName<TAbi>,
> extends ContractGetEventsOptions<TAbi, TEventName> {
abi: TAbi;
address: Address;
> extends ContractParams<TAbi>,
ContractGetEventsOptions<TAbi, TEventName> {
event: TEventName;
}

Expand All @@ -104,9 +106,7 @@ export type SimulateWriteParams<
TAbi,
"nonpayable" | "payable"
> = FunctionName<TAbi, "nonpayable" | "payable">,
> = {
abi: TAbi;
address: Address;
> = ContractParams<TAbi> & {
fn: TFunctionName;
} & FunctionArgsParam<TAbi, TFunctionName> &
ContractWriteOptions;
Expand Down
Loading

0 comments on commit c31860a

Please sign in to comment.