-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend.did
264 lines (264 loc) · 7.95 KB
/
backend.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
type AddUserCredentialError = variant {
InvalidCredential;
VersionMismatch;
ConfigurationError;
UserNotFound;
};
type AddUserCredentialRequest = record {
credential_jwt : text;
issuer_canister_id : principal;
current_user_version : opt nat64;
credential_spec : CredentialSpec;
};
type AllowSigningError = variant {
ApproveError : ApproveError;
Other : text;
FailedToContactCyclesLedger;
};
type ApiEnabled = variant { ReadOnly; Enabled; Disabled };
type ApproveError = variant {
GenericError : record { message : text; error_code : nat };
TemporarilyUnavailable;
Duplicate : record { duplicate_of : nat };
BadFee : record { expected_fee : nat };
AllowanceChanged : record { current_allowance : nat };
CreatedInFuture : record { ledger_time : nat64 };
TooOld;
Expired : record { ledger_time : nat64 };
InsufficientFunds : record { balance : nat };
};
type Arg = variant { Upgrade; Init : InitArg };
type ArgumentValue = variant { Int : int32; String : text };
type BitcoinNetwork = variant { mainnet; regtest; testnet };
type BtcAddPendingTransactionError = variant {
InternalError : record { msg : text };
};
type BtcAddPendingTransactionRequest = record {
txid : blob;
network : BitcoinNetwork;
address : text;
utxos : vec Utxo;
};
type BtcGetPendingTransactionsReponse = record {
transactions : vec PendingTransaction;
};
type BtcGetPendingTransactionsRequest = record {
network : BitcoinNetwork;
address : text;
};
type CanisterStatusResultV2 = record {
controller : principal;
status : CanisterStatusType;
freezing_threshold : nat;
balance : vec record { blob; nat };
memory_size : nat;
cycles : nat;
settings : DefiniteCanisterSettingsArgs;
idle_cycles_burned_per_day : nat;
module_hash : opt blob;
};
type CanisterStatusType = variant { stopped; stopping; running };
type Config = record {
api : opt Guards;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
supported_credentials : opt vec SupportedCredential;
ic_root_key_raw : opt blob;
};
type CredentialSpec = record {
arguments : opt vec record { text; ArgumentValue };
credential_type : text;
};
type CredentialType = variant { ProofOfUniqueness };
type CustomToken = record {
token : Token;
version : opt nat64;
enabled : bool;
};
type DefiniteCanisterSettingsArgs = record {
controller : principal;
freezing_threshold : nat;
controllers : vec principal;
memory_allocation : nat;
compute_allocation : nat;
};
type GetUserProfileError = variant { NotFound };
type Guards = record { user_data : ApiEnabled; threshold_key : ApiEnabled };
type HttpRequest = record {
url : text;
method : text;
body : blob;
headers : vec record { text; text };
};
type HttpResponse = record {
body : blob;
headers : vec record { text; text };
status_code : nat16;
};
type IcrcToken = record { ledger_id : principal; index_id : opt principal };
type InitArg = record {
api : opt Guards;
derivation_origin : opt text;
ecdsa_key_name : text;
cfs_canister_id : opt principal;
allowed_callers : vec principal;
supported_credentials : opt vec SupportedCredential;
ic_root_key_der : opt blob;
};
type ListUsersRequest = record {
updated_after_timestamp : opt nat64;
matches_max_length : opt nat64;
};
type ListUsersResponse = record {
users : vec OisyUser;
matches_max_length : nat64;
};
type MigrationError = variant {
TargetLockFailed;
TargetUnlockFailed;
CouldNotGetTargetPostStats;
CouldNotGetTargetPriorStats;
DataMigrationFailed;
TargetStatsMismatch : record { Stats; Stats };
Unknown;
TargetCanisterNotEmpty : Stats;
NoMigrationInProgress;
};
type MigrationProgress = variant {
MigratedUserTokensUpTo : opt principal;
Failed : MigrationError;
MigratedUserTimestampsUpTo : opt principal;
MigratedCustomTokensUpTo : opt principal;
CheckingDataMigration;
MigratedUserProfilesUpTo : opt record { nat64; principal };
UnlockingTarget;
Unlocking;
Completed;
Pending;
LockingTarget;
CheckingTarget;
};
type MigrationReport = record { to : principal; progress : MigrationProgress };
type OisyUser = record {
"principal" : principal;
pouh_verified : bool;
updated_timestamp : nat64;
};
type Outpoint = record { txid : blob; vout : nat32 };
type PendingTransaction = record { txid : blob; utxos : vec Utxo };
type Result = variant { Ok; Err : AddUserCredentialError };
type Result_1 = variant { Ok; Err : AllowSigningError };
type Result_2 = variant { Ok; Err : BtcAddPendingTransactionError };
type Result_3 = variant {
Ok : BtcGetPendingTransactionsReponse;
Err : BtcAddPendingTransactionError;
};
type Result_4 = variant {
Ok : SelectedUtxosFeeResponse;
Err : SelectedUtxosFeeError;
};
type Result_5 = variant { Ok : UserProfile; Err : GetUserProfileError };
type Result_6 = variant { Ok : MigrationReport; Err : text };
type Result_7 = variant { Ok; Err : text };
type Result_8 = variant {
Ok : TopUpCyclesLedgerResponse;
Err : TopUpCyclesLedgerError;
};
type SelectedUtxosFeeError = variant {
PendingTransactions;
InternalError : record { msg : text };
};
type SelectedUtxosFeeRequest = record {
network : BitcoinNetwork;
amount_satoshis : nat64;
min_confirmations : opt nat32;
};
type SelectedUtxosFeeResponse = record {
fee_satoshis : nat64;
utxos : vec Utxo;
};
type Stats = record {
user_profile_count : nat64;
custom_token_count : nat64;
user_timestamps_count : nat64;
user_token_count : nat64;
};
type SupportedCredential = record {
ii_canister_id : principal;
issuer_origin : text;
issuer_canister_id : principal;
ii_origin : text;
credential_type : CredentialType;
};
type Token = variant { Icrc : IcrcToken };
type TopUpCyclesLedgerError = variant {
InvalidArgPercentageOutOfRange : record {
max : nat8;
min : nat8;
percentage : nat8;
};
CouldNotGetBalanceFromCyclesLedger;
CouldNotTopUpCyclesLedger : record { tried_to_send : nat; available : nat };
};
type TopUpCyclesLedgerRequest = record {
threshold : opt nat;
percentage : opt nat8;
};
type TopUpCyclesLedgerResponse = record {
backend_cycles : nat;
ledger_balance : nat;
topped_up : nat;
};
type UserCredential = record {
issuer : text;
verified_date_timestamp : opt nat64;
credential_type : CredentialType;
};
type UserProfile = record {
credentials : vec UserCredential;
version : opt nat64;
created_timestamp : nat64;
updated_timestamp : nat64;
};
type UserToken = record {
decimals : opt nat8;
version : opt nat64;
enabled : opt bool;
chain_id : nat64;
contract_address : text;
symbol : opt text;
};
type UserTokenId = record { chain_id : nat64; contract_address : text };
type Utxo = record { height : nat32; value : nat64; outpoint : Outpoint };
service : (Arg) -> {
add_user_credential : (AddUserCredentialRequest) -> (Result);
allow_signing : () -> (Result_1);
btc_add_pending_transaction : (BtcAddPendingTransactionRequest) -> (Result_2);
btc_get_pending_transactions : (BtcGetPendingTransactionsRequest) -> (
Result_3,
);
btc_select_user_utxos_fee : (SelectedUtxosFeeRequest) -> (Result_4);
bulk_up : (blob) -> ();
config : () -> (Config) query;
create_user_profile : () -> (UserProfile);
get_canister_status : () -> (CanisterStatusResultV2);
get_user_profile : () -> (Result_5) query;
http_request : (HttpRequest) -> (HttpResponse) query;
list_custom_tokens : () -> (vec CustomToken) query;
list_user_tokens : () -> (vec UserToken) query;
list_users : (ListUsersRequest) -> (ListUsersResponse) query;
migrate_user_data_to : (principal) -> (Result_6);
migration : () -> (opt MigrationReport) query;
migration_stop_timer : () -> (Result_7);
remove_user_token : (UserTokenId) -> ();
set_custom_token : (CustomToken) -> ();
set_guards : (Guards) -> ();
set_many_custom_tokens : (vec CustomToken) -> ();
set_many_user_tokens : (vec UserToken) -> ();
set_user_token : (UserToken) -> ();
stats : () -> (Stats) query;
step_migration : () -> ();
top_up_cycles_ledger : (opt TopUpCyclesLedgerRequest) -> (Result_8);
}