@trezor/connect 9.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +50 -0
- package/README.md +38 -0
- package/lib/api/applyFlags.d.ts +8 -0
- package/lib/api/applyFlags.js +37 -0
- package/lib/api/applySettings.d.ts +8 -0
- package/lib/api/applySettings.js +57 -0
- package/lib/api/authorizeCoinJoin.d.ts +7 -0
- package/lib/api/authorizeCoinJoin.js +45 -0
- package/lib/api/backupDevice.d.ts +7 -0
- package/lib/api/backupDevice.js +31 -0
- package/lib/api/binance/binanceSignTx.d.ts +6 -0
- package/lib/api/binance/binanceSignTx.js +91 -0
- package/lib/api/binanceGetAddress.d.ts +22 -0
- package/lib/api/binanceGetAddress.js +126 -0
- package/lib/api/binanceGetPublicKey.d.ts +10 -0
- package/lib/api/binanceGetPublicKey.js +72 -0
- package/lib/api/binanceSignTransaction.d.ts +12 -0
- package/lib/api/binanceSignTransaction.js +31 -0
- package/lib/api/bitcoin/Fees.d.ts +15 -0
- package/lib/api/bitcoin/Fees.js +175 -0
- package/lib/api/bitcoin/TransactionComposer.d.ts +36 -0
- package/lib/api/bitcoin/TransactionComposer.js +150 -0
- package/lib/api/bitcoin/__fixtures__/inputs.d.ts +112 -0
- package/lib/api/bitcoin/__fixtures__/inputs.js +102 -0
- package/lib/api/bitcoin/__fixtures__/signtxVerify.d.ts +147 -0
- package/lib/api/bitcoin/__fixtures__/signtxVerify.js +216 -0
- package/lib/api/bitcoin/enhanceSignTx.d.ts +4 -0
- package/lib/api/bitcoin/enhanceSignTx.js +63 -0
- package/lib/api/bitcoin/index.d.ts +10 -0
- package/lib/api/bitcoin/index.js +13 -0
- package/lib/api/bitcoin/inputs.d.ts +8 -0
- package/lib/api/bitcoin/inputs.js +60 -0
- package/lib/api/bitcoin/outputs.d.ts +8 -0
- package/lib/api/bitcoin/outputs.js +115 -0
- package/lib/api/bitcoin/refTx.d.ts +11 -0
- package/lib/api/bitcoin/refTx.js +220 -0
- package/lib/api/bitcoin/signtx.d.ts +25 -0
- package/lib/api/bitcoin/signtx.js +164 -0
- package/lib/api/bitcoin/signtxLegacy.d.ts +4 -0
- package/lib/api/bitcoin/signtxLegacy.js +136 -0
- package/lib/api/bitcoin/signtxVerify.d.ts +8 -0
- package/lib/api/bitcoin/signtxVerify.js +130 -0
- package/lib/api/blockchainDisconnect.d.ts +13 -0
- package/lib/api/blockchainDisconnect.js +34 -0
- package/lib/api/blockchainEstimateFee.d.ts +12 -0
- package/lib/api/blockchainEstimateFee.js +70 -0
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +12 -0
- package/lib/api/blockchainGetAccountBalanceHistory.js +41 -0
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +15 -0
- package/lib/api/blockchainGetCurrentFiatRates.js +33 -0
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +17 -0
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +33 -0
- package/lib/api/blockchainGetTransactions.d.ts +12 -0
- package/lib/api/blockchainGetTransactions.js +33 -0
- package/lib/api/blockchainSetCustomBackend.d.ts +11 -0
- package/lib/api/blockchainSetCustomBackend.js +38 -0
- package/lib/api/blockchainSubscribe.d.ts +14 -0
- package/lib/api/blockchainSubscribe.js +38 -0
- package/lib/api/blockchainSubscribeFiatRates.d.ts +14 -0
- package/lib/api/blockchainSubscribeFiatRates.js +33 -0
- package/lib/api/blockchainUnsubscribe.d.ts +14 -0
- package/lib/api/blockchainUnsubscribe.js +38 -0
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +13 -0
- package/lib/api/blockchainUnsubscribeFiatRates.js +29 -0
- package/lib/api/cardano/cardanoAddressParameters.d.ts +8 -0
- package/lib/api/cardano/cardanoAddressParameters.js +100 -0
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +6 -0
- package/lib/api/cardano/cardanoAuxiliaryData.js +51 -0
- package/lib/api/cardano/cardanoCertificate.d.ts +14 -0
- package/lib/api/cardano/cardanoCertificate.js +149 -0
- package/lib/api/cardano/cardanoInputs.d.ts +13 -0
- package/lib/api/cardano/cardanoInputs.js +34 -0
- package/lib/api/cardano/cardanoOutputs.d.ts +8 -0
- package/lib/api/cardano/cardanoOutputs.js +38 -0
- package/lib/api/cardano/cardanoTokenBundle.d.ts +8 -0
- package/lib/api/cardano/cardanoTokenBundle.js +36 -0
- package/lib/api/cardano/cardanoWitnesses.d.ts +5 -0
- package/lib/api/cardano/cardanoWitnesses.js +48 -0
- package/lib/api/cardanoGetAddress.d.ts +23 -0
- package/lib/api/cardanoGetAddress.js +158 -0
- package/lib/api/cardanoGetNativeScriptHash.d.ts +12 -0
- package/lib/api/cardanoGetNativeScriptHash.js +79 -0
- package/lib/api/cardanoGetPublicKey.d.ts +10 -0
- package/lib/api/cardanoGetPublicKey.js +78 -0
- package/lib/api/cardanoSignTransaction.d.ts +48 -0
- package/lib/api/cardanoSignTransaction.js +283 -0
- package/lib/api/changePin.d.ts +7 -0
- package/lib/api/changePin.js +22 -0
- package/lib/api/cipherKeyValue.d.ts +8 -0
- package/lib/api/cipherKeyValue.js +56 -0
- package/lib/api/common/Discovery.d.ts +35 -0
- package/lib/api/common/Discovery.js +113 -0
- package/lib/api/common/__fixtures__/paramsValidator.d.ts +596 -0
- package/lib/api/common/__fixtures__/paramsValidator.js +355 -0
- package/lib/api/common/paramsValidator.d.ts +14 -0
- package/lib/api/common/paramsValidator.js +140 -0
- package/lib/api/composeTransaction.d.ts +33 -0
- package/lib/api/composeTransaction.js +270 -0
- package/lib/api/customMessage.d.ts +13 -0
- package/lib/api/customMessage.js +56 -0
- package/lib/api/eos/eosSignTx.d.ts +17 -0
- package/lib/api/eos/eosSignTx.js +347 -0
- package/lib/api/eosGetPublicKey.d.ts +10 -0
- package/lib/api/eosGetPublicKey.js +73 -0
- package/lib/api/eosSignTransaction.d.ts +16 -0
- package/lib/api/eosSignTransaction.js +36 -0
- package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.d.ts +225 -0
- package/lib/api/ethereum/__fixtures__/ethereumSignTypedData.js +341 -0
- package/lib/api/ethereum/ethereumSignTx.d.ts +13 -0
- package/lib/api/ethereum/ethereumSignTx.js +92 -0
- package/lib/api/ethereum/ethereumSignTypedData.d.ts +9 -0
- package/lib/api/ethereum/ethereumSignTypedData.js +120 -0
- package/lib/api/ethereumGetAddress.d.ts +28 -0
- package/lib/api/ethereumGetAddress.js +133 -0
- package/lib/api/ethereumGetPublicKey.d.ts +15 -0
- package/lib/api/ethereumGetPublicKey.js +79 -0
- package/lib/api/ethereumSignMessage.d.ts +7 -0
- package/lib/api/ethereumSignMessage.js +41 -0
- package/lib/api/ethereumSignTransaction.d.ts +20 -0
- package/lib/api/ethereumSignTransaction.js +82 -0
- package/lib/api/ethereumSignTypedData.d.ts +14 -0
- package/lib/api/ethereumSignTypedData.js +151 -0
- package/lib/api/ethereumVerifyMessage.d.ts +7 -0
- package/lib/api/ethereumVerifyMessage.js +34 -0
- package/lib/api/firmware/getBinary.d.ts +20 -0
- package/lib/api/firmware/getBinary.js +37 -0
- package/lib/api/firmware/modifyFirmware.d.ts +6 -0
- package/lib/api/firmware/modifyFirmware.js +18 -0
- package/lib/api/firmwareUpdate.d.ts +15 -0
- package/lib/api/firmwareUpdate.js +89 -0
- package/lib/api/getAccountInfo.d.ts +98 -0
- package/lib/api/getAccountInfo.js +326 -0
- package/lib/api/getAddress.d.ts +28 -0
- package/lib/api/getAddress.js +152 -0
- package/lib/api/getCoinInfo.d.ts +11 -0
- package/lib/api/getCoinInfo.js +27 -0
- package/lib/api/getDeviceState.d.ts +8 -0
- package/lib/api/getDeviceState.js +15 -0
- package/lib/api/getFeatures.d.ts +6 -0
- package/lib/api/getFeatures.js +18 -0
- package/lib/api/getOwnershipId.d.ts +10 -0
- package/lib/api/getOwnershipId.js +75 -0
- package/lib/api/getOwnershipProof.d.ts +14 -0
- package/lib/api/getOwnershipProof.js +86 -0
- package/lib/api/getPublicKey.d.ts +15 -0
- package/lib/api/getPublicKey.js +84 -0
- package/lib/api/getSettings.d.ts +6 -0
- package/lib/api/getSettings.js +16 -0
- package/lib/api/index.d.ts +64 -0
- package/lib/api/index.js +134 -0
- package/lib/api/management/uploadFirmware.d.ts +6 -0
- package/lib/api/management/uploadFirmware.js +49 -0
- package/lib/api/nem/nemSignTx.d.ts +4 -0
- package/lib/api/nem/nemSignTx.js +139 -0
- package/lib/api/nemGetAddress.d.ts +22 -0
- package/lib/api/nemGetAddress.js +144 -0
- package/lib/api/nemSignTransaction.d.ts +7 -0
- package/lib/api/nemSignTransaction.js +29 -0
- package/lib/api/pushTransaction.d.ts +14 -0
- package/lib/api/pushTransaction.js +40 -0
- package/lib/api/rebootToBootloader.d.ts +8 -0
- package/lib/api/rebootToBootloader.js +43 -0
- package/lib/api/recoveryDevice.d.ts +8 -0
- package/lib/api/recoveryDevice.js +57 -0
- package/lib/api/requestLogin.d.ts +12 -0
- package/lib/api/requestLogin.js +63 -0
- package/lib/api/resetDevice.d.ts +9 -0
- package/lib/api/resetDevice.js +59 -0
- package/lib/api/rippleGetAddress.d.ts +22 -0
- package/lib/api/rippleGetAddress.js +126 -0
- package/lib/api/rippleSignTransaction.d.ts +10 -0
- package/lib/api/rippleSignTransaction.js +54 -0
- package/lib/api/setProxy.d.ts +8 -0
- package/lib/api/setProxy.js +26 -0
- package/lib/api/signMessage.d.ts +7 -0
- package/lib/api/signMessage.js +51 -0
- package/lib/api/signTransaction.d.ts +21 -0
- package/lib/api/signTransaction.js +146 -0
- package/lib/api/stellar/stellarSignTx.d.ts +5 -0
- package/lib/api/stellar/stellarSignTx.js +198 -0
- package/lib/api/stellarGetAddress.d.ts +22 -0
- package/lib/api/stellarGetAddress.js +126 -0
- package/lib/api/stellarSignTransaction.d.ts +23 -0
- package/lib/api/stellarSignTransaction.js +62 -0
- package/lib/api/tezos/tezosSignTx.d.ts +4 -0
- package/lib/api/tezos/tezosSignTx.js +237 -0
- package/lib/api/tezosGetAddress.d.ts +22 -0
- package/lib/api/tezosGetAddress.js +126 -0
- package/lib/api/tezosGetPublicKey.d.ts +10 -0
- package/lib/api/tezosGetPublicKey.js +72 -0
- package/lib/api/tezosSignTransaction.d.ts +7 -0
- package/lib/api/tezosSignTransaction.js +30 -0
- package/lib/api/verifyMessage.d.ts +7 -0
- package/lib/api/verifyMessage.js +47 -0
- package/lib/api/wipeDevice.d.ts +8 -0
- package/lib/api/wipeDevice.js +41 -0
- package/lib/backend/BlockchainLink.d.ts +75 -0
- package/lib/backend/BlockchainLink.js +298 -0
- package/lib/constants/cardano.d.ts +9 -0
- package/lib/constants/cardano.js +14 -0
- package/lib/constants/errors.d.ts +49 -0
- package/lib/constants/errors.js +62 -0
- package/lib/constants/index.d.ts +6 -0
- package/lib/constants/index.js +10 -0
- package/lib/constants/nem.d.ts +22 -0
- package/lib/constants/nem.js +28 -0
- package/lib/constants/network.d.ts +13 -0
- package/lib/constants/network.js +15 -0
- package/lib/core/AbstractMethod.d.ts +59 -0
- package/lib/core/AbstractMethod.js +159 -0
- package/lib/core/index.d.ts +16 -0
- package/lib/core/index.js +671 -0
- package/lib/core/method.d.ts +6 -0
- package/lib/core/method.js +19 -0
- package/lib/data/DataManager.d.ts +31 -0
- package/lib/data/DataManager.js +98 -0
- package/lib/data/coinInfo.d.ts +37 -0
- package/lib/data/coinInfo.js +278 -0
- package/lib/data/config.d.ts +98 -0
- package/lib/data/config.js +201 -0
- package/lib/data/connectSettings.d.ts +6 -0
- package/lib/data/connectSettings.js +150 -0
- package/lib/data/firmwareInfo.d.ts +11 -0
- package/lib/data/firmwareInfo.js +148 -0
- package/lib/data/transportInfo.d.ts +4 -0
- package/lib/data/transportInfo.js +29 -0
- package/lib/data/udevInfo.d.ts +3 -0
- package/lib/data/udevInfo.js +21 -0
- package/lib/data/version.d.ts +3 -0
- package/lib/data/version.js +7 -0
- package/lib/device/AbortController.d.ts +21 -0
- package/lib/device/AbortController.js +40 -0
- package/lib/device/DescriptorStream.d.ts +28 -0
- package/lib/device/DescriptorStream.js +139 -0
- package/lib/device/Device.d.ts +105 -0
- package/lib/device/Device.js +527 -0
- package/lib/device/DeviceCommands.d.ts +63 -0
- package/lib/device/DeviceCommands.js +465 -0
- package/lib/device/DeviceList.d.ts +76 -0
- package/lib/device/DeviceList.js +411 -0
- package/lib/events/blockchain.d.ts +56 -0
- package/lib/events/blockchain.js +18 -0
- package/lib/events/call.d.ts +41 -0
- package/lib/events/call.js +14 -0
- package/lib/events/core.d.ts +20 -0
- package/lib/events/core.js +28 -0
- package/lib/events/device.d.ts +40 -0
- package/lib/events/device.js +28 -0
- package/lib/events/iframe.d.ts +39 -0
- package/lib/events/iframe.js +18 -0
- package/lib/events/index.d.ts +62 -0
- package/lib/events/index.js +21 -0
- package/lib/events/popup.d.ts +51 -0
- package/lib/events/popup.js +22 -0
- package/lib/events/transport.d.ts +62 -0
- package/lib/events/transport.js +21 -0
- package/lib/events/ui-promise.d.ts +12 -0
- package/lib/events/ui-promise.js +3 -0
- package/lib/events/ui-request.d.ts +180 -0
- package/lib/events/ui-request.js +50 -0
- package/lib/events/ui-response.d.ts +97 -0
- package/lib/events/ui-response.js +25 -0
- package/lib/exports.d.ts +5 -0
- package/lib/exports.js +10 -0
- package/lib/factory.d.ts +20 -0
- package/lib/factory.js +122 -0
- package/lib/index-browser.d.ts +4 -0
- package/lib/index-browser.js +29 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +236 -0
- package/lib/types/account.d.ts +37 -0
- package/lib/types/account.js +3 -0
- package/lib/types/api/applyFlags.d.ts +4 -0
- package/lib/types/api/applyFlags.js +3 -0
- package/lib/types/api/applySettings.d.ts +4 -0
- package/lib/types/api/applySettings.js +3 -0
- package/lib/types/api/authorizeCoinJoin.d.ts +14 -0
- package/lib/types/api/authorizeCoinJoin.js +3 -0
- package/lib/types/api/backupDevice.d.ts +4 -0
- package/lib/types/api/backupDevice.js +3 -0
- package/lib/types/api/binanceGetAddress.d.ts +4 -0
- package/lib/types/api/binanceGetAddress.js +3 -0
- package/lib/types/api/binanceGetPublicKey.d.ts +4 -0
- package/lib/types/api/binanceGetPublicKey.js +3 -0
- package/lib/types/api/binanceSignTransaction.d.ts +31 -0
- package/lib/types/api/binanceSignTransaction.js +3 -0
- package/lib/types/api/blockchainDisconnect.d.ts +5 -0
- package/lib/types/api/blockchainDisconnect.js +3 -0
- package/lib/types/api/blockchainEstimateFee.d.ts +29 -0
- package/lib/types/api/blockchainEstimateFee.js +3 -0
- package/lib/types/api/blockchainGetAccountBalanceHistory.d.ts +4 -0
- package/lib/types/api/blockchainGetAccountBalanceHistory.js +3 -0
- package/lib/types/api/blockchainGetCurrentFiatRates.d.ts +4 -0
- package/lib/types/api/blockchainGetCurrentFiatRates.js +3 -0
- package/lib/types/api/blockchainGetFiatRatesForTimestamps.d.ts +4 -0
- package/lib/types/api/blockchainGetFiatRatesForTimestamps.js +3 -0
- package/lib/types/api/blockchainGetTransactions.d.ts +7 -0
- package/lib/types/api/blockchainGetTransactions.js +3 -0
- package/lib/types/api/blockchainSetCustomBackend.d.ts +7 -0
- package/lib/types/api/blockchainSetCustomBackend.js +3 -0
- package/lib/types/api/blockchainSubscribe.d.ts +7 -0
- package/lib/types/api/blockchainSubscribe.js +3 -0
- package/lib/types/api/blockchainSubscribeFiatRates.d.ts +7 -0
- package/lib/types/api/blockchainSubscribeFiatRates.js +3 -0
- package/lib/types/api/blockchainUnsubscribe.d.ts +5 -0
- package/lib/types/api/blockchainUnsubscribe.js +3 -0
- package/lib/types/api/blockchainUnsubscribeFiatRates.d.ts +5 -0
- package/lib/types/api/blockchainUnsubscribeFiatRates.js +3 -0
- package/lib/types/api/cancel.d.ts +2 -0
- package/lib/types/api/cancel.js +3 -0
- package/lib/types/api/cardanoGetAddress.d.ts +35 -0
- package/lib/types/api/cardanoGetAddress.js +3 -0
- package/lib/types/api/cardanoGetNativeScriptHash.d.ts +21 -0
- package/lib/types/api/cardanoGetNativeScriptHash.js +3 -0
- package/lib/types/api/cardanoGetPublicKey.d.ts +16 -0
- package/lib/types/api/cardanoGetPublicKey.js +3 -0
- package/lib/types/api/cardanoSignTransaction.d.ts +130 -0
- package/lib/types/api/cardanoSignTransaction.js +3 -0
- package/lib/types/api/changePin.d.ts +4 -0
- package/lib/types/api/changePin.js +3 -0
- package/lib/types/api/cipherKeyValue.d.ts +17 -0
- package/lib/types/api/cipherKeyValue.js +3 -0
- package/lib/types/api/composeTransaction.d.ts +92 -0
- package/lib/types/api/composeTransaction.js +3 -0
- package/lib/types/api/customMessage.d.ts +12 -0
- package/lib/types/api/customMessage.js +3 -0
- package/lib/types/api/disableWebUSB.d.ts +2 -0
- package/lib/types/api/disableWebUSB.js +3 -0
- package/lib/types/api/dispose.d.ts +2 -0
- package/lib/types/api/dispose.js +3 -0
- package/lib/types/api/eosGetPublicKey.d.ts +14 -0
- package/lib/types/api/eosGetPublicKey.js +3 -0
- package/lib/types/api/eosSignTransaction.d.ts +111 -0
- package/lib/types/api/eosSignTransaction.js +3 -0
- package/lib/types/api/ethereumGetAddress.d.ts +4 -0
- package/lib/types/api/ethereumGetAddress.js +3 -0
- package/lib/types/api/ethereumGetPublicKey.d.ts +5 -0
- package/lib/types/api/ethereumGetPublicKey.js +3 -0
- package/lib/types/api/ethereumSignMessage.d.ts +9 -0
- package/lib/types/api/ethereumSignMessage.js +3 -0
- package/lib/types/api/ethereumSignTransaction.d.ts +40 -0
- package/lib/types/api/ethereumSignTransaction.js +3 -0
- package/lib/types/api/ethereumSignTypedData.d.ts +42 -0
- package/lib/types/api/ethereumSignTypedData.js +3 -0
- package/lib/types/api/ethereumVerifyMessage.d.ts +10 -0
- package/lib/types/api/ethereumVerifyMessage.js +3 -0
- package/lib/types/api/firmwareUpdate.d.ts +14 -0
- package/lib/types/api/firmwareUpdate.js +3 -0
- package/lib/types/api/getAccountInfo.d.ts +14 -0
- package/lib/types/api/getAccountInfo.js +3 -0
- package/lib/types/api/getAddress.d.ts +13 -0
- package/lib/types/api/getAddress.js +3 -0
- package/lib/types/api/getCoinInfo.d.ts +4 -0
- package/lib/types/api/getCoinInfo.js +3 -0
- package/lib/types/api/getDeviceState.d.ts +6 -0
- package/lib/types/api/getDeviceState.js +3 -0
- package/lib/types/api/getFeatures.d.ts +4 -0
- package/lib/types/api/getFeatures.js +3 -0
- package/lib/types/api/getOwnershipId.d.ts +15 -0
- package/lib/types/api/getOwnershipId.js +3 -0
- package/lib/types/api/getOwnershipProof.d.ts +19 -0
- package/lib/types/api/getOwnershipProof.js +3 -0
- package/lib/types/api/getPublicKey.d.ts +19 -0
- package/lib/types/api/getPublicKey.js +3 -0
- package/lib/types/api/getSettings.d.ts +4 -0
- package/lib/types/api/getSettings.js +3 -0
- package/lib/types/api/index.d.ts +149 -0
- package/lib/types/api/index.js +3 -0
- package/lib/types/api/init.d.ts +5 -0
- package/lib/types/api/init.js +3 -0
- package/lib/types/api/manifest.d.ts +3 -0
- package/lib/types/api/manifest.js +3 -0
- package/lib/types/api/nemGetAddress.d.ts +7 -0
- package/lib/types/api/nemGetAddress.js +3 -0
- package/lib/types/api/nemSignTransaction.d.ts +92 -0
- package/lib/types/api/nemSignTransaction.js +3 -0
- package/lib/types/api/off.d.ts +11 -0
- package/lib/types/api/off.js +3 -0
- package/lib/types/api/on.d.ts +14 -0
- package/lib/types/api/on.js +3 -0
- package/lib/types/api/pushTransaction.d.ts +10 -0
- package/lib/types/api/pushTransaction.js +3 -0
- package/lib/types/api/rebootToBootloader.d.ts +4 -0
- package/lib/types/api/rebootToBootloader.js +3 -0
- package/lib/types/api/recoveryDevice.d.ts +7 -0
- package/lib/types/api/recoveryDevice.js +3 -0
- package/lib/types/api/removeAllListeners.d.ts +3 -0
- package/lib/types/api/removeAllListeners.js +3 -0
- package/lib/types/api/renderWebUSBButton.d.ts +2 -0
- package/lib/types/api/renderWebUSBButton.js +3 -0
- package/lib/types/api/requestLogin.d.ts +20 -0
- package/lib/types/api/requestLogin.js +3 -0
- package/lib/types/api/resetDevice.d.ts +16 -0
- package/lib/types/api/resetDevice.js +3 -0
- package/lib/types/api/rippleGetAddress.d.ts +4 -0
- package/lib/types/api/rippleGetAddress.js +3 -0
- package/lib/types/api/rippleSignTransaction.d.ts +23 -0
- package/lib/types/api/rippleSignTransaction.js +3 -0
- package/lib/types/api/setProxy.d.ts +9 -0
- package/lib/types/api/setProxy.js +3 -0
- package/lib/types/api/signMessage.d.ts +11 -0
- package/lib/types/api/signMessage.js +3 -0
- package/lib/types/api/signTransaction.d.ts +70 -0
- package/lib/types/api/signTransaction.js +3 -0
- package/lib/types/api/stellarGetAddress.d.ts +4 -0
- package/lib/types/api/stellarGetAddress.js +3 -0
- package/lib/types/api/stellarSignTransaction.d.ts +182 -0
- package/lib/types/api/stellarSignTransaction.js +3 -0
- package/lib/types/api/tezosGetAddress.d.ts +4 -0
- package/lib/types/api/tezosGetAddress.js +3 -0
- package/lib/types/api/tezosGetPublicKey.d.ts +4 -0
- package/lib/types/api/tezosGetPublicKey.js +3 -0
- package/lib/types/api/tezosSignTransaction.d.ts +61 -0
- package/lib/types/api/tezosSignTransaction.js +3 -0
- package/lib/types/api/uiResponse.d.ts +3 -0
- package/lib/types/api/uiResponse.js +3 -0
- package/lib/types/api/verifyMessage.d.ts +11 -0
- package/lib/types/api/verifyMessage.js +3 -0
- package/lib/types/api/wipeDevice.d.ts +4 -0
- package/lib/types/api/wipeDevice.js +3 -0
- package/lib/types/coinInfo.d.ts +79 -0
- package/lib/types/coinInfo.js +3 -0
- package/lib/types/device.d.ts +92 -0
- package/lib/types/device.js +3 -0
- package/lib/types/firmware.d.ts +36 -0
- package/lib/types/firmware.js +3 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.js +11 -0
- package/lib/types/params.d.ts +56 -0
- package/lib/types/params.js +3 -0
- package/lib/types/settings.d.ts +34 -0
- package/lib/types/settings.js +3 -0
- package/lib/types/utils.d.ts +15 -0
- package/lib/types/utils.js +3 -0
- package/lib/utils/__fixtures__/accountUtils.d.ts +4 -0
- package/lib/utils/__fixtures__/accountUtils.js +32 -0
- package/lib/utils/__fixtures__/addressUtils.d.ts +10 -0
- package/lib/utils/__fixtures__/addressUtils.js +214 -0
- package/lib/utils/__fixtures__/ethereumUtils.d.ts +3 -0
- package/lib/utils/__fixtures__/ethereumUtils.js +20 -0
- package/lib/utils/__fixtures__/formatUtils.d.ts +3 -0
- package/lib/utils/__fixtures__/formatUtils.js +15 -0
- package/lib/utils/__fixtures__/hdnodeUtils.d.ts +186 -0
- package/lib/utils/__fixtures__/hdnodeUtils.js +206 -0
- package/lib/utils/accountUtils.d.ts +11 -0
- package/lib/utils/accountUtils.js +99 -0
- package/lib/utils/addressUtils.d.ts +3 -0
- package/lib/utils/addressUtils.js +32 -0
- package/lib/utils/assets-browser.d.ts +2 -0
- package/lib/utils/assets-browser.js +21 -0
- package/lib/utils/assets.d.ts +2 -0
- package/lib/utils/assets.js +28 -0
- package/lib/utils/bip39.d.ts +3 -0
- package/lib/utils/bip39.js +2053 -0
- package/lib/utils/browserUtils.d.ts +21 -0
- package/lib/utils/browserUtils.js +100 -0
- package/lib/utils/bufferUtils.d.ts +3 -0
- package/lib/utils/bufferUtils.js +11 -0
- package/lib/utils/debug.d.ts +24 -0
- package/lib/utils/debug.js +90 -0
- package/lib/utils/deferred.d.ts +18 -0
- package/lib/utils/deferred.js +66 -0
- package/lib/utils/deviceFeaturesUtils.d.ts +6 -0
- package/lib/utils/deviceFeaturesUtils.js +115 -0
- package/lib/utils/ethereumUtils.d.ts +3 -0
- package/lib/utils/ethereumUtils.js +12 -0
- package/lib/utils/firmwareUtils.d.ts +7 -0
- package/lib/utils/firmwareUtils.js +28 -0
- package/lib/utils/formatUtils.d.ts +8 -0
- package/lib/utils/formatUtils.js +57 -0
- package/lib/utils/hdnodeUtils.d.ts +8 -0
- package/lib/utils/hdnodeUtils.js +80 -0
- package/lib/utils/interactionTimeout.d.ts +10 -0
- package/lib/utils/interactionTimeout.js +34 -0
- package/lib/utils/objectUtils.d.ts +10 -0
- package/lib/utils/objectUtils.js +37 -0
- package/lib/utils/pathUtils.d.ts +20 -0
- package/lib/utils/pathUtils.js +159 -0
- package/lib/utils/promiseUtils.d.ts +2 -0
- package/lib/utils/promiseUtils.js +8 -0
- package/lib/utils/urlUtils.d.ts +5 -0
- package/lib/utils/urlUtils.js +27 -0
- package/lib/utils/versionUtils.d.ts +6 -0
- package/lib/utils/versionUtils.js +72 -0
- package/lib/utils/windowsUtils.d.ts +2 -0
- package/lib/utils/windowsUtils.js +6 -0
- package/lib/workers/RNUsbPlugin.d.ts +31 -0
- package/lib/workers/RNUsbPlugin.js +65 -0
- package/lib/workers/workers-browser.d.ts +8 -0
- package/lib/workers/workers-browser.js +19 -0
- package/lib/workers/workers-react-native.d.ts +8 -0
- package/lib/workers/workers-react-native.js +19 -0
- package/lib/workers/workers.d.ts +10 -0
- package/lib/workers/workers.js +17 -0
- package/package.json +62 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { config } from './config';
|
|
2
|
+
import type { ConnectSettings } from '../types';
|
|
3
|
+
declare type AssetCollection = {
|
|
4
|
+
[key: string]: JSON;
|
|
5
|
+
};
|
|
6
|
+
export declare class DataManager {
|
|
7
|
+
static assets: AssetCollection;
|
|
8
|
+
static settings: ConnectSettings;
|
|
9
|
+
static messages: {
|
|
10
|
+
[key: string]: JSON;
|
|
11
|
+
};
|
|
12
|
+
static load(settings: ConnectSettings, withAssets?: boolean): Promise<void>;
|
|
13
|
+
static getProtobufMessages(_version?: number[]): JSON;
|
|
14
|
+
static isWhitelisted(origin: string): {
|
|
15
|
+
origin: string;
|
|
16
|
+
priority: number;
|
|
17
|
+
} | undefined;
|
|
18
|
+
static isManagementAllowed(): {
|
|
19
|
+
origin: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
static getPriority(whitelist?: typeof config['whitelist'][0]): number;
|
|
22
|
+
static getHostLabel(origin: string): {
|
|
23
|
+
origin: string;
|
|
24
|
+
label: string;
|
|
25
|
+
icon: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
static getSettings(key?: undefined): ConnectSettings;
|
|
28
|
+
static getSettings<T extends keyof ConnectSettings>(key: T): ConnectSettings[T];
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=DataManager.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataManager = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const parse_uri_1 = (0, tslib_1.__importDefault)(require("parse-uri"));
|
|
6
|
+
const assets_1 = require("../utils/assets");
|
|
7
|
+
const connectSettings_1 = require("./connectSettings");
|
|
8
|
+
const coinInfo_1 = require("./coinInfo");
|
|
9
|
+
const firmwareInfo_1 = require("./firmwareInfo");
|
|
10
|
+
const transportInfo_1 = require("./transportInfo");
|
|
11
|
+
const config_1 = require("./config");
|
|
12
|
+
class DataManager {
|
|
13
|
+
static async load(settings, withAssets = true) {
|
|
14
|
+
const ts = settings.env === 'web' ? `?r=${settings.timestamp}` : '';
|
|
15
|
+
this.settings = settings;
|
|
16
|
+
const isLocalhost = typeof window !== 'undefined' && window.location
|
|
17
|
+
? window.location.hostname === 'localhost'
|
|
18
|
+
: true;
|
|
19
|
+
const whitelist = DataManager.isWhitelisted(this.settings.origin || '');
|
|
20
|
+
this.settings.trustedHost = (isLocalhost || !!whitelist) && !this.settings.popup;
|
|
21
|
+
if (!this.settings.trustedHost) {
|
|
22
|
+
this.settings.popup = true;
|
|
23
|
+
}
|
|
24
|
+
if (!this.settings.trustedHost && !whitelist) {
|
|
25
|
+
this.settings.debug = false;
|
|
26
|
+
}
|
|
27
|
+
this.settings.priority = DataManager.getPriority(whitelist);
|
|
28
|
+
const knownHost = DataManager.getHostLabel(this.settings.extension || this.settings.origin || '');
|
|
29
|
+
if (knownHost) {
|
|
30
|
+
this.settings.hostLabel = knownHost.label;
|
|
31
|
+
this.settings.hostIcon = knownHost.icon;
|
|
32
|
+
}
|
|
33
|
+
if (this.settings.popup && this.settings.webusb && this.settings.env !== 'webextension') {
|
|
34
|
+
this.settings.webusb = false;
|
|
35
|
+
}
|
|
36
|
+
if (!withAssets)
|
|
37
|
+
return;
|
|
38
|
+
const assetPromises = config_1.config.assets.map(async (asset) => {
|
|
39
|
+
const json = await (0, assets_1.httpRequest)(`${asset.url}${ts}`, 'json');
|
|
40
|
+
this.assets[asset.name] = json;
|
|
41
|
+
});
|
|
42
|
+
await Promise.all(assetPromises);
|
|
43
|
+
const protobufPromises = config_1.config.messages.map(async (protobuf) => {
|
|
44
|
+
const json = await (0, assets_1.httpRequest)(`${protobuf.json}${ts}`, 'json');
|
|
45
|
+
this.messages[protobuf.name] = json;
|
|
46
|
+
});
|
|
47
|
+
await Promise.all(protobufPromises);
|
|
48
|
+
(0, transportInfo_1.parseBridgeJSON)(this.assets.bridge);
|
|
49
|
+
(0, coinInfo_1.parseCoinsJson)(this.assets.coins);
|
|
50
|
+
(0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t1'], 1);
|
|
51
|
+
(0, firmwareInfo_1.parseFirmware)(this.assets['firmware-t2'], 2);
|
|
52
|
+
}
|
|
53
|
+
static getProtobufMessages(_version) {
|
|
54
|
+
return this.messages.default;
|
|
55
|
+
}
|
|
56
|
+
static isWhitelisted(origin) {
|
|
57
|
+
const uri = (0, parse_uri_1.default)(origin);
|
|
58
|
+
if (uri && typeof uri.host === 'string') {
|
|
59
|
+
const parts = uri.host.split('.');
|
|
60
|
+
if (parts.length > 2) {
|
|
61
|
+
uri.host = parts.slice(parts.length - 2, parts.length).join('.');
|
|
62
|
+
}
|
|
63
|
+
return config_1.config.whitelist.find(item => item.origin === origin || item.origin === uri.host);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
static isManagementAllowed() {
|
|
67
|
+
var _a;
|
|
68
|
+
const uri = (0, parse_uri_1.default)((_a = this.settings.origin) !== null && _a !== void 0 ? _a : '');
|
|
69
|
+
if (uri && typeof uri.host === 'string') {
|
|
70
|
+
const parts = uri.host.split('.');
|
|
71
|
+
if (parts.length > 2) {
|
|
72
|
+
uri.host = parts.slice(parts.length - 2, parts.length).join('.');
|
|
73
|
+
}
|
|
74
|
+
return config_1.config.management.find(item => item.origin === this.settings.origin || item.origin === uri.host);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
static getPriority(whitelist) {
|
|
78
|
+
if (whitelist) {
|
|
79
|
+
return whitelist.priority;
|
|
80
|
+
}
|
|
81
|
+
return connectSettings_1.DEFAULT_PRIORITY;
|
|
82
|
+
}
|
|
83
|
+
static getHostLabel(origin) {
|
|
84
|
+
return config_1.config.knownHosts.find(host => host.origin === origin);
|
|
85
|
+
}
|
|
86
|
+
static getSettings(key) {
|
|
87
|
+
if (!this.settings)
|
|
88
|
+
return null;
|
|
89
|
+
if (typeof key === 'string') {
|
|
90
|
+
return this.settings[key];
|
|
91
|
+
}
|
|
92
|
+
return this.settings;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.DataManager = DataManager;
|
|
96
|
+
DataManager.assets = {};
|
|
97
|
+
DataManager.messages = {};
|
|
98
|
+
//# sourceMappingURL=DataManager.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CoinInfo, BitcoinNetworkInfo, EthereumNetworkInfo, MiscNetworkInfo } from '../types/coinInfo';
|
|
2
|
+
export declare function cloneCoinInfo<T>(info: T): T;
|
|
3
|
+
export declare const getBitcoinNetwork: (pathOrName: number[] | string) => BitcoinNetworkInfo | undefined;
|
|
4
|
+
export declare const getEthereumNetwork: (pathOrName: number[] | string) => EthereumNetworkInfo | undefined;
|
|
5
|
+
export declare const getMiscNetwork: (pathOrName: number[] | string) => MiscNetworkInfo | undefined;
|
|
6
|
+
export declare const getSegwitNetwork: (coin: BitcoinNetworkInfo) => {
|
|
7
|
+
bip32: {
|
|
8
|
+
public: number;
|
|
9
|
+
private: number;
|
|
10
|
+
};
|
|
11
|
+
messagePrefix: string;
|
|
12
|
+
bech32: string;
|
|
13
|
+
pubKeyHash: number;
|
|
14
|
+
scriptHash: number;
|
|
15
|
+
wif: number;
|
|
16
|
+
forkId?: number | undefined;
|
|
17
|
+
} | null;
|
|
18
|
+
export declare const getBech32Network: (coin: BitcoinNetworkInfo) => {
|
|
19
|
+
bip32: {
|
|
20
|
+
public: number;
|
|
21
|
+
private: number;
|
|
22
|
+
};
|
|
23
|
+
messagePrefix: string;
|
|
24
|
+
bech32: string;
|
|
25
|
+
pubKeyHash: number;
|
|
26
|
+
scriptHash: number;
|
|
27
|
+
wif: number;
|
|
28
|
+
forkId?: number | undefined;
|
|
29
|
+
} | null;
|
|
30
|
+
export declare const fixCoinInfoNetwork: (ci: BitcoinNetworkInfo, path: number[]) => BitcoinNetworkInfo;
|
|
31
|
+
export declare const getCoinInfoByHash: (hash: string, networkInfo: any) => BitcoinNetworkInfo;
|
|
32
|
+
export declare const getCoinInfo: (currency: string) => BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo | undefined;
|
|
33
|
+
export declare const getCoinName: (path: number[]) => string;
|
|
34
|
+
export declare const parseCoinsJson: (json: any) => void;
|
|
35
|
+
export declare const getUniqueNetworks: (networks: (CoinInfo | undefined)[]) => CoinInfo[];
|
|
36
|
+
export declare const getAllNetworks: () => (BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo)[];
|
|
37
|
+
//# sourceMappingURL=coinInfo.d.ts.map
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllNetworks = exports.getUniqueNetworks = exports.parseCoinsJson = exports.getCoinName = exports.getCoinInfo = exports.getCoinInfoByHash = exports.fixCoinInfoNetwork = exports.getBech32Network = exports.getSegwitNetwork = exports.getMiscNetwork = exports.getEthereumNetwork = exports.getBitcoinNetwork = exports.cloneCoinInfo = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
6
|
+
const bitcoinNetworks = [];
|
|
7
|
+
const ethereumNetworks = [];
|
|
8
|
+
const miscNetworks = [];
|
|
9
|
+
function cloneCoinInfo(info) {
|
|
10
|
+
const jsonString = JSON.stringify(info);
|
|
11
|
+
if (jsonString === undefined) {
|
|
12
|
+
return info;
|
|
13
|
+
}
|
|
14
|
+
return JSON.parse(jsonString);
|
|
15
|
+
}
|
|
16
|
+
exports.cloneCoinInfo = cloneCoinInfo;
|
|
17
|
+
const getBitcoinNetwork = (pathOrName) => {
|
|
18
|
+
const networks = cloneCoinInfo(bitcoinNetworks);
|
|
19
|
+
if (typeof pathOrName === 'string') {
|
|
20
|
+
const name = pathOrName.toLowerCase();
|
|
21
|
+
return networks.find(n => n.name.toLowerCase() === name ||
|
|
22
|
+
n.shortcut.toLowerCase() === name ||
|
|
23
|
+
n.label.toLowerCase() === name);
|
|
24
|
+
}
|
|
25
|
+
const slip44 = (0, pathUtils_1.fromHardened)(pathOrName[1]);
|
|
26
|
+
return networks.find(n => n.slip44 === slip44);
|
|
27
|
+
};
|
|
28
|
+
exports.getBitcoinNetwork = getBitcoinNetwork;
|
|
29
|
+
const getEthereumNetwork = (pathOrName) => {
|
|
30
|
+
const networks = cloneCoinInfo(ethereumNetworks);
|
|
31
|
+
if (typeof pathOrName === 'string') {
|
|
32
|
+
const name = pathOrName.toLowerCase();
|
|
33
|
+
return networks.find(n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name);
|
|
34
|
+
}
|
|
35
|
+
const slip44 = (0, pathUtils_1.fromHardened)(pathOrName[1]);
|
|
36
|
+
return networks.find(n => n.slip44 === slip44);
|
|
37
|
+
};
|
|
38
|
+
exports.getEthereumNetwork = getEthereumNetwork;
|
|
39
|
+
const getMiscNetwork = (pathOrName) => {
|
|
40
|
+
const networks = cloneCoinInfo(miscNetworks);
|
|
41
|
+
if (typeof pathOrName === 'string') {
|
|
42
|
+
const name = pathOrName.toLowerCase();
|
|
43
|
+
return networks.find(n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name);
|
|
44
|
+
}
|
|
45
|
+
const slip44 = (0, pathUtils_1.fromHardened)(pathOrName[1]);
|
|
46
|
+
return networks.find(n => n.slip44 === slip44);
|
|
47
|
+
};
|
|
48
|
+
exports.getMiscNetwork = getMiscNetwork;
|
|
49
|
+
const getSegwitNetwork = (coin) => {
|
|
50
|
+
if (coin.segwit && typeof coin.xPubMagicSegwit === 'number') {
|
|
51
|
+
return {
|
|
52
|
+
...coin.network,
|
|
53
|
+
bip32: {
|
|
54
|
+
...coin.network.bip32,
|
|
55
|
+
public: coin.xPubMagicSegwit,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
exports.getSegwitNetwork = getSegwitNetwork;
|
|
62
|
+
const getBech32Network = (coin) => {
|
|
63
|
+
if (coin.segwit && typeof coin.xPubMagicSegwitNative === 'number') {
|
|
64
|
+
return {
|
|
65
|
+
...coin.network,
|
|
66
|
+
bip32: {
|
|
67
|
+
...coin.network.bip32,
|
|
68
|
+
public: coin.xPubMagicSegwitNative,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
exports.getBech32Network = getBech32Network;
|
|
75
|
+
const fixCoinInfoNetwork = (ci, path) => {
|
|
76
|
+
const coinInfo = cloneCoinInfo(ci);
|
|
77
|
+
if (path[0] === (0, pathUtils_1.toHardened)(84)) {
|
|
78
|
+
const bech32Network = (0, exports.getBech32Network)(coinInfo);
|
|
79
|
+
if (bech32Network) {
|
|
80
|
+
coinInfo.network = bech32Network;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (path[0] === (0, pathUtils_1.toHardened)(49)) {
|
|
84
|
+
const segwitNetwork = (0, exports.getSegwitNetwork)(coinInfo);
|
|
85
|
+
if (segwitNetwork) {
|
|
86
|
+
coinInfo.network = segwitNetwork;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
coinInfo.segwit = false;
|
|
91
|
+
}
|
|
92
|
+
return coinInfo;
|
|
93
|
+
};
|
|
94
|
+
exports.fixCoinInfoNetwork = fixCoinInfoNetwork;
|
|
95
|
+
const detectBtcVersion = (data) => {
|
|
96
|
+
if (data.subversion == null) {
|
|
97
|
+
return 'btc';
|
|
98
|
+
}
|
|
99
|
+
if (data.subversion.startsWith('/Bitcoin ABC')) {
|
|
100
|
+
return 'bch';
|
|
101
|
+
}
|
|
102
|
+
if (data.subversion.startsWith('/Bitcoin Cash')) {
|
|
103
|
+
return 'bch';
|
|
104
|
+
}
|
|
105
|
+
if (data.subversion.startsWith('/Bitcoin Gold')) {
|
|
106
|
+
return 'btg';
|
|
107
|
+
}
|
|
108
|
+
return 'btc';
|
|
109
|
+
};
|
|
110
|
+
const getCoinInfoByHash = (hash, networkInfo) => {
|
|
111
|
+
const networks = cloneCoinInfo(bitcoinNetworks);
|
|
112
|
+
const result = networks.find(info => hash.toLowerCase() === info.hashGenesisBlock.toLowerCase());
|
|
113
|
+
if (!result) {
|
|
114
|
+
throw constants_1.ERRORS.TypedError('Method_UnknownCoin', `Coin info not found for hash: ${hash} ${networkInfo.hashGenesisBlock}`);
|
|
115
|
+
}
|
|
116
|
+
if (result.isBitcoin) {
|
|
117
|
+
const btcVersion = detectBtcVersion(networkInfo);
|
|
118
|
+
let fork;
|
|
119
|
+
if (btcVersion === 'bch') {
|
|
120
|
+
fork = networks.find(info => info.name === 'Bcash');
|
|
121
|
+
}
|
|
122
|
+
else if (btcVersion === 'btg') {
|
|
123
|
+
fork = networks.find(info => info.name === 'Bgold');
|
|
124
|
+
}
|
|
125
|
+
if (fork) {
|
|
126
|
+
return fork;
|
|
127
|
+
}
|
|
128
|
+
throw constants_1.ERRORS.TypedError('Method_UnknownCoin', `Coin info not found for hash: ${hash} ${networkInfo.hashGenesisBlock} BTC version:${btcVersion}`);
|
|
129
|
+
}
|
|
130
|
+
return result;
|
|
131
|
+
};
|
|
132
|
+
exports.getCoinInfoByHash = getCoinInfoByHash;
|
|
133
|
+
const getCoinInfo = (currency) => (0, exports.getBitcoinNetwork)(currency) || (0, exports.getEthereumNetwork)(currency) || (0, exports.getMiscNetwork)(currency);
|
|
134
|
+
exports.getCoinInfo = getCoinInfo;
|
|
135
|
+
const getCoinName = (path) => {
|
|
136
|
+
const slip44 = (0, pathUtils_1.fromHardened)(path[1]);
|
|
137
|
+
const network = ethereumNetworks.find(n => n.slip44 === slip44);
|
|
138
|
+
return network ? network.name : 'Unknown coin';
|
|
139
|
+
};
|
|
140
|
+
exports.getCoinName = getCoinName;
|
|
141
|
+
const parseBitcoinNetworksJson = (json) => {
|
|
142
|
+
Object.keys(json).forEach(key => {
|
|
143
|
+
const coin = json[key];
|
|
144
|
+
const shortcut = coin.coin_shortcut;
|
|
145
|
+
const isBitcoin = shortcut === 'BTC' || shortcut === 'TEST';
|
|
146
|
+
const network = {
|
|
147
|
+
messagePrefix: coin.signed_message_header,
|
|
148
|
+
bech32: coin.bech32_prefix,
|
|
149
|
+
bip32: {
|
|
150
|
+
public: coin.xpub_magic,
|
|
151
|
+
private: coin.xprv_magic,
|
|
152
|
+
},
|
|
153
|
+
pubKeyHash: coin.address_type,
|
|
154
|
+
scriptHash: coin.address_type_p2sh,
|
|
155
|
+
forkId: coin.fork_id,
|
|
156
|
+
wif: 0,
|
|
157
|
+
};
|
|
158
|
+
bitcoinNetworks.push({
|
|
159
|
+
type: 'bitcoin',
|
|
160
|
+
blockchainLink: coin.blockchain_link,
|
|
161
|
+
blocktime: Math.round(coin.blocktime_seconds / 60),
|
|
162
|
+
cashAddrPrefix: coin.cashaddr_prefix,
|
|
163
|
+
label: coin.coin_label,
|
|
164
|
+
name: coin.coin_name,
|
|
165
|
+
shortcut,
|
|
166
|
+
curveName: coin.curve_name,
|
|
167
|
+
defaultFees: coin.default_fee_b,
|
|
168
|
+
dustLimit: coin.dust_limit,
|
|
169
|
+
forceBip143: coin.force_bip143,
|
|
170
|
+
hashGenesisBlock: coin.hash_genesis_block,
|
|
171
|
+
maxAddressLength: coin.max_address_length,
|
|
172
|
+
maxFeeSatoshiKb: coin.maxfee_kb,
|
|
173
|
+
minAddressLength: coin.min_address_length,
|
|
174
|
+
minFeeSatoshiKb: coin.minfee_kb,
|
|
175
|
+
segwit: coin.segwit,
|
|
176
|
+
slip44: coin.slip44,
|
|
177
|
+
support: coin.support,
|
|
178
|
+
xPubMagic: coin.xpub_magic,
|
|
179
|
+
xPubMagicSegwitNative: coin.xpub_magic_segwit_native,
|
|
180
|
+
xPubMagicSegwit: coin.xpub_magic_segwit_p2sh,
|
|
181
|
+
taproot: coin.taproot,
|
|
182
|
+
network,
|
|
183
|
+
isBitcoin,
|
|
184
|
+
maxFee: Math.round(coin.maxfee_kb / 1000),
|
|
185
|
+
minFee: Math.round(coin.minfee_kb / 1000),
|
|
186
|
+
blocks: Math.round(coin.blocktime_seconds / 60),
|
|
187
|
+
decimals: coin.decimals,
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
const parseEthereumNetworksJson = (json) => {
|
|
192
|
+
Object.keys(json).forEach(key => {
|
|
193
|
+
const network = json[key];
|
|
194
|
+
ethereumNetworks.push({
|
|
195
|
+
type: 'ethereum',
|
|
196
|
+
blockchainLink: network.blockchain_link,
|
|
197
|
+
blocktime: -1,
|
|
198
|
+
chain: network.chain,
|
|
199
|
+
chainId: network.chain_id,
|
|
200
|
+
defaultFees: [
|
|
201
|
+
{
|
|
202
|
+
label: 'normal',
|
|
203
|
+
feePerUnit: '5000000000',
|
|
204
|
+
feeLimit: '21000',
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
minFee: 1,
|
|
208
|
+
maxFee: 10000,
|
|
209
|
+
label: network.name,
|
|
210
|
+
name: network.name,
|
|
211
|
+
shortcut: network.shortcut,
|
|
212
|
+
rskip60: network.rskip60,
|
|
213
|
+
slip44: network.slip44,
|
|
214
|
+
support: network.support,
|
|
215
|
+
network: undefined,
|
|
216
|
+
decimals: 16,
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
};
|
|
220
|
+
const parseMiscNetworksJSON = (json, type) => {
|
|
221
|
+
Object.keys(json).forEach(key => {
|
|
222
|
+
const network = json[key];
|
|
223
|
+
let minFee = -1;
|
|
224
|
+
let maxFee = -1;
|
|
225
|
+
let defaultFees = { Normal: -1 };
|
|
226
|
+
const shortcut = network.shortcut.toLowerCase();
|
|
227
|
+
if (shortcut === 'xrp' || shortcut === 'txrp') {
|
|
228
|
+
minFee = 10;
|
|
229
|
+
maxFee = 10000;
|
|
230
|
+
defaultFees = { Normal: 12 };
|
|
231
|
+
}
|
|
232
|
+
if (shortcut === 'ada' || shortcut === 'tada') {
|
|
233
|
+
minFee = 44;
|
|
234
|
+
maxFee = 16384 * 44 + 155381;
|
|
235
|
+
defaultFees = { Normal: 44 };
|
|
236
|
+
}
|
|
237
|
+
miscNetworks.push({
|
|
238
|
+
type: type || 'misc',
|
|
239
|
+
blockchainLink: network.blockchain_link,
|
|
240
|
+
blocktime: -1,
|
|
241
|
+
curve: network.curve,
|
|
242
|
+
defaultFees,
|
|
243
|
+
minFee,
|
|
244
|
+
maxFee,
|
|
245
|
+
label: network.name,
|
|
246
|
+
name: network.name,
|
|
247
|
+
shortcut: network.shortcut,
|
|
248
|
+
slip44: network.slip44,
|
|
249
|
+
support: network.support,
|
|
250
|
+
network: undefined,
|
|
251
|
+
decimals: network.decimals,
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
};
|
|
255
|
+
const parseCoinsJson = (json) => {
|
|
256
|
+
Object.keys(json).forEach(key => {
|
|
257
|
+
switch (key) {
|
|
258
|
+
case 'bitcoin':
|
|
259
|
+
return parseBitcoinNetworksJson(json[key]);
|
|
260
|
+
case 'eth':
|
|
261
|
+
return parseEthereumNetworksJson(json[key]);
|
|
262
|
+
case 'misc':
|
|
263
|
+
return parseMiscNetworksJSON(json[key]);
|
|
264
|
+
case 'nem':
|
|
265
|
+
return parseMiscNetworksJSON(json[key], 'nem');
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
exports.parseCoinsJson = parseCoinsJson;
|
|
270
|
+
const getUniqueNetworks = (networks) => networks.reduce((result, info) => {
|
|
271
|
+
if (!info || result.find(i => i.shortcut === info.shortcut))
|
|
272
|
+
return result;
|
|
273
|
+
return result.concat(info);
|
|
274
|
+
}, []);
|
|
275
|
+
exports.getUniqueNetworks = getUniqueNetworks;
|
|
276
|
+
const getAllNetworks = () => [...bitcoinNetworks, ...ethereumNetworks, ...miscNetworks];
|
|
277
|
+
exports.getAllNetworks = getAllNetworks;
|
|
278
|
+
//# sourceMappingURL=coinInfo.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export declare const config: {
|
|
2
|
+
webusb: {
|
|
3
|
+
vendorId: number;
|
|
4
|
+
productId: number;
|
|
5
|
+
}[];
|
|
6
|
+
whitelist: {
|
|
7
|
+
origin: string;
|
|
8
|
+
priority: number;
|
|
9
|
+
}[];
|
|
10
|
+
management: {
|
|
11
|
+
origin: string;
|
|
12
|
+
}[];
|
|
13
|
+
knownHosts: {
|
|
14
|
+
origin: string;
|
|
15
|
+
label: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
}[];
|
|
18
|
+
onionDomains: {
|
|
19
|
+
'trezor.io': string;
|
|
20
|
+
};
|
|
21
|
+
assets: {
|
|
22
|
+
name: string;
|
|
23
|
+
url: string;
|
|
24
|
+
}[];
|
|
25
|
+
messages: {
|
|
26
|
+
name: string;
|
|
27
|
+
range: {
|
|
28
|
+
min: string[];
|
|
29
|
+
};
|
|
30
|
+
json: string;
|
|
31
|
+
}[];
|
|
32
|
+
supportedBrowsers: {
|
|
33
|
+
chrome: {
|
|
34
|
+
version: number;
|
|
35
|
+
download: string;
|
|
36
|
+
update: string;
|
|
37
|
+
};
|
|
38
|
+
chromium: {
|
|
39
|
+
version: number;
|
|
40
|
+
download: string;
|
|
41
|
+
update: string;
|
|
42
|
+
};
|
|
43
|
+
electron: {
|
|
44
|
+
version: number;
|
|
45
|
+
download: string;
|
|
46
|
+
update: string;
|
|
47
|
+
};
|
|
48
|
+
firefox: {
|
|
49
|
+
version: number;
|
|
50
|
+
download: string;
|
|
51
|
+
update: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
supportedFirmware: ({
|
|
55
|
+
coin: string[];
|
|
56
|
+
methods: string[];
|
|
57
|
+
min: string[];
|
|
58
|
+
max: undefined;
|
|
59
|
+
comment: string[];
|
|
60
|
+
capabilities?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
coin: string[];
|
|
63
|
+
min: string[];
|
|
64
|
+
comment: string[];
|
|
65
|
+
methods?: undefined;
|
|
66
|
+
max?: undefined;
|
|
67
|
+
capabilities?: undefined;
|
|
68
|
+
} | {
|
|
69
|
+
methods: string[];
|
|
70
|
+
min: string[];
|
|
71
|
+
comment: string[];
|
|
72
|
+
coin?: undefined;
|
|
73
|
+
max?: undefined;
|
|
74
|
+
capabilities?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
capabilities: string[];
|
|
77
|
+
min: string[];
|
|
78
|
+
comment: string[];
|
|
79
|
+
coin?: undefined;
|
|
80
|
+
methods?: undefined;
|
|
81
|
+
max?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
coin: string[];
|
|
84
|
+
methods: string[];
|
|
85
|
+
min: string[];
|
|
86
|
+
comment: string[];
|
|
87
|
+
max?: undefined;
|
|
88
|
+
capabilities?: undefined;
|
|
89
|
+
} | {
|
|
90
|
+
capabilities: string[];
|
|
91
|
+
methods: string[];
|
|
92
|
+
min: string[];
|
|
93
|
+
coin?: undefined;
|
|
94
|
+
max?: undefined;
|
|
95
|
+
comment?: undefined;
|
|
96
|
+
})[];
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=config.d.ts.map
|