@dfinity/ckbtc 6.0.1 → 7.0.0-beta-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.
- package/README.md +3 -3
- package/dist/index.d.ts +25 -13
- package/dist/index.js +1 -6
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +1 -6
- package/dist/index.mjs.map +4 -4
- package/package.json +4 -10
- package/dist/bitcoin.canister.d.ts +0 -35
- package/dist/candid/bitcoin.certified.idl.d.ts +0 -2
- package/dist/candid/bitcoin.certified.idl.js +0 -177
- package/dist/candid/bitcoin.d.ts +0 -128
- package/dist/candid/bitcoin.did +0 -149
- package/dist/candid/bitcoin.idl.d.ts +0 -2
- package/dist/candid/bitcoin.idl.js +0 -181
- package/dist/candid/minter.certified.idl.d.ts +0 -2
- package/dist/candid/minter.certified.idl.js +0 -474
- package/dist/candid/minter.d.ts +0 -843
- package/dist/candid/minter.did +0 -602
- package/dist/candid/minter.idl.d.ts +0 -2
- package/dist/candid/minter.idl.js +0 -474
- package/dist/enums/btc.enums.d.ts +0 -12
- package/dist/errors/btc.errors.d.ts +0 -18
- package/dist/errors/minter.errors.d.ts +0 -30
- package/dist/minter.canister.d.ts +0 -120
- package/dist/types/bitcoin.params.d.ts +0 -17
- package/dist/types/btc.d.ts +0 -9
- package/dist/types/canister.options.d.ts +0 -5
- package/dist/types/minter.params.d.ts +0 -36
- package/dist/types/minter.responses.d.ts +0 -25
- package/dist/utils/btc.utils.d.ts +0 -13
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
// This file was automatically generated by @icp-sdk/bindgen@0.2.0.
|
|
6
|
-
// You should NOT make any changes in this file as it will be overwritten.
|
|
7
|
-
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
8
|
-
|
|
9
|
-
export const idlFactory = ({ IDL }) => {
|
|
10
|
-
const Mode = IDL.Variant({
|
|
11
|
-
RestrictedTo: IDL.Vec(IDL.Principal),
|
|
12
|
-
DepositsRestrictedTo: IDL.Vec(IDL.Principal),
|
|
13
|
-
ReadOnly: IDL.Null,
|
|
14
|
-
GeneralAvailability: IDL.Null,
|
|
15
|
-
});
|
|
16
|
-
const UpgradeArgs = IDL.Record({
|
|
17
|
-
get_utxos_cache_expiration_seconds: IDL.Opt(IDL.Nat64),
|
|
18
|
-
kyt_principal: IDL.Opt(IDL.Principal),
|
|
19
|
-
mode: IDL.Opt(Mode),
|
|
20
|
-
retrieve_btc_min_amount: IDL.Opt(IDL.Nat64),
|
|
21
|
-
max_time_in_queue_nanos: IDL.Opt(IDL.Nat64),
|
|
22
|
-
check_fee: IDL.Opt(IDL.Nat64),
|
|
23
|
-
btc_checker_principal: IDL.Opt(IDL.Principal),
|
|
24
|
-
min_confirmations: IDL.Opt(IDL.Nat32),
|
|
25
|
-
kyt_fee: IDL.Opt(IDL.Nat64),
|
|
26
|
-
});
|
|
27
|
-
const BtcNetwork = IDL.Variant({
|
|
28
|
-
Mainnet: IDL.Null,
|
|
29
|
-
Regtest: IDL.Null,
|
|
30
|
-
Testnet: IDL.Null,
|
|
31
|
-
});
|
|
32
|
-
const InitArgs = IDL.Record({
|
|
33
|
-
get_utxos_cache_expiration_seconds: IDL.Opt(IDL.Nat64),
|
|
34
|
-
kyt_principal: IDL.Opt(IDL.Principal),
|
|
35
|
-
ecdsa_key_name: IDL.Text,
|
|
36
|
-
mode: Mode,
|
|
37
|
-
retrieve_btc_min_amount: IDL.Nat64,
|
|
38
|
-
ledger_id: IDL.Principal,
|
|
39
|
-
max_time_in_queue_nanos: IDL.Nat64,
|
|
40
|
-
btc_network: BtcNetwork,
|
|
41
|
-
check_fee: IDL.Opt(IDL.Nat64),
|
|
42
|
-
btc_checker_principal: IDL.Opt(IDL.Principal),
|
|
43
|
-
min_confirmations: IDL.Opt(IDL.Nat32),
|
|
44
|
-
kyt_fee: IDL.Opt(IDL.Nat64),
|
|
45
|
-
});
|
|
46
|
-
const MinterArg = IDL.Variant({
|
|
47
|
-
Upgrade: IDL.Opt(UpgradeArgs),
|
|
48
|
-
Init: InitArgs,
|
|
49
|
-
});
|
|
50
|
-
const MemoryMetrics = IDL.Record({
|
|
51
|
-
wasm_binary_size: IDL.Nat,
|
|
52
|
-
wasm_chunk_store_size: IDL.Nat,
|
|
53
|
-
canister_history_size: IDL.Nat,
|
|
54
|
-
stable_memory_size: IDL.Nat,
|
|
55
|
-
snapshots_size: IDL.Nat,
|
|
56
|
-
wasm_memory_size: IDL.Nat,
|
|
57
|
-
global_memory_size: IDL.Nat,
|
|
58
|
-
custom_sections_size: IDL.Nat,
|
|
59
|
-
});
|
|
60
|
-
const CanisterStatusType = IDL.Variant({
|
|
61
|
-
stopped: IDL.Null,
|
|
62
|
-
stopping: IDL.Null,
|
|
63
|
-
running: IDL.Null,
|
|
64
|
-
});
|
|
65
|
-
const LogVisibility = IDL.Variant({
|
|
66
|
-
controllers: IDL.Null,
|
|
67
|
-
public: IDL.Null,
|
|
68
|
-
allowed_viewers: IDL.Vec(IDL.Principal),
|
|
69
|
-
});
|
|
70
|
-
const DefiniteCanisterSettings = IDL.Record({
|
|
71
|
-
freezing_threshold: IDL.Nat,
|
|
72
|
-
wasm_memory_threshold: IDL.Nat,
|
|
73
|
-
controllers: IDL.Vec(IDL.Principal),
|
|
74
|
-
reserved_cycles_limit: IDL.Nat,
|
|
75
|
-
log_visibility: LogVisibility,
|
|
76
|
-
wasm_memory_limit: IDL.Nat,
|
|
77
|
-
memory_allocation: IDL.Nat,
|
|
78
|
-
compute_allocation: IDL.Nat,
|
|
79
|
-
});
|
|
80
|
-
const QueryStats = IDL.Record({
|
|
81
|
-
response_payload_bytes_total: IDL.Nat,
|
|
82
|
-
num_instructions_total: IDL.Nat,
|
|
83
|
-
num_calls_total: IDL.Nat,
|
|
84
|
-
request_payload_bytes_total: IDL.Nat,
|
|
85
|
-
});
|
|
86
|
-
const CanisterStatusResponse = IDL.Record({
|
|
87
|
-
memory_metrics: MemoryMetrics,
|
|
88
|
-
status: CanisterStatusType,
|
|
89
|
-
memory_size: IDL.Nat,
|
|
90
|
-
cycles: IDL.Nat,
|
|
91
|
-
settings: DefiniteCanisterSettings,
|
|
92
|
-
query_stats: QueryStats,
|
|
93
|
-
idle_cycles_burned_per_day: IDL.Nat,
|
|
94
|
-
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
95
|
-
reserved_cycles: IDL.Nat,
|
|
96
|
-
});
|
|
97
|
-
const Account = IDL.Record({
|
|
98
|
-
owner: IDL.Principal,
|
|
99
|
-
subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
100
|
-
});
|
|
101
|
-
const Utxo = IDL.Record({
|
|
102
|
-
height: IDL.Nat32,
|
|
103
|
-
value: IDL.Nat64,
|
|
104
|
-
outpoint: IDL.Record({ txid: IDL.Vec(IDL.Nat8), vout: IDL.Nat32 }),
|
|
105
|
-
});
|
|
106
|
-
const ReimbursementReason = IDL.Variant({
|
|
107
|
-
CallFailed: IDL.Null,
|
|
108
|
-
TaintedDestination: IDL.Record({
|
|
109
|
-
kyt_fee: IDL.Nat64,
|
|
110
|
-
kyt_provider: IDL.Principal,
|
|
111
|
-
}),
|
|
112
|
-
});
|
|
113
|
-
const WithdrawalFee = IDL.Record({
|
|
114
|
-
minter_fee: IDL.Nat64,
|
|
115
|
-
bitcoin_fee: IDL.Nat64,
|
|
116
|
-
});
|
|
117
|
-
const SuspendedReason = IDL.Variant({
|
|
118
|
-
ValueTooSmall: IDL.Null,
|
|
119
|
-
Quarantined: IDL.Null,
|
|
120
|
-
});
|
|
121
|
-
const BitcoinAddress = IDL.Variant({
|
|
122
|
-
p2wsh_v0: IDL.Vec(IDL.Nat8),
|
|
123
|
-
p2tr_v1: IDL.Vec(IDL.Nat8),
|
|
124
|
-
p2sh: IDL.Vec(IDL.Nat8),
|
|
125
|
-
p2wpkh_v0: IDL.Vec(IDL.Nat8),
|
|
126
|
-
p2pkh: IDL.Vec(IDL.Nat8),
|
|
127
|
-
});
|
|
128
|
-
const InvalidTransactionError = IDL.Variant({
|
|
129
|
-
too_many_inputs: IDL.Record({
|
|
130
|
-
max_num_inputs: IDL.Nat64,
|
|
131
|
-
num_inputs: IDL.Nat64,
|
|
132
|
-
}),
|
|
133
|
-
});
|
|
134
|
-
const WithdrawalReimbursementReason = IDL.Variant({
|
|
135
|
-
invalid_transaction: InvalidTransactionError,
|
|
136
|
-
});
|
|
137
|
-
const ReplacedReason = IDL.Variant({
|
|
138
|
-
to_cancel: IDL.Record({ reason: WithdrawalReimbursementReason }),
|
|
139
|
-
to_retry: IDL.Null,
|
|
140
|
-
});
|
|
141
|
-
const EventType = IDL.Variant({
|
|
142
|
-
received_utxos: IDL.Record({
|
|
143
|
-
to_account: Account,
|
|
144
|
-
mint_txid: IDL.Opt(IDL.Nat64),
|
|
145
|
-
utxos: IDL.Vec(Utxo),
|
|
146
|
-
}),
|
|
147
|
-
schedule_deposit_reimbursement: IDL.Record({
|
|
148
|
-
burn_block_index: IDL.Nat64,
|
|
149
|
-
account: Account,
|
|
150
|
-
amount: IDL.Nat64,
|
|
151
|
-
reason: ReimbursementReason,
|
|
152
|
-
}),
|
|
153
|
-
sent_transaction: IDL.Record({
|
|
154
|
-
fee: IDL.Opt(IDL.Nat64),
|
|
155
|
-
change_output: IDL.Opt(IDL.Record({ value: IDL.Nat64, vout: IDL.Nat32 })),
|
|
156
|
-
txid: IDL.Vec(IDL.Nat8),
|
|
157
|
-
withdrawal_fee: IDL.Opt(WithdrawalFee),
|
|
158
|
-
utxos: IDL.Vec(Utxo),
|
|
159
|
-
requests: IDL.Vec(IDL.Nat64),
|
|
160
|
-
submitted_at: IDL.Nat64,
|
|
161
|
-
}),
|
|
162
|
-
distributed_kyt_fee: IDL.Record({
|
|
163
|
-
block_index: IDL.Nat64,
|
|
164
|
-
amount: IDL.Nat64,
|
|
165
|
-
kyt_provider: IDL.Principal,
|
|
166
|
-
}),
|
|
167
|
-
init: InitArgs,
|
|
168
|
-
upgrade: UpgradeArgs,
|
|
169
|
-
retrieve_btc_kyt_failed: IDL.Record({
|
|
170
|
-
block_index: IDL.Nat64,
|
|
171
|
-
owner: IDL.Principal,
|
|
172
|
-
uuid: IDL.Text,
|
|
173
|
-
address: IDL.Text,
|
|
174
|
-
amount: IDL.Nat64,
|
|
175
|
-
kyt_provider: IDL.Principal,
|
|
176
|
-
}),
|
|
177
|
-
suspended_utxo: IDL.Record({
|
|
178
|
-
utxo: Utxo,
|
|
179
|
-
account: Account,
|
|
180
|
-
reason: SuspendedReason,
|
|
181
|
-
}),
|
|
182
|
-
accepted_retrieve_btc_request: IDL.Record({
|
|
183
|
-
received_at: IDL.Nat64,
|
|
184
|
-
block_index: IDL.Nat64,
|
|
185
|
-
address: BitcoinAddress,
|
|
186
|
-
reimbursement_account: IDL.Opt(Account),
|
|
187
|
-
amount: IDL.Nat64,
|
|
188
|
-
kyt_provider: IDL.Opt(IDL.Principal),
|
|
189
|
-
}),
|
|
190
|
-
checked_utxo: IDL.Record({
|
|
191
|
-
clean: IDL.Bool,
|
|
192
|
-
utxo: Utxo,
|
|
193
|
-
uuid: IDL.Text,
|
|
194
|
-
kyt_provider: IDL.Opt(IDL.Principal),
|
|
195
|
-
}),
|
|
196
|
-
schedule_withdrawal_reimbursement: IDL.Record({
|
|
197
|
-
burn_block_index: IDL.Nat64,
|
|
198
|
-
account: Account,
|
|
199
|
-
amount: IDL.Nat64,
|
|
200
|
-
reason: WithdrawalReimbursementReason,
|
|
201
|
-
}),
|
|
202
|
-
quarantined_withdrawal_reimbursement: IDL.Record({
|
|
203
|
-
burn_block_index: IDL.Nat64,
|
|
204
|
-
}),
|
|
205
|
-
removed_retrieve_btc_request: IDL.Record({ block_index: IDL.Nat64 }),
|
|
206
|
-
confirmed_transaction: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
207
|
-
replaced_transaction: IDL.Record({
|
|
208
|
-
fee: IDL.Nat64,
|
|
209
|
-
change_output: IDL.Record({ value: IDL.Nat64, vout: IDL.Nat32 }),
|
|
210
|
-
new_utxos: IDL.Opt(IDL.Vec(Utxo)),
|
|
211
|
-
old_txid: IDL.Vec(IDL.Nat8),
|
|
212
|
-
withdrawal_fee: IDL.Opt(WithdrawalFee),
|
|
213
|
-
new_txid: IDL.Vec(IDL.Nat8),
|
|
214
|
-
submitted_at: IDL.Nat64,
|
|
215
|
-
reason: IDL.Opt(ReplacedReason),
|
|
216
|
-
}),
|
|
217
|
-
checked_utxo_v2: IDL.Record({ utxo: Utxo, account: Account }),
|
|
218
|
-
ignored_utxo: IDL.Record({ utxo: Utxo }),
|
|
219
|
-
checked_utxo_mint_unknown: IDL.Record({
|
|
220
|
-
utxo: Utxo,
|
|
221
|
-
account: Account,
|
|
222
|
-
}),
|
|
223
|
-
reimbursed_failed_deposit: IDL.Record({
|
|
224
|
-
burn_block_index: IDL.Nat64,
|
|
225
|
-
mint_block_index: IDL.Nat64,
|
|
226
|
-
}),
|
|
227
|
-
reimbursed_withdrawal: IDL.Record({
|
|
228
|
-
burn_block_index: IDL.Nat64,
|
|
229
|
-
mint_block_index: IDL.Nat64,
|
|
230
|
-
}),
|
|
231
|
-
});
|
|
232
|
-
const Event = IDL.Record({
|
|
233
|
-
timestamp: IDL.Opt(IDL.Nat64),
|
|
234
|
-
payload: EventType,
|
|
235
|
-
});
|
|
236
|
-
const MinterInfo = IDL.Record({
|
|
237
|
-
retrieve_btc_min_amount: IDL.Nat64,
|
|
238
|
-
min_confirmations: IDL.Nat32,
|
|
239
|
-
kyt_fee: IDL.Nat64,
|
|
240
|
-
});
|
|
241
|
-
const RetrieveBtcArgs = IDL.Record({
|
|
242
|
-
address: IDL.Text,
|
|
243
|
-
amount: IDL.Nat64,
|
|
244
|
-
});
|
|
245
|
-
const RetrieveBtcOk = IDL.Record({ block_index: IDL.Nat64 });
|
|
246
|
-
const RetrieveBtcError = IDL.Variant({
|
|
247
|
-
MalformedAddress: IDL.Text,
|
|
248
|
-
GenericError: IDL.Record({
|
|
249
|
-
error_message: IDL.Text,
|
|
250
|
-
error_code: IDL.Nat64,
|
|
251
|
-
}),
|
|
252
|
-
TemporarilyUnavailable: IDL.Text,
|
|
253
|
-
AlreadyProcessing: IDL.Null,
|
|
254
|
-
AmountTooLow: IDL.Nat64,
|
|
255
|
-
InsufficientFunds: IDL.Record({ balance: IDL.Nat64 }),
|
|
256
|
-
});
|
|
257
|
-
const RetrieveBtcStatus = IDL.Variant({
|
|
258
|
-
Signing: IDL.Null,
|
|
259
|
-
Confirmed: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
260
|
-
Sending: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
261
|
-
AmountTooLow: IDL.Null,
|
|
262
|
-
Unknown: IDL.Null,
|
|
263
|
-
Submitted: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
264
|
-
Pending: IDL.Null,
|
|
265
|
-
});
|
|
266
|
-
const ReimbursementRequest = IDL.Record({
|
|
267
|
-
account: Account,
|
|
268
|
-
amount: IDL.Nat64,
|
|
269
|
-
reason: ReimbursementReason,
|
|
270
|
-
});
|
|
271
|
-
const ReimbursedDeposit = IDL.Record({
|
|
272
|
-
account: Account,
|
|
273
|
-
mint_block_index: IDL.Nat64,
|
|
274
|
-
amount: IDL.Nat64,
|
|
275
|
-
reason: ReimbursementReason,
|
|
276
|
-
});
|
|
277
|
-
const RetrieveBtcStatusV2 = IDL.Variant({
|
|
278
|
-
Signing: IDL.Null,
|
|
279
|
-
Confirmed: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
280
|
-
Sending: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
281
|
-
AmountTooLow: IDL.Null,
|
|
282
|
-
WillReimburse: ReimbursementRequest,
|
|
283
|
-
Unknown: IDL.Null,
|
|
284
|
-
Submitted: IDL.Record({ txid: IDL.Vec(IDL.Nat8) }),
|
|
285
|
-
Reimbursed: ReimbursedDeposit,
|
|
286
|
-
Pending: IDL.Null,
|
|
287
|
-
});
|
|
288
|
-
const RetrieveBtcWithApprovalArgs = IDL.Record({
|
|
289
|
-
from_subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
290
|
-
address: IDL.Text,
|
|
291
|
-
amount: IDL.Nat64,
|
|
292
|
-
});
|
|
293
|
-
const RetrieveBtcWithApprovalError = IDL.Variant({
|
|
294
|
-
MalformedAddress: IDL.Text,
|
|
295
|
-
GenericError: IDL.Record({
|
|
296
|
-
error_message: IDL.Text,
|
|
297
|
-
error_code: IDL.Nat64,
|
|
298
|
-
}),
|
|
299
|
-
TemporarilyUnavailable: IDL.Text,
|
|
300
|
-
InsufficientAllowance: IDL.Record({ allowance: IDL.Nat64 }),
|
|
301
|
-
AlreadyProcessing: IDL.Null,
|
|
302
|
-
AmountTooLow: IDL.Nat64,
|
|
303
|
-
InsufficientFunds: IDL.Record({ balance: IDL.Nat64 }),
|
|
304
|
-
});
|
|
305
|
-
const UtxoStatus = IDL.Variant({
|
|
306
|
-
ValueTooSmall: Utxo,
|
|
307
|
-
Tainted: Utxo,
|
|
308
|
-
Minted: IDL.Record({
|
|
309
|
-
minted_amount: IDL.Nat64,
|
|
310
|
-
block_index: IDL.Nat64,
|
|
311
|
-
utxo: Utxo,
|
|
312
|
-
}),
|
|
313
|
-
Checked: Utxo,
|
|
314
|
-
});
|
|
315
|
-
const Timestamp = IDL.Nat64;
|
|
316
|
-
const SuspendedUtxo = IDL.Record({
|
|
317
|
-
utxo: Utxo,
|
|
318
|
-
earliest_retry: Timestamp,
|
|
319
|
-
reason: SuspendedReason,
|
|
320
|
-
});
|
|
321
|
-
const PendingUtxo = IDL.Record({
|
|
322
|
-
confirmations: IDL.Nat32,
|
|
323
|
-
value: IDL.Nat64,
|
|
324
|
-
outpoint: IDL.Record({ txid: IDL.Vec(IDL.Nat8), vout: IDL.Nat32 }),
|
|
325
|
-
});
|
|
326
|
-
const UpdateBalanceError = IDL.Variant({
|
|
327
|
-
GenericError: IDL.Record({
|
|
328
|
-
error_message: IDL.Text,
|
|
329
|
-
error_code: IDL.Nat64,
|
|
330
|
-
}),
|
|
331
|
-
TemporarilyUnavailable: IDL.Text,
|
|
332
|
-
AlreadyProcessing: IDL.Null,
|
|
333
|
-
NoNewUtxos: IDL.Record({
|
|
334
|
-
suspended_utxos: IDL.Opt(IDL.Vec(SuspendedUtxo)),
|
|
335
|
-
required_confirmations: IDL.Nat32,
|
|
336
|
-
pending_utxos: IDL.Opt(IDL.Vec(PendingUtxo)),
|
|
337
|
-
current_confirmations: IDL.Opt(IDL.Nat32),
|
|
338
|
-
}),
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
return IDL.Service({
|
|
342
|
-
estimate_withdrawal_fee: IDL.Func(
|
|
343
|
-
[IDL.Record({ amount: IDL.Opt(IDL.Nat64) })],
|
|
344
|
-
[IDL.Record({ minter_fee: IDL.Nat64, bitcoin_fee: IDL.Nat64 })],
|
|
345
|
-
["query"],
|
|
346
|
-
),
|
|
347
|
-
get_btc_address: IDL.Func(
|
|
348
|
-
[
|
|
349
|
-
IDL.Record({
|
|
350
|
-
owner: IDL.Opt(IDL.Principal),
|
|
351
|
-
subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
352
|
-
}),
|
|
353
|
-
],
|
|
354
|
-
[IDL.Text],
|
|
355
|
-
[],
|
|
356
|
-
),
|
|
357
|
-
get_canister_status: IDL.Func([], [CanisterStatusResponse], []),
|
|
358
|
-
get_deposit_fee: IDL.Func([], [IDL.Nat64], ["query"]),
|
|
359
|
-
get_events: IDL.Func(
|
|
360
|
-
[IDL.Record({ start: IDL.Nat64, length: IDL.Nat64 })],
|
|
361
|
-
[IDL.Vec(Event)],
|
|
362
|
-
["query"],
|
|
363
|
-
),
|
|
364
|
-
get_known_utxos: IDL.Func(
|
|
365
|
-
[
|
|
366
|
-
IDL.Record({
|
|
367
|
-
owner: IDL.Opt(IDL.Principal),
|
|
368
|
-
subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
369
|
-
}),
|
|
370
|
-
],
|
|
371
|
-
[IDL.Vec(Utxo)],
|
|
372
|
-
["query"],
|
|
373
|
-
),
|
|
374
|
-
get_minter_info: IDL.Func([], [MinterInfo], ["query"]),
|
|
375
|
-
get_withdrawal_account: IDL.Func([], [Account], []),
|
|
376
|
-
retrieve_btc: IDL.Func(
|
|
377
|
-
[RetrieveBtcArgs],
|
|
378
|
-
[IDL.Variant({ Ok: RetrieveBtcOk, Err: RetrieveBtcError })],
|
|
379
|
-
[],
|
|
380
|
-
),
|
|
381
|
-
retrieve_btc_status: IDL.Func(
|
|
382
|
-
[IDL.Record({ block_index: IDL.Nat64 })],
|
|
383
|
-
[RetrieveBtcStatus],
|
|
384
|
-
["query"],
|
|
385
|
-
),
|
|
386
|
-
retrieve_btc_status_v2: IDL.Func(
|
|
387
|
-
[IDL.Record({ block_index: IDL.Nat64 })],
|
|
388
|
-
[RetrieveBtcStatusV2],
|
|
389
|
-
["query"],
|
|
390
|
-
),
|
|
391
|
-
retrieve_btc_status_v2_by_account: IDL.Func(
|
|
392
|
-
[IDL.Opt(Account)],
|
|
393
|
-
[
|
|
394
|
-
IDL.Vec(
|
|
395
|
-
IDL.Record({
|
|
396
|
-
block_index: IDL.Nat64,
|
|
397
|
-
status_v2: IDL.Opt(RetrieveBtcStatusV2),
|
|
398
|
-
}),
|
|
399
|
-
),
|
|
400
|
-
],
|
|
401
|
-
["query"],
|
|
402
|
-
),
|
|
403
|
-
retrieve_btc_with_approval: IDL.Func(
|
|
404
|
-
[RetrieveBtcWithApprovalArgs],
|
|
405
|
-
[
|
|
406
|
-
IDL.Variant({
|
|
407
|
-
Ok: RetrieveBtcOk,
|
|
408
|
-
Err: RetrieveBtcWithApprovalError,
|
|
409
|
-
}),
|
|
410
|
-
],
|
|
411
|
-
[],
|
|
412
|
-
),
|
|
413
|
-
update_balance: IDL.Func(
|
|
414
|
-
[
|
|
415
|
-
IDL.Record({
|
|
416
|
-
owner: IDL.Opt(IDL.Principal),
|
|
417
|
-
subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
418
|
-
}),
|
|
419
|
-
],
|
|
420
|
-
[
|
|
421
|
-
IDL.Variant({
|
|
422
|
-
Ok: IDL.Vec(UtxoStatus),
|
|
423
|
-
Err: UpdateBalanceError,
|
|
424
|
-
}),
|
|
425
|
-
],
|
|
426
|
-
[],
|
|
427
|
-
),
|
|
428
|
-
});
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
export const init = ({ IDL }) => {
|
|
432
|
-
const Mode = IDL.Variant({
|
|
433
|
-
RestrictedTo: IDL.Vec(IDL.Principal),
|
|
434
|
-
DepositsRestrictedTo: IDL.Vec(IDL.Principal),
|
|
435
|
-
ReadOnly: IDL.Null,
|
|
436
|
-
GeneralAvailability: IDL.Null,
|
|
437
|
-
});
|
|
438
|
-
const UpgradeArgs = IDL.Record({
|
|
439
|
-
get_utxos_cache_expiration_seconds: IDL.Opt(IDL.Nat64),
|
|
440
|
-
kyt_principal: IDL.Opt(IDL.Principal),
|
|
441
|
-
mode: IDL.Opt(Mode),
|
|
442
|
-
retrieve_btc_min_amount: IDL.Opt(IDL.Nat64),
|
|
443
|
-
max_time_in_queue_nanos: IDL.Opt(IDL.Nat64),
|
|
444
|
-
check_fee: IDL.Opt(IDL.Nat64),
|
|
445
|
-
btc_checker_principal: IDL.Opt(IDL.Principal),
|
|
446
|
-
min_confirmations: IDL.Opt(IDL.Nat32),
|
|
447
|
-
kyt_fee: IDL.Opt(IDL.Nat64),
|
|
448
|
-
});
|
|
449
|
-
const BtcNetwork = IDL.Variant({
|
|
450
|
-
Mainnet: IDL.Null,
|
|
451
|
-
Regtest: IDL.Null,
|
|
452
|
-
Testnet: IDL.Null,
|
|
453
|
-
});
|
|
454
|
-
const InitArgs = IDL.Record({
|
|
455
|
-
get_utxos_cache_expiration_seconds: IDL.Opt(IDL.Nat64),
|
|
456
|
-
kyt_principal: IDL.Opt(IDL.Principal),
|
|
457
|
-
ecdsa_key_name: IDL.Text,
|
|
458
|
-
mode: Mode,
|
|
459
|
-
retrieve_btc_min_amount: IDL.Nat64,
|
|
460
|
-
ledger_id: IDL.Principal,
|
|
461
|
-
max_time_in_queue_nanos: IDL.Nat64,
|
|
462
|
-
btc_network: BtcNetwork,
|
|
463
|
-
check_fee: IDL.Opt(IDL.Nat64),
|
|
464
|
-
btc_checker_principal: IDL.Opt(IDL.Principal),
|
|
465
|
-
min_confirmations: IDL.Opt(IDL.Nat32),
|
|
466
|
-
kyt_fee: IDL.Opt(IDL.Nat64),
|
|
467
|
-
});
|
|
468
|
-
const MinterArg = IDL.Variant({
|
|
469
|
-
Upgrade: IDL.Opt(UpgradeArgs),
|
|
470
|
-
Init: InitArgs,
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
return [MinterArg];
|
|
474
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class ParseBtcAddressError extends Error {
|
|
2
|
-
}
|
|
3
|
-
export declare class ParseBtcAddressInvalidError extends ParseBtcAddressError {
|
|
4
|
-
}
|
|
5
|
-
export declare class ParseBtcAddressNoDataError extends ParseBtcAddressError {
|
|
6
|
-
}
|
|
7
|
-
export declare class ParseBtcAddressUnsupportedAddressTypeError extends ParseBtcAddressError {
|
|
8
|
-
}
|
|
9
|
-
export declare class ParseBtcAddressBadWitnessLengthError extends ParseBtcAddressError {
|
|
10
|
-
}
|
|
11
|
-
export declare class ParseBtcAddressUnsupportedWitnessVersionError extends ParseBtcAddressError {
|
|
12
|
-
}
|
|
13
|
-
export declare class ParseBtcAddressUnexpectedHumanReadablePartError extends ParseBtcAddressError {
|
|
14
|
-
}
|
|
15
|
-
export declare class ParseBtcAddressMalformedAddressError extends ParseBtcAddressError {
|
|
16
|
-
}
|
|
17
|
-
export declare class ParseBtcAddressWrongNetworkError extends ParseBtcAddressError {
|
|
18
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { PendingUtxo, RetrieveBtcError, RetrieveBtcWithApprovalError, UpdateBalanceError } from "../candid/minter";
|
|
2
|
-
export declare class MinterGenericError extends Error {
|
|
3
|
-
}
|
|
4
|
-
export declare class MinterTemporaryUnavailableError extends MinterGenericError {
|
|
5
|
-
}
|
|
6
|
-
export declare class MinterAlreadyProcessingError extends MinterGenericError {
|
|
7
|
-
}
|
|
8
|
-
export declare class MinterUpdateBalanceError extends MinterGenericError {
|
|
9
|
-
}
|
|
10
|
-
export declare class MinterNoNewUtxosError extends MinterUpdateBalanceError {
|
|
11
|
-
readonly pendingUtxos: PendingUtxo[];
|
|
12
|
-
readonly requiredConfirmations: number;
|
|
13
|
-
constructor({ pending_utxos, required_confirmations, }: {
|
|
14
|
-
pending_utxos: [] | [PendingUtxo[]];
|
|
15
|
-
required_confirmations: number;
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
export declare class MinterRetrieveBtcError extends MinterGenericError {
|
|
19
|
-
}
|
|
20
|
-
export declare class MinterMalformedAddressError extends MinterRetrieveBtcError {
|
|
21
|
-
}
|
|
22
|
-
export declare class MinterAmountTooLowError extends MinterRetrieveBtcError {
|
|
23
|
-
}
|
|
24
|
-
export declare class MinterInsufficientFundsError extends MinterRetrieveBtcError {
|
|
25
|
-
}
|
|
26
|
-
export declare class MinterInsufficientAllowanceError extends MinterRetrieveBtcError {
|
|
27
|
-
}
|
|
28
|
-
export declare const createUpdateBalanceError: (Err: UpdateBalanceError) => MinterGenericError;
|
|
29
|
-
export declare const createRetrieveBtcError: (Err: RetrieveBtcError) => MinterGenericError;
|
|
30
|
-
export declare const createRetrieveBtcWithApprovalError: (Err: RetrieveBtcWithApprovalError) => MinterGenericError;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { Canister, type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { _SERVICE as CkBTCMinterService, MinterInfo, RetrieveBtcOk, RetrieveBtcStatus, Utxo, Account as WithdrawalAccount } from "./candid/minter";
|
|
3
|
-
import type { CkBTCCanisterOptions } from "./types/canister.options";
|
|
4
|
-
import type { EstimateWithdrawalFeeParams, GetBTCAddressParams, GetKnownUtxosParams, RetrieveBtcParams, RetrieveBtcStatusV2ByAccountParams, UpdateBalanceParams } from "./types/minter.params";
|
|
5
|
-
import type { EstimateWithdrawalFee, RetrieveBtcStatusV2WithId, UpdateBalanceOk } from "./types/minter.responses";
|
|
6
|
-
export declare class CkBTCMinterCanister extends Canister<CkBTCMinterService> {
|
|
7
|
-
static create(options: CkBTCCanisterOptions<CkBTCMinterService>): CkBTCMinterCanister;
|
|
8
|
-
/**
|
|
9
|
-
* Returns a BTC address for a given account.
|
|
10
|
-
*
|
|
11
|
-
* Note: an update call is required by the Minter canister.
|
|
12
|
-
*
|
|
13
|
-
* @param {GetBTCAddressParams} params The parameters for which a BTC address should be resolved.
|
|
14
|
-
* @param {Principal} params.owner The owner for which the BTC address should be generated. If not provided, the `caller` will be use instead.
|
|
15
|
-
* @param {Uint8Array} params.subaccount An optional subaccount to compute the address.
|
|
16
|
-
* @returns {Promise<string>} The BTC address of the given account.
|
|
17
|
-
*/
|
|
18
|
-
getBtcAddress: ({ owner, subaccount, }: GetBTCAddressParams) => Promise<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Notify the minter about the bitcoin transfer.
|
|
21
|
-
*
|
|
22
|
-
* Upon successful notification, new ckBTC should be available on the targeted address.
|
|
23
|
-
*
|
|
24
|
-
* @param {UpdateBalanceParams} params The parameters are the address to which bitcoin where transferred.
|
|
25
|
-
* @param {Principal} params.owner The owner of the address. If not provided, the `caller` will be use instead.
|
|
26
|
-
* @param {Principal} params.subaccount An optional subaccount of the address.
|
|
27
|
-
* @returns {Promise<UpdateBalanceOk>} The result of the balance update.
|
|
28
|
-
*/
|
|
29
|
-
updateBalance: ({ owner, subaccount, }: UpdateBalanceParams) => Promise<UpdateBalanceOk>;
|
|
30
|
-
/**
|
|
31
|
-
* Returns the account to which the caller should deposit ckBTC before withdrawing BTC using the [retrieveBtc] endpoint.
|
|
32
|
-
*
|
|
33
|
-
* @returns {Promise<Account>} The account to which ckBTC needs to be transferred. Provide corresponding information to map an Icrc1 account.
|
|
34
|
-
*/
|
|
35
|
-
getWithdrawalAccount: () => Promise<WithdrawalAccount>;
|
|
36
|
-
/**
|
|
37
|
-
* Submits a request to convert ckBTC to BTC.
|
|
38
|
-
*
|
|
39
|
-
* Note:
|
|
40
|
-
*
|
|
41
|
-
* The BTC retrieval process is slow. Instead of synchronously waiting for a BTC transaction to settle, this method returns a request ([block_index]) that the caller can use to query the request status.
|
|
42
|
-
*
|
|
43
|
-
* Preconditions:
|
|
44
|
-
*
|
|
45
|
-
* The caller deposited the requested amount in ckBTC to the account that the [getWithdrawalAccount] endpoint returns.
|
|
46
|
-
*
|
|
47
|
-
* @param {RetrieveBtcParams} params The parameters are the bitcoin address and amount to convert.
|
|
48
|
-
* @param {string} params.address The bitcoin address.
|
|
49
|
-
* @param {bigint} params.amount The ckBTC amount.
|
|
50
|
-
* @returns {Promise<RetrieveBtcOk>} The result or the operation.
|
|
51
|
-
*/
|
|
52
|
-
retrieveBtc: (params: RetrieveBtcParams) => Promise<RetrieveBtcOk>;
|
|
53
|
-
/**
|
|
54
|
-
* Submits a request to convert ckBTC to BTC after making an ICRC-2 approval.
|
|
55
|
-
*
|
|
56
|
-
* # Note
|
|
57
|
-
*
|
|
58
|
-
* The BTC retrieval process is slow. Instead of synchronously waiting for a BTC transaction to settle, this method returns a request ([block_index]) that the caller can use to query the request status.
|
|
59
|
-
*
|
|
60
|
-
* # Preconditions
|
|
61
|
-
*
|
|
62
|
-
* The caller allowed the minter's principal to spend its funds using
|
|
63
|
-
* [icrc2_approve] on the ckBTC ledger.
|
|
64
|
-
*
|
|
65
|
-
* @param {string} params.address The bitcoin address.
|
|
66
|
-
* @param {bigint} params.amount The ckBTC amount.
|
|
67
|
-
* @param {Uint8Array} params.fromSubaccount An optional subaccount from which
|
|
68
|
-
* the ckBTC should be transferred.
|
|
69
|
-
* @returns {Promise<RetrieveBtcOk>} The result or the operation.
|
|
70
|
-
*/
|
|
71
|
-
retrieveBtcWithApproval: ({ address, amount, fromSubaccount, }: {
|
|
72
|
-
address: string;
|
|
73
|
-
amount: bigint;
|
|
74
|
-
fromSubaccount?: Uint8Array;
|
|
75
|
-
}) => Promise<RetrieveBtcOk>;
|
|
76
|
-
/**
|
|
77
|
-
* Returns the status of a specific BTC withdrawal based on the transaction ID
|
|
78
|
-
* of the corresponding burn transaction.
|
|
79
|
-
*
|
|
80
|
-
* @param {bigint} transactionId The ID of the corresponding burn transaction.
|
|
81
|
-
* @param {boolean} certified query or update call
|
|
82
|
-
* @returns {Promise<RetrieveBtcStatus>} The status of the BTC retrieval request.
|
|
83
|
-
*/
|
|
84
|
-
retrieveBtcStatus: ({ transactionId, certified, }: {
|
|
85
|
-
transactionId: bigint;
|
|
86
|
-
certified: boolean;
|
|
87
|
-
}) => Promise<RetrieveBtcStatus>;
|
|
88
|
-
/**
|
|
89
|
-
* Returns the status of all BTC withdrawals for an account.
|
|
90
|
-
*
|
|
91
|
-
* @param {boolean} certified query or update call
|
|
92
|
-
* @param {MinterAccount} account an optional account to retrieve the statuses. If not provided, statuses for the caller are retrieved.
|
|
93
|
-
* @returns {Promise<RetrieveBtcStatusV2WithId[]>} The statuses of the BTC retrieval requests.
|
|
94
|
-
*/
|
|
95
|
-
retrieveBtcStatusV2ByAccount: ({ account, certified, }: RetrieveBtcStatusV2ByAccountParams) => Promise<RetrieveBtcStatusV2WithId[]>;
|
|
96
|
-
/**
|
|
97
|
-
* Returns an estimation of the user's fee (in Satoshi) for a retrieve_btc request based on the current status of the Bitcoin network and the fee related to the minter.
|
|
98
|
-
*
|
|
99
|
-
* @param {RetrieveBtcParams} params The parameters to estimate the fee.
|
|
100
|
-
* @param {boolean} params.certified query or update call
|
|
101
|
-
* @param {bigint | undefined} params.amount The optional amount for which the fee should be estimated.
|
|
102
|
-
*/
|
|
103
|
-
estimateWithdrawalFee: ({ certified, amount, }: EstimateWithdrawalFeeParams) => Promise<EstimateWithdrawalFee>;
|
|
104
|
-
/**
|
|
105
|
-
* Returns internal minter parameters such as the minimal amount to retrieve BTC, minimal number of confirmations or KYT fee.
|
|
106
|
-
*
|
|
107
|
-
* @param {QueryParams} params The parameters to get the minter info.
|
|
108
|
-
* @param {boolean} params.certified query or update call
|
|
109
|
-
*/
|
|
110
|
-
getMinterInfo: ({ certified }: QueryParams) => Promise<MinterInfo>;
|
|
111
|
-
/**
|
|
112
|
-
* Returns UTXOs of the given account known by the minter.
|
|
113
|
-
*
|
|
114
|
-
* @param {GetKnownUtxosParams} params The parameters for which the known utxos should be resolved.
|
|
115
|
-
* @param {Principal} params.owner The owner of the account. Note that if not provided, the `caller` would be used by the minter instead.
|
|
116
|
-
* @param {Uint8Array} params.subaccount An optional subaccount.
|
|
117
|
-
* @returns {Promise<Utxo[]>} The known utxos (with no guarantee in the ordering).
|
|
118
|
-
*/
|
|
119
|
-
getKnownUtxos: ({ owner, subaccount, certified, }: GetKnownUtxosParams) => Promise<Utxo[]>;
|
|
120
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { get_balance_request, get_utxos_request } from "../candid/bitcoin";
|
|
3
|
-
export type BitcoinNetwork = "testnet" | "mainnet" | "regtest";
|
|
4
|
-
export type GetUtxosParams = Omit<get_utxos_request, "network" | "filter"> & {
|
|
5
|
-
network: BitcoinNetwork;
|
|
6
|
-
filter?: {
|
|
7
|
-
page: Uint8Array;
|
|
8
|
-
} | {
|
|
9
|
-
minConfirmations: number;
|
|
10
|
-
};
|
|
11
|
-
} & Omit<QueryParams, "certified">;
|
|
12
|
-
export declare const toGetUtxosParams: ({ network, filter, ...rest }: GetUtxosParams) => get_utxos_request;
|
|
13
|
-
export type GetBalanceParams = Omit<get_balance_request, "network" | "min_confirmations"> & {
|
|
14
|
-
network: BitcoinNetwork;
|
|
15
|
-
minConfirmations?: number;
|
|
16
|
-
} & Omit<QueryParams, "certified">;
|
|
17
|
-
export declare const toGetBalanceParams: ({ network, minConfirmations, ...rest }: GetBalanceParams) => get_balance_request;
|
package/dist/types/btc.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { BtcAddressType, BtcNetwork } from "../enums/btc.enums";
|
|
2
|
-
export interface BtcAddress {
|
|
3
|
-
address: string;
|
|
4
|
-
network?: BtcNetwork;
|
|
5
|
-
}
|
|
6
|
-
export interface BtcAddressInfo extends Required<BtcAddress> {
|
|
7
|
-
parser: "bip-173" | "base58";
|
|
8
|
-
type: BtcAddressType;
|
|
9
|
-
}
|