forked from vechain/connex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vm.d.ts
53 lines (44 loc) · 1.22 KB
/
vm.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
declare namespace Connex.VM {
/** the Explainer interface, to simulate tx execution */
interface Explainer {
/** set caller address (msg.sender) */
caller(addr: string): this
/** set max allowed gas */
gas(gas: number): this
/** set gas price, presented by hex/dec string or number type */
gasPrice(gp: string | number): this
/** set gas payer */
gasPayer(addr: string): this
/**
* turn on result cache
* @param hints a set of addresses, as the condition of cache invalidation
*/
cache(hints: string[]): this
/** execute clauses (dry-run, without altering blockchain) */
execute(): Promise<Output[]>
}
type Clause = {
to: string | null
value: string | number
data?: string
}
type Output = {
data: string
vmError: string
gasUsed: number
reverted: boolean
revertReason?: string
events: Event[]
transfers: Transfer[]
}
type Event = {
address: string
topics: string[]
data: string
}
type Transfer = {
sender: string
recipient: string
amount: string
}
}