mainnet-js 0.5.8 → 1.0.0-rc.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/dist/index.html +9 -1
- package/dist/mainnet-1.0.0-rc.1.js +2928 -0
- package/dist/module/chain.d.ts +1 -0
- package/dist/module/chain.d.ts.map +1 -0
- package/dist/module/cli.d.ts +1 -0
- package/dist/module/cli.d.ts.map +1 -0
- package/dist/module/cli.js +2 -2
- package/dist/module/cli.js.map +1 -1
- package/dist/module/constant.d.ts +1 -0
- package/dist/module/constant.d.ts.map +1 -0
- package/dist/module/db/ExchangeRateProvider.d.ts +2 -1
- package/dist/module/db/ExchangeRateProvider.d.ts.map +1 -0
- package/dist/module/db/IndexedDBProvider.d.ts +3 -2
- package/dist/module/db/IndexedDBProvider.d.ts.map +1 -0
- package/dist/module/db/SqlProvider.d.ts +7 -8
- package/dist/module/db/SqlProvider.d.ts.map +1 -0
- package/dist/module/db/SqlProvider.js +10 -8
- package/dist/module/db/SqlProvider.js.map +1 -1
- package/dist/module/db/StorageProvider.d.ts +2 -1
- package/dist/module/db/StorageProvider.d.ts.map +1 -0
- package/dist/module/db/getStorageProvider.d.ts +3 -0
- package/dist/module/db/getStorageProvider.d.ts.map +1 -0
- package/dist/module/db/getStorageProvider.js +19 -0
- package/dist/module/db/getStorageProvider.js.map +1 -0
- package/dist/module/db/index.d.ts +4 -3
- package/dist/module/db/index.d.ts.map +1 -0
- package/dist/module/db/index.js +2 -2
- package/dist/module/db/index.js.map +1 -1
- package/dist/module/db/interface.d.ts +1 -0
- package/dist/module/db/interface.d.ts.map +1 -0
- package/dist/module/db/util.d.ts +2 -3
- package/dist/module/db/util.d.ts.map +1 -0
- package/dist/module/db/util.js +0 -17
- package/dist/module/db/util.js.map +1 -1
- package/dist/module/enum.d.ts +1 -0
- package/dist/module/enum.d.ts.map +1 -0
- package/dist/module/history/electrumTransformer.d.ts +3 -2
- package/dist/module/history/electrumTransformer.d.ts.map +1 -0
- package/dist/module/history/electrumTransformer.js +16 -14
- package/dist/module/history/electrumTransformer.js.map +1 -1
- package/dist/module/history/interface.d.ts +2 -1
- package/dist/module/history/interface.d.ts.map +1 -0
- package/dist/module/index.d.ts +26 -21
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +25 -17
- package/dist/module/index.js.map +1 -1
- package/dist/module/interface.d.ts +14 -0
- package/dist/module/interface.d.ts.map +1 -0
- package/dist/module/interface.js +5 -0
- package/dist/module/interface.js.map +1 -1
- package/dist/module/message/index.d.ts +3 -2
- package/dist/module/message/index.d.ts.map +1 -0
- package/dist/module/message/index.js +2 -2
- package/dist/module/message/index.js.map +1 -1
- package/dist/module/message/interface.d.ts +1 -0
- package/dist/module/message/interface.d.ts.map +1 -0
- package/dist/module/message/signed.d.ts +2 -1
- package/dist/module/message/signed.d.ts.map +1 -0
- package/dist/module/message/signed.js +10 -4
- package/dist/module/message/signed.js.map +1 -1
- package/dist/module/mine/index.d.ts +2 -1
- package/dist/module/mine/index.d.ts.map +1 -0
- package/dist/module/mine/index.js +1 -1
- package/dist/module/mine/index.js.map +1 -1
- package/dist/module/mine/mine.d.ts +1 -0
- package/dist/module/mine/mine.d.ts.map +1 -0
- package/dist/module/mine/mine.js +3 -3
- package/dist/module/mine/mine.js.map +1 -1
- package/dist/module/network/Connection.d.ts +3 -2
- package/dist/module/network/Connection.d.ts.map +1 -0
- package/dist/module/network/Connection.js +3 -3
- package/dist/module/network/Connection.js.map +1 -1
- package/dist/module/network/ElectrumNetworkProvider.d.ts +8 -5
- package/dist/module/network/ElectrumNetworkProvider.d.ts.map +1 -0
- package/dist/module/network/ElectrumNetworkProvider.js +59 -13
- package/dist/module/network/ElectrumNetworkProvider.js.map +1 -1
- package/dist/module/network/NetworkProvider.d.ts +2 -1
- package/dist/module/network/NetworkProvider.d.ts.map +1 -0
- package/dist/module/network/configuration.d.ts +8 -10
- package/dist/module/network/configuration.d.ts.map +1 -0
- package/dist/module/network/configuration.js +29 -17
- package/dist/module/network/configuration.js.map +1 -1
- package/dist/module/network/constant.d.ts +1 -0
- package/dist/module/network/constant.d.ts.map +1 -0
- package/dist/module/network/constant.js +8 -4
- package/dist/module/network/constant.js.map +1 -1
- package/dist/module/network/default.d.ts +4 -3
- package/dist/module/network/default.d.ts.map +1 -0
- package/dist/module/network/default.js +7 -7
- package/dist/module/network/default.js.map +1 -1
- package/dist/module/network/getRelayFeeCache.d.ts +2 -1
- package/dist/module/network/getRelayFeeCache.d.ts.map +1 -0
- package/dist/module/network/getRelayFeeCache.js +2 -2
- package/dist/module/network/getRelayFeeCache.js.map +1 -1
- package/dist/module/network/index.d.ts +3 -2
- package/dist/module/network/index.d.ts.map +1 -0
- package/dist/module/network/index.js +2 -2
- package/dist/module/network/index.js.map +1 -1
- package/dist/module/network/interface.d.ts +1 -0
- package/dist/module/network/interface.d.ts.map +1 -0
- package/dist/module/network/util.d.ts +2 -1
- package/dist/module/network/util.d.ts.map +1 -0
- package/dist/module/qr/Qr.d.ts +2 -1
- package/dist/module/qr/Qr.d.ts.map +1 -0
- package/dist/module/qr/Qr.js +2 -2
- package/dist/module/qr/Qr.js.map +1 -1
- package/dist/module/qr/interface.d.ts +1 -0
- package/dist/module/qr/interface.d.ts.map +1 -0
- package/dist/module/rate/ExchangeRate.d.ts +1 -0
- package/dist/module/rate/ExchangeRate.d.ts.map +1 -0
- package/dist/module/rate/ExchangeRate.js +5 -5
- package/dist/module/rate/ExchangeRate.js.map +1 -1
- package/dist/module/slp/GsppProvider.d.ts +4 -3
- package/dist/module/slp/GsppProvider.d.ts.map +1 -0
- package/dist/module/slp/GsppProvider.js +7 -7
- package/dist/module/slp/GsppProvider.js.map +1 -1
- package/dist/module/slp/SlpDbProvider.d.ts +4 -3
- package/dist/module/slp/SlpDbProvider.d.ts.map +1 -0
- package/dist/module/slp/SlpDbProvider.js +8 -8
- package/dist/module/slp/SlpDbProvider.js.map +1 -1
- package/dist/module/slp/SlpDbTemplates.d.ts +1 -0
- package/dist/module/slp/SlpDbTemplates.d.ts.map +1 -0
- package/dist/module/slp/SlpLibAuth.d.ts +7 -14
- package/dist/module/slp/SlpLibAuth.d.ts.map +1 -0
- package/dist/module/slp/SlpLibAuth.js +48 -39
- package/dist/module/slp/SlpLibAuth.js.map +1 -1
- package/dist/module/slp/SlpProvider.d.ts +2 -1
- package/dist/module/slp/SlpProvider.d.ts.map +1 -0
- package/dist/module/slp/SlpProvider.js.map +1 -1
- package/dist/module/slp/index.d.ts +5 -4
- package/dist/module/slp/index.d.ts.map +1 -0
- package/dist/module/slp/index.js +3 -3
- package/dist/module/slp/index.js.map +1 -1
- package/dist/module/slp/interface.d.ts +2 -1
- package/dist/module/slp/interface.d.ts.map +1 -0
- package/dist/module/test/axios.d.ts +3 -0
- package/dist/module/test/axios.d.ts.map +1 -0
- package/dist/module/test/axios.js +35 -0
- package/dist/module/test/axios.js.map +1 -0
- package/dist/module/test/expect.d.ts +6 -1
- package/dist/module/test/expect.d.ts.map +1 -0
- package/dist/module/test/expect.js +22 -1
- package/dist/module/test/expect.js.map +1 -1
- package/dist/module/transaction/Wif.d.ts +19 -16
- package/dist/module/transaction/Wif.d.ts.map +1 -0
- package/dist/module/transaction/Wif.js +152 -55
- package/dist/module/transaction/Wif.js.map +1 -1
- package/dist/module/transaction/allocateFee.d.ts +5 -4
- package/dist/module/transaction/allocateFee.d.ts.map +1 -0
- package/dist/module/transaction/allocateFee.js +11 -8
- package/dist/module/transaction/allocateFee.js.map +1 -1
- package/dist/module/util/amountInSatoshi.d.ts +1 -0
- package/dist/module/util/amountInSatoshi.d.ts.map +1 -0
- package/dist/module/util/amountInSatoshi.js +4 -4
- package/dist/module/util/amountInSatoshi.js.map +1 -1
- package/dist/module/util/asSendRequestObject.d.ts +3 -2
- package/dist/module/util/asSendRequestObject.d.ts.map +1 -0
- package/dist/module/util/asSendRequestObject.js +6 -3
- package/dist/module/util/asSendRequestObject.js.map +1 -1
- package/dist/module/util/balanceObjectFromSatoshi.d.ts +1 -0
- package/dist/module/util/balanceObjectFromSatoshi.d.ts.map +1 -0
- package/dist/module/util/balanceObjectFromSatoshi.js +5 -5
- package/dist/module/util/balanceObjectFromSatoshi.js.map +1 -1
- package/dist/module/util/base64.d.ts +2 -1
- package/dist/module/util/base64.d.ts.map +1 -0
- package/dist/module/util/base64.js +5 -25
- package/dist/module/util/base64.js.map +1 -1
- package/dist/module/util/bchaddr.d.ts +1 -0
- package/dist/module/util/bchaddr.d.ts.map +1 -0
- package/dist/module/util/browserNotSupported.d.ts +1 -0
- package/dist/module/util/browserNotSupported.d.ts.map +1 -0
- package/dist/module/util/browserNotSupported.js +1 -1
- package/dist/module/util/browserNotSupported.js.map +1 -1
- package/dist/module/util/checkForEmptySeed.d.ts +1 -0
- package/dist/module/util/checkForEmptySeed.d.ts.map +1 -0
- package/dist/module/util/checkWifNetwork.d.ts +2 -1
- package/dist/module/util/checkWifNetwork.d.ts.map +1 -0
- package/dist/module/util/checkWifNetwork.js +1 -1
- package/dist/module/util/checkWifNetwork.js.map +1 -1
- package/dist/module/util/convert.d.ts +1 -0
- package/dist/module/util/convert.d.ts.map +1 -0
- package/dist/module/util/convert.js +2 -2
- package/dist/module/util/convert.js.map +1 -1
- package/dist/module/util/delay.d.ts +1 -0
- package/dist/module/util/delay.d.ts.map +1 -0
- package/dist/module/util/deriveCashaddr.d.ts +6 -1
- package/dist/module/util/deriveCashaddr.d.ts.map +1 -0
- package/dist/module/util/deriveCashaddr.js +85 -6
- package/dist/module/util/deriveCashaddr.js.map +1 -1
- package/dist/module/util/deriveLockscript.d.ts +1 -0
- package/dist/module/util/deriveLockscript.d.ts.map +1 -0
- package/dist/module/util/deriveNetwork.d.ts +1 -0
- package/dist/module/util/deriveNetwork.d.ts.map +1 -0
- package/dist/module/util/deriveNetwork.js +2 -2
- package/dist/module/util/deriveNetwork.js.map +1 -1
- package/dist/module/util/derivePublicKeyHash.d.ts +3 -1
- package/dist/module/util/derivePublicKeyHash.d.ts.map +1 -0
- package/dist/module/util/derivePublicKeyHash.js +1 -1
- package/dist/module/util/derivePublicKeyHash.js.map +1 -1
- package/dist/module/util/eventsource.d.ts +1 -0
- package/dist/module/util/eventsource.d.ts.map +1 -0
- package/dist/module/util/eventsource.js +3 -2
- package/dist/module/util/eventsource.js.map +1 -1
- package/dist/module/util/floor.d.ts +1 -0
- package/dist/module/util/floor.d.ts.map +1 -0
- package/dist/module/util/getAddrsByXpubKey.d.ts +8 -8
- package/dist/module/util/getAddrsByXpubKey.d.ts.map +1 -0
- package/dist/module/util/getAddrsByXpubKey.js +17 -21
- package/dist/module/util/getAddrsByXpubKey.js.map +1 -1
- package/dist/module/util/getRuntimePlatform.d.ts +1 -0
- package/dist/module/util/getRuntimePlatform.d.ts.map +1 -0
- package/dist/module/util/getUsdRate.d.ts +1 -0
- package/dist/module/util/getUsdRate.d.ts.map +1 -0
- package/dist/module/util/getUsdRate.js +1 -1
- package/dist/module/util/getUsdRate.js.map +1 -1
- package/dist/module/util/getXPubKey.d.ts +2 -1
- package/dist/module/util/getXPubKey.d.ts.map +1 -0
- package/dist/module/util/getXPubKey.js +6 -7
- package/dist/module/util/getXPubKey.js.map +1 -1
- package/dist/module/util/hash160.d.ts +2 -1
- package/dist/module/util/hash160.d.ts.map +1 -0
- package/dist/module/util/hash160.js +2 -4
- package/dist/module/util/hash160.js.map +1 -1
- package/dist/module/util/index.d.ts +21 -20
- package/dist/module/util/index.d.ts.map +1 -0
- package/dist/module/util/index.js +20 -20
- package/dist/module/util/index.js.map +1 -1
- package/dist/module/util/randomBytes.d.ts +3 -1
- package/dist/module/util/randomBytes.d.ts.map +1 -0
- package/dist/module/util/randomBytes.js +2 -3
- package/dist/module/util/randomBytes.js.map +1 -1
- package/dist/module/util/randomInt.d.ts +1 -0
- package/dist/module/util/randomInt.d.ts.map +1 -0
- package/dist/module/util/randomValues.d.ts +1 -0
- package/dist/module/util/randomValues.d.ts.map +1 -0
- package/dist/module/util/randomValues.js +7 -7
- package/dist/module/util/randomValues.js.map +1 -1
- package/dist/module/util/sanitizeAddress.d.ts +1 -0
- package/dist/module/util/sanitizeAddress.d.ts.map +1 -0
- package/dist/module/util/sanitizeAddress.js +1 -1
- package/dist/module/util/sanitizeAddress.js.map +1 -1
- package/dist/module/util/sanitizeUnit.d.ts +2 -1
- package/dist/module/util/sanitizeUnit.d.ts.map +1 -0
- package/dist/module/util/satoshiToAmount.d.ts +1 -0
- package/dist/module/util/satoshiToAmount.d.ts.map +1 -0
- package/dist/module/util/satoshiToAmount.js +4 -4
- package/dist/module/util/satoshiToAmount.js.map +1 -1
- package/dist/module/util/sumSendRequestAmounts.d.ts +3 -2
- package/dist/module/util/sumSendRequestAmounts.d.ts.map +1 -0
- package/dist/module/util/sumSendRequestAmounts.js +5 -2
- package/dist/module/util/sumSendRequestAmounts.js.map +1 -1
- package/dist/module/util/sumUtxoValue.d.ts +4 -2
- package/dist/module/util/sumUtxoValue.d.ts.map +1 -0
- package/dist/module/util/sumUtxoValue.js +17 -3
- package/dist/module/util/sumUtxoValue.js.map +1 -1
- package/dist/module/util/transaction.d.ts +2 -0
- package/dist/module/util/transaction.d.ts.map +1 -0
- package/dist/module/util/transaction.js +7 -0
- package/dist/module/util/transaction.js.map +1 -0
- package/dist/module/wallet/Base.d.ts +8 -7
- package/dist/module/wallet/Base.d.ts.map +1 -0
- package/dist/module/wallet/Base.js +7 -7
- package/dist/module/wallet/Base.js.map +1 -1
- package/dist/module/wallet/Bcmr.d.ts +88 -0
- package/dist/module/wallet/Bcmr.d.ts.map +1 -0
- package/dist/module/wallet/Bcmr.js +281 -0
- package/dist/module/wallet/Bcmr.js.map +1 -0
- package/dist/module/wallet/Slp.d.ts +6 -5
- package/dist/module/wallet/Slp.d.ts.map +1 -0
- package/dist/module/wallet/Slp.js +15 -15
- package/dist/module/wallet/Slp.js.map +1 -1
- package/dist/module/wallet/Util.d.ts +3 -2
- package/dist/module/wallet/Util.d.ts.map +1 -0
- package/dist/module/wallet/Util.js +9 -14
- package/dist/module/wallet/Util.js.map +1 -1
- package/dist/module/wallet/Wif.d.ts +124 -20
- package/dist/module/wallet/Wif.d.ts.map +1 -0
- package/dist/module/wallet/Wif.js +406 -74
- package/dist/module/wallet/Wif.js.map +1 -1
- package/dist/module/wallet/bcmr-v1.schema.d.ts +623 -0
- package/dist/module/wallet/bcmr-v1.schema.d.ts.map +1 -0
- package/dist/module/wallet/bcmr-v1.schema.js +2 -0
- package/dist/module/wallet/bcmr-v1.schema.js.map +1 -0
- package/dist/module/wallet/createWallet.d.ts +3 -2
- package/dist/module/wallet/createWallet.d.ts.map +1 -0
- package/dist/module/wallet/createWallet.js +3 -3
- package/dist/module/wallet/createWallet.js.map +1 -1
- package/dist/module/wallet/enum.d.ts +1 -0
- package/dist/module/wallet/enum.d.ts.map +1 -0
- package/dist/module/wallet/interface.d.ts +10 -6
- package/dist/module/wallet/interface.d.ts.map +1 -0
- package/dist/module/wallet/model.d.ts +81 -5
- package/dist/module/wallet/model.d.ts.map +1 -0
- package/dist/module/wallet/model.js +102 -17
- package/dist/module/wallet/model.js.map +1 -1
- package/dist/module/webhook/Webhook.d.ts +3 -2
- package/dist/module/webhook/Webhook.d.ts.map +1 -0
- package/dist/module/webhook/Webhook.js +4 -1
- package/dist/module/webhook/Webhook.js.map +1 -1
- package/dist/module/webhook/WebhookBch.d.ts +4 -3
- package/dist/module/webhook/WebhookBch.d.ts.map +1 -0
- package/dist/module/webhook/WebhookBch.js +4 -4
- package/dist/module/webhook/WebhookBch.js.map +1 -1
- package/dist/module/webhook/WebhookSlp.d.ts +5 -4
- package/dist/module/webhook/WebhookSlp.d.ts.map +1 -0
- package/dist/module/webhook/WebhookSlp.js +4 -4
- package/dist/module/webhook/WebhookSlp.js.map +1 -1
- package/dist/module/webhook/WebhookWorker.d.ts +3 -2
- package/dist/module/webhook/WebhookWorker.d.ts.map +1 -0
- package/dist/module/webhook/WebhookWorker.js +1 -1
- package/dist/module/webhook/WebhookWorker.js.map +1 -1
- package/dist/module/webhook/index.d.ts +6 -5
- package/dist/module/webhook/index.d.ts.map +1 -0
- package/dist/module/webhook/index.js +5 -5
- package/dist/module/webhook/index.js.map +1 -1
- package/dist/module/webhook/interface.d.ts +1 -0
- package/dist/module/webhook/interface.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/polyfill/{bip39.browser.js → bip39.browser.cjs} +1 -0
- package/polyfill/{util.js → util.cjs} +0 -0
- package/src/Wallet.test.headless.js +6 -6
- package/src/Wallet.test.ts +69 -1
- package/src/cli.ts +3 -3
- package/src/db/ExchangeRateProvider.ts +1 -1
- package/src/db/IndexedDBProvider.test.ts +0 -1
- package/src/db/IndexedDBProvider.ts +2 -2
- package/src/db/SqlProvider.ts +14 -12
- package/src/db/StorageProvider.ts +1 -1
- package/src/db/getStorageProvider.ts +20 -0
- package/src/db/index.ts +3 -3
- package/src/db/util.ts +1 -20
- package/src/history/electrumTransformer.test.ts +1 -2
- package/src/history/electrumTransformer.ts +19 -18
- package/src/history/interface.ts +1 -1
- package/src/index.ts +29 -21
- package/src/interface.ts +15 -0
- package/src/message/index.ts +2 -2
- package/src/message/signed.test.ts +4 -4
- package/src/message/signed.ts +23 -6
- package/src/mine/index.ts +1 -1
- package/src/mine/mine.ts +3 -3
- package/src/network/Connection.ts +5 -5
- package/src/network/ElectrumNetworkProvider.ts +85 -20
- package/src/network/NetworkProvider.ts +1 -1
- package/src/network/configuration.test.ts +33 -8
- package/src/network/configuration.ts +33 -18
- package/src/network/constant.ts +9 -4
- package/src/network/default.ts +13 -10
- package/src/network/getRelayFeeCache.ts +3 -3
- package/src/network/index.ts +6 -2
- package/src/network/util.ts +1 -1
- package/src/qr/Qr.ts +3 -3
- package/src/rate/ExchangeRate.ts +14 -15
- package/src/slp/GsppProvider.test.ts +2 -2
- package/src/slp/GsppProvider.ts +11 -8
- package/src/slp/SlpDbProvider.test.ts +1 -1
- package/src/slp/SlpDbProvider.ts +12 -9
- package/src/slp/SlpLibAuth.test.ts +1 -1
- package/src/slp/SlpLibAuth.ts +52 -42
- package/src/slp/SlpProvider.ts +6 -1
- package/src/slp/index.ts +4 -4
- package/src/slp/interface.ts +1 -1
- package/src/test/axios.ts +47 -0
- package/src/test/expect.ts +27 -2
- package/src/transaction/Wif.ts +203 -77
- package/src/transaction/allocateFee.ts +32 -14
- package/src/util/amountInSatoshi.ts +4 -4
- package/src/util/asSendRequestObject.ts +42 -30
- package/src/util/balanceObjectFromSatoshi.ts +5 -5
- package/src/util/base64.ts +5 -24
- package/src/util/browserNotSupported.ts +1 -1
- package/src/util/checkWifNetwork.ts +1 -1
- package/src/util/convert.ts +2 -2
- package/src/util/deriveCashaddr.test.ts +43 -0
- package/src/util/deriveCashaddr.ts +123 -7
- package/src/util/deriveNetwork.ts +2 -2
- package/src/util/derivePublicKeyHash.test.ts +3 -0
- package/src/util/derivePublicKeyHash.ts +18 -5
- package/src/util/eventsource.ts +4 -2
- package/src/util/getAddrsByXpubKey.test.ts +5 -5
- package/src/util/getAddrsByXpubKey.ts +23 -28
- package/src/util/getUsdRate.ts +1 -1
- package/src/util/getXPubKey.ts +5 -7
- package/src/util/hash160.test.ts +2 -2
- package/src/util/hash160.ts +2 -4
- package/src/util/index.ts +26 -20
- package/src/util/randomBytes.ts +2 -3
- package/src/util/randomValues.ts +8 -8
- package/src/util/sanitizeAddress.ts +1 -1
- package/src/util/sanitizeUnit.ts +1 -1
- package/src/util/satoshiToAmount.ts +4 -4
- package/src/util/sumSendRequestAmounts.ts +10 -4
- package/src/util/sumUtxoValue.ts +19 -7
- package/src/util/transaction.ts +10 -0
- package/src/wallet/Base.ts +11 -11
- package/src/wallet/Bcmr.test.headless.js +353 -0
- package/src/wallet/Bcmr.test.ts +610 -0
- package/src/wallet/Bcmr.ts +390 -0
- package/src/wallet/Cashtokens.test.headless.js +467 -0
- package/src/wallet/Cashtokens.test.ts +475 -0
- package/src/wallet/Slp.test.headless.js +6 -8
- package/src/wallet/Slp.test.ts +2 -2
- package/src/wallet/Slp.ts +26 -22
- package/src/wallet/Util.ts +9 -20
- package/src/wallet/Wif.test.ts +20 -21
- package/src/wallet/Wif.ts +534 -99
- package/src/wallet/bcmr-v1.schema.ts +639 -0
- package/src/wallet/createWallet.test.ts +1 -0
- package/src/wallet/createWallet.ts +4 -4
- package/src/wallet/interface.ts +9 -6
- package/src/wallet/model.ts +190 -19
- package/src/webhook/Webhook.ts +7 -3
- package/src/webhook/WebhookBch.ts +7 -7
- package/src/webhook/WebhookSlp.test.ts +2 -2
- package/src/webhook/WebhookSlp.ts +6 -6
- package/src/webhook/WebhookWorker.ts +2 -2
- package/src/webhook/index.ts +5 -5
- package/tsconfig.browser.json +0 -3
- package/tsconfig.json +17 -5
- package/{webpack.config.js → webpack.config.cjs} +46 -14
- package/dist/main/chain.d.ts +0 -3
- package/dist/main/chain.js +0 -7
- package/dist/main/chain.js.map +0 -1
- package/dist/main/cli.d.ts +0 -1
- package/dist/main/cli.js +0 -35
- package/dist/main/cli.js.map +0 -1
- package/dist/main/constant.d.ts +0 -5
- package/dist/main/constant.js +0 -27
- package/dist/main/constant.js.map +0 -1
- package/dist/main/db/ExchangeRateProvider.d.ts +0 -11
- package/dist/main/db/ExchangeRateProvider.js +0 -47
- package/dist/main/db/ExchangeRateProvider.js.map +0 -1
- package/dist/main/db/IndexedDBProvider.d.ts +0 -15
- package/dist/main/db/IndexedDBProvider.js +0 -86
- package/dist/main/db/IndexedDBProvider.js.map +0 -1
- package/dist/main/db/SqlProvider.d.ts +0 -41
- package/dist/main/db/SqlProvider.js +0 -217
- package/dist/main/db/SqlProvider.js.map +0 -1
- package/dist/main/db/StorageProvider.d.ts +0 -52
- package/dist/main/db/StorageProvider.js +0 -3
- package/dist/main/db/StorageProvider.js.map +0 -1
- package/dist/main/db/index.d.ts +0 -3
- package/dist/main/db/index.js +0 -11
- package/dist/main/db/index.js.map +0 -1
- package/dist/main/db/interface.d.ts +0 -22
- package/dist/main/db/interface.js +0 -3
- package/dist/main/db/interface.js.map +0 -1
- package/dist/main/db/util.d.ts +0 -5
- package/dist/main/db/util.js +0 -53
- package/dist/main/db/util.js.map +0 -1
- package/dist/main/enum.d.ts +0 -33
- package/dist/main/enum.js +0 -39
- package/dist/main/enum.js.map +0 -1
- package/dist/main/history/electrumTransformer.d.ts +0 -4
- package/dist/main/history/electrumTransformer.js +0 -214
- package/dist/main/history/electrumTransformer.js.map +0 -1
- package/dist/main/history/interface.d.ts +0 -16
- package/dist/main/history/interface.js +0 -3
- package/dist/main/history/interface.js.map +0 -1
- package/dist/main/index.d.ts +0 -24
- package/dist/main/index.js +0 -62
- package/dist/main/index.js.map +0 -1
- package/dist/main/interface.d.ts +0 -31
- package/dist/main/interface.js +0 -12
- package/dist/main/interface.js.map +0 -1
- package/dist/main/message/index.d.ts +0 -2
- package/dist/main/message/index.js +0 -15
- package/dist/main/message/index.js.map +0 -1
- package/dist/main/message/interface.d.ts +0 -29
- package/dist/main/message/interface.js +0 -6
- package/dist/main/message/interface.js.map +0 -1
- package/dist/main/message/signed.d.ts +0 -33
- package/dist/main/message/signed.js +0 -141
- package/dist/main/message/signed.js.map +0 -1
- package/dist/main/mine/index.d.ts +0 -1
- package/dist/main/mine/index.js +0 -14
- package/dist/main/mine/index.js.map +0 -1
- package/dist/main/mine/mine.d.ts +0 -13
- package/dist/main/mine/mine.js +0 -37
- package/dist/main/mine/mine.js.map +0 -1
- package/dist/main/network/Connection.d.ts +0 -14
- package/dist/main/network/Connection.js +0 -71
- package/dist/main/network/Connection.js.map +0 -1
- package/dist/main/network/ElectrumNetworkProvider.d.ts +0 -49
- package/dist/main/network/ElectrumNetworkProvider.js +0 -338
- package/dist/main/network/ElectrumNetworkProvider.js.map +0 -1
- package/dist/main/network/NetworkProvider.d.ts +0 -107
- package/dist/main/network/NetworkProvider.js +0 -3
- package/dist/main/network/NetworkProvider.js.map +0 -1
- package/dist/main/network/configuration.d.ts +0 -12
- package/dist/main/network/configuration.js +0 -79
- package/dist/main/network/configuration.js.map +0 -1
- package/dist/main/network/constant.d.ts +0 -35
- package/dist/main/network/constant.js +0 -55
- package/dist/main/network/constant.js.map +0 -1
- package/dist/main/network/default.d.ts +0 -7
- package/dist/main/network/default.js +0 -107
- package/dist/main/network/default.js.map +0 -1
- package/dist/main/network/getRelayFeeCache.d.ts +0 -2
- package/dist/main/network/getRelayFeeCache.js +0 -27
- package/dist/main/network/getRelayFeeCache.js.map +0 -1
- package/dist/main/network/index.d.ts +0 -2
- package/dist/main/network/index.js +0 -10
- package/dist/main/network/index.js.map +0 -1
- package/dist/main/network/interface.d.ts +0 -60
- package/dist/main/network/interface.js +0 -3
- package/dist/main/network/interface.js.map +0 -1
- package/dist/main/network/util.d.ts +0 -2
- package/dist/main/network/util.js +0 -32
- package/dist/main/network/util.js.map +0 -1
- package/dist/main/qr/Qr.d.ts +0 -8
- package/dist/main/qr/Qr.js +0 -26
- package/dist/main/qr/Qr.js.map +0 -1
- package/dist/main/qr/interface.d.ts +0 -5
- package/dist/main/qr/interface.js +0 -3
- package/dist/main/qr/interface.js.map +0 -1
- package/dist/main/rate/ExchangeRate.d.ts +0 -19
- package/dist/main/rate/ExchangeRate.js +0 -147
- package/dist/main/rate/ExchangeRate.js.map +0 -1
- package/dist/main/slp/GsppProvider.d.ts +0 -54
- package/dist/main/slp/GsppProvider.js +0 -214
- package/dist/main/slp/GsppProvider.js.map +0 -1
- package/dist/main/slp/SlpDbProvider.d.ts +0 -51
- package/dist/main/slp/SlpDbProvider.js +0 -182
- package/dist/main/slp/SlpDbProvider.js.map +0 -1
- package/dist/main/slp/SlpDbTemplates.d.ts +0 -312
- package/dist/main/slp/SlpDbTemplates.js +0 -387
- package/dist/main/slp/SlpDbTemplates.js.map +0 -1
- package/dist/main/slp/SlpLibAuth.d.ts +0 -217
- package/dist/main/slp/SlpLibAuth.js +0 -452
- package/dist/main/slp/SlpLibAuth.js.map +0 -1
- package/dist/main/slp/SlpProvider.d.ts +0 -23
- package/dist/main/slp/SlpProvider.js +0 -39
- package/dist/main/slp/SlpProvider.js.map +0 -1
- package/dist/main/slp/index.d.ts +0 -5
- package/dist/main/slp/index.js +0 -24
- package/dist/main/slp/index.js.map +0 -1
- package/dist/main/slp/interface.d.ts +0 -113
- package/dist/main/slp/interface.js +0 -10
- package/dist/main/slp/interface.js.map +0 -1
- package/dist/main/test/expect.d.ts +0 -7
- package/dist/main/test/expect.js +0 -31
- package/dist/main/test/expect.js.map +0 -1
- package/dist/main/transaction/Wif.d.ts +0 -42
- package/dist/main/transaction/Wif.js +0 -214
- package/dist/main/transaction/Wif.js.map +0 -1
- package/dist/main/transaction/allocateFee.d.ts +0 -7
- package/dist/main/transaction/allocateFee.js +0 -118
- package/dist/main/transaction/allocateFee.js.map +0 -1
- package/dist/main/util/amountInSatoshi.d.ts +0 -9
- package/dist/main/util/amountInSatoshi.js +0 -38
- package/dist/main/util/amountInSatoshi.js.map +0 -1
- package/dist/main/util/asSendRequestObject.d.ts +0 -2
- package/dist/main/util/asSendRequestObject.js +0 -57
- package/dist/main/util/asSendRequestObject.js.map +0 -1
- package/dist/main/util/balanceObjectFromSatoshi.d.ts +0 -8
- package/dist/main/util/balanceObjectFromSatoshi.js +0 -62
- package/dist/main/util/balanceObjectFromSatoshi.js.map +0 -1
- package/dist/main/util/base64.d.ts +0 -2
- package/dist/main/util/base64.js +0 -36
- package/dist/main/util/base64.js.map +0 -1
- package/dist/main/util/bchaddr.d.ts +0 -1
- package/dist/main/util/bchaddr.js +0 -24
- package/dist/main/util/bchaddr.js.map +0 -1
- package/dist/main/util/browserNotSupported.d.ts +0 -1
- package/dist/main/util/browserNotSupported.js +0 -11
- package/dist/main/util/browserNotSupported.js.map +0 -1
- package/dist/main/util/checkForEmptySeed.d.ts +0 -2
- package/dist/main/util/checkForEmptySeed.js +0 -12
- package/dist/main/util/checkForEmptySeed.js.map +0 -1
- package/dist/main/util/checkWifNetwork.d.ts +0 -2
- package/dist/main/util/checkWifNetwork.js +0 -16
- package/dist/main/util/checkWifNetwork.js.map +0 -1
- package/dist/main/util/convert.d.ts +0 -15
- package/dist/main/util/convert.js +0 -24
- package/dist/main/util/convert.js.map +0 -1
- package/dist/main/util/delay.d.ts +0 -1
- package/dist/main/util/delay.js +0 -8
- package/dist/main/util/delay.js.map +0 -1
- package/dist/main/util/deriveCashaddr.d.ts +0 -2
- package/dist/main/util/deriveCashaddr.js +0 -13
- package/dist/main/util/deriveCashaddr.js.map +0 -1
- package/dist/main/util/deriveLockscript.d.ts +0 -8
- package/dist/main/util/deriveLockscript.js +0 -19
- package/dist/main/util/deriveLockscript.js.map +0 -1
- package/dist/main/util/deriveNetwork.d.ts +0 -1
- package/dist/main/util/deriveNetwork.js +0 -23
- package/dist/main/util/deriveNetwork.js.map +0 -1
- package/dist/main/util/derivePublicKeyHash.d.ts +0 -16
- package/dist/main/util/derivePublicKeyHash.js +0 -49
- package/dist/main/util/derivePublicKeyHash.js.map +0 -1
- package/dist/main/util/eventsource.d.ts +0 -2
- package/dist/main/util/eventsource.js +0 -12
- package/dist/main/util/eventsource.js.map +0 -1
- package/dist/main/util/floor.d.ts +0 -1
- package/dist/main/util/floor.js +0 -9
- package/dist/main/util/floor.js.map +0 -1
- package/dist/main/util/getAddrsByXpubKey.d.ts +0 -22
- package/dist/main/util/getAddrsByXpubKey.js +0 -79
- package/dist/main/util/getAddrsByXpubKey.js.map +0 -1
- package/dist/main/util/getRuntimePlatform.d.ts +0 -6
- package/dist/main/util/getRuntimePlatform.js +0 -34
- package/dist/main/util/getRuntimePlatform.js.map +0 -1
- package/dist/main/util/getUsdRate.d.ts +0 -1
- package/dist/main/util/getUsdRate.js +0 -9
- package/dist/main/util/getUsdRate.js.map +0 -1
- package/dist/main/util/getXPubKey.d.ts +0 -1
- package/dist/main/util/getXPubKey.js +0 -26
- package/dist/main/util/getXPubKey.js.map +0 -1
- package/dist/main/util/hash160.d.ts +0 -8
- package/dist/main/util/hash160.js +0 -18
- package/dist/main/util/hash160.js.map +0 -1
- package/dist/main/util/index.d.ts +0 -21
- package/dist/main/util/index.js +0 -72
- package/dist/main/util/index.js.map +0 -1
- package/dist/main/util/randomBytes.d.ts +0 -1
- package/dist/main/util/randomBytes.js +0 -18
- package/dist/main/util/randomBytes.js.map +0 -1
- package/dist/main/util/randomInt.d.ts +0 -1
- package/dist/main/util/randomInt.js +0 -9
- package/dist/main/util/randomInt.js.map +0 -1
- package/dist/main/util/randomValues.d.ts +0 -1
- package/dist/main/util/randomValues.js +0 -15
- package/dist/main/util/randomValues.js.map +0 -1
- package/dist/main/util/sanitizeAddress.d.ts +0 -1
- package/dist/main/util/sanitizeAddress.js +0 -15
- package/dist/main/util/sanitizeAddress.js.map +0 -1
- package/dist/main/util/sanitizeUnit.d.ts +0 -2
- package/dist/main/util/sanitizeUnit.js +0 -13
- package/dist/main/util/sanitizeUnit.js.map +0 -1
- package/dist/main/util/satoshiToAmount.d.ts +0 -9
- package/dist/main/util/satoshiToAmount.js +0 -41
- package/dist/main/util/satoshiToAmount.js.map +0 -1
- package/dist/main/util/sumSendRequestAmounts.d.ts +0 -2
- package/dist/main/util/sumSendRequestAmounts.js +0 -31
- package/dist/main/util/sumSendRequestAmounts.js.map +0 -1
- package/dist/main/util/sumUtxoValue.d.ts +0 -2
- package/dist/main/util/sumUtxoValue.js +0 -17
- package/dist/main/util/sumUtxoValue.js.map +0 -1
- package/dist/main/wallet/Base.d.ts +0 -202
- package/dist/main/wallet/Base.js +0 -438
- package/dist/main/wallet/Base.js.map +0 -1
- package/dist/main/wallet/Slp.d.ts +0 -430
- package/dist/main/wallet/Slp.js +0 -775
- package/dist/main/wallet/Slp.js.map +0 -1
- package/dist/main/wallet/Util.d.ts +0 -69
- package/dist/main/wallet/Util.js +0 -182
- package/dist/main/wallet/Util.js.map +0 -1
- package/dist/main/wallet/Wif.d.ts +0 -255
- package/dist/main/wallet/Wif.js +0 -1067
- package/dist/main/wallet/Wif.js.map +0 -1
- package/dist/main/wallet/createWallet.d.ts +0 -69
- package/dist/main/wallet/createWallet.js +0 -244
- package/dist/main/wallet/createWallet.js.map +0 -1
- package/dist/main/wallet/enum.d.ts +0 -16
- package/dist/main/wallet/enum.js +0 -22
- package/dist/main/wallet/enum.js.map +0 -1
- package/dist/main/wallet/interface.d.ts +0 -76
- package/dist/main/wallet/interface.js +0 -3
- package/dist/main/wallet/interface.js.map +0 -1
- package/dist/main/wallet/model.d.ts +0 -88
- package/dist/main/wallet/model.js +0 -129
- package/dist/main/wallet/model.js.map +0 -1
- package/dist/main/webhook/Webhook.d.ts +0 -40
- package/dist/main/webhook/Webhook.js +0 -82
- package/dist/main/webhook/Webhook.js.map +0 -1
- package/dist/main/webhook/WebhookBch.d.ts +0 -13
- package/dist/main/webhook/WebhookBch.js +0 -148
- package/dist/main/webhook/WebhookBch.js.map +0 -1
- package/dist/main/webhook/WebhookSlp.d.ts +0 -14
- package/dist/main/webhook/WebhookSlp.js +0 -107
- package/dist/main/webhook/WebhookSlp.js.map +0 -1
- package/dist/main/webhook/WebhookWorker.d.ts +0 -22
- package/dist/main/webhook/WebhookWorker.js +0 -100
- package/dist/main/webhook/WebhookWorker.js.map +0 -1
- package/dist/main/webhook/index.d.ts +0 -5
- package/dist/main/webhook/index.js +0 -23
- package/dist/main/webhook/index.js.map +0 -1
- package/dist/main/webhook/interface.d.ts +0 -8
- package/dist/main/webhook/interface.js +0 -3
- package/dist/main/webhook/interface.js.map +0 -1
- package/dist/mainnet-0.5.8.js +0 -2
- package/dist/mainnet-0.5.8.js.LICENSE.txt +0 -48
- package/dist/tsconfig.browser.tsbuildinfo +0 -1
- package/jest.config.js +0 -23
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const electrum_cash_1 = require("electrum-cash");
|
|
4
|
-
const interface_1 = require("../interface");
|
|
5
|
-
const delay_1 = require("../util/delay");
|
|
6
|
-
const async_mutex_1 = require("async-mutex");
|
|
7
|
-
const Util_1 = require("../wallet/Util");
|
|
8
|
-
class ElectrumNetworkProvider {
|
|
9
|
-
constructor(electrum, network = interface_1.Network.MAINNET, manualConnectionManagement) {
|
|
10
|
-
this.network = network;
|
|
11
|
-
this.manualConnectionManagement = manualConnectionManagement;
|
|
12
|
-
this.subscriptions = 0;
|
|
13
|
-
this.mutex = new async_mutex_1.Mutex();
|
|
14
|
-
this.blockHeight = 0;
|
|
15
|
-
if (electrum) {
|
|
16
|
-
this.electrum = electrum;
|
|
17
|
-
this.connectPromise = this.getConnectPromise();
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
throw new Error(`A electrum-cash cluster or client is required.`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async getConnectPromise(_timeout = 3000) {
|
|
24
|
-
// connects to the electrum cash and waits until the connection is ready to accept requests
|
|
25
|
-
let timeoutHandle;
|
|
26
|
-
await Promise.race([
|
|
27
|
-
new Promise(async (resolve) => {
|
|
28
|
-
this.connectPromise = undefined;
|
|
29
|
-
if (this.electrum instanceof electrum_cash_1.ElectrumCluster) {
|
|
30
|
-
try {
|
|
31
|
-
await this.connectCluster();
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
console.warn(`Unable to connect to one or more electrum-cash hosts: ${e}`);
|
|
35
|
-
}
|
|
36
|
-
resolve(await this.readyCluster());
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
resolve(await this.connectClient());
|
|
40
|
-
}
|
|
41
|
-
}),
|
|
42
|
-
// new Promise(
|
|
43
|
-
// (_resolve, reject) =>
|
|
44
|
-
// (timeoutHandle = setTimeout(() => {
|
|
45
|
-
// reject(
|
|
46
|
-
// new Error(`Timeout connecting to electrum network: ${this.network}`)
|
|
47
|
-
// );
|
|
48
|
-
// }, _timeout))
|
|
49
|
-
// ),
|
|
50
|
-
]);
|
|
51
|
-
clearTimeout(timeoutHandle);
|
|
52
|
-
}
|
|
53
|
-
async getUtxos(cashaddr) {
|
|
54
|
-
const result = (await this.performRequest("blockchain.address.listunspent", cashaddr));
|
|
55
|
-
const utxos = result.map((utxo) => ({
|
|
56
|
-
txid: utxo.tx_hash,
|
|
57
|
-
vout: utxo.tx_pos,
|
|
58
|
-
satoshis: utxo.value,
|
|
59
|
-
height: utxo.height,
|
|
60
|
-
}));
|
|
61
|
-
return utxos;
|
|
62
|
-
}
|
|
63
|
-
async getBalance(cashaddr) {
|
|
64
|
-
const result = (await this.performRequest("blockchain.address.get_balance", cashaddr));
|
|
65
|
-
return result.confirmed + result.unconfirmed;
|
|
66
|
-
}
|
|
67
|
-
async getBlockHeight() {
|
|
68
|
-
if (!this.blockHeight) {
|
|
69
|
-
return new Promise(async (resolve) => {
|
|
70
|
-
await this.subscribeToHeaders((header) => {
|
|
71
|
-
this.blockHeight = header.height;
|
|
72
|
-
});
|
|
73
|
-
resolve(this.blockHeight);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return this.blockHeight;
|
|
77
|
-
}
|
|
78
|
-
async getRawTransaction(txHash, verbose = false) {
|
|
79
|
-
try {
|
|
80
|
-
return (await this.performRequest("blockchain.transaction.get", txHash, verbose));
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
if (error.message.indexOf("No such mempool or blockchain transaction.") > -1)
|
|
84
|
-
throw Error(`Could not decode transaction ${txHash}. It might not exist on the current blockchain (${this.network}).`);
|
|
85
|
-
else
|
|
86
|
-
throw error;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
// gets the decoded transaction in human readable form
|
|
90
|
-
async getRawTransactionObject(txHash) {
|
|
91
|
-
return (await this.getRawTransaction(txHash, true));
|
|
92
|
-
}
|
|
93
|
-
async sendRawTransaction(txHex, awaitPropagation = true) {
|
|
94
|
-
return new Promise(async (resolve, reject) => {
|
|
95
|
-
let txHash = await Util_1.Util.getTransactionHash(txHex);
|
|
96
|
-
if (!awaitPropagation) {
|
|
97
|
-
this.performRequest("blockchain.transaction.broadcast", txHex);
|
|
98
|
-
resolve(txHash);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
const waitForTransactionCallback = async (data) => {
|
|
102
|
-
if (data && data[0] === txHash) {
|
|
103
|
-
this.unsubscribeFromTransaction(txHash, waitForTransactionCallback);
|
|
104
|
-
resolve(txHash);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
this.subscribeToTransaction(txHash, waitForTransactionCallback);
|
|
108
|
-
this.performRequest("blockchain.transaction.broadcast", txHex).catch((error) => {
|
|
109
|
-
this.unsubscribeFromTransaction(txHash, waitForTransactionCallback);
|
|
110
|
-
reject(error);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
// Get transaction history of a given cashaddr
|
|
116
|
-
async getHistory(cashaddr) {
|
|
117
|
-
const result = (await this.performRequest("blockchain.address.get_history", cashaddr));
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
// Get the minimum fee a low-priority transaction must pay in order to be accepted to the daemon's memory pool.
|
|
121
|
-
async getRelayFee() {
|
|
122
|
-
const result = (await this.performRequest("blockchain.relayfee"));
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
watchAddressStatus(cashaddr, callback) {
|
|
126
|
-
const watchAddressStatusCallback = async (data) => {
|
|
127
|
-
// subscription acknowledgement is the latest known status or null if no status is known
|
|
128
|
-
// status is an array: [ cashaddr, statusHash ]
|
|
129
|
-
if (data instanceof Array) {
|
|
130
|
-
const addr = data[0];
|
|
131
|
-
if (addr !== cashaddr) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const status = data[1];
|
|
135
|
-
callback(status);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
this.subscribeToAddress(cashaddr, watchAddressStatusCallback);
|
|
139
|
-
return async () => {
|
|
140
|
-
await this.unsubscribeFromAddress(cashaddr, watchAddressStatusCallback);
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
// public watchAddress(
|
|
144
|
-
// cashaddr: string,
|
|
145
|
-
// callback: (txHash: string) => void
|
|
146
|
-
// ): CancelWatchFn {
|
|
147
|
-
// const watchAddressCallback = async (data) => {
|
|
148
|
-
// // subscription acknowledgement is the latest known status or null if no status is known
|
|
149
|
-
// // status is an array: [ cashaddr, [tx_hashes] ]
|
|
150
|
-
// if (data instanceof Array) {
|
|
151
|
-
// let addr = data[0] as string;
|
|
152
|
-
// if (addr !== cashaddr) {
|
|
153
|
-
// return;
|
|
154
|
-
// }
|
|
155
|
-
// for (const txHash of data[1]) {
|
|
156
|
-
// if (!txHash) {
|
|
157
|
-
// // data[1] can be null eventually if there are no tx for this address
|
|
158
|
-
// continue;
|
|
159
|
-
// }
|
|
160
|
-
// callback(txHash);
|
|
161
|
-
// }
|
|
162
|
-
// }
|
|
163
|
-
// };
|
|
164
|
-
// this.subscribeToAddressTransactions(cashaddr, watchAddressCallback);
|
|
165
|
-
// return async () => {
|
|
166
|
-
// await this.unsubscribeFromAddressTransactions(
|
|
167
|
-
// cashaddr,
|
|
168
|
-
// watchAddressCallback
|
|
169
|
-
// );
|
|
170
|
-
// };
|
|
171
|
-
// }
|
|
172
|
-
// public watchAddressTransactions(
|
|
173
|
-
// cashaddr: string,
|
|
174
|
-
// callback: (tx: ElectrumRawTransaction) => void
|
|
175
|
-
// ): CancelWatchFn {
|
|
176
|
-
// return this.watchAddress(cashaddr, async (txHash: string) => {
|
|
177
|
-
// const tx = await this.getRawTransactionObject(txHash);
|
|
178
|
-
// callback(tx);
|
|
179
|
-
// });
|
|
180
|
-
// }
|
|
181
|
-
// Wait for the next block or a block at given blockchain height.
|
|
182
|
-
watchBlocks(callback) {
|
|
183
|
-
let acknowledged = false;
|
|
184
|
-
const waitForBlockCallback = (_header) => {
|
|
185
|
-
if (!acknowledged) {
|
|
186
|
-
acknowledged = true;
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
_header = _header instanceof Array ? _header[0] : _header;
|
|
190
|
-
callback(_header);
|
|
191
|
-
};
|
|
192
|
-
this.subscribeToHeaders(waitForBlockCallback);
|
|
193
|
-
return async () => {
|
|
194
|
-
this.unsubscribeFromHeaders(waitForBlockCallback);
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
// Wait for the next block or a block at given blockchain height.
|
|
198
|
-
async waitForBlock(height) {
|
|
199
|
-
return new Promise(async (resolve) => {
|
|
200
|
-
const cancelWatch = this.watchBlocks(async (header) => {
|
|
201
|
-
if (height === undefined || header.height >= height) {
|
|
202
|
-
await cancelWatch();
|
|
203
|
-
resolve(header);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
// subscribe to notifications sent when new block is found, the block header is sent to callback
|
|
209
|
-
async subscribeToHeaders(callback) {
|
|
210
|
-
await this.subscribeRequest("blockchain.headers.subscribe", callback);
|
|
211
|
-
}
|
|
212
|
-
// unsubscribe to notifications sent when new block is found
|
|
213
|
-
async unsubscribeFromHeaders(callback) {
|
|
214
|
-
await this.unsubscribeRequest("blockchain.headers.subscribe", callback);
|
|
215
|
-
}
|
|
216
|
-
async subscribeToAddress(cashaddr, callback) {
|
|
217
|
-
await this.subscribeRequest("blockchain.address.subscribe", callback, cashaddr);
|
|
218
|
-
}
|
|
219
|
-
async unsubscribeFromAddress(cashaddr, callback) {
|
|
220
|
-
await this.unsubscribeRequest("blockchain.address.subscribe", callback, cashaddr);
|
|
221
|
-
}
|
|
222
|
-
async subscribeToAddressTransactions(cashaddr, callback) {
|
|
223
|
-
await this.subscribeRequest("blockchain.address.transactions.subscribe", callback, cashaddr);
|
|
224
|
-
}
|
|
225
|
-
async unsubscribeFromAddressTransactions(cashaddr, callback) {
|
|
226
|
-
await this.unsubscribeRequest("blockchain.address.transactions.subscribe", callback, cashaddr);
|
|
227
|
-
}
|
|
228
|
-
async subscribeToTransaction(txHash, callback) {
|
|
229
|
-
await this.subscribeRequest("blockchain.transaction.subscribe", callback, txHash);
|
|
230
|
-
}
|
|
231
|
-
async unsubscribeFromTransaction(txHash, callback) {
|
|
232
|
-
await this.unsubscribeRequest("blockchain.transaction.subscribe", callback, txHash);
|
|
233
|
-
}
|
|
234
|
-
async performRequest(name, ...parameters) {
|
|
235
|
-
await this.ready();
|
|
236
|
-
const requestTimeout = new Promise(function (_resolve, reject) {
|
|
237
|
-
setTimeout(function () {
|
|
238
|
-
reject("electrum-cash request timed out, retrying");
|
|
239
|
-
}, 30000);
|
|
240
|
-
}).catch(function (e) {
|
|
241
|
-
throw e;
|
|
242
|
-
});
|
|
243
|
-
const request = this.electrum.request(name, ...parameters);
|
|
244
|
-
return await Promise.race([request, requestTimeout])
|
|
245
|
-
.then((value) => {
|
|
246
|
-
if (value instanceof Error)
|
|
247
|
-
throw value;
|
|
248
|
-
let result = value;
|
|
249
|
-
return result;
|
|
250
|
-
})
|
|
251
|
-
.catch(async () => {
|
|
252
|
-
// console.warn(
|
|
253
|
-
// "initial electrum-cash request attempt timed out, retrying..."
|
|
254
|
-
// );
|
|
255
|
-
return await Promise.race([request, requestTimeout])
|
|
256
|
-
.then((value) => {
|
|
257
|
-
if (value instanceof Error)
|
|
258
|
-
throw value;
|
|
259
|
-
let result = value;
|
|
260
|
-
return result;
|
|
261
|
-
})
|
|
262
|
-
.catch(function (e) {
|
|
263
|
-
throw e;
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
async subscribeRequest(methodName, callback, ...parameters) {
|
|
268
|
-
await this.ready();
|
|
269
|
-
const result = await this.electrum.subscribe(callback, methodName, ...parameters);
|
|
270
|
-
this.subscriptions++;
|
|
271
|
-
return result;
|
|
272
|
-
}
|
|
273
|
-
async unsubscribeRequest(methodName, callback, ...parameters) {
|
|
274
|
-
await this.ready();
|
|
275
|
-
const result = this.electrum.unsubscribe(callback, methodName, ...parameters);
|
|
276
|
-
this.subscriptions--;
|
|
277
|
-
return result;
|
|
278
|
-
}
|
|
279
|
-
async ready() {
|
|
280
|
-
return (await this.connect());
|
|
281
|
-
}
|
|
282
|
-
async connect() {
|
|
283
|
-
return await this.mutex.runExclusive(async () => {
|
|
284
|
-
return await this.connectPromise;
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
disconnect() {
|
|
288
|
-
if (this.subscriptions > 0) {
|
|
289
|
-
// console.warn(
|
|
290
|
-
// `Trying to disconnect a network provider with ${this.subscriptions} active subscriptions. This is in most cases a bad idea.`
|
|
291
|
-
// );
|
|
292
|
-
}
|
|
293
|
-
return this.isElectrumClient()
|
|
294
|
-
? this.disconnectClient()
|
|
295
|
-
: this.disconnectCluster();
|
|
296
|
-
}
|
|
297
|
-
isElectrumClient() {
|
|
298
|
-
return this.electrum.hasOwnProperty("connection");
|
|
299
|
-
}
|
|
300
|
-
async readyClient(timeout) {
|
|
301
|
-
timeout = typeof timeout !== "undefined" ? timeout : 3000;
|
|
302
|
-
let connectPromise = async () => {
|
|
303
|
-
while (this.electrum.connection.status !==
|
|
304
|
-
electrum_cash_1.ConnectionStatus.CONNECTED) {
|
|
305
|
-
await (0, delay_1.delay)(100);
|
|
306
|
-
}
|
|
307
|
-
return true;
|
|
308
|
-
};
|
|
309
|
-
return connectPromise;
|
|
310
|
-
}
|
|
311
|
-
async readyCluster(timeout) {
|
|
312
|
-
timeout;
|
|
313
|
-
return this.electrum.ready();
|
|
314
|
-
}
|
|
315
|
-
async connectCluster() {
|
|
316
|
-
return this.electrum.startup();
|
|
317
|
-
}
|
|
318
|
-
async connectClient() {
|
|
319
|
-
let connectionPromise = async () => {
|
|
320
|
-
try {
|
|
321
|
-
return await this.electrum.connect();
|
|
322
|
-
}
|
|
323
|
-
catch (e) {
|
|
324
|
-
console.warn(`Warning: Failed to connect to client on ${this.network}.`);
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
return [await connectionPromise()];
|
|
329
|
-
}
|
|
330
|
-
async disconnectCluster() {
|
|
331
|
-
return this.electrum.shutdown();
|
|
332
|
-
}
|
|
333
|
-
async disconnectClient() {
|
|
334
|
-
return [await this.electrum.disconnect(true)];
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
exports.default = ElectrumNetworkProvider;
|
|
338
|
-
//# sourceMappingURL=ElectrumNetworkProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ElectrumNetworkProvider.js","sourceRoot":"","sources":["../../../src/network/ElectrumNetworkProvider.ts"],"names":[],"mappings":";;AAAA,iDAKuB;AAGvB,4CAAuC;AACvC,yCAAsC;AAGtC,6CAAoC;AACpC,yCAAsC;AAKtC,MAAqB,uBAAuB;IAO1C,YACE,QAA0C,EACnC,UAAmB,mBAAO,CAAC,OAAO,EACjC,0BAAoC;QADrC,YAAO,GAAP,OAAO,CAA2B;QACjC,+BAA0B,GAA1B,0BAA0B,CAAU;QARvC,kBAAa,GAAW,CAAC,CAAC;QAEzB,UAAK,GAAG,IAAI,mBAAK,EAAE,CAAC;QACpB,gBAAW,GAAG,CAAC,CAAC;QAOtB,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;SAChD;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SACnE;IACH,CAAC;IAEO,KAAK,CAAC,iBAAiB,CAAC,WAAmB,IAAI;QACrD,2FAA2F;QAC3F,IAAI,aAAa,CAAC;QAElB,MAAM,OAAO,CAAC,IAAI,CAAC;YACjB,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;gBAC5B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;gBAEhC,IAAI,IAAI,CAAC,QAAQ,YAAY,+BAAe,EAAE;oBAC5C,IAAI;wBACF,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;qBAC7B;oBAAC,OAAO,CAAC,EAAE;wBACV,OAAO,CAAC,IAAI,CACV,yDAAyD,CAAC,EAAE,CAC7D,CAAC;qBACH;oBACD,OAAO,CAAC,MAAM,I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B,OAAO,CAAC,MAAO,IAAI,CAAC,QAA2B,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;CACF;AA1eD,0CA0eC"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { TxI, UtxoI, Network, HeaderI } from "../interface";
|
|
2
|
-
export default interface NetworkProvider {
|
|
3
|
-
/**
|
|
4
|
-
* Variable indicating the network that this provider connects to.
|
|
5
|
-
*/
|
|
6
|
-
network: Network;
|
|
7
|
-
/**
|
|
8
|
-
* Retrieve all UTXOs (confirmed and unconfirmed) for a given address.
|
|
9
|
-
* @param cashaddr The CashAddress for which we wish to retrieve UTXOs.
|
|
10
|
-
* @returns List of UTXOs spendable by the provided address.
|
|
11
|
-
*/
|
|
12
|
-
getUtxos(cashaddr: string): Promise<UtxoI[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Retrieve all balance of an address in satoshi
|
|
15
|
-
* @param cashaddr The CashAddress for which we wish to retrieve UTXOs.
|
|
16
|
-
* @returns the balance.
|
|
17
|
-
*/
|
|
18
|
-
getBalance(cashaddr: string): Promise<number>;
|
|
19
|
-
/**
|
|
20
|
-
* @returns The current block height.
|
|
21
|
-
*/
|
|
22
|
-
getBlockHeight(): Promise<number>;
|
|
23
|
-
/**
|
|
24
|
-
* @returns The current minimum relay fee per kb
|
|
25
|
-
*/
|
|
26
|
-
getRelayFee(): Promise<number>;
|
|
27
|
-
/**
|
|
28
|
-
* Retrieve the Hex transaction details for a given transaction ID.
|
|
29
|
-
* @param txHash Hex of transaction hash.
|
|
30
|
-
* @param verbose Whether a verbose coin-specific response is required.
|
|
31
|
-
* @throws {Error} If the transaction does not exist
|
|
32
|
-
* @returns The full hex transaction for the provided transaction ID.
|
|
33
|
-
*/
|
|
34
|
-
getRawTransaction(txHash: string): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Retrieve a verbose coin-specific response transaction details for a given transaction ID.
|
|
37
|
-
* @param txHash Hex of transaction hash.
|
|
38
|
-
* @throws {Error} If the transaction does not exist
|
|
39
|
-
* @returns The full hex transaction for the provided transaction ID.
|
|
40
|
-
*/
|
|
41
|
-
getRawTransactionObject(txHash: string): Promise<any>;
|
|
42
|
-
/**
|
|
43
|
-
* Broadcast a raw hex transaction to the Bitcoin Cash network.
|
|
44
|
-
* @param txHex The raw transaction hex to be broadcast.
|
|
45
|
-
* @param awaitPropagation Wait for transaction to be registered in the bitcoind or indexer. If set to false, function returns computed transaction hash immediately.
|
|
46
|
-
* @throws {Error} If the transaction was not accepted by the network.
|
|
47
|
-
* @returns The transaction ID (hash) corresponding to the broadcast transaction.
|
|
48
|
-
*/
|
|
49
|
-
sendRawTransaction(txHex: string, awaitPropagation?: boolean): Promise<string>;
|
|
50
|
-
/**
|
|
51
|
-
* Return the confirmed and unconfirmed history of a Bitcoin Cash address.
|
|
52
|
-
* @param cashaddr The CashAddress for which we wish to retrieve history.
|
|
53
|
-
* @throws {Error} When failing to get history.
|
|
54
|
-
* @returns Array of transactions.
|
|
55
|
-
*/
|
|
56
|
-
getHistory(cashaddr: string): Promise<TxI[]>;
|
|
57
|
-
/**
|
|
58
|
-
* Wait for the next block or a block at given blockchain height.
|
|
59
|
-
* @param height If specified, waits for blockchain to reach this height.
|
|
60
|
-
* @returns Block header.
|
|
61
|
-
*/
|
|
62
|
-
waitForBlock(height?: number): Promise<HeaderI>;
|
|
63
|
-
/**
|
|
64
|
-
* Subscribe to the address change events
|
|
65
|
-
* @param cashaddr The CashAddress for which we wish to retrieve history.
|
|
66
|
-
* @throws {Error} If the subscription failed.
|
|
67
|
-
* @returns nothing.
|
|
68
|
-
*/
|
|
69
|
-
subscribeToAddress(cashaddr: string, callback: (data: any) => void): Promise<void>;
|
|
70
|
-
/**
|
|
71
|
-
* Unsubscribe from the address change events
|
|
72
|
-
* @param cashaddr The CashAddress for which we wish to retrieve history.
|
|
73
|
-
* @throws {Error} If the unsubscription failed.
|
|
74
|
-
* @returns nothing.
|
|
75
|
-
*/
|
|
76
|
-
unsubscribeFromAddress(cashaddr: string, callback: (data: any) => void): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Subscribe to a transaction in order to receive future notifications if its confirmation status changes.
|
|
79
|
-
* @param txHash The transaction hash as a hexadecimal string.
|
|
80
|
-
* @throws {Error} If the subscription failed.
|
|
81
|
-
* @returns nothing.
|
|
82
|
-
*/
|
|
83
|
-
subscribeToTransaction(txHash: string, callback: (data: any) => void): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Unsubscribe from a transaction, preventing future notifications if its confirmation status changes.
|
|
86
|
-
* @param txHash The transaction hash as a hexadecimal string.
|
|
87
|
-
* @throws {Error} If the subscription failed.
|
|
88
|
-
* @returns nothing.
|
|
89
|
-
*/
|
|
90
|
-
unsubscribeFromTransaction(txHash: string, callback: (data: any) => void): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Function to wait for connection to be ready
|
|
93
|
-
* @param timeout number of milliseconds to wait before throwing error
|
|
94
|
-
* @returns true when ready, or an error
|
|
95
|
-
*/
|
|
96
|
-
ready(timeout?: number): Promise<boolean | unknown>;
|
|
97
|
-
/**
|
|
98
|
-
* Function to connect manually if using persistent connections
|
|
99
|
-
* @returns array of connection boolean successes, or throws error
|
|
100
|
-
*/
|
|
101
|
-
connect(): Promise<void[]>;
|
|
102
|
-
/**
|
|
103
|
-
* Function to disconnect manually if using persistent connections
|
|
104
|
-
* @returns array of connection boolean successes, or throws error
|
|
105
|
-
*/
|
|
106
|
-
disconnect(): Promise<boolean[]>;
|
|
107
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkProvider.js","sourceRoot":"","sources":["../../../src/network/NetworkProvider.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare function getDefaultServers(): {
|
|
2
|
-
mainnet: string[];
|
|
3
|
-
testnet: string[];
|
|
4
|
-
regtest: string[];
|
|
5
|
-
};
|
|
6
|
-
export declare function getUserAgent(): any;
|
|
7
|
-
export declare function getConfidence(): any;
|
|
8
|
-
export declare const defaultServers: {
|
|
9
|
-
mainnet: string[];
|
|
10
|
-
testnet: string[];
|
|
11
|
-
regtest: string[];
|
|
12
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.defaultServers = exports.getConfidence = exports.getUserAgent = exports.getDefaultServers = void 0;
|
|
23
|
-
const index_1 = require("../util/index");
|
|
24
|
-
const primary = __importStar(require("./constant"));
|
|
25
|
-
let mainnetServers, testnetServers, regtestServers;
|
|
26
|
-
function getDefaultServers() {
|
|
27
|
-
if ((0, index_1.getRuntimePlatform)() == "node") {
|
|
28
|
-
mainnetServers = process.env.ELECTRUM
|
|
29
|
-
? process.env.ELECTRUM.split(",")
|
|
30
|
-
: primary.mainnetServers;
|
|
31
|
-
testnetServers = process.env.ELECTRUM_TESTNET
|
|
32
|
-
? process.env.ELECTRUM_TESTNET.split(",")
|
|
33
|
-
: primary.testnetServers;
|
|
34
|
-
regtestServers = process.env.ELECTRUM_REGTEST
|
|
35
|
-
? process.env.ELECTRUM_REGTEST.split(",")
|
|
36
|
-
: primary.regtestServers;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
mainnetServers = primary.mainnetServers;
|
|
40
|
-
testnetServers = primary.testnetServers;
|
|
41
|
-
regtestServers = primary.regtestServers;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
mainnet: mainnetServers,
|
|
45
|
-
testnet: testnetServers,
|
|
46
|
-
regtest: regtestServers,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
exports.getDefaultServers = getDefaultServers;
|
|
50
|
-
function getUserAgent() {
|
|
51
|
-
// Allow users to configure the cluster confidence
|
|
52
|
-
let ua;
|
|
53
|
-
if ((0, index_1.getRuntimePlatform)() === "node") {
|
|
54
|
-
ua = process.env.ELECTRUM_USER_AGENT
|
|
55
|
-
? process.env.ELECTRUM_USER_AGENT
|
|
56
|
-
: "mainnet-js-" + (0, index_1.getRuntimePlatform)();
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
ua = "mainnet-js-" + (0, index_1.getRuntimePlatform)();
|
|
60
|
-
}
|
|
61
|
-
return ua;
|
|
62
|
-
}
|
|
63
|
-
exports.getUserAgent = getUserAgent;
|
|
64
|
-
function getConfidence() {
|
|
65
|
-
// Allow users to configure the cluster confidence
|
|
66
|
-
let confidence;
|
|
67
|
-
if ((0, index_1.getRuntimePlatform)() === "node") {
|
|
68
|
-
confidence = process.env.ELECTRUM_CONFIDENCE
|
|
69
|
-
? parseInt(process.env.ELECTRUM_CONFIDENCE)
|
|
70
|
-
: 1;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
confidence = 1;
|
|
74
|
-
}
|
|
75
|
-
return confidence;
|
|
76
|
-
}
|
|
77
|
-
exports.getConfidence = getConfidence;
|
|
78
|
-
exports.defaultServers = getDefaultServers();
|
|
79
|
-
//# sourceMappingURL=configuration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../src/network/configuration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAmD;AACnD,oDAAsC;AAEtC,IAAI,cAAwB,EAC1B,cAAwB,EACxB,cAAwB,CAAC;AAE3B,SAAgB,iBAAiB;IAC/B,IAAI,IAAA,0BAAkB,GAAE,IAAI,MAAM,EAAE;QAClC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ;YACnC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;YACjC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC3B,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB;YAC3C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC;YACzC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;QAC3B,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB;YAC3C,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC;YACzC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC;KAC5B;SAAM;QACL,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QACxC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QACxC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;KACzC;IACD,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC;AArBD,8CAqBC;AAED,SAAgB,YAAY;IAC1B,kDAAkD;IAClD,IAAI,EAAE,CAAC;IACP,IAAI,IAAA,0BAAkB,GAAE,KAAK,MAAM,EAAE;QACnC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB;YAClC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB;YACjC,CAAC,CAAC,aAAa,GAAG,IAAA,0BAAkB,GAAE,CAAC;KAC1C;SAAM;QACL,EAAE,GAAG,aAAa,GAAG,IAAA,0BAAkB,GAAE,CAAC;KAC3C;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAXD,oCAWC;AAED,SAAgB,aAAa;IAC3B,kDAAkD;IAClD,IAAI,UAAU,CAAC;IACf,IAAI,IAAA,0BAAkB,GAAE,KAAK,MAAM,EAAE;QACnC,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB;YAC1C,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;YAC3C,CAAC,CAAC,CAAC,CAAC;KACP;SAAM;QACL,UAAU,GAAG,CAAC,CAAC;KAChB;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,sCAWC;AAEY,QAAA,cAAc,GAAG,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { ClusterOrder } from "electrum-cash";
|
|
2
|
-
export declare const ELECTRUM_CASH_PROTOCOL_VERSION = "1.4.1";
|
|
3
|
-
export declare const networkTickerMap: {
|
|
4
|
-
mainnet: string;
|
|
5
|
-
testnet: string;
|
|
6
|
-
regtest: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const mainnetServers: string[];
|
|
9
|
-
export declare const testnetServers: string[];
|
|
10
|
-
export declare const regtestServers: string[];
|
|
11
|
-
export declare const defaultServers: {
|
|
12
|
-
mainnet: string[];
|
|
13
|
-
testnet: string[];
|
|
14
|
-
regtest: string[];
|
|
15
|
-
};
|
|
16
|
-
export declare const clusterParams: {
|
|
17
|
-
mainnet: {
|
|
18
|
-
confidence: number;
|
|
19
|
-
distribution: number;
|
|
20
|
-
order: ClusterOrder;
|
|
21
|
-
timeout: number;
|
|
22
|
-
};
|
|
23
|
-
testnet: {
|
|
24
|
-
confidence: number;
|
|
25
|
-
distribution: number;
|
|
26
|
-
order: ClusterOrder;
|
|
27
|
-
timeout: number;
|
|
28
|
-
};
|
|
29
|
-
regtest: {
|
|
30
|
-
confidence: number;
|
|
31
|
-
distribution: number;
|
|
32
|
-
order: ClusterOrder;
|
|
33
|
-
timeout: number;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clusterParams = exports.defaultServers = exports.regtestServers = exports.testnetServers = exports.mainnetServers = exports.networkTickerMap = exports.ELECTRUM_CASH_PROTOCOL_VERSION = void 0;
|
|
4
|
-
const electrum_cash_1 = require("electrum-cash");
|
|
5
|
-
exports.ELECTRUM_CASH_PROTOCOL_VERSION = "1.4.1";
|
|
6
|
-
exports.networkTickerMap = {
|
|
7
|
-
mainnet: "BCH",
|
|
8
|
-
testnet: "tBCH",
|
|
9
|
-
regtest: "rBCH",
|
|
10
|
-
};
|
|
11
|
-
exports.mainnetServers = [
|
|
12
|
-
"wss://bch.imaginary.cash:50004",
|
|
13
|
-
//"wss://blackie.c3-soft.com:50004",
|
|
14
|
-
"wss://electrum.imaginary.cash:50004",
|
|
15
|
-
"wss://fulcrum.fountainhead.cash",
|
|
16
|
-
];
|
|
17
|
-
exports.testnetServers = [
|
|
18
|
-
"wss://tbch.loping.net:60004",
|
|
19
|
-
//"wss://blackie.c3-soft.com:60004",
|
|
20
|
-
//"wss://testnet.bitcoincash.network:60004",
|
|
21
|
-
//,"wss://unavailable.invalid:50004"
|
|
22
|
-
];
|
|
23
|
-
// testnet4
|
|
24
|
-
// export const testnetServers = [
|
|
25
|
-
// //"wss://t4fork.c3-soft.com:61004",
|
|
26
|
-
// "wss://testnet4.imaginary.cash:50004",
|
|
27
|
-
// //,"wss://unavailable.invalid:50004"
|
|
28
|
-
// ];
|
|
29
|
-
exports.regtestServers = ["ws://127.0.0.1:60003"];
|
|
30
|
-
exports.defaultServers = {
|
|
31
|
-
mainnet: exports.mainnetServers,
|
|
32
|
-
testnet: exports.testnetServers,
|
|
33
|
-
regtest: exports.regtestServers,
|
|
34
|
-
};
|
|
35
|
-
exports.clusterParams = {
|
|
36
|
-
mainnet: {
|
|
37
|
-
confidence: 1,
|
|
38
|
-
distribution: 1,
|
|
39
|
-
order: electrum_cash_1.ClusterOrder.RANDOM,
|
|
40
|
-
timeout: 45000,
|
|
41
|
-
},
|
|
42
|
-
testnet: {
|
|
43
|
-
confidence: 1,
|
|
44
|
-
distribution: 1,
|
|
45
|
-
order: electrum_cash_1.ClusterOrder.RANDOM,
|
|
46
|
-
timeout: 30000,
|
|
47
|
-
},
|
|
48
|
-
regtest: {
|
|
49
|
-
confidence: 1,
|
|
50
|
-
distribution: 1,
|
|
51
|
-
order: electrum_cash_1.ClusterOrder.PRIORITY,
|
|
52
|
-
timeout: 3000,
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=constant.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/network/constant.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAEhC,QAAA,8BAA8B,GAAG,OAAO,CAAC;AAEzC,QAAA,gBAAgB,GAAG;IAC9B,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;CAChB,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,gCAAgC;IAChC,oCAAoC;IACpC,qCAAqC;IACrC,iCAAiC;CAClC,CAAC;AAEW,QAAA,cAAc,GAAG;IAC5B,6BAA6B;IAC7B,oCAAoC;IACpC,4CAA4C;IAC5C,oCAAoC;CACrC,CAAC;AAEF,WAAW;AACX,kCAAkC;AAClC,wCAAwC;AACxC,2CAA2C;AAC3C,yCAAyC;AACzC,KAAK;AAEQ,QAAA,cAAc,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE1C,QAAA,cAAc,GAAG;IAC5B,OAAO,EAAE,sBAAc;IACvB,OAAO,EAAE,sBAAc;IACvB,OAAO,EAAE,sBAAc;CACxB,CAAC;AAEW,QAAA,aAAa,GAAG;IAC3B,OAAO,EAAE;QACP,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;QACf,KAAK,EAAE,4BAAY,CAAC,MAAM;QAC1B,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;QACf,KAAK,EAAE,4BAAY,CAAC,MAAM;QAC1B,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,UAAU,EAAE,CAAC;QACb,YAAY,EAAE,CAAC;QACf,KAAK,EAAE,4BAAY,CAAC,QAAQ;QAC5B,OAAO,EAAE,IAAI;KACd;CACF,CAAC"}
|