@dfinity/ckbtc 6.0.1 → 7.0.0-next-2025-12-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,602 +0,0 @@
1
- // Generated from IC repo commit fa06b0e (2025-11-12 tags: release-2025-11-13_03-24-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
2
-
3
- // Represents an account on the ckBTC ledger.
4
- type Account = record { owner : principal; subaccount : opt blob };
5
-
6
- type CanisterStatusResponse = record {
7
- status : CanisterStatusType;
8
- memory_size : nat;
9
- cycles : nat;
10
- settings : DefiniteCanisterSettings;
11
- idle_cycles_burned_per_day : nat;
12
- module_hash : opt vec nat8;
13
- query_stats : QueryStats;
14
- reserved_cycles : nat;
15
- memory_metrics : MemoryMetrics;
16
- };
17
-
18
- type QueryStats = record {
19
- response_payload_bytes_total : nat;
20
- num_instructions_total : nat;
21
- num_calls_total : nat;
22
- request_payload_bytes_total : nat;
23
- };
24
-
25
- type MemoryMetrics = record {
26
- wasm_memory_size : nat;
27
- stable_memory_size : nat;
28
- global_memory_size : nat;
29
- wasm_binary_size : nat;
30
- custom_sections_size : nat;
31
- canister_history_size : nat;
32
- wasm_chunk_store_size : nat;
33
- snapshots_size : nat;
34
- };
35
-
36
- type CanisterStatusType = variant { stopped; stopping; running };
37
-
38
- type DefiniteCanisterSettings = record {
39
- freezing_threshold : nat;
40
- controllers : vec principal;
41
- memory_allocation : nat;
42
- compute_allocation : nat;
43
- reserved_cycles_limit : nat;
44
- log_visibility: LogVisibility;
45
- wasm_memory_limit : nat;
46
- wasm_memory_threshold : nat;
47
- };
48
-
49
- type LogVisibility = variant {
50
- controllers;
51
- public;
52
- allowed_viewers : vec principal;
53
- };
54
-
55
- type RetrieveBtcArgs = record {
56
- // The address to which the ckBTC minter should deposit BTC.
57
- address : text;
58
- // The amount of ckBTC in Satoshis that the client wants to withdraw.
59
- amount : nat64;
60
- };
61
-
62
- type RetrieveBtcWithApprovalArgs = record {
63
- // The address to which the ckBTC minter should deposit BTC.
64
- address : text;
65
- // The amount of ckBTC in Satoshis that the client wants to withdraw.
66
- amount : nat64;
67
- // The subaccount to burn ckBTC from.
68
- from_subaccount : opt blob;
69
- };
70
-
71
- type RetrieveBtcError = variant {
72
- // The minter failed to parse the destination address.
73
- MalformedAddress : text;
74
- // The minter is already processing another retrieval request for the same
75
- // principal.
76
- AlreadyProcessing;
77
- // The withdrawal amount is too low.
78
- // The payload contains the minimal withdrawal amount.
79
- AmountTooLow : nat64;
80
- // The ckBTC balance of the withdrawal account is too low.
81
- InsufficientFunds : record { balance : nat64 };
82
- // The minter is overloaded, retry the request.
83
- // The payload contains a human-readable message explaining what caused the unavailability.
84
- TemporarilyUnavailable : text;
85
- // A generic error reserved for future extensions.
86
- GenericError : record { error_message : text; error_code : nat64 };
87
- };
88
-
89
- type RetrieveBtcWithApprovalError = variant {
90
- // The minter failed to parse the destination address.
91
- MalformedAddress : text;
92
- // The minter is already processing another retrieval request for the same
93
- // principal.
94
- AlreadyProcessing;
95
- // The withdrawal amount is too low.
96
- // The payload contains the minimal withdrawal amount.
97
- AmountTooLow : nat64;
98
- // The ckBTC balance of the withdrawal account is too low.
99
- InsufficientFunds : record { balance : nat64 };
100
- // The allowance given to the minter is too low.
101
- InsufficientAllowance : record { allowance : nat64 };
102
- // The minter is overloaded, retry the request.
103
- // The payload contains a human-readable message explaining what caused the unavailability.
104
- TemporarilyUnavailable : text;
105
- // A generic error reserved for future extensions.
106
- GenericError : record { error_message : text; error_code : nat64 };
107
- };
108
-
109
- type RetrieveBtcOk = record {
110
- // Returns the burn transaction index corresponding to the withdrawal.
111
- // You can use this index to query the withdrawal status.
112
- block_index : nat64
113
- };
114
-
115
- // The result of an [update_balance] call.
116
- type UtxoStatus = variant {
117
- // The minter ignored this UTXO because UTXO's value is too small to pay
118
- // the check fees.
119
- ValueTooSmall : Utxo;
120
- // The Bitcoin checker considered this UTXO to be tainted.
121
- Tainted : Utxo;
122
- // The UTXO passed the Bitcoin check, but the minter failed to mint ckBTC
123
- // because the Ledger was unavailable. Retrying the [update_balance] call
124
- // should eventually advance the UTXO to the [Minted] state.
125
- Checked : Utxo;
126
- // The UTXO passed the Bitcoin check, and ckBTC has been minted.
127
- Minted : record {
128
- block_index : nat64;
129
- minted_amount : nat64;
130
- utxo : Utxo;
131
- };
132
- };
133
-
134
- // Utxos that don't have enough confirmations to be processed.
135
- type PendingUtxo = record {
136
- outpoint : record { txid : vec nat8; vout : nat32 };
137
- value : nat64;
138
- confirmations: nat32;
139
- };
140
-
141
- // Number of nanoseconds since the Unix Epoch
142
- type Timestamp = nat64;
143
-
144
- type SuspendedUtxo = record {
145
- utxo : Utxo;
146
- reason : SuspendedReason;
147
- earliest_retry: Timestamp;
148
- };
149
-
150
- type UpdateBalanceError = variant {
151
- // There are no new UTXOs to process.
152
- NoNewUtxos : record {
153
- current_confirmations: opt nat32;
154
- required_confirmations: nat32;
155
- pending_utxos: opt vec PendingUtxo;
156
- suspended_utxos: opt vec SuspendedUtxo;
157
- };
158
- // The minter is already processing another update balance request for the caller.
159
- AlreadyProcessing;
160
- // The minter is overloaded, retry the request.
161
- // The payload contains a human-readable message explaining what caused the unavailability.
162
- TemporarilyUnavailable : text;
163
- // A generic error reserved for future extensions.
164
- GenericError : record { error_message : text; error_code : nat64 };
165
- };
166
-
167
- type BtcNetwork = variant {
168
- // The public Bitcoin mainnet.
169
- Mainnet;
170
- // The public Bitcoin testnet.
171
- Testnet;
172
- // A local Bitcoin regtest installation.
173
- Regtest;
174
- };
175
-
176
- type Mode = variant {
177
- // The minter does not allow any state modifications.
178
- ReadOnly;
179
- // Only specified principals can modify minter's state.
180
- RestrictedTo : vec principal;
181
- // Only specified principals can convert BTC to ckBTC.
182
- DepositsRestrictedTo : vec principal;
183
- // Anyone can interact with the minter.
184
- GeneralAvailability;
185
- };
186
-
187
- // The initialization parameters of the minter canister.
188
- type InitArgs = record {
189
- // The minter will interact with this Bitcoin network.
190
- btc_network : BtcNetwork;
191
-
192
- // The principal of the ledger that handles ckBTC transfers.
193
- // The default account of the ckBTC minter must be configured as
194
- // the minting account of the ledger.
195
- ledger_id : principal;
196
-
197
- // The name of the ECDSA key to use.
198
- // E.g., "dfx_test_key" on the local replica.
199
- ecdsa_key_name : text;
200
-
201
- // The minimal amount of ckBTC that can be converted to BTC.
202
- retrieve_btc_min_amount : nat64;
203
-
204
- /// Maximum time in nanoseconds that a transaction should spend in the queue
205
- /// before being sent.
206
- max_time_in_queue_nanos : nat64;
207
-
208
- /// The minimum number of confirmations required for the minter to
209
- /// accept a Bitcoin transaction.
210
- min_confirmations : opt nat32;
211
-
212
- /// The minter's operation mode.
213
- mode : Mode;
214
-
215
- /// The fee paid per Bitcoin check.
216
- check_fee : opt nat64;
217
-
218
- /// The fee paid per check by the KYT canister (deprecated, use check_fee instead).
219
- kyt_fee : opt nat64;
220
-
221
- /// The canister id of the Bitcoin checker canister.
222
- btc_checker_principal: opt principal;
223
-
224
- /// The canister id of the KYT canister (deprecated, use btc_checker_principal instead).
225
- kyt_principal: opt principal;
226
-
227
- /// The expiration duration (in seconds) for cached entries in the get_utxos cache.
228
- get_utxos_cache_expiration_seconds: opt nat64;
229
- };
230
-
231
- // The upgrade parameters of the minter canister.
232
- type UpgradeArgs = record {
233
- // The minimal amount of ckBTC that the minter converts to BTC.
234
- retrieve_btc_min_amount : opt nat64;
235
-
236
- /// Maximum time in nanoseconds that a transaction should spend in the queue
237
- /// before being sent.
238
- max_time_in_queue_nanos : opt nat64;
239
-
240
- /// The minimum number of confirmations required for the minter to
241
- /// accept a Bitcoin transaction.
242
- min_confirmations : opt nat32;
243
-
244
- /// If set, overrides the current minter's operation mode.
245
- mode : opt Mode;
246
-
247
- /// The fee per Bitcoin check.
248
- check_fee : opt nat64;
249
-
250
- /// The fee paid per check by the KYT canister (deprecated, use check_fee instead).
251
- kyt_fee : opt nat64;
252
-
253
- /// The principal of the Bitcoin checker canister.
254
- btc_checker_principal : opt principal;
255
-
256
- /// The canister id of the KYT canister (deprecated, use btc_checker_principal instead).
257
- kyt_principal: opt principal;
258
-
259
- /// The expiration duration (in seconds) for cached entries in the get_utxos cache.
260
- get_utxos_cache_expiration_seconds: opt nat64;
261
- };
262
-
263
- type RetrieveBtcStatus = variant {
264
- // The minter does not have any information on the specified
265
- // retrieval request. It can be that nobody submitted the
266
- // request or the minter pruned the relevant information from the
267
- // history to save space.
268
- Unknown;
269
-
270
- // The minter did not send a Bitcoin transaction for this request yet.
271
- Pending;
272
-
273
- // The minter is obtaining all required ECDSA signatures on the
274
- // Bitcoin transaction for this request.
275
- Signing;
276
-
277
- // The minter signed the transaction and is waiting for a reply
278
- // from the Bitcoin canister.
279
- Sending : record { txid : blob };
280
-
281
- // The minter sent a transaction for the retrieve request.
282
- // The payload contains the identifier of the transaction on the Bitcoin network.
283
- Submitted : record { txid : blob };
284
-
285
- // The amount was too low to cover the transaction fees.
286
- AmountTooLow;
287
-
288
- // The minter received enough confirmations for the Bitcoin
289
- // transaction for this request. The payload contains the
290
- // identifier of the transaction on the Bitcoin network.
291
- Confirmed : record { txid : blob };
292
- };
293
-
294
- type ReimbursementRequest = record {
295
- account : Account;
296
- amount : nat64;
297
- reason : ReimbursementReason;
298
- };
299
-
300
- type ReimbursedDeposit = record {
301
- account : Account;
302
- mint_block_index : nat64;
303
- amount : nat64;
304
- reason : ReimbursementReason;
305
- };
306
-
307
- type RetrieveBtcStatusV2 = variant {
308
- // The minter does not have any information on the specified
309
- // retrieval request. It can be that nobody submitted the
310
- // request or the minter pruned the relevant information from the
311
- // history to save space.
312
- Unknown;
313
- // The minter did not send a Bitcoin transaction for this request yet.
314
- Pending;
315
- // The minter is obtaining all required ECDSA signatures on the
316
- // Bitcoin transaction for this request.
317
- Signing;
318
- // The minter signed the transaction and is waiting for a reply
319
- // from the Bitcoin canister.
320
- Sending : record { txid : blob };
321
- // The minter sent a transaction for the retrieve request.
322
- // The payload contains the identifier of the transaction on the Bitcoin network.
323
- Submitted : record { txid : blob };
324
- // The amount was too low to cover the transaction fees.
325
- AmountTooLow;
326
- // The minter received enough confirmations for the Bitcoin
327
- // transaction for this request. The payload contains the
328
- // identifier of the transaction on the Bitcoin network.
329
- Confirmed : record { txid : blob };
330
- /// The retrieve Bitcoin request has been reimbursed.
331
- Reimbursed : ReimbursedDeposit;
332
- /// The minter will try to reimburse this transaction.
333
- WillReimburse : ReimbursementRequest;
334
- };
335
-
336
- type Utxo = record {
337
- outpoint : record { txid : vec nat8; vout : nat32 };
338
- value : nat64;
339
- height : nat32;
340
- };
341
-
342
- type BitcoinAddress = variant {
343
- p2wpkh_v0 : blob;
344
- p2wsh_v0 : blob;
345
- p2tr_v1 : blob;
346
- p2pkh : blob;
347
- p2sh : blob;
348
- };
349
-
350
- type MinterInfo = record {
351
- min_confirmations : nat32;
352
- // This amount is based on the `retrieve_btc_min_amount` setting during canister
353
- // initialization or upgrades, but may vary according to current network fees.
354
- retrieve_btc_min_amount : nat64;
355
- // The same as `check_fee`, but the old name is kept here to be backward compatible.
356
- kyt_fee : nat64;
357
- };
358
-
359
- type ReimbursementReason = variant {
360
- CallFailed;
361
- TaintedDestination : record {
362
- kyt_fee : nat64;
363
- kyt_provider: principal;
364
- };
365
- };
366
-
367
- type ReplacedReason = variant {
368
- to_retry;
369
- to_cancel : record {
370
- reason : WithdrawalReimbursementReason;
371
- };
372
- };
373
-
374
- type WithdrawalReimbursementReason = variant {
375
- invalid_transaction : InvalidTransactionError;
376
- };
377
-
378
- type InvalidTransactionError = variant {
379
- too_many_inputs : record {
380
- num_inputs : nat64;
381
- max_num_inputs : nat64;
382
- };
383
- };
384
-
385
- type SuspendedReason = variant {
386
- // The minter ignored this UTXO because UTXO's value is too small to pay
387
- // the check fees.
388
- ValueTooSmall;
389
- // The Bitcoin checker considered this UTXO to be tainted.
390
- Quarantined;
391
- };
392
-
393
- type WithdrawalFee = record {
394
- minter_fee : nat64;
395
- bitcoin_fee : nat64;
396
- };
397
-
398
- type Event = record {
399
- timestamp : opt nat64;
400
- payload : EventType;
401
- };
402
-
403
- type EventType = variant {
404
- init : InitArgs;
405
- upgrade : UpgradeArgs;
406
- received_utxos : record { to_account : Account; mint_txid : opt nat64; utxos : vec Utxo };
407
- accepted_retrieve_btc_request : record {
408
- amount : nat64;
409
- address : BitcoinAddress;
410
- block_index : nat64;
411
- received_at : nat64;
412
- kyt_provider : opt principal;
413
- reimbursement_account : opt Account;
414
- };
415
- distributed_kyt_fee : record {
416
- kyt_provider : principal;
417
- amount : nat64;
418
- block_index: nat64;
419
- };
420
- removed_retrieve_btc_request : record { block_index : nat64 };
421
- sent_transaction : record {
422
- requests : vec nat64;
423
- txid : blob;
424
- utxos : vec Utxo;
425
- change_output : opt record { vout : nat32; value : nat64 };
426
- submitted_at : nat64;
427
- fee: opt nat64;
428
- withdrawal_fee : opt WithdrawalFee;
429
- };
430
- replaced_transaction : record {
431
- new_txid : blob;
432
- old_txid : blob;
433
- change_output : record { vout : nat32; value : nat64 };
434
- submitted_at : nat64;
435
- fee : nat64;
436
- withdrawal_fee : opt WithdrawalFee;
437
- reason : opt ReplacedReason;
438
- new_utxos : opt vec Utxo;
439
- };
440
- confirmed_transaction : record { txid : blob };
441
- checked_utxo : record {
442
- utxo : Utxo;
443
- uuid : text;
444
- clean : bool;
445
- kyt_provider : opt principal;
446
- };
447
- checked_utxo_v2 : record {
448
- utxo : Utxo;
449
- account : Account;
450
- };
451
- checked_utxo_mint_unknown : record {
452
- utxo : Utxo;
453
- account : Account;
454
- };
455
- ignored_utxo : record { utxo: Utxo; };
456
- suspended_utxo : record { utxo: Utxo; account: Account; reason: SuspendedReason };
457
- retrieve_btc_kyt_failed : record {
458
- address : text;
459
- amount : nat64;
460
- owner : principal;
461
- kyt_provider : principal;
462
- uuid : text;
463
- block_index : nat64;
464
- };
465
- schedule_deposit_reimbursement : record {
466
- account : Account;
467
- burn_block_index : nat64;
468
- amount : nat64;
469
- reason : ReimbursementReason;
470
- };
471
- reimbursed_failed_deposit : record { burn_block_index : nat64; mint_block_index : nat64 };
472
- schedule_withdrawal_reimbursement : record {
473
- account : Account;
474
- burn_block_index : nat64;
475
- amount : nat64;
476
- reason : WithdrawalReimbursementReason;
477
- };
478
- quarantined_withdrawal_reimbursement : record {
479
- burn_block_index : nat64;
480
- };
481
- reimbursed_withdrawal : record {
482
- burn_block_index : nat64;
483
- mint_block_index : nat64;
484
- };
485
- };
486
-
487
- type MinterArg = variant {
488
- Init : InitArgs;
489
- Upgrade : opt UpgradeArgs;
490
- };
491
-
492
- service : (minter_arg : MinterArg) -> {
493
- // Section "Convert BTC to ckBTC" {{{
494
-
495
- // Returns the Bitcoin address to which the owner should send BTC
496
- // before converting the amount to ckBTC using the [update_balance]
497
- // endpoint.
498
- //
499
- // If the owner is not set, it defaults to the caller's principal.
500
- // The resolved owner must be a non-anonymous principal.
501
- get_btc_address : (record { owner: opt principal; subaccount : opt blob }) -> (text);
502
-
503
- // Returns UTXOs of the given account known by the minter (with no
504
- // guarantee in the ordering of the returned values).
505
- //
506
- // If the owner is not set, it defaults to the caller's principal.
507
- get_known_utxos: (record { owner: opt principal; subaccount : opt blob }) -> (vec Utxo) query;
508
-
509
- // Mints ckBTC for newly deposited UTXOs.
510
- //
511
- // If the owner is not set, it defaults to the caller's principal.
512
- //
513
- // # Preconditions
514
- //
515
- // * The owner deposited some BTC to the address that the
516
- // [get_btc_address] endpoint returns.
517
- update_balance : (record { owner: opt principal; subaccount : opt blob }) -> (variant { Ok : vec UtxoStatus; Err : UpdateBalanceError });
518
-
519
- // }}} Section "Convert BTC to ckBTC"
520
-
521
- // Section "Convert ckBTC to BTC" {{{
522
-
523
- /// Returns an estimate of the user's fee (in Satoshi) for a
524
- /// retrieve_btc request based on the current status of the Bitcoin network.
525
- estimate_withdrawal_fee : (record { amount : opt nat64 }) -> (record { bitcoin_fee : nat64; minter_fee : nat64 }) query;
526
-
527
- /// Returns the fee that the minter will charge for a bitcoin deposit.
528
- get_deposit_fee: () -> (nat64) query;
529
-
530
- // Returns the account to which the caller should deposit ckBTC
531
- // before withdrawing BTC using the [retrieve_btc] endpoint.
532
- get_withdrawal_account : () -> (Account);
533
-
534
-
535
- // Submits a request to convert ckBTC to BTC.
536
- //
537
- // # Note
538
- //
539
- // The BTC retrieval process is slow. Instead of
540
- // synchronously waiting for a BTC transaction to settle, this
541
- // method returns a request ([block_index]) that the caller can use
542
- // to query the request status.
543
- //
544
- // # Preconditions
545
- //
546
- // * The caller deposited the requested amount in ckBTC to the account
547
- // that the [get_withdrawal_account] endpoint returns.
548
- retrieve_btc : (RetrieveBtcArgs) -> (variant { Ok : RetrieveBtcOk; Err : RetrieveBtcError });
549
-
550
- // Submits a request to convert ckBTC to BTC.
551
- //
552
- // # Note
553
- //
554
- // The BTC retrieval process is slow. Instead of
555
- // synchronously waiting for a BTC transaction to settle, this
556
- // method returns a request ([block_index]) that the caller can use
557
- // to query the request status.
558
- //
559
- // # Preconditions
560
- //
561
- // * The caller allowed the minter's principal to spend its funds
562
- // using [icrc2_approve] on the ckBTC ledger.
563
- retrieve_btc_with_approval : (RetrieveBtcWithApprovalArgs) -> (variant { Ok : RetrieveBtcOk; Err : RetrieveBtcWithApprovalError });
564
-
565
- /// [deprecated] Returns the status of a withdrawal request.
566
- /// You should use retrieve_btc_status_v2 to retrieve the status of your withdrawal request.
567
- retrieve_btc_status : (record { block_index : nat64 }) -> (RetrieveBtcStatus) query;
568
-
569
- /// Returns the status of a withdrawal request request using the RetrieveBtcStatusV2 type.
570
- retrieve_btc_status_v2 : (record { block_index : nat64 }) -> (RetrieveBtcStatusV2) query;
571
-
572
- // Returns the withdrawal statues by account.
573
- //
574
- // # Note
575
- // The _v2_ part indicates that you get a response in line with the retrieve_btc_status_v2 endpoint,
576
- // i.e., you get a vector of RetrieveBtcStatusV2 and not RetrieveBtcStatus.
577
- //
578
- retrieve_btc_status_v2_by_account : (opt Account) -> (vec record { block_index: nat64; status_v2: opt RetrieveBtcStatusV2; }) query;
579
-
580
- // }}} Section "Convert ckBTC to BTC"
581
-
582
- // Section "Minter Information" {{{
583
- // Returns internal minter parameters.
584
- get_minter_info : () -> (MinterInfo) query;
585
-
586
- get_canister_status : () -> (CanisterStatusResponse);
587
- // }}}
588
-
589
- // Section "Event log" {{{
590
-
591
- // The minter keeps track of all state modifications in an internal event log.
592
- //
593
- // This method returns a list of events in the specified range.
594
- // The minter can return fewer events than requested. The result is
595
- // an empty vector if the start position is greater than the total
596
- // number of events.
597
- //
598
- // NOTE: this method exists for debugging purposes.
599
- // The ckBTC minter authors do not guarantee backward compatibility for this method.
600
- get_events : (record { start: nat64; length : nat64 }) -> (vec Event) query;
601
- // }}} Section "Event log"
602
- }
@@ -1,2 +0,0 @@
1
- import type { IDL } from "@icp-sdk/core/candid";
2
- export const idlFactory: IDL.InterfaceFactory;