-
Notifications
You must be signed in to change notification settings - Fork 7
/
types.ts
83 lines (70 loc) · 2.25 KB
/
types.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright 2017-2022 @polkadot/api-contract authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { ApiBase } from 'https://deno.land/x/polkadot@0.0.8/api/base/index.ts';
import type { ApiTypes } from 'https://deno.land/x/polkadot@0.0.8/api/types/index.ts';
import type { Text, u64 } from 'https://deno.land/x/polkadot@0.0.8/types/mod.ts';
import type { ContractExecResultResult, ContractSelector, StorageDeposit } from 'https://deno.land/x/polkadot@0.0.8/types/interfaces/index.ts';
import type { Codec, TypeDef } from 'https://deno.land/x/polkadot@0.0.8/types/types/index.ts';
import type { BN } from 'https://deno.land/x/polkadot@0.0.8/util/mod.ts';
import type { Abi } from './index.ts';
export interface ContractBase<ApiType extends ApiTypes> {
readonly abi: Abi;
readonly api: ApiBase<ApiType>;
getMessage: (name: string) => AbiMessage;
messages: AbiMessage[];
}
export interface AbiParam {
name: string;
type: TypeDef;
}
export interface AbiEvent {
args: AbiParam[];
docs: string[];
fromU8a: (data: Uint8Array) => DecodedEvent;
identifier: string;
index: number;
}
export interface AbiMessage {
args: AbiParam[];
docs: string[];
fromU8a: (data: Uint8Array) => DecodedMessage;
identifier: string;
index: number;
isConstructor?: boolean;
isMutating?: boolean;
isPayable?: boolean;
method: string;
path: string[];
returnType?: TypeDef | null;
selector: ContractSelector;
toU8a: (params: unknown[]) => Uint8Array;
}
export type AbiConstructor = AbiMessage;
export interface InterfaceContractCalls {
// eslint-disable-next-line @typescript-eslint/ban-types
[index: string]: Function;
}
export interface ContractCallOutcome {
debugMessage: Text;
gasConsumed: u64;
gasRequired: u64;
output: Codec | null;
result: ContractExecResultResult;
storageDeposit: StorageDeposit;
}
export interface DecodedEvent {
args: Codec[];
event: AbiEvent;
}
export interface DecodedMessage {
args: Codec[];
message: AbiMessage;
}
export interface ContractOptions {
gasLimit?: bigint | string | number | BN;
storageDepositLimit?: bigint | string | number | BN | null;
value?: bigint | BN | string | number;
}
export interface BlueprintOptions extends ContractOptions {
salt?: Uint8Array | string | null;
}