-
Notifications
You must be signed in to change notification settings - Fork 1
/
index-ng.did
151 lines (126 loc) · 3.64 KB
/
index-ng.did
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
type Tokens = nat;
type InitArg = record {
ledger_id: principal;
// The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
// responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
// A higher values means that it takes longer for new blocks to show up in the index.
retrieve_blocks_from_ledger_interval_seconds : opt nat64;
};
type UpgradeArg = record {
ledger_id: opt principal;
// The interval in seconds in which to retrieve blocks from the ledger. A lower value makes the index more
// responsive in showing new blocks, but increases the consumption of cycles of both the index and ledger canisters.
// A higher values means that it takes longer for new blocks to show up in the index.
retrieve_blocks_from_ledger_interval_seconds : opt nat64;
};
type IndexArg = variant {
Init: InitArg;
Upgrade: UpgradeArg;
};
type GetBlocksRequest = record {
start : nat;
length : nat;
};
type Value = variant {
Blob : blob;
Text : text;
Nat : nat;
Nat64: nat64;
Int : int;
Array : vec Value;
Map : Map;
};
type Map = vec record { text; Value };
type Block = Value;
type GetBlocksResponse = record {
chain_length: nat64;
blocks: vec Block;
};
type BlockIndex = nat;
type SubAccount = blob;
type Account = record { owner : principal; subaccount : opt SubAccount };
type Transaction = record {
burn : opt Burn;
kind : text;
mint : opt Mint;
approve : opt Approve;
timestamp : nat64;
transfer : opt Transfer;
};
type Approve = record {
fee : opt nat;
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
expected_allowance : opt nat;
expires_at : opt nat64;
spender : Account;
};
type Burn = record {
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
spender : opt Account;
};
type Mint = record {
to : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
};
type Transfer = record {
to : Account;
fee : opt nat;
from : Account;
memo : opt vec nat8;
created_at_time : opt nat64;
amount : nat;
spender : opt Account;
};
type GetAccountTransactionsArgs = record {
account : Account;
// The txid of the last transaction seen by the client.
// If None then the results will start from the most recent
// txid.
start : opt BlockIndex;
// Maximum number of transactions to fetch.
max_results : nat;
};
type TransactionWithId = record {
id : BlockIndex;
transaction : Transaction;
};
type GetTransactions = record {
balance : Tokens;
transactions : vec TransactionWithId;
// The txid of the oldest transaction the account has
oldest_tx_id : opt BlockIndex;
};
type GetTransactionsErr = record {
message : text;
};
type GetTransactionsResult = variant {
Ok : GetTransactions;
Err : GetTransactionsErr;
};
type ListSubaccountsArgs = record {
owner: principal;
start: opt SubAccount;
};
type Status = record {
num_blocks_synced : BlockIndex;
};
type FeeCollectorRanges = record {
ranges : vec record { Account; vec record { BlockIndex; BlockIndex } };
}
service : (index_arg: opt IndexArg) -> {
get_account_transactions : (GetAccountTransactionsArgs) -> (GetTransactionsResult) query;
get_blocks : (GetBlocksRequest) -> (GetBlocksResponse) query;
get_fee_collectors_ranges : () -> (FeeCollectorRanges) query;
icrc1_balance_of : (Account) -> (Tokens) query;
ledger_id : () -> (principal) query;
list_subaccounts : (ListSubaccountsArgs) -> (vec SubAccount) query;
status : () -> (Status) query;
}