@dfinity/ckbtc 2.5.0 → 3.0.0
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 +29 -9
- package/dist/candid/minter.did +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +3 -3
- package/dist/esm/bitcoin.canister.js +1 -1
- package/dist/esm/chunk-WUAXPVZB.js +2 -0
- package/dist/esm/chunk-WUAXPVZB.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/bitcoin.canister.d.ts +19 -4
- package/dist/types/types/bitcoin.params.d.ts +8 -3
- package/package.json +5 -5
- package/dist/esm/chunk-NEYHWXBO.js +0 -2
- package/dist/esm/chunk-NEYHWXBO.js.map +0 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as a}from"./chunk-WUAXPVZB.js";import"./chunk-IS3C7V4B.js";export{a as BitcoinCanister};
|
|
2
2
|
//# sourceMappingURL=bitcoin.canister.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{Canister as v,createServices as B}from"@dfinity/utils";var k=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),a=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}),l=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(a),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,_=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}),u=t.Vec(t.Nat8),d=t.Record({tip_height:s,block_headers:t.Vec(u)}),g=t.Record({network:n}),b=t.Nat64,o=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),m=t.Vec(t.Nat8),N=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),f=t.Record({height:s,value:i,outpoint:N}),r=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:m,utxos:t.Vec(f)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),h=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:a,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),O=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(a),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([_],[i],[]),bitcoin_get_balance_query:t.Func([_],[i],[]),bitcoin_get_block_headers:t.Func([p],[d],[]),bitcoin_get_current_fee_percentiles:t.Func([g],[t.Vec(b)],[]),bitcoin_get_utxos:t.Func([o],[r],[]),bitcoin_get_utxos_query:t.Func([o],[r],[]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[h],[]),set_config:t.Func([O],[],[])})};var w=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),a=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}),l=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),blocks_source:t.Opt(t.Principal),fees:t.Opt(a),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,_=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}),u=t.Vec(t.Nat8),d=t.Record({tip_height:s,block_headers:t.Vec(u)}),g=t.Record({network:n}),b=t.Nat64,o=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:c}),m=t.Vec(t.Nat8),N=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),f=t.Record({height:s,value:i,outpoint:N}),r=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:s,tip_block_hash:m,utxos:t.Vec(f)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),h=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:a,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),O=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(a),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([_],[i],[]),bitcoin_get_balance_query:t.Func([_],[i],["query"]),bitcoin_get_block_headers:t.Func([p],[d],[]),bitcoin_get_current_fee_percentiles:t.Func([g],[t.Vec(b)],[]),bitcoin_get_utxos:t.Func([o],[r],[]),bitcoin_get_utxos_query:t.Func([o],[r],["query"]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[h],["query"]),set_config:t.Func([O],[],[])})};import{nonNullish as q,toNullable as x}from"@dfinity/utils";var F=t=>t==="testnet"?{testnet:null}:{mainnet:null},P=({network:t,filter:e,...a})=>({filter:q(e)?x("minConfirmations"in e?{min_confirmations:e.minConfirmations}:{page:e.page}):x(),network:t==="testnet"?{testnet:null}:{mainnet:null},...a}),R=({network:t,minConfirmations:e,...a})=>({min_confirmations:x(e),network:F(t),...a});var V=class t extends v{constructor(){super(...arguments);this.getUtxosQuery=({...a})=>{let{bitcoin_get_utxos_query:n}=this.caller({certified:!1});return n(P(a))};this.getBalanceQuery=({...a})=>{let{bitcoin_get_balance_query:n}=this.caller({certified:!1});return n(R(a))}}static create(a){let{service:n,certifiedService:l,canisterId:c}=B({options:a,idlFactory:w,certifiedIdlFactory:k});return new t(c,n,l)}};export{P as a,R as b,V as c};
|
|
2
|
+
//# sourceMappingURL=chunk-WUAXPVZB.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/bitcoin.canister.ts", "../../candid/bitcoin.certified.idl.js", "../../candid/bitcoin.idl.js", "../../src/types/bitcoin.params.ts"],
|
|
4
|
+
"sourcesContent": ["import { Canister, createServices } from \"@dfinity/utils\";\nimport type {\n _SERVICE as BitcoinService,\n get_utxos_response,\n satoshi,\n} from \"../candid/bitcoin\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/bitcoin.certified.idl\";\nimport { idlFactory } from \"../candid/bitcoin.idl\";\nimport {\n toGetBalanceParams,\n toGetUtxosParams,\n type GetBalanceParams,\n type GetUtxosParams,\n} from \"./types/bitcoin.params\";\nimport type { CkBTCCanisterOptions } from \"./types/canister.options\";\n\nexport class BitcoinCanister extends Canister<BitcoinService> {\n static create(options: CkBTCCanisterOptions<BitcoinService>) {\n const { service, certifiedService, canisterId } =\n createServices<BitcoinService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new BitcoinCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), 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.\n *\n * \u26A0\uFE0F Note that this method does not support certified calls because only canisters are allowed to get UTXOs via update calls.\n *\n * @link https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-bitcoin_get_utxos\n *\n * @param {Object} params\n * @param {BitcoinNetwork} params.network Tesnet or mainnet.\n * @param {Object} 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.\n * @param {string} params.address A Bitcoin address.\n * @returns {Promise<bitcoin_get_utxos_result>} The UTXOs are returned sorted by block height in descending order.\n */\n getUtxosQuery = ({\n ...params\n }: GetUtxosParams): Promise<get_utxos_response> => {\n const { bitcoin_get_utxos_query } = this.caller({\n certified: false,\n });\n return bitcoin_get_utxos_query(toGetUtxosParams(params));\n };\n\n /**\n * Given a `get_balance_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), the function returns the current balance of this address in `Satoshi` (10^8 Satoshi = 1 Bitcoin) in the specified Bitcoin network.\n *\n * \u26A0\uFE0F Note that this method does not support certified calls because only canisters are allowed to get Bitcoin balance via update calls.\n *\n * @link https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-bitcoin_get_balance\n *\n * @param {Object} params\n * @param {BitcoinNetwork} params.network Tesnet or mainnet.\n * @param {Object} 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.\n * @param {string} params.address A Bitcoin address.\n * @returns {Promise<satoshi>} The balance is returned in `Satoshi` (10^8 Satoshi = 1 Bitcoin).\n */\n getBalanceQuery = ({ ...params }: GetBalanceParams): Promise<satoshi> => {\n const { bitcoin_get_balance_query } = this.caller({\n certified: false,\n });\n return bitcoin_get_balance_query(toGetBalanceParams(params));\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */\nexport const idlFactory = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n const address = IDL.Text;\n const get_balance_request = IDL.Record({\n 'network' : network,\n 'address' : address,\n 'min_confirmations' : IDL.Opt(IDL.Nat32),\n });\n const satoshi = IDL.Nat64;\n const block_height = IDL.Nat32;\n const get_block_headers_request = IDL.Record({\n 'start_height' : block_height,\n 'end_height' : IDL.Opt(block_height),\n 'network' : network,\n });\n const block_header = IDL.Vec(IDL.Nat8);\n const get_block_headers_response = IDL.Record({\n 'tip_height' : block_height,\n 'block_headers' : IDL.Vec(block_header),\n });\n const get_current_fee_percentiles_request = IDL.Record({\n 'network' : network,\n });\n const millisatoshi_per_byte = IDL.Nat64;\n const get_utxos_request = IDL.Record({\n 'network' : network,\n 'filter' : IDL.Opt(\n IDL.Variant({\n 'page' : IDL.Vec(IDL.Nat8),\n 'min_confirmations' : IDL.Nat32,\n })\n ),\n 'address' : address,\n });\n const block_hash = IDL.Vec(IDL.Nat8);\n const outpoint = IDL.Record({\n 'txid' : IDL.Vec(IDL.Nat8),\n 'vout' : IDL.Nat32,\n });\n const utxo = IDL.Record({\n 'height' : block_height,\n 'value' : satoshi,\n 'outpoint' : outpoint,\n });\n const get_utxos_response = IDL.Record({\n 'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'tip_height' : block_height,\n 'tip_block_hash' : block_hash,\n 'utxos' : IDL.Vec(utxo),\n });\n const send_transaction_request = IDL.Record({\n 'transaction' : IDL.Vec(IDL.Nat8),\n 'network' : network,\n });\n const config = IDL.Record({\n 'api_access' : flag,\n 'lazily_evaluate_fee_percentiles' : flag,\n 'blocks_source' : IDL.Principal,\n 'fees' : fees,\n 'watchdog_canister' : IDL.Opt(IDL.Principal),\n 'network' : network,\n 'stability_threshold' : IDL.Nat,\n 'syncing' : flag,\n 'burn_cycles' : flag,\n 'disable_api_if_not_fully_synced' : flag,\n });\n const set_config_request = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return IDL.Service({\n 'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),\n 'bitcoin_get_balance_query' : IDL.Func(\n [get_balance_request],\n [satoshi],\n [],\n ),\n 'bitcoin_get_block_headers' : IDL.Func(\n [get_block_headers_request],\n [get_block_headers_response],\n [],\n ),\n 'bitcoin_get_current_fee_percentiles' : IDL.Func(\n [get_current_fee_percentiles_request],\n [IDL.Vec(millisatoshi_per_byte)],\n [],\n ),\n 'bitcoin_get_utxos' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_get_utxos_query' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),\n 'get_config' : IDL.Func([], [config], []),\n 'set_config' : IDL.Func([set_config_request], [], []),\n });\n};\nexport const init = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return [init_config];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */\nexport const idlFactory = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n const address = IDL.Text;\n const get_balance_request = IDL.Record({\n 'network' : network,\n 'address' : address,\n 'min_confirmations' : IDL.Opt(IDL.Nat32),\n });\n const satoshi = IDL.Nat64;\n const block_height = IDL.Nat32;\n const get_block_headers_request = IDL.Record({\n 'start_height' : block_height,\n 'end_height' : IDL.Opt(block_height),\n 'network' : network,\n });\n const block_header = IDL.Vec(IDL.Nat8);\n const get_block_headers_response = IDL.Record({\n 'tip_height' : block_height,\n 'block_headers' : IDL.Vec(block_header),\n });\n const get_current_fee_percentiles_request = IDL.Record({\n 'network' : network,\n });\n const millisatoshi_per_byte = IDL.Nat64;\n const get_utxos_request = IDL.Record({\n 'network' : network,\n 'filter' : IDL.Opt(\n IDL.Variant({\n 'page' : IDL.Vec(IDL.Nat8),\n 'min_confirmations' : IDL.Nat32,\n })\n ),\n 'address' : address,\n });\n const block_hash = IDL.Vec(IDL.Nat8);\n const outpoint = IDL.Record({\n 'txid' : IDL.Vec(IDL.Nat8),\n 'vout' : IDL.Nat32,\n });\n const utxo = IDL.Record({\n 'height' : block_height,\n 'value' : satoshi,\n 'outpoint' : outpoint,\n });\n const get_utxos_response = IDL.Record({\n 'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'tip_height' : block_height,\n 'tip_block_hash' : block_hash,\n 'utxos' : IDL.Vec(utxo),\n });\n const send_transaction_request = IDL.Record({\n 'transaction' : IDL.Vec(IDL.Nat8),\n 'network' : network,\n });\n const config = IDL.Record({\n 'api_access' : flag,\n 'lazily_evaluate_fee_percentiles' : flag,\n 'blocks_source' : IDL.Principal,\n 'fees' : fees,\n 'watchdog_canister' : IDL.Opt(IDL.Principal),\n 'network' : network,\n 'stability_threshold' : IDL.Nat,\n 'syncing' : flag,\n 'burn_cycles' : flag,\n 'disable_api_if_not_fully_synced' : flag,\n });\n const set_config_request = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return IDL.Service({\n 'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),\n 'bitcoin_get_balance_query' : IDL.Func(\n [get_balance_request],\n [satoshi],\n ['query'],\n ),\n 'bitcoin_get_block_headers' : IDL.Func(\n [get_block_headers_request],\n [get_block_headers_response],\n [],\n ),\n 'bitcoin_get_current_fee_percentiles' : IDL.Func(\n [get_current_fee_percentiles_request],\n [IDL.Vec(millisatoshi_per_byte)],\n [],\n ),\n 'bitcoin_get_utxos' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_get_utxos_query' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n ['query'],\n ),\n 'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),\n 'get_config' : IDL.Func([], [config], ['query']),\n 'set_config' : IDL.Func([set_config_request], [], []),\n });\n};\nexport const init = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return [init_config];\n};\n", "import { nonNullish, toNullable, type QueryParams } from \"@dfinity/utils\";\nimport type {\n get_balance_request,\n get_utxos_request,\n network,\n} from \"../../candid/bitcoin\";\n\nexport type BitcoinNetwork = \"testnet\" | \"mainnet\";\n\nconst mapBitcoinNetwork = (network: BitcoinNetwork): network =>\n network === \"testnet\" ? { testnet: null } : { mainnet: null };\n\nexport type GetUtxosParams = Omit<get_utxos_request, \"network\" | \"filter\"> & {\n network: BitcoinNetwork;\n filter?: { page: Uint8Array | number[] } | { minConfirmations: number };\n} & Omit<QueryParams, \"certified\">;\n\nexport const toGetUtxosParams = ({\n network,\n filter,\n ...rest\n}: GetUtxosParams): get_utxos_request => ({\n filter: nonNullish(filter)\n ? toNullable(\n \"minConfirmations\" in filter\n ? { min_confirmations: filter.minConfirmations }\n : { page: filter.page },\n )\n : toNullable(),\n network: network === \"testnet\" ? { testnet: null } : { mainnet: null },\n ...rest,\n});\n\nexport type GetBalanceParams = Omit<\n get_balance_request,\n \"network\" | \"min_confirmations\"\n> & {\n network: BitcoinNetwork;\n minConfirmations?: number;\n} & Omit<QueryParams, \"certified\">;\n\nexport const toGetBalanceParams = ({\n network,\n minConfirmations,\n ...rest\n}: GetBalanceParams): get_balance_request => ({\n min_confirmations: toNullable(minConfirmations),\n network: mapBitcoinNetwork(network),\n ...rest,\n});\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAsB,iB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AAGC,CACL,IAAmD,CACjD,GAAM,CAAE,wBAAAC,CAAwB,EAAI,KAAK,OAAO,CAC9C,UAAW,EACb,CAAC,EACD,OAAOA,EAAwBC,EAAiBF,CAAM,CAAC,CACzD,EAeA,qBAAkB,CAAC,CAAE,GAAGA,CAAO,IAA0C,CACvE,GAAM,CAAE,0BAAAG,CAA0B,EAAI,KAAK,OAAO,CAChD,UAAW,EACb,CAAC,EACD,OAAOA,EAA0BC,EAAmBJ,CAAM,CAAC,CAC7D,EAnDA,OAAO,OAAOK,EAA+C,CAC3D,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAA+B,CAC7B,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIZ,EAAgBU,EAAYF,EAASC,CAAgB,CAClE,CA2CF",
|
|
6
|
+
"names": ["Canister", "createServices", "idlFactory", "IDL", "flag", "fees", "network", "init_config", "address", "get_balance_request", "satoshi", "block_height", "get_block_headers_request", "block_header", "get_block_headers_response", "get_current_fee_percentiles_request", "millisatoshi_per_byte", "get_utxos_request", "block_hash", "outpoint", "utxo", "get_utxos_response", "send_transaction_request", "config", "set_config_request", "idlFactory", "IDL", "flag", "fees", "network", "init_config", "address", "get_balance_request", "satoshi", "block_height", "get_block_headers_request", "block_header", "get_block_headers_response", "get_current_fee_percentiles_request", "millisatoshi_per_byte", "get_utxos_request", "block_hash", "outpoint", "utxo", "get_utxos_response", "send_transaction_request", "config", "set_config_request", "nonNullish", "toNullable", "mapBitcoinNetwork", "network", "toGetUtxosParams", "filter", "rest", "toGetBalanceParams", "minConfirmations", "BitcoinCanister", "_BitcoinCanister", "Canister", "params", "bitcoin_get_utxos_query", "toGetUtxosParams", "bitcoin_get_balance_query", "toGetBalanceParams", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Ft,b as dt}from"./chunk-NEYHWXBO.js";import{a as jt,b as Dt,c as Wt,d as St,e as Vt,f as $t,g as qt,h as Gt,i as zt,j as Xt,k as Kt,l as Jt,m as Qt,n as bt}from"./chunk-D2A54F3A.js";import{a as y,b as G}from"./chunk-IS3C7V4B.js";var O=y((ue,Z)=>{"use strict";var At="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Z.exports=At});var et=y((pe,tt)=>{"use strict";var _t=O(),Et=e=>{if(!e||typeof e!="string")throw new Error(`Expected base58 string but got \u201C${e}\u201D`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character \u201C${e.match(/[IOl0]/gmu)}\u201D`);let t=e.match(/^1+/gmu),o=t?t[0].length:0,r=(e.length-o)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(o),...e.match(/.{1}/gmu).map(s=>_t.indexOf(s)).reduce((s,c)=>(s=s.map(n=>{let i=n*58+c;return c=i>>8,i}),s),new Uint8Array(r)).reverse().filter((s=>c=>s=s||c)(!1))])};tt.exports=Et});var ot=y((xe,nt)=>{"use strict";var rt=O(),Ct=()=>{let e=Array(256).fill(-1);for(let t=0;t<rt.length;++t)e[rt.charCodeAt(t)]=t;return e};nt.exports=Ct});var it=y((le,ct)=>{"use strict";var st=O(),kt=ot(),Ut=kt(),Bt=e=>{let t=[];for(let o of e){let r=o;for(let s=0;s<t.length;++s){let c=(Ut[t[s]]<<8)+r;t[s]=st.charCodeAt(c%58),r=c/58|0}for(;r;)t.push(st.charCodeAt(r%58)),r=r/58|0}for(let o of e){if(o)break;t.push(49)}return t.reverse(),String.fromCharCode(...t)};ct.exports=Bt});var ft=y($=>{"use strict";$.base58_to_binary=et();$.binary_to_base58=it()});var pt=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.bech32m=E.bech32=void 0;var F="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ht={};for(let e=0;e<F.length;e++){let t=F.charAt(e);ht[t]=e}function _(e){let t=e>>25;return(e&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function at(e){let t=1;for(let o=0;o<e.length;++o){let r=e.charCodeAt(o);if(r<33||r>126)return"Invalid prefix ("+e+")";t=_(t)^r>>5}t=_(t);for(let o=0;o<e.length;++o){let r=e.charCodeAt(o);t=_(t)^r&31}return t}function q(e,t,o,r){let s=0,c=0,n=(1<<o)-1,i=[];for(let a=0;a<e.length;++a)for(s=s<<t|e[a],c+=t;c>=o;)c-=o,i.push(s>>c&n);if(r)c>0&&i.push(s<<o-c&n);else{if(c>=t)return"Excess padding";if(s<<o-c&n)return"Non-zero padding"}return i}function Lt(e){return q(e,8,5,!0)}function Pt(e){let t=q(e,5,8,!1);if(Array.isArray(t))return t}function Tt(e){let t=q(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function ut(e){let t;e==="bech32"?t=1:t=734539939;function o(n,i,a){if(a=a||90,n.length+7+i.length>a)throw new TypeError("Exceeds length limit");n=n.toLowerCase();let u=at(n);if(typeof u=="string")throw new Error(u);let h=n+"1";for(let f=0;f<i.length;++f){let p=i[f];if(p>>5)throw new Error("Non 5-bit word");u=_(u)^p,h+=F.charAt(p)}for(let f=0;f<6;++f)u=_(u);u^=t;for(let f=0;f<6;++f){let p=u>>(5-f)*5&31;h+=F.charAt(p)}return h}function r(n,i){if(i=i||90,n.length<8)return n+" too short";if(n.length>i)return"Exceeds length limit";let a=n.toLowerCase(),u=n.toUpperCase();if(n!==a&&n!==u)return"Mixed-case string "+n;n=a;let h=n.lastIndexOf("1");if(h===-1)return"No separator character for "+n;if(h===0)return"Missing prefix for "+n;let f=n.slice(0,h),p=n.slice(h+1);if(p.length<6)return"Data too short";let x=at(f);if(typeof x=="string")return x;let w=[];for(let l=0;l<p.length;++l){let L=p.charAt(l),C=ht[L];if(C===void 0)return"Unknown character "+L;x=_(x)^C,!(l+6>=p.length)&&w.push(C)}return x!==t?"Invalid checksum for "+n:{prefix:f,words:w}}function s(n,i){let a=r(n,i);if(typeof a=="object")return a}function c(n,i){let a=r(n,i);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:s,decode:c,encode:o,toWords:Lt,fromWordsUnsafe:Pt,fromWords:Tt}}E.bech32=ut("bech32");E.bech32m=ut("bech32m")});var z=(r=>(r[r.Mainnet=0]="Mainnet",r[r.Regtest=1]="Regtest",r[r.Testnet=2]="Testnet",r))(z||{}),X=(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))(X||{});var b=class extends Error{},k=class extends b{},P=class extends b{},U=class extends b{},T=class extends b{},v=class extends b{},I=class extends b{},A=class extends b{},N=class extends b{};import{isNullish as xt}from"@dfinity/utils";function wt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function j(e,...t){if(!wt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function D(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function K(e,t){j(e);let o=t.outputLen;if(e.length<o)throw new Error(`digestInto() expects output buffer of length at least ${o}`)}var H=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),d=(e,t)=>e<<32-t|e>>>t;var re=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function gt(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function W(e){return typeof e=="string"&&(e=gt(e)),j(e),e}var R=class{clone(){return this._cloneInto()}},ne={}.toString;function J(e){let t=r=>e().update(W(r)).digest(),o=e();return t.outputLen=o.outputLen,t.blockLen=o.blockLen,t.create=()=>e(),t}function mt(e,t,o,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,o,r);let s=BigInt(32),c=BigInt(4294967295),n=Number(o>>s&c),i=Number(o&c),a=r?4:0,u=r?0:4;e.setUint32(t+a,n,r),e.setUint32(t+u,i,r)}var Q=(e,t,o)=>e&t^~e&o,Y=(e,t,o)=>e&t^e&o^t&o,M=class extends R{constructor(t,o,r,s){super(),this.blockLen=t,this.outputLen=o,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=H(this.buffer)}update(t){D(this);let{view:o,buffer:r,blockLen:s}=this;t=W(t);let c=t.length;for(let n=0;n<c;){let i=Math.min(s-this.pos,c-n);if(i===s){let a=H(t);for(;s<=c-n;n+=s)this.process(a,n);continue}r.set(t.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===s&&(this.process(o,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){D(this),K(t,this),this.finished=!0;let{buffer:o,view:r,blockLen:s,isLE:c}=this,{pos:n}=this;o[n++]=128,this.buffer.subarray(n).fill(0),this.padOffset>s-n&&(this.process(r,0),n=0);for(let f=n;f<s;f++)o[f]=0;mt(r,s-8,BigInt(this.length*8),c),this.process(r,0);let i=H(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)i.setUint32(4*f,h[f],c)}digest(){let{buffer:t,outputLen:o}=this;this.digestInto(t);let r=t.slice(0,o);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:o,buffer:r,length:s,finished:c,destroyed:n,pos:i}=this;return t.length=s,t.pos=i,t.finished=c,t.destroyed=n,s%o&&t.buffer.set(r),t}};var yt=new Uint32Array([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]),g=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m=new Uint32Array(64),S=class extends M{constructor(){super(64,32,8,!1),this.A=g[0]|0,this.B=g[1]|0,this.C=g[2]|0,this.D=g[3]|0,this.E=g[4]|0,this.F=g[5]|0,this.G=g[6]|0,this.H=g[7]|0}get(){let{A:t,B:o,C:r,D:s,E:c,F:n,G:i,H:a}=this;return[t,o,r,s,c,n,i,a]}set(t,o,r,s,c,n,i,a){this.A=t|0,this.B=o|0,this.C=r|0,this.D=s|0,this.E=c|0,this.F=n|0,this.G=i|0,this.H=a|0}process(t,o){for(let f=0;f<16;f++,o+=4)m[f]=t.getUint32(o,!1);for(let f=16;f<64;f++){let p=m[f-15],x=m[f-2],w=d(p,7)^d(p,18)^p>>>3,l=d(x,17)^d(x,19)^x>>>10;m[f]=l+m[f-7]+w+m[f-16]|0}let{A:r,B:s,C:c,D:n,E:i,F:a,G:u,H:h}=this;for(let f=0;f<64;f++){let p=d(i,6)^d(i,11)^d(i,25),x=h+p+Q(i,a,u)+yt[f]+m[f]|0,l=(d(r,2)^d(r,13)^d(r,22))+Y(r,s,c)|0;h=u,u=a,a=i,i=n+x|0,n=c,c=s,s=r,r=x+l|0}r=r+this.A|0,s=s+this.B|0,c=c+this.C|0,n=n+this.D|0,i=i+this.E|0,a=a+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,s,c,n,i,a,u,h)}roundClean(){m.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var V=J(()=>new S);var lt=G(ft()),B=G(pt());var vt=0,It=5,Nt=111,Rt=196,Ht={[vt]:{type:1,networks:[0]},[Nt]:{type:1,networks:[2,1]},[It]:{type:2,networks:[0]},[Rt]:{type:2,networks:[2,1]}},Mt=({address:e,network:t})=>{let r=(h=>{try{return(0,lt.base58_to_binary)(h)}catch{throw new k}})(e),{length:s}=r;if(s!==25)throw new A(`Expected the address to be 25 bytes, got ${s}.`);(h=>{let f=h.slice(s-4,s),p=h.slice(0,s-4),x=V.create();x.update(p);let w=V.create();w.update(x.digest());let l=w.digest().slice(0,4);if(f.some((L,C)=>L!==l[C]))throw new A(`Checksum mismatch expected ${f}, got ${l}.`)})(r);let n=r[0],i=Ht[n];if(xt(i))throw new U;let{type:a,networks:u}=i;if(!u.includes(t))throw new N;return{address:e,network:t,type:a,parser:"base58"}},Ot=({address:e,network:t})=>{let o=h=>{try{return h.startsWith("bc1p")||h.startsWith("tb1p")||h.startsWith("bcrt1p")?B.bech32m.decode(h):B.bech32.decode(h)}catch{throw new A}},{prefix:r,words:s}=o(e),n={bc:0,tb:2,bcrt:1}[r];if(xt(n))throw new k;if(n!==t)throw new I;let[i,...a]=s;if(i>1)throw new v;switch(B.bech32.fromWords(a).length){case 20:return{address:e,network:t,type:0,parser:"bip-173"};case 32:return{address:e,network:t,type:i===0?3:4,parser:"bip-173"};default:throw new T}},Ae=({address:e,network:t=0})=>{switch(e.charAt(0)){case"1":case"2":case"3":case"m":case"n":return Mt({address:e,network:t});case"b":case"B":case"t":case"T":return Ot({address:e,network:t});case"":throw new P;default:throw new U}};export{dt as BitcoinCanister,X as BtcAddressType,z as BtcNetwork,bt as CkBTCMinterCanister,Wt as MinterAlreadyProcessingError,Gt as MinterAmountTooLowError,jt as MinterGenericError,Xt as MinterInsufficientAllowanceError,zt as MinterInsufficientFundsError,qt as MinterMalformedAddressError,Vt as MinterNoNewUtxosError,$t as MinterRetrieveBtcError,Dt as MinterTemporaryUnavailableError,St as MinterUpdateBalanceError,T as ParseBtcAddressBadWitnessLengthError,b as ParseBtcAddressError,k as ParseBtcAddressInvalidError,A as ParseBtcAddressMalformedAddressError,P as ParseBtcAddressNoDataError,I as ParseBtcAddressUnexpectedHumanReadablePartError,U as ParseBtcAddressUnsupportedAddressTypeError,v as ParseBtcAddressUnsupportedWitnessVersionError,N as ParseBtcAddressWrongNetworkError,Jt as createRetrieveBtcError,Qt as createRetrieveBtcWithApprovalError,Kt as createUpdateBalanceError,Ae as parseBtcAddress,Ft as toGetUtxosParams};
|
|
1
|
+
import{a as Ft,b as jt,c as dt}from"./chunk-WUAXPVZB.js";import{a as Dt,b as Wt,c as St,d as Vt,e as $t,f as qt,g as Gt,h as zt,i as Xt,j as Kt,k as Jt,l as Qt,m as Yt,n as bt}from"./chunk-D2A54F3A.js";import{a as y,b as G}from"./chunk-IS3C7V4B.js";var O=y((pe,Z)=>{"use strict";var At="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";Z.exports=At});var et=y((xe,tt)=>{"use strict";var _t=O(),Et=e=>{if(!e||typeof e!="string")throw new Error(`Expected base58 string but got \u201C${e}\u201D`);if(e.match(/[IOl0]/gmu))throw new Error(`Invalid base58 character \u201C${e.match(/[IOl0]/gmu)}\u201D`);let t=e.match(/^1+/gmu),o=t?t[0].length:0,r=(e.length-o)*(Math.log(58)/Math.log(256))+1>>>0;return new Uint8Array([...new Uint8Array(o),...e.match(/.{1}/gmu).map(s=>_t.indexOf(s)).reduce((s,c)=>(s=s.map(n=>{let i=n*58+c;return c=i>>8,i}),s),new Uint8Array(r)).reverse().filter((s=>c=>s=s||c)(!1))])};tt.exports=Et});var ot=y((le,nt)=>{"use strict";var rt=O(),Ct=()=>{let e=Array(256).fill(-1);for(let t=0;t<rt.length;++t)e[rt.charCodeAt(t)]=t;return e};nt.exports=Ct});var it=y((de,ct)=>{"use strict";var st=O(),kt=ot(),Ut=kt(),Bt=e=>{let t=[];for(let o of e){let r=o;for(let s=0;s<t.length;++s){let c=(Ut[t[s]]<<8)+r;t[s]=st.charCodeAt(c%58),r=c/58|0}for(;r;)t.push(st.charCodeAt(r%58)),r=r/58|0}for(let o of e){if(o)break;t.push(49)}return t.reverse(),String.fromCharCode(...t)};ct.exports=Bt});var ft=y($=>{"use strict";$.base58_to_binary=et();$.binary_to_base58=it()});var pt=y(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.bech32m=E.bech32=void 0;var F="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ht={};for(let e=0;e<F.length;e++){let t=F.charAt(e);ht[t]=e}function _(e){let t=e>>25;return(e&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function at(e){let t=1;for(let o=0;o<e.length;++o){let r=e.charCodeAt(o);if(r<33||r>126)return"Invalid prefix ("+e+")";t=_(t)^r>>5}t=_(t);for(let o=0;o<e.length;++o){let r=e.charCodeAt(o);t=_(t)^r&31}return t}function q(e,t,o,r){let s=0,c=0,n=(1<<o)-1,i=[];for(let a=0;a<e.length;++a)for(s=s<<t|e[a],c+=t;c>=o;)c-=o,i.push(s>>c&n);if(r)c>0&&i.push(s<<o-c&n);else{if(c>=t)return"Excess padding";if(s<<o-c&n)return"Non-zero padding"}return i}function Lt(e){return q(e,8,5,!0)}function Pt(e){let t=q(e,5,8,!1);if(Array.isArray(t))return t}function Tt(e){let t=q(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function ut(e){let t;e==="bech32"?t=1:t=734539939;function o(n,i,a){if(a=a||90,n.length+7+i.length>a)throw new TypeError("Exceeds length limit");n=n.toLowerCase();let u=at(n);if(typeof u=="string")throw new Error(u);let h=n+"1";for(let f=0;f<i.length;++f){let p=i[f];if(p>>5)throw new Error("Non 5-bit word");u=_(u)^p,h+=F.charAt(p)}for(let f=0;f<6;++f)u=_(u);u^=t;for(let f=0;f<6;++f){let p=u>>(5-f)*5&31;h+=F.charAt(p)}return h}function r(n,i){if(i=i||90,n.length<8)return n+" too short";if(n.length>i)return"Exceeds length limit";let a=n.toLowerCase(),u=n.toUpperCase();if(n!==a&&n!==u)return"Mixed-case string "+n;n=a;let h=n.lastIndexOf("1");if(h===-1)return"No separator character for "+n;if(h===0)return"Missing prefix for "+n;let f=n.slice(0,h),p=n.slice(h+1);if(p.length<6)return"Data too short";let x=at(f);if(typeof x=="string")return x;let w=[];for(let l=0;l<p.length;++l){let L=p.charAt(l),C=ht[L];if(C===void 0)return"Unknown character "+L;x=_(x)^C,!(l+6>=p.length)&&w.push(C)}return x!==t?"Invalid checksum for "+n:{prefix:f,words:w}}function s(n,i){let a=r(n,i);if(typeof a=="object")return a}function c(n,i){let a=r(n,i);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:s,decode:c,encode:o,toWords:Lt,fromWordsUnsafe:Pt,fromWords:Tt}}E.bech32=ut("bech32");E.bech32m=ut("bech32m")});var z=(r=>(r[r.Mainnet=0]="Mainnet",r[r.Regtest=1]="Regtest",r[r.Testnet=2]="Testnet",r))(z||{}),X=(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))(X||{});var b=class extends Error{},k=class extends b{},P=class extends b{},U=class extends b{},T=class extends b{},v=class extends b{},I=class extends b{},A=class extends b{},N=class extends b{};import{isNullish as xt}from"@dfinity/utils";function wt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function j(e,...t){if(!wt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function D(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function K(e,t){j(e);let o=t.outputLen;if(e.length<o)throw new Error(`digestInto() expects output buffer of length at least ${o}`)}var H=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),d=(e,t)=>e<<32-t|e>>>t;var ne=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function gt(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function W(e){return typeof e=="string"&&(e=gt(e)),j(e),e}var R=class{clone(){return this._cloneInto()}},oe={}.toString;function J(e){let t=r=>e().update(W(r)).digest(),o=e();return t.outputLen=o.outputLen,t.blockLen=o.blockLen,t.create=()=>e(),t}function mt(e,t,o,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,o,r);let s=BigInt(32),c=BigInt(4294967295),n=Number(o>>s&c),i=Number(o&c),a=r?4:0,u=r?0:4;e.setUint32(t+a,n,r),e.setUint32(t+u,i,r)}var Q=(e,t,o)=>e&t^~e&o,Y=(e,t,o)=>e&t^e&o^t&o,M=class extends R{constructor(t,o,r,s){super(),this.blockLen=t,this.outputLen=o,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=H(this.buffer)}update(t){D(this);let{view:o,buffer:r,blockLen:s}=this;t=W(t);let c=t.length;for(let n=0;n<c;){let i=Math.min(s-this.pos,c-n);if(i===s){let a=H(t);for(;s<=c-n;n+=s)this.process(a,n);continue}r.set(t.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===s&&(this.process(o,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){D(this),K(t,this),this.finished=!0;let{buffer:o,view:r,blockLen:s,isLE:c}=this,{pos:n}=this;o[n++]=128,this.buffer.subarray(n).fill(0),this.padOffset>s-n&&(this.process(r,0),n=0);for(let f=n;f<s;f++)o[f]=0;mt(r,s-8,BigInt(this.length*8),c),this.process(r,0);let i=H(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=a/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)i.setUint32(4*f,h[f],c)}digest(){let{buffer:t,outputLen:o}=this;this.digestInto(t);let r=t.slice(0,o);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:o,buffer:r,length:s,finished:c,destroyed:n,pos:i}=this;return t.length=s,t.pos=i,t.finished=c,t.destroyed=n,s%o&&t.buffer.set(r),t}};var yt=new Uint32Array([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]),g=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),m=new Uint32Array(64),S=class extends M{constructor(){super(64,32,8,!1),this.A=g[0]|0,this.B=g[1]|0,this.C=g[2]|0,this.D=g[3]|0,this.E=g[4]|0,this.F=g[5]|0,this.G=g[6]|0,this.H=g[7]|0}get(){let{A:t,B:o,C:r,D:s,E:c,F:n,G:i,H:a}=this;return[t,o,r,s,c,n,i,a]}set(t,o,r,s,c,n,i,a){this.A=t|0,this.B=o|0,this.C=r|0,this.D=s|0,this.E=c|0,this.F=n|0,this.G=i|0,this.H=a|0}process(t,o){for(let f=0;f<16;f++,o+=4)m[f]=t.getUint32(o,!1);for(let f=16;f<64;f++){let p=m[f-15],x=m[f-2],w=d(p,7)^d(p,18)^p>>>3,l=d(x,17)^d(x,19)^x>>>10;m[f]=l+m[f-7]+w+m[f-16]|0}let{A:r,B:s,C:c,D:n,E:i,F:a,G:u,H:h}=this;for(let f=0;f<64;f++){let p=d(i,6)^d(i,11)^d(i,25),x=h+p+Q(i,a,u)+yt[f]+m[f]|0,l=(d(r,2)^d(r,13)^d(r,22))+Y(r,s,c)|0;h=u,u=a,a=i,i=n+x|0,n=c,c=s,s=r,r=x+l|0}r=r+this.A|0,s=s+this.B|0,c=c+this.C|0,n=n+this.D|0,i=i+this.E|0,a=a+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,s,c,n,i,a,u,h)}roundClean(){m.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var V=J(()=>new S);var lt=G(ft()),B=G(pt());var vt=0,It=5,Nt=111,Rt=196,Ht={[vt]:{type:1,networks:[0]},[Nt]:{type:1,networks:[2,1]},[It]:{type:2,networks:[0]},[Rt]:{type:2,networks:[2,1]}},Mt=({address:e,network:t})=>{let r=(h=>{try{return(0,lt.base58_to_binary)(h)}catch{throw new k}})(e),{length:s}=r;if(s!==25)throw new A(`Expected the address to be 25 bytes, got ${s}.`);(h=>{let f=h.slice(s-4,s),p=h.slice(0,s-4),x=V.create();x.update(p);let w=V.create();w.update(x.digest());let l=w.digest().slice(0,4);if(f.some((L,C)=>L!==l[C]))throw new A(`Checksum mismatch expected ${f}, got ${l}.`)})(r);let n=r[0],i=Ht[n];if(xt(i))throw new U;let{type:a,networks:u}=i;if(!u.includes(t))throw new N;return{address:e,network:t,type:a,parser:"base58"}},Ot=({address:e,network:t})=>{let o=h=>{try{return h.startsWith("bc1p")||h.startsWith("tb1p")||h.startsWith("bcrt1p")?B.bech32m.decode(h):B.bech32.decode(h)}catch{throw new A}},{prefix:r,words:s}=o(e),n={bc:0,tb:2,bcrt:1}[r];if(xt(n))throw new k;if(n!==t)throw new I;let[i,...a]=s;if(i>1)throw new v;switch(B.bech32.fromWords(a).length){case 20:return{address:e,network:t,type:0,parser:"bip-173"};case 32:return{address:e,network:t,type:i===0?3:4,parser:"bip-173"};default:throw new T}},_e=({address:e,network:t=0})=>{switch(e.charAt(0)){case"1":case"2":case"3":case"m":case"n":return Mt({address:e,network:t});case"b":case"B":case"t":case"T":return Ot({address:e,network:t});case"":throw new P;default:throw new U}};export{dt as BitcoinCanister,X as BtcAddressType,z as BtcNetwork,bt as CkBTCMinterCanister,St as MinterAlreadyProcessingError,zt as MinterAmountTooLowError,Dt as MinterGenericError,Kt as MinterInsufficientAllowanceError,Xt as MinterInsufficientFundsError,Gt as MinterMalformedAddressError,$t as MinterNoNewUtxosError,qt as MinterRetrieveBtcError,Wt as MinterTemporaryUnavailableError,Vt as MinterUpdateBalanceError,T as ParseBtcAddressBadWitnessLengthError,b as ParseBtcAddressError,k as ParseBtcAddressInvalidError,A as ParseBtcAddressMalformedAddressError,P as ParseBtcAddressNoDataError,I as ParseBtcAddressUnexpectedHumanReadablePartError,U as ParseBtcAddressUnsupportedAddressTypeError,v as ParseBtcAddressUnsupportedWitnessVersionError,N as ParseBtcAddressWrongNetworkError,Qt as createRetrieveBtcError,Yt as createRetrieveBtcWithApprovalError,Jt as createUpdateBalanceError,_e as parseBtcAddress,jt as toGetBalanceParams,Ft as toGetUtxosParams};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@noble/hashes/esm/utils.js:
|
package/dist/esm/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../node_modules/base58-js/private/base58_chars.js", "../../../../node_modules/base58-js/public/base58_to_binary.js", "../../../../node_modules/base58-js/private/create_base58_map.js", "../../../../node_modules/base58-js/public/binary_to_base58.js", "../../../../node_modules/base58-js/public/index.js", "../../../../node_modules/bech32/dist/index.js", "../../src/enums/btc.enums.ts", "../../src/errors/btc.errors.ts", "../../src/utils/btc.utils.ts", "../../../../node_modules/@noble/hashes/src/_assert.ts", "../../../../node_modules/@noble/hashes/src/utils.ts", "../../../../node_modules/@noble/hashes/src/_md.ts", "../../../../node_modules/@noble/hashes/src/sha256.ts"],
|
|
4
4
|
"sourcesContent": ["'use strict'\n/**\n * Base58 characters must only include numbers 123456789, uppercase ABCDEFGHJKLMNPQRSTUVWXYZ and lowercase abcdefghijkmnopqrstuvwxyz.\n * @kind namespace\n * @name base58_chars\n * @type {string}\n */\nconst base58_chars =\n '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n\nmodule.exports = base58_chars\n", "'use strict'\n\nconst base58_chars = require('../private/base58_chars.js')\n\n/**\n * Converts a `base58` string to its corresponding binary representation.\n * @kind function\n * @name base58_to_binary\n * @param {base58_chars} base58String base58 encoded string\n * @returns {Uint8Array} binary representation for the base58 string.\n * @example <caption>Ways to `import`.</caption>\n * ```js\n * import { base58_to_binary } from 'base58-js'\n * ```\n * @example <caption>Ways to `require`.</caption>\n * ```js\n * const { base58_to_binary } = require('base58-js')\n * ```\n * @example <caption>Usage.</caption>\n * ```js\n * const bin = base58_to_binary(\"6MRy\")\n * console.log(bin)\n * ```\n * Logged output will be Uint8Array(3) [15, 239, 64].\n */\nconst base58_to_binary = base58String => {\n if (!base58String || typeof base58String !== 'string')\n throw new Error(`Expected base58 string but got \u201C${base58String}\u201D`)\n if (base58String.match(/[IOl0]/gmu))\n throw new Error(\n `Invalid base58 character \u201C${base58String.match(/[IOl0]/gmu)}\u201D`\n )\n const lz = base58String.match(/^1+/gmu)\n const psz = lz ? lz[0].length : 0\n const size =\n ((base58String.length - psz) * (Math.log(58) / Math.log(256)) + 1) >>> 0\n\n return new Uint8Array([\n ...new Uint8Array(psz),\n ...base58String\n .match(/.{1}/gmu)\n .map(i => base58_chars.indexOf(i))\n .reduce((acc, i) => {\n acc = acc.map(j => {\n const x = j * 58 + i\n i = x >> 8\n return x\n })\n return acc\n }, new Uint8Array(size))\n .reverse()\n .filter(\n (\n lastValue => value =>\n (lastValue = lastValue || value)\n )(false)\n )\n ])\n}\n\nmodule.exports = base58_to_binary\n", "'use strict'\nconst base58_chars = require('./base58_chars.js')\n\n/**\n * Generates a mapping between base58 and ascii.\n * @name create_base58_map\n * @kind function\n * @returns {Array} mapping between ascii and base58.\n * @ignore\n */\nconst create_base58_map = () => {\n const base58M = Array(256).fill(-1)\n for (let i = 0; i < base58_chars.length; ++i)\n base58M[base58_chars.charCodeAt(i)] = i\n\n return base58M\n}\n\nmodule.exports = create_base58_map\n", "'use strict'\n\nconst base58_chars = require('../private/base58_chars.js')\nconst create_base58_map = require('../private/create_base58_map.js')\n\nconst base58Map = create_base58_map()\n\n/**\n * Converts a [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) into a base58 string.\n * @kind function\n * @name binary_to_base58\n * @param {Uint8Array | Array} uint8array Unsigned integer.\n * @returns {base58_chars} The base58 string representation of the binary array.\n * @example <caption>Ways to `require`.</caption>\n * ```js\n * const { binary_to_base58 } = require(\"base58-js\")\n * ```\n * @example <caption>Ways to `import`.</caption>\n * ```js\n * import { binary_to_base58 } from 'base58-js'\n * ```\n * @example <caption>Usage.</caption>\n * ```js\n * const str = binary_to_base58([15, 239, 64])\n * console.log(str)\n * ```\n * Logged output will be 6MRy.\n */\nconst binary_to_base58 = uint8array => {\n const result = []\n\n for (const byte of uint8array) {\n let carry = byte\n for (let j = 0; j < result.length; ++j) {\n const x = (base58Map[result[j]] << 8) + carry\n result[j] = base58_chars.charCodeAt(x % 58)\n carry = (x / 58) | 0\n }\n while (carry) {\n result.push(base58_chars.charCodeAt(carry % 58))\n carry = (carry / 58) | 0\n }\n }\n\n for (const byte of uint8array)\n if (byte) break\n else result.push('1'.charCodeAt(0))\n\n result.reverse()\n\n return String.fromCharCode(...result)\n}\n\nmodule.exports = binary_to_base58\n", "'use strict'\n\nexports.base58_to_binary = require('./base58_to_binary.js')\nexports.binary_to_base58 = require('./binary_to_base58.js')\n", "'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bech32m = exports.bech32 = void 0;\nconst ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';\nconst ALPHABET_MAP = {};\nfor (let z = 0; z < ALPHABET.length; z++) {\n const x = ALPHABET.charAt(z);\n ALPHABET_MAP[x] = z;\n}\nfunction polymodStep(pre) {\n const b = pre >> 25;\n return (((pre & 0x1ffffff) << 5) ^\n (-((b >> 0) & 1) & 0x3b6a57b2) ^\n (-((b >> 1) & 1) & 0x26508e6d) ^\n (-((b >> 2) & 1) & 0x1ea119fa) ^\n (-((b >> 3) & 1) & 0x3d4233dd) ^\n (-((b >> 4) & 1) & 0x2a1462b3));\n}\nfunction prefixChk(prefix) {\n let chk = 1;\n for (let i = 0; i < prefix.length; ++i) {\n const c = prefix.charCodeAt(i);\n if (c < 33 || c > 126)\n return 'Invalid prefix (' + prefix + ')';\n chk = polymodStep(chk) ^ (c >> 5);\n }\n chk = polymodStep(chk);\n for (let i = 0; i < prefix.length; ++i) {\n const v = prefix.charCodeAt(i);\n chk = polymodStep(chk) ^ (v & 0x1f);\n }\n return chk;\n}\nfunction convert(data, inBits, outBits, pad) {\n let value = 0;\n let bits = 0;\n const maxV = (1 << outBits) - 1;\n const result = [];\n for (let i = 0; i < data.length; ++i) {\n value = (value << inBits) | data[i];\n bits += inBits;\n while (bits >= outBits) {\n bits -= outBits;\n result.push((value >> bits) & maxV);\n }\n }\n if (pad) {\n if (bits > 0) {\n result.push((value << (outBits - bits)) & maxV);\n }\n }\n else {\n if (bits >= inBits)\n return 'Excess padding';\n if ((value << (outBits - bits)) & maxV)\n return 'Non-zero padding';\n }\n return result;\n}\nfunction toWords(bytes) {\n return convert(bytes, 8, 5, true);\n}\nfunction fromWordsUnsafe(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n}\nfunction fromWords(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n throw new Error(res);\n}\nfunction getLibraryFromEncoding(encoding) {\n let ENCODING_CONST;\n if (encoding === 'bech32') {\n ENCODING_CONST = 1;\n }\n else {\n ENCODING_CONST = 0x2bc830a3;\n }\n function encode(prefix, words, LIMIT) {\n LIMIT = LIMIT || 90;\n if (prefix.length + 7 + words.length > LIMIT)\n throw new TypeError('Exceeds length limit');\n prefix = prefix.toLowerCase();\n // determine chk mod\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n throw new Error(chk);\n let result = prefix + '1';\n for (let i = 0; i < words.length; ++i) {\n const x = words[i];\n if (x >> 5 !== 0)\n throw new Error('Non 5-bit word');\n chk = polymodStep(chk) ^ x;\n result += ALPHABET.charAt(x);\n }\n for (let i = 0; i < 6; ++i) {\n chk = polymodStep(chk);\n }\n chk ^= ENCODING_CONST;\n for (let i = 0; i < 6; ++i) {\n const v = (chk >> ((5 - i) * 5)) & 0x1f;\n result += ALPHABET.charAt(v);\n }\n return result;\n }\n function __decode(str, LIMIT) {\n LIMIT = LIMIT || 90;\n if (str.length < 8)\n return str + ' too short';\n if (str.length > LIMIT)\n return 'Exceeds length limit';\n // don't allow mixed case\n const lowered = str.toLowerCase();\n const uppered = str.toUpperCase();\n if (str !== lowered && str !== uppered)\n return 'Mixed-case string ' + str;\n str = lowered;\n const split = str.lastIndexOf('1');\n if (split === -1)\n return 'No separator character for ' + str;\n if (split === 0)\n return 'Missing prefix for ' + str;\n const prefix = str.slice(0, split);\n const wordChars = str.slice(split + 1);\n if (wordChars.length < 6)\n return 'Data too short';\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n return chk;\n const words = [];\n for (let i = 0; i < wordChars.length; ++i) {\n const c = wordChars.charAt(i);\n const v = ALPHABET_MAP[c];\n if (v === undefined)\n return 'Unknown character ' + c;\n chk = polymodStep(chk) ^ v;\n // not in the checksum?\n if (i + 6 >= wordChars.length)\n continue;\n words.push(v);\n }\n if (chk !== ENCODING_CONST)\n return 'Invalid checksum for ' + str;\n return { prefix, words };\n }\n function decodeUnsafe(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n }\n function decode(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n throw new Error(res);\n }\n return {\n decodeUnsafe,\n decode,\n encode,\n toWords,\n fromWordsUnsafe,\n fromWords,\n };\n}\nexports.bech32 = getLibraryFromEncoding('bech32');\nexports.bech32m = getLibraryFromEncoding('bech32m');\n", "// As defined on Bitcoin network.\n// e.g. https://developer.bitcoin.org/examples/testing.html\nexport enum BtcNetwork {\n Mainnet,\n Regtest,\n Testnet,\n}\n\n// See https://github.com/dfinity/ic/blob/a8da3aa23dc6f8f4708cb0cb8edce84c5bd8f225/rs/bitcoin/ckbtc/minter/src/address.rs#L18\nexport enum BtcAddressType {\n P2wpkhV0,\n P2pkh,\n P2sh,\n P2wsh,\n P2tr,\n}\n", "export class ParseBtcAddressError extends Error {}\nexport class ParseBtcAddressInvalidError extends ParseBtcAddressError {}\nexport class ParseBtcAddressNoDataError extends ParseBtcAddressError {}\nexport class ParseBtcAddressUnsupportedAddressTypeError extends ParseBtcAddressError {}\nexport class ParseBtcAddressBadWitnessLengthError extends ParseBtcAddressError {}\nexport class ParseBtcAddressUnsupportedWitnessVersionError extends ParseBtcAddressError {}\nexport class ParseBtcAddressUnexpectedHumanReadablePartError extends ParseBtcAddressError {}\nexport class ParseBtcAddressMalformedAddressError extends ParseBtcAddressError {}\nexport class ParseBtcAddressWrongNetworkError extends ParseBtcAddressError {}\n", "import { isNullish } from \"@dfinity/utils\";\nimport { sha256 } from \"@noble/hashes/sha256\";\nimport { base58_to_binary } from \"base58-js\";\nimport { bech32, bech32m, type Decoded } from \"bech32\";\nimport { BtcAddressType, BtcNetwork } from \"../enums/btc.enums\";\nimport {\n ParseBtcAddressBadWitnessLengthError,\n ParseBtcAddressInvalidError,\n ParseBtcAddressMalformedAddressError,\n ParseBtcAddressNoDataError,\n ParseBtcAddressUnexpectedHumanReadablePartError,\n ParseBtcAddressUnsupportedAddressTypeError,\n ParseBtcAddressUnsupportedWitnessVersionError,\n ParseBtcAddressWrongNetworkError,\n} from \"../errors/btc.errors\";\nimport type { BtcAddress, BtcAddressInfo } from \"../types/btc\";\n\n// See https://en.bitcoin.it/wiki/List_of_address_prefixes\nconst BTC_MAINNET_PREFIX = 0; // or 0x00\nconst BTC_MAINNET_P2SH_PREFIX = 5; // or 0x05\nconst BTC_TESTNET_PREFIX = 111; // or 0x6f\nconst BTC_TESTNET_P2SH_PREFIX = 196; // or 0xc4\n\nconst Base58AddressTypes: Record<\n number,\n { type: BtcAddressType; networks: BtcNetwork[] }\n> = {\n [BTC_MAINNET_PREFIX]: {\n type: BtcAddressType.P2pkh,\n networks: [BtcNetwork.Mainnet],\n },\n\n [BTC_TESTNET_PREFIX]: {\n type: BtcAddressType.P2pkh,\n networks: [BtcNetwork.Testnet, BtcNetwork.Regtest],\n },\n\n [BTC_MAINNET_P2SH_PREFIX]: {\n type: BtcAddressType.P2sh,\n networks: [BtcNetwork.Mainnet],\n },\n\n [BTC_TESTNET_P2SH_PREFIX]: {\n type: BtcAddressType.P2sh,\n networks: [BtcNetwork.Testnet, BtcNetwork.Regtest],\n },\n};\n\nconst parseBase58Address = ({\n address,\n network,\n}: Required<BtcAddress>): BtcAddressInfo => {\n const decodeBase58 = (address: string): Uint8Array => {\n try {\n return base58_to_binary(address);\n } catch (error) {\n throw new ParseBtcAddressInvalidError();\n }\n };\n\n const decoded: Uint8Array = decodeBase58(address);\n\n const { length } = decoded;\n\n if (length !== 25) {\n throw new ParseBtcAddressMalformedAddressError(\n `Expected the address to be 25 bytes, got ${length}.`,\n );\n }\n\n const validateBase58Checksum = (decoded: Uint8Array) => {\n const expectedChecksum = decoded.slice(length - 4, length);\n const body = decoded.slice(0, length - 4);\n\n const bodyHash = sha256.create();\n bodyHash.update(body);\n\n const checksumHash = sha256.create();\n checksumHash.update(bodyHash.digest());\n\n const checksum = checksumHash.digest().slice(0, 4);\n\n if (\n expectedChecksum.some(\n (value: number, index: number) => value !== checksum[index],\n )\n ) {\n throw new ParseBtcAddressMalformedAddressError(\n `Checksum mismatch expected ${expectedChecksum}, got ${checksum}.`,\n );\n }\n };\n\n validateBase58Checksum(decoded);\n\n const version = decoded[0];\n\n const versionNetwork = Base58AddressTypes[version];\n\n if (isNullish(versionNetwork)) {\n throw new ParseBtcAddressUnsupportedAddressTypeError();\n }\n\n const { type, networks } = versionNetwork;\n\n if (!networks.includes(network)) {\n throw new ParseBtcAddressWrongNetworkError();\n }\n\n return {\n address,\n network,\n type,\n parser: \"base58\",\n };\n};\n\nconst parseBip173Address = ({\n address,\n network,\n}: Required<BtcAddress>): BtcAddressInfo => {\n const decodeBech32 = (address: string): Decoded => {\n try {\n if (\n address.startsWith(\"bc1p\") ||\n address.startsWith(\"tb1p\") ||\n address.startsWith(\"bcrt1p\")\n ) {\n return bech32m.decode(address);\n }\n\n return bech32.decode(address);\n } catch (error) {\n throw new ParseBtcAddressMalformedAddressError();\n }\n };\n\n const { prefix, words } = decodeBech32(address);\n\n const mapPrefixToNetwork: Record<string, BtcNetwork> = {\n bc: BtcNetwork.Mainnet,\n tb: BtcNetwork.Testnet,\n bcrt: BtcNetwork.Regtest,\n };\n\n const decodedNetwork: BtcNetwork | undefined = mapPrefixToNetwork[prefix];\n\n if (isNullish(decodedNetwork)) {\n throw new ParseBtcAddressInvalidError();\n }\n\n if (decodedNetwork !== network) {\n throw new ParseBtcAddressUnexpectedHumanReadablePartError();\n }\n\n const [witnessVersion, ...rest] = words;\n\n if (witnessVersion > 1) {\n throw new ParseBtcAddressUnsupportedWitnessVersionError();\n }\n\n const data = bech32.fromWords(rest);\n\n switch (data.length) {\n case 20:\n return {\n address,\n network,\n type: BtcAddressType.P2wpkhV0,\n parser: \"bip-173\",\n };\n case 32:\n return {\n address,\n network,\n type: witnessVersion === 0 ? BtcAddressType.P2wsh : BtcAddressType.P2tr,\n parser: \"bip-173\",\n };\n default:\n throw new ParseBtcAddressBadWitnessLengthError();\n }\n};\n\n/**\n * Parse a Bitcoin address.\n *\n * Parse implementation follows strategy implemented in [Minter canister](https://github.com/dfinity/ic/blob/a8da3aa23dc6f8f4708cb0cb8edce84c5bd8f225/rs/bitcoin/ckbtc/minter/src/address.rs#L54).\n *\n * Credits: Parts of JavaScript code and test values from [bitcoin-address-validation](https://github.com/ruigomeseu/bitcoin-address-validation).\n *\n * @param {BtcAddress} params The Bitcoin address and network to parse\n * @param {string} params.address\n * @param {BtcNetwork} params.network Optional. Default BtcNetwork is Mainnet\n */\nexport const parseBtcAddress = ({\n address,\n network = BtcNetwork.Mainnet,\n}: BtcAddress): BtcAddressInfo => {\n switch (address.charAt(0)) {\n case \"1\":\n case \"2\":\n case \"3\":\n case \"m\":\n case \"n\":\n return parseBase58Address({ address, network });\n case \"b\":\n case \"B\":\n case \"t\":\n case \"T\":\n return parseBip173Address({ address, network });\n case \"\":\n throw new ParseBtcAddressNoDataError();\n default:\n throw new ParseBtcAddressUnsupportedAddressTypeError();\n }\n};\n", "function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`positive integer expected, not ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`boolean expected, not ${b}`);\n}\n\n// copied from utils\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(h: Hash) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(h.outputLen);\n number(h.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n", "/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\nimport { bytes as abytes } from './_assert.js';\n// export { isBytes } from './_assert.js';\n// We can't reuse isBytes from _assert, because somehow this causes huge perf issues\nexport function isBytes(a: unknown): a is Uint8Array {\n return (\n a instanceof Uint8Array ||\n (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')\n );\n}\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n// The rotate left (circular left shift) operation for uint32\nexport const rotl = (word: number, shift: number) =>\n (word << shift) | ((word >>> (32 - shift)) >>> 0);\n\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// The byte swap operation for uint32\nexport const byteSwap = (word: number) =>\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff);\n// Conditionally byte swap if on a big-endian platform\nexport const byteSwapIfBE = isLE ? (n: number) => n : (n: number) => byteSwap(n);\n\n// In place byte swap for Uint32Array\nexport function byteSwap32(arr: Uint32Array) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n}\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 } as const;\nfunction asciiToBase16(char: number): number | undefined {\n if (char >= asciis._0 && char <= asciis._9) return char - asciis._0;\n if (char >= asciis._A && char <= asciis._F) return char - (asciis._A - 10);\n if (char >= asciis._a && char <= asciis._f) return char - (asciis._a - 10);\n return;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType<typeof wrapConstructor>;\n\nexport function wrapConstructor<T extends Hash<T>>(hashCons: () => Hash<T>) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n", "import { exists, output } from './_assert.js';\nimport { Hash, createView, Input, toBytes } from './utils.js';\n\n// Polyfill for Safari 14\nfunction setBigUint64(view: DataView, byteOffset: number, value: bigint, isLE: boolean): void {\n if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n\n// Choice: a ? b : c\nexport const Chi = (a: number, b: number, c: number) => (a & b) ^ (~a & c);\n// Majority function, true if any two inpust is true\nexport const Maj = (a: number, b: number, c: number) => (a & b) ^ (a & c) ^ (b & c);\n\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport abstract class HashMD<T extends HashMD<T>> extends Hash<T> {\n protected abstract process(buf: DataView, offset: number): void;\n protected abstract get(): number[];\n protected abstract set(...args: number[]): void;\n abstract destroy(): void;\n protected abstract roundClean(): void;\n // For partial updates less than block size\n protected buffer: Uint8Array;\n protected view: DataView;\n protected finished = false;\n protected length = 0;\n protected pos = 0;\n protected destroyed = false;\n\n constructor(\n readonly blockLen: number,\n public outputLen: number,\n readonly padOffset: number,\n readonly isLE: boolean\n ) {\n super();\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data: Input): this {\n exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out: Uint8Array) {\n exists(this);\n output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++) buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to?: T): T {\n to ||= new (this.constructor as any)() as T;\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen) to.buffer.set(buffer);\n return to;\n }\n}\n", "import { HashMD, Chi, Maj } from './_md.js';\nimport { rotr, wrapConstructor } from './utils.js';\n\n// SHA2-256 need to try 2^128 hashes to execute birthday attack.\n// BTC network is doing 2^67 hashes/sec as per early 2023.\n\n// Round constants:\n// first 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311)\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n\n// Initial state:\n// first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19\n// prettier-ignore\nconst SHA256_IV = /* @__PURE__ */ new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n]);\n\n// Temporary buffer, not used to store anything between runs\n// Named this way because it matches specification.\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nclass SHA256 extends HashMD<SHA256> {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n A = SHA256_IV[0] | 0;\n B = SHA256_IV[1] | 0;\n C = SHA256_IV[2] | 0;\n D = SHA256_IV[3] | 0;\n E = SHA256_IV[4] | 0;\n F = SHA256_IV[5] | 0;\n G = SHA256_IV[6] | 0;\n H = SHA256_IV[7] | 0;\n\n constructor() {\n super(64, 32, 8, false);\n }\n protected get(): [number, number, number, number, number, number, number, number] {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n protected set(\n A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number\n ) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n protected roundClean() {\n SHA256_W.fill(0);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n this.buffer.fill(0);\n }\n}\n// Constants from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf\nclass SHA224 extends SHA256 {\n A = 0xc1059ed8 | 0;\n B = 0x367cd507 | 0;\n C = 0x3070dd17 | 0;\n D = 0xf70e5939 | 0;\n E = 0xffc00b31 | 0;\n F = 0x68581511 | 0;\n G = 0x64f98fa7 | 0;\n H = 0xbefa4fa4 | 0;\n constructor() {\n super();\n this.outputLen = 28;\n }\n}\n\n/**\n * SHA2-256 hash function\n * @param message - data that would be hashed\n */\nexport const sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());\nexport const sha224 = /* @__PURE__ */ wrapConstructor(() => new SHA224());\n"],
|
|
5
|
-
"mappings": "iPAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAOA,IAAMC,GACJ,6DAEFD,EAAO,QAAUC,KCVjB,IAAAC,GAAAC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OA,CAAO,EAGxB,SAAO,OAAOA,CAAO,CAC9B,MAAgB,CACd,MAAM,IAAIK,CACZ,CACF,EAEM,CAAE,OAAAkB,EAAQ,MAAAC,CAAM,EAAIF,EAAatB,CAAO,EAQxCyB,EANiD,CACrD,KACA,KACA,MACF,EAEkEF,CAAM,EAExE,GAAIP,GAAUS,CAAc,EAC1B,MAAM,IAAItB,EAGZ,GAAIsB,IAAmBxB,EACrB,MAAM,IAAIyB,EAGZ,GAAM,CAACC,EAAgB,GAAGC,CAAI,EAAIJ,EAElC,GAAIG,EAAiB,EACnB,MAAM,IAAIE,EAKZ,OAFa,SAAO,UAAUD,CAAI,EAErB,OAAQ,CACnB,IAAK,IACH,MAAO,CACL,QAAA5B,EACA,QAAAC,EACA,OACA,OAAQ,SACV,EACF,IAAK,IACH,MAAO,CACL,QAAAD,EACA,QAAAC,EACA,KAAM0B,IAAmB,MACzB,OAAQ,SACV,EACF,QACE,MAAM,IAAIG,CACd,CACF,EAaaC,GAAkB,CAAC,CAC9B,QAAA/B,EACA,QAAAC,GACF,IAAkC,CAChC,OAAQD,EAAQ,OAAO,CAAC,EAAG,CACzB,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACH,OAAOD,GAAmB,CAAE,QAAAC,EAAS,QAAAC,CAAQ,CAAC,EAChD,IAAK,IACL,IAAK,IACL,IAAK,IACL,IAAK,IACH,OAAOoB,GAAmB,CAAE,QAAArB,EAAS,QAAAC,CAAQ,CAAC,EAChD,IAAK,GACH,MAAM,IAAI+B,EACZ,QACE,MAAM,IAAIf,CACd,CACF",
|
|
6
6
|
"names": ["require_base58_chars", "__commonJSMin", "exports", "module", "base58_chars", "require_base58_to_binary", "__commonJSMin", "exports", "module", "base58_chars", "base58_to_binary", "base58String", "lz", "psz", "size", "i", "acc", "j", "x", "lastValue", "value", "require_create_base58_map", "__commonJSMin", "exports", "module", "base58_chars", "create_base58_map", "base58M", "i", "require_binary_to_base58", "__commonJSMin", "exports", "module", "base58_chars", "create_base58_map", "base58Map", "binary_to_base58", "uint8array", "result", "byte", "carry", "j", "x", "require_public", "__commonJSMin", "exports", "require_dist", "__commonJSMin", "exports", "ALPHABET", "ALPHABET_MAP", "z", "x", "polymodStep", "pre", "b", "prefixChk", "prefix", "chk", "i", "c", "v", "convert", "data", "inBits", "outBits", "pad", "value", "bits", "maxV", "result", "toWords", "bytes", "fromWordsUnsafe", "words", "res", "fromWords", "getLibraryFromEncoding", "encoding", "ENCODING_CONST", "encode", "LIMIT", "__decode", "str", "lowered", "uppered", "split", "wordChars", "decodeUnsafe", "decode", "BtcNetwork", "BtcAddressType", "ParseBtcAddressError", "ParseBtcAddressInvalidError", "ParseBtcAddressNoDataError", "ParseBtcAddressUnsupportedAddressTypeError", "ParseBtcAddressBadWitnessLengthError", "ParseBtcAddressUnsupportedWitnessVersionError", "ParseBtcAddressUnexpectedHumanReadablePartError", "ParseBtcAddressMalformedAddressError", "ParseBtcAddressWrongNetworkError", "isNullish", "isBytes", "a", "bytes", "b", "lengths", "exists", "instance", "checkFinished", "output", "out", "bytes", "min", "createView", "arr", "rotr", "word", "shift", "isLE", "utf8ToBytes", "str", "toBytes", "data", "bytes", "Hash", "toStr", "wrapConstructor", "hashCons", "hashC", "msg", "toBytes", "tmp", "setBigUint64", "view", "byteOffset", "value", "isLE", "_32n", "_u32_max", "wh", "wl", "h", "l", "Chi", "a", "b", "c", "Maj", "HashMD", "Hash", "blockLen", "outputLen", "padOffset", "createView", "data", "exists", "buffer", "toBytes", "len", "pos", "take", "dataView", "out", "output", "i", "oview", "outLen", "state", "res", "to", "length", "finished", "destroyed", "SHA256_K", "SHA256_IV", "SHA256_W", "SHA256", "HashMD", "A", "B", "C", "D", "E", "F", "G", "H", "view", "offset", "i", "W15", "W2", "s0", "rotr", "s1", "sigma1", "T1", "Chi", "T2", "Maj", "sha256", "wrapConstructor", "SHA256", "import_base58_js", "import_bech32", "BTC_MAINNET_PREFIX", "BTC_MAINNET_P2SH_PREFIX", "BTC_TESTNET_PREFIX", "BTC_TESTNET_P2SH_PREFIX", "Base58AddressTypes", "parseBase58Address", "address", "network", "decoded", "ParseBtcAddressInvalidError", "length", "ParseBtcAddressMalformedAddressError", "expectedChecksum", "body", "bodyHash", "sha256", "checksumHash", "checksum", "value", "index", "version", "versionNetwork", "isNullish", "ParseBtcAddressUnsupportedAddressTypeError", "type", "networks", "ParseBtcAddressWrongNetworkError", "parseBip173Address", "decodeBech32", "prefix", "words", "decodedNetwork", "ParseBtcAddressUnexpectedHumanReadablePartError", "witnessVersion", "rest", "ParseBtcAddressUnsupportedWitnessVersionError", "ParseBtcAddressBadWitnessLengthError", "parseBtcAddress", "ParseBtcAddressNoDataError"]
|
|
7
7
|
}
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import { Canister } from "@dfinity/utils";
|
|
2
|
-
import type { _SERVICE as BitcoinService, get_utxos_response } from "../candid/bitcoin";
|
|
3
|
-
import { type GetUtxosParams } from "./types/bitcoin.params";
|
|
2
|
+
import type { _SERVICE as BitcoinService, get_utxos_response, satoshi } from "../candid/bitcoin";
|
|
3
|
+
import { type GetBalanceParams, type GetUtxosParams } from "./types/bitcoin.params";
|
|
4
4
|
import type { CkBTCCanisterOptions } from "./types/canister.options";
|
|
5
5
|
export declare class BitcoinCanister extends Canister<BitcoinService> {
|
|
6
6
|
static create(options: CkBTCCanisterOptions<BitcoinService>): BitcoinCanister;
|
|
7
7
|
/**
|
|
8
8
|
* Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), 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.
|
|
9
9
|
*
|
|
10
|
+
* ⚠️ Note that this method does not support certified calls because only canisters are allowed to get UTXOs via update calls.
|
|
11
|
+
*
|
|
10
12
|
* @link https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-bitcoin_get_utxos
|
|
11
13
|
*
|
|
12
14
|
* @param {Object} params
|
|
13
15
|
* @param {BitcoinNetwork} params.network Tesnet or mainnet.
|
|
14
16
|
* @param {Object} 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.
|
|
15
17
|
* @param {string} params.address A Bitcoin address.
|
|
16
|
-
* @param {boolean} params.certified query or update call
|
|
17
18
|
* @returns {Promise<bitcoin_get_utxos_result>} The UTXOs are returned sorted by block height in descending order.
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
getUtxosQuery: ({ ...params }: GetUtxosParams) => Promise<get_utxos_response>;
|
|
21
|
+
/**
|
|
22
|
+
* Given a `get_balance_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), the function returns the current balance of this address in `Satoshi` (10^8 Satoshi = 1 Bitcoin) in the specified Bitcoin network.
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ Note that this method does not support certified calls because only canisters are allowed to get Bitcoin balance via update calls.
|
|
25
|
+
*
|
|
26
|
+
* @link https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-bitcoin_get_balance
|
|
27
|
+
*
|
|
28
|
+
* @param {Object} params
|
|
29
|
+
* @param {BitcoinNetwork} params.network Tesnet or mainnet.
|
|
30
|
+
* @param {Object} 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.
|
|
31
|
+
* @param {string} params.address A Bitcoin address.
|
|
32
|
+
* @returns {Promise<satoshi>} The balance is returned in `Satoshi` (10^8 Satoshi = 1 Bitcoin).
|
|
33
|
+
*/
|
|
34
|
+
getBalanceQuery: ({ ...params }: GetBalanceParams) => Promise<satoshi>;
|
|
20
35
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { type QueryParams } from "@dfinity/utils";
|
|
2
|
-
import type { get_utxos_request } from "../../candid/bitcoin";
|
|
2
|
+
import type { get_balance_request, get_utxos_request } from "../../candid/bitcoin";
|
|
3
3
|
export type BitcoinNetwork = "testnet" | "mainnet";
|
|
4
4
|
export type GetUtxosParams = Omit<get_utxos_request, "network" | "filter"> & {
|
|
5
5
|
network: BitcoinNetwork;
|
|
6
6
|
filter?: {
|
|
7
7
|
page: Uint8Array | number[];
|
|
8
8
|
} | {
|
|
9
|
-
|
|
9
|
+
minConfirmations: number;
|
|
10
10
|
};
|
|
11
|
-
} & QueryParams
|
|
11
|
+
} & Omit<QueryParams, "certified">;
|
|
12
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfinity/ckbtc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A library for interfacing with ckBTC.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/cjs/index.cjs.js",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
],
|
|
39
39
|
"homepage": "https://github.com/dfinity/ic-js#readme",
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@dfinity/agent": "^
|
|
42
|
-
"@dfinity/candid": "^
|
|
43
|
-
"@dfinity/principal": "^
|
|
44
|
-
"@dfinity/utils": "^2.
|
|
41
|
+
"@dfinity/agent": "^2.0.0",
|
|
42
|
+
"@dfinity/candid": "^2.0.0",
|
|
43
|
+
"@dfinity/principal": "^2.0.0",
|
|
44
|
+
"@dfinity/utils": "^2.5.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@noble/hashes": "^1.3.2",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Canister as q,createServices as F}from"@dfinity/utils";var x=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),s=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(s),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)}),a=t.Text,i=t.Record({network:n,address:a,min_confirmations:t.Opt(t.Nat32)}),_=t.Nat64,c=t.Nat32,p=t.Record({start_height:c,end_height:t.Opt(c),network:n}),u=t.Vec(t.Nat8),d=t.Record({tip_height:c,block_headers:t.Vec(u)}),g=t.Record({network:n}),b=t.Nat64,r=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:a}),N=t.Vec(t.Nat8),m=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),f=t.Record({height:c,value:_,outpoint:m}),l=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:c,tip_block_hash:N,utxos:t.Vec(f)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),h=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:s,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),O=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(s),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([i],[_],[]),bitcoin_get_balance_query:t.Func([i],[_],[]),bitcoin_get_block_headers:t.Func([p],[d],[]),bitcoin_get_current_fee_percentiles:t.Func([g],[t.Vec(b)],[]),bitcoin_get_utxos:t.Func([r],[l],[]),bitcoin_get_utxos_query:t.Func([r],[l],[]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[h],[]),set_config:t.Func([O],[],[])})};var k=({IDL:t})=>{let e=t.Variant({disabled:t.Null,enabled:t.Null}),s=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(s),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)}),a=t.Text,i=t.Record({network:n,address:a,min_confirmations:t.Opt(t.Nat32)}),_=t.Nat64,c=t.Nat32,p=t.Record({start_height:c,end_height:t.Opt(c),network:n}),u=t.Vec(t.Nat8),d=t.Record({tip_height:c,block_headers:t.Vec(u)}),g=t.Record({network:n}),b=t.Nat64,r=t.Record({network:n,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:a}),N=t.Vec(t.Nat8),m=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),f=t.Record({height:c,value:_,outpoint:m}),l=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:c,tip_block_hash:N,utxos:t.Vec(f)}),y=t.Record({transaction:t.Vec(t.Nat8),network:n}),h=t.Record({api_access:e,lazily_evaluate_fee_percentiles:e,blocks_source:t.Principal,fees:s,watchdog_canister:t.Opt(t.Principal),network:n,stability_threshold:t.Nat,syncing:e,burn_cycles:e,disable_api_if_not_fully_synced:e}),O=t.Record({api_access:t.Opt(e),lazily_evaluate_fee_percentiles:t.Opt(e),fees:t.Opt(s),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([i],[_],[]),bitcoin_get_balance_query:t.Func([i],[_],["query"]),bitcoin_get_block_headers:t.Func([p],[d],[]),bitcoin_get_current_fee_percentiles:t.Func([g],[t.Vec(b)],[]),bitcoin_get_utxos:t.Func([r],[l],[]),bitcoin_get_utxos_query:t.Func([r],[l],["query"]),bitcoin_send_transaction:t.Func([y],[],[]),get_config:t.Func([],[h],["query"]),set_config:t.Func([O],[],[])})};import{toNullable as V}from"@dfinity/utils";var w=({network:t,filter:e,...s})=>({filter:V(e),network:t==="testnet"?{testnet:null}:{mainnet:null},...s});var R=class t extends q{constructor(){super(...arguments);this.getUtxos=({certified:s=!0,...n})=>{let{bitcoin_get_utxos:o,bitcoin_get_utxos_query:a}=this.caller({certified:s});return(s?o:a)(w(n))}}static create(s){let{service:n,certifiedService:o,canisterId:a}=F({options:s,idlFactory:k,certifiedIdlFactory:x});return new t(a,n,o)}};export{w as a,R as b};
|
|
2
|
-
//# sourceMappingURL=chunk-NEYHWXBO.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/bitcoin.canister.ts", "../../candid/bitcoin.certified.idl.js", "../../candid/bitcoin.idl.js", "../../src/types/bitcoin.params.ts"],
|
|
4
|
-
"sourcesContent": ["import { Canister, createServices } from \"@dfinity/utils\";\nimport type {\n _SERVICE as BitcoinService,\n get_utxos_response,\n} from \"../candid/bitcoin\";\nimport { idlFactory as certifiedIdlFactory } from \"../candid/bitcoin.certified.idl\";\nimport { idlFactory } from \"../candid/bitcoin.idl\";\nimport { toGetUtxosParams, type GetUtxosParams } from \"./types/bitcoin.params\";\nimport type { CkBTCCanisterOptions } from \"./types/canister.options\";\n\nexport class BitcoinCanister extends Canister<BitcoinService> {\n static create(options: CkBTCCanisterOptions<BitcoinService>) {\n const { service, certifiedService, canisterId } =\n createServices<BitcoinService>({\n options,\n idlFactory,\n certifiedIdlFactory,\n });\n\n return new BitcoinCanister(canisterId, service, certifiedService);\n }\n\n /**\n * Given a `get_utxos_request`, which must specify a Bitcoin address and a Bitcoin network (`mainnet` or `testnet`), 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.\n *\n * @link https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-bitcoin_get_utxos\n *\n * @param {Object} params\n * @param {BitcoinNetwork} params.network Tesnet or mainnet.\n * @param {Object} 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.\n * @param {string} params.address A Bitcoin address.\n * @param {boolean} params.certified query or update call\n * @returns {Promise<bitcoin_get_utxos_result>} The UTXOs are returned sorted by block height in descending order.\n */\n getUtxos = ({\n certified = true,\n ...params\n }: GetUtxosParams): Promise<get_utxos_response> => {\n const { bitcoin_get_utxos, bitcoin_get_utxos_query } = this.caller({\n certified,\n });\n const fn = certified ? bitcoin_get_utxos : bitcoin_get_utxos_query;\n return fn(toGetUtxosParams(params));\n };\n}\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */\nexport const idlFactory = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n const address = IDL.Text;\n const get_balance_request = IDL.Record({\n 'network' : network,\n 'address' : address,\n 'min_confirmations' : IDL.Opt(IDL.Nat32),\n });\n const satoshi = IDL.Nat64;\n const block_height = IDL.Nat32;\n const get_block_headers_request = IDL.Record({\n 'start_height' : block_height,\n 'end_height' : IDL.Opt(block_height),\n 'network' : network,\n });\n const block_header = IDL.Vec(IDL.Nat8);\n const get_block_headers_response = IDL.Record({\n 'tip_height' : block_height,\n 'block_headers' : IDL.Vec(block_header),\n });\n const get_current_fee_percentiles_request = IDL.Record({\n 'network' : network,\n });\n const millisatoshi_per_byte = IDL.Nat64;\n const get_utxos_request = IDL.Record({\n 'network' : network,\n 'filter' : IDL.Opt(\n IDL.Variant({\n 'page' : IDL.Vec(IDL.Nat8),\n 'min_confirmations' : IDL.Nat32,\n })\n ),\n 'address' : address,\n });\n const block_hash = IDL.Vec(IDL.Nat8);\n const outpoint = IDL.Record({\n 'txid' : IDL.Vec(IDL.Nat8),\n 'vout' : IDL.Nat32,\n });\n const utxo = IDL.Record({\n 'height' : block_height,\n 'value' : satoshi,\n 'outpoint' : outpoint,\n });\n const get_utxos_response = IDL.Record({\n 'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'tip_height' : block_height,\n 'tip_block_hash' : block_hash,\n 'utxos' : IDL.Vec(utxo),\n });\n const send_transaction_request = IDL.Record({\n 'transaction' : IDL.Vec(IDL.Nat8),\n 'network' : network,\n });\n const config = IDL.Record({\n 'api_access' : flag,\n 'lazily_evaluate_fee_percentiles' : flag,\n 'blocks_source' : IDL.Principal,\n 'fees' : fees,\n 'watchdog_canister' : IDL.Opt(IDL.Principal),\n 'network' : network,\n 'stability_threshold' : IDL.Nat,\n 'syncing' : flag,\n 'burn_cycles' : flag,\n 'disable_api_if_not_fully_synced' : flag,\n });\n const set_config_request = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return IDL.Service({\n 'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),\n 'bitcoin_get_balance_query' : IDL.Func(\n [get_balance_request],\n [satoshi],\n [],\n ),\n 'bitcoin_get_block_headers' : IDL.Func(\n [get_block_headers_request],\n [get_block_headers_response],\n [],\n ),\n 'bitcoin_get_current_fee_percentiles' : IDL.Func(\n [get_current_fee_percentiles_request],\n [IDL.Vec(millisatoshi_per_byte)],\n [],\n ),\n 'bitcoin_get_utxos' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_get_utxos_query' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),\n 'get_config' : IDL.Func([], [config], []),\n 'set_config' : IDL.Func([set_config_request], [], []),\n });\n};\nexport const init = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return [init_config];\n};\n", "/* Do not edit. Compiled with ./scripts/compile-idl-js from packages/ckbtc/candid/bitcoin.did */\nexport const idlFactory = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n const address = IDL.Text;\n const get_balance_request = IDL.Record({\n 'network' : network,\n 'address' : address,\n 'min_confirmations' : IDL.Opt(IDL.Nat32),\n });\n const satoshi = IDL.Nat64;\n const block_height = IDL.Nat32;\n const get_block_headers_request = IDL.Record({\n 'start_height' : block_height,\n 'end_height' : IDL.Opt(block_height),\n 'network' : network,\n });\n const block_header = IDL.Vec(IDL.Nat8);\n const get_block_headers_response = IDL.Record({\n 'tip_height' : block_height,\n 'block_headers' : IDL.Vec(block_header),\n });\n const get_current_fee_percentiles_request = IDL.Record({\n 'network' : network,\n });\n const millisatoshi_per_byte = IDL.Nat64;\n const get_utxos_request = IDL.Record({\n 'network' : network,\n 'filter' : IDL.Opt(\n IDL.Variant({\n 'page' : IDL.Vec(IDL.Nat8),\n 'min_confirmations' : IDL.Nat32,\n })\n ),\n 'address' : address,\n });\n const block_hash = IDL.Vec(IDL.Nat8);\n const outpoint = IDL.Record({\n 'txid' : IDL.Vec(IDL.Nat8),\n 'vout' : IDL.Nat32,\n });\n const utxo = IDL.Record({\n 'height' : block_height,\n 'value' : satoshi,\n 'outpoint' : outpoint,\n });\n const get_utxos_response = IDL.Record({\n 'next_page' : IDL.Opt(IDL.Vec(IDL.Nat8)),\n 'tip_height' : block_height,\n 'tip_block_hash' : block_hash,\n 'utxos' : IDL.Vec(utxo),\n });\n const send_transaction_request = IDL.Record({\n 'transaction' : IDL.Vec(IDL.Nat8),\n 'network' : network,\n });\n const config = IDL.Record({\n 'api_access' : flag,\n 'lazily_evaluate_fee_percentiles' : flag,\n 'blocks_source' : IDL.Principal,\n 'fees' : fees,\n 'watchdog_canister' : IDL.Opt(IDL.Principal),\n 'network' : network,\n 'stability_threshold' : IDL.Nat,\n 'syncing' : flag,\n 'burn_cycles' : flag,\n 'disable_api_if_not_fully_synced' : flag,\n });\n const set_config_request = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return IDL.Service({\n 'bitcoin_get_balance' : IDL.Func([get_balance_request], [satoshi], []),\n 'bitcoin_get_balance_query' : IDL.Func(\n [get_balance_request],\n [satoshi],\n ['query'],\n ),\n 'bitcoin_get_block_headers' : IDL.Func(\n [get_block_headers_request],\n [get_block_headers_response],\n [],\n ),\n 'bitcoin_get_current_fee_percentiles' : IDL.Func(\n [get_current_fee_percentiles_request],\n [IDL.Vec(millisatoshi_per_byte)],\n [],\n ),\n 'bitcoin_get_utxos' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n [],\n ),\n 'bitcoin_get_utxos_query' : IDL.Func(\n [get_utxos_request],\n [get_utxos_response],\n ['query'],\n ),\n 'bitcoin_send_transaction' : IDL.Func([send_transaction_request], [], []),\n 'get_config' : IDL.Func([], [config], ['query']),\n 'set_config' : IDL.Func([set_config_request], [], []),\n });\n};\nexport const init = ({ IDL }) => {\n const flag = IDL.Variant({ 'disabled' : IDL.Null, 'enabled' : IDL.Null });\n const fees = IDL.Record({\n 'get_current_fee_percentiles' : IDL.Nat,\n 'get_utxos_maximum' : IDL.Nat,\n 'get_block_headers_cycles_per_ten_instructions' : IDL.Nat,\n 'get_current_fee_percentiles_maximum' : IDL.Nat,\n 'send_transaction_per_byte' : IDL.Nat,\n 'get_balance' : IDL.Nat,\n 'get_utxos_cycles_per_ten_instructions' : IDL.Nat,\n 'get_block_headers_base' : IDL.Nat,\n 'get_utxos_base' : IDL.Nat,\n 'get_balance_maximum' : IDL.Nat,\n 'send_transaction_base' : IDL.Nat,\n 'get_block_headers_maximum' : IDL.Nat,\n });\n const network = IDL.Variant({\n 'mainnet' : IDL.Null,\n 'regtest' : IDL.Null,\n 'testnet' : IDL.Null,\n });\n const init_config = IDL.Record({\n 'api_access' : IDL.Opt(flag),\n 'lazily_evaluate_fee_percentiles' : IDL.Opt(flag),\n 'blocks_source' : IDL.Opt(IDL.Principal),\n 'fees' : IDL.Opt(fees),\n 'watchdog_canister' : IDL.Opt(IDL.Opt(IDL.Principal)),\n 'network' : IDL.Opt(network),\n 'stability_threshold' : IDL.Opt(IDL.Nat),\n 'syncing' : IDL.Opt(flag),\n 'burn_cycles' : IDL.Opt(flag),\n 'disable_api_if_not_fully_synced' : IDL.Opt(flag),\n });\n return [init_config];\n};\n", "import { toNullable, type QueryParams } from \"@dfinity/utils\";\nimport type { get_utxos_request } from \"../../candid/bitcoin\";\n\nexport type BitcoinNetwork = \"testnet\" | \"mainnet\";\n\nexport type GetUtxosParams = Omit<get_utxos_request, \"network\" | \"filter\"> & {\n network: BitcoinNetwork;\n filter?: { page: Uint8Array | number[] } | { min_confirmations: number };\n} & QueryParams;\n\nexport const toGetUtxosParams = ({\n network,\n filter,\n ...rest\n}: GetUtxosParams): get_utxos_request => ({\n filter: toNullable(filter),\n network: network === \"testnet\" ? { testnet: null } : { mainnet: null },\n ...rest,\n});\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,YAAAA,EAAU,kBAAAC,MAAsB,iBCClC,IAAMC,EAAa,CAAC,CAAE,IAAAC,CAAI,IAAM,CACrC,IAAMC,EAAOD,EAAI,QAAQ,CAAE,SAAaA,EAAI,KAAM,QAAYA,EAAI,IAAK,CAAC,EAClEE,EAAOF,EAAI,OAAO,CACtB,4BAAgCA,EAAI,IACpC,kBAAsBA,EAAI,IAC1B,8CAAkDA,EAAI,IACtD,oCAAwCA,EAAI,IAC5C,0BAA8BA,EAAI,IAClC,YAAgBA,EAAI,IACpB,sCAA0CA,EAAI,IAC9C,uBAA2BA,EAAI,IAC/B,eAAmBA,EAAI,IACvB,oBAAwBA,EAAI,IAC5B,sBAA0BA,EAAI,IAC9B,0BAA8BA,EAAI,GACpC,CAAC,EACKG,EAAUH,EAAI,QAAQ,CAC1B,QAAYA,EAAI,KAChB,QAAYA,EAAI,KAChB,QAAYA,EAAI,IAClB,CAAC,EACKI,EAAcJ,EAAI,OAAO,CAC7B,WAAeA,EAAI,IAAIC,CAAI,EAC3B,gCAAoCD,EAAI,IAAIC,CAAI,EAChD,cAAkBD,EAAI,IAAIA,EAAI,SAAS,EACvC,KAASA,EAAI,IAAIE,CAAI,EACrB,kBAAsBF,EAAI,IAA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AASD,IAAY,UAAY,CAAE,QAAS,IAAK,EAAI,CAAE,QAAS,IAAK,EACrE,GAAGE,CACL,GHRO,IAAMC,EAAN,MAAMC,UAAwBC,CAAyB,CAAvD,kCAwBL,cAAW,CAAC,CACV,UAAAC,EAAY,GACZ,GAAGC,CACL,IAAmD,CACjD,GAAM,CAAE,kBAAAC,EAAmB,wBAAAC,CAAwB,EAAI,KAAK,OAAO,CACjE,UAAAH,CACF,CAAC,EAED,OADWA,EAAYE,EAAoBC,GACjCC,EAAiBH,CAAM,CAAC,CACpC,EAhCA,OAAO,OAAOI,EAA+C,CAC3D,GAAM,CAAE,QAAAC,EAAS,iBAAAC,EAAkB,WAAAC,CAAW,EAC5CC,EAA+B,CAC7B,QAAAJ,EACA,WAAAK,EACA,oBAAAA,CACF,CAAC,EAEH,OAAO,IAAIZ,EAAgBU,EAAYF,EAASC,CAAgB,CAClE,CAwBF",
|
|
6
|
-
"names": ["Canister", "createServices", "idlFactory", "IDL", "flag", "fees", "network", "init_config", "address", "get_balance_request", "satoshi", "block_height", "get_block_headers_request", "block_header", "get_block_headers_response", "get_current_fee_percentiles_request", "millisatoshi_per_byte", "get_utxos_request", "block_hash", "outpoint", "utxo", "get_utxos_response", "send_transaction_request", "config", "set_config_request", "idlFactory", "IDL", "flag", "fees", "network", "init_config", "address", "get_balance_request", "satoshi", "block_height", "get_block_headers_request", "block_header", "get_block_headers_response", "get_current_fee_percentiles_request", "millisatoshi_per_byte", "get_utxos_request", "block_hash", "outpoint", "utxo", "get_utxos_response", "send_transaction_request", "config", "set_config_request", "toNullable", "toGetUtxosParams", "network", "filter", "rest", "BitcoinCanister", "_BitcoinCanister", "Canister", "certified", "params", "bitcoin_get_utxos", "bitcoin_get_utxos_query", "toGetUtxosParams", "options", "service", "certifiedService", "canisterId", "createServices", "idlFactory"]
|
|
7
|
-
}
|