-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.ts
38 lines (34 loc) · 1.03 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
export type { Config, DefaultConfig, ResolvedConfig } from './config'
import {
Abi,
Call,
ContractFunctions,
ContractFunctionsPopulateTransaction,
ExtractAbiFunctionNames,
FunctionArgs,
FunctionRet,
} from './kanabi'
export { type Abi } from './kanabi'
export function call<
TAbi extends Abi,
TFunctionName extends ExtractAbiFunctionNames<TAbi>,
>(
abi: TAbi,
f: TFunctionName,
args: FunctionArgs<TAbi, TFunctionName>,
): FunctionRet<TAbi, TFunctionName> {
throw new Error('todo')
}
type TypedContractActions<TAbi extends Abi> = {
call<TFunctionName extends ExtractAbiFunctionNames<TAbi>>(
method: TFunctionName,
args?: FunctionArgs<TAbi, TFunctionName>,
): Promise<FunctionRet<TAbi, TFunctionName>>
populate<TFunctionName extends ExtractAbiFunctionNames<TAbi>>(
method: TFunctionName,
args?: FunctionArgs<TAbi, TFunctionName>,
): Call
populateTransaction: ContractFunctionsPopulateTransaction<TAbi>
}
export type TypedContract<TAbi extends Abi> = TypedContractActions<TAbi> &
ContractFunctions<TAbi>