forked from vechain/connex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
thor.d.ts
70 lines (61 loc) · 2.41 KB
/
thor.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
declare namespace Connex {
/** the interface of Thor module, for accessing VeChain accounts/blocks/txs/logs etc. */
export interface Thor {
/** the genesis block */
readonly genesis: Thor.Block
/** current status of VeChain */
readonly status: Thor.Status
/** create a ticker to watch new blocks */
ticker(): Thor.Ticker
/**
* create a visitor to the account specified by the given address
* @param addr account address
*/
account(addr: string): Thor.Account.Visitor
/**
* create a visitor to the block specified by the given revision
* @param revision block id or number, defaults to current value of status.head.id
*/
block(revision?: string | number): Thor.Block.Visitor
/**
* create a visitor to the transaction specified by the given id
* @param id tx id
*/
transaction(id: string): Thor.Transaction.Visitor
/** create an event logs filter */
filter(kind: 'event', criteria: Thor.Filter.Criteria<'event'>[]): Thor.Filter<'event'>
/** create an transfer logs filter */
filter(kind: 'transfer', criteria: Thor.Filter.Criteria<'transfer'>[]): Thor.Filter<'transfer'>
/** create an explainer to simulate tx execution */
explain(clauses: VM.Clause[]): VM.Explainer
}
namespace Thor {
/** describes the status of VeChain */
type Status = {
/** progress of synchronization. From 0 to 1, 1 means fully synchronized. */
progress: number
/** summary of head block */
head: {
/** block id */
id: string
/** block number */
number: number
/** block timestamp */
timestamp: number
/** parent block id */
parentID: string
/** bits of supported txs features */
txsFeatures?: number
/** block gas limit */
gasLimit: number
}
/** id of finalized block */
finalized: string
}
/** the ticker interface, to watch new blocks */
interface Ticker {
/** returns a Promise of new head block summary, which is resolved once a new block produced */
next(): Promise<Status['head']>
}
}
}