@dfinity/ckbtc 6.0.0 → 6.0.1-next-2025-12-03
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 +5 -329
- package/dist/candid/minter.certified.idl.js +7 -0
- package/dist/candid/minter.d.ts +7 -0
- package/dist/candid/minter.did +9 -1
- package/dist/candid/minter.idl.js +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +3 -3
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@ A library for interfacing with [ckBTC](https://github.com/dfinity/ic/tree/master
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@dfinity/ckbtc) [](https://opensource.org/licenses/Apache-2.0)
|
|
6
6
|
|
|
7
|
+
> [!TIP]
|
|
8
|
+
> Still using `@dfinity/ckbtc`? Upgrade to [`@icp-sdk/canisters/ckbtc`](https://js.icp.build/canisters/latest/upgrading/v1/)!
|
|
9
|
+
|
|
7
10
|
## Table of contents
|
|
8
11
|
|
|
9
12
|
- [Installation](#installation)
|
|
@@ -45,336 +48,9 @@ const { getBtcAddress } = CkBTCMinterCanister.create({
|
|
|
45
48
|
const btcAddress = await getBtcAddress({});
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
##
|
|
49
|
-
|
|
50
|
-
`ckbtc-js` implements following features:
|
|
51
|
-
|
|
52
|
-
<!-- TSDOC_START -->
|
|
53
|
-
|
|
54
|
-
### :toolbox: Functions
|
|
55
|
-
|
|
56
|
-
- [parseBtcAddress](#gear-parsebtcaddress)
|
|
57
|
-
|
|
58
|
-
#### :gear: parseBtcAddress
|
|
59
|
-
|
|
60
|
-
Parse a Bitcoin address.
|
|
61
|
-
|
|
62
|
-
Parse implementation follows strategy implemented in [Minter canister](https://github.com/dfinity/ic/blob/a8da3aa23dc6f8f4708cb0cb8edce84c5bd8f225/rs/bitcoin/ckbtc/minter/src/address.rs#L54).
|
|
63
|
-
|
|
64
|
-
Credits: Parts of JavaScript code and test values from [bitcoin-address-validation](https://github.com/ruigomeseu/bitcoin-address-validation).
|
|
65
|
-
|
|
66
|
-
| Function | Type |
|
|
67
|
-
| ----------------- | ------------------------------------------------------- |
|
|
68
|
-
| `parseBtcAddress` | `({ address, network, }: BtcAddress) => BtcAddressInfo` |
|
|
69
|
-
|
|
70
|
-
Parameters:
|
|
71
|
-
|
|
72
|
-
- `params`: The Bitcoin address and network to parse
|
|
73
|
-
- `params.network`: Optional. Default BtcNetwork is Mainnet
|
|
74
|
-
|
|
75
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/utils/btc.utils.ts#L195)
|
|
76
|
-
|
|
77
|
-
### :factory: CkBTCMinterCanister
|
|
78
|
-
|
|
79
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L42)
|
|
80
|
-
|
|
81
|
-
#### Static Methods
|
|
82
|
-
|
|
83
|
-
- [create](#gear-create)
|
|
84
|
-
|
|
85
|
-
##### :gear: create
|
|
86
|
-
|
|
87
|
-
| Method | Type |
|
|
88
|
-
| -------- | ------------------------------------------------------------------ |
|
|
89
|
-
| `create` | `(options: CkBTCCanisterOptions<_SERVICE>) => CkBTCMinterCanister` |
|
|
90
|
-
|
|
91
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L43)
|
|
92
|
-
|
|
93
|
-
#### Methods
|
|
94
|
-
|
|
95
|
-
- [getBtcAddress](#gear-getbtcaddress)
|
|
96
|
-
- [updateBalance](#gear-updatebalance)
|
|
97
|
-
- [getWithdrawalAccount](#gear-getwithdrawalaccount)
|
|
98
|
-
- [retrieveBtc](#gear-retrievebtc)
|
|
99
|
-
- [retrieveBtcWithApproval](#gear-retrievebtcwithapproval)
|
|
100
|
-
- [retrieveBtcStatus](#gear-retrievebtcstatus)
|
|
101
|
-
- [retrieveBtcStatusV2ByAccount](#gear-retrievebtcstatusv2byaccount)
|
|
102
|
-
- [estimateWithdrawalFee](#gear-estimatewithdrawalfee)
|
|
103
|
-
- [getMinterInfo](#gear-getminterinfo)
|
|
104
|
-
- [getKnownUtxos](#gear-getknownutxos)
|
|
105
|
-
|
|
106
|
-
##### :gear: getBtcAddress
|
|
107
|
-
|
|
108
|
-
Returns a BTC address for a given account.
|
|
109
|
-
|
|
110
|
-
Note: an update call is required by the Minter canister.
|
|
111
|
-
|
|
112
|
-
| Method | Type |
|
|
113
|
-
| --------------- | ----------------------------------------------------------- |
|
|
114
|
-
| `getBtcAddress` | `({ owner, subaccount, }: MinterParams) => Promise<string>` |
|
|
115
|
-
|
|
116
|
-
Parameters:
|
|
117
|
-
|
|
118
|
-
- `params`: The parameters for which a BTC address should be resolved.
|
|
119
|
-
- `params.owner`: The owner for which the BTC address should be generated. If not provided, the `caller` will be use instead.
|
|
120
|
-
- `params.subaccount`: An optional subaccount to compute the address.
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
|
|
124
|
-
The BTC address of the given account.
|
|
125
|
-
|
|
126
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L64)
|
|
127
|
-
|
|
128
|
-
##### :gear: updateBalance
|
|
129
|
-
|
|
130
|
-
Notify the minter about the bitcoin transfer.
|
|
131
|
-
|
|
132
|
-
Upon successful notification, new ckBTC should be available on the targeted address.
|
|
133
|
-
|
|
134
|
-
| Method | Type |
|
|
135
|
-
| --------------- | -------------------------------------------------------------------- |
|
|
136
|
-
| `updateBalance` | `({ owner, subaccount, }: MinterParams) => Promise<UpdateBalanceOk>` |
|
|
137
|
-
|
|
138
|
-
Parameters:
|
|
139
|
-
|
|
140
|
-
- `params`: The parameters are the address to which bitcoin where transferred.
|
|
141
|
-
- `params.owner`: The owner of the address. If not provided, the `caller` will be use instead.
|
|
142
|
-
- `params.subaccount`: An optional subaccount of the address.
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
|
|
146
|
-
The result of the balance update.
|
|
147
|
-
|
|
148
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L83)
|
|
149
|
-
|
|
150
|
-
##### :gear: getWithdrawalAccount
|
|
151
|
-
|
|
152
|
-
Returns the account to which the caller should deposit ckBTC before withdrawing BTC using the [retrieveBtc] endpoint.
|
|
153
|
-
|
|
154
|
-
| Method | Type |
|
|
155
|
-
| ---------------------- | ------------------------ |
|
|
156
|
-
| `getWithdrawalAccount` | `() => Promise<Account>` |
|
|
157
|
-
|
|
158
|
-
Returns:
|
|
159
|
-
|
|
160
|
-
The account to which ckBTC needs to be transferred. Provide corresponding information to map an Icrc1 account.
|
|
161
|
-
|
|
162
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L106)
|
|
163
|
-
|
|
164
|
-
##### :gear: retrieveBtc
|
|
165
|
-
|
|
166
|
-
Submits a request to convert ckBTC to BTC.
|
|
167
|
-
|
|
168
|
-
Note:
|
|
169
|
-
|
|
170
|
-
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.
|
|
171
|
-
|
|
172
|
-
Preconditions:
|
|
173
|
-
|
|
174
|
-
The caller deposited the requested amount in ckBTC to the account that the [getWithdrawalAccount] endpoint returns.
|
|
175
|
-
|
|
176
|
-
| Method | Type |
|
|
177
|
-
| ------------- | ------------------------------------------------------- |
|
|
178
|
-
| `retrieveBtc` | `(params: RetrieveBtcParams) => Promise<RetrieveBtcOk>` |
|
|
179
|
-
|
|
180
|
-
Parameters:
|
|
181
|
-
|
|
182
|
-
- `params`: The parameters are the bitcoin address and amount to convert.
|
|
183
|
-
- `params.address`: The bitcoin address.
|
|
184
|
-
- `params.amount`: The ckBTC amount.
|
|
185
|
-
|
|
186
|
-
Returns:
|
|
187
|
-
|
|
188
|
-
The result or the operation.
|
|
189
|
-
|
|
190
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L125)
|
|
191
|
-
|
|
192
|
-
##### :gear: retrieveBtcWithApproval
|
|
193
|
-
|
|
194
|
-
Submits a request to convert ckBTC to BTC after making an ICRC-2 approval.
|
|
195
|
-
|
|
196
|
-
# Note
|
|
197
|
-
|
|
198
|
-
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.
|
|
199
|
-
|
|
200
|
-
# Preconditions
|
|
201
|
-
|
|
202
|
-
The caller allowed the minter's principal to spend its funds using
|
|
203
|
-
[icrc2_approve] on the ckBTC ledger.
|
|
204
|
-
|
|
205
|
-
| Method | Type |
|
|
206
|
-
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
207
|
-
| `retrieveBtcWithApproval` | `({ address, amount, fromSubaccount, }: { address: string; amount: bigint; fromSubaccount?: Uint8Array<ArrayBufferLike> or undefined; }) => Promise<RetrieveBtcOk>` |
|
|
208
|
-
|
|
209
|
-
Parameters:
|
|
210
|
-
|
|
211
|
-
- `params.address`: The bitcoin address.
|
|
212
|
-
- `params.amount`: The ckBTC amount.
|
|
213
|
-
- `params.fromSubaccount`: An optional subaccount from which
|
|
214
|
-
the ckBTC should be transferred.
|
|
215
|
-
|
|
216
|
-
Returns:
|
|
217
|
-
|
|
218
|
-
The result or the operation.
|
|
219
|
-
|
|
220
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L155)
|
|
221
|
-
|
|
222
|
-
##### :gear: retrieveBtcStatus
|
|
223
|
-
|
|
224
|
-
Returns the status of a specific BTC withdrawal based on the transaction ID
|
|
225
|
-
of the corresponding burn transaction.
|
|
226
|
-
|
|
227
|
-
| Method | Type |
|
|
228
|
-
| ------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
229
|
-
| `retrieveBtcStatus` | `({ transactionId, certified, }: { transactionId: bigint; certified: boolean; }) => Promise<RetrieveBtcStatus>` |
|
|
230
|
-
|
|
231
|
-
Parameters:
|
|
232
|
-
|
|
233
|
-
- `transactionId`: The ID of the corresponding burn transaction.
|
|
234
|
-
- `certified`: query or update call
|
|
235
|
-
|
|
236
|
-
Returns:
|
|
237
|
-
|
|
238
|
-
The status of the BTC retrieval request.
|
|
239
|
-
|
|
240
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L187)
|
|
241
|
-
|
|
242
|
-
##### :gear: retrieveBtcStatusV2ByAccount
|
|
243
|
-
|
|
244
|
-
Returns the status of all BTC withdrawals for an account.
|
|
245
|
-
|
|
246
|
-
| Method | Type |
|
|
247
|
-
| ------------------------------ | ------------------------------------------------------------------------------------------------------- |
|
|
248
|
-
| `retrieveBtcStatusV2ByAccount` | `({ account, certified, }: RetrieveBtcStatusV2ByAccountParams) => Promise<RetrieveBtcStatusV2WithId[]>` |
|
|
249
|
-
|
|
250
|
-
Parameters:
|
|
251
|
-
|
|
252
|
-
- `certified`: query or update call
|
|
253
|
-
- `account`: an optional account to retrieve the statuses. If not provided, statuses for the caller are retrieved.
|
|
254
|
-
|
|
255
|
-
Returns:
|
|
256
|
-
|
|
257
|
-
The statuses of the BTC retrieval requests.
|
|
258
|
-
|
|
259
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L205)
|
|
260
|
-
|
|
261
|
-
##### :gear: estimateWithdrawalFee
|
|
262
|
-
|
|
263
|
-
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.
|
|
264
|
-
|
|
265
|
-
| Method | Type |
|
|
266
|
-
| ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
267
|
-
| `estimateWithdrawalFee` | `({ certified, amount, }: EstimateWithdrawalFeeParams) => Promise<EstimateWithdrawalFee>` |
|
|
268
|
-
|
|
269
|
-
Parameters:
|
|
270
|
-
|
|
271
|
-
- `params`: The parameters to estimate the fee.
|
|
272
|
-
- `params.certified`: query or update call
|
|
273
|
-
- `params.amount`: The optional amount for which the fee should be estimated.
|
|
274
|
-
|
|
275
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L239)
|
|
276
|
-
|
|
277
|
-
##### :gear: getMinterInfo
|
|
278
|
-
|
|
279
|
-
Returns internal minter parameters such as the minimal amount to retrieve BTC, minimal number of confirmations or KYT fee.
|
|
280
|
-
|
|
281
|
-
| Method | Type |
|
|
282
|
-
| --------------- | ----------------------------------------------------- |
|
|
283
|
-
| `getMinterInfo` | `({ certified }: QueryParams) => Promise<MinterInfo>` |
|
|
284
|
-
|
|
285
|
-
Parameters:
|
|
286
|
-
|
|
287
|
-
- `params`: The parameters to get the minter info.
|
|
288
|
-
- `params.certified`: query or update call
|
|
289
|
-
|
|
290
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L253)
|
|
291
|
-
|
|
292
|
-
##### :gear: getKnownUtxos
|
|
293
|
-
|
|
294
|
-
Returns UTXOs of the given account known by the minter.
|
|
295
|
-
|
|
296
|
-
| Method | Type |
|
|
297
|
-
| --------------- | ----------------------------------------------------------------------------- |
|
|
298
|
-
| `getKnownUtxos` | `({ owner, subaccount, certified, }: GetKnownUtxosParams) => Promise<Utxo[]>` |
|
|
299
|
-
|
|
300
|
-
Parameters:
|
|
301
|
-
|
|
302
|
-
- `params`: The parameters for which the known utxos should be resolved.
|
|
303
|
-
- `params.owner`: The owner of the account. Note that if not provided, the `caller` would be used by the minter instead.
|
|
304
|
-
- `params.subaccount`: An optional subaccount.
|
|
305
|
-
|
|
306
|
-
Returns:
|
|
307
|
-
|
|
308
|
-
The known utxos (with no guarantee in the ordering).
|
|
309
|
-
|
|
310
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/minter.canister.ts#L266)
|
|
311
|
-
|
|
312
|
-
### :factory: BitcoinCanister
|
|
313
|
-
|
|
314
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L17)
|
|
315
|
-
|
|
316
|
-
#### Static Methods
|
|
317
|
-
|
|
318
|
-
- [create](#gear-create)
|
|
319
|
-
|
|
320
|
-
##### :gear: create
|
|
321
|
-
|
|
322
|
-
| Method | Type |
|
|
323
|
-
| -------- | -------------------------------------------------------------- |
|
|
324
|
-
| `create` | `(options: CkBTCCanisterOptions<_SERVICE>) => BitcoinCanister` |
|
|
325
|
-
|
|
326
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L18)
|
|
327
|
-
|
|
328
|
-
#### Methods
|
|
329
|
-
|
|
330
|
-
- [getUtxosQuery](#gear-getutxosquery)
|
|
331
|
-
- [getBalanceQuery](#gear-getbalancequery)
|
|
332
|
-
|
|
333
|
-
##### :gear: getUtxosQuery
|
|
334
|
-
|
|
335
|
-
Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet`, `testnet` or `regtest`), the function returns all unspent transaction outputs (UTXOs) associated with the provided address in the specified Bitcoin network based on the current view of the Bitcoin blockchain available to the Bitcoin component.
|
|
336
|
-
|
|
337
|
-
⚠️ Note that this method does not support certified calls because only canisters are allowed to get UTXOs via update calls.
|
|
338
|
-
|
|
339
|
-
| Method | Type |
|
|
340
|
-
| --------------- | ---------------------------------------------------------------- |
|
|
341
|
-
| `getUtxosQuery` | `({ ...params }: GetUtxosParams) => Promise<get_utxos_response>` |
|
|
342
|
-
|
|
343
|
-
Parameters:
|
|
344
|
-
|
|
345
|
-
- `params.network`: Tesnet or mainnet.
|
|
346
|
-
- `params.filter`: The optional filter parameter can be used to restrict the set of returned UTXOs, either providing a minimum number of confirmations or a page reference when pagination is used for addresses with many UTXOs.
|
|
347
|
-
- `params.address`: A Bitcoin address.
|
|
348
|
-
|
|
349
|
-
Returns:
|
|
350
|
-
|
|
351
|
-
The UTXOs are returned sorted by block height in descending order.
|
|
352
|
-
|
|
353
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L42)
|
|
354
|
-
|
|
355
|
-
##### :gear: getBalanceQuery
|
|
356
|
-
|
|
357
|
-
Given a `get_balance_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet`, `testnet` or `regtest`), the function returns the current balance of this address in `Satoshi` (10^8 Satoshi = 1 Bitcoin) in the specified Bitcoin network.
|
|
358
|
-
|
|
359
|
-
⚠️ Note that this method does not support certified calls because only canisters are allowed to get Bitcoin balance via update calls.
|
|
360
|
-
|
|
361
|
-
| Method | Type |
|
|
362
|
-
| ----------------- | ------------------------------------------------------ |
|
|
363
|
-
| `getBalanceQuery` | `({ ...params }: GetBalanceParams) => Promise<bigint>` |
|
|
364
|
-
|
|
365
|
-
Parameters:
|
|
366
|
-
|
|
367
|
-
- `params.network`: Tesnet or mainnet.
|
|
368
|
-
- `params.min_confirmations`: The optional filter parameter can be used to limit the set of considered UTXOs for the calculation of the balance to those with at least the provided number of confirmations in the same manner as for the `bitcoin_get_utxos` call.
|
|
369
|
-
- `params.address`: A Bitcoin address.
|
|
370
|
-
|
|
371
|
-
Returns:
|
|
372
|
-
|
|
373
|
-
The balance is returned in `Satoshi` (10^8 Satoshi = 1 Bitcoin).
|
|
374
|
-
|
|
375
|
-
[:link: Source](https://github.com/dfinity/icp-js-canisters/tree/main/packages/ckbtc/src/bitcoin.canister.ts#L64)
|
|
51
|
+
## Documentation
|
|
376
52
|
|
|
377
|
-
|
|
53
|
+
You can find the API docs [here](https://js.icp.build/canisters/latest/api/ckbtc/).
|
|
378
54
|
|
|
379
55
|
## Resources
|
|
380
56
|
|
|
@@ -62,6 +62,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
62
62
|
stopping: IDL.Null,
|
|
63
63
|
running: IDL.Null,
|
|
64
64
|
});
|
|
65
|
+
const environment_variable = IDL.Record({
|
|
66
|
+
value: IDL.Text,
|
|
67
|
+
name: IDL.Text,
|
|
68
|
+
});
|
|
65
69
|
const LogVisibility = IDL.Variant({
|
|
66
70
|
controllers: IDL.Null,
|
|
67
71
|
public: IDL.Null,
|
|
@@ -70,6 +74,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
70
74
|
const DefiniteCanisterSettings = IDL.Record({
|
|
71
75
|
freezing_threshold: IDL.Nat,
|
|
72
76
|
wasm_memory_threshold: IDL.Nat,
|
|
77
|
+
environment_variables: IDL.Vec(environment_variable),
|
|
73
78
|
controllers: IDL.Vec(IDL.Principal),
|
|
74
79
|
reserved_cycles_limit: IDL.Nat,
|
|
75
80
|
log_visibility: LogVisibility,
|
|
@@ -87,6 +92,8 @@ export const idlFactory = ({ IDL }) => {
|
|
|
87
92
|
memory_metrics: MemoryMetrics,
|
|
88
93
|
status: CanisterStatusType,
|
|
89
94
|
memory_size: IDL.Nat,
|
|
95
|
+
ready_for_migration: IDL.Bool,
|
|
96
|
+
version: IDL.Nat64,
|
|
90
97
|
cycles: IDL.Nat,
|
|
91
98
|
settings: DefiniteCanisterSettings,
|
|
92
99
|
query_stats: QueryStats,
|
package/dist/candid/minter.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface CanisterStatusResponse {
|
|
|
46
46
|
memory_metrics: MemoryMetrics;
|
|
47
47
|
status: CanisterStatusType;
|
|
48
48
|
memory_size: bigint;
|
|
49
|
+
ready_for_migration: boolean;
|
|
50
|
+
version: bigint;
|
|
49
51
|
cycles: bigint;
|
|
50
52
|
settings: DefiniteCanisterSettings;
|
|
51
53
|
query_stats: QueryStats;
|
|
@@ -60,6 +62,7 @@ export type CanisterStatusType =
|
|
|
60
62
|
export interface DefiniteCanisterSettings {
|
|
61
63
|
freezing_threshold: bigint;
|
|
62
64
|
wasm_memory_threshold: bigint;
|
|
65
|
+
environment_variables: Array<environment_variable>;
|
|
63
66
|
controllers: Array<Principal>;
|
|
64
67
|
reserved_cycles_limit: bigint;
|
|
65
68
|
log_visibility: LogVisibility;
|
|
@@ -701,6 +704,10 @@ export interface WithdrawalFee {
|
|
|
701
704
|
export type WithdrawalReimbursementReason = {
|
|
702
705
|
invalid_transaction: InvalidTransactionError;
|
|
703
706
|
};
|
|
707
|
+
export interface environment_variable {
|
|
708
|
+
value: string;
|
|
709
|
+
name: string;
|
|
710
|
+
}
|
|
704
711
|
export interface _SERVICE {
|
|
705
712
|
/**
|
|
706
713
|
* / Returns an estimate of the user's fee (in Satoshi) for a
|
package/dist/candid/minter.did
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 724ae41 (2025-11-27 tags: release-2025-11-28_03-22-base) 'rs/bitcoin/ckbtc/minter/ckbtc_minter.did' by import-candid
|
|
2
2
|
|
|
3
3
|
// Represents an account on the ckBTC ledger.
|
|
4
4
|
type Account = record { owner : principal; subaccount : opt blob };
|
|
5
5
|
|
|
6
|
+
type environment_variable = record {
|
|
7
|
+
name: text;
|
|
8
|
+
value: text;
|
|
9
|
+
};
|
|
10
|
+
|
|
6
11
|
type CanisterStatusResponse = record {
|
|
7
12
|
status : CanisterStatusType;
|
|
13
|
+
ready_for_migration : bool;
|
|
14
|
+
version : nat64;
|
|
8
15
|
memory_size : nat;
|
|
9
16
|
cycles : nat;
|
|
10
17
|
settings : DefiniteCanisterSettings;
|
|
@@ -44,6 +51,7 @@ type DefiniteCanisterSettings = record {
|
|
|
44
51
|
log_visibility: LogVisibility;
|
|
45
52
|
wasm_memory_limit : nat;
|
|
46
53
|
wasm_memory_threshold : nat;
|
|
54
|
+
environment_variables : vec environment_variable;
|
|
47
55
|
};
|
|
48
56
|
|
|
49
57
|
type LogVisibility = variant {
|
|
@@ -62,6 +62,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
62
62
|
stopping: IDL.Null,
|
|
63
63
|
running: IDL.Null,
|
|
64
64
|
});
|
|
65
|
+
const environment_variable = IDL.Record({
|
|
66
|
+
value: IDL.Text,
|
|
67
|
+
name: IDL.Text,
|
|
68
|
+
});
|
|
65
69
|
const LogVisibility = IDL.Variant({
|
|
66
70
|
controllers: IDL.Null,
|
|
67
71
|
public: IDL.Null,
|
|
@@ -70,6 +74,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
70
74
|
const DefiniteCanisterSettings = IDL.Record({
|
|
71
75
|
freezing_threshold: IDL.Nat,
|
|
72
76
|
wasm_memory_threshold: IDL.Nat,
|
|
77
|
+
environment_variables: IDL.Vec(environment_variable),
|
|
73
78
|
controllers: IDL.Vec(IDL.Principal),
|
|
74
79
|
reserved_cycles_limit: IDL.Nat,
|
|
75
80
|
log_visibility: LogVisibility,
|
|
@@ -87,6 +92,8 @@ export const idlFactory = ({ IDL }) => {
|
|
|
87
92
|
memory_metrics: MemoryMetrics,
|
|
88
93
|
status: CanisterStatusType,
|
|
89
94
|
memory_size: IDL.Nat,
|
|
95
|
+
ready_for_migration: IDL.Bool,
|
|
96
|
+
version: IDL.Nat64,
|
|
90
97
|
cycles: IDL.Nat,
|
|
91
98
|
settings: DefiniteCanisterSettings,
|
|
92
99
|
query_stats: QueryStats,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Yt=Object.create;var At=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var It=Object.getOwnPropertyNames;var Lt=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var te=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of It(e))!Dt.call(t,o)&&o!==r&&At(t,o,{get:()=>e[o],enumerable:!(n=Zt(e,o))||n.enumerable});return t};var re=(t,e,r)=>(r=t!=null?Yt(Lt(t)):{},ee(e||!t||!t.__esModule?At(r,"default",{value:t,enumerable:!0}):r,t));var Xt=te(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.bech32m=T.bech32=void 0;var J="qpzry9x8gf2tvdw0s3jn54khce6mua7l",jt={};for(let t=0;t<J.length;t++){let e=J.charAt(t);jt[e]=t}function P(t){let e=t>>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function $t(t){let e=1;for(let r=0;r<t.length;++r){let n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=P(e)^n>>5}e=P(e);for(let r=0;r<t.length;++r){let n=t.charCodeAt(r);e=P(e)^n&31}return e}function Vt(t,e,r,n){let o=0,c=0,a=(1<<r)-1,i=[];for(let s=0;s<t.length;++s)for(o=o<<e|t[s],c+=e;c>=r;)c-=r,i.push(o>>c&a);if(n)c>0&&i.push(o<<r-c&a);else{if(c>=e)return"Excess padding";if(o<<r-c&a)return"Non-zero padding"}return i}function be(t){return Vt(t,8,5,!0)}function Ne(t){let e=Vt(t,5,8,!1);if(Array.isArray(e))return e}function ge(t){let e=Vt(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function Kt(t){let e;t==="bech32"?e=1:e=734539939;function r(a,i,s){if(s=s||90,a.length+7+i.length>s)throw new TypeError("Exceeds length limit");a=a.toLowerCase();let p=$t(a);if(typeof p=="string")throw new Error(p);let _=a+"1";for(let l=0;l<i.length;++l){let d=i[l];if(d>>5!==0)throw new Error("Non 5-bit word");p=P(p)^d,_+=J.charAt(d)}for(let l=0;l<6;++l)p=P(p);p^=e;for(let l=0;l<6;++l){let d=p>>(5-l)*5&31;_+=J.charAt(d)}return _}function n(a,i){if(i=i||90,a.length<8)return a+" too short";if(a.length>i)return"Exceeds length limit";let s=a.toLowerCase(),p=a.toUpperCase();if(a!==s&&a!==p)return"Mixed-case string "+a;a=s;let _=a.lastIndexOf("1");if(_===-1)return"No separator character for "+a;if(_===0)return"Missing prefix for "+a;let l=a.slice(0,_),d=a.slice(_+1);if(d.length<6)return"Data too short";let u=$t(l);if(typeof u=="string")return u;let f=[];for(let h=0;h<d.length;++h){let x=d.charAt(h),m=jt[x];if(m===void 0)return"Unknown character "+x;u=P(u)^m,!(h+6>=d.length)&&f.push(m)}return u!==e?"Invalid checksum for "+a:{prefix:l,words:f}}function o(a,i){let s=n(a,i);if(typeof s=="object")return s}function c(a,i){let s=n(a,i);if(typeof s=="object")return s;throw new Error(s)}return{decodeUnsafe:o,decode:c,encode:r,toWords:be,fromWordsUnsafe:Ne,fromWords:ge}}T.bech32=Kt("bech32");T.bech32m=Kt("bech32m")});import{Canister as ae,createServices as ce}from"@dfinity/utils";var Bt=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),r=t.Record({get_current_fee_percentiles:t.Nat,get_utxos_maximum:t.Nat,get_block_headers_cycles_per_ten_instructions:t.Nat,get_current_fee_percentiles_maximum:t.Nat,send_transaction_per_byte:t.Nat,get_balance:t.Nat,get_utxos_cycles_per_ten_instructions:t.Nat,get_block_headers_base:t.Nat,get_utxos_base:t.Nat,get_balance_maximum:t.Nat,send_transaction_base:t.Nat,get_block_headers_maximum:t.Nat}),n=t.Variant({mainnet:t.Null,regtest:t.Null,testnet:t.Null}),o=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),network:t.Opt(n),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)}),c=t.Text,a=t.Record({network:n,address:c,min_confirmations:t.Opt(t.Nat32)}),i=t.Nat64,s=t.Nat32,p=t.Record({start_height:s,end_height:t.Opt(s),network:n}),_=t.Vec(t.Nat8),l=t.Record({tip_height:s,block_headers:t.Vec(_)}),d=t.Record({network:n}),u=t.Nat64,f=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),h=t.Vec(t.Nat8),x=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),m=t.Record({height:s,value:i,outpoint:x}),g=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:h,utxos:t.Vec(m)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),O=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:r,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),v=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)});return t.Service({bitcoin_get_balance:t.Func([a],[i],[]),bitcoin_get_balance_query:t.Func([a],[i],[]),bitcoin_get_block_headers:t.Func([p],[l],[]),bitcoin_get_current_fee_percentiles:t.Func([d],[t.Vec(u)],[]),bitcoin_get_utxos:t.Func([f],[g],[]),bitcoin_get_utxos_query:t.Func([f],[g],[]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[O],[]),set_config:t.Func([v],[],[])})};var Pt=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),r=t.Record({get_current_fee_percentiles:t.Nat,get_utxos_maximum:t.Nat,get_block_headers_cycles_per_ten_instructions:t.Nat,get_current_fee_percentiles_maximum:t.Nat,send_transaction_per_byte:t.Nat,get_balance:t.Nat,get_utxos_cycles_per_ten_instructions:t.Nat,get_block_headers_base:t.Nat,get_utxos_base:t.Nat,get_balance_maximum:t.Nat,send_transaction_base:t.Nat,get_block_headers_maximum:t.Nat}),n=t.Variant({mainnet:t.Null,regtest:t.Null,testnet:t.Null}),o=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),network:t.Opt(n),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)}),c=t.Text,a=t.Record({network:n,address:c,min_confirmations:t.Opt(t.Nat32)}),i=t.Nat64,s=t.Nat32,p=t.Record({start_height:s,end_height:t.Opt(s),network:n}),_=t.Vec(t.Nat8),l=t.Record({tip_height:s,block_headers:t.Vec(_)}),d=t.Record({network:n}),u=t.Nat64,f=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),h=t.Vec(t.Nat8),x=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),m=t.Record({height:s,value:i,outpoint:x}),g=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:h,utxos:t.Vec(m)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),O=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:r,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),v=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)});return t.Service({bitcoin_get_balance:t.Func([a],[i],[]),bitcoin_get_balance_query:t.Func([a],[i],["query"]),bitcoin_get_block_headers:t.Func([p],[l],[]),bitcoin_get_current_fee_percentiles:t.Func([d],[t.Vec(u)],[]),bitcoin_get_utxos:t.Func([f],[g],[]),bitcoin_get_utxos_query:t.Func([f],[g],["query"]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[O],["query"]),set_config:t.Func([v],[],[])})};import{nonNullish as ne,toNullable as lt}from"@dfinity/utils";var oe={mainnet:{mainnet:null},testnet:{testnet:null},regtest:{regtest:null}},Tt=({network:t,filter:e,...r})=>({filter:ne(e)?lt("minConfirmations"in e?{min_confirmations:e.minConfirmations}:{page:e.page}):lt(),network:t==="testnet"?{testnet:null}:{mainnet:null},...r}),Ut=({network:t,minConfirmations:e,...r})=>({min_confirmations:lt(e),network:oe[t],...r});var ut=class t extends ae{static create(e){let{service:r,certifiedService:n,canisterId:o}=ce({options:e,idlFactory:Pt,certifiedIdlFactory:Bt});return new t(o,r,n)}getUtxosQuery=({...e})=>{let{bitcoin_get_utxos_query:r}=this.caller({certified:!1});return r(Tt(e))};getBalanceQuery=({...e})=>{let{bitcoin_get_balance_query:r}=this.caller({certified:!1});return r(Ut(e))}};var Ft=(n=>(n[n.Mainnet=0]="Mainnet",n[n.Regtest=1]="Regtest",n[n.Testnet=2]="Testnet",n))(Ft||{}),Et=(c=>(c[c.P2wpkhV0=0]="P2wpkhV0",c[c.P2pkh=1]="P2pkh",c[c.P2sh=2]="P2sh",c[c.P2wsh=3]="P2wsh",c[c.P2tr=4]="P2tr",c))(Et||{});var N=class extends Error{},E=class extends N{},q=class extends N{},S=class extends N{},G=class extends N{},W=class extends N{},M=class extends N{},B=class extends N{},z=class extends N{};import{fromNullable as ie,nonNullish as bt}from"@dfinity/utils";var V=class extends Error{},dt=class extends V{},_t=class extends V{},Q=class extends V{},pt=class extends Q{pendingUtxos;requiredConfirmations;constructor({pending_utxos:e,required_confirmations:r}){super(),this.pendingUtxos=ie(e)??[],this.requiredConfirmations=r}},A=class extends V{},ft=class extends A{},ht=class extends A{},xt=class extends A{},mt=class extends A{},Nt=t=>{if("GenericError"in t){let{GenericError:{error_message:e,error_code:r}}=t;return new V(`${e} (${r})`)}if("TemporarilyUnavailable"in t)return new dt(t.TemporarilyUnavailable);if("AlreadyProcessing"in t)return new _t},St=t=>{let e=Nt(t);return bt(e)?e:"NoNewUtxos"in t?new pt(t.NoNewUtxos):new Q(`Unsupported response type in minter.updateBalance ${JSON.stringify(t)}`)},gt=t=>{let e=Nt(t);return bt(e)?e:"MalformedAddress"in t?new ft(t.MalformedAddress):"AmountTooLow"in t?new ht(`${t.AmountTooLow}`):"InsufficientFunds"in t?new xt(`${t.InsufficientFunds.balance}`):new A(`Unsupported response type in minter.retrieveBtc ${JSON.stringify(t)}`)},Ct=t=>{let e=Nt(t);return bt(e)?e:"InsufficientAllowance"in t?new mt(`${t.InsufficientAllowance.allowance}`):gt(t)};import{Canister as se,createServices as le,fromNullable as ue,isNullish as de,toNullable as w}from"@dfinity/utils";var Ht=({IDL:t})=>{let e=t.Variant({RestrictedTo:t.Vec(t.Principal),DepositsRestrictedTo:t.Vec(t.Principal),ReadOnly:t.Null,GeneralAvailability:t.Null}),r=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),mode:t.Opt(e),retrieve_btc_min_amount:t.Opt(t.Nat64),max_time_in_queue_nanos:t.Opt(t.Nat64),check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),n=t.Variant({Mainnet:t.Null,Regtest:t.Null,Testnet:t.Null}),o=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),ecdsa_key_name:t.Text,mode:e,retrieve_btc_min_amount:t.Nat64,ledger_id:t.Principal,max_time_in_queue_nanos:t.Nat64,btc_network:n,check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),c=t.Variant({Upgrade:t.Opt(r),Init:o}),a=t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),i=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),s=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),p=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:s,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),_=t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),l=t.Record({memory_metrics:a,status:i,memory_size:t.Nat,cycles:t.Nat,settings:p,query_stats:_,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),d=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),u=t.Record({height:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),f=t.Variant({CallFailed:t.Null,TaintedDestination:t.Record({kyt_fee:t.Nat64,kyt_provider:t.Principal})}),h=t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64}),x=t.Variant({ValueTooSmall:t.Null,Quarantined:t.Null}),m=t.Variant({p2wsh_v0:t.Vec(t.Nat8),p2tr_v1:t.Vec(t.Nat8),p2sh:t.Vec(t.Nat8),p2wpkh_v0:t.Vec(t.Nat8),p2pkh:t.Vec(t.Nat8)}),g=t.Variant({too_many_inputs:t.Record({max_num_inputs:t.Nat64,num_inputs:t.Nat64})}),y=t.Variant({invalid_transaction:g}),O=t.Variant({to_cancel:t.Record({reason:y}),to_retry:t.Null}),v=t.Variant({received_utxos:t.Record({to_account:d,mint_txid:t.Opt(t.Nat64),utxos:t.Vec(u)}),schedule_deposit_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:f}),sent_transaction:t.Record({fee:t.Opt(t.Nat64),change_output:t.Opt(t.Record({value:t.Nat64,vout:t.Nat32})),txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(h),utxos:t.Vec(u),requests:t.Vec(t.Nat64),submitted_at:t.Nat64}),distributed_kyt_fee:t.Record({block_index:t.Nat64,amount:t.Nat64,kyt_provider:t.Principal}),init:o,upgrade:r,retrieve_btc_kyt_failed:t.Record({block_index:t.Nat64,owner:t.Principal,uuid:t.Text,address:t.Text,amount:t.Nat64,kyt_provider:t.Principal}),suspended_utxo:t.Record({utxo:u,account:d,reason:x}),accepted_retrieve_btc_request:t.Record({received_at:t.Nat64,block_index:t.Nat64,address:m,reimbursement_account:t.Opt(d),amount:t.Nat64,kyt_provider:t.Opt(t.Principal)}),checked_utxo:t.Record({clean:t.Bool,utxo:u,uuid:t.Text,kyt_provider:t.Opt(t.Principal)}),schedule_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:y}),quarantined_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64}),removed_retrieve_btc_request:t.Record({block_index:t.Nat64}),confirmed_transaction:t.Record({txid:t.Vec(t.Nat8)}),replaced_transaction:t.Record({fee:t.Nat64,change_output:t.Record({value:t.Nat64,vout:t.Nat32}),new_utxos:t.Opt(t.Vec(u)),old_txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(h),new_txid:t.Vec(t.Nat8),submitted_at:t.Nat64,reason:t.Opt(O)}),checked_utxo_v2:t.Record({utxo:u,account:d}),ignored_utxo:t.Record({utxo:u}),checked_utxo_mint_unknown:t.Record({utxo:u,account:d}),reimbursed_failed_deposit:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64}),reimbursed_withdrawal:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64})}),Y=t.Record({timestamp:t.Opt(t.Nat64),payload:v}),Z=t.Record({retrieve_btc_min_amount:t.Nat64,min_confirmations:t.Nat32,kyt_fee:t.Nat64}),I=t.Record({address:t.Text,amount:t.Nat64}),U=t.Record({block_index:t.Nat64}),L=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),D=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Pending:t.Null}),tt=t.Record({account:d,amount:t.Nat64,reason:f}),et=t.Record({account:d,mint_block_index:t.Nat64,amount:t.Nat64,reason:f}),F=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,WillReimburse:tt,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Reimbursed:et,Pending:t.Null}),rt=t.Record({from_subaccount:t.Opt(t.Vec(t.Nat8)),address:t.Text,amount:t.Nat64}),nt=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,InsufficientAllowance:t.Record({allowance:t.Nat64}),AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),ot=t.Variant({ValueTooSmall:u,Tainted:u,Minted:t.Record({minted_amount:t.Nat64,block_index:t.Nat64,utxo:u}),Checked:u}),at=t.Nat64,ct=t.Record({utxo:u,earliest_retry:at,reason:x}),it=t.Record({confirmations:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),st=t.Variant({GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,NoNewUtxos:t.Record({suspended_utxos:t.Opt(t.Vec(ct)),required_confirmations:t.Nat32,pending_utxos:t.Opt(t.Vec(it)),current_confirmations:t.Opt(t.Nat32)})});return t.Service({estimate_withdrawal_fee:t.Func([t.Record({amount:t.Opt(t.Nat64)})],[t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64})],[]),get_btc_address:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Text],[]),get_canister_status:t.Func([],[l],[]),get_deposit_fee:t.Func([],[t.Nat64],[]),get_events:t.Func([t.Record({start:t.Nat64,length:t.Nat64})],[t.Vec(Y)],[]),get_known_utxos:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Vec(u)],[]),get_minter_info:t.Func([],[Z],[]),get_withdrawal_account:t.Func([],[d],[]),retrieve_btc:t.Func([I],[t.Variant({Ok:U,Err:L})],[]),retrieve_btc_status:t.Func([t.Record({block_index:t.Nat64})],[D],[]),retrieve_btc_status_v2:t.Func([t.Record({block_index:t.Nat64})],[F],[]),retrieve_btc_status_v2_by_account:t.Func([t.Opt(d)],[t.Vec(t.Record({block_index:t.Nat64,status_v2:t.Opt(F)}))],[]),retrieve_btc_with_approval:t.Func([rt],[t.Variant({Ok:U,Err:nt})],[]),update_balance:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Variant({Ok:t.Vec(ot),Err:st})],[])})};var qt=({IDL:t})=>{let e=t.Variant({RestrictedTo:t.Vec(t.Principal),DepositsRestrictedTo:t.Vec(t.Principal),ReadOnly:t.Null,GeneralAvailability:t.Null}),r=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),mode:t.Opt(e),retrieve_btc_min_amount:t.Opt(t.Nat64),max_time_in_queue_nanos:t.Opt(t.Nat64),check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),n=t.Variant({Mainnet:t.Null,Regtest:t.Null,Testnet:t.Null}),o=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),ecdsa_key_name:t.Text,mode:e,retrieve_btc_min_amount:t.Nat64,ledger_id:t.Principal,max_time_in_queue_nanos:t.Nat64,btc_network:n,check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),c=t.Variant({Upgrade:t.Opt(r),Init:o}),a=t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),i=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),s=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),p=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:s,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),_=t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),l=t.Record({memory_metrics:a,status:i,memory_size:t.Nat,cycles:t.Nat,settings:p,query_stats:_,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),d=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),u=t.Record({height:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),f=t.Variant({CallFailed:t.Null,TaintedDestination:t.Record({kyt_fee:t.Nat64,kyt_provider:t.Principal})}),h=t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64}),x=t.Variant({ValueTooSmall:t.Null,Quarantined:t.Null}),m=t.Variant({p2wsh_v0:t.Vec(t.Nat8),p2tr_v1:t.Vec(t.Nat8),p2sh:t.Vec(t.Nat8),p2wpkh_v0:t.Vec(t.Nat8),p2pkh:t.Vec(t.Nat8)}),g=t.Variant({too_many_inputs:t.Record({max_num_inputs:t.Nat64,num_inputs:t.Nat64})}),y=t.Variant({invalid_transaction:g}),O=t.Variant({to_cancel:t.Record({reason:y}),to_retry:t.Null}),v=t.Variant({received_utxos:t.Record({to_account:d,mint_txid:t.Opt(t.Nat64),utxos:t.Vec(u)}),schedule_deposit_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:f}),sent_transaction:t.Record({fee:t.Opt(t.Nat64),change_output:t.Opt(t.Record({value:t.Nat64,vout:t.Nat32})),txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(h),utxos:t.Vec(u),requests:t.Vec(t.Nat64),submitted_at:t.Nat64}),distributed_kyt_fee:t.Record({block_index:t.Nat64,amount:t.Nat64,kyt_provider:t.Principal}),init:o,upgrade:r,retrieve_btc_kyt_failed:t.Record({block_index:t.Nat64,owner:t.Principal,uuid:t.Text,address:t.Text,amount:t.Nat64,kyt_provider:t.Principal}),suspended_utxo:t.Record({utxo:u,account:d,reason:x}),accepted_retrieve_btc_request:t.Record({received_at:t.Nat64,block_index:t.Nat64,address:m,reimbursement_account:t.Opt(d),amount:t.Nat64,kyt_provider:t.Opt(t.Principal)}),checked_utxo:t.Record({clean:t.Bool,utxo:u,uuid:t.Text,kyt_provider:t.Opt(t.Principal)}),schedule_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:y}),quarantined_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64}),removed_retrieve_btc_request:t.Record({block_index:t.Nat64}),confirmed_transaction:t.Record({txid:t.Vec(t.Nat8)}),replaced_transaction:t.Record({fee:t.Nat64,change_output:t.Record({value:t.Nat64,vout:t.Nat32}),new_utxos:t.Opt(t.Vec(u)),old_txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(h),new_txid:t.Vec(t.Nat8),submitted_at:t.Nat64,reason:t.Opt(O)}),checked_utxo_v2:t.Record({utxo:u,account:d}),ignored_utxo:t.Record({utxo:u}),checked_utxo_mint_unknown:t.Record({utxo:u,account:d}),reimbursed_failed_deposit:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64}),reimbursed_withdrawal:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64})}),Y=t.Record({timestamp:t.Opt(t.Nat64),payload:v}),Z=t.Record({retrieve_btc_min_amount:t.Nat64,min_confirmations:t.Nat32,kyt_fee:t.Nat64}),I=t.Record({address:t.Text,amount:t.Nat64}),U=t.Record({block_index:t.Nat64}),L=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),D=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Pending:t.Null}),tt=t.Record({account:d,amount:t.Nat64,reason:f}),et=t.Record({account:d,mint_block_index:t.Nat64,amount:t.Nat64,reason:f}),F=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,WillReimburse:tt,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Reimbursed:et,Pending:t.Null}),rt=t.Record({from_subaccount:t.Opt(t.Vec(t.Nat8)),address:t.Text,amount:t.Nat64}),nt=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,InsufficientAllowance:t.Record({allowance:t.Nat64}),AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),ot=t.Variant({ValueTooSmall:u,Tainted:u,Minted:t.Record({minted_amount:t.Nat64,block_index:t.Nat64,utxo:u}),Checked:u}),at=t.Nat64,ct=t.Record({utxo:u,earliest_retry:at,reason:x}),it=t.Record({confirmations:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),st=t.Variant({GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,NoNewUtxos:t.Record({suspended_utxos:t.Opt(t.Vec(ct)),required_confirmations:t.Nat32,pending_utxos:t.Opt(t.Vec(it)),current_confirmations:t.Opt(t.Nat32)})});return t.Service({estimate_withdrawal_fee:t.Func([t.Record({amount:t.Opt(t.Nat64)})],[t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64})],["query"]),get_btc_address:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Text],[]),get_canister_status:t.Func([],[l],[]),get_deposit_fee:t.Func([],[t.Nat64],["query"]),get_events:t.Func([t.Record({start:t.Nat64,length:t.Nat64})],[t.Vec(Y)],["query"]),get_known_utxos:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Vec(u)],["query"]),get_minter_info:t.Func([],[Z],["query"]),get_withdrawal_account:t.Func([],[d],[]),retrieve_btc:t.Func([I],[t.Variant({Ok:U,Err:L})],[]),retrieve_btc_status:t.Func([t.Record({block_index:t.Nat64})],[D],["query"]),retrieve_btc_status_v2:t.Func([t.Record({block_index:t.Nat64})],[F],["query"]),retrieve_btc_status_v2_by_account:t.Func([t.Opt(d)],[t.Vec(t.Record({block_index:t.Nat64,status_v2:t.Opt(F)}))],["query"]),retrieve_btc_with_approval:t.Func([rt],[t.Variant({Ok:U,Err:nt})],[]),update_balance:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Variant({Ok:t.Vec(ot),Err:st})],[])})};var yt=class t extends se{static create(e){let{service:r,certifiedService:n,canisterId:o}=le({options:e,idlFactory:qt,certifiedIdlFactory:Ht});return new t(o,r,n)}getBtcAddress=({owner:e,subaccount:r})=>this.caller({certified:!0}).get_btc_address({owner:w(e),subaccount:w(r)});updateBalance=async({owner:e,subaccount:r})=>{let n=await this.caller({certified:!0}).update_balance({owner:w(e),subaccount:w(r)});if("Err"in n)throw St(n.Err);return n.Ok};getWithdrawalAccount=()=>this.caller({certified:!0}).get_withdrawal_account();retrieveBtc=async e=>{let r=await this.caller({certified:!0}).retrieve_btc(e);if("Err"in r)throw gt(r.Err);return r.Ok};retrieveBtcWithApproval=async({address:e,amount:r,fromSubaccount:n})=>{let o=await this.caller({certified:!0}).retrieve_btc_with_approval({address:e,amount:r,from_subaccount:w(n)});if("Err"in o)throw Ct(o.Err);return o.Ok};retrieveBtcStatus=({transactionId:e,certified:r})=>this.caller({certified:r}).retrieve_btc_status({block_index:e});retrieveBtcStatusV2ByAccount=async({account:e,certified:r})=>{let{retrieve_btc_status_v2_by_account:n}=this.caller({certified:r});return(await n(de(e)?[]:[{owner:e.owner,subaccount:w(e.subaccount)}])).map(({block_index:c,status_v2:a})=>({id:c,status:ue(a)}))};estimateWithdrawalFee=({certified:e,amount:r})=>this.caller({certified:e}).estimate_withdrawal_fee({amount:w(r)});getMinterInfo=({certified:e})=>this.caller({certified:e}).get_minter_info();getKnownUtxos=({owner:e,subaccount:r,certified:n})=>{let{get_known_utxos:o}=this.caller({certified:n});return o({owner:w(e),subaccount:w(r)})}};import{isNullish as Jt}from"@dfinity/utils";function _e(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function j(t,...e){if(!_e(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function wt(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Gt(t,e){j(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function C(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function K(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function b(t,e){return t<<32-e|t>>>e}function pe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Rt(t){return typeof t=="string"&&(t=pe(t)),j(t),t}var $=class{};function Wt(t){let e=n=>t().update(Rt(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function fe(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let o=BigInt(32),c=BigInt(4294967295),a=Number(r>>o&c),i=Number(r&c),s=n?4:0,p=n?0:4;t.setUint32(e+s,a,n),t.setUint32(e+p,i,n)}function Mt(t,e,r){return t&e^~t&r}function zt(t,e,r){return t&e^t&r^e&r}var X=class extends ${constructor(e,r,n,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(e),this.view=K(this.buffer)}update(e){wt(this),e=Rt(e),j(e);let{view:r,buffer:n,blockLen:o}=this,c=e.length;for(let a=0;a<c;){let i=Math.min(o-this.pos,c-a);if(i===o){let s=K(e);for(;o<=c-a;a+=o)this.process(s,a);continue}n.set(e.subarray(a,a+i),this.pos),this.pos+=i,a+=i,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){wt(this),Gt(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:c}=this,{pos:a}=this;r[a++]=128,C(this.buffer.subarray(a)),this.padOffset>o-a&&(this.process(n,0),a=0);for(let l=a;l<o;l++)r[l]=0;fe(n,o-8,BigInt(this.length*8),c),this.process(n,0);let i=K(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let p=s/4,_=this.get();if(p>_.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<p;l++)i.setUint32(4*l,_[l],c)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:c,destroyed:a,pos:i}=this;return e.destroyed=a,e.finished=c,e.length=o,e.pos=i,o%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},R=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var he=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),k=new Uint32Array(64),kt=class extends X{constructor(e=32){super(64,e,8,!1),this.A=R[0]|0,this.B=R[1]|0,this.C=R[2]|0,this.D=R[3]|0,this.E=R[4]|0,this.F=R[5]|0,this.G=R[6]|0,this.H=R[7]|0}get(){let{A:e,B:r,C:n,D:o,E:c,F:a,G:i,H:s}=this;return[e,r,n,o,c,a,i,s]}set(e,r,n,o,c,a,i,s){this.A=e|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=c|0,this.F=a|0,this.G=i|0,this.H=s|0}process(e,r){for(let l=0;l<16;l++,r+=4)k[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let d=k[l-15],u=k[l-2],f=b(d,7)^b(d,18)^d>>>3,h=b(u,17)^b(u,19)^u>>>10;k[l]=h+k[l-7]+f+k[l-16]|0}let{A:n,B:o,C:c,D:a,E:i,F:s,G:p,H:_}=this;for(let l=0;l<64;l++){let d=b(i,6)^b(i,11)^b(i,25),u=_+d+Mt(i,s,p)+he[l]+k[l]|0,h=(b(n,2)^b(n,13)^b(n,22))+zt(n,o,c)|0;_=p,p=s,s=i,i=a+u|0,a=c,c=o,o=n,n=u+h|0}n=n+this.A|0,o=o+this.B|0,c=c+this.C|0,a=a+this.D|0,i=i+this.E|0,s=s+this.F|0,p=p+this.G|0,_=_+this.H|0,this.set(n,o,c,a,i,s,p,_)}roundClean(){C(k)}destroy(){this.set(0,0,0,0,0,0,0,0),C(this.buffer)}};var Ot=Wt(()=>new kt);var xe="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Qt=xe;function me(t){if(!t||typeof t!="string")throw new Error(`Expected base58 string but got \u201C${t}\u201D`);if(t.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character \u201C${t.match(/[IOl0]/gmu)}\u201D`);let e=t.match(/^1+/gmu),r=e?e[0].length:0,n=(t.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...t.match(/.{1}/gmu).map(o=>Qt.indexOf(o)).reduce((o,c)=>(o=o.map(a=>{let i=a*58+c;return c=i>>8,i}),o),new Uint8Array(n)).reverse().filter((o=>c=>o=o||c)(!1))])}var vt=me;var H=re(Xt(),1);var ye=0,we=5,Re=111,ke=196,Oe={[ye]:{type:1,networks:[0]},[Re]:{type:1,networks:[2,1]},[we]:{type:2,networks:[0]},[ke]:{type:2,networks:[2,1]}},ve=({address:t,network:e})=>{let n=(_=>{try{return vt(_)}catch{throw new E}})(t),{length:o}=n;if(o!==25)throw new B(`Expected the address to be 25 bytes, got ${o}.`);(_=>{let l=_.slice(o-4,o),d=_.slice(0,o-4),u=Ot.create();u.update(d);let f=Ot.create();f.update(u.digest());let h=f.digest().slice(0,4);if(l.some((x,m)=>x!==h[m]))throw new B(`Checksum mismatch expected ${l}, got ${h}.`)})(n);let[a]=n,i=Oe[a];if(Jt(i))throw new S;let{type:s,networks:p}=i;if(!p.includes(e))throw new z;return{address:t,network:e,type:s,parser:"base58"}},Ve=({address:t,network:e})=>{let r=_=>{try{return _.startsWith("bc1p")||_.startsWith("tb1p")||_.startsWith("bcrt1p")?H.bech32m.decode(_):H.bech32.decode(_)}catch{throw new B}},{prefix:n,words:o}=r(t),a={bc:0,tb:2,bcrt:1}[n];if(Jt(a))throw new E;if(a!==e)throw new M;let[i,...s]=o;if(i>1)throw new W;switch(H.bech32.fromWords(s).length){case 20:return{address:t,network:e,type:0,parser:"bip-173"};case 32:return{address:t,network:e,type:i===0?3:4,parser:"bip-173"};default:throw new G}},hr=({address:t,network:e=0})=>{switch(t.charAt(0)){case"1":case"2":case"3":case"m":case"n":return ve({address:t,network:e});case"b":case"B":case"t":case"T":return Ve({address:t,network:e});case"":throw new q;default:throw new S}};export{ut as BitcoinCanister,Et as BtcAddressType,Ft as BtcNetwork,yt as CkBTCMinterCanister,_t as MinterAlreadyProcessingError,ht as MinterAmountTooLowError,V as MinterGenericError,mt as MinterInsufficientAllowanceError,xt as MinterInsufficientFundsError,ft as MinterMalformedAddressError,pt as MinterNoNewUtxosError,A as MinterRetrieveBtcError,dt as MinterTemporaryUnavailableError,Q as MinterUpdateBalanceError,G as ParseBtcAddressBadWitnessLengthError,N as ParseBtcAddressError,E as ParseBtcAddressInvalidError,B as ParseBtcAddressMalformedAddressError,q as ParseBtcAddressNoDataError,M as ParseBtcAddressUnexpectedHumanReadablePartError,S as ParseBtcAddressUnsupportedAddressTypeError,W as ParseBtcAddressUnsupportedWitnessVersionError,z as ParseBtcAddressWrongNetworkError,gt as createRetrieveBtcError,Ct as createRetrieveBtcWithApprovalError,St as createUpdateBalanceError,hr as parseBtcAddress,Ut as toGetBalanceParams,Tt as toGetUtxosParams};
|
|
1
|
+
var Zt=Object.create;var Bt=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Lt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ee=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Lt(e))!te.call(t,o)&&o!==r&&Bt(t,o,{get:()=>e[o],enumerable:!(n=It(e,o))||n.enumerable});return t};var ne=(t,e,r)=>(r=t!=null?Zt(Dt(t)):{},re(e||!t||!t.__esModule?Bt(r,"default",{value:t,enumerable:!0}):r,t));var Jt=ee(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.bech32m=T.bech32=void 0;var J="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Kt={};for(let t=0;t<J.length;t++){let e=J.charAt(t);Kt[e]=t}function P(t){let e=t>>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function jt(t){let e=1;for(let r=0;r<t.length;++r){let n=t.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+t+")";e=P(e)^n>>5}e=P(e);for(let r=0;r<t.length;++r){let n=t.charCodeAt(r);e=P(e)^n&31}return e}function At(t,e,r,n){let o=0,c=0,a=(1<<r)-1,i=[];for(let s=0;s<t.length;++s)for(o=o<<e|t[s],c+=e;c>=r;)c-=r,i.push(o>>c&a);if(n)c>0&&i.push(o<<r-c&a);else{if(c>=e)return"Excess padding";if(o<<r-c&a)return"Non-zero padding"}return i}function Ne(t){return At(t,8,5,!0)}function ge(t){let e=At(t,5,8,!1);if(Array.isArray(e))return e}function ye(t){let e=At(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function Xt(t){let e;t==="bech32"?e=1:e=734539939;function r(a,i,s){if(s=s||90,a.length+7+i.length>s)throw new TypeError("Exceeds length limit");a=a.toLowerCase();let p=jt(a);if(typeof p=="string")throw new Error(p);let _=a+"1";for(let l=0;l<i.length;++l){let f=i[l];if(f>>5!==0)throw new Error("Non 5-bit word");p=P(p)^f,_+=J.charAt(f)}for(let l=0;l<6;++l)p=P(p);p^=e;for(let l=0;l<6;++l){let f=p>>(5-l)*5&31;_+=J.charAt(f)}return _}function n(a,i){if(i=i||90,a.length<8)return a+" too short";if(a.length>i)return"Exceeds length limit";let s=a.toLowerCase(),p=a.toUpperCase();if(a!==s&&a!==p)return"Mixed-case string "+a;a=s;let _=a.lastIndexOf("1");if(_===-1)return"No separator character for "+a;if(_===0)return"Missing prefix for "+a;let l=a.slice(0,_),f=a.slice(_+1);if(f.length<6)return"Data too short";let d=jt(l);if(typeof d=="string")return d;let u=[];for(let h=0;h<f.length;++h){let m=f.charAt(h),x=Kt[m];if(x===void 0)return"Unknown character "+m;d=P(d)^x,!(h+6>=f.length)&&u.push(x)}return d!==e?"Invalid checksum for "+a:{prefix:l,words:u}}function o(a,i){let s=n(a,i);if(typeof s=="object")return s}function c(a,i){let s=n(a,i);if(typeof s=="object")return s;throw new Error(s)}return{decodeUnsafe:o,decode:c,encode:r,toWords:Ne,fromWordsUnsafe:ge,fromWords:ye}}T.bech32=Xt("bech32");T.bech32m=Xt("bech32m")});import{Canister as ce,createServices as ie}from"@dfinity/utils";var Pt=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),r=t.Record({get_current_fee_percentiles:t.Nat,get_utxos_maximum:t.Nat,get_block_headers_cycles_per_ten_instructions:t.Nat,get_current_fee_percentiles_maximum:t.Nat,send_transaction_per_byte:t.Nat,get_balance:t.Nat,get_utxos_cycles_per_ten_instructions:t.Nat,get_block_headers_base:t.Nat,get_utxos_base:t.Nat,get_balance_maximum:t.Nat,send_transaction_base:t.Nat,get_block_headers_maximum:t.Nat}),n=t.Variant({mainnet:t.Null,regtest:t.Null,testnet:t.Null}),o=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),network:t.Opt(n),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)}),c=t.Text,a=t.Record({network:n,address:c,min_confirmations:t.Opt(t.Nat32)}),i=t.Nat64,s=t.Nat32,p=t.Record({start_height:s,end_height:t.Opt(s),network:n}),_=t.Vec(t.Nat8),l=t.Record({tip_height:s,block_headers:t.Vec(_)}),f=t.Record({network:n}),d=t.Nat64,u=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),h=t.Vec(t.Nat8),m=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),x=t.Record({height:s,value:i,outpoint:m}),g=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:h,utxos:t.Vec(x)}),O=t.Record({transaction:t.Vec(t.Nat8),network:n}),y=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:r,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),v=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)});return t.Service({bitcoin_get_balance:t.Func([a],[i],[]),bitcoin_get_balance_query:t.Func([a],[i],[]),bitcoin_get_block_headers:t.Func([p],[l],[]),bitcoin_get_current_fee_percentiles:t.Func([f],[t.Vec(d)],[]),bitcoin_get_utxos:t.Func([u],[g],[]),bitcoin_get_utxos_query:t.Func([u],[g],[]),bitcoin_send_transaction:t.Func([O],[],[]),get_config:t.Func([],[y],[]),set_config:t.Func([v],[],[])})};var Tt=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),r=t.Record({get_current_fee_percentiles:t.Nat,get_utxos_maximum:t.Nat,get_block_headers_cycles_per_ten_instructions:t.Nat,get_current_fee_percentiles_maximum:t.Nat,send_transaction_per_byte:t.Nat,get_balance:t.Nat,get_utxos_cycles_per_ten_instructions:t.Nat,get_block_headers_base:t.Nat,get_utxos_base:t.Nat,get_balance_maximum:t.Nat,send_transaction_base:t.Nat,get_block_headers_maximum:t.Nat}),n=t.Variant({mainnet:t.Null,regtest:t.Null,testnet:t.Null}),o=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),network:t.Opt(n),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)}),c=t.Text,a=t.Record({network:n,address:c,min_confirmations:t.Opt(t.Nat32)}),i=t.Nat64,s=t.Nat32,p=t.Record({start_height:s,end_height:t.Opt(s),network:n}),_=t.Vec(t.Nat8),l=t.Record({tip_height:s,block_headers:t.Vec(_)}),f=t.Record({network:n}),d=t.Nat64,u=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),h=t.Vec(t.Nat8),m=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),x=t.Record({height:s,value:i,outpoint:m}),g=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:h,utxos:t.Vec(x)}),O=t.Record({transaction:t.Vec(t.Nat8),network:n}),y=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:r,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),v=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(r),watchdog_canister:t.Opt(t.Opt(t.Principal)),stability_threshold:t.Opt(t.Nat),syncing:t.Opt(e),burn_cycles:t.Opt(e),disable_api_if_not_fully_synced:t.Opt(e)});return t.Service({bitcoin_get_balance:t.Func([a],[i],[]),bitcoin_get_balance_query:t.Func([a],[i],["query"]),bitcoin_get_block_headers:t.Func([p],[l],[]),bitcoin_get_current_fee_percentiles:t.Func([f],[t.Vec(d)],[]),bitcoin_get_utxos:t.Func([u],[g],[]),bitcoin_get_utxos_query:t.Func([u],[g],["query"]),bitcoin_send_transaction:t.Func([O],[],[]),get_config:t.Func([],[y],["query"]),set_config:t.Func([v],[],[])})};import{nonNullish as oe,toNullable as ut}from"@dfinity/utils";var ae={mainnet:{mainnet:null},testnet:{testnet:null},regtest:{regtest:null}},Ut=({network:t,filter:e,...r})=>({filter:oe(e)?ut("minConfirmations"in e?{min_confirmations:e.minConfirmations}:{page:e.page}):ut(),network:t==="testnet"?{testnet:null}:{mainnet:null},...r}),Ft=({network:t,minConfirmations:e,...r})=>({min_confirmations:ut(e),network:ae[t],...r});var dt=class t extends ce{static create(e){let{service:r,certifiedService:n,canisterId:o}=ie({options:e,idlFactory:Tt,certifiedIdlFactory:Pt});return new t(o,r,n)}getUtxosQuery=({...e})=>{let{bitcoin_get_utxos_query:r}=this.caller({certified:!1});return r(Ut(e))};getBalanceQuery=({...e})=>{let{bitcoin_get_balance_query:r}=this.caller({certified:!1});return r(Ft(e))}};var Et=(n=>(n[n.Mainnet=0]="Mainnet",n[n.Regtest=1]="Regtest",n[n.Testnet=2]="Testnet",n))(Et||{}),St=(c=>(c[c.P2wpkhV0=0]="P2wpkhV0",c[c.P2pkh=1]="P2pkh",c[c.P2sh=2]="P2sh",c[c.P2wsh=3]="P2wsh",c[c.P2tr=4]="P2tr",c))(St||{});var N=class extends Error{},E=class extends N{},q=class extends N{},S=class extends N{},G=class extends N{},W=class extends N{},M=class extends N{},B=class extends N{},z=class extends N{};import{fromNullable as se,nonNullish as Nt}from"@dfinity/utils";var V=class extends Error{},_t=class extends V{},pt=class extends V{},Q=class extends V{},ft=class extends Q{pendingUtxos;requiredConfirmations;constructor({pending_utxos:e,required_confirmations:r}){super(),this.pendingUtxos=se(e)??[],this.requiredConfirmations=r}},A=class extends V{},ht=class extends A{},xt=class extends A{},mt=class extends A{},bt=class extends A{},gt=t=>{if("GenericError"in t){let{GenericError:{error_message:e,error_code:r}}=t;return new V(`${e} (${r})`)}if("TemporarilyUnavailable"in t)return new _t(t.TemporarilyUnavailable);if("AlreadyProcessing"in t)return new pt},Ct=t=>{let e=gt(t);return Nt(e)?e:"NoNewUtxos"in t?new ft(t.NoNewUtxos):new Q(`Unsupported response type in minter.updateBalance ${JSON.stringify(t)}`)},yt=t=>{let e=gt(t);return Nt(e)?e:"MalformedAddress"in t?new ht(t.MalformedAddress):"AmountTooLow"in t?new xt(`${t.AmountTooLow}`):"InsufficientFunds"in t?new mt(`${t.InsufficientFunds.balance}`):new A(`Unsupported response type in minter.retrieveBtc ${JSON.stringify(t)}`)},Ht=t=>{let e=gt(t);return Nt(e)?e:"InsufficientAllowance"in t?new bt(`${t.InsufficientAllowance.allowance}`):yt(t)};import{Canister as le,createServices as ue,fromNullable as de,isNullish as _e,toNullable as w}from"@dfinity/utils";var qt=({IDL:t})=>{let e=t.Variant({RestrictedTo:t.Vec(t.Principal),DepositsRestrictedTo:t.Vec(t.Principal),ReadOnly:t.Null,GeneralAvailability:t.Null}),r=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),mode:t.Opt(e),retrieve_btc_min_amount:t.Opt(t.Nat64),max_time_in_queue_nanos:t.Opt(t.Nat64),check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),n=t.Variant({Mainnet:t.Null,Regtest:t.Null,Testnet:t.Null}),o=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),ecdsa_key_name:t.Text,mode:e,retrieve_btc_min_amount:t.Nat64,ledger_id:t.Principal,max_time_in_queue_nanos:t.Nat64,btc_network:n,check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),c=t.Variant({Upgrade:t.Opt(r),Init:o}),a=t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),i=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),s=t.Record({value:t.Text,name:t.Text}),p=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),_=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,environment_variables:t.Vec(s),controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:p,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),l=t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),f=t.Record({memory_metrics:a,status:i,memory_size:t.Nat,ready_for_migration:t.Bool,version:t.Nat64,cycles:t.Nat,settings:_,query_stats:l,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),d=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),u=t.Record({height:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),h=t.Variant({CallFailed:t.Null,TaintedDestination:t.Record({kyt_fee:t.Nat64,kyt_provider:t.Principal})}),m=t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64}),x=t.Variant({ValueTooSmall:t.Null,Quarantined:t.Null}),g=t.Variant({p2wsh_v0:t.Vec(t.Nat8),p2tr_v1:t.Vec(t.Nat8),p2sh:t.Vec(t.Nat8),p2wpkh_v0:t.Vec(t.Nat8),p2pkh:t.Vec(t.Nat8)}),O=t.Variant({too_many_inputs:t.Record({max_num_inputs:t.Nat64,num_inputs:t.Nat64})}),y=t.Variant({invalid_transaction:O}),v=t.Variant({to_cancel:t.Record({reason:y}),to_retry:t.Null}),Y=t.Variant({received_utxos:t.Record({to_account:d,mint_txid:t.Opt(t.Nat64),utxos:t.Vec(u)}),schedule_deposit_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:h}),sent_transaction:t.Record({fee:t.Opt(t.Nat64),change_output:t.Opt(t.Record({value:t.Nat64,vout:t.Nat32})),txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(m),utxos:t.Vec(u),requests:t.Vec(t.Nat64),submitted_at:t.Nat64}),distributed_kyt_fee:t.Record({block_index:t.Nat64,amount:t.Nat64,kyt_provider:t.Principal}),init:o,upgrade:r,retrieve_btc_kyt_failed:t.Record({block_index:t.Nat64,owner:t.Principal,uuid:t.Text,address:t.Text,amount:t.Nat64,kyt_provider:t.Principal}),suspended_utxo:t.Record({utxo:u,account:d,reason:x}),accepted_retrieve_btc_request:t.Record({received_at:t.Nat64,block_index:t.Nat64,address:g,reimbursement_account:t.Opt(d),amount:t.Nat64,kyt_provider:t.Opt(t.Principal)}),checked_utxo:t.Record({clean:t.Bool,utxo:u,uuid:t.Text,kyt_provider:t.Opt(t.Principal)}),schedule_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:y}),quarantined_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64}),removed_retrieve_btc_request:t.Record({block_index:t.Nat64}),confirmed_transaction:t.Record({txid:t.Vec(t.Nat8)}),replaced_transaction:t.Record({fee:t.Nat64,change_output:t.Record({value:t.Nat64,vout:t.Nat32}),new_utxos:t.Opt(t.Vec(u)),old_txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(m),new_txid:t.Vec(t.Nat8),submitted_at:t.Nat64,reason:t.Opt(v)}),checked_utxo_v2:t.Record({utxo:u,account:d}),ignored_utxo:t.Record({utxo:u}),checked_utxo_mint_unknown:t.Record({utxo:u,account:d}),reimbursed_failed_deposit:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64}),reimbursed_withdrawal:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64})}),Z=t.Record({timestamp:t.Opt(t.Nat64),payload:Y}),I=t.Record({retrieve_btc_min_amount:t.Nat64,min_confirmations:t.Nat32,kyt_fee:t.Nat64}),L=t.Record({address:t.Text,amount:t.Nat64}),U=t.Record({block_index:t.Nat64}),D=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),tt=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Pending:t.Null}),et=t.Record({account:d,amount:t.Nat64,reason:h}),rt=t.Record({account:d,mint_block_index:t.Nat64,amount:t.Nat64,reason:h}),F=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,WillReimburse:et,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Reimbursed:rt,Pending:t.Null}),nt=t.Record({from_subaccount:t.Opt(t.Vec(t.Nat8)),address:t.Text,amount:t.Nat64}),ot=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,InsufficientAllowance:t.Record({allowance:t.Nat64}),AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),at=t.Variant({ValueTooSmall:u,Tainted:u,Minted:t.Record({minted_amount:t.Nat64,block_index:t.Nat64,utxo:u}),Checked:u}),ct=t.Nat64,it=t.Record({utxo:u,earliest_retry:ct,reason:x}),st=t.Record({confirmations:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),lt=t.Variant({GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,NoNewUtxos:t.Record({suspended_utxos:t.Opt(t.Vec(it)),required_confirmations:t.Nat32,pending_utxos:t.Opt(t.Vec(st)),current_confirmations:t.Opt(t.Nat32)})});return t.Service({estimate_withdrawal_fee:t.Func([t.Record({amount:t.Opt(t.Nat64)})],[t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64})],[]),get_btc_address:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Text],[]),get_canister_status:t.Func([],[f],[]),get_deposit_fee:t.Func([],[t.Nat64],[]),get_events:t.Func([t.Record({start:t.Nat64,length:t.Nat64})],[t.Vec(Z)],[]),get_known_utxos:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Vec(u)],[]),get_minter_info:t.Func([],[I],[]),get_withdrawal_account:t.Func([],[d],[]),retrieve_btc:t.Func([L],[t.Variant({Ok:U,Err:D})],[]),retrieve_btc_status:t.Func([t.Record({block_index:t.Nat64})],[tt],[]),retrieve_btc_status_v2:t.Func([t.Record({block_index:t.Nat64})],[F],[]),retrieve_btc_status_v2_by_account:t.Func([t.Opt(d)],[t.Vec(t.Record({block_index:t.Nat64,status_v2:t.Opt(F)}))],[]),retrieve_btc_with_approval:t.Func([nt],[t.Variant({Ok:U,Err:ot})],[]),update_balance:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Variant({Ok:t.Vec(at),Err:lt})],[])})};var Gt=({IDL:t})=>{let e=t.Variant({RestrictedTo:t.Vec(t.Principal),DepositsRestrictedTo:t.Vec(t.Principal),ReadOnly:t.Null,GeneralAvailability:t.Null}),r=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),mode:t.Opt(e),retrieve_btc_min_amount:t.Opt(t.Nat64),max_time_in_queue_nanos:t.Opt(t.Nat64),check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),n=t.Variant({Mainnet:t.Null,Regtest:t.Null,Testnet:t.Null}),o=t.Record({get_utxos_cache_expiration_seconds:t.Opt(t.Nat64),kyt_principal:t.Opt(t.Principal),ecdsa_key_name:t.Text,mode:e,retrieve_btc_min_amount:t.Nat64,ledger_id:t.Principal,max_time_in_queue_nanos:t.Nat64,btc_network:n,check_fee:t.Opt(t.Nat64),btc_checker_principal:t.Opt(t.Principal),min_confirmations:t.Opt(t.Nat32),kyt_fee:t.Opt(t.Nat64)}),c=t.Variant({Upgrade:t.Opt(r),Init:o}),a=t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),i=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),s=t.Record({value:t.Text,name:t.Text}),p=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),_=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,environment_variables:t.Vec(s),controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:p,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),l=t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),f=t.Record({memory_metrics:a,status:i,memory_size:t.Nat,ready_for_migration:t.Bool,version:t.Nat64,cycles:t.Nat,settings:_,query_stats:l,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),d=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),u=t.Record({height:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),h=t.Variant({CallFailed:t.Null,TaintedDestination:t.Record({kyt_fee:t.Nat64,kyt_provider:t.Principal})}),m=t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64}),x=t.Variant({ValueTooSmall:t.Null,Quarantined:t.Null}),g=t.Variant({p2wsh_v0:t.Vec(t.Nat8),p2tr_v1:t.Vec(t.Nat8),p2sh:t.Vec(t.Nat8),p2wpkh_v0:t.Vec(t.Nat8),p2pkh:t.Vec(t.Nat8)}),O=t.Variant({too_many_inputs:t.Record({max_num_inputs:t.Nat64,num_inputs:t.Nat64})}),y=t.Variant({invalid_transaction:O}),v=t.Variant({to_cancel:t.Record({reason:y}),to_retry:t.Null}),Y=t.Variant({received_utxos:t.Record({to_account:d,mint_txid:t.Opt(t.Nat64),utxos:t.Vec(u)}),schedule_deposit_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:h}),sent_transaction:t.Record({fee:t.Opt(t.Nat64),change_output:t.Opt(t.Record({value:t.Nat64,vout:t.Nat32})),txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(m),utxos:t.Vec(u),requests:t.Vec(t.Nat64),submitted_at:t.Nat64}),distributed_kyt_fee:t.Record({block_index:t.Nat64,amount:t.Nat64,kyt_provider:t.Principal}),init:o,upgrade:r,retrieve_btc_kyt_failed:t.Record({block_index:t.Nat64,owner:t.Principal,uuid:t.Text,address:t.Text,amount:t.Nat64,kyt_provider:t.Principal}),suspended_utxo:t.Record({utxo:u,account:d,reason:x}),accepted_retrieve_btc_request:t.Record({received_at:t.Nat64,block_index:t.Nat64,address:g,reimbursement_account:t.Opt(d),amount:t.Nat64,kyt_provider:t.Opt(t.Principal)}),checked_utxo:t.Record({clean:t.Bool,utxo:u,uuid:t.Text,kyt_provider:t.Opt(t.Principal)}),schedule_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64,account:d,amount:t.Nat64,reason:y}),quarantined_withdrawal_reimbursement:t.Record({burn_block_index:t.Nat64}),removed_retrieve_btc_request:t.Record({block_index:t.Nat64}),confirmed_transaction:t.Record({txid:t.Vec(t.Nat8)}),replaced_transaction:t.Record({fee:t.Nat64,change_output:t.Record({value:t.Nat64,vout:t.Nat32}),new_utxos:t.Opt(t.Vec(u)),old_txid:t.Vec(t.Nat8),withdrawal_fee:t.Opt(m),new_txid:t.Vec(t.Nat8),submitted_at:t.Nat64,reason:t.Opt(v)}),checked_utxo_v2:t.Record({utxo:u,account:d}),ignored_utxo:t.Record({utxo:u}),checked_utxo_mint_unknown:t.Record({utxo:u,account:d}),reimbursed_failed_deposit:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64}),reimbursed_withdrawal:t.Record({burn_block_index:t.Nat64,mint_block_index:t.Nat64})}),Z=t.Record({timestamp:t.Opt(t.Nat64),payload:Y}),I=t.Record({retrieve_btc_min_amount:t.Nat64,min_confirmations:t.Nat32,kyt_fee:t.Nat64}),L=t.Record({address:t.Text,amount:t.Nat64}),U=t.Record({block_index:t.Nat64}),D=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),tt=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Pending:t.Null}),et=t.Record({account:d,amount:t.Nat64,reason:h}),rt=t.Record({account:d,mint_block_index:t.Nat64,amount:t.Nat64,reason:h}),F=t.Variant({Signing:t.Null,Confirmed:t.Record({txid:t.Vec(t.Nat8)}),Sending:t.Record({txid:t.Vec(t.Nat8)}),AmountTooLow:t.Null,WillReimburse:et,Unknown:t.Null,Submitted:t.Record({txid:t.Vec(t.Nat8)}),Reimbursed:rt,Pending:t.Null}),nt=t.Record({from_subaccount:t.Opt(t.Vec(t.Nat8)),address:t.Text,amount:t.Nat64}),ot=t.Variant({MalformedAddress:t.Text,GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,InsufficientAllowance:t.Record({allowance:t.Nat64}),AlreadyProcessing:t.Null,AmountTooLow:t.Nat64,InsufficientFunds:t.Record({balance:t.Nat64})}),at=t.Variant({ValueTooSmall:u,Tainted:u,Minted:t.Record({minted_amount:t.Nat64,block_index:t.Nat64,utxo:u}),Checked:u}),ct=t.Nat64,it=t.Record({utxo:u,earliest_retry:ct,reason:x}),st=t.Record({confirmations:t.Nat32,value:t.Nat64,outpoint:t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32})}),lt=t.Variant({GenericError:t.Record({error_message:t.Text,error_code:t.Nat64}),TemporarilyUnavailable:t.Text,AlreadyProcessing:t.Null,NoNewUtxos:t.Record({suspended_utxos:t.Opt(t.Vec(it)),required_confirmations:t.Nat32,pending_utxos:t.Opt(t.Vec(st)),current_confirmations:t.Opt(t.Nat32)})});return t.Service({estimate_withdrawal_fee:t.Func([t.Record({amount:t.Opt(t.Nat64)})],[t.Record({minter_fee:t.Nat64,bitcoin_fee:t.Nat64})],["query"]),get_btc_address:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Text],[]),get_canister_status:t.Func([],[f],[]),get_deposit_fee:t.Func([],[t.Nat64],["query"]),get_events:t.Func([t.Record({start:t.Nat64,length:t.Nat64})],[t.Vec(Z)],["query"]),get_known_utxos:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Vec(u)],["query"]),get_minter_info:t.Func([],[I],["query"]),get_withdrawal_account:t.Func([],[d],[]),retrieve_btc:t.Func([L],[t.Variant({Ok:U,Err:D})],[]),retrieve_btc_status:t.Func([t.Record({block_index:t.Nat64})],[tt],["query"]),retrieve_btc_status_v2:t.Func([t.Record({block_index:t.Nat64})],[F],["query"]),retrieve_btc_status_v2_by_account:t.Func([t.Opt(d)],[t.Vec(t.Record({block_index:t.Nat64,status_v2:t.Opt(F)}))],["query"]),retrieve_btc_with_approval:t.Func([nt],[t.Variant({Ok:U,Err:ot})],[]),update_balance:t.Func([t.Record({owner:t.Opt(t.Principal),subaccount:t.Opt(t.Vec(t.Nat8))})],[t.Variant({Ok:t.Vec(at),Err:lt})],[])})};var wt=class t extends le{static create(e){let{service:r,certifiedService:n,canisterId:o}=ue({options:e,idlFactory:Gt,certifiedIdlFactory:qt});return new t(o,r,n)}getBtcAddress=({owner:e,subaccount:r})=>this.caller({certified:!0}).get_btc_address({owner:w(e),subaccount:w(r)});updateBalance=async({owner:e,subaccount:r})=>{let n=await this.caller({certified:!0}).update_balance({owner:w(e),subaccount:w(r)});if("Err"in n)throw Ct(n.Err);return n.Ok};getWithdrawalAccount=()=>this.caller({certified:!0}).get_withdrawal_account();retrieveBtc=async e=>{let r=await this.caller({certified:!0}).retrieve_btc(e);if("Err"in r)throw yt(r.Err);return r.Ok};retrieveBtcWithApproval=async({address:e,amount:r,fromSubaccount:n})=>{let o=await this.caller({certified:!0}).retrieve_btc_with_approval({address:e,amount:r,from_subaccount:w(n)});if("Err"in o)throw Ht(o.Err);return o.Ok};retrieveBtcStatus=({transactionId:e,certified:r})=>this.caller({certified:r}).retrieve_btc_status({block_index:e});retrieveBtcStatusV2ByAccount=async({account:e,certified:r})=>{let{retrieve_btc_status_v2_by_account:n}=this.caller({certified:r});return(await n(_e(e)?[]:[{owner:e.owner,subaccount:w(e.subaccount)}])).map(({block_index:c,status_v2:a})=>({id:c,status:de(a)}))};estimateWithdrawalFee=({certified:e,amount:r})=>this.caller({certified:e}).estimate_withdrawal_fee({amount:w(r)});getMinterInfo=({certified:e})=>this.caller({certified:e}).get_minter_info();getKnownUtxos=({owner:e,subaccount:r,certified:n})=>{let{get_known_utxos:o}=this.caller({certified:n});return o({owner:w(e),subaccount:w(r)})}};import{isNullish as Yt}from"@dfinity/utils";function pe(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function j(t,...e){if(!pe(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Rt(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Wt(t,e){j(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function C(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function K(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function b(t,e){return t<<32-e|t>>>e}function fe(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function kt(t){return typeof t=="string"&&(t=fe(t)),j(t),t}var $=class{};function Mt(t){let e=n=>t().update(kt(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function he(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let o=BigInt(32),c=BigInt(4294967295),a=Number(r>>o&c),i=Number(r&c),s=n?4:0,p=n?0:4;t.setUint32(e+s,a,n),t.setUint32(e+p,i,n)}function zt(t,e,r){return t&e^~t&r}function Qt(t,e,r){return t&e^t&r^e&r}var X=class extends ${constructor(e,r,n,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=o,this.buffer=new Uint8Array(e),this.view=K(this.buffer)}update(e){Rt(this),e=kt(e),j(e);let{view:r,buffer:n,blockLen:o}=this,c=e.length;for(let a=0;a<c;){let i=Math.min(o-this.pos,c-a);if(i===o){let s=K(e);for(;o<=c-a;a+=o)this.process(s,a);continue}n.set(e.subarray(a,a+i),this.pos),this.pos+=i,a+=i,this.pos===o&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Rt(this),Wt(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:o,isLE:c}=this,{pos:a}=this;r[a++]=128,C(this.buffer.subarray(a)),this.padOffset>o-a&&(this.process(n,0),a=0);for(let l=a;l<o;l++)r[l]=0;he(n,o-8,BigInt(this.length*8),c),this.process(n,0);let i=K(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let p=s/4,_=this.get();if(p>_.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<p;l++)i.setUint32(4*l,_[l],c)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:o,finished:c,destroyed:a,pos:i}=this;return e.destroyed=a,e.finished=c,e.length=o,e.pos=i,o%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},R=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var xe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),k=new Uint32Array(64),Ot=class extends X{constructor(e=32){super(64,e,8,!1),this.A=R[0]|0,this.B=R[1]|0,this.C=R[2]|0,this.D=R[3]|0,this.E=R[4]|0,this.F=R[5]|0,this.G=R[6]|0,this.H=R[7]|0}get(){let{A:e,B:r,C:n,D:o,E:c,F:a,G:i,H:s}=this;return[e,r,n,o,c,a,i,s]}set(e,r,n,o,c,a,i,s){this.A=e|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=c|0,this.F=a|0,this.G=i|0,this.H=s|0}process(e,r){for(let l=0;l<16;l++,r+=4)k[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let f=k[l-15],d=k[l-2],u=b(f,7)^b(f,18)^f>>>3,h=b(d,17)^b(d,19)^d>>>10;k[l]=h+k[l-7]+u+k[l-16]|0}let{A:n,B:o,C:c,D:a,E:i,F:s,G:p,H:_}=this;for(let l=0;l<64;l++){let f=b(i,6)^b(i,11)^b(i,25),d=_+f+zt(i,s,p)+xe[l]+k[l]|0,h=(b(n,2)^b(n,13)^b(n,22))+Qt(n,o,c)|0;_=p,p=s,s=i,i=a+d|0,a=c,c=o,o=n,n=d+h|0}n=n+this.A|0,o=o+this.B|0,c=c+this.C|0,a=a+this.D|0,i=i+this.E|0,s=s+this.F|0,p=p+this.G|0,_=_+this.H|0,this.set(n,o,c,a,i,s,p,_)}roundClean(){C(k)}destroy(){this.set(0,0,0,0,0,0,0,0),C(this.buffer)}};var vt=Mt(()=>new Ot);var me="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",$t=me;function be(t){if(!t||typeof t!="string")throw new Error(`Expected base58 string but got \u201C${t}\u201D`);if(t.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character \u201C${t.match(/[IOl0]/gmu)}\u201D`);let e=t.match(/^1+/gmu),r=e?e[0].length:0,n=(t.length-r)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(r),...t.match(/.{1}/gmu).map(o=>$t.indexOf(o)).reduce((o,c)=>(o=o.map(a=>{let i=a*58+c;return c=i>>8,i}),o),new Uint8Array(n)).reverse().filter((o=>c=>o=o||c)(!1))])}var Vt=be;var H=ne(Jt(),1);var we=0,Re=5,ke=111,Oe=196,ve={[we]:{type:1,networks:[0]},[ke]:{type:1,networks:[2,1]},[Re]:{type:2,networks:[0]},[Oe]:{type:2,networks:[2,1]}},Ve=({address:t,network:e})=>{let n=(_=>{try{return Vt(_)}catch{throw new E}})(t),{length:o}=n;if(o!==25)throw new B(`Expected the address to be 25 bytes, got ${o}.`);(_=>{let l=_.slice(o-4,o),f=_.slice(0,o-4),d=vt.create();d.update(f);let u=vt.create();u.update(d.digest());let h=u.digest().slice(0,4);if(l.some((m,x)=>m!==h[x]))throw new B(`Checksum mismatch expected ${l}, got ${h}.`)})(n);let[a]=n,i=ve[a];if(Yt(i))throw new S;let{type:s,networks:p}=i;if(!p.includes(e))throw new z;return{address:t,network:e,type:s,parser:"base58"}},Ae=({address:t,network:e})=>{let r=_=>{try{return _.startsWith("bc1p")||_.startsWith("tb1p")||_.startsWith("bcrt1p")?H.bech32m.decode(_):H.bech32.decode(_)}catch{throw new B}},{prefix:n,words:o}=r(t),a={bc:0,tb:2,bcrt:1}[n];if(Yt(a))throw new E;if(a!==e)throw new M;let[i,...s]=o;if(i>1)throw new W;switch(H.bech32.fromWords(s).length){case 20:return{address:t,network:e,type:0,parser:"bip-173"};case 32:return{address:t,network:e,type:i===0?3:4,parser:"bip-173"};default:throw new G}},xr=({address:t,network:e=0})=>{switch(t.charAt(0)){case"1":case"2":case"3":case"m":case"n":return Ve({address:t,network:e});case"b":case"B":case"t":case"T":return Ae({address:t,network:e});case"":throw new q;default:throw new S}};export{dt as BitcoinCanister,St as BtcAddressType,Et as BtcNetwork,wt as CkBTCMinterCanister,pt as MinterAlreadyProcessingError,xt as MinterAmountTooLowError,V as MinterGenericError,bt as MinterInsufficientAllowanceError,mt as MinterInsufficientFundsError,ht as MinterMalformedAddressError,ft as MinterNoNewUtxosError,A as MinterRetrieveBtcError,_t as MinterTemporaryUnavailableError,Q as MinterUpdateBalanceError,G as ParseBtcAddressBadWitnessLengthError,N as ParseBtcAddressError,E as ParseBtcAddressInvalidError,B as ParseBtcAddressMalformedAddressError,q as ParseBtcAddressNoDataError,M as ParseBtcAddressUnexpectedHumanReadablePartError,S as ParseBtcAddressUnsupportedAddressTypeError,W as ParseBtcAddressUnsupportedWitnessVersionError,z as ParseBtcAddressWrongNetworkError,yt as createRetrieveBtcError,Ht as createRetrieveBtcWithApprovalError,Ct as createUpdateBalanceError,xr as parseBtcAddress,Ft as toGetBalanceParams,Ut as toGetUtxosParams};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@noble/hashes/esm/utils.js:
|