mainnet-js 2.7.5 → 2.7.6
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 +1 -1
- package/dist/{mainnet-2.7.5.js → mainnet-2.7.6.js} +4 -4
- package/dist/module/util/deriveCashaddr.d.ts +4 -2
- package/dist/module/util/deriveCashaddr.d.ts.map +1 -1
- package/dist/module/util/deriveCashaddr.js +32 -45
- package/dist/module/util/deriveCashaddr.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/util/deriveCashaddr.test.ts +121 -8
- package/src/util/deriveCashaddr.ts +40 -68
package/dist/index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
5
|
<title>The Empty Mainnet App</title>
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="mainnet-2.7.
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="mainnet-2.7.6.js"></script></head>
|
|
7
7
|
<body><script>document.addEventListener("DOMContentLoaded", async (event) => Object.assign(globalThis, await __mainnetPromise))</script>
|
|
8
8
|
</body>
|
|
9
9
|
</html>
|
|
@@ -164,7 +164,7 @@ eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__
|
|
|
164
164
|
\**********************/
|
|
165
165
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
166
166
|
|
|
167
|
-
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BCMR\": () => (/* reexport safe */ _wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__.BCMR),\n/* harmony export */ \"BaseWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.BaseWallet),\n/* harmony export */ \"CONST\": () => (/* reexport module object */ _constant_js__WEBPACK_IMPORTED_MODULE_17__),\n/* harmony export */ \"Config\": () => (/* reexport safe */ _config_js__WEBPACK_IMPORTED_MODULE_11__.Config),\n/* harmony export */ \"Connection\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.Connection),\n/* harmony export */ \"DefaultProvider\": () => (/* reexport safe */ _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__.DefaultProvider),\n/* harmony export */ \"ElectrumNetworkProvider\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.ElectrumNetworkProvider),\n/* harmony export */ \"ExchangeRate\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.ExchangeRate),\n/* harmony export */ \"FeePaidByEnum\": () => (/* reexport safe */ _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__.FeePaidByEnum),\n/* harmony export */ \"Mainnet\": () => (/* reexport module object */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__),\n/* harmony export */ \"NFTCapability\": () => (/* reexport safe */ _interface_js__WEBPACK_IMPORTED_MODULE_18__.NFTCapability),\n/* harmony export */ \"Network\": () => (/* reexport safe */ _interface_js__WEBPACK_IMPORTED_MODULE_18__.Network),\n/* harmony export */ \"NetworkType\": () => (/* reexport safe */ _enum_js__WEBPACK_IMPORTED_MODULE_12__.NetworkType),\n/* harmony export */ \"OpReturnData\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.OpReturnData),\n/* harmony export */ \"RegTestWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.RegTestWallet),\n/* harmony export */ \"RegTestWatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.RegTestWatchWallet),\n/* harmony export */ \"RegTestWifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.RegTestWifWallet),\n/* harmony export */ \"RuntimePlatform\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.RuntimePlatform),\n/* harmony export */ \"SendRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.SendRequest),\n/* harmony export */ \"SendResponse\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.SendResponse),\n/* harmony export */ \"SignedMessage\": () => (/* reexport safe */ _message_signed_js__WEBPACK_IMPORTED_MODULE_6__.SignedMessage),\n/* harmony export */ \"StorageProvider\": () => (/* reexport safe */ _db_index_js__WEBPACK_IMPORTED_MODULE_2__.StorageProvider),\n/* harmony export */ \"TestNetWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.TestNetWallet),\n/* harmony export */ \"TestNetWatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.TestNetWatchWallet),\n/* harmony export */ \"TestNetWifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.TestNetWifWallet),\n/* harmony export */ \"TokenBurnRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenBurnRequest),\n/* harmony export */ \"TokenGenesisRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenGenesisRequest),\n/* harmony export */ \"TokenMintRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenMintRequest),\n/* harmony export */ \"TokenSendRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenSendRequest),\n/* harmony export */ \"UnitEnum\": () => (/* reexport safe */ _enum_js__WEBPACK_IMPORTED_MODULE_12__.UnitEnum),\n/* harmony export */ \"Wallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.Wallet),\n/* harmony export */ \"WalletTypeEnum\": () => (/* reexport safe */ _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__.WalletTypeEnum),\n/* harmony export */ \"WatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.WatchWallet),\n/* harmony export */ \"WifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.WifWallet),\n/* harmony export */ \"XPubKey\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.XPubKey),\n/* harmony export */ \"amountInSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.amountInSatoshi),\n/* harmony export */ \"asSendRequestObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.asSendRequestObject),\n/* harmony export */ \"atob\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.atob),\n/* harmony export */ \"balanceFromSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.balanceFromSatoshi),\n/* harmony export */ \"balanceResponseFromSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.balanceResponseFromSatoshi),\n/* harmony export */ \"binToBase64\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.binToBase64),\n/* harmony export */ \"binToHex\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.binToHex),\n/* harmony export */ \"btoa\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.btoa),\n/* harmony export */ \"checkTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.checkTokenaddr),\n/* harmony export */ \"convert\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.convert),\n/* harmony export */ \"convertObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.convertObject),\n/* harmony export */ \"createWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.createWallet),\n/* harmony export */ \"createWalletResponse\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.createWalletResponse),\n/* harmony export */ \"decodeHeader\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.decodeHeader),\n/* harmony export */ \"delay\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.delay),\n/* harmony export */ \"deriveCashaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.deriveCashaddr),\n/* harmony export */ \"derivePublicKeyHash\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.derivePublicKeyHash),\n/* harmony export */ \"deriveTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.deriveTokenaddr),\n/* harmony export */ \"derivedNetwork\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.derivedNetwork),\n/* harmony export */ \"disconnectProviders\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.disconnectProviders),\n/* harmony export */ \"expect\": () => (/* reexport safe */ _test_expect_js__WEBPACK_IMPORTED_MODULE_1__.expect),\n/* harmony export */ \"fromUtxoId\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.fromUtxoId),\n/* harmony export */ \"getAddrsByXpubKey\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getAddrsByXpubKey),\n/* harmony export */ \"getAddrsByXpubKeyObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getAddrsByXpubKeyObject),\n/* harmony export */ \"getNamedWalletId\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.getNamedWalletId),\n/* harmony export */ \"getNetworkProvider\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.getNetworkProvider),\n/* harmony export */ \"getRuntimePlatform\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getRuntimePlatform),\n/* harmony export */ \"getUsdRate\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getUsdRate),\n/* harmony export */ \"getWeakRandomInt\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getWeakRandomInt),\n/* harmony export */ \"getXPubKey\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXPubKey),\n/* harmony export */ \"getXpubKeyInfo\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXpubKeyInfo),\n/* harmony export */ \"getXpubKeyInfoObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXpubKeyInfoObject),\n/* harmony export */ \"hash160\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.hash160),\n/* harmony export */ \"hexToBin\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.hexToBin),\n/* harmony export */ \"initProviders\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.initProviders),\n/* harmony export */ \"isTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.isValidAddress),\n/* harmony export */ \"libauth\": () => (/* reexport module object */ _libauth_js__WEBPACK_IMPORTED_MODULE_16__),\n/* harmony export */ \"mine\": () => (/* reexport safe */ _mine_index_js__WEBPACK_IMPORTED_MODULE_3__.mine),\n/* harmony export */ \"namedWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.namedWallet),\n/* harmony export */ \"namedWalletExists\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.namedWalletExists),\n/* harmony export */ \"removeFetchMock\": () => (/* reexport safe */ _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__.removeFetchMock),\n/* harmony export */ \"replaceNamedWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.replaceNamedWallet),\n/* harmony export */ \"sanitizeAddress\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sanitizeAddress),\n/* harmony export */ \"sanitizeUnit\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sanitizeUnit),\n/* harmony export */ \"setupFetchMock\": () => (/* reexport safe */ _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__.setupFetchMock),\n/* harmony export */ \"sha256\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sha256),\n/* harmony export */ \"sumTokenAmounts\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sumTokenAmounts),\n/* harmony export */ \"sumUtxoValue\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sumUtxoValue),\n/* harmony export */ \"toCashaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.toTokenaddr),\n/* harmony export */ \"toUtxoId\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.toUtxoId),\n/* harmony export */ \"utf8ToBin\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.utf8ToBin),\n/* harmony export */ \"walletClassMap\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.walletClassMap),\n/* harmony export */ \"walletFromId\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.walletFromId)\n/* harmony export */ });\n/* harmony import */ var _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./test/fetch.js */ \"./src/test/fetch.ts\");\n/* harmony import */ var _test_expect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./test/expect.js */ \"./src/test/expect.ts\");\n/* harmony import */ var _db_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./db/index.js */ \"./src/db/index.ts\");\n/* harmony import */ var _mine_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mine/index.js */ \"./src/mine/index.ts\");\n/* harmony import */ var _wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./wallet/Bcmr.js */ \"./src/wallet/Bcmr.ts\");\n/* harmony import */ var _network_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./network/index.js */ \"./src/network/index.ts\");\n/* harmony import */ var _message_signed_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./message/signed.js */ \"./src/message/signed.ts\");\n/* harmony import */ var _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./wallet/Base.js */ \"./src/wallet/Base.ts\");\n/* harmony import */ var _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./wallet/Wif.js */ \"./src/wallet/Wif.ts\");\n/* harmony import */ var _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wallet/createWallet.js */ \"./src/wallet/createWallet.ts\");\n/* harmony import */ var _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./network/configuration.js */ \"./src/network/configuration.ts\");\n/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./config.js */ \"./src/config.ts\");\n/* harmony import */ var _enum_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./enum.js */ \"./src/enum.ts\");\n/* harmony import */ var _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./wallet/enum.js */ \"./src/wallet/enum.ts\");\n/* harmony import */ var _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./wallet/model.js */ \"./src/wallet/model.ts\");\n/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./util/index.js */ \"./src/util/index.ts\");\n/* harmony import */ var _libauth_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./libauth.js */ \"./src/libauth.ts\");\n/* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constant.js */ \"./src/constant.ts\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./interface.js */ \"./src/interface.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__, _network_index_js__WEBPACK_IMPORTED_MODULE_5__, _message_signed_js__WEBPACK_IMPORTED_MODULE_6__, _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__, _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__, _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__, _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__, _config_js__WEBPACK_IMPORTED_MODULE_11__, _enum_js__WEBPACK_IMPORTED_MODULE_12__, _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__, _util_index_js__WEBPACK_IMPORTED_MODULE_15__, _libauth_js__WEBPACK_IMPORTED_MODULE_16__]);\n([_wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__, _network_index_js__WEBPACK_IMPORTED_MODULE_5__, _message_signed_js__WEBPACK_IMPORTED_MODULE_6__, _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__, _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__, _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__, _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__, _config_js__WEBPACK_IMPORTED_MODULE_11__, _enum_js__WEBPACK_IMPORTED_MODULE_12__, _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__, _util_index_js__WEBPACK_IMPORTED_MODULE_15__, _libauth_js__WEBPACK_IMPORTED_MODULE_16__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\n\n\n\n\n\n\n\n\n\n// provider\n\n// config\n\n// Enum\n\n\n// models\n\n// utils\n\n\n\n// libauth\n\n// constants\n\n\n// interfaces\n\n\n\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://mainnet-js/./src/index.ts?");
|
|
167
|
+
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BCMR\": () => (/* reexport safe */ _wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__.BCMR),\n/* harmony export */ \"BaseWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.BaseWallet),\n/* harmony export */ \"CONST\": () => (/* reexport module object */ _constant_js__WEBPACK_IMPORTED_MODULE_17__),\n/* harmony export */ \"Config\": () => (/* reexport safe */ _config_js__WEBPACK_IMPORTED_MODULE_11__.Config),\n/* harmony export */ \"Connection\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.Connection),\n/* harmony export */ \"DefaultProvider\": () => (/* reexport safe */ _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__.DefaultProvider),\n/* harmony export */ \"ElectrumNetworkProvider\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.ElectrumNetworkProvider),\n/* harmony export */ \"ExchangeRate\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.ExchangeRate),\n/* harmony export */ \"FeePaidByEnum\": () => (/* reexport safe */ _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__.FeePaidByEnum),\n/* harmony export */ \"Mainnet\": () => (/* reexport module object */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__),\n/* harmony export */ \"NFTCapability\": () => (/* reexport safe */ _interface_js__WEBPACK_IMPORTED_MODULE_18__.NFTCapability),\n/* harmony export */ \"Network\": () => (/* reexport safe */ _interface_js__WEBPACK_IMPORTED_MODULE_18__.Network),\n/* harmony export */ \"NetworkType\": () => (/* reexport safe */ _enum_js__WEBPACK_IMPORTED_MODULE_12__.NetworkType),\n/* harmony export */ \"OpReturnData\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.OpReturnData),\n/* harmony export */ \"RegTestWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.RegTestWallet),\n/* harmony export */ \"RegTestWatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.RegTestWatchWallet),\n/* harmony export */ \"RegTestWifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.RegTestWifWallet),\n/* harmony export */ \"RuntimePlatform\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.RuntimePlatform),\n/* harmony export */ \"SendRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.SendRequest),\n/* harmony export */ \"SendResponse\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.SendResponse),\n/* harmony export */ \"SignedMessage\": () => (/* reexport safe */ _message_signed_js__WEBPACK_IMPORTED_MODULE_6__.SignedMessage),\n/* harmony export */ \"StorageProvider\": () => (/* reexport safe */ _db_index_js__WEBPACK_IMPORTED_MODULE_2__.StorageProvider),\n/* harmony export */ \"TestNetWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.TestNetWallet),\n/* harmony export */ \"TestNetWatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.TestNetWatchWallet),\n/* harmony export */ \"TestNetWifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.TestNetWifWallet),\n/* harmony export */ \"TokenBurnRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenBurnRequest),\n/* harmony export */ \"TokenGenesisRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenGenesisRequest),\n/* harmony export */ \"TokenMintRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenMintRequest),\n/* harmony export */ \"TokenSendRequest\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.TokenSendRequest),\n/* harmony export */ \"UnitEnum\": () => (/* reexport safe */ _enum_js__WEBPACK_IMPORTED_MODULE_12__.UnitEnum),\n/* harmony export */ \"Wallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.Wallet),\n/* harmony export */ \"WalletTypeEnum\": () => (/* reexport safe */ _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__.WalletTypeEnum),\n/* harmony export */ \"WatchWallet\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.WatchWallet),\n/* harmony export */ \"WifWallet\": () => (/* reexport safe */ _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__.WifWallet),\n/* harmony export */ \"XPubKey\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.XPubKey),\n/* harmony export */ \"amountInSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.amountInSatoshi),\n/* harmony export */ \"asSendRequestObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.asSendRequestObject),\n/* harmony export */ \"atob\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.atob),\n/* harmony export */ \"balanceFromSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.balanceFromSatoshi),\n/* harmony export */ \"balanceResponseFromSatoshi\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.balanceResponseFromSatoshi),\n/* harmony export */ \"binToBase64\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.binToBase64),\n/* harmony export */ \"binToHex\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.binToHex),\n/* harmony export */ \"btoa\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.btoa),\n/* harmony export */ \"checkTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.checkTokenaddr),\n/* harmony export */ \"convert\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.convert),\n/* harmony export */ \"convertAddress\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.convertAddress),\n/* harmony export */ \"convertObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.convertObject),\n/* harmony export */ \"createWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.createWallet),\n/* harmony export */ \"createWalletResponse\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.createWalletResponse),\n/* harmony export */ \"decodeHeader\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.decodeHeader),\n/* harmony export */ \"delay\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.delay),\n/* harmony export */ \"deriveCashaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.deriveCashaddr),\n/* harmony export */ \"derivePublicKeyHash\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.derivePublicKeyHash),\n/* harmony export */ \"deriveTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.deriveTokenaddr),\n/* harmony export */ \"derivedNetwork\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.derivedNetwork),\n/* harmony export */ \"disconnectProviders\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.disconnectProviders),\n/* harmony export */ \"expect\": () => (/* reexport safe */ _test_expect_js__WEBPACK_IMPORTED_MODULE_1__.expect),\n/* harmony export */ \"fromUtxoId\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.fromUtxoId),\n/* harmony export */ \"getAddrsByXpubKey\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getAddrsByXpubKey),\n/* harmony export */ \"getAddrsByXpubKeyObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getAddrsByXpubKeyObject),\n/* harmony export */ \"getNamedWalletId\": () => (/* reexport safe */ _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__.getNamedWalletId),\n/* harmony export */ \"getNetworkProvider\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.getNetworkProvider),\n/* harmony export */ \"getRuntimePlatform\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getRuntimePlatform),\n/* harmony export */ \"getUsdRate\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getUsdRate),\n/* harmony export */ \"getWeakRandomInt\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getWeakRandomInt),\n/* harmony export */ \"getXPubKey\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXPubKey),\n/* harmony export */ \"getXpubKeyInfo\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXpubKeyInfo),\n/* harmony export */ \"getXpubKeyInfoObject\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.getXpubKeyInfoObject),\n/* harmony export */ \"hash160\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.hash160),\n/* harmony export */ \"hexToBin\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.hexToBin),\n/* harmony export */ \"initProviders\": () => (/* reexport safe */ _network_index_js__WEBPACK_IMPORTED_MODULE_5__.initProviders),\n/* harmony export */ \"isTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.isValidAddress),\n/* harmony export */ \"libauth\": () => (/* reexport module object */ _libauth_js__WEBPACK_IMPORTED_MODULE_16__),\n/* harmony export */ \"mine\": () => (/* reexport safe */ _mine_index_js__WEBPACK_IMPORTED_MODULE_3__.mine),\n/* harmony export */ \"namedWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.namedWallet),\n/* harmony export */ \"namedWalletExists\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.namedWalletExists),\n/* harmony export */ \"removeFetchMock\": () => (/* reexport safe */ _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__.removeFetchMock),\n/* harmony export */ \"replaceNamedWallet\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.replaceNamedWallet),\n/* harmony export */ \"sanitizeAddress\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sanitizeAddress),\n/* harmony export */ \"sanitizeUnit\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sanitizeUnit),\n/* harmony export */ \"setupFetchMock\": () => (/* reexport safe */ _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__.setupFetchMock),\n/* harmony export */ \"sha256\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sha256),\n/* harmony export */ \"sumTokenAmounts\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sumTokenAmounts),\n/* harmony export */ \"sumUtxoValue\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.sumUtxoValue),\n/* harmony export */ \"toCashaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.toTokenaddr),\n/* harmony export */ \"toUtxoId\": () => (/* reexport safe */ _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__.toUtxoId),\n/* harmony export */ \"utf8ToBin\": () => (/* reexport safe */ _util_index_js__WEBPACK_IMPORTED_MODULE_15__.utf8ToBin),\n/* harmony export */ \"walletClassMap\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.walletClassMap),\n/* harmony export */ \"walletFromId\": () => (/* reexport safe */ _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__.walletFromId)\n/* harmony export */ });\n/* harmony import */ var _test_fetch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./test/fetch.js */ \"./src/test/fetch.ts\");\n/* harmony import */ var _test_expect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./test/expect.js */ \"./src/test/expect.ts\");\n/* harmony import */ var _db_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./db/index.js */ \"./src/db/index.ts\");\n/* harmony import */ var _mine_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mine/index.js */ \"./src/mine/index.ts\");\n/* harmony import */ var _wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./wallet/Bcmr.js */ \"./src/wallet/Bcmr.ts\");\n/* harmony import */ var _network_index_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./network/index.js */ \"./src/network/index.ts\");\n/* harmony import */ var _message_signed_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./message/signed.js */ \"./src/message/signed.ts\");\n/* harmony import */ var _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./wallet/Base.js */ \"./src/wallet/Base.ts\");\n/* harmony import */ var _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./wallet/Wif.js */ \"./src/wallet/Wif.ts\");\n/* harmony import */ var _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wallet/createWallet.js */ \"./src/wallet/createWallet.ts\");\n/* harmony import */ var _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./network/configuration.js */ \"./src/network/configuration.ts\");\n/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./config.js */ \"./src/config.ts\");\n/* harmony import */ var _enum_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./enum.js */ \"./src/enum.ts\");\n/* harmony import */ var _wallet_enum_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./wallet/enum.js */ \"./src/wallet/enum.ts\");\n/* harmony import */ var _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./wallet/model.js */ \"./src/wallet/model.ts\");\n/* harmony import */ var _util_index_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./util/index.js */ \"./src/util/index.ts\");\n/* harmony import */ var _libauth_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./libauth.js */ \"./src/libauth.ts\");\n/* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./constant.js */ \"./src/constant.ts\");\n/* harmony import */ var _interface_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./interface.js */ \"./src/interface.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__, _network_index_js__WEBPACK_IMPORTED_MODULE_5__, _message_signed_js__WEBPACK_IMPORTED_MODULE_6__, _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__, _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__, _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__, _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__, _config_js__WEBPACK_IMPORTED_MODULE_11__, _enum_js__WEBPACK_IMPORTED_MODULE_12__, _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__, _util_index_js__WEBPACK_IMPORTED_MODULE_15__, _libauth_js__WEBPACK_IMPORTED_MODULE_16__]);\n([_wallet_Bcmr_js__WEBPACK_IMPORTED_MODULE_4__, _network_index_js__WEBPACK_IMPORTED_MODULE_5__, _message_signed_js__WEBPACK_IMPORTED_MODULE_6__, _wallet_Base_js__WEBPACK_IMPORTED_MODULE_7__, _wallet_Wif_js__WEBPACK_IMPORTED_MODULE_8__, _wallet_createWallet_js__WEBPACK_IMPORTED_MODULE_9__, _network_configuration_js__WEBPACK_IMPORTED_MODULE_10__, _config_js__WEBPACK_IMPORTED_MODULE_11__, _enum_js__WEBPACK_IMPORTED_MODULE_12__, _wallet_model_js__WEBPACK_IMPORTED_MODULE_14__, _util_index_js__WEBPACK_IMPORTED_MODULE_15__, _libauth_js__WEBPACK_IMPORTED_MODULE_16__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\n\n\n\n\n\n\n\n\n\n// provider\n\n// config\n\n// Enum\n\n\n// models\n\n// utils\n\n\n\n// libauth\n\n// constants\n\n\n// interfaces\n\n\n\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://mainnet-js/./src/index.ts?");
|
|
168
168
|
|
|
169
169
|
/***/ }),
|
|
170
170
|
|
|
@@ -454,7 +454,7 @@ eval("/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harm
|
|
|
454
454
|
\************************************/
|
|
455
455
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
456
456
|
|
|
457
|
-
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"checkTokenaddr\": () => (/* binding */ checkTokenaddr),\n/* harmony export */ \"deriveCashaddr\": () => (/* binding */ deriveCashaddr),\n/* harmony export */ \"deriveTokenaddr\": () => (/* binding */ deriveTokenaddr),\n/* harmony export */ \"isTokenaddr\": () => (/* binding */ isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* binding */ isValidAddress),\n/* harmony export */ \"toCashaddr\": () => (/* binding */ toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* binding */ toTokenaddr)\n/* harmony export */ });\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/address/cash-address.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/crypto/default-crypto-instances.js\");\n/* harmony import */ var _hash160_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hash160.js */ \"./src/util/hash160.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__, _hash160_js__WEBPACK_IMPORTED_MODULE_2__]);\n([_bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__, _hash160_js__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\nfunction isValidAddress(cashaddr) {\n const result = (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.decodeCashAddress)(cashaddr);\n if (typeof result === \"string\") {\n return false;\n }\n return true;\n}\nfunction deriveCashaddr(privateKey, networkPrefix) {\n let publicKey = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.derivePublicKeyCompressed(privateKey);\n if (typeof publicKey === \"string\") {\n throw new Error(publicKey);\n }\n let pkh = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKey);\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: networkPrefix,\n type: _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.CashAddressType.p2pkh,\n payload: pkh,\n }).address;\n}\nfunction deriveTokenaddr(key, networkPrefix) {\n let publicKeyHash;\n // private key\n if (key.length === 32) {\n let publicKeyCompressed = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.derivePublicKeyCompressed(key);\n if (typeof publicKeyCompressed === \"string\") {\n throw new Error(publicKeyCompressed);\n }\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKeyCompressed);\n }\n else if (key.length === 65) {\n // uncompressed public key\n let publicKeyCompressed = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.compressPublicKey(key);\n if (typeof publicKeyCompressed === \"string\") {\n throw new Error(publicKeyCompressed);\n }\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKeyCompressed);\n }\n else if (key.length === 33) {\n // compressed public key\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(key);\n }\n else if (key.length === 20) {\n // public key hash\n publicKeyHash = key;\n }\n else {\n throw new Error(\"Unsupported type of key\");\n }\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: networkPrefix,\n type: _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.CashAddressType.p2pkhWithTokens,\n payload: publicKeyHash,\n }).address;\n}\nfunction
|
|
457
|
+
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"checkTokenaddr\": () => (/* binding */ checkTokenaddr),\n/* harmony export */ \"convertAddress\": () => (/* binding */ convertAddress),\n/* harmony export */ \"deriveCashaddr\": () => (/* binding */ deriveCashaddr),\n/* harmony export */ \"deriveTokenaddr\": () => (/* binding */ deriveTokenaddr),\n/* harmony export */ \"isTokenaddr\": () => (/* binding */ isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* binding */ isValidAddress),\n/* harmony export */ \"toCashaddr\": () => (/* binding */ toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* binding */ toTokenaddr)\n/* harmony export */ });\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/address/cash-address.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/crypto/default-crypto-instances.js\");\n/* harmony import */ var _enum_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../enum.js */ \"./src/enum.ts\");\n/* harmony import */ var _hash160_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hash160.js */ \"./src/util/hash160.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__, _hash160_js__WEBPACK_IMPORTED_MODULE_2__, _enum_js__WEBPACK_IMPORTED_MODULE_3__]);\n([_bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__, _hash160_js__WEBPACK_IMPORTED_MODULE_2__, _enum_js__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\n\nfunction isValidAddress(cashaddr) {\n const result = (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.decodeCashAddress)(cashaddr);\n if (typeof result === \"string\") {\n return false;\n }\n return true;\n}\nfunction deriveCashaddr(privateKey, networkPrefix) {\n let publicKey = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.derivePublicKeyCompressed(privateKey);\n if (typeof publicKey === \"string\") {\n throw new Error(publicKey);\n }\n let pkh = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKey);\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: networkPrefix,\n type: _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.CashAddressType.p2pkh,\n payload: pkh,\n }).address;\n}\nfunction deriveTokenaddr(key, networkPrefix) {\n let publicKeyHash;\n // private key\n if (key.length === 32) {\n let publicKeyCompressed = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.derivePublicKeyCompressed(key);\n if (typeof publicKeyCompressed === \"string\") {\n throw new Error(publicKeyCompressed);\n }\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKeyCompressed);\n }\n else if (key.length === 65) {\n // uncompressed public key\n let publicKeyCompressed = _bitauth_libauth__WEBPACK_IMPORTED_MODULE_1__.secp256k1.compressPublicKey(key);\n if (typeof publicKeyCompressed === \"string\") {\n throw new Error(publicKeyCompressed);\n }\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(publicKeyCompressed);\n }\n else if (key.length === 33) {\n // compressed public key\n publicKeyHash = (0,_hash160_js__WEBPACK_IMPORTED_MODULE_2__.hash160)(key);\n }\n else if (key.length === 20) {\n // public key hash\n publicKeyHash = key;\n }\n else {\n throw new Error(\"Unsupported type of key\");\n }\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: networkPrefix,\n type: _bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.CashAddressType.p2pkhWithTokens,\n payload: publicKeyHash,\n }).address;\n}\nfunction decodeAddress(address) {\n const result = (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.decodeCashAddress)(address);\n if (typeof result === \"string\") {\n throw new Error(result);\n }\n return result;\n}\nfunction toCashaddr(address) {\n const result = decodeAddress(address);\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: result.prefix,\n type: result.type.replace(\"WithTokens\", \"\"),\n payload: result.payload,\n }).address;\n}\nfunction toTokenaddr(address) {\n const result = decodeAddress(address);\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: result.prefix,\n type: (result.type.replace(\"WithTokens\", \"\") +\n \"WithTokens\"),\n payload: result.payload,\n }).address;\n}\nfunction isTokenaddr(address) {\n const result = decodeAddress(address);\n return result.type.endsWith(\"WithTokens\");\n}\n// This function converts a cash address to a cash address of the specified network.\n// If withTokens is true, it will return a token-aware address.\n// If withTokens is false, it will return a non-token-aware address.\n// If withTokens is undefined, it will not change the token-awareness.\nfunction convertAddress(address, network = \"mainnet\", withTokens = undefined) {\n const result = decodeAddress(address);\n return (0,_bitauth_libauth__WEBPACK_IMPORTED_MODULE_0__.encodeCashAddress)({\n prefix: _enum_js__WEBPACK_IMPORTED_MODULE_3__.prefixFromNetworkMap[network],\n type: withTokens === undefined\n ? result.type\n : (result.type.replace(\"WithTokens\", \"\") +\n (withTokens ? \"WithTokens\" : \"\")),\n payload: result.payload,\n }).address;\n}\nfunction checkTokenaddr(cashaddr, enforce) {\n if (enforce && !isTokenaddr(cashaddr)) {\n throw new Error(\"Error trying to send to a non-tokenaware cash address\");\n }\n}\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://mainnet-js/./src/util/deriveCashaddr.ts?");
|
|
458
458
|
|
|
459
459
|
/***/ }),
|
|
460
460
|
|
|
@@ -554,7 +554,7 @@ eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__
|
|
|
554
554
|
\***************************/
|
|
555
555
|
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
556
556
|
|
|
557
|
-
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ExchangeRate\": () => (/* reexport safe */ _rate_ExchangeRate_js__WEBPACK_IMPORTED_MODULE_16__.ExchangeRate),\n/* harmony export */ \"RuntimePlatform\": () => (/* reexport safe */ _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__.RuntimePlatform),\n/* harmony export */ \"amountInSatoshi\": () => (/* reexport safe */ _amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__.amountInSatoshi),\n/* harmony export */ \"asSendRequestObject\": () => (/* reexport safe */ _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__.asSendRequestObject),\n/* harmony export */ \"atob\": () => (/* reexport safe */ _base64_js__WEBPACK_IMPORTED_MODULE_2__.atob),\n/* harmony export */ \"balanceFromSatoshi\": () => (/* reexport safe */ _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__.balanceFromSatoshi),\n/* harmony export */ \"balanceResponseFromSatoshi\": () => (/* reexport safe */ _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__.balanceResponseFromSatoshi),\n/* harmony export */ \"binToBase64\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_5__.binToBase64),\n/* harmony export */ \"binToHex\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__.binToHex),\n/* harmony export */ \"btoa\": () => (/* reexport safe */ _base64_js__WEBPACK_IMPORTED_MODULE_2__.btoa),\n/* harmony export */ \"checkTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.checkTokenaddr),\n/* harmony export */ \"convert\": () => (/* reexport safe */ _convert_js__WEBPACK_IMPORTED_MODULE_7__.convert),\n/* harmony export */ \"convertObject\": () => (/* reexport safe */ _convert_js__WEBPACK_IMPORTED_MODULE_7__.convertObject),\n/* harmony export */ \"decodeHeader\": () => (/* reexport safe */ _header_js__WEBPACK_IMPORTED_MODULE_23__.decodeHeader),\n/* harmony export */ \"delay\": () => (/* reexport safe */ _delay_js__WEBPACK_IMPORTED_MODULE_8__.delay),\n/* harmony export */ \"deriveCashaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.deriveCashaddr),\n/* harmony export */ \"derivePublicKeyHash\": () => (/* reexport safe */ _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__.derivePublicKeyHash),\n/* harmony export */ \"deriveTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.deriveTokenaddr),\n/* harmony export */ \"derivedNetwork\": () => (/* reexport safe */ _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__.derivedNetwork),\n/* harmony export */ \"getAddrsByXpubKey\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getAddrsByXpubKey),\n/* harmony export */ \"getAddrsByXpubKeyObject\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getAddrsByXpubKeyObject),\n/* harmony export */ \"getRuntimePlatform\": () => (/* reexport safe */ _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__.getRuntimePlatform),\n/* harmony export */ \"getUsdRate\": () => (/* reexport safe */ _getUsdRate_js__WEBPACK_IMPORTED_MODULE_14__.getUsdRate),\n/* harmony export */ \"getWeakRandomInt\": () => (/* reexport safe */ _randomInt_js__WEBPACK_IMPORTED_MODULE_19__.getWeakRandomInt),\n/* harmony export */ \"getXPubKey\": () => (/* reexport safe */ _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__.getXPubKey),\n/* harmony export */ \"getXpubKeyInfo\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getXpubKeyInfo),\n/* harmony export */ \"getXpubKeyInfoObject\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getXpubKeyInfoObject),\n/* harmony export */ \"hash160\": () => (/* reexport safe */ _hash160_js__WEBPACK_IMPORTED_MODULE_15__.hash160),\n/* harmony export */ \"hexToBin\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__.hexToBin),\n/* harmony export */ \"isTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.isValidAddress),\n/* harmony export */ \"sanitizeAddress\": () => (/* reexport safe */ _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__.sanitizeAddress),\n/* harmony export */ \"sanitizeUnit\": () => (/* reexport safe */ _sanitizeUnit_js__WEBPACK_IMPORTED_MODULE_18__.sanitizeUnit),\n/* harmony export */ \"sha256\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__.sha256),\n/* harmony export */ \"sumTokenAmounts\": () => (/* reexport safe */ _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__.sumTokenAmounts),\n/* harmony export */ \"sumUtxoValue\": () => (/* reexport safe */ _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__.sumUtxoValue),\n/* harmony export */ \"toCashaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.toTokenaddr),\n/* harmony export */ \"utf8ToBin\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_4__.utf8ToBin)\n/* harmony export */ });\n/* harmony import */ var _amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./amountInSatoshi.js */ \"./src/util/amountInSatoshi.ts\");\n/* harmony import */ var _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./asSendRequestObject.js */ \"./src/util/asSendRequestObject.ts\");\n/* harmony import */ var _base64_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64.js */ \"./src/util/base64.ts\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/hex.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/utf8.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/base64.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/crypto/default-crypto-instances.js\");\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./convert.js */ \"./src/util/convert.ts\");\n/* harmony import */ var _delay_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./delay.js */ \"./src/util/delay.ts\");\n/* harmony import */ var _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./deriveNetwork.js */ \"./src/util/deriveNetwork.ts\");\n/* harmony import */ var _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./derivePublicKeyHash.js */ \"./src/util/derivePublicKeyHash.ts\");\n/* harmony import */ var _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./deriveCashaddr.js */ \"./src/util/deriveCashaddr.ts\");\n/* harmony import */ var _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../util/getAddrsByXpubKey.js */ \"./src/util/getAddrsByXpubKey.ts\");\n/* harmony import */ var _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./getRuntimePlatform.js */ \"./src/util/getRuntimePlatform.ts\");\n/* harmony import */ var _getUsdRate_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./getUsdRate.js */ \"./src/util/getUsdRate.ts\");\n/* harmony import */ var _hash160_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./hash160.js */ \"./src/util/hash160.ts\");\n/* harmony import */ var _rate_ExchangeRate_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../rate/ExchangeRate.js */ \"./src/rate/ExchangeRate.ts\");\n/* harmony import */ var _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./sanitizeAddress.js */ \"./src/util/sanitizeAddress.ts\");\n/* harmony import */ var _sanitizeUnit_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./sanitizeUnit.js */ \"./src/util/sanitizeUnit.ts\");\n/* harmony import */ var _randomInt_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./randomInt.js */ \"./src/util/randomInt.ts\");\n/* harmony import */ var _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/getXPubKey.js */ \"./src/util/getXPubKey.ts\");\n/* harmony import */ var _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./sumUtxoValue.js */ \"./src/util/sumUtxoValue.ts\");\n/* harmony import */ var _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./balanceObjectFromSatoshi.js */ \"./src/util/balanceObjectFromSatoshi.ts\");\n/* harmony import */ var _header_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./header.js */ \"./src/util/header.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__, _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__, _base64_js__WEBPACK_IMPORTED_MODULE_2__, _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__, _convert_js__WEBPACK_IMPORTED_MODULE_7__, _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__, _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__, _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__, _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__, _hash160_js__WEBPACK_IMPORTED_MODULE_15__, _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__, _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__, _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__, _header_js__WEBPACK_IMPORTED_MODULE_23__]);\n([_amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__, _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__, _base64_js__WEBPACK_IMPORTED_MODULE_2__, _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__, _convert_js__WEBPACK_IMPORTED_MODULE_7__, _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__, _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__, _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__, _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__, _hash160_js__WEBPACK_IMPORTED_MODULE_15__, _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__, _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__, _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__, _header_js__WEBPACK_IMPORTED_MODULE_23__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://mainnet-js/./src/util/index.ts?");
|
|
557
|
+
eval("__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {\n__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ExchangeRate\": () => (/* reexport safe */ _rate_ExchangeRate_js__WEBPACK_IMPORTED_MODULE_16__.ExchangeRate),\n/* harmony export */ \"RuntimePlatform\": () => (/* reexport safe */ _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__.RuntimePlatform),\n/* harmony export */ \"amountInSatoshi\": () => (/* reexport safe */ _amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__.amountInSatoshi),\n/* harmony export */ \"asSendRequestObject\": () => (/* reexport safe */ _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__.asSendRequestObject),\n/* harmony export */ \"atob\": () => (/* reexport safe */ _base64_js__WEBPACK_IMPORTED_MODULE_2__.atob),\n/* harmony export */ \"balanceFromSatoshi\": () => (/* reexport safe */ _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__.balanceFromSatoshi),\n/* harmony export */ \"balanceResponseFromSatoshi\": () => (/* reexport safe */ _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__.balanceResponseFromSatoshi),\n/* harmony export */ \"binToBase64\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_5__.binToBase64),\n/* harmony export */ \"binToHex\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__.binToHex),\n/* harmony export */ \"btoa\": () => (/* reexport safe */ _base64_js__WEBPACK_IMPORTED_MODULE_2__.btoa),\n/* harmony export */ \"checkTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.checkTokenaddr),\n/* harmony export */ \"convert\": () => (/* reexport safe */ _convert_js__WEBPACK_IMPORTED_MODULE_7__.convert),\n/* harmony export */ \"convertAddress\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.convertAddress),\n/* harmony export */ \"convertObject\": () => (/* reexport safe */ _convert_js__WEBPACK_IMPORTED_MODULE_7__.convertObject),\n/* harmony export */ \"decodeHeader\": () => (/* reexport safe */ _header_js__WEBPACK_IMPORTED_MODULE_23__.decodeHeader),\n/* harmony export */ \"delay\": () => (/* reexport safe */ _delay_js__WEBPACK_IMPORTED_MODULE_8__.delay),\n/* harmony export */ \"deriveCashaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.deriveCashaddr),\n/* harmony export */ \"derivePublicKeyHash\": () => (/* reexport safe */ _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__.derivePublicKeyHash),\n/* harmony export */ \"deriveTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.deriveTokenaddr),\n/* harmony export */ \"derivedNetwork\": () => (/* reexport safe */ _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__.derivedNetwork),\n/* harmony export */ \"getAddrsByXpubKey\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getAddrsByXpubKey),\n/* harmony export */ \"getAddrsByXpubKeyObject\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getAddrsByXpubKeyObject),\n/* harmony export */ \"getRuntimePlatform\": () => (/* reexport safe */ _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__.getRuntimePlatform),\n/* harmony export */ \"getUsdRate\": () => (/* reexport safe */ _getUsdRate_js__WEBPACK_IMPORTED_MODULE_14__.getUsdRate),\n/* harmony export */ \"getWeakRandomInt\": () => (/* reexport safe */ _randomInt_js__WEBPACK_IMPORTED_MODULE_19__.getWeakRandomInt),\n/* harmony export */ \"getXPubKey\": () => (/* reexport safe */ _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__.getXPubKey),\n/* harmony export */ \"getXpubKeyInfo\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getXpubKeyInfo),\n/* harmony export */ \"getXpubKeyInfoObject\": () => (/* reexport safe */ _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__.getXpubKeyInfoObject),\n/* harmony export */ \"hash160\": () => (/* reexport safe */ _hash160_js__WEBPACK_IMPORTED_MODULE_15__.hash160),\n/* harmony export */ \"hexToBin\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__.hexToBin),\n/* harmony export */ \"isTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.isTokenaddr),\n/* harmony export */ \"isValidAddress\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.isValidAddress),\n/* harmony export */ \"sanitizeAddress\": () => (/* reexport safe */ _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__.sanitizeAddress),\n/* harmony export */ \"sanitizeUnit\": () => (/* reexport safe */ _sanitizeUnit_js__WEBPACK_IMPORTED_MODULE_18__.sanitizeUnit),\n/* harmony export */ \"sha256\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__.sha256),\n/* harmony export */ \"sumTokenAmounts\": () => (/* reexport safe */ _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__.sumTokenAmounts),\n/* harmony export */ \"sumUtxoValue\": () => (/* reexport safe */ _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__.sumUtxoValue),\n/* harmony export */ \"toCashaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.toCashaddr),\n/* harmony export */ \"toTokenaddr\": () => (/* reexport safe */ _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__.toTokenaddr),\n/* harmony export */ \"utf8ToBin\": () => (/* reexport safe */ _bitauth_libauth__WEBPACK_IMPORTED_MODULE_4__.utf8ToBin)\n/* harmony export */ });\n/* harmony import */ var _amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./amountInSatoshi.js */ \"./src/util/amountInSatoshi.ts\");\n/* harmony import */ var _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./asSendRequestObject.js */ \"./src/util/asSendRequestObject.ts\");\n/* harmony import */ var _base64_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64.js */ \"./src/util/base64.ts\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/hex.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/utf8.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/format/base64.js\");\n/* harmony import */ var _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @bitauth/libauth */ \"../../node_modules/@bitauth/libauth/build/lib/crypto/default-crypto-instances.js\");\n/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./convert.js */ \"./src/util/convert.ts\");\n/* harmony import */ var _delay_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./delay.js */ \"./src/util/delay.ts\");\n/* harmony import */ var _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./deriveNetwork.js */ \"./src/util/deriveNetwork.ts\");\n/* harmony import */ var _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./derivePublicKeyHash.js */ \"./src/util/derivePublicKeyHash.ts\");\n/* harmony import */ var _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./deriveCashaddr.js */ \"./src/util/deriveCashaddr.ts\");\n/* harmony import */ var _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../util/getAddrsByXpubKey.js */ \"./src/util/getAddrsByXpubKey.ts\");\n/* harmony import */ var _getRuntimePlatform_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./getRuntimePlatform.js */ \"./src/util/getRuntimePlatform.ts\");\n/* harmony import */ var _getUsdRate_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./getUsdRate.js */ \"./src/util/getUsdRate.ts\");\n/* harmony import */ var _hash160_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./hash160.js */ \"./src/util/hash160.ts\");\n/* harmony import */ var _rate_ExchangeRate_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../rate/ExchangeRate.js */ \"./src/rate/ExchangeRate.ts\");\n/* harmony import */ var _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./sanitizeAddress.js */ \"./src/util/sanitizeAddress.ts\");\n/* harmony import */ var _sanitizeUnit_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./sanitizeUnit.js */ \"./src/util/sanitizeUnit.ts\");\n/* harmony import */ var _randomInt_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./randomInt.js */ \"./src/util/randomInt.ts\");\n/* harmony import */ var _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/getXPubKey.js */ \"./src/util/getXPubKey.ts\");\n/* harmony import */ var _sumUtxoValue_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./sumUtxoValue.js */ \"./src/util/sumUtxoValue.ts\");\n/* harmony import */ var _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./balanceObjectFromSatoshi.js */ \"./src/util/balanceObjectFromSatoshi.ts\");\n/* harmony import */ var _header_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./header.js */ \"./src/util/header.ts\");\nvar __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__, _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__, _base64_js__WEBPACK_IMPORTED_MODULE_2__, _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__, _convert_js__WEBPACK_IMPORTED_MODULE_7__, _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__, _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__, _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__, _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__, _hash160_js__WEBPACK_IMPORTED_MODULE_15__, _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__, _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__, _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__, _header_js__WEBPACK_IMPORTED_MODULE_23__]);\n([_amountInSatoshi_js__WEBPACK_IMPORTED_MODULE_0__, _asSendRequestObject_js__WEBPACK_IMPORTED_MODULE_1__, _base64_js__WEBPACK_IMPORTED_MODULE_2__, _bitauth_libauth__WEBPACK_IMPORTED_MODULE_6__, _convert_js__WEBPACK_IMPORTED_MODULE_7__, _deriveNetwork_js__WEBPACK_IMPORTED_MODULE_9__, _derivePublicKeyHash_js__WEBPACK_IMPORTED_MODULE_10__, _deriveCashaddr_js__WEBPACK_IMPORTED_MODULE_11__, _util_getAddrsByXpubKey_js__WEBPACK_IMPORTED_MODULE_12__, _hash160_js__WEBPACK_IMPORTED_MODULE_15__, _sanitizeAddress_js__WEBPACK_IMPORTED_MODULE_17__, _util_getXPubKey_js__WEBPACK_IMPORTED_MODULE_20__, _balanceObjectFromSatoshi_js__WEBPACK_IMPORTED_MODULE_22__, _header_js__WEBPACK_IMPORTED_MODULE_23__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__webpack_async_result__();\n} catch(e) { __webpack_async_result__(e); } });\n\n//# sourceURL=webpack://mainnet-js/./src/util/index.ts?");
|
|
558
558
|
|
|
559
559
|
/***/ }),
|
|
560
560
|
|
|
@@ -754,7 +754,7 @@ eval("/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harm
|
|
|
754
754
|
\*****************************************************************************/
|
|
755
755
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
756
756
|
|
|
757
|
-
eval("/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CashAddressEncodingError\": () => (/* binding */ CashAddressEncodingError),\n/* harmony export */ \"CashAddressNetworkPrefix\": () => (/* binding */ CashAddressNetworkPrefix),\n/* harmony export */ \"CashAddressType\": () => (/* binding */ CashAddressType),\n/* harmony export */ \"cashAddressTypeBitsToType\": () => (/* binding */ cashAddressTypeBitsToType),\n/* harmony export */ \"decodeCashAddress\": () => (/* binding */ decodeCashAddress),\n/* harmony export */ \"decodeCashAddressFormat\": () => (/* binding */ decodeCashAddressFormat),\n/* harmony export */ \"decodeCashAddressFormatWithoutPrefix\": () => (/* binding */ decodeCashAddressFormatWithoutPrefix),\n/* harmony export */ \"decodeCashAddressVersionByte\": () => (/* binding */ decodeCashAddressVersionByte),\n/* harmony export */ \"encodeCashAddress\": () => (/* binding */ encodeCashAddress)\n/* harmony export */ });\n/* unused harmony exports CashAddressVersionByte, CashAddressTypeBits, cashAddressTypeToTypeBits, cashAddressLengthBitsToLength, cashAddressLengthToLengthBits, encodeCashAddressVersionByte, CashAddressVersionByteDecodingError, maskCashAddressPrefix, cashAddressPolynomialModulo, cashAddressChecksumToUint5Array, CashAddressFormatEncodingError, encodeCashAddressFormat, isValidCashAddressPayloadLength, encodeCashAddressNonStandard, CashAddressDecodingError, decodeCashAddressNonStandard, cashAddressPolynomialToCashAddress, CashAddressFormatCorrectionError, attemptCashAddressFormatErrorCorrection */\n/* harmony import */ var _format_format_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../format/format.js */ \"../../node_modules/@bitauth/libauth/build/lib/format/error.js\");\n/* harmony import */ var _bech32_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bech32.js */ \"../../node_modules/@bitauth/libauth/build/lib/address/bech32.js\");\n\n\nvar CashAddressNetworkPrefix;\n(function (CashAddressNetworkPrefix) {\n CashAddressNetworkPrefix[\"mainnet\"] = \"bitcoincash\";\n CashAddressNetworkPrefix[\"testnet\"] = \"bchtest\";\n CashAddressNetworkPrefix[\"regtest\"] = \"bchreg\";\n})(CashAddressNetworkPrefix || (CashAddressNetworkPrefix = {}));\n/**\n * The CashAddress specification standardizes the format of the version byte:\n * - Most significant bit: reserved, must be `0`\n * - next 4 bits: Address Type\n * - 3 least significant bits: Payload Length\n *\n * Two Address Type values are currently standardized:\n * - 0 (`0b0000`): P2PKH\n * - 1 (`0b0001`): P2SH\n *\n * And two are proposed by `CHIP-2022-02-CashTokens`:\n * - 2 (`0b0010`): P2PKH + Token Support\n * - 3 (`0b0011`): P2SH + Token Support\n *\n * The CashAddress specification standardizes expected payload length using\n * {@link CashAddressLengthBits}. Currently, two length bit values are in use by\n * standard CashAddress types:\n * - `0` (`0b000`): 20 bytes (in use by `p2pkh` and `p2sh20`)\n * - `3` (`0b011`): 32 bytes (in use by `p2sh32`)\n */\nvar CashAddressVersionByte;\n(function (CashAddressVersionByte) {\n /**\n * Pay to Public Key Hash (P2PKH): `0b00000000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0000` (P2PKH)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2pkh\"] = 0] = \"p2pkh\";\n /**\n * 20-byte Pay to Script Hash (P2SH20): `0b00001000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0001` (P2SH)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh20\"] = 8] = \"p2sh20\";\n /**\n * 32-byte Pay to Script Hash (P2SH20): `0b00001000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0001` (P2SH)\n * - Length bits: `011` (32 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh32\"] = 11] = \"p2sh32\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support: `0b00010000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0010` (P2PKH + Tokens)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2pkhWithTokens\"] = 16] = \"p2pkhWithTokens\";\n /**\n * 20-byte Pay to Script Hash (P2SH20) with token support: `0b00011000`\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0011` (P2SH + Tokens)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh20WithTokens\"] = 24] = \"p2sh20WithTokens\";\n /**\n * 32-byte Pay to Script Hash (P2SH32) with token support: `0b00011011`\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0011` (P2SH + Tokens)\n * - Length bits: `011` (32 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh32WithTokens\"] = 27] = \"p2sh32WithTokens\";\n})(CashAddressVersionByte || (CashAddressVersionByte = {}));\n/**\n * The address types currently defined in the CashAddress specification. See\n * also: {@link CashAddressVersionByte}.\n */\nvar CashAddressType;\n(function (CashAddressType) {\n /**\n * Pay to Public Key Hash (P2PKH): `0b0000`\n */\n CashAddressType[\"p2pkh\"] = \"p2pkh\";\n /**\n * Pay to Script Hash (P2SH): `0b0001`\n *\n * Note, this type is used for both {@link CashAddressVersionByte.p2sh20} and\n * {@link CashAddressVersionByte.p2sh32}.\n */\n CashAddressType[\"p2sh\"] = \"p2sh\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support: `0b0010`\n */\n CashAddressType[\"p2pkhWithTokens\"] = \"p2pkhWithTokens\";\n /**\n * Pay to Script Hash (P2SH) with token support: `0b0011`\n *\n * Note, this type is used for both\n * {@link CashAddressVersionByte.p2sh20WithTokens} and\n * {@link CashAddressVersionByte.p2sh32WithTokens}.\n */\n CashAddressType[\"p2shWithTokens\"] = \"p2shWithTokens\";\n})(CashAddressType || (CashAddressType = {}));\n/**\n * The address type bits currently defined in the CashAddress specification.\n * These map to: {@link CashAddressType}.\n */\nvar CashAddressTypeBits;\n(function (CashAddressTypeBits) {\n /**\n * Pay to Public Key Hash (P2PKH)\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2pkh\"] = 0] = \"p2pkh\";\n /**\n * Pay to Script Hash (P2SH)\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2sh\"] = 1] = \"p2sh\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2pkhWithTokens\"] = 2] = \"p2pkhWithTokens\";\n /**\n * Pay to Script Hash (P2SH) with token support\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2shWithTokens\"] = 3] = \"p2shWithTokens\";\n})(CashAddressTypeBits || (CashAddressTypeBits = {}));\nconst cashAddressTypeToTypeBits = {\n [CashAddressType.p2pkh]: CashAddressTypeBits.p2pkh,\n [CashAddressType.p2sh]: CashAddressTypeBits.p2sh,\n [CashAddressType.p2pkhWithTokens]: CashAddressTypeBits.p2pkhWithTokens,\n [CashAddressType.p2shWithTokens]: CashAddressTypeBits.p2shWithTokens,\n};\nconst cashAddressTypeBitsToType = {\n [CashAddressTypeBits.p2pkh]: CashAddressType.p2pkh,\n [CashAddressTypeBits.p2sh]: CashAddressType.p2sh,\n [CashAddressTypeBits.p2pkhWithTokens]: CashAddressType.p2pkhWithTokens,\n [CashAddressTypeBits.p2shWithTokens]: CashAddressType.p2shWithTokens,\n};\n/* eslint-disable @typescript-eslint/naming-convention */\nconst cashAddressLengthBitsToLength = {\n 0: 20,\n 1: 24,\n 2: 28,\n 3: 32,\n 4: 40,\n 5: 48,\n 6: 56,\n 7: 64,\n};\nconst cashAddressLengthToLengthBits = {\n 20: 0,\n 24: 1,\n 28: 2,\n 32: 3,\n 40: 4,\n 48: 5,\n 56: 6,\n 64: 7,\n};\n/**\n * Encode a CashAddress version byte for the given address type and payload\n * length. See {@link CashAddressVersionByte} for more information.\n *\n * The `type` parameter must be a number between `0` and `15`, and `bitLength`\n * must be one of the standardized lengths. To use the contents of a variable,\n * cast it to {@link CashAddressType} or\n * {@link CashAddressSupportedLength} respectively,\n * e.g.:\n * ```ts\n * const type = 3 as CashAddressType;\n * const length = 20 as CashAddressSupportedLength;\n * getCashAddressVersionByte(type, length);\n * ```\n *\n * For the reverse, see {@link decodeCashAddressVersionByte}.\n *\n * @param typeBits - The address type bit of the payload being encoded.\n * @param length - The length of the payload being encoded.\n */\nconst encodeCashAddressVersionByte = (typeBits, length) => \n// eslint-disable-next-line no-bitwise\n(typeBits << 3 /* Constants.cashAddressTypeBitsShift */) |\n cashAddressLengthToLengthBits[length];\nvar CashAddressVersionByteDecodingError;\n(function (CashAddressVersionByteDecodingError) {\n CashAddressVersionByteDecodingError[\"reservedBitSet\"] = \"Reserved bit is set.\";\n})(CashAddressVersionByteDecodingError || (CashAddressVersionByteDecodingError = {}));\n/**\n * Decode a CashAddress version byte. For a list of known versions, see\n * {@link CashAddressVersionByte}.\n *\n * For the reverse, see {@link encodeCashAddressVersionByte}.\n *\n * @param version - The version byte to decode.\n */\nconst decodeCashAddressVersionByte = (version) => \n// eslint-disable-next-line no-negated-condition, no-bitwise\n(version & 128 /* Constants.cashAddressReservedBitMask */) !== 0\n ? CashAddressVersionByteDecodingError.reservedBitSet\n : {\n length: cashAddressLengthBitsToLength[\n // eslint-disable-next-line no-bitwise\n (version &\n 7 /* Constants.cashAddressLengthBits */)],\n typeBits: \n // eslint-disable-next-line no-bitwise\n (version >>> 3 /* Constants.cashAddressTypeBitsShift */) &\n 15 /* Constants.cashAddressTypeBits */,\n };\n/**\n * Convert a string into an array of 5-bit numbers, representing the characters\n * in a case-insensitive way.\n *\n * @param prefix - The prefix to mask.\n */\nconst maskCashAddressPrefix = (prefix) => {\n const result = [];\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let i = 0; i < prefix.length; i++) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, functional/immutable-data\n result.push(prefix.charCodeAt(i) & 31 /* Constants.asciiCaseInsensitiveBits */);\n }\n return result;\n};\n// prettier-ignore\nconst bech32GeneratorMostSignificantByte = [0x98, 0x79, 0xf3, 0xae, 0x1e]; // eslint-disable-line @typescript-eslint/no-magic-numbers\n// prettier-ignore\nconst bech32GeneratorRemainingBytes = [0xf2bc8e61, 0xb76d99e2, 0x3e5fb3c4, 0x2eabe2a8, 0x4f43e470]; // eslint-disable-line @typescript-eslint/no-magic-numbers\n/**\n * Perform the CashAddress polynomial modulo operation, which is based on the\n * Bech32 polynomial modulo operation, but the returned checksum is 40 bits,\n * rather than 30.\n *\n * A.K.A. `PolyMod`\n *\n * @remarks\n * Notes from C++ implementation:\n * This function will compute what 8 5-bit values to XOR into the last 8 input\n * values, in order to make the checksum 0. These 8 values are packed together\n * in a single 40-bit integer. The higher bits correspond to earlier values.\n *\n * The input is interpreted as a list of coefficients of a polynomial over F\n * = GF(32), with an implicit 1 in front. If the input is [v0,v1,v2,v3,v4],\n * that polynomial is v(x) = 1*x^5 + v0*x^4 + v1*x^3 + v2*x^2 + v3*x + v4.\n * The implicit 1 guarantees that [v0,v1,v2,...] has a distinct checksum\n * from [0,v0,v1,v2,...].\n *\n * The output is a 40-bit integer whose 5-bit groups are the coefficients of\n * the remainder of v(x) mod g(x), where g(x) is the cashaddr generator, x^8\n * + [19]*x^7 + [3]*x^6 + [25]*x^5 + [11]*x^4 + [25]*x^3 + [3]*x^2 + [19]*x\n * + [1]. g(x) is chosen in such a way that the resulting code is a BCH\n * code, guaranteeing detection of up to 4 errors within a window of 1025\n * characters. Among the various possible BCH codes, one was selected to in\n * fact guarantee detection of up to 5 errors within a window of 160\n * characters and 6 errors within a window of 126 characters. In addition,\n * the code guarantee the detection of a burst of up to 8 errors.\n *\n * Note that the coefficients are elements of GF(32), here represented as\n * decimal numbers between []. In this finite field, addition is just XOR of\n * the corresponding numbers. For example, [27] + [13] = [27 ^ 13] = [22].\n * Multiplication is more complicated, and requires treating the bits of\n * values themselves as coefficients of a polynomial over a smaller field,\n * GF(2), and multiplying those polynomials mod a^5 + a^3 + 1. For example,\n * [5] * [26] = (a^2 + 1) * (a^4 + a^3 + a) = (a^4 + a^3 + a) * a^2 + (a^4 +\n * a^3 + a) = a^6 + a^5 + a^4 + a = a^3 + 1 (mod a^5 + a^3 + 1) = [9].\n *\n * During the course of the loop below, `c` contains the bit-packed\n * coefficients of the polynomial constructed from just the values of v that\n * were processed so far, mod g(x). In the above example, `c` initially\n * corresponds to 1 mod (x), and after processing 2 inputs of v, it\n * corresponds to x^2 + v0*x + v1 mod g(x). As 1 mod g(x) = 1, that is the\n * starting value for `c`.\n *\n * @param v - Array of 5-bit integers over which the checksum is to be computed.\n */\n// Derived from the `bitcore-lib-cash` implementation (does not require BigInt): https://github.com/bitpay/bitcore\nconst cashAddressPolynomialModulo = (v) => {\n /* eslint-disable functional/no-let, functional/no-loop-statements, functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers */\n let mostSignificantByte = 0;\n let lowerBytes = 1;\n let c = 0;\n // eslint-disable-next-line @typescript-eslint/prefer-for-of, no-plusplus\n for (let j = 0; j < v.length; j++) {\n c = mostSignificantByte >>> 3;\n mostSignificantByte &= 0x07;\n mostSignificantByte <<= 5;\n mostSignificantByte |= lowerBytes >>> 27;\n lowerBytes &= 0x07ffffff;\n lowerBytes <<= 5;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n lowerBytes ^= v[j];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < bech32GeneratorMostSignificantByte.length; ++i) {\n // eslint-disable-next-line functional/no-conditional-statements\n if (c & (1 << i)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n mostSignificantByte ^= bech32GeneratorMostSignificantByte[i];\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n lowerBytes ^= bech32GeneratorRemainingBytes[i];\n }\n }\n }\n lowerBytes ^= 1;\n // eslint-disable-next-line functional/no-conditional-statements\n if (lowerBytes < 0) {\n lowerBytes ^= 1 << 31;\n lowerBytes += (1 << 30) * 2;\n }\n return mostSignificantByte * (1 << 30) * 4 + lowerBytes;\n /* eslint-enable functional/no-let, functional/no-loop-statements, functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers */\n};\n/**\n * Convert the checksum returned by {@link cashAddressPolynomialModulo} to an\n * array of 5-bit positive integers that can be Base32 encoded.\n * @param checksum - A 40 bit checksum returned by\n * {@link cashAddressPolynomialModulo}.\n */\nconst cashAddressChecksumToUint5Array = (checksum) => {\n const result = [];\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let i = 0; i < 8 /* Constants.base256WordLength */; ++i) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers, functional/immutable-data\n result.push(checksum & 31);\n // eslint-disable-next-line functional/no-expression-statements, @typescript-eslint/no-magic-numbers, no-param-reassign\n checksum /= 32;\n }\n // eslint-disable-next-line functional/immutable-data\n return result.reverse();\n};\nvar CashAddressFormatEncodingError;\n(function (CashAddressFormatEncodingError) {\n CashAddressFormatEncodingError[\"excessiveVersion\"] = \"CashAddress format encoding error: version must be 255 or less.\";\n})(CashAddressFormatEncodingError || (CashAddressFormatEncodingError = {}));\nvar CashAddressEncodingError;\n(function (CashAddressEncodingError) {\n CashAddressEncodingError[\"noTypeBitsValueStandardizedForP2pk\"] = \"CashAddress encoding error: no CashAddress type bit has been standardized for P2PK locking bytecode.\";\n CashAddressEncodingError[\"unsupportedPayloadLength\"] = \"CashAddress encoding error: a payload of this length can not be encoded as a valid CashAddress.\";\n CashAddressEncodingError[\"unknownLockingBytecodeType\"] = \"CashAddress encoding error: unknown locking bytecode type.\";\n})(CashAddressEncodingError || (CashAddressEncodingError = {}));\n/**\n * Encode a payload as a CashAddress-like string using the CashAddress format.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * For the reverse, see {@link decodeCashAddressFormat}.\n *\n * To encode a standard CashAddress, use {@link encodeCashAddress}.\n */\nconst encodeCashAddressFormat = ({ payload, prefix, throwErrors = true, version, }) => {\n const checksum40BitPlaceholder = [0, 0, 0, 0, 0, 0, 0, 0];\n if (version > 255 /* Constants.maximumCashAddressFormatVersion */) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressFormatEncodingError.excessiveVersion, `Version: ${version}.`, throwErrors);\n }\n const payloadContents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.regroupBits)({\n bin: Uint8Array.from([version, ...payload]),\n resultWordLength: 5 /* Constants.base32WordLength */,\n sourceWordLength: 8 /* Constants.base256WordLength */,\n });\n const checksumContents = [\n ...maskCashAddressPrefix(prefix),\n 0 /* Constants.payloadSeparator */,\n ...payloadContents,\n ...checksum40BitPlaceholder,\n ];\n const checksum = cashAddressPolynomialModulo(checksumContents);\n const encoded = [\n ...payloadContents,\n ...cashAddressChecksumToUint5Array(checksum),\n ];\n const address = `${prefix}:${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.encodeBech32)(encoded)}`;\n return { address };\n};\nconst isValidCashAddressPayloadLength = (length) => cashAddressLengthToLengthBits[length] !== undefined;\n/**\n * Encode a payload as a CashAddress. This function is similar to\n * {@link encodeCashAddress} but supports non-standard `prefix`es and `type`s.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * For other address standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link encodeCashAddressFormat}.\n *\n * For the reverse, see {@link decodeCashAddressNonStandard}.\n */\nconst encodeCashAddressNonStandard = ({ payload, prefix, throwErrors = true, typeBits, }) => {\n const { length } = payload;\n if (!isValidCashAddressPayloadLength(length)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressEncodingError.unsupportedPayloadLength, `Payload length: ${length}.`, throwErrors);\n }\n return encodeCashAddressFormat({\n payload,\n prefix,\n throwErrors,\n version: encodeCashAddressVersionByte(typeBits, length),\n });\n};\n/**\n * Encode a payload as a CashAddress.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * To encode a CashAddress with a custom/unknown prefix or type bit, see\n * {@link encodeCashAddressNonStandard}. For other address standards that\n * closely follow the CashAddress specification (but have alternative version\n * byte requirements), use {@link encodeCashAddressFormat}.\n *\n * To decode a CashAddress, use {@link decodeCashAddress}.\n *\n * @returns If `throwErrors` is `true`, the CashAddress as a `string`. If\n * `throwErrors` is `false`, a {@link CashAddressResult} on successful encoding\n * or an error message as a `string`.\n */\nconst encodeCashAddress = ({ payload, prefix = 'bitcoincash', throwErrors = true, type, }) => encodeCashAddressNonStandard({\n payload,\n prefix,\n throwErrors,\n typeBits: cashAddressTypeToTypeBits[type],\n});\nvar CashAddressDecodingError;\n(function (CashAddressDecodingError) {\n CashAddressDecodingError[\"improperPadding\"] = \"CashAddress decoding error: the payload is improperly padded.\";\n CashAddressDecodingError[\"invalidCharacters\"] = \"CashAddress decoding error: the payload contains unexpected characters.\";\n CashAddressDecodingError[\"invalidChecksum\"] = \"CashAddress decoding error: invalid checksum - please review the address for errors.\";\n CashAddressDecodingError[\"invalidFormat\"] = \"CashAddress decoding error: CashAddresses should be of the form \\\"prefix:payload\\\".\";\n CashAddressDecodingError[\"mismatchedPayloadLength\"] = \"CashAddress decoding error: mismatched payload length for specified address version.\";\n CashAddressDecodingError[\"reservedBit\"] = \"CashAddress decoding error: unknown CashAddress version, reserved bit set.\";\n CashAddressDecodingError[\"unknownAddressType\"] = \"CashAddress decoding error: unknown CashAddress type.\";\n})(CashAddressDecodingError || (CashAddressDecodingError = {}));\n/**\n * Decode and validate a string using the CashAddress format. This is more\n * lenient than {@link decodeCashAddress}, which also validates the contents of\n * the version byte.\n *\n * Note, this method requires `address` to include a network prefix. To\n * decode a string with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * For the reverse, see {@link encodeCashAddressFormat}.\n *\n * @param address - The CashAddress-like string to decode.\n */\n// eslint-disable-next-line complexity\nconst decodeCashAddressFormat = (address) => {\n const parts = address.toLowerCase().split(':');\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n if (parts.length !== 2 || parts[0] === '' || parts[1] === '') {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidFormat, `Provided address: \"${address}\".`);\n }\n const [prefix, payload] = parts;\n if (!(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.isBech32CharacterSet)(payload)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidCharacters, `Invalid characters: ${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.extractNonBech32Characters)(payload).join(', ')}.`);\n }\n const decodedPayload = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.decodeBech32)(payload);\n const polynomial = [\n ...maskCashAddressPrefix(prefix),\n 0 /* Constants.payloadSeparator */,\n ...decodedPayload,\n ];\n if (cashAddressPolynomialModulo(polynomial) !== 0) {\n return CashAddressDecodingError.invalidChecksum;\n }\n const checksum40BitPlaceholderLength = 8;\n const payloadContents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.regroupBits)({\n allowPadding: false,\n bin: decodedPayload.slice(0, -checksum40BitPlaceholderLength),\n resultWordLength: 8 /* Constants.base256WordLength */,\n sourceWordLength: 5 /* Constants.base32WordLength */,\n });\n if (typeof payloadContents === 'string') {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.improperPadding, payloadContents);\n }\n const [version, ...contents] = payloadContents;\n const result = Uint8Array.from(contents);\n return { payload: result, prefix, version };\n};\n/**\n * Decode and validate a CashAddress, strictly checking the version byte\n * according to the CashAddress specification. This is important for error\n * detection in CashAddresses.\n *\n * This function is similar to {@link decodeCashAddress} but supports\n * non-standard `type`s.\n *\n * For other address-like standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link decodeCashAddressFormat}.\n *\n * Note, this method requires that CashAddresses include a network prefix. To\n * decode an address with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * For the reverse, see {@link encodeCashAddressNonStandard}.\n *\n * @param address - The CashAddress to decode.\n */\nconst decodeCashAddressNonStandard = (address) => {\n const decoded = decodeCashAddressFormat(address);\n if (typeof decoded === 'string') {\n return decoded;\n }\n const info = decodeCashAddressVersionByte(decoded.version);\n if (info === CashAddressVersionByteDecodingError.reservedBitSet) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.reservedBit);\n }\n if (decoded.payload.length !== info.length) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.mismatchedPayloadLength, `Version byte indicated a byte length of ${info.length}, but the payload is ${decoded.payload.length} bytes.`);\n }\n return {\n payload: decoded.payload,\n prefix: decoded.prefix,\n typeBits: info.typeBits,\n };\n};\n/**\n * Decode and validate a CashAddress, strictly checking the version byte\n * according to the CashAddress specification. This is important for error\n * detection in CashAddresses.\n *\n * To decode CashAddresses with non-standard `type`s,\n * see {@link decodeCashAddressNonStandard}.\n *\n * For other address-like standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link decodeCashAddressFormat}.\n *\n * Note, this method requires that CashAddresses include a network prefix. To\n * decode an address with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * To encode a CashAddress, use {@link encodeCashAddress}.\n *\n * @param address - The CashAddress to decode.\n */\nconst decodeCashAddress = (address) => {\n const decoded = decodeCashAddressNonStandard(address);\n if (typeof decoded === 'string') {\n return decoded;\n }\n const type = cashAddressTypeBitsToType[decoded.typeBits];\n if (type === undefined) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.unknownAddressType, `Type bit value: ${decoded.typeBits}.`);\n }\n return {\n payload: decoded.payload,\n prefix: decoded.prefix,\n type,\n };\n};\n/**\n * Attempt to decode and validate a CashAddress against a list of possible\n * prefixes. If the correct prefix is known, use {@link decodeCashAddress}.\n *\n * @param address - The CashAddress to decode.\n * @param possiblePrefixes - The network prefixes to try.\n */\n// decodeCashAddressWithoutPrefix\nconst decodeCashAddressFormatWithoutPrefix = (address, possiblePrefixes = [\n CashAddressNetworkPrefix.mainnet,\n CashAddressNetworkPrefix.testnet,\n CashAddressNetworkPrefix.regtest,\n]) => {\n // eslint-disable-next-line functional/no-loop-statements\n for (const prefix of possiblePrefixes) {\n const attempt = decodeCashAddressFormat(`${prefix}:${address}`);\n if (attempt !== CashAddressDecodingError.invalidChecksum) {\n return attempt;\n }\n }\n return CashAddressDecodingError.invalidChecksum;\n};\n/**\n * Convert a CashAddress polynomial to CashAddress string format.\n *\n * @remarks\n * CashAddress polynomials take the form:\n *\n * `[lowest 5 bits of each prefix character] 0 [payload + checksum]`\n *\n * This method remaps the 5-bit integers in the prefix location to the matching\n * ASCII lowercase characters, replaces the separator with `:`, and then Bech32\n * encodes the remaining payload and checksum.\n *\n * @param polynomial - An array of 5-bit integers representing the terms of a\n * CashAddress polynomial.\n */\nconst cashAddressPolynomialToCashAddress = (polynomial) => {\n const separatorPosition = polynomial.indexOf(0);\n const prefix = polynomial\n .slice(0, separatorPosition)\n .map((integer) => String.fromCharCode(96 /* Constants.asciiLowerCaseStart */ + integer))\n .join('');\n const contents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.encodeBech32)(polynomial.slice(separatorPosition + 1));\n return `${prefix}:${contents}`;\n};\nvar CashAddressFormatCorrectionError;\n(function (CashAddressFormatCorrectionError) {\n CashAddressFormatCorrectionError[\"tooManyErrors\"] = \"CashAddress format correction error: this address cannot be corrected as it contains more than 2 errors.\";\n})(CashAddressFormatCorrectionError || (CashAddressFormatCorrectionError = {}));\n/**\n * Attempt to correct up to 2 errors in a CashAddress-formatted string. The\n * string must include the prefix and only contain Bech32 characters.\n *\n * ## **CAUTION: improper use of this function can lead to lost funds.**\n *\n * Using error correction of CashAddress-like formats degrades error detection,\n * i.e. if the payload contains more than 2 errors, it is possible that error\n * correction will \"correct\" the payload to a plausible but incorrect payload.\n *\n * For applications which proceed to take irreversible actions – like sending a\n * payment – **naive usage of CashAddress Format error correction can lead to\n * vulnerabilities and lost funds**.\n *\n * It is strongly advised that this method only be used in fail-safe\n * applications (e.g. automatic correction of CashAddress-formatted private key\n * material during wallet recovery) or under explicit user control (e.g. \"The\n * address you entered is invalid, please review the highlighted characters and\n * try again.\").\n *\n * Only 2 substitution errors can be corrected (or a single swap) – deletions\n * and insertions (errors that shift many other characters and change the\n * length of the payload) can never be safely corrected and will produce an\n * error.\n *\n * Errors can be corrected in both the prefix and the payload, but attempting to\n * correct errors in the prefix prior to this method can improve results, e.g.\n * for `bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfde0x`, the string\n * `bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc` can be corrected, while\n * `typo:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc` can not.\n *\n * @param address - The address or formatted data to correct.\n */\n// Derived from: https://github.com/deadalnix/cashaddressed\n// eslint-disable-next-line complexity\nconst attemptCashAddressFormatErrorCorrection = (address) => {\n const parts = address.toLowerCase().split(':');\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n if (parts.length !== 2 || parts[0] === '' || parts[1] === '') {\n return CashAddressDecodingError.invalidFormat;\n }\n const [prefix, payload] = parts;\n if (!(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.isBech32CharacterSet)(payload)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidCharacters, `Invalid characters: ${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.extractNonBech32Characters)(payload).join(', ')}.`);\n }\n const decodedPayload = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.decodeBech32)(payload);\n const polynomial = [...maskCashAddressPrefix(prefix), 0, ...decodedPayload];\n const originalChecksum = cashAddressPolynomialModulo(polynomial);\n if (originalChecksum === 0) {\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [],\n };\n }\n const syndromes = {};\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let term = 0; term < polynomial.length; term++) {\n // eslint-disable-next-line functional/no-loop-statements\n for (\n // eslint-disable-next-line functional/no-let\n let errorVector = 1; errorVector < 32 /* Constants.finiteFieldOrder */; \n // eslint-disable-next-line no-plusplus\n errorVector++) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[term] ^= errorVector;\n const correct = cashAddressPolynomialModulo(polynomial);\n if (correct === 0) {\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [term],\n };\n }\n // eslint-disable-next-line no-bitwise\n const s0 = (BigInt(correct) ^ BigInt(originalChecksum)).toString();\n // eslint-disable-next-line functional/no-expression-statements, functional/immutable-data\n syndromes[s0] = term * 32 /* Constants.finiteFieldOrder */ + errorVector;\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[term] ^= errorVector;\n }\n }\n // eslint-disable-next-line functional/no-loop-statements\n for (const [s0, pe] of Object.entries(syndromes)) {\n // eslint-disable-next-line no-bitwise\n const s1Location = (BigInt(s0) ^ BigInt(originalChecksum)).toString();\n const s1 = syndromes[s1Location];\n if (s1 !== undefined) {\n const correctionIndex1 = Math.trunc(pe / 32 /* Constants.finiteFieldOrder */);\n const correctionIndex2 = Math.trunc(s1 / 32 /* Constants.finiteFieldOrder */);\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[correctionIndex1] ^= pe % 32 /* Constants.finiteFieldOrder */;\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[correctionIndex2] ^= s1 % 32 /* Constants.finiteFieldOrder */;\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [correctionIndex1, correctionIndex2].sort((a, b) => a - b),\n };\n }\n }\n return CashAddressFormatCorrectionError.tooManyErrors;\n};\n//# sourceMappingURL=cash-address.js.map\n\n//# sourceURL=webpack://mainnet-js/../../node_modules/@bitauth/libauth/build/lib/address/cash-address.js?");
|
|
757
|
+
eval("/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CashAddressEncodingError\": () => (/* binding */ CashAddressEncodingError),\n/* harmony export */ \"CashAddressNetworkPrefix\": () => (/* binding */ CashAddressNetworkPrefix),\n/* harmony export */ \"CashAddressType\": () => (/* binding */ CashAddressType),\n/* harmony export */ \"decodeCashAddress\": () => (/* binding */ decodeCashAddress),\n/* harmony export */ \"decodeCashAddressFormat\": () => (/* binding */ decodeCashAddressFormat),\n/* harmony export */ \"decodeCashAddressFormatWithoutPrefix\": () => (/* binding */ decodeCashAddressFormatWithoutPrefix),\n/* harmony export */ \"encodeCashAddress\": () => (/* binding */ encodeCashAddress)\n/* harmony export */ });\n/* unused harmony exports CashAddressVersionByte, CashAddressTypeBits, cashAddressTypeToTypeBits, cashAddressTypeBitsToType, cashAddressLengthBitsToLength, cashAddressLengthToLengthBits, encodeCashAddressVersionByte, CashAddressVersionByteDecodingError, decodeCashAddressVersionByte, maskCashAddressPrefix, cashAddressPolynomialModulo, cashAddressChecksumToUint5Array, CashAddressFormatEncodingError, encodeCashAddressFormat, isValidCashAddressPayloadLength, encodeCashAddressNonStandard, CashAddressDecodingError, decodeCashAddressNonStandard, cashAddressPolynomialToCashAddress, CashAddressFormatCorrectionError, attemptCashAddressFormatErrorCorrection */\n/* harmony import */ var _format_format_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../format/format.js */ \"../../node_modules/@bitauth/libauth/build/lib/format/error.js\");\n/* harmony import */ var _bech32_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bech32.js */ \"../../node_modules/@bitauth/libauth/build/lib/address/bech32.js\");\n\n\nvar CashAddressNetworkPrefix;\n(function (CashAddressNetworkPrefix) {\n CashAddressNetworkPrefix[\"mainnet\"] = \"bitcoincash\";\n CashAddressNetworkPrefix[\"testnet\"] = \"bchtest\";\n CashAddressNetworkPrefix[\"regtest\"] = \"bchreg\";\n})(CashAddressNetworkPrefix || (CashAddressNetworkPrefix = {}));\n/**\n * The CashAddress specification standardizes the format of the version byte:\n * - Most significant bit: reserved, must be `0`\n * - next 4 bits: Address Type\n * - 3 least significant bits: Payload Length\n *\n * Two Address Type values are currently standardized:\n * - 0 (`0b0000`): P2PKH\n * - 1 (`0b0001`): P2SH\n *\n * And two are proposed by `CHIP-2022-02-CashTokens`:\n * - 2 (`0b0010`): P2PKH + Token Support\n * - 3 (`0b0011`): P2SH + Token Support\n *\n * The CashAddress specification standardizes expected payload length using\n * {@link CashAddressLengthBits}. Currently, two length bit values are in use by\n * standard CashAddress types:\n * - `0` (`0b000`): 20 bytes (in use by `p2pkh` and `p2sh20`)\n * - `3` (`0b011`): 32 bytes (in use by `p2sh32`)\n */\nvar CashAddressVersionByte;\n(function (CashAddressVersionByte) {\n /**\n * Pay to Public Key Hash (P2PKH): `0b00000000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0000` (P2PKH)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2pkh\"] = 0] = \"p2pkh\";\n /**\n * 20-byte Pay to Script Hash (P2SH20): `0b00001000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0001` (P2SH)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh20\"] = 8] = \"p2sh20\";\n /**\n * 32-byte Pay to Script Hash (P2SH20): `0b00001000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0001` (P2SH)\n * - Length bits: `011` (32 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh32\"] = 11] = \"p2sh32\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support: `0b00010000`\n *\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0010` (P2PKH + Tokens)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2pkhWithTokens\"] = 16] = \"p2pkhWithTokens\";\n /**\n * 20-byte Pay to Script Hash (P2SH20) with token support: `0b00011000`\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0011` (P2SH + Tokens)\n * - Length bits: `000` (20 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh20WithTokens\"] = 24] = \"p2sh20WithTokens\";\n /**\n * 32-byte Pay to Script Hash (P2SH32) with token support: `0b00011011`\n * - Most significant bit: `0` (reserved)\n * - Address Type bits: `0011` (P2SH + Tokens)\n * - Length bits: `011` (32 bytes)\n */\n CashAddressVersionByte[CashAddressVersionByte[\"p2sh32WithTokens\"] = 27] = \"p2sh32WithTokens\";\n})(CashAddressVersionByte || (CashAddressVersionByte = {}));\n/**\n * The address types currently defined in the CashAddress specification. See\n * also: {@link CashAddressVersionByte}.\n */\nvar CashAddressType;\n(function (CashAddressType) {\n /**\n * Pay to Public Key Hash (P2PKH): `0b0000`\n */\n CashAddressType[\"p2pkh\"] = \"p2pkh\";\n /**\n * Pay to Script Hash (P2SH): `0b0001`\n *\n * Note, this type is used for both {@link CashAddressVersionByte.p2sh20} and\n * {@link CashAddressVersionByte.p2sh32}.\n */\n CashAddressType[\"p2sh\"] = \"p2sh\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support: `0b0010`\n */\n CashAddressType[\"p2pkhWithTokens\"] = \"p2pkhWithTokens\";\n /**\n * Pay to Script Hash (P2SH) with token support: `0b0011`\n *\n * Note, this type is used for both\n * {@link CashAddressVersionByte.p2sh20WithTokens} and\n * {@link CashAddressVersionByte.p2sh32WithTokens}.\n */\n CashAddressType[\"p2shWithTokens\"] = \"p2shWithTokens\";\n})(CashAddressType || (CashAddressType = {}));\n/**\n * The address type bits currently defined in the CashAddress specification.\n * These map to: {@link CashAddressType}.\n */\nvar CashAddressTypeBits;\n(function (CashAddressTypeBits) {\n /**\n * Pay to Public Key Hash (P2PKH)\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2pkh\"] = 0] = \"p2pkh\";\n /**\n * Pay to Script Hash (P2SH)\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2sh\"] = 1] = \"p2sh\";\n /**\n * Pay to Public Key Hash (P2PKH) with token support\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2pkhWithTokens\"] = 2] = \"p2pkhWithTokens\";\n /**\n * Pay to Script Hash (P2SH) with token support\n */\n CashAddressTypeBits[CashAddressTypeBits[\"p2shWithTokens\"] = 3] = \"p2shWithTokens\";\n})(CashAddressTypeBits || (CashAddressTypeBits = {}));\nconst cashAddressTypeToTypeBits = {\n [CashAddressType.p2pkh]: CashAddressTypeBits.p2pkh,\n [CashAddressType.p2sh]: CashAddressTypeBits.p2sh,\n [CashAddressType.p2pkhWithTokens]: CashAddressTypeBits.p2pkhWithTokens,\n [CashAddressType.p2shWithTokens]: CashAddressTypeBits.p2shWithTokens,\n};\nconst cashAddressTypeBitsToType = {\n [CashAddressTypeBits.p2pkh]: CashAddressType.p2pkh,\n [CashAddressTypeBits.p2sh]: CashAddressType.p2sh,\n [CashAddressTypeBits.p2pkhWithTokens]: CashAddressType.p2pkhWithTokens,\n [CashAddressTypeBits.p2shWithTokens]: CashAddressType.p2shWithTokens,\n};\n/* eslint-disable @typescript-eslint/naming-convention */\nconst cashAddressLengthBitsToLength = {\n 0: 20,\n 1: 24,\n 2: 28,\n 3: 32,\n 4: 40,\n 5: 48,\n 6: 56,\n 7: 64,\n};\nconst cashAddressLengthToLengthBits = {\n 20: 0,\n 24: 1,\n 28: 2,\n 32: 3,\n 40: 4,\n 48: 5,\n 56: 6,\n 64: 7,\n};\n/**\n * Encode a CashAddress version byte for the given address type and payload\n * length. See {@link CashAddressVersionByte} for more information.\n *\n * The `type` parameter must be a number between `0` and `15`, and `bitLength`\n * must be one of the standardized lengths. To use the contents of a variable,\n * cast it to {@link CashAddressType} or\n * {@link CashAddressSupportedLength} respectively,\n * e.g.:\n * ```ts\n * const type = 3 as CashAddressType;\n * const length = 20 as CashAddressSupportedLength;\n * getCashAddressVersionByte(type, length);\n * ```\n *\n * For the reverse, see {@link decodeCashAddressVersionByte}.\n *\n * @param typeBits - The address type bit of the payload being encoded.\n * @param length - The length of the payload being encoded.\n */\nconst encodeCashAddressVersionByte = (typeBits, length) => \n// eslint-disable-next-line no-bitwise\n(typeBits << 3 /* Constants.cashAddressTypeBitsShift */) |\n cashAddressLengthToLengthBits[length];\nvar CashAddressVersionByteDecodingError;\n(function (CashAddressVersionByteDecodingError) {\n CashAddressVersionByteDecodingError[\"reservedBitSet\"] = \"Reserved bit is set.\";\n})(CashAddressVersionByteDecodingError || (CashAddressVersionByteDecodingError = {}));\n/**\n * Decode a CashAddress version byte. For a list of known versions, see\n * {@link CashAddressVersionByte}.\n *\n * For the reverse, see {@link encodeCashAddressVersionByte}.\n *\n * @param version - The version byte to decode.\n */\nconst decodeCashAddressVersionByte = (version) => \n// eslint-disable-next-line no-negated-condition, no-bitwise\n(version & 128 /* Constants.cashAddressReservedBitMask */) !== 0\n ? CashAddressVersionByteDecodingError.reservedBitSet\n : {\n length: cashAddressLengthBitsToLength[\n // eslint-disable-next-line no-bitwise\n (version &\n 7 /* Constants.cashAddressLengthBits */)],\n typeBits: \n // eslint-disable-next-line no-bitwise\n (version >>> 3 /* Constants.cashAddressTypeBitsShift */) &\n 15 /* Constants.cashAddressTypeBits */,\n };\n/**\n * Convert a string into an array of 5-bit numbers, representing the characters\n * in a case-insensitive way.\n *\n * @param prefix - The prefix to mask.\n */\nconst maskCashAddressPrefix = (prefix) => {\n const result = [];\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let i = 0; i < prefix.length; i++) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, functional/immutable-data\n result.push(prefix.charCodeAt(i) & 31 /* Constants.asciiCaseInsensitiveBits */);\n }\n return result;\n};\n// prettier-ignore\nconst bech32GeneratorMostSignificantByte = [0x98, 0x79, 0xf3, 0xae, 0x1e]; // eslint-disable-line @typescript-eslint/no-magic-numbers\n// prettier-ignore\nconst bech32GeneratorRemainingBytes = [0xf2bc8e61, 0xb76d99e2, 0x3e5fb3c4, 0x2eabe2a8, 0x4f43e470]; // eslint-disable-line @typescript-eslint/no-magic-numbers\n/**\n * Perform the CashAddress polynomial modulo operation, which is based on the\n * Bech32 polynomial modulo operation, but the returned checksum is 40 bits,\n * rather than 30.\n *\n * A.K.A. `PolyMod`\n *\n * @remarks\n * Notes from C++ implementation:\n * This function will compute what 8 5-bit values to XOR into the last 8 input\n * values, in order to make the checksum 0. These 8 values are packed together\n * in a single 40-bit integer. The higher bits correspond to earlier values.\n *\n * The input is interpreted as a list of coefficients of a polynomial over F\n * = GF(32), with an implicit 1 in front. If the input is [v0,v1,v2,v3,v4],\n * that polynomial is v(x) = 1*x^5 + v0*x^4 + v1*x^3 + v2*x^2 + v3*x + v4.\n * The implicit 1 guarantees that [v0,v1,v2,...] has a distinct checksum\n * from [0,v0,v1,v2,...].\n *\n * The output is a 40-bit integer whose 5-bit groups are the coefficients of\n * the remainder of v(x) mod g(x), where g(x) is the cashaddr generator, x^8\n * + [19]*x^7 + [3]*x^6 + [25]*x^5 + [11]*x^4 + [25]*x^3 + [3]*x^2 + [19]*x\n * + [1]. g(x) is chosen in such a way that the resulting code is a BCH\n * code, guaranteeing detection of up to 4 errors within a window of 1025\n * characters. Among the various possible BCH codes, one was selected to in\n * fact guarantee detection of up to 5 errors within a window of 160\n * characters and 6 errors within a window of 126 characters. In addition,\n * the code guarantee the detection of a burst of up to 8 errors.\n *\n * Note that the coefficients are elements of GF(32), here represented as\n * decimal numbers between []. In this finite field, addition is just XOR of\n * the corresponding numbers. For example, [27] + [13] = [27 ^ 13] = [22].\n * Multiplication is more complicated, and requires treating the bits of\n * values themselves as coefficients of a polynomial over a smaller field,\n * GF(2), and multiplying those polynomials mod a^5 + a^3 + 1. For example,\n * [5] * [26] = (a^2 + 1) * (a^4 + a^3 + a) = (a^4 + a^3 + a) * a^2 + (a^4 +\n * a^3 + a) = a^6 + a^5 + a^4 + a = a^3 + 1 (mod a^5 + a^3 + 1) = [9].\n *\n * During the course of the loop below, `c` contains the bit-packed\n * coefficients of the polynomial constructed from just the values of v that\n * were processed so far, mod g(x). In the above example, `c` initially\n * corresponds to 1 mod (x), and after processing 2 inputs of v, it\n * corresponds to x^2 + v0*x + v1 mod g(x). As 1 mod g(x) = 1, that is the\n * starting value for `c`.\n *\n * @param v - Array of 5-bit integers over which the checksum is to be computed.\n */\n// Derived from the `bitcore-lib-cash` implementation (does not require BigInt): https://github.com/bitpay/bitcore\nconst cashAddressPolynomialModulo = (v) => {\n /* eslint-disable functional/no-let, functional/no-loop-statements, functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers */\n let mostSignificantByte = 0;\n let lowerBytes = 1;\n let c = 0;\n // eslint-disable-next-line @typescript-eslint/prefer-for-of, no-plusplus\n for (let j = 0; j < v.length; j++) {\n c = mostSignificantByte >>> 3;\n mostSignificantByte &= 0x07;\n mostSignificantByte <<= 5;\n mostSignificantByte |= lowerBytes >>> 27;\n lowerBytes &= 0x07ffffff;\n lowerBytes <<= 5;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n lowerBytes ^= v[j];\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < bech32GeneratorMostSignificantByte.length; ++i) {\n // eslint-disable-next-line functional/no-conditional-statements\n if (c & (1 << i)) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n mostSignificantByte ^= bech32GeneratorMostSignificantByte[i];\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n lowerBytes ^= bech32GeneratorRemainingBytes[i];\n }\n }\n }\n lowerBytes ^= 1;\n // eslint-disable-next-line functional/no-conditional-statements\n if (lowerBytes < 0) {\n lowerBytes ^= 1 << 31;\n lowerBytes += (1 << 30) * 2;\n }\n return mostSignificantByte * (1 << 30) * 4 + lowerBytes;\n /* eslint-enable functional/no-let, functional/no-loop-statements, functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers */\n};\n/**\n * Convert the checksum returned by {@link cashAddressPolynomialModulo} to an\n * array of 5-bit positive integers that can be Base32 encoded.\n * @param checksum - A 40 bit checksum returned by\n * {@link cashAddressPolynomialModulo}.\n */\nconst cashAddressChecksumToUint5Array = (checksum) => {\n const result = [];\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let i = 0; i < 8 /* Constants.base256WordLength */; ++i) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-magic-numbers, functional/immutable-data\n result.push(checksum & 31);\n // eslint-disable-next-line functional/no-expression-statements, @typescript-eslint/no-magic-numbers, no-param-reassign\n checksum /= 32;\n }\n // eslint-disable-next-line functional/immutable-data\n return result.reverse();\n};\nvar CashAddressFormatEncodingError;\n(function (CashAddressFormatEncodingError) {\n CashAddressFormatEncodingError[\"excessiveVersion\"] = \"CashAddress format encoding error: version must be 255 or less.\";\n})(CashAddressFormatEncodingError || (CashAddressFormatEncodingError = {}));\nvar CashAddressEncodingError;\n(function (CashAddressEncodingError) {\n CashAddressEncodingError[\"noTypeBitsValueStandardizedForP2pk\"] = \"CashAddress encoding error: no CashAddress type bit has been standardized for P2PK locking bytecode.\";\n CashAddressEncodingError[\"unsupportedPayloadLength\"] = \"CashAddress encoding error: a payload of this length can not be encoded as a valid CashAddress.\";\n CashAddressEncodingError[\"unknownLockingBytecodeType\"] = \"CashAddress encoding error: unknown locking bytecode type.\";\n})(CashAddressEncodingError || (CashAddressEncodingError = {}));\n/**\n * Encode a payload as a CashAddress-like string using the CashAddress format.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * For the reverse, see {@link decodeCashAddressFormat}.\n *\n * To encode a standard CashAddress, use {@link encodeCashAddress}.\n */\nconst encodeCashAddressFormat = ({ payload, prefix, throwErrors = true, version, }) => {\n const checksum40BitPlaceholder = [0, 0, 0, 0, 0, 0, 0, 0];\n if (version > 255 /* Constants.maximumCashAddressFormatVersion */) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressFormatEncodingError.excessiveVersion, `Version: ${version}.`, throwErrors);\n }\n const payloadContents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.regroupBits)({\n bin: Uint8Array.from([version, ...payload]),\n resultWordLength: 5 /* Constants.base32WordLength */,\n sourceWordLength: 8 /* Constants.base256WordLength */,\n });\n const checksumContents = [\n ...maskCashAddressPrefix(prefix),\n 0 /* Constants.payloadSeparator */,\n ...payloadContents,\n ...checksum40BitPlaceholder,\n ];\n const checksum = cashAddressPolynomialModulo(checksumContents);\n const encoded = [\n ...payloadContents,\n ...cashAddressChecksumToUint5Array(checksum),\n ];\n const address = `${prefix}:${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.encodeBech32)(encoded)}`;\n return { address };\n};\nconst isValidCashAddressPayloadLength = (length) => cashAddressLengthToLengthBits[length] !== undefined;\n/**\n * Encode a payload as a CashAddress. This function is similar to\n * {@link encodeCashAddress} but supports non-standard `prefix`es and `type`s.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * For other address standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link encodeCashAddressFormat}.\n *\n * For the reverse, see {@link decodeCashAddressNonStandard}.\n */\nconst encodeCashAddressNonStandard = ({ payload, prefix, throwErrors = true, typeBits, }) => {\n const { length } = payload;\n if (!isValidCashAddressPayloadLength(length)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressEncodingError.unsupportedPayloadLength, `Payload length: ${length}.`, throwErrors);\n }\n return encodeCashAddressFormat({\n payload,\n prefix,\n throwErrors,\n version: encodeCashAddressVersionByte(typeBits, length),\n });\n};\n/**\n * Encode a payload as a CashAddress.\n *\n * Note that this function defaults to throwing encoding errors. To handle\n * errors in a type-safe way, set `throwErrors` to `false`.\n *\n * To encode a CashAddress with a custom/unknown prefix or type bit, see\n * {@link encodeCashAddressNonStandard}. For other address standards that\n * closely follow the CashAddress specification (but have alternative version\n * byte requirements), use {@link encodeCashAddressFormat}.\n *\n * To decode a CashAddress, use {@link decodeCashAddress}.\n *\n * @returns If `throwErrors` is `true`, the CashAddress as a `string`. If\n * `throwErrors` is `false`, a {@link CashAddressResult} on successful encoding\n * or an error message as a `string`.\n */\nconst encodeCashAddress = ({ payload, prefix = 'bitcoincash', throwErrors = true, type, }) => encodeCashAddressNonStandard({\n payload,\n prefix,\n throwErrors,\n typeBits: cashAddressTypeToTypeBits[type],\n});\nvar CashAddressDecodingError;\n(function (CashAddressDecodingError) {\n CashAddressDecodingError[\"improperPadding\"] = \"CashAddress decoding error: the payload is improperly padded.\";\n CashAddressDecodingError[\"invalidCharacters\"] = \"CashAddress decoding error: the payload contains unexpected characters.\";\n CashAddressDecodingError[\"invalidChecksum\"] = \"CashAddress decoding error: invalid checksum - please review the address for errors.\";\n CashAddressDecodingError[\"invalidFormat\"] = \"CashAddress decoding error: CashAddresses should be of the form \\\"prefix:payload\\\".\";\n CashAddressDecodingError[\"mismatchedPayloadLength\"] = \"CashAddress decoding error: mismatched payload length for specified address version.\";\n CashAddressDecodingError[\"reservedBit\"] = \"CashAddress decoding error: unknown CashAddress version, reserved bit set.\";\n CashAddressDecodingError[\"unknownAddressType\"] = \"CashAddress decoding error: unknown CashAddress type.\";\n})(CashAddressDecodingError || (CashAddressDecodingError = {}));\n/**\n * Decode and validate a string using the CashAddress format. This is more\n * lenient than {@link decodeCashAddress}, which also validates the contents of\n * the version byte.\n *\n * Note, this method requires `address` to include a network prefix. To\n * decode a string with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * For the reverse, see {@link encodeCashAddressFormat}.\n *\n * @param address - The CashAddress-like string to decode.\n */\n// eslint-disable-next-line complexity\nconst decodeCashAddressFormat = (address) => {\n const parts = address.toLowerCase().split(':');\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n if (parts.length !== 2 || parts[0] === '' || parts[1] === '') {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidFormat, `Provided address: \"${address}\".`);\n }\n const [prefix, payload] = parts;\n if (!(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.isBech32CharacterSet)(payload)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidCharacters, `Invalid characters: ${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.extractNonBech32Characters)(payload).join(', ')}.`);\n }\n const decodedPayload = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.decodeBech32)(payload);\n const polynomial = [\n ...maskCashAddressPrefix(prefix),\n 0 /* Constants.payloadSeparator */,\n ...decodedPayload,\n ];\n if (cashAddressPolynomialModulo(polynomial) !== 0) {\n return CashAddressDecodingError.invalidChecksum;\n }\n const checksum40BitPlaceholderLength = 8;\n const payloadContents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.regroupBits)({\n allowPadding: false,\n bin: decodedPayload.slice(0, -checksum40BitPlaceholderLength),\n resultWordLength: 8 /* Constants.base256WordLength */,\n sourceWordLength: 5 /* Constants.base32WordLength */,\n });\n if (typeof payloadContents === 'string') {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.improperPadding, payloadContents);\n }\n const [version, ...contents] = payloadContents;\n const result = Uint8Array.from(contents);\n return { payload: result, prefix, version };\n};\n/**\n * Decode and validate a CashAddress, strictly checking the version byte\n * according to the CashAddress specification. This is important for error\n * detection in CashAddresses.\n *\n * This function is similar to {@link decodeCashAddress} but supports\n * non-standard `type`s.\n *\n * For other address-like standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link decodeCashAddressFormat}.\n *\n * Note, this method requires that CashAddresses include a network prefix. To\n * decode an address with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * For the reverse, see {@link encodeCashAddressNonStandard}.\n *\n * @param address - The CashAddress to decode.\n */\nconst decodeCashAddressNonStandard = (address) => {\n const decoded = decodeCashAddressFormat(address);\n if (typeof decoded === 'string') {\n return decoded;\n }\n const info = decodeCashAddressVersionByte(decoded.version);\n if (info === CashAddressVersionByteDecodingError.reservedBitSet) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.reservedBit);\n }\n if (decoded.payload.length !== info.length) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.mismatchedPayloadLength, `Version byte indicated a byte length of ${info.length}, but the payload is ${decoded.payload.length} bytes.`);\n }\n return {\n payload: decoded.payload,\n prefix: decoded.prefix,\n typeBits: info.typeBits,\n };\n};\n/**\n * Decode and validate a CashAddress, strictly checking the version byte\n * according to the CashAddress specification. This is important for error\n * detection in CashAddresses.\n *\n * To decode CashAddresses with non-standard `type`s,\n * see {@link decodeCashAddressNonStandard}.\n *\n * For other address-like standards that closely follow the CashAddress\n * specification (but have alternative version byte requirements), use\n * {@link decodeCashAddressFormat}.\n *\n * Note, this method requires that CashAddresses include a network prefix. To\n * decode an address with an unknown prefix, try\n * {@link decodeCashAddressFormatWithoutPrefix}.\n *\n * To encode a CashAddress, use {@link encodeCashAddress}.\n *\n * @param address - The CashAddress to decode.\n */\nconst decodeCashAddress = (address) => {\n const decoded = decodeCashAddressNonStandard(address);\n if (typeof decoded === 'string') {\n return decoded;\n }\n const type = cashAddressTypeBitsToType[decoded.typeBits];\n if (type === undefined) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.unknownAddressType, `Type bit value: ${decoded.typeBits}.`);\n }\n return {\n payload: decoded.payload,\n prefix: decoded.prefix,\n type,\n };\n};\n/**\n * Attempt to decode and validate a CashAddress against a list of possible\n * prefixes. If the correct prefix is known, use {@link decodeCashAddress}.\n *\n * @param address - The CashAddress to decode.\n * @param possiblePrefixes - The network prefixes to try.\n */\n// decodeCashAddressWithoutPrefix\nconst decodeCashAddressFormatWithoutPrefix = (address, possiblePrefixes = [\n CashAddressNetworkPrefix.mainnet,\n CashAddressNetworkPrefix.testnet,\n CashAddressNetworkPrefix.regtest,\n]) => {\n // eslint-disable-next-line functional/no-loop-statements\n for (const prefix of possiblePrefixes) {\n const attempt = decodeCashAddressFormat(`${prefix}:${address}`);\n if (attempt !== CashAddressDecodingError.invalidChecksum) {\n return attempt;\n }\n }\n return CashAddressDecodingError.invalidChecksum;\n};\n/**\n * Convert a CashAddress polynomial to CashAddress string format.\n *\n * @remarks\n * CashAddress polynomials take the form:\n *\n * `[lowest 5 bits of each prefix character] 0 [payload + checksum]`\n *\n * This method remaps the 5-bit integers in the prefix location to the matching\n * ASCII lowercase characters, replaces the separator with `:`, and then Bech32\n * encodes the remaining payload and checksum.\n *\n * @param polynomial - An array of 5-bit integers representing the terms of a\n * CashAddress polynomial.\n */\nconst cashAddressPolynomialToCashAddress = (polynomial) => {\n const separatorPosition = polynomial.indexOf(0);\n const prefix = polynomial\n .slice(0, separatorPosition)\n .map((integer) => String.fromCharCode(96 /* Constants.asciiLowerCaseStart */ + integer))\n .join('');\n const contents = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.encodeBech32)(polynomial.slice(separatorPosition + 1));\n return `${prefix}:${contents}`;\n};\nvar CashAddressFormatCorrectionError;\n(function (CashAddressFormatCorrectionError) {\n CashAddressFormatCorrectionError[\"tooManyErrors\"] = \"CashAddress format correction error: this address cannot be corrected as it contains more than 2 errors.\";\n})(CashAddressFormatCorrectionError || (CashAddressFormatCorrectionError = {}));\n/**\n * Attempt to correct up to 2 errors in a CashAddress-formatted string. The\n * string must include the prefix and only contain Bech32 characters.\n *\n * ## **CAUTION: improper use of this function can lead to lost funds.**\n *\n * Using error correction of CashAddress-like formats degrades error detection,\n * i.e. if the payload contains more than 2 errors, it is possible that error\n * correction will \"correct\" the payload to a plausible but incorrect payload.\n *\n * For applications which proceed to take irreversible actions – like sending a\n * payment – **naive usage of CashAddress Format error correction can lead to\n * vulnerabilities and lost funds**.\n *\n * It is strongly advised that this method only be used in fail-safe\n * applications (e.g. automatic correction of CashAddress-formatted private key\n * material during wallet recovery) or under explicit user control (e.g. \"The\n * address you entered is invalid, please review the highlighted characters and\n * try again.\").\n *\n * Only 2 substitution errors can be corrected (or a single swap) – deletions\n * and insertions (errors that shift many other characters and change the\n * length of the payload) can never be safely corrected and will produce an\n * error.\n *\n * Errors can be corrected in both the prefix and the payload, but attempting to\n * correct errors in the prefix prior to this method can improve results, e.g.\n * for `bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfde0x`, the string\n * `bchtest:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc` can be corrected, while\n * `typo:qq2azmyyv6dtgczexyalqar70q036yund53jvfdecc` can not.\n *\n * @param address - The address or formatted data to correct.\n */\n// Derived from: https://github.com/deadalnix/cashaddressed\n// eslint-disable-next-line complexity\nconst attemptCashAddressFormatErrorCorrection = (address) => {\n const parts = address.toLowerCase().split(':');\n // eslint-disable-next-line @typescript-eslint/no-magic-numbers\n if (parts.length !== 2 || parts[0] === '' || parts[1] === '') {\n return CashAddressDecodingError.invalidFormat;\n }\n const [prefix, payload] = parts;\n if (!(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.isBech32CharacterSet)(payload)) {\n return (0,_format_format_js__WEBPACK_IMPORTED_MODULE_0__.formatError)(CashAddressDecodingError.invalidCharacters, `Invalid characters: ${(0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.extractNonBech32Characters)(payload).join(', ')}.`);\n }\n const decodedPayload = (0,_bech32_js__WEBPACK_IMPORTED_MODULE_1__.decodeBech32)(payload);\n const polynomial = [...maskCashAddressPrefix(prefix), 0, ...decodedPayload];\n const originalChecksum = cashAddressPolynomialModulo(polynomial);\n if (originalChecksum === 0) {\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [],\n };\n }\n const syndromes = {};\n // eslint-disable-next-line functional/no-let, functional/no-loop-statements, no-plusplus\n for (let term = 0; term < polynomial.length; term++) {\n // eslint-disable-next-line functional/no-loop-statements\n for (\n // eslint-disable-next-line functional/no-let\n let errorVector = 1; errorVector < 32 /* Constants.finiteFieldOrder */; \n // eslint-disable-next-line no-plusplus\n errorVector++) {\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[term] ^= errorVector;\n const correct = cashAddressPolynomialModulo(polynomial);\n if (correct === 0) {\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [term],\n };\n }\n // eslint-disable-next-line no-bitwise\n const s0 = (BigInt(correct) ^ BigInt(originalChecksum)).toString();\n // eslint-disable-next-line functional/no-expression-statements, functional/immutable-data\n syndromes[s0] = term * 32 /* Constants.finiteFieldOrder */ + errorVector;\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[term] ^= errorVector;\n }\n }\n // eslint-disable-next-line functional/no-loop-statements\n for (const [s0, pe] of Object.entries(syndromes)) {\n // eslint-disable-next-line no-bitwise\n const s1Location = (BigInt(s0) ^ BigInt(originalChecksum)).toString();\n const s1 = syndromes[s1Location];\n if (s1 !== undefined) {\n const correctionIndex1 = Math.trunc(pe / 32 /* Constants.finiteFieldOrder */);\n const correctionIndex2 = Math.trunc(s1 / 32 /* Constants.finiteFieldOrder */);\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[correctionIndex1] ^= pe % 32 /* Constants.finiteFieldOrder */;\n // eslint-disable-next-line functional/no-expression-statements, no-bitwise, @typescript-eslint/no-non-null-assertion\n polynomial[correctionIndex2] ^= s1 % 32 /* Constants.finiteFieldOrder */;\n return {\n address: cashAddressPolynomialToCashAddress(polynomial),\n corrections: [correctionIndex1, correctionIndex2].sort((a, b) => a - b),\n };\n }\n }\n return CashAddressFormatCorrectionError.tooManyErrors;\n};\n//# sourceMappingURL=cash-address.js.map\n\n//# sourceURL=webpack://mainnet-js/../../node_modules/@bitauth/libauth/build/lib/address/cash-address.js?");
|
|
758
758
|
|
|
759
759
|
/***/ }),
|
|
760
760
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { CashAddressNetworkPrefix } from "@bitauth/libauth";
|
|
2
|
+
import { Network } from "../interface.js";
|
|
2
3
|
export declare function isValidAddress(cashaddr: string): boolean;
|
|
3
4
|
export declare function deriveCashaddr(privateKey: Uint8Array, networkPrefix: CashAddressNetworkPrefix): string;
|
|
4
5
|
export declare function deriveTokenaddr(key: Uint8Array, networkPrefix: CashAddressNetworkPrefix): string;
|
|
5
|
-
export declare function toCashaddr(
|
|
6
|
-
export declare function toTokenaddr(
|
|
6
|
+
export declare function toCashaddr(address: string): string;
|
|
7
|
+
export declare function toTokenaddr(address: string): string;
|
|
7
8
|
export declare function isTokenaddr(address: string): boolean;
|
|
9
|
+
export declare function convertAddress(address: string, network?: Network, withTokens?: boolean | undefined): string;
|
|
8
10
|
export declare function checkTokenaddr(cashaddr: string, enforce: boolean): void;
|
|
9
11
|
//# sourceMappingURL=deriveCashaddr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deriveCashaddr.d.ts","sourceRoot":"","sources":["../../../src/util/deriveCashaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,
|
|
1
|
+
{"version":3,"file":"deriveCashaddr.d.ts","sourceRoot":"","sources":["../../../src/util/deriveCashaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EAMzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,wBAAwB,GACtC,MAAM,CAWR;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,UAAU,EACf,aAAa,EAAE,wBAAwB,GACtC,MAAM,CA+BR;AAUD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQlD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAIpD;AAMD,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,OAAmB,EAC5B,UAAU,GAAE,OAAO,GAAG,SAAqB,GAC1C,MAAM,CAYR;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAIhE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CashAddressType, decodeCashAddress, encodeCashAddress, secp256k1, } from "@bitauth/libauth";
|
|
2
|
+
import { prefixFromNetworkMap } from "../enum.js";
|
|
2
3
|
import { hash160 } from "./hash160.js";
|
|
3
4
|
export function isValidAddress(cashaddr) {
|
|
4
5
|
const result = decodeCashAddress(cashaddr);
|
|
@@ -54,62 +55,48 @@ export function deriveTokenaddr(key, networkPrefix) {
|
|
|
54
55
|
payload: publicKeyHash,
|
|
55
56
|
}).address;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (tokenaddr.includes(":")) {
|
|
61
|
-
result = decodeCashAddressFormat(tokenaddr);
|
|
62
|
-
}
|
|
63
|
-
// otherwise, derive the network from the tokenaddr without prefix
|
|
64
|
-
else {
|
|
65
|
-
result = decodeCashAddressFormatWithoutPrefix(tokenaddr);
|
|
66
|
-
}
|
|
67
|
-
if (typeof result === "string")
|
|
58
|
+
function decodeAddress(address) {
|
|
59
|
+
const result = decodeCashAddress(address);
|
|
60
|
+
if (typeof result === "string") {
|
|
68
61
|
throw new Error(result);
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
export function toCashaddr(address) {
|
|
66
|
+
const result = decodeAddress(address);
|
|
69
67
|
return encodeCashAddress({
|
|
70
68
|
prefix: result.prefix,
|
|
71
|
-
type:
|
|
69
|
+
type: result.type.replace("WithTokens", ""),
|
|
72
70
|
payload: result.payload,
|
|
73
71
|
}).address;
|
|
74
72
|
}
|
|
75
|
-
export function toTokenaddr(
|
|
76
|
-
|
|
77
|
-
// If the address has a prefix decode it as is
|
|
78
|
-
if (cashaddr.includes(":")) {
|
|
79
|
-
result = decodeCashAddressFormat(cashaddr);
|
|
80
|
-
}
|
|
81
|
-
// otherwise, derive the network from the cashaddr without prefix
|
|
82
|
-
else {
|
|
83
|
-
result = decodeCashAddressFormatWithoutPrefix(cashaddr);
|
|
84
|
-
}
|
|
85
|
-
if (typeof result === "string")
|
|
86
|
-
throw new Error(result);
|
|
73
|
+
export function toTokenaddr(address) {
|
|
74
|
+
const result = decodeAddress(address);
|
|
87
75
|
return encodeCashAddress({
|
|
88
76
|
prefix: result.prefix,
|
|
89
|
-
type:
|
|
77
|
+
type: (result.type.replace("WithTokens", "") +
|
|
78
|
+
"WithTokens"),
|
|
90
79
|
payload: result.payload,
|
|
91
80
|
}).address;
|
|
92
81
|
}
|
|
93
82
|
export function isTokenaddr(address) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
return ([CashAddressType.p2pkhWithTokens, CashAddressType.p2shWithTokens].indexOf(type) !== -1);
|
|
83
|
+
const result = decodeAddress(address);
|
|
84
|
+
return result.type.endsWith("WithTokens");
|
|
85
|
+
}
|
|
86
|
+
// This function converts a cash address to a cash address of the specified network.
|
|
87
|
+
// If withTokens is true, it will return a token-aware address.
|
|
88
|
+
// If withTokens is false, it will return a non-token-aware address.
|
|
89
|
+
// If withTokens is undefined, it will not change the token-awareness.
|
|
90
|
+
export function convertAddress(address, network = "mainnet", withTokens = undefined) {
|
|
91
|
+
const result = decodeAddress(address);
|
|
92
|
+
return encodeCashAddress({
|
|
93
|
+
prefix: prefixFromNetworkMap[network],
|
|
94
|
+
type: withTokens === undefined
|
|
95
|
+
? result.type
|
|
96
|
+
: (result.type.replace("WithTokens", "") +
|
|
97
|
+
(withTokens ? "WithTokens" : "")),
|
|
98
|
+
payload: result.payload,
|
|
99
|
+
}).address;
|
|
113
100
|
}
|
|
114
101
|
export function checkTokenaddr(cashaddr, enforce) {
|
|
115
102
|
if (enforce && !isTokenaddr(cashaddr)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deriveCashaddr.js","sourceRoot":"","sources":["../../../src/util/deriveCashaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,
|
|
1
|
+
{"version":3,"file":"deriveCashaddr.js","sourceRoot":"","sources":["../../../src/util/deriveCashaddr.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,iBAAiB,EAEjB,iBAAiB,EACjB,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,aAAuC;IAEvC,IAAI,SAAS,GAAG,SAAS,CAAC,yBAAyB,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,iBAAiB,CAAC;QACvB,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,eAAe,CAAC,KAAK;QAC3B,OAAO,EAAE,GAAG;KACb,CAAC,CAAC,OAAO,CAAC;AACb,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAe,EACf,aAAuC;IAEvC,IAAI,aAAyB,CAAC;IAC9B,cAAc;IACd,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACtB,IAAI,mBAAmB,GAAG,SAAS,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;QACnE,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QACD,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC7B,0BAA0B;QAC1B,IAAI,mBAAmB,GAAG,SAAS,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAC3D,IAAI,OAAO,mBAAmB,KAAK,QAAQ,EAAE,CAAC;YAC5C,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QACD,aAAa,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC7B,wBAAwB;QACxB,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC;SAAM,IAAI,GAAG,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC7B,kBAAkB;QAClB,aAAa,GAAG,GAAG,CAAC;IACtB,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,iBAAiB,CAAC;QACvB,MAAM,EAAE,aAAa;QACrB,IAAI,EAAE,eAAe,CAAC,eAAe;QACrC,OAAO,EAAE,aAAa;KACvB,CAAC,CAAC,OAAO,CAAC;AACb,CAAC;AAED,SAAS,aAAa,CAAC,OAAe;IACpC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,iBAAiB,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAkC;QACjD,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAoB;QAC9D,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC,OAAO,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,iBAAiB,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC,MAAkC;QACjD,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;YAC1C,YAAY,CAAoB;QAClC,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC,OAAO,CAAC;AACb,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC5C,CAAC;AAED,oFAAoF;AACpF,+DAA+D;AAC/D,oEAAoE;AACpE,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,UAAmB,SAAS,EAC5B,aAAkC,SAAS;IAE3C,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO,iBAAiB,CAAC;QACvB,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAA6B;QACjE,IAAI,EACF,UAAU,KAAK,SAAS;YACtB,CAAC,CAAC,MAAM,CAAC,IAAI;YACb,CAAC,CAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;gBACrC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAqB;QAC7D,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC,OAAO,CAAC;AACb,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,OAAgB;IAC/D,IAAI,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|