@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,21 @@
|
|
|
1
|
+
export declare type BrowserState = {
|
|
2
|
+
name: string;
|
|
3
|
+
osname: string;
|
|
4
|
+
supported: boolean;
|
|
5
|
+
outdated: boolean;
|
|
6
|
+
mobile: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare type SupportedBrowser = {
|
|
9
|
+
version: number;
|
|
10
|
+
download: string;
|
|
11
|
+
update: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const getBrowserState: (supportedBrowsers: {
|
|
14
|
+
[key: string]: SupportedBrowser;
|
|
15
|
+
}) => BrowserState;
|
|
16
|
+
export declare const getOS: () => string;
|
|
17
|
+
export declare const getSuggestedPlatform: () => string | undefined;
|
|
18
|
+
export declare const suggestBridgeInstaller: () => import("..").BridgeInfo;
|
|
19
|
+
export declare const suggestUdevInstaller: () => import("..").UdevInfo;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=browserUtils.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.suggestUdevInstaller = exports.suggestBridgeInstaller = exports.getSuggestedPlatform = exports.getOS = exports.getBrowserState = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bowser_1 = (0, tslib_1.__importDefault)(require("bowser"));
|
|
6
|
+
const transportInfo_1 = require("../data/transportInfo");
|
|
7
|
+
const udevInfo_1 = require("../data/udevInfo");
|
|
8
|
+
const DEFAULT_STATE = {
|
|
9
|
+
name: 'unknown',
|
|
10
|
+
osname: 'unknown',
|
|
11
|
+
supported: false,
|
|
12
|
+
outdated: false,
|
|
13
|
+
mobile: false,
|
|
14
|
+
};
|
|
15
|
+
const getBrowserState = (supportedBrowsers) => {
|
|
16
|
+
if (typeof window === 'undefined' || !navigator || !navigator.userAgent)
|
|
17
|
+
return DEFAULT_STATE;
|
|
18
|
+
const { browser, os, platform } = bowser_1.default.parse(navigator.userAgent);
|
|
19
|
+
const mobile = platform.type === 'mobile';
|
|
20
|
+
let supported = browser.name ? supportedBrowsers[browser.name.toLowerCase()] : null;
|
|
21
|
+
let outdated = false;
|
|
22
|
+
if (mobile && typeof navigator.usb === 'undefined') {
|
|
23
|
+
supported = null;
|
|
24
|
+
}
|
|
25
|
+
if (supported) {
|
|
26
|
+
outdated = supported.version > parseInt(browser.version, 10);
|
|
27
|
+
if (outdated) {
|
|
28
|
+
supported = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
name: `${browser.name}: ${browser.version}; ${os.name}: ${os.version};`,
|
|
33
|
+
osname: os.name,
|
|
34
|
+
mobile,
|
|
35
|
+
supported: !!supported,
|
|
36
|
+
outdated,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.getBrowserState = getBrowserState;
|
|
40
|
+
const getOS = () => {
|
|
41
|
+
if (typeof window === 'undefined' || !navigator || !navigator.userAgent)
|
|
42
|
+
return 'unknown';
|
|
43
|
+
const { os } = bowser_1.default.parse(navigator.userAgent);
|
|
44
|
+
return os.name ? os.name.toLowerCase() : 'unknown';
|
|
45
|
+
};
|
|
46
|
+
exports.getOS = getOS;
|
|
47
|
+
const getSuggestedPlatform = () => {
|
|
48
|
+
if (typeof window === 'undefined' || !navigator || !navigator.userAgent)
|
|
49
|
+
return;
|
|
50
|
+
const agent = navigator.userAgent;
|
|
51
|
+
const { os } = bowser_1.default.parse(agent);
|
|
52
|
+
const name = os.name ? os.name.toLowerCase() : null;
|
|
53
|
+
switch (name) {
|
|
54
|
+
case 'linux': {
|
|
55
|
+
const isRpm = agent.match(/CentOS|Fedora|Mandriva|Mageia|Red Hat|Scientific|SUSE/)
|
|
56
|
+
? 'rpm'
|
|
57
|
+
: 'deb';
|
|
58
|
+
const is64x = agent.match(/Linux i[3456]86/) ? '32' : '64';
|
|
59
|
+
return `${isRpm}${is64x}`;
|
|
60
|
+
}
|
|
61
|
+
case 'macos':
|
|
62
|
+
return 'mac';
|
|
63
|
+
case 'windows': {
|
|
64
|
+
const arch = agent.match(/(Win64|WOW64)/) ? '64' : '32';
|
|
65
|
+
return `win${arch}`;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
exports.getSuggestedPlatform = getSuggestedPlatform;
|
|
72
|
+
const suggestBridgeInstaller = () => {
|
|
73
|
+
const info = (0, transportInfo_1.getBridgeInfo)();
|
|
74
|
+
if (!info.packages.find(p => p.preferred)) {
|
|
75
|
+
const platform = (0, exports.getSuggestedPlatform)();
|
|
76
|
+
if (platform) {
|
|
77
|
+
info.packages = info.packages.map(p => ({
|
|
78
|
+
...p,
|
|
79
|
+
preferred: p.platform.indexOf(platform) >= 0,
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return info;
|
|
84
|
+
};
|
|
85
|
+
exports.suggestBridgeInstaller = suggestBridgeInstaller;
|
|
86
|
+
const suggestUdevInstaller = () => {
|
|
87
|
+
const info = (0, udevInfo_1.getUdevInfo)();
|
|
88
|
+
if (!info.packages.find(p => p.preferred)) {
|
|
89
|
+
const platform = (0, exports.getSuggestedPlatform)();
|
|
90
|
+
if (platform) {
|
|
91
|
+
info.packages = info.packages.map(p => ({
|
|
92
|
+
...p,
|
|
93
|
+
preferred: p.platform.indexOf(platform) >= 0,
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return info;
|
|
98
|
+
};
|
|
99
|
+
exports.suggestUdevInstaller = suggestUdevInstaller;
|
|
100
|
+
//# sourceMappingURL=browserUtils.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reverseBuffer = void 0;
|
|
4
|
+
const reverseBuffer = (buf) => {
|
|
5
|
+
const copy = Buffer.alloc(buf.length);
|
|
6
|
+
buf.copy(copy);
|
|
7
|
+
[].reverse.call(copy);
|
|
8
|
+
return copy;
|
|
9
|
+
};
|
|
10
|
+
exports.reverseBuffer = reverseBuffer;
|
|
11
|
+
//# sourceMappingURL=bufferUtils.js.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare type LogMessage = {
|
|
2
|
+
level: string;
|
|
3
|
+
prefix: string;
|
|
4
|
+
message: any[];
|
|
5
|
+
timestamp: number;
|
|
6
|
+
};
|
|
7
|
+
declare class Log {
|
|
8
|
+
prefix: string;
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
css: string;
|
|
11
|
+
messages: LogMessage[];
|
|
12
|
+
constructor(prefix: string, enabled: boolean);
|
|
13
|
+
addMessage(level: string, prefix: string, ...args: any[]): void;
|
|
14
|
+
log(...args: any[]): void;
|
|
15
|
+
error(...args: any[]): void;
|
|
16
|
+
warn(...args: any[]): void;
|
|
17
|
+
debug(...args: any[]): void;
|
|
18
|
+
}
|
|
19
|
+
export declare const initLog: (prefix: string, enabled?: boolean | undefined) => Log;
|
|
20
|
+
export declare const enableLog: (enabled?: boolean | undefined) => void;
|
|
21
|
+
export declare const enableLogByPrefix: (prefix: string, enabled: boolean) => void;
|
|
22
|
+
export declare const getLog: () => LogMessage[];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=debug.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLog = exports.enableLogByPrefix = exports.enableLog = exports.initLog = void 0;
|
|
4
|
+
const colors = {
|
|
5
|
+
'@trezor/connect': 'color: #f4a742; background: #000;',
|
|
6
|
+
IFrame: 'color: #f4a742; background: #000;',
|
|
7
|
+
Core: 'color: #f4a742; background: #000;',
|
|
8
|
+
DescriptorStream: 'color: #77ab59; background: #000;',
|
|
9
|
+
DeviceList: 'color: #77ab59; background: #000;',
|
|
10
|
+
Device: 'color: #bada55; background: #000;',
|
|
11
|
+
DeviceCommands: 'color: #bada55; background: #000;',
|
|
12
|
+
};
|
|
13
|
+
const MAX_ENTRIES = 100;
|
|
14
|
+
class Log {
|
|
15
|
+
constructor(prefix, enabled) {
|
|
16
|
+
this.prefix = prefix;
|
|
17
|
+
this.enabled = enabled;
|
|
18
|
+
this.messages = [];
|
|
19
|
+
this.css = typeof window !== 'undefined' && colors[prefix] ? colors[prefix] : '';
|
|
20
|
+
}
|
|
21
|
+
addMessage(level, prefix, ...args) {
|
|
22
|
+
this.messages.push({
|
|
23
|
+
level,
|
|
24
|
+
prefix,
|
|
25
|
+
message: args,
|
|
26
|
+
timestamp: new Date().getTime(),
|
|
27
|
+
});
|
|
28
|
+
if (this.messages.length > MAX_ENTRIES) {
|
|
29
|
+
this.messages.shift();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
log(...args) {
|
|
33
|
+
this.addMessage('log', this.prefix, ...args);
|
|
34
|
+
if (this.enabled) {
|
|
35
|
+
console.log(this.prefix, ...args);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
error(...args) {
|
|
39
|
+
this.addMessage('error', this.prefix, ...args);
|
|
40
|
+
if (this.enabled) {
|
|
41
|
+
console.error(this.prefix, ...args);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
warn(...args) {
|
|
45
|
+
this.addMessage('warn', this.prefix, ...args);
|
|
46
|
+
if (this.enabled) {
|
|
47
|
+
console.warn(this.prefix, ...args);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
debug(...args) {
|
|
51
|
+
this.addMessage('debug', this.prefix, ...args);
|
|
52
|
+
if (this.enabled) {
|
|
53
|
+
if (this.css) {
|
|
54
|
+
console.log(`%c${this.prefix}`, this.css, ...args);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log(this.prefix, ...args);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const _logs = {};
|
|
63
|
+
const initLog = (prefix, enabled) => {
|
|
64
|
+
const instance = new Log(prefix, !!enabled);
|
|
65
|
+
_logs[prefix] = instance;
|
|
66
|
+
return instance;
|
|
67
|
+
};
|
|
68
|
+
exports.initLog = initLog;
|
|
69
|
+
const enableLog = (enabled) => {
|
|
70
|
+
Object.keys(_logs).forEach(key => {
|
|
71
|
+
_logs[key].enabled = !!enabled;
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
exports.enableLog = enableLog;
|
|
75
|
+
const enableLogByPrefix = (prefix, enabled) => {
|
|
76
|
+
if (_logs[prefix]) {
|
|
77
|
+
_logs[prefix].enabled = enabled;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.enableLogByPrefix = enableLogByPrefix;
|
|
81
|
+
const getLog = () => {
|
|
82
|
+
let logs = [];
|
|
83
|
+
Object.keys(_logs).forEach(key => {
|
|
84
|
+
logs = logs.concat(_logs[key].messages);
|
|
85
|
+
});
|
|
86
|
+
logs.sort((a, b) => a.timestamp - b.timestamp);
|
|
87
|
+
return logs;
|
|
88
|
+
};
|
|
89
|
+
exports.getLog = getLog;
|
|
90
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare type Deferred<T, I = any, D = any> = {
|
|
2
|
+
id?: I;
|
|
3
|
+
data?: D;
|
|
4
|
+
promise: Promise<T>;
|
|
5
|
+
resolve: (t: T) => void;
|
|
6
|
+
reject: (e: Error) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare type AsyncDeferred<T> = {
|
|
9
|
+
promise: Promise<T>;
|
|
10
|
+
resolve: (t: T) => void;
|
|
11
|
+
reject: (e: Error) => void;
|
|
12
|
+
run: (...args: any[]) => any;
|
|
13
|
+
};
|
|
14
|
+
export declare function create<T, I = any, D = any>(arg?: I, data?: D): Deferred<T, I, D>;
|
|
15
|
+
export declare function createAsync<T>(innerFn: (...args: any[]) => any): AsyncDeferred<T>;
|
|
16
|
+
export declare function resolveTimeoutPromise<T>(delay: number, result: T): Promise<T>;
|
|
17
|
+
export declare const rejectTimeoutPromise: (delay: number, error: Error) => Promise<any>;
|
|
18
|
+
//# sourceMappingURL=deferred.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rejectTimeoutPromise = exports.resolveTimeoutPromise = exports.createAsync = exports.create = void 0;
|
|
4
|
+
function create(arg, data) {
|
|
5
|
+
let localResolve = (_t) => { };
|
|
6
|
+
let localReject = (_e) => { };
|
|
7
|
+
let id;
|
|
8
|
+
const promise = new Promise(async (resolve, reject) => {
|
|
9
|
+
localResolve = resolve;
|
|
10
|
+
localReject = reject;
|
|
11
|
+
if (typeof arg === 'function') {
|
|
12
|
+
try {
|
|
13
|
+
await arg();
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
reject(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (typeof arg === 'string')
|
|
20
|
+
id = arg;
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
id,
|
|
24
|
+
data,
|
|
25
|
+
resolve: localResolve,
|
|
26
|
+
reject: localReject,
|
|
27
|
+
promise,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
exports.create = create;
|
|
31
|
+
function createAsync(innerFn) {
|
|
32
|
+
let localResolve = (_t) => { };
|
|
33
|
+
let localReject = _e => { };
|
|
34
|
+
const promise = new Promise((resolve, reject) => {
|
|
35
|
+
localResolve = resolve;
|
|
36
|
+
localReject = reject;
|
|
37
|
+
});
|
|
38
|
+
const inner = async () => {
|
|
39
|
+
await innerFn();
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
resolve: localResolve,
|
|
43
|
+
reject: localReject,
|
|
44
|
+
promise,
|
|
45
|
+
run: () => {
|
|
46
|
+
inner();
|
|
47
|
+
return promise;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.createAsync = createAsync;
|
|
52
|
+
function resolveTimeoutPromise(delay, result) {
|
|
53
|
+
return new Promise(resolve => {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
resolve(result);
|
|
56
|
+
}, delay);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
exports.resolveTimeoutPromise = resolveTimeoutPromise;
|
|
60
|
+
const rejectTimeoutPromise = (delay, error) => new Promise((_resolve, reject) => {
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
reject(error);
|
|
63
|
+
}, delay);
|
|
64
|
+
});
|
|
65
|
+
exports.rejectTimeoutPromise = rejectTimeoutPromise;
|
|
66
|
+
//# sourceMappingURL=deferred.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PROTO } from '../constants';
|
|
2
|
+
import type { Features, CoinInfo, UnavailableCapabilities } from '../types';
|
|
3
|
+
export declare const parseCapabilities: (features?: PROTO.Features | undefined) => PROTO.Capability[];
|
|
4
|
+
export declare const getUnavailableCapabilities: (features: Features, coins: CoinInfo[]) => UnavailableCapabilities;
|
|
5
|
+
export declare const parseRevision: (features: Features) => string | null;
|
|
6
|
+
//# sourceMappingURL=deviceFeaturesUtils.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseRevision = exports.getUnavailableCapabilities = exports.parseCapabilities = void 0;
|
|
4
|
+
const versionUtils_1 = require("./versionUtils");
|
|
5
|
+
const config_1 = require("../data/config");
|
|
6
|
+
const DEFAULT_CAPABILITIES_T1 = [
|
|
7
|
+
'Capability_Bitcoin',
|
|
8
|
+
'Capability_Bitcoin_like',
|
|
9
|
+
'Capability_Crypto',
|
|
10
|
+
'Capability_Ethereum',
|
|
11
|
+
'Capability_NEM',
|
|
12
|
+
'Capability_Stellar',
|
|
13
|
+
'Capability_U2F',
|
|
14
|
+
];
|
|
15
|
+
const DEFAULT_CAPABILITIES_TT = [
|
|
16
|
+
'Capability_Bitcoin',
|
|
17
|
+
'Capability_Bitcoin_like',
|
|
18
|
+
'Capability_Binance',
|
|
19
|
+
'Capability_Cardano',
|
|
20
|
+
'Capability_Crypto',
|
|
21
|
+
'Capability_EOS',
|
|
22
|
+
'Capability_Ethereum',
|
|
23
|
+
'Capability_Monero',
|
|
24
|
+
'Capability_NEM',
|
|
25
|
+
'Capability_Ripple',
|
|
26
|
+
'Capability_Stellar',
|
|
27
|
+
'Capability_Tezos',
|
|
28
|
+
'Capability_U2F',
|
|
29
|
+
];
|
|
30
|
+
const parseCapabilities = (features) => {
|
|
31
|
+
if (!features || features.firmware_present === false)
|
|
32
|
+
return [];
|
|
33
|
+
if (!features.capabilities || !features.capabilities.length) {
|
|
34
|
+
return features.major_version === 1 ? DEFAULT_CAPABILITIES_T1 : DEFAULT_CAPABILITIES_TT;
|
|
35
|
+
}
|
|
36
|
+
return features.capabilities;
|
|
37
|
+
};
|
|
38
|
+
exports.parseCapabilities = parseCapabilities;
|
|
39
|
+
const getUnavailableCapabilities = (features, coins) => {
|
|
40
|
+
const { capabilities } = features;
|
|
41
|
+
const list = {};
|
|
42
|
+
if (!capabilities)
|
|
43
|
+
return list;
|
|
44
|
+
const fw = [features.major_version, features.minor_version, features.patch_version];
|
|
45
|
+
const key = `trezor${features.major_version}`;
|
|
46
|
+
const supported = coins.filter(info => {
|
|
47
|
+
if (!info.support || typeof info.support[key] !== 'string') {
|
|
48
|
+
list[info.shortcut.toLowerCase()] = 'no-support';
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
});
|
|
53
|
+
const unavailable = supported.filter(info => {
|
|
54
|
+
if (info.type === 'bitcoin') {
|
|
55
|
+
if (info.name === 'Bitcoin' || info.name === 'Testnet') {
|
|
56
|
+
return !capabilities.includes('Capability_Bitcoin');
|
|
57
|
+
}
|
|
58
|
+
return !capabilities.includes('Capability_Bitcoin_like');
|
|
59
|
+
}
|
|
60
|
+
if (info.type === 'ethereum') {
|
|
61
|
+
return !capabilities.includes('Capability_Ethereum');
|
|
62
|
+
}
|
|
63
|
+
if (info.type === 'nem') {
|
|
64
|
+
return !capabilities.includes('Capability_NEM');
|
|
65
|
+
}
|
|
66
|
+
if (info.shortcut === 'BNB')
|
|
67
|
+
return !capabilities.includes('Capability_Binance');
|
|
68
|
+
if (info.shortcut === 'ADA' || info.shortcut === 'tADA')
|
|
69
|
+
return !capabilities.includes('Capability_Cardano');
|
|
70
|
+
if (info.shortcut === 'XRP' || info.shortcut === 'tXRP')
|
|
71
|
+
return !capabilities.includes('Capability_Ripple');
|
|
72
|
+
return !capabilities.includes(`Capability_${info.name}`);
|
|
73
|
+
});
|
|
74
|
+
unavailable.forEach(info => {
|
|
75
|
+
list[info.shortcut.toLowerCase()] = 'no-capability';
|
|
76
|
+
});
|
|
77
|
+
supported
|
|
78
|
+
.filter(info => !unavailable.includes(info))
|
|
79
|
+
.forEach(info => {
|
|
80
|
+
if ((0, versionUtils_1.versionCompare)(info.support[key], fw) > 0) {
|
|
81
|
+
list[info.shortcut.toLowerCase()] = 'update-required';
|
|
82
|
+
unavailable.push(info);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
config_1.config.supportedFirmware.forEach(s => {
|
|
86
|
+
if (!s.capabilities)
|
|
87
|
+
return;
|
|
88
|
+
const min = s.min ? s.min[fw[0] - 1] : null;
|
|
89
|
+
const max = s.max ? s.max[fw[0] - 1] : null;
|
|
90
|
+
if (min && (min === '0' || (0, versionUtils_1.versionCompare)(min, fw) > 0)) {
|
|
91
|
+
const value = min === '0' ? 'no-support' : 'update-required';
|
|
92
|
+
s.capabilities.forEach(m => {
|
|
93
|
+
list[m] = value;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (max && (0, versionUtils_1.versionCompare)(max, fw) < 0) {
|
|
97
|
+
s.capabilities.forEach(m => {
|
|
98
|
+
list[m] = 'trezor-connect-outdated';
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return list;
|
|
103
|
+
};
|
|
104
|
+
exports.getUnavailableCapabilities = getUnavailableCapabilities;
|
|
105
|
+
const parseRevision = (features) => {
|
|
106
|
+
const { revision } = features;
|
|
107
|
+
if (!revision)
|
|
108
|
+
return null;
|
|
109
|
+
if (/^(?=.*[a-f])([a-f0-9]*)$/gi.test(revision))
|
|
110
|
+
return revision;
|
|
111
|
+
const revisionUtf8 = Buffer.from(revision, 'hex').toString('utf-8');
|
|
112
|
+
return /^([a-f0-9])*$/gi.test(revisionUtf8) ? revisionUtf8 : revision;
|
|
113
|
+
};
|
|
114
|
+
exports.parseRevision = parseRevision;
|
|
115
|
+
//# sourceMappingURL=deviceFeaturesUtils.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNetworkLabel = void 0;
|
|
4
|
+
const getNetworkLabel = (label, network) => {
|
|
5
|
+
if (network) {
|
|
6
|
+
const name = network.name.toLowerCase().indexOf('testnet') >= 0 ? 'Testnet' : network.name;
|
|
7
|
+
return label.replace('#NETWORK', name);
|
|
8
|
+
}
|
|
9
|
+
return label.replace('#NETWORK', '');
|
|
10
|
+
};
|
|
11
|
+
exports.getNetworkLabel = getNetworkLabel;
|
|
12
|
+
//# sourceMappingURL=ethereumUtils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Features, StrictFeatures, FirmwareRelease, VersionArray } from '../types';
|
|
2
|
+
export declare const isStrictFeatures: (extFeatures: Features) => extFeatures is StrictFeatures;
|
|
3
|
+
export declare const isValidReleases: (extReleases: any) => extReleases is FirmwareRelease[];
|
|
4
|
+
export declare const getScore: (device_id: string) => number;
|
|
5
|
+
export declare const filterSafeListByBootloader: (releasesList: FirmwareRelease[], bootloaderVersion: VersionArray) => FirmwareRelease[];
|
|
6
|
+
export declare const filterSafeListByFirmware: (releasesList: FirmwareRelease[], firmwareVersion: VersionArray) => FirmwareRelease[];
|
|
7
|
+
//# sourceMappingURL=firmwareUtils.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterSafeListByFirmware = exports.filterSafeListByBootloader = exports.getScore = exports.isValidReleases = exports.isStrictFeatures = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const utils_1 = require("@trezor/utils");
|
|
6
|
+
const isStrictFeatures = (extFeatures) => [1, 2].includes(extFeatures.major_version) &&
|
|
7
|
+
(extFeatures.firmware_present === false ||
|
|
8
|
+
extFeatures.bootloader_mode == null ||
|
|
9
|
+
extFeatures.bootloader_mode === true);
|
|
10
|
+
exports.isStrictFeatures = isStrictFeatures;
|
|
11
|
+
const isValidReleases = (extReleases) => Array.isArray(extReleases) &&
|
|
12
|
+
extReleases.every(release => release.version && release.min_firmware_version && release.min_bootloader_version);
|
|
13
|
+
exports.isValidReleases = isValidReleases;
|
|
14
|
+
const getScore = (device_id) => {
|
|
15
|
+
const hash = (0, crypto_1.createHash)('sha256');
|
|
16
|
+
hash.update(device_id);
|
|
17
|
+
const output = parseInt(hash.digest('hex'), 16) / 2 ** 256;
|
|
18
|
+
return Math.round(output * 100) / 100;
|
|
19
|
+
};
|
|
20
|
+
exports.getScore = getScore;
|
|
21
|
+
const filterSafeListByBootloader = (releasesList, bootloaderVersion) => releasesList.filter(item => (!item.min_bootloader_version ||
|
|
22
|
+
utils_1.versionUtils.isNewerOrEqual(bootloaderVersion, item.min_bootloader_version)) &&
|
|
23
|
+
(!item.bootloader_version ||
|
|
24
|
+
utils_1.versionUtils.isNewerOrEqual(item.bootloader_version, bootloaderVersion)));
|
|
25
|
+
exports.filterSafeListByBootloader = filterSafeListByBootloader;
|
|
26
|
+
const filterSafeListByFirmware = (releasesList, firmwareVersion) => releasesList.filter(item => utils_1.versionUtils.isNewerOrEqual(firmwareVersion, item.min_firmware_version));
|
|
27
|
+
exports.filterSafeListByFirmware = filterSafeListByFirmware;
|
|
28
|
+
//# sourceMappingURL=firmwareUtils.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CoinInfo } from '../types';
|
|
2
|
+
export declare const formatAmount: (n: string, coinInfo: CoinInfo) => string;
|
|
3
|
+
export declare const formatTime: (n: number) => string;
|
|
4
|
+
export declare const btckb2satoshib: (n: string) => string;
|
|
5
|
+
export declare const hasHexPrefix: (str: string) => boolean;
|
|
6
|
+
export declare const stripHexPrefix: (str: string) => string;
|
|
7
|
+
export declare const messageToHex: (message: string) => string;
|
|
8
|
+
//# sourceMappingURL=formatUtils.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageToHex = exports.stripHexPrefix = exports.hasHexPrefix = exports.btckb2satoshib = exports.formatTime = exports.formatAmount = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bignumber_js_1 = (0, tslib_1.__importDefault)(require("bignumber.js"));
|
|
6
|
+
const formatAmount = (n, coinInfo) => `${new bignumber_js_1.default(n).div(10 ** coinInfo.decimals).toString(10)} ${coinInfo.shortcut}`;
|
|
7
|
+
exports.formatAmount = formatAmount;
|
|
8
|
+
const formatTime = (n) => {
|
|
9
|
+
if (!n || n <= 0)
|
|
10
|
+
return 'No time estimate';
|
|
11
|
+
const hours = Math.floor(n / 60);
|
|
12
|
+
const minutes = n % 60;
|
|
13
|
+
let res = '';
|
|
14
|
+
if (hours !== 0) {
|
|
15
|
+
res += `${hours} hour`;
|
|
16
|
+
if (hours > 1) {
|
|
17
|
+
res += 's';
|
|
18
|
+
}
|
|
19
|
+
res += ' ';
|
|
20
|
+
}
|
|
21
|
+
if (minutes !== 0) {
|
|
22
|
+
res += `${minutes} minutes`;
|
|
23
|
+
}
|
|
24
|
+
return res;
|
|
25
|
+
};
|
|
26
|
+
exports.formatTime = formatTime;
|
|
27
|
+
const btckb2satoshib = (n) => new bignumber_js_1.default(n).times(1e5).toFixed(0, bignumber_js_1.default.ROUND_HALF_UP);
|
|
28
|
+
exports.btckb2satoshib = btckb2satoshib;
|
|
29
|
+
const hasHexPrefix = (str) => str.slice(0, 2).toLowerCase() === '0x';
|
|
30
|
+
exports.hasHexPrefix = hasHexPrefix;
|
|
31
|
+
const stripHexPrefix = (str) => ((0, exports.hasHexPrefix)(str) ? str.slice(2) : str);
|
|
32
|
+
exports.stripHexPrefix = stripHexPrefix;
|
|
33
|
+
const isHexString = (value, length) => {
|
|
34
|
+
if (typeof value !== 'string' || !value.match(/^(0x|0X)?[0-9A-Fa-f]*$/)) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (length && value.length !== 2 + 2 * length) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
};
|
|
42
|
+
const messageToHex = (message) => {
|
|
43
|
+
let buffer;
|
|
44
|
+
if (isHexString(message)) {
|
|
45
|
+
let clean = (0, exports.stripHexPrefix)(message);
|
|
46
|
+
if (clean.length % 2 !== 0) {
|
|
47
|
+
clean = `0${clean}`;
|
|
48
|
+
}
|
|
49
|
+
buffer = Buffer.from(clean, 'hex');
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
buffer = Buffer.from(message);
|
|
53
|
+
}
|
|
54
|
+
return buffer.toString('hex');
|
|
55
|
+
};
|
|
56
|
+
exports.messageToHex = messageToHex;
|
|
57
|
+
//# sourceMappingURL=formatUtils.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Network } from '@trezor/utxo-lib';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
export declare const convertXpub: (xpub: string, originalNetwork?: Network | undefined, requestedNetwork?: Network | undefined) => string;
|
|
4
|
+
export declare const convertBitcoinXpub: (xpub: string, network: Network) => string;
|
|
5
|
+
export declare function xpubDerive<PK extends PROTO.PublicKey | PROTO.EthereumPublicKey>(xpub: PK, childXPub: PK, suffix: number, network?: Network, _requestedNetwork?: Network): PK;
|
|
6
|
+
export declare const xpubToHDNodeType: (xpub: string, network: Network) => PROTO.HDNodeType;
|
|
7
|
+
export declare const convertMultisigPubKey: <T extends PROTO.TxInputType | PROTO.TxOutputType>(network: Network, utxo: T) => T;
|
|
8
|
+
//# sourceMappingURL=hdnodeUtils.d.ts.map
|