@bigmi/core 0.9.0 → 0.9.1
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/CHANGELOG.md +12 -0
- package/dist/cjs/_virtual/_rolldown/runtime.js +1 -1
- package/dist/cjs/actions/getBalance.d.ts +3 -4
- package/dist/cjs/actions/getBlock.d.ts +3 -4
- package/dist/cjs/actions/getBlockCount.d.ts +2 -3
- package/dist/cjs/actions/getBlockStats.d.ts +3 -4
- package/dist/cjs/actions/getTransactionFee.d.ts +3 -4
- package/dist/cjs/actions/getTransactions.d.ts +3 -4
- package/dist/cjs/actions/getUTXOTransaction.d.ts +3 -4
- package/dist/cjs/actions/getUTXOs.d.ts +3 -4
- package/dist/cjs/actions/getXPubAddresses.d.ts +3 -4
- package/dist/cjs/actions/sendUTXOTransaction.d.ts +3 -4
- package/dist/cjs/actions/signPsbt.d.ts +1 -2
- package/dist/cjs/actions/waitForTransaction.d.ts +6 -7
- package/dist/cjs/actions/watchBlockNumber.d.ts +5 -6
- package/dist/cjs/actions/watchBlockNumber.js +3 -2
- package/dist/cjs/actions/watchBlockNumber.js.map +1 -1
- package/dist/cjs/chains/bitcoin.d.ts +1 -2
- package/dist/cjs/chains/defineChain.d.ts +1 -2
- package/dist/cjs/chains/signet.d.ts +1 -2
- package/dist/cjs/clients/decorators/public.d.ts +2 -3
- package/dist/cjs/clients/decorators/wallet.d.ts +2 -3
- package/dist/cjs/errors/address.d.ts +2 -3
- package/dist/cjs/errors/base.d.ts +3 -4
- package/dist/cjs/errors/base.js.map +1 -1
- package/dist/cjs/errors/block.d.ts +2 -3
- package/dist/cjs/errors/provider.d.ts +1 -2
- package/dist/cjs/errors/request.d.ts +10 -11
- package/dist/cjs/errors/rpc.d.ts +4 -5
- package/dist/cjs/errors/transaction.d.ts +6 -7
- package/dist/cjs/errors/transport.d.ts +6 -7
- package/dist/cjs/errors/utils.d.ts +3 -4
- package/dist/cjs/errors/utxo.d.ts +2 -3
- package/dist/cjs/factories/createClient.d.ts +6 -7
- package/dist/cjs/factories/createClient.js.map +1 -1
- package/dist/cjs/factories/createTransport.d.ts +1 -2
- package/dist/cjs/test/utils.d.ts +1 -2
- package/dist/cjs/transports/ankr/ankr.d.ts +1 -2
- package/dist/cjs/transports/ankr/ankr.types.d.ts +7 -8
- package/dist/cjs/transports/ankr/getBalance.d.ts +1 -2
- package/dist/cjs/transports/ankr/getTransactionFee.d.ts +1 -2
- package/dist/cjs/transports/ankr/getTransactions.d.ts +1 -2
- package/dist/cjs/transports/ankr/methods.d.ts +1 -2
- package/dist/cjs/transports/ankr/utils.d.ts +1 -2
- package/dist/cjs/transports/blockchair/blockchair.d.ts +1 -2
- package/dist/cjs/transports/blockchair/blockchair.types.d.ts +13 -14
- package/dist/cjs/transports/blockchair/getBalance.d.ts +1 -2
- package/dist/cjs/transports/blockchair/getTransactionFee.d.ts +1 -2
- package/dist/cjs/transports/blockchair/getUTXOs.d.ts +1 -2
- package/dist/cjs/transports/blockchair/getXPubAddresses.d.ts +1 -2
- package/dist/cjs/transports/blockchair/methods.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/blockcypher.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/blockcypher.types.d.ts +8 -9
- package/dist/cjs/transports/blockcypher/getBalance.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/getTransactionFee.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/getUTXOs.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/methods.d.ts +1 -2
- package/dist/cjs/transports/blockcypher/utils.d.ts +1 -2
- package/dist/cjs/transports/custom.d.ts +4 -5
- package/dist/cjs/transports/fallback.d.ts +7 -8
- package/dist/cjs/transports/fallback.js.map +1 -1
- package/dist/cjs/transports/getHttpRpcClient.d.ts +6 -7
- package/dist/cjs/transports/getRpcProviderMethods.d.ts +1 -2
- package/dist/cjs/transports/http.d.ts +4 -5
- package/dist/cjs/transports/mempool/getBalance.d.ts +1 -2
- package/dist/cjs/transports/mempool/getTransactionFee.d.ts +1 -2
- package/dist/cjs/transports/mempool/getTransactions.d.ts +1 -2
- package/dist/cjs/transports/mempool/mempool.d.ts +1 -2
- package/dist/cjs/transports/mempool/mempool.types.d.ts +7 -8
- package/dist/cjs/transports/mempool/methods.d.ts +1 -2
- package/dist/cjs/transports/mempool/utils.d.ts +1 -2
- package/dist/cjs/transports/types.d.ts +12 -13
- package/dist/cjs/transports/utxo.d.ts +1 -2
- package/dist/cjs/types/account.d.ts +1 -2
- package/dist/cjs/types/address.d.ts +4 -5
- package/dist/cjs/types/block.d.ts +1 -2
- package/dist/cjs/types/blockStats.d.ts +2 -3
- package/dist/cjs/types/chain.d.ts +6 -7
- package/dist/cjs/types/client.d.ts +3 -4
- package/dist/cjs/types/hash.d.ts +1 -2
- package/dist/cjs/types/request.d.ts +5 -6
- package/dist/cjs/types/rpc.d.ts +4 -5
- package/dist/cjs/types/transaction.d.ts +2 -3
- package/dist/cjs/types/transport.d.ts +3 -4
- package/dist/cjs/types/utils.d.ts +19 -20
- package/dist/cjs/types/xpub.d.ts +1 -2
- package/dist/cjs/utils/buildRequest.d.ts +3 -4
- package/dist/cjs/utils/buildRequest.js +2 -1
- package/dist/cjs/utils/buildRequest.js.map +1 -1
- package/dist/cjs/utils/cancelTransaction.d.ts +1 -2
- package/dist/cjs/utils/converter.d.ts +5 -6
- package/dist/cjs/utils/createBatchScheduler.d.ts +2 -3
- package/dist/cjs/utils/deepEqual.d.ts +1 -2
- package/dist/cjs/utils/getAction.d.ts +1 -2
- package/dist/cjs/utils/getAddressInfo.d.ts +2 -3
- package/dist/cjs/utils/getAddressInfo.js +2 -1
- package/dist/cjs/utils/getAddressInfo.js.map +1 -1
- package/dist/cjs/utils/idCache.d.ts +1 -2
- package/dist/cjs/utils/isAddress.d.ts +1 -2
- package/dist/cjs/utils/lru.d.ts +1 -2
- package/dist/cjs/utils/modifyFee.d.ts +1 -2
- package/dist/cjs/utils/observe.d.ts +3 -4
- package/dist/cjs/utils/parseAccount.d.ts +2 -3
- package/dist/cjs/utils/poll.d.ts +1 -2
- package/dist/cjs/utils/poll.js +2 -1
- package/dist/cjs/utils/poll.js.map +1 -1
- package/dist/cjs/utils/retryUntil.d.ts +1 -2
- package/dist/cjs/utils/sleep.d.ts +1 -2
- package/dist/cjs/utils/stringify.d.ts +2 -3
- package/dist/cjs/utils/uid.d.ts +1 -2
- package/dist/cjs/utils/url.d.ts +1 -2
- package/dist/cjs/utils/wait.d.ts +1 -2
- package/dist/cjs/utils/withDedupe.d.ts +2 -3
- package/dist/cjs/utils/withResolvers.d.ts +2 -3
- package/dist/cjs/utils/withRetry.d.ts +3 -4
- package/dist/cjs/utils/withTimeout.d.ts +2 -3
- package/dist/cjs/version.d.ts +2 -3
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/vite-env.d.ts +1 -1
- package/dist/esm/actions/getBalance.d.ts +3 -4
- package/dist/esm/actions/getBalance.d.ts.map +1 -1
- package/dist/esm/actions/getBlock.d.ts +3 -4
- package/dist/esm/actions/getBlock.d.ts.map +1 -1
- package/dist/esm/actions/getBlockCount.d.ts +2 -3
- package/dist/esm/actions/getBlockCount.d.ts.map +1 -1
- package/dist/esm/actions/getBlockStats.d.ts +3 -4
- package/dist/esm/actions/getBlockStats.d.ts.map +1 -1
- package/dist/esm/actions/getTransactionFee.d.ts +3 -4
- package/dist/esm/actions/getTransactionFee.d.ts.map +1 -1
- package/dist/esm/actions/getTransactions.d.ts +3 -4
- package/dist/esm/actions/getTransactions.d.ts.map +1 -1
- package/dist/esm/actions/getUTXOTransaction.d.ts +3 -4
- package/dist/esm/actions/getUTXOTransaction.d.ts.map +1 -1
- package/dist/esm/actions/getUTXOs.d.ts +3 -4
- package/dist/esm/actions/getUTXOs.d.ts.map +1 -1
- package/dist/esm/actions/getXPubAddresses.d.ts +3 -4
- package/dist/esm/actions/getXPubAddresses.d.ts.map +1 -1
- package/dist/esm/actions/sendUTXOTransaction.d.ts +3 -4
- package/dist/esm/actions/sendUTXOTransaction.d.ts.map +1 -1
- package/dist/esm/actions/signPsbt.d.ts +1 -2
- package/dist/esm/actions/signPsbt.d.ts.map +1 -1
- package/dist/esm/actions/waitForTransaction.d.ts +6 -7
- package/dist/esm/actions/waitForTransaction.d.ts.map +1 -1
- package/dist/esm/actions/watchBlockNumber.d.ts +5 -6
- package/dist/esm/actions/watchBlockNumber.d.ts.map +1 -1
- package/dist/esm/actions/watchBlockNumber.js +3 -2
- package/dist/esm/actions/watchBlockNumber.js.map +1 -1
- package/dist/esm/chains/bitcoin.d.ts +1 -2
- package/dist/esm/chains/bitcoin.d.ts.map +1 -1
- package/dist/esm/chains/defineChain.d.ts +1 -2
- package/dist/esm/chains/defineChain.d.ts.map +1 -1
- package/dist/esm/chains/signet.d.ts +1 -2
- package/dist/esm/chains/signet.d.ts.map +1 -1
- package/dist/esm/clients/decorators/public.d.ts +2 -3
- package/dist/esm/clients/decorators/public.d.ts.map +1 -1
- package/dist/esm/clients/decorators/wallet.d.ts +2 -3
- package/dist/esm/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/esm/errors/address.d.ts +2 -3
- package/dist/esm/errors/address.d.ts.map +1 -1
- package/dist/esm/errors/base.d.ts +3 -4
- package/dist/esm/errors/base.d.ts.map +1 -1
- package/dist/esm/errors/base.js.map +1 -1
- package/dist/esm/errors/block.d.ts +2 -3
- package/dist/esm/errors/block.d.ts.map +1 -1
- package/dist/esm/errors/provider.d.ts +1 -2
- package/dist/esm/errors/provider.d.ts.map +1 -1
- package/dist/esm/errors/request.d.ts +10 -11
- package/dist/esm/errors/request.d.ts.map +1 -1
- package/dist/esm/errors/rpc.d.ts +4 -5
- package/dist/esm/errors/rpc.d.ts.map +1 -1
- package/dist/esm/errors/transaction.d.ts +6 -7
- package/dist/esm/errors/transaction.d.ts.map +1 -1
- package/dist/esm/errors/transport.d.ts +6 -7
- package/dist/esm/errors/transport.d.ts.map +1 -1
- package/dist/esm/errors/utils.d.ts +3 -4
- package/dist/esm/errors/utils.d.ts.map +1 -1
- package/dist/esm/errors/utxo.d.ts +2 -3
- package/dist/esm/errors/utxo.d.ts.map +1 -1
- package/dist/esm/factories/createClient.d.ts +6 -7
- package/dist/esm/factories/createClient.d.ts.map +1 -1
- package/dist/esm/factories/createClient.js.map +1 -1
- package/dist/esm/factories/createTransport.d.ts +1 -2
- package/dist/esm/factories/createTransport.d.ts.map +1 -1
- package/dist/esm/test/utils.d.ts +1 -2
- package/dist/esm/test/utils.d.ts.map +1 -1
- package/dist/esm/transports/ankr/ankr.d.ts +1 -2
- package/dist/esm/transports/ankr/ankr.d.ts.map +1 -1
- package/dist/esm/transports/ankr/ankr.types.d.ts +7 -8
- package/dist/esm/transports/ankr/ankr.types.d.ts.map +1 -1
- package/dist/esm/transports/ankr/getBalance.d.ts +1 -2
- package/dist/esm/transports/ankr/getBalance.d.ts.map +1 -1
- package/dist/esm/transports/ankr/getTransactionFee.d.ts +1 -2
- package/dist/esm/transports/ankr/getTransactionFee.d.ts.map +1 -1
- package/dist/esm/transports/ankr/getTransactions.d.ts +1 -2
- package/dist/esm/transports/ankr/getTransactions.d.ts.map +1 -1
- package/dist/esm/transports/ankr/methods.d.ts +1 -2
- package/dist/esm/transports/ankr/methods.d.ts.map +1 -1
- package/dist/esm/transports/ankr/utils.d.ts +1 -2
- package/dist/esm/transports/ankr/utils.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/blockchair.d.ts +1 -2
- package/dist/esm/transports/blockchair/blockchair.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/blockchair.types.d.ts +13 -14
- package/dist/esm/transports/blockchair/blockchair.types.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/getBalance.d.ts +1 -2
- package/dist/esm/transports/blockchair/getBalance.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/getTransactionFee.d.ts +1 -2
- package/dist/esm/transports/blockchair/getTransactionFee.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/getUTXOs.d.ts +1 -2
- package/dist/esm/transports/blockchair/getUTXOs.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/getXPubAddresses.d.ts +1 -2
- package/dist/esm/transports/blockchair/getXPubAddresses.d.ts.map +1 -1
- package/dist/esm/transports/blockchair/methods.d.ts +1 -2
- package/dist/esm/transports/blockchair/methods.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/blockcypher.d.ts +1 -2
- package/dist/esm/transports/blockcypher/blockcypher.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/blockcypher.types.d.ts +8 -9
- package/dist/esm/transports/blockcypher/blockcypher.types.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/getBalance.d.ts +1 -2
- package/dist/esm/transports/blockcypher/getBalance.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/getTransactionFee.d.ts +1 -2
- package/dist/esm/transports/blockcypher/getTransactionFee.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/getUTXOs.d.ts +1 -2
- package/dist/esm/transports/blockcypher/getUTXOs.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/methods.d.ts +1 -2
- package/dist/esm/transports/blockcypher/methods.d.ts.map +1 -1
- package/dist/esm/transports/blockcypher/utils.d.ts +1 -2
- package/dist/esm/transports/blockcypher/utils.d.ts.map +1 -1
- package/dist/esm/transports/custom.d.ts +4 -5
- package/dist/esm/transports/custom.d.ts.map +1 -1
- package/dist/esm/transports/fallback.d.ts +7 -8
- package/dist/esm/transports/fallback.d.ts.map +1 -1
- package/dist/esm/transports/fallback.js.map +1 -1
- package/dist/esm/transports/getHttpRpcClient.d.ts +6 -7
- package/dist/esm/transports/getHttpRpcClient.d.ts.map +1 -1
- package/dist/esm/transports/getRpcProviderMethods.d.ts +1 -2
- package/dist/esm/transports/getRpcProviderMethods.d.ts.map +1 -1
- package/dist/esm/transports/http.d.ts +4 -5
- package/dist/esm/transports/http.d.ts.map +1 -1
- package/dist/esm/transports/mempool/getBalance.d.ts +1 -2
- package/dist/esm/transports/mempool/getBalance.d.ts.map +1 -1
- package/dist/esm/transports/mempool/getTransactionFee.d.ts +1 -2
- package/dist/esm/transports/mempool/getTransactionFee.d.ts.map +1 -1
- package/dist/esm/transports/mempool/getTransactions.d.ts +1 -2
- package/dist/esm/transports/mempool/getTransactions.d.ts.map +1 -1
- package/dist/esm/transports/mempool/mempool.d.ts +1 -2
- package/dist/esm/transports/mempool/mempool.d.ts.map +1 -1
- package/dist/esm/transports/mempool/mempool.types.d.ts +7 -8
- package/dist/esm/transports/mempool/mempool.types.d.ts.map +1 -1
- package/dist/esm/transports/mempool/methods.d.ts +1 -2
- package/dist/esm/transports/mempool/methods.d.ts.map +1 -1
- package/dist/esm/transports/mempool/utils.d.ts +1 -2
- package/dist/esm/transports/mempool/utils.d.ts.map +1 -1
- package/dist/esm/transports/types.d.ts +12 -13
- package/dist/esm/transports/types.d.ts.map +1 -1
- package/dist/esm/transports/utxo.d.ts +1 -2
- package/dist/esm/transports/utxo.d.ts.map +1 -1
- package/dist/esm/types/account.d.ts +1 -2
- package/dist/esm/types/account.d.ts.map +1 -1
- package/dist/esm/types/address.d.ts +4 -5
- package/dist/esm/types/address.d.ts.map +1 -1
- package/dist/esm/types/block.d.ts +1 -2
- package/dist/esm/types/block.d.ts.map +1 -1
- package/dist/esm/types/blockStats.d.ts +2 -3
- package/dist/esm/types/blockStats.d.ts.map +1 -1
- package/dist/esm/types/chain.d.ts +6 -7
- package/dist/esm/types/chain.d.ts.map +1 -1
- package/dist/esm/types/client.d.ts +3 -4
- package/dist/esm/types/client.d.ts.map +1 -1
- package/dist/esm/types/hash.d.ts +1 -2
- package/dist/esm/types/hash.d.ts.map +1 -1
- package/dist/esm/types/request.d.ts +5 -6
- package/dist/esm/types/request.d.ts.map +1 -1
- package/dist/esm/types/rpc.d.ts +4 -5
- package/dist/esm/types/rpc.d.ts.map +1 -1
- package/dist/esm/types/transaction.d.ts +2 -3
- package/dist/esm/types/transaction.d.ts.map +1 -1
- package/dist/esm/types/transport.d.ts +3 -4
- package/dist/esm/types/transport.d.ts.map +1 -1
- package/dist/esm/types/utils.d.ts +19 -20
- package/dist/esm/types/utils.d.ts.map +1 -1
- package/dist/esm/types/xpub.d.ts +1 -2
- package/dist/esm/types/xpub.d.ts.map +1 -1
- package/dist/esm/utils/buildRequest.d.ts +3 -4
- package/dist/esm/utils/buildRequest.d.ts.map +1 -1
- package/dist/esm/utils/buildRequest.js +2 -1
- package/dist/esm/utils/buildRequest.js.map +1 -1
- package/dist/esm/utils/cancelTransaction.d.ts +1 -2
- package/dist/esm/utils/cancelTransaction.d.ts.map +1 -1
- package/dist/esm/utils/converter.d.ts +5 -6
- package/dist/esm/utils/converter.d.ts.map +1 -1
- package/dist/esm/utils/createBatchScheduler.d.ts +2 -3
- package/dist/esm/utils/createBatchScheduler.d.ts.map +1 -1
- package/dist/esm/utils/deepEqual.d.ts +1 -2
- package/dist/esm/utils/deepEqual.d.ts.map +1 -1
- package/dist/esm/utils/getAction.d.ts +1 -2
- package/dist/esm/utils/getAction.d.ts.map +1 -1
- package/dist/esm/utils/getAddressInfo.d.ts +2 -3
- package/dist/esm/utils/getAddressInfo.d.ts.map +1 -1
- package/dist/esm/utils/getAddressInfo.js +2 -1
- package/dist/esm/utils/getAddressInfo.js.map +1 -1
- package/dist/esm/utils/idCache.d.ts +1 -2
- package/dist/esm/utils/idCache.d.ts.map +1 -1
- package/dist/esm/utils/isAddress.d.ts +1 -2
- package/dist/esm/utils/isAddress.d.ts.map +1 -1
- package/dist/esm/utils/lru.d.ts +1 -2
- package/dist/esm/utils/lru.d.ts.map +1 -1
- package/dist/esm/utils/modifyFee.d.ts +1 -2
- package/dist/esm/utils/modifyFee.d.ts.map +1 -1
- package/dist/esm/utils/observe.d.ts +3 -4
- package/dist/esm/utils/observe.d.ts.map +1 -1
- package/dist/esm/utils/parseAccount.d.ts +2 -3
- package/dist/esm/utils/parseAccount.d.ts.map +1 -1
- package/dist/esm/utils/poll.d.ts +1 -2
- package/dist/esm/utils/poll.d.ts.map +1 -1
- package/dist/esm/utils/poll.js +2 -1
- package/dist/esm/utils/poll.js.map +1 -1
- package/dist/esm/utils/retryUntil.d.ts +1 -2
- package/dist/esm/utils/retryUntil.d.ts.map +1 -1
- package/dist/esm/utils/sleep.d.ts +1 -2
- package/dist/esm/utils/sleep.d.ts.map +1 -1
- package/dist/esm/utils/stringify.d.ts +2 -3
- package/dist/esm/utils/stringify.d.ts.map +1 -1
- package/dist/esm/utils/uid.d.ts +1 -2
- package/dist/esm/utils/uid.d.ts.map +1 -1
- package/dist/esm/utils/url.d.ts +1 -2
- package/dist/esm/utils/url.d.ts.map +1 -1
- package/dist/esm/utils/wait.d.ts +1 -2
- package/dist/esm/utils/wait.d.ts.map +1 -1
- package/dist/esm/utils/withDedupe.d.ts +2 -3
- package/dist/esm/utils/withDedupe.d.ts.map +1 -1
- package/dist/esm/utils/withResolvers.d.ts +2 -3
- package/dist/esm/utils/withResolvers.d.ts.map +1 -1
- package/dist/esm/utils/withRetry.d.ts +3 -4
- package/dist/esm/utils/withRetry.d.ts.map +1 -1
- package/dist/esm/utils/withTimeout.d.ts +2 -3
- package/dist/esm/utils/withTimeout.d.ts.map +1 -1
- package/dist/esm/version.d.ts +2 -3
- package/dist/esm/version.d.ts.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/vite-env.d.ts +1 -1
- package/package.json +3 -3
- package/src/factories/createClient.ts +1 -2
- package/src/types/client.ts +1 -2
- package/src/version.ts +1 -1
|
@@ -4,7 +4,7 @@ import { UTXOMethod } from "../transports/types.js";
|
|
|
4
4
|
import { ErrorType } from "../errors/utils.js";
|
|
5
5
|
import { BtcRpcRequestFn, RpcSchema } from "./request.js";
|
|
6
6
|
//#region src/types/transport.d.ts
|
|
7
|
-
type TransportConfig<type extends string = string, rpcRequestFn extends BtcRpcRequestFn = BtcRpcRequestFn> = {
|
|
7
|
+
export type TransportConfig<type extends string = string, rpcRequestFn extends BtcRpcRequestFn = BtcRpcRequestFn> = {
|
|
8
8
|
/** The name of the transport. */
|
|
9
9
|
name: string;
|
|
10
10
|
/** The key of the transport. */
|
|
@@ -26,7 +26,7 @@ type TransportConfig<type extends string = string, rpcRequestFn extends BtcRpcRe
|
|
|
26
26
|
/** The type of the transport. */
|
|
27
27
|
type: type;
|
|
28
28
|
};
|
|
29
|
-
type Transport<type extends string = string, rpcAttributes = Record<string, any>, rpcRequestFn extends BtcRpcRequestFn = BtcRpcRequestFn<RpcSchema>> = <chain extends Chain | undefined = Chain>({ chain }: {
|
|
29
|
+
export type Transport<type extends string = string, rpcAttributes = Record<string, any>, rpcRequestFn extends BtcRpcRequestFn = BtcRpcRequestFn<RpcSchema>> = <chain extends Chain | undefined = Chain>({ chain }: {
|
|
30
30
|
chain?: chain | undefined;
|
|
31
31
|
pollingInterval?: number | undefined;
|
|
32
32
|
retryCount?: TransportConfig["retryCount"] | undefined;
|
|
@@ -36,7 +36,6 @@ type Transport<type extends string = string, rpcAttributes = Record<string, any>
|
|
|
36
36
|
request: rpcRequestFn;
|
|
37
37
|
value?: rpcAttributes | undefined;
|
|
38
38
|
};
|
|
39
|
-
type CreateTransportErrorType = ErrorType;
|
|
39
|
+
export type CreateTransportErrorType = ErrorType;
|
|
40
40
|
//#endregion
|
|
41
|
-
export { CreateTransportErrorType, Transport, TransportConfig };
|
|
42
41
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
//#region src/types/utils.d.ts
|
|
2
2
|
/** Combines members of an intersection into a readable type. */
|
|
3
|
-
type Compute<type> = { [key in keyof type]: type[key]; } & unknown;
|
|
3
|
+
export type Compute<type> = { [key in keyof type]: type[key]; } & unknown;
|
|
4
4
|
/**
|
|
5
5
|
* Makes all properties of an object optional.
|
|
6
6
|
*
|
|
7
7
|
* Compatible with [`exactOptionalPropertyTypes`](https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes).
|
|
8
8
|
*/
|
|
9
|
-
type ExactPartial<type> = { [key in keyof type]?: type[key] | undefined; };
|
|
9
|
+
export type ExactPartial<type> = { [key in keyof type]?: type[key] | undefined; };
|
|
10
10
|
/** Checks if {@link type} can be narrowed further than {@link type2} */
|
|
11
|
-
type IsNarrowable<type, type2> = IsUnknown<type> extends true ? false : undefined extends type ? false : IsNever<(type extends type2 ? true : false) & (type2 extends type ? false : true)> extends true ? false : true;
|
|
11
|
+
export type IsNarrowable<type, type2> = IsUnknown<type> extends true ? false : undefined extends type ? false : IsNever<(type extends type2 ? true : false) & (type2 extends type ? false : true)> extends true ? false : true;
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
* Checks if {@link type} is `never`
|
|
15
15
|
*/
|
|
16
|
-
type IsNever<type> = [type] extends [never] ? true : false;
|
|
16
|
+
export type IsNever<type> = [type] extends [never] ? true : false;
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
19
|
* Checks if {@link type} is `unknown`
|
|
20
20
|
*/
|
|
21
|
-
type IsUnknown<type> = unknown extends type ? true : false;
|
|
21
|
+
export type IsUnknown<type> = unknown extends type ? true : false;
|
|
22
22
|
/** Merges two object types into new type */
|
|
23
|
-
type Merge<obj1, obj2> = Compute<LooseOmit<obj1, keyof obj2 extends (infer key extends string) ? key : never> & obj2>;
|
|
23
|
+
export type Merge<obj1, obj2> = Compute<LooseOmit<obj1, keyof obj2 extends (infer key extends string) ? key : never> & obj2>;
|
|
24
24
|
/** Removes `readonly` from all properties of an object. */
|
|
25
|
-
type Mutable<type extends object> = { -readonly [key in keyof type]: type[key]; };
|
|
25
|
+
export type Mutable<type extends object> = { -readonly [key in keyof type]: type[key]; };
|
|
26
26
|
/** Strict version of built-in Omit type */
|
|
27
|
-
type StrictOmit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;
|
|
27
|
+
export type StrictOmit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;
|
|
28
28
|
/** Makes objects destructurable. */
|
|
29
|
-
type OneOf<union extends object, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends (infer Item) ? Compute<Item & { [K in Exclude<keys, keyof Item>]?: undefined; }> : never;
|
|
29
|
+
export type OneOf<union extends object, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends (infer Item) ? Compute<Item & { [K in Exclude<keys, keyof Item>]?: undefined; }> : never;
|
|
30
30
|
type KeyofUnion<type> = type extends type ? keyof type : never;
|
|
31
31
|
/** Makes {@link key} optional in {@link type} while preserving type inference. */
|
|
32
|
-
type PartialBy<type, key extends keyof type> = ExactPartial<Pick<type, key>> & StrictOmit<type, key>;
|
|
33
|
-
type RemoveUndefined<type> = { [key in keyof type]: NonNullable<type[key]>; };
|
|
32
|
+
export type PartialBy<type, key extends keyof type> = ExactPartial<Pick<type, key>> & StrictOmit<type, key>;
|
|
33
|
+
export type RemoveUndefined<type> = { [key in keyof type]: NonNullable<type[key]>; };
|
|
34
34
|
/** Loose version of {@link StrictOmit} */
|
|
35
|
-
type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;
|
|
36
|
-
type UnionCompute<type> = type extends object ? Compute<type> : type;
|
|
37
|
-
type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;
|
|
38
|
-
type UnionStrictOmit<type, keys extends keyof type> = type extends any ? StrictOmit<type, keys> : never;
|
|
39
|
-
type UnionExactPartial<type> = type extends object ? ExactPartial<type> : type;
|
|
35
|
+
export type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;
|
|
36
|
+
export type UnionCompute<type> = type extends object ? Compute<type> : type;
|
|
37
|
+
export type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;
|
|
38
|
+
export type UnionStrictOmit<type, keys extends keyof type> = type extends any ? StrictOmit<type, keys> : never;
|
|
39
|
+
export type UnionExactPartial<type> = type extends object ? ExactPartial<type> : type;
|
|
40
40
|
/**
|
|
41
41
|
* @description Combines members of an intersection into a readable type.
|
|
42
42
|
*
|
|
@@ -45,7 +45,7 @@ type UnionExactPartial<type> = type extends object ? ExactPartial<type> : type;
|
|
|
45
45
|
* Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
|
|
46
46
|
* => { a: string, b: string, c: number, d: bigint }
|
|
47
47
|
*/
|
|
48
|
-
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
48
|
+
export type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
49
49
|
/**
|
|
50
50
|
* @description Assigns the properties of U onto T.
|
|
51
51
|
*
|
|
@@ -53,9 +53,8 @@ type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
|
53
53
|
* Assign<{ a: string, b: number }, { a: undefined, c: boolean }>
|
|
54
54
|
* => { a: undefined, b: number, c: boolean }
|
|
55
55
|
*/
|
|
56
|
-
type Assign<T, U> = Assign_<T, U> & U;
|
|
56
|
+
export type Assign<T, U> = Assign_<T, U> & U;
|
|
57
57
|
type Assign_<T, U> = { [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K]; };
|
|
58
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
58
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
59
59
|
//#endregion
|
|
60
|
-
export { Assign, Compute, ExactPartial, IsNarrowable, IsNever, IsUnknown, LooseOmit, MaybePromise, Merge, Mutable, OneOf, PartialBy, Prettify, RemoveUndefined, StrictOmit, UnionCompute, UnionExactPartial, UnionLooseOmit, UnionStrictOmit };
|
|
61
60
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/cjs/types/xpub.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from "./address.js";
|
|
2
2
|
//#region src/types/xpub.d.ts
|
|
3
|
-
type xPubAccount = {
|
|
3
|
+
export type xPubAccount = {
|
|
4
4
|
balance: bigint;
|
|
5
5
|
addresses: Array<{
|
|
6
6
|
address: Address;
|
|
@@ -10,5 +10,4 @@ type xPubAccount = {
|
|
|
10
10
|
}>;
|
|
11
11
|
};
|
|
12
12
|
//#endregion
|
|
13
|
-
export { xPubAccount };
|
|
14
13
|
//# sourceMappingURL=xpub.d.ts.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ErrorType } from "../errors/utils.js";
|
|
2
2
|
import { BtcRpcRequestFn, BtcRpcRequestOptions, RpcSchema } from "../types/request.js";
|
|
3
3
|
//#region src/utils/buildRequest.d.ts
|
|
4
|
-
type RequestErrorType = ErrorType;
|
|
5
|
-
declare function buildRequest<request extends BtcRpcRequestFn<RpcSchema>>(request: request, options?: BtcRpcRequestOptions): BtcRpcRequestFn;
|
|
4
|
+
export type RequestErrorType = ErrorType;
|
|
5
|
+
export declare function buildRequest<request extends BtcRpcRequestFn<RpcSchema>>(request: request, options?: BtcRpcRequestOptions): BtcRpcRequestFn;
|
|
6
6
|
/** @internal */
|
|
7
|
-
declare function shouldRetry(error: Error): boolean;
|
|
7
|
+
export declare function shouldRetry(error: Error): boolean;
|
|
8
8
|
//#endregion
|
|
9
|
-
export { RequestErrorType, buildRequest, shouldRetry };
|
|
10
9
|
//# sourceMappingURL=buildRequest.d.ts.map
|
|
@@ -16,6 +16,7 @@ function buildRequest(request, options = {}) {
|
|
|
16
16
|
const { method } = args;
|
|
17
17
|
if (methods?.exclude?.includes(method)) throw new require_errors_rpc.MethodNotSupportedRpcError(method);
|
|
18
18
|
if (methods?.include && !methods.include.includes(method)) throw new require_errors_rpc.MethodNotSupportedRpcError(method);
|
|
19
|
+
const requestId = dedupe ? require_utils_converter.stringToHex(`${uid}.${require_utils_stringify.stringify(args)}`) : void 0;
|
|
19
20
|
return require_utils_withDedupe.withDedupe(() => require_utils_withRetry.withRetry(async () => {
|
|
20
21
|
try {
|
|
21
22
|
return await request(args);
|
|
@@ -42,7 +43,7 @@ function buildRequest(request, options = {}) {
|
|
|
42
43
|
shouldRetry: ({ error }) => shouldRetry(error)
|
|
43
44
|
}), {
|
|
44
45
|
enabled: dedupe,
|
|
45
|
-
id:
|
|
46
|
+
id: requestId
|
|
46
47
|
});
|
|
47
48
|
};
|
|
48
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRequest.js","names":["MethodNotSupportedRpcError","
|
|
1
|
+
{"version":3,"file":"buildRequest.js","names":["MethodNotSupportedRpcError","stringToHex","stringify","withDedupe","withRetry","UserRejectedRequestError","BaseError","HttpRequestError"],"sources":["../../../src/utils/buildRequest.ts"],"sourcesContent":["import { BaseError } from '../errors/base.js'\nimport { HttpRequestError } from '../errors/request.js'\nimport {\n MethodNotSupportedRpcError,\n RpcErrorCode,\n UserRejectedRequestError,\n} from '../errors/rpc.js'\nimport type { ErrorType } from '../errors/utils.js'\nimport type {\n BtcRpcRequestFn,\n BtcRpcRequestOptions,\n RpcSchema,\n} from '../types/request.js'\nimport { stringToHex } from './converter.js'\nimport { stringify } from './stringify.js'\nimport { withDedupe } from './withDedupe.js'\nimport { withRetry } from './withRetry.js'\n\nexport type RequestErrorType = ErrorType\n\nexport function buildRequest<request extends BtcRpcRequestFn<RpcSchema>>(\n request: request,\n options: BtcRpcRequestOptions = {}\n): BtcRpcRequestFn {\n return async (args, overrideOptions = {}) => {\n const {\n dedupe = false,\n methods,\n retryDelay = 150,\n retryCount = 3,\n uid,\n } = {\n ...options,\n ...overrideOptions,\n }\n\n const { method } = args\n if (methods?.exclude?.includes(method)) {\n throw new MethodNotSupportedRpcError(method)\n }\n if (methods?.include && !methods.include.includes(method)) {\n throw new MethodNotSupportedRpcError(method)\n }\n\n const requestId = dedupe\n ? stringToHex(`${uid}.${stringify(args)}`)\n : undefined\n return withDedupe(\n () =>\n withRetry(\n async () => {\n try {\n return await request(args)\n } catch (err_) {\n const err = err_ as unknown as BaseError\n switch (err.code) {\n case RpcErrorCode.METHOD_NOT_SUPPORTED:\n throw new MethodNotSupportedRpcError(method)\n\n case RpcErrorCode.USER_REJECTION:\n throw new UserRejectedRequestError(err.message)\n\n // CAIP-25: User Rejected Error\n // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25\n case 5000:\n throw new UserRejectedRequestError(err.message)\n\n default:\n if (err_ instanceof BaseError) {\n throw err_\n }\n throw new BaseError('Unknown Error', { cause: err_ as Error })\n }\n }\n },\n {\n delay: ({ count, error }) => {\n // If we find a Retry-After header, let's retry after the given time.\n if (error && error instanceof HttpRequestError) {\n const retryAfter = error?.headers?.get('Retry-After')\n if (retryAfter?.match(/\\d/)) {\n return Number.parseInt(retryAfter, 10) * 1000\n }\n }\n\n // Otherwise, let's retry with an exponential backoff.\n return ~~(1 << count) * retryDelay\n },\n retryCount,\n shouldRetry: ({ error }) => shouldRetry(error),\n }\n ),\n { enabled: dedupe, id: requestId }\n )\n }\n}\n\n/** @internal */\nexport function shouldRetry(error: Error): boolean {\n if ('code' in error && typeof error.code === 'number') {\n if (error.code === -1) {\n return true // Unknown error\n }\n if (error.code === RpcErrorCode.INTERNAL_ERROR) {\n return true\n }\n return false\n }\n if (error instanceof HttpRequestError && error.status) {\n // Forbidden\n if (error.status === 403) {\n return true\n }\n // Request Timeout\n if (error.status === 408) {\n return true\n }\n // Request Entity Too Large\n if (error.status === 413) {\n return true\n }\n // Too Many Requests\n if (error.status === 429) {\n return true\n }\n // Internal Server Error\n if (error.status === 500) {\n return true\n }\n // Bad Gateway\n if (error.status === 502) {\n return true\n }\n // Service Unavailable\n if (error.status === 503) {\n return true\n }\n // Gateway Timeout\n if (error.status === 504) {\n return true\n }\n return false\n }\n return true\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAgB,aACd,SACA,UAAgC,CAAC,GAChB;CACjB,OAAO,OAAO,MAAM,kBAAkB,CAAC,MAAM;EAC3C,MAAM,EACJ,SAAS,OACT,SACA,aAAa,KACb,aAAa,GACb,QACE;GACF,GAAG;GACH,GAAG;EACL;EAEA,MAAM,EAAE,WAAW;EACnB,IAAI,SAAS,SAAS,SAAS,MAAM,GACnC,MAAM,IAAIA,mBAAAA,2BAA2B,MAAM;EAE7C,IAAI,SAAS,WAAW,CAAC,QAAQ,QAAQ,SAAS,MAAM,GACtD,MAAM,IAAIA,mBAAAA,2BAA2B,MAAM;EAG7C,MAAM,YAAY,SACdC,wBAAAA,YAAY,GAAG,IAAI,GAAGC,wBAAAA,UAAU,IAAI,GAAG,IACvC,KAAA;EACJ,OAAOC,yBAAAA,iBAEHC,wBAAAA,UACE,YAAY;GACV,IAAI;IACF,OAAO,MAAM,QAAQ,IAAI;GAC3B,SAAS,MAAM;IACb,MAAM,MAAM;IACZ,QAAQ,IAAI,MAAZ;KACE,KAAA,QACE,MAAM,IAAIJ,mBAAAA,2BAA2B,MAAM;KAE7C,KAAA,OACE,MAAM,IAAIK,mBAAAA,yBAAyB,IAAI,OAAO;KAIhD,KAAK,KACH,MAAM,IAAIA,mBAAAA,yBAAyB,IAAI,OAAO;KAEhD;MACE,IAAI,gBAAgBC,oBAAAA,WAClB,MAAM;MAER,MAAM,IAAIA,oBAAAA,UAAU,iBAAiB,EAAE,OAAO,KAAc,CAAC;IACjE;GACF;EACF,GACA;GACE,QAAQ,EAAE,OAAO,YAAY;IAE3B,IAAI,SAAS,iBAAiBC,uBAAAA,kBAAkB;KAC9C,MAAM,aAAa,OAAO,SAAS,IAAI,aAAa;KACpD,IAAI,YAAY,MAAM,IAAI,GACxB,OAAO,OAAO,SAAS,YAAY,EAAE,IAAI;IAE7C;IAGA,OAAO,CAAC,EAAE,KAAK,SAAS;GAC1B;GACA;GACA,cAAc,EAAE,YAAY,YAAY,KAAK;EAC/C,CACF,GACF;GAAE,SAAS;GAAQ,IAAI;EAAU,CACnC;CACF;AACF;;AAGA,SAAgB,YAAY,OAAuB;CACjD,IAAI,UAAU,SAAS,OAAO,MAAM,SAAS,UAAU;EACrD,IAAI,MAAM,SAAS,IACjB,OAAO;EAET,IAAI,MAAM,SAAA,QACR,OAAO;EAET,OAAO;CACT;CACA,IAAI,iBAAiBA,uBAAAA,oBAAoB,MAAM,QAAQ;EAErD,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAGT,IAAI,MAAM,WAAW,KACnB,OAAO;EAET,OAAO;CACT;CACA,OAAO;AACT"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Psbt } from "bitcoinjs-lib";
|
|
2
2
|
//#region src/utils/cancelTransaction.d.ts
|
|
3
|
-
declare function cancelTransaction(psbt: Psbt, accountAddress: string): Psbt;
|
|
3
|
+
export declare function cancelTransaction(psbt: Psbt, accountAddress: string): Psbt;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { cancelTransaction };
|
|
6
5
|
//# sourceMappingURL=cancelTransaction.d.ts.map
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
//#region src/utils/converter.d.ts
|
|
2
|
-
declare function hexToBase64(hex: string): string;
|
|
3
|
-
declare function base64ToHex(base64: string): string;
|
|
4
|
-
declare function base64urlEncode(str: string): string;
|
|
5
|
-
declare function stringToHex(value: string): string;
|
|
6
|
-
declare function hexToUnit8Array(value: string): Uint8Array;
|
|
2
|
+
export declare function hexToBase64(hex: string): string;
|
|
3
|
+
export declare function base64ToHex(base64: string): string;
|
|
4
|
+
export declare function base64urlEncode(str: string): string;
|
|
5
|
+
export declare function stringToHex(value: string): string;
|
|
6
|
+
export declare function hexToUnit8Array(value: string): Uint8Array;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { base64ToHex, base64urlEncode, hexToBase64, hexToUnit8Array, stringToHex };
|
|
9
8
|
//# sourceMappingURL=converter.d.ts.map
|
|
@@ -13,9 +13,8 @@ type CreateBatchSchedulerReturnType<parameters = unknown, returnType extends rea
|
|
|
13
13
|
flush: () => void;
|
|
14
14
|
schedule: parameters extends undefined ? (args?: parameters | undefined) => Promise<Resolved<returnType>> : (args: parameters) => Promise<Resolved<returnType>>;
|
|
15
15
|
};
|
|
16
|
-
type CreateBatchSchedulerErrorType = ErrorType;
|
|
16
|
+
export type CreateBatchSchedulerErrorType = ErrorType;
|
|
17
17
|
/** @internal */
|
|
18
|
-
declare function createBatchScheduler<parameters, returnType extends readonly unknown[]>({ fn, id, shouldSplitBatch, wait, sort }: CreateBatchSchedulerArguments<parameters, returnType>): CreateBatchSchedulerReturnType<parameters, returnType>;
|
|
18
|
+
export declare function createBatchScheduler<parameters, returnType extends readonly unknown[]>({ fn, id, shouldSplitBatch, wait, sort }: CreateBatchSchedulerArguments<parameters, returnType>): CreateBatchSchedulerReturnType<parameters, returnType>;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { CreateBatchSchedulerErrorType, createBatchScheduler };
|
|
21
20
|
//# sourceMappingURL=createBatchScheduler.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/utils/deepEqual.d.ts
|
|
2
2
|
/** Forked from https://github.com/epoberezkin/fast-deep-equal */
|
|
3
|
-
declare function deepEqual(a: any, b: any): boolean;
|
|
3
|
+
export declare function deepEqual(a: any, b: any): boolean;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { deepEqual };
|
|
6
5
|
//# sourceMappingURL=deepEqual.d.ts.map
|
|
@@ -13,9 +13,8 @@ import { WalletActions } from "../clients/decorators/wallet.js";
|
|
|
13
13
|
* Useful for extracting overridden actions from a client (ie. if a consumer
|
|
14
14
|
* wants to override the `sendTransaction` implementation).
|
|
15
15
|
*/
|
|
16
|
-
declare function getAction<transport extends Transport, chain extends Chain | undefined, account extends Account | undefined, rpcSchema extends UTXOSchema | undefined, extended extends {
|
|
16
|
+
export declare function getAction<transport extends Transport, chain extends Chain | undefined, account extends Account | undefined, rpcSchema extends UTXOSchema | undefined, extended extends {
|
|
17
17
|
[key: string]: unknown;
|
|
18
18
|
}, client extends Client<transport, chain, account, rpcSchema, extended>, parameters, returnType>(client: client, actionFn: (_: any, parameters: parameters) => returnType, name: keyof PublicActions | keyof WalletActions | (string & {})): (parameters: parameters) => returnType;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { getAction };
|
|
21
20
|
//# sourceMappingURL=getAction.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ChainId } from "../types/chain.js";
|
|
2
2
|
import { Address, AddressInfo } from "../types/address.js";
|
|
3
3
|
//#region src/utils/getAddressInfo.d.ts
|
|
4
|
-
declare const getAddressInfo: (address: Address) => AddressInfo;
|
|
5
|
-
declare const getAddressChainId: (address: Address) => ChainId;
|
|
4
|
+
export declare const getAddressInfo: (address: Address) => AddressInfo;
|
|
5
|
+
export declare const getAddressChainId: (address: Address) => ChainId;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { getAddressChainId, getAddressInfo };
|
|
8
7
|
//# sourceMappingURL=getAddressInfo.d.ts.map
|
|
@@ -68,7 +68,8 @@ const getAddressInfo = (address) => {
|
|
|
68
68
|
if (length !== 25) throw new Error("Invalid address");
|
|
69
69
|
const version = decoded[0];
|
|
70
70
|
const checksum = decoded.slice(length - 4, length);
|
|
71
|
-
const
|
|
71
|
+
const body = decoded.slice(0, length - 4);
|
|
72
|
+
const expectedChecksum = (0, _noble_hashes_sha256.sha256)((0, _noble_hashes_sha256.sha256)(body)).slice(0, 4);
|
|
72
73
|
if (checksum.some((value, index) => value !== expectedChecksum[index])) throw new Error("Invalid address");
|
|
73
74
|
if (!Object.keys(addressTypes).map(Number).includes(version)) throw new Error("Invalid address");
|
|
74
75
|
const addressType = addressTypes[version];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAddressInfo.js","names":["bech32m"],"sources":["../../../src/utils/getAddressInfo.ts"],"sourcesContent":["import { sha256 } from '@noble/hashes/sha256'\nimport { bech32, bech32m, type Decoded } from 'bech32'\nimport bs58 from 'bs58'\n\nimport {\n type Address,\n type AddressInfo,\n type AddressPurpose,\n AddressType,\n} from '../types/address.js'\nimport { ChainId, Network } from '../types/chain.js'\n\nconst addressTypes: {\n [key: number]: { type: AddressType; network: Network }\n} = {\n 0: {\n type: AddressType.p2pkh,\n network: Network.Mainnet,\n },\n 111: {\n type: AddressType.p2pkh,\n network: Network.Testnet,\n },\n 5: {\n type: AddressType.p2sh,\n network: Network.Mainnet,\n },\n 196: {\n type: AddressType.p2sh,\n network: Network.Testnet,\n },\n}\n\nconst parseBech32 = (address: Address): AddressInfo => {\n let decoded: Decoded\n\n try {\n if (\n address.startsWith('bc1p') ||\n address.startsWith('tb1p') ||\n address.startsWith('bcrt1p')\n ) {\n decoded = bech32m.decode(address)\n } else {\n decoded = bech32.decode(address)\n }\n } catch (_error) {\n throw new Error('Invalid address')\n }\n\n const mapPrefixToNetwork: { [key: string]: Network } = {\n bc: Network.Mainnet,\n tb: Network.Testnet,\n bcrt: Network.Regtest,\n }\n\n const network: Network = mapPrefixToNetwork[decoded.prefix]\n\n if (network === undefined) {\n throw new Error('Invalid address')\n }\n\n const witnessVersion = decoded.words[0]\n\n if (witnessVersion < 0 || witnessVersion > 16) {\n throw new Error('Invalid address')\n }\n const data = bech32.fromWords(decoded.words.slice(1))\n\n let type: AddressType\n if (data.length === 20) {\n type = AddressType.p2wpkh\n } else if (witnessVersion === 1) {\n type = AddressType.p2tr\n } else {\n type = AddressType.p2wsh\n }\n\n const purpose = getAddressPurpose(type)\n\n return {\n bech32: true,\n network,\n address,\n type,\n purpose,\n }\n}\n\nexport const getAddressInfo = (address: Address): AddressInfo => {\n let decoded: Uint8Array\n const prefix = address.substring(0, 2).toLowerCase()\n\n if (prefix === 'bc' || prefix === 'tb') {\n return parseBech32(address)\n }\n\n try {\n decoded = bs58.decode(address)\n } catch (_error) {\n throw new Error('Invalid address')\n }\n\n const { length } = decoded\n\n if (length !== 25) {\n throw new Error('Invalid address')\n }\n\n const version = decoded[0]\n\n const checksum = decoded.slice(length - 4, length)\n const body = decoded.slice(0, length - 4)\n\n const expectedChecksum = sha256(sha256(body)).slice(0, 4)\n\n if (\n checksum.some(\n (value: number, index: number) => value !== expectedChecksum[index]\n )\n ) {\n throw new Error('Invalid address')\n }\n\n const validVersions = Object.keys(addressTypes).map(Number)\n\n if (!validVersions.includes(version)) {\n throw new Error('Invalid address')\n }\n\n const addressType = addressTypes[version]\n\n return {\n ...addressType,\n address,\n bech32: false,\n purpose: getAddressPurpose(addressType.type),\n }\n}\n\nconst getAddressPurpose = (type: AddressType): AddressPurpose => {\n switch (type) {\n case AddressType.p2tr:\n return 'ordinals'\n case AddressType.p2wsh:\n return 'stacks'\n case AddressType.p2wpkh:\n case AddressType.p2sh:\n case AddressType.p2pkh:\n return 'payment'\n default:\n throw new Error('Invalid address type')\n }\n}\n\nexport const getAddressChainId = (address: Address): ChainId => {\n const addressInfo = getAddressInfo(address)\n\n switch (addressInfo.network) {\n case Network.Mainnet:\n return ChainId.BITCOIN_MAINNET\n case Network.Testnet:\n return ChainId.BITCOIN_TESTNET\n case Network.Regtest:\n return ChainId.BITCOIN_SIGNET\n default:\n return ChainId.BITCOIN_MAINNET\n }\n}\n"],"mappings":";;;;;;;;;AAYA,MAAM,eAEF;CACF,GAAG;EACD,MAAA;EACA,SAAA;CACF;CACA,KAAK;EACH,MAAA;EACA,SAAA;CACF;CACA,GAAG;EACD,MAAA;EACA,SAAA;CACF;CACA,KAAK;EACH,MAAA;EACA,SAAA;CACF;AACF;AAEA,MAAM,eAAe,YAAkC;CACrD,IAAI;CAEJ,IAAI;EACF,IACE,QAAQ,WAAW,MAAM,KACzB,QAAQ,WAAW,MAAM,KACzB,QAAQ,WAAW,QAAQ,GAE3B,UAAUA,OAAAA,QAAQ,OAAO,OAAO;OAEhC,UAAU,OAAA,OAAO,OAAO,OAAO;CAEnC,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,iBAAiB;CACnC;CAQA,MAAM,UAAmB;EALvB,IAAA;EACA,IAAA;EACA,MAAA;CAGwC,EAAE,QAAQ;CAEpD,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MAAM,iBAAiB;CAGnC,MAAM,iBAAiB,QAAQ,MAAM;CAErC,IAAI,iBAAiB,KAAK,iBAAiB,IACzC,MAAM,IAAI,MAAM,iBAAiB;CAEnC,MAAM,OAAO,OAAA,OAAO,UAAU,QAAQ,MAAM,MAAM,CAAC,CAAC;CAEpD,IAAI;CACJ,IAAI,KAAK,WAAW,IAClB,OAAA;MACK,IAAI,mBAAmB,GAC5B,OAAA;MAEA,OAAA;CAGF,MAAM,UAAU,kBAAkB,IAAI;CAEtC,OAAO;EACL,QAAQ;EACR;EACA;EACA;EACA;CACF;AACF;AAEA,MAAa,kBAAkB,YAAkC;CAC/D,IAAI;CACJ,MAAM,SAAS,QAAQ,UAAU,GAAG,CAAC,CAAC,CAAC,YAAY;CAEnD,IAAI,WAAW,QAAQ,WAAW,MAChC,OAAO,YAAY,OAAO;CAG5B,IAAI;EACF,UAAU,KAAA,QAAK,OAAO,OAAO;CAC/B,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,iBAAiB;CACnC;CAEA,MAAM,EAAE,WAAW;CAEnB,IAAI,WAAW,IACb,MAAM,IAAI,MAAM,iBAAiB;CAGnC,MAAM,UAAU,QAAQ;CAExB,MAAM,WAAW,QAAQ,MAAM,SAAS,GAAG,MAAM;
|
|
1
|
+
{"version":3,"file":"getAddressInfo.js","names":["bech32m","sha256"],"sources":["../../../src/utils/getAddressInfo.ts"],"sourcesContent":["import { sha256 } from '@noble/hashes/sha256'\nimport { bech32, bech32m, type Decoded } from 'bech32'\nimport bs58 from 'bs58'\n\nimport {\n type Address,\n type AddressInfo,\n type AddressPurpose,\n AddressType,\n} from '../types/address.js'\nimport { ChainId, Network } from '../types/chain.js'\n\nconst addressTypes: {\n [key: number]: { type: AddressType; network: Network }\n} = {\n 0: {\n type: AddressType.p2pkh,\n network: Network.Mainnet,\n },\n 111: {\n type: AddressType.p2pkh,\n network: Network.Testnet,\n },\n 5: {\n type: AddressType.p2sh,\n network: Network.Mainnet,\n },\n 196: {\n type: AddressType.p2sh,\n network: Network.Testnet,\n },\n}\n\nconst parseBech32 = (address: Address): AddressInfo => {\n let decoded: Decoded\n\n try {\n if (\n address.startsWith('bc1p') ||\n address.startsWith('tb1p') ||\n address.startsWith('bcrt1p')\n ) {\n decoded = bech32m.decode(address)\n } else {\n decoded = bech32.decode(address)\n }\n } catch (_error) {\n throw new Error('Invalid address')\n }\n\n const mapPrefixToNetwork: { [key: string]: Network } = {\n bc: Network.Mainnet,\n tb: Network.Testnet,\n bcrt: Network.Regtest,\n }\n\n const network: Network = mapPrefixToNetwork[decoded.prefix]\n\n if (network === undefined) {\n throw new Error('Invalid address')\n }\n\n const witnessVersion = decoded.words[0]\n\n if (witnessVersion < 0 || witnessVersion > 16) {\n throw new Error('Invalid address')\n }\n const data = bech32.fromWords(decoded.words.slice(1))\n\n let type: AddressType\n if (data.length === 20) {\n type = AddressType.p2wpkh\n } else if (witnessVersion === 1) {\n type = AddressType.p2tr\n } else {\n type = AddressType.p2wsh\n }\n\n const purpose = getAddressPurpose(type)\n\n return {\n bech32: true,\n network,\n address,\n type,\n purpose,\n }\n}\n\nexport const getAddressInfo = (address: Address): AddressInfo => {\n let decoded: Uint8Array\n const prefix = address.substring(0, 2).toLowerCase()\n\n if (prefix === 'bc' || prefix === 'tb') {\n return parseBech32(address)\n }\n\n try {\n decoded = bs58.decode(address)\n } catch (_error) {\n throw new Error('Invalid address')\n }\n\n const { length } = decoded\n\n if (length !== 25) {\n throw new Error('Invalid address')\n }\n\n const version = decoded[0]\n\n const checksum = decoded.slice(length - 4, length)\n const body = decoded.slice(0, length - 4)\n\n const expectedChecksum = sha256(sha256(body)).slice(0, 4)\n\n if (\n checksum.some(\n (value: number, index: number) => value !== expectedChecksum[index]\n )\n ) {\n throw new Error('Invalid address')\n }\n\n const validVersions = Object.keys(addressTypes).map(Number)\n\n if (!validVersions.includes(version)) {\n throw new Error('Invalid address')\n }\n\n const addressType = addressTypes[version]\n\n return {\n ...addressType,\n address,\n bech32: false,\n purpose: getAddressPurpose(addressType.type),\n }\n}\n\nconst getAddressPurpose = (type: AddressType): AddressPurpose => {\n switch (type) {\n case AddressType.p2tr:\n return 'ordinals'\n case AddressType.p2wsh:\n return 'stacks'\n case AddressType.p2wpkh:\n case AddressType.p2sh:\n case AddressType.p2pkh:\n return 'payment'\n default:\n throw new Error('Invalid address type')\n }\n}\n\nexport const getAddressChainId = (address: Address): ChainId => {\n const addressInfo = getAddressInfo(address)\n\n switch (addressInfo.network) {\n case Network.Mainnet:\n return ChainId.BITCOIN_MAINNET\n case Network.Testnet:\n return ChainId.BITCOIN_TESTNET\n case Network.Regtest:\n return ChainId.BITCOIN_SIGNET\n default:\n return ChainId.BITCOIN_MAINNET\n }\n}\n"],"mappings":";;;;;;;;;AAYA,MAAM,eAEF;CACF,GAAG;EACD,MAAA;EACA,SAAA;CACF;CACA,KAAK;EACH,MAAA;EACA,SAAA;CACF;CACA,GAAG;EACD,MAAA;EACA,SAAA;CACF;CACA,KAAK;EACH,MAAA;EACA,SAAA;CACF;AACF;AAEA,MAAM,eAAe,YAAkC;CACrD,IAAI;CAEJ,IAAI;EACF,IACE,QAAQ,WAAW,MAAM,KACzB,QAAQ,WAAW,MAAM,KACzB,QAAQ,WAAW,QAAQ,GAE3B,UAAUA,OAAAA,QAAQ,OAAO,OAAO;OAEhC,UAAU,OAAA,OAAO,OAAO,OAAO;CAEnC,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,iBAAiB;CACnC;CAQA,MAAM,UAAmB;EALvB,IAAA;EACA,IAAA;EACA,MAAA;CAGwC,EAAE,QAAQ;CAEpD,IAAI,YAAY,KAAA,GACd,MAAM,IAAI,MAAM,iBAAiB;CAGnC,MAAM,iBAAiB,QAAQ,MAAM;CAErC,IAAI,iBAAiB,KAAK,iBAAiB,IACzC,MAAM,IAAI,MAAM,iBAAiB;CAEnC,MAAM,OAAO,OAAA,OAAO,UAAU,QAAQ,MAAM,MAAM,CAAC,CAAC;CAEpD,IAAI;CACJ,IAAI,KAAK,WAAW,IAClB,OAAA;MACK,IAAI,mBAAmB,GAC5B,OAAA;MAEA,OAAA;CAGF,MAAM,UAAU,kBAAkB,IAAI;CAEtC,OAAO;EACL,QAAQ;EACR;EACA;EACA;EACA;CACF;AACF;AAEA,MAAa,kBAAkB,YAAkC;CAC/D,IAAI;CACJ,MAAM,SAAS,QAAQ,UAAU,GAAG,CAAC,CAAC,CAAC,YAAY;CAEnD,IAAI,WAAW,QAAQ,WAAW,MAChC,OAAO,YAAY,OAAO;CAG5B,IAAI;EACF,UAAU,KAAA,QAAK,OAAO,OAAO;CAC/B,SAAS,QAAQ;EACf,MAAM,IAAI,MAAM,iBAAiB;CACnC;CAEA,MAAM,EAAE,WAAW;CAEnB,IAAI,WAAW,IACb,MAAM,IAAI,MAAM,iBAAiB;CAGnC,MAAM,UAAU,QAAQ;CAExB,MAAM,WAAW,QAAQ,MAAM,SAAS,GAAG,MAAM;CACjD,MAAM,OAAO,QAAQ,MAAM,GAAG,SAAS,CAAC;CAExC,MAAM,oBAAA,GAAmBC,qBAAAA,OAAAA,EAAAA,GAAOA,qBAAAA,OAAAA,CAAO,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC;CAExD,IACE,SAAS,MACN,OAAe,UAAkB,UAAU,iBAAiB,MAC/D,GAEA,MAAM,IAAI,MAAM,iBAAiB;CAKnC,IAAI,CAFkB,OAAO,KAAK,YAAY,CAAC,CAAC,IAAI,MAEnC,CAAC,CAAC,SAAS,OAAO,GACjC,MAAM,IAAI,MAAM,iBAAiB;CAGnC,MAAM,cAAc,aAAa;CAEjC,OAAO;EACL,GAAG;EACH;EACA,QAAQ;EACR,SAAS,kBAAkB,YAAY,IAAI;CAC7C;AACF;AAEA,MAAM,qBAAqB,SAAsC;CAC/D,QAAQ,MAAR;EACE,KAAA,QACE,OAAO;EACT,KAAA,SACE,OAAO;EACT,KAAA;EACA,KAAA;EACA,KAAA,SACE,OAAO;EACT,SACE,MAAM,IAAI,MAAM,sBAAsB;CAC1C;AACF;AAEA,MAAa,qBAAqB,YAA8B;CAG9D,QAFoB,eAAe,OAEjB,CAAC,CAAC,SAApB;EACE,KAAA,WACE,OAAA;EACF,KAAA,WACE,OAAA;EACF,KAAA,WACE,OAAA;EACF,SACE,OAAA;CACJ;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Network } from "../types/chain.js";
|
|
2
2
|
//#region src/utils/isAddress.d.ts
|
|
3
|
-
declare const isAddress: (address: string, network?: Network) => boolean;
|
|
3
|
+
export declare const isAddress: (address: string, network?: Network) => boolean;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { isAddress };
|
|
6
5
|
//# sourceMappingURL=isAddress.d.ts.map
|
package/dist/cjs/utils/lru.d.ts
CHANGED
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU
|
|
6
6
|
*/
|
|
7
|
-
declare class LruMap<value = unknown> extends Map<string, value> {
|
|
7
|
+
export declare class LruMap<value = unknown> extends Map<string, value> {
|
|
8
8
|
maxSize: number;
|
|
9
9
|
constructor(size: number);
|
|
10
10
|
override get(key: string): value | undefined;
|
|
11
11
|
override set(key: string, value: value): this;
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
export { LruMap };
|
|
15
14
|
//# sourceMappingURL=lru.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Psbt } from "bitcoinjs-lib";
|
|
2
2
|
//#region src/utils/modifyFee.d.ts
|
|
3
|
-
declare function modifyFee(psbt: Psbt, newFee: bigint, accountAddress: string): Psbt;
|
|
3
|
+
export declare function modifyFee(psbt: Psbt, newFee: bigint, accountAddress: string): Psbt;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { modifyFee };
|
|
6
5
|
//# sourceMappingURL=modifyFee.d.ts.map
|
|
@@ -3,19 +3,18 @@ import { MaybePromise } from "../types/utils.js";
|
|
|
3
3
|
type Callback = ((...args: any[]) => any) | undefined;
|
|
4
4
|
type Callbacks = Record<string, Callback>;
|
|
5
5
|
/** @internal */
|
|
6
|
-
declare const listenersCache: Map<string, {
|
|
6
|
+
export declare const listenersCache: Map<string, {
|
|
7
7
|
id: number;
|
|
8
8
|
fns: Callbacks;
|
|
9
9
|
}[]>;
|
|
10
10
|
/** @internal */
|
|
11
|
-
declare const cleanupCache: Map<string, () => void>;
|
|
11
|
+
export declare const cleanupCache: Map<string, () => void>;
|
|
12
12
|
type EmitFunction<callbacks extends Callbacks> = (emit: callbacks) => MaybePromise<void | (() => void)>;
|
|
13
13
|
/**
|
|
14
14
|
* @description Sets up an observer for a given function. If another function
|
|
15
15
|
* is set up under the same observer id, the function will only be called once
|
|
16
16
|
* for both instances of the observer.
|
|
17
17
|
*/
|
|
18
|
-
declare function observe<callbacks extends Callbacks>(observerId: string, callbacks: callbacks, fn: EmitFunction<callbacks>): () => void;
|
|
18
|
+
export declare function observe<callbacks extends Callbacks>(observerId: string, callbacks: callbacks, fn: EmitFunction<callbacks>): () => void;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { cleanupCache, listenersCache, observe };
|
|
21
20
|
//# sourceMappingURL=observe.d.ts.map
|
|
@@ -2,8 +2,7 @@ import { Address } from "../types/address.js";
|
|
|
2
2
|
import { Account } from "../types/account.js";
|
|
3
3
|
import { ErrorType } from "../errors/utils.js";
|
|
4
4
|
//#region src/utils/parseAccount.d.ts
|
|
5
|
-
type ParseAccountErrorType = ErrorType;
|
|
6
|
-
declare function parseAccount<accountOrAddress extends Address | Account>(account: accountOrAddress): accountOrAddress extends Address ? Account : accountOrAddress;
|
|
5
|
+
export type ParseAccountErrorType = ErrorType;
|
|
6
|
+
export declare function parseAccount<accountOrAddress extends Address | Account>(account: accountOrAddress): accountOrAddress extends Address ? Account : accountOrAddress;
|
|
7
7
|
//#endregion
|
|
8
|
-
export { ParseAccountErrorType, parseAccount };
|
|
9
8
|
//# sourceMappingURL=parseAccount.d.ts.map
|
package/dist/cjs/utils/poll.d.ts
CHANGED
|
@@ -7,9 +7,8 @@ type PollOptions<T> = {
|
|
|
7
7
|
/**
|
|
8
8
|
* @description Polls a function at a specified interval.
|
|
9
9
|
*/
|
|
10
|
-
declare function poll<T>(fn: ({ unpoll }: {
|
|
10
|
+
export declare function poll<T>(fn: ({ unpoll }: {
|
|
11
11
|
unpoll: () => void;
|
|
12
12
|
}) => Promise<T | undefined>, { emitOnBegin, initialWaitTime, interval }: PollOptions<T>): () => void;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { poll };
|
|
15
14
|
//# sourceMappingURL=poll.d.ts.map
|
package/dist/cjs/utils/poll.js
CHANGED
|
@@ -12,7 +12,8 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
|
|
|
12
12
|
const watch = async () => {
|
|
13
13
|
let data;
|
|
14
14
|
if (emitOnBegin) data = await fn({ unpoll: unwatch });
|
|
15
|
-
|
|
15
|
+
const initialWait = await initialWaitTime?.(data) ?? interval;
|
|
16
|
+
await require_utils_sleep.sleep(initialWait);
|
|
16
17
|
const poll = async () => {
|
|
17
18
|
if (!active) return;
|
|
18
19
|
await fn({ unpoll: unwatch });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poll.js","names":["sleep"],"sources":["../../../src/utils/poll.ts"],"sourcesContent":["import { sleep } from './sleep.js'\n\ntype PollOptions<T> = {\n // Whether or not to emit when the polling starts.\n emitOnBegin?: boolean | undefined\n // The initial wait time (in ms) before polling.\n initialWaitTime?: ((data: T | undefined) => Promise<number>) | undefined\n // The interval (in ms).\n interval: number\n}\n\n/**\n * @description Polls a function at a specified interval.\n */\nexport function poll<T>(\n fn: ({ unpoll }: { unpoll: () => void }) => Promise<T | undefined>,\n { emitOnBegin, initialWaitTime, interval }: PollOptions<T>\n): () => void {\n let active = true\n\n const unwatch = () => {\n active = false\n }\n\n const watch = async () => {\n let data: T | undefined\n if (emitOnBegin) {\n data = await fn({ unpoll: unwatch })\n }\n\n const initialWait = (await initialWaitTime?.(data)) ?? interval\n await sleep(initialWait)\n\n const poll = async () => {\n if (!active) {\n return\n }\n await fn({ unpoll: unwatch })\n await sleep(interval)\n poll()\n }\n\n poll()\n }\n watch()\n\n return unwatch\n}\n"],"mappings":";;;;;;AAcA,SAAgB,KACd,IACA,EAAE,aAAa,iBAAiB,YACpB;CACZ,IAAI,SAAS;CAEb,MAAM,gBAAgB;EACpB,SAAS;CACX;CAEA,MAAM,QAAQ,YAAY;EACxB,IAAI;EACJ,IAAI,aACF,OAAO,MAAM,GAAG,EAAE,QAAQ,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"poll.js","names":["sleep"],"sources":["../../../src/utils/poll.ts"],"sourcesContent":["import { sleep } from './sleep.js'\n\ntype PollOptions<T> = {\n // Whether or not to emit when the polling starts.\n emitOnBegin?: boolean | undefined\n // The initial wait time (in ms) before polling.\n initialWaitTime?: ((data: T | undefined) => Promise<number>) | undefined\n // The interval (in ms).\n interval: number\n}\n\n/**\n * @description Polls a function at a specified interval.\n */\nexport function poll<T>(\n fn: ({ unpoll }: { unpoll: () => void }) => Promise<T | undefined>,\n { emitOnBegin, initialWaitTime, interval }: PollOptions<T>\n): () => void {\n let active = true\n\n const unwatch = () => {\n active = false\n }\n\n const watch = async () => {\n let data: T | undefined\n if (emitOnBegin) {\n data = await fn({ unpoll: unwatch })\n }\n\n const initialWait = (await initialWaitTime?.(data)) ?? interval\n await sleep(initialWait)\n\n const poll = async () => {\n if (!active) {\n return\n }\n await fn({ unpoll: unwatch })\n await sleep(interval)\n poll()\n }\n\n poll()\n }\n watch()\n\n return unwatch\n}\n"],"mappings":";;;;;;AAcA,SAAgB,KACd,IACA,EAAE,aAAa,iBAAiB,YACpB;CACZ,IAAI,SAAS;CAEb,MAAM,gBAAgB;EACpB,SAAS;CACX;CAEA,MAAM,QAAQ,YAAY;EACxB,IAAI;EACJ,IAAI,aACF,OAAO,MAAM,GAAG,EAAE,QAAQ,QAAQ,CAAC;EAGrC,MAAM,cAAe,MAAM,kBAAkB,IAAI,KAAM;EACvD,MAAMA,oBAAAA,MAAM,WAAW;EAEvB,MAAM,OAAO,YAAY;GACvB,IAAI,CAAC,QACH;GAEF,MAAM,GAAG,EAAE,QAAQ,QAAQ,CAAC;GAC5B,MAAMA,oBAAAA,MAAM,QAAQ;GACpB,KAAK;EACP;EAEA,KAAK;CACP;CACA,MAAM;CAEN,OAAO;AACT"}
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
* { timeout: 5000, interval: 100 }
|
|
15
15
|
* )
|
|
16
16
|
*/
|
|
17
|
-
declare function retryUntil<T>(condition: () => Promise<T | undefined | null | false>, options?: {
|
|
17
|
+
export declare function retryUntil<T>(condition: () => Promise<T | undefined | null | false>, options?: {
|
|
18
18
|
/** Maximum time to wait in milliseconds (default: 5000ms) */
|
|
19
19
|
timeout?: number;
|
|
20
20
|
/** Interval between checks in milliseconds (default: 100ms) */
|
|
21
21
|
interval?: number;
|
|
22
22
|
}): Promise<T | undefined>;
|
|
23
23
|
//#endregion
|
|
24
|
-
export { retryUntil };
|
|
25
24
|
//# sourceMappingURL=retryUntil.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ErrorType } from "../errors/utils.js";
|
|
2
2
|
//#region src/utils/stringify.d.ts
|
|
3
|
-
type StringifyErrorType = ErrorType;
|
|
4
|
-
declare const stringify: typeof JSON.stringify;
|
|
3
|
+
export type StringifyErrorType = ErrorType;
|
|
4
|
+
export declare const stringify: typeof JSON.stringify;
|
|
5
5
|
//#endregion
|
|
6
|
-
export { StringifyErrorType, stringify };
|
|
7
6
|
//# sourceMappingURL=stringify.d.ts.map
|
package/dist/cjs/utils/uid.d.ts
CHANGED
package/dist/cjs/utils/url.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/utils/url.d.ts
|
|
2
|
-
declare const urlWithParams: (url: string, params: Record<string, string | number | undefined>) => string;
|
|
2
|
+
export declare const urlWithParams: (url: string, params: Record<string, string | number | undefined>) => string;
|
|
3
3
|
//#endregion
|
|
4
|
-
export { urlWithParams };
|
|
5
4
|
//# sourceMappingURL=url.d.ts.map
|
package/dist/cjs/utils/wait.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { LruMap } from "./lru.js";
|
|
2
2
|
//#region src/utils/withDedupe.d.ts
|
|
3
3
|
/** @internal */
|
|
4
|
-
declare const promiseCache: LruMap<Promise<any>>;
|
|
4
|
+
export declare const promiseCache: LruMap<Promise<any>>;
|
|
5
5
|
type WithDedupeOptions = {
|
|
6
6
|
enabled?: boolean | undefined;
|
|
7
7
|
id?: string | undefined;
|
|
8
8
|
};
|
|
9
9
|
/** Deduplicates in-flight promises. */
|
|
10
|
-
declare function withDedupe<data>(fn: () => Promise<data>, { enabled, id }: WithDedupeOptions): Promise<data>;
|
|
10
|
+
export declare function withDedupe<data>(fn: () => Promise<data>, { enabled, id }: WithDedupeOptions): Promise<data>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { promiseCache, withDedupe };
|
|
13
12
|
//# sourceMappingURL=withDedupe.d.ts.map
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/utils/withResolvers.d.ts
|
|
2
2
|
/** @internal */
|
|
3
|
-
type PromiseWithResolvers<type> = {
|
|
3
|
+
export type PromiseWithResolvers<type> = {
|
|
4
4
|
promise: Promise<type>;
|
|
5
5
|
resolve: (value: type | PromiseLike<type>) => void;
|
|
6
6
|
reject: (reason?: unknown) => void;
|
|
7
7
|
};
|
|
8
8
|
/** @internal */
|
|
9
|
-
declare function withResolvers<type>(): PromiseWithResolvers<type>;
|
|
9
|
+
export declare function withResolvers<type>(): PromiseWithResolvers<type>;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { PromiseWithResolvers, withResolvers };
|
|
12
11
|
//# sourceMappingURL=withResolvers.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ErrorType } from "../errors/utils.js";
|
|
2
2
|
//#region src/utils/withRetry.d.ts
|
|
3
|
-
type WithRetryParameters = {
|
|
3
|
+
export type WithRetryParameters = {
|
|
4
4
|
delay?: ((config: {
|
|
5
5
|
count: number;
|
|
6
6
|
error: Error;
|
|
@@ -11,8 +11,7 @@ type WithRetryParameters = {
|
|
|
11
11
|
error: Error;
|
|
12
12
|
}) => Promise<boolean> | boolean) | undefined;
|
|
13
13
|
};
|
|
14
|
-
type WithRetryErrorType = ErrorType;
|
|
15
|
-
declare function withRetry<data>(fn: () => Promise<data>, { delay: delay_, retryCount, shouldRetry }?: WithRetryParameters): Promise<data>;
|
|
14
|
+
export type WithRetryErrorType = ErrorType;
|
|
15
|
+
export declare function withRetry<data>(fn: () => Promise<data>, { delay: delay_, retryCount, shouldRetry }?: WithRetryParameters): Promise<data>;
|
|
16
16
|
//#endregion
|
|
17
|
-
export { WithRetryErrorType, WithRetryParameters, withRetry };
|
|
18
17
|
//# sourceMappingURL=withRetry.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorType } from "../errors/utils.js";
|
|
2
2
|
//#region src/utils/withTimeout.d.ts
|
|
3
|
-
type WithTimeoutErrorType = ErrorType;
|
|
4
|
-
declare function withTimeout<data>(fn: ({ signal }: {
|
|
3
|
+
export type WithTimeoutErrorType = ErrorType;
|
|
4
|
+
export declare function withTimeout<data>(fn: ({ signal }: {
|
|
5
5
|
signal: AbortController["signal"] | null;
|
|
6
6
|
}) => Promise<data>, { errorInstance, timeout, signal }: {
|
|
7
7
|
errorInstance?: Error | undefined;
|
|
@@ -9,5 +9,4 @@ declare function withTimeout<data>(fn: ({ signal }: {
|
|
|
9
9
|
signal?: boolean | undefined;
|
|
10
10
|
}): Promise<data>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { WithTimeoutErrorType, withTimeout };
|
|
13
12
|
//# sourceMappingURL=withTimeout.d.ts.map
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/version.d.ts
|
|
2
|
-
declare const name = "@bigmi/core";
|
|
3
|
-
declare const version = "0.9.
|
|
2
|
+
export declare const name = "@bigmi/core";
|
|
3
|
+
export declare const version = "0.9.1";
|
|
4
4
|
//#endregion
|
|
5
|
-
export { name, version };
|
|
6
5
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@bigmi/core'\nexport const version = '0.9.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/version.ts"],"sourcesContent":["export const name = '@bigmi/core'\nexport const version = '0.9.1'\n"],"mappings":";;AAAA,MAAa,OAAO;AACpB,MAAa,UAAU"}
|
package/dist/cjs/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {}
|
|
@@ -4,12 +4,11 @@ import { Account } from "../types/account.js";
|
|
|
4
4
|
import { Transport } from "../types/transport.js";
|
|
5
5
|
import { Client } from "../types/client.js";
|
|
6
6
|
//#region src/actions/getBalance.d.ts
|
|
7
|
-
type GetBalanceParameters = {
|
|
7
|
+
export type GetBalanceParameters = {
|
|
8
8
|
/** The address of the account. */
|
|
9
9
|
address: string;
|
|
10
10
|
};
|
|
11
|
-
type GetBalanceReturnType = bigint;
|
|
12
|
-
declare function getBalance<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, params: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
|
11
|
+
export type GetBalanceReturnType = bigint;
|
|
12
|
+
export declare function getBalance<C extends Chain | undefined, A extends Account | undefined = Account | undefined>(client: Client<Transport, C, A, UTXOSchema>, params: GetBalanceParameters): Promise<GetBalanceReturnType>;
|
|
13
13
|
//#endregion
|
|
14
|
-
export { GetBalanceParameters, GetBalanceReturnType, getBalance };
|
|
15
14
|
//# sourceMappingURL=getBalance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.d.ts","names":[],"sources":["../../../src/actions/getBalance.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"getBalance.d.ts","names":[],"sources":["../../../src/actions/getBalance.ts"],"mappings":";;;;;;YAMY;;EAEV;;YAGU;wBAEU,WACpB,UAAU,mBACV,UAAU,sBAAsB,qBAEhC,QAAQ,OAAO,WAAW,GAAG,GAAG,aAChC,QAAQ,uBACP,QAAQ"}
|