This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
89 lines (78 loc) · 2.75 KB
/
index.d.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
84
85
86
87
88
89
/** Connex driver interface */
declare namespace Connex {
interface Driver {
readonly genesis: Thor.Block
/** current known head */
readonly head: Thor.Status['head']
/**
* poll new head
* rejected only when driver closed
*/
pollHead(): Promise<Thor.Status['head']>
getBlock(revision: string | number): Promise<Thor.Block | null>
getTransaction(id: string): Promise<Thor.Transaction | null>
getReceipt(id: string): Promise<Thor.Receipt | null>
getAccount(addr: string, revision: string): Promise<Thor.Account>
getCode(addr: string, revision: string): Promise<Thor.Code>
getStorage(addr: string, key: string, revision: string): Promise<Thor.Storage>
explain(arg: Driver.ExplainArg, revision: string, cacheTies?: string[]): Promise<Thor.VMOutput[]>
filterEventLogs(arg: Driver.FilterEventLogsArg): Promise<Thor.Event[]>
filterTransferLogs(arg: Driver.FilterTransferLogsArg): Promise<Thor.Transfer[]>
// vendor methods
signTx(msg: Driver.SignTxArg, options: Driver.SignTxOption): Promise<Driver.SignTxResult>
signCert(msg: Driver.SignCertArg, option: Driver.SignCertOption): Promise<Driver.SignCertResult>
isAddressOwned(addr: string): Promise<boolean>
}
namespace Driver {
type ExplainArg = {
clauses: Array<{
to: string | null
value: string
data: string
}>,
caller?: string
gas?: number
gasPrice?: string
}
type FilterEventLogsArg = {
range: Thor.Filter.Range
options: {
offset: number
limit: number
}
criteriaSet: Thor.Event.Criteria[]
order: 'asc' | 'desc'
}
type FilterTransferLogsArg = {
range: Thor.Filter.Range
options: {
offset: number
limit: number
}
criteriaSet: Thor.Transfer.Criteria[]
order: 'asc' | 'desc'
}
type SignTxArg = Array<{
to: string | null
value: string
data: string
comment?: string
abi?: object
}>
type SignTxOption = {
signer?: string
gas?: number
dependsOn?: string
link?: string
comment?: string
delegationHandler?: Vendor.DelegationHandler
}
type SignTxResult = Vendor.TxResponse
type SignCertArg = Vendor.CertMessage
type SignCertOption = {
signer?: string
link?: string
}
type SignCertResult = Vendor.CertResponse
}
}