@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,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modifyFirmware = void 0;
|
|
4
|
+
const utils_1 = require("@trezor/utils");
|
|
5
|
+
const modifyFirmware = ({ fw, features }) => {
|
|
6
|
+
if (features.major_version === 2)
|
|
7
|
+
return fw;
|
|
8
|
+
if (utils_1.versionUtils.isNewerOrEqual([features.major_version, features.minor_version, features.patch_version], [1, 8, 0])) {
|
|
9
|
+
const fwView = new Uint8Array(fw);
|
|
10
|
+
if (String.fromCharCode(...Array.from(fwView.slice(0, 4))) === 'TRZR' &&
|
|
11
|
+
String.fromCharCode(...Array.from(fwView.slice(256, 260))) === 'TRZF') {
|
|
12
|
+
return fw.slice(256);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return fw;
|
|
16
|
+
};
|
|
17
|
+
exports.modifyFirmware = modifyFirmware;
|
|
18
|
+
//# sourceMappingURL=modifyFirmware.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
declare type Params = {
|
|
3
|
+
binary?: ArrayBuffer;
|
|
4
|
+
version?: number[];
|
|
5
|
+
btcOnly?: boolean;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
intermediary?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export default class FirmwareUpdate extends AbstractMethod<'firmwareUpdate', Params> {
|
|
10
|
+
init(): void;
|
|
11
|
+
confirmation(): Promise<boolean>;
|
|
12
|
+
run(): Promise<import("packages/transport/lib/types/messages").Success>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=firmwareUpdate.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getBinary_1 = require("./firmware/getBinary");
|
|
4
|
+
const modifyFirmware_1 = require("./firmware/modifyFirmware");
|
|
5
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
7
|
+
const events_1 = require("../events");
|
|
8
|
+
const uploadFirmware_1 = require("./management/uploadFirmware");
|
|
9
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
10
|
+
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
11
|
+
const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
12
|
+
class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
13
|
+
init() {
|
|
14
|
+
this.useEmptyPassphrase = true;
|
|
15
|
+
this.requiredPermissions = ['management'];
|
|
16
|
+
this.allowDeviceMode = [events_1.UI.BOOTLOADER, events_1.UI.INITIALIZE];
|
|
17
|
+
this.requireDeviceMode = [events_1.UI.BOOTLOADER];
|
|
18
|
+
this.useDeviceState = false;
|
|
19
|
+
this.skipFirmwareCheck = true;
|
|
20
|
+
const { payload } = this;
|
|
21
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
22
|
+
{ name: 'version', type: 'array' },
|
|
23
|
+
{ name: 'btcOnly', type: 'boolean' },
|
|
24
|
+
{ name: 'baseUrl', type: 'string' },
|
|
25
|
+
{ name: 'binary', type: 'array-buffer' },
|
|
26
|
+
{ name: 'intermediary', type: 'boolean' },
|
|
27
|
+
]);
|
|
28
|
+
if ('version' in payload) {
|
|
29
|
+
this.params = {
|
|
30
|
+
version: payload.version,
|
|
31
|
+
btcOnly: payload.btcOnly,
|
|
32
|
+
baseUrl: payload.baseUrl || 'https://data.trezor.io',
|
|
33
|
+
intermediary: payload.intermediary,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if ('binary' in payload) {
|
|
37
|
+
this.params = {
|
|
38
|
+
...this.params,
|
|
39
|
+
binary: payload.binary,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async confirmation() {
|
|
44
|
+
await this.getPopupPromise().promise;
|
|
45
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
46
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
47
|
+
view: 'device-management',
|
|
48
|
+
customConfirmButton: {
|
|
49
|
+
className: 'wipe',
|
|
50
|
+
label: 'Proceed',
|
|
51
|
+
},
|
|
52
|
+
label: 'Do you want to update firmware? Never do this without your recovery card.',
|
|
53
|
+
}));
|
|
54
|
+
const uiResp = await uiPromise.promise;
|
|
55
|
+
return uiResp.payload;
|
|
56
|
+
}
|
|
57
|
+
async run() {
|
|
58
|
+
const { device, params } = this;
|
|
59
|
+
let binary;
|
|
60
|
+
try {
|
|
61
|
+
if (params.binary) {
|
|
62
|
+
if (!(0, firmwareUtils_1.isStrictFeatures)(device.features)) {
|
|
63
|
+
throw new Error('Features of unexpected shape provided');
|
|
64
|
+
}
|
|
65
|
+
binary = (0, modifyFirmware_1.modifyFirmware)({
|
|
66
|
+
fw: params.binary,
|
|
67
|
+
features: device.features,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const firmware = await (0, getBinary_1.getBinary)({
|
|
72
|
+
features: device.features,
|
|
73
|
+
releases: (0, firmwareInfo_1.getReleases)(device.features.major_version),
|
|
74
|
+
version: params.version,
|
|
75
|
+
btcOnly: params.btcOnly,
|
|
76
|
+
baseUrl: params.baseUrl,
|
|
77
|
+
intermediary: params.intermediary,
|
|
78
|
+
});
|
|
79
|
+
binary = firmware.binary;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
throw constants_1.ERRORS.TypedError('Method_FirmwareUpdate_DownloadFailed', 'Failed to download firmware binary');
|
|
84
|
+
}
|
|
85
|
+
return (0, uploadFirmware_1.uploadFirmware)(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: binary });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.default = FirmwareUpdate;
|
|
89
|
+
//# sourceMappingURL=firmwareUpdate.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { Discovery } from './common/Discovery';
|
|
3
|
+
import type { CoinInfo, AccountInfo, AccountUtxo } from '../types';
|
|
4
|
+
import type { GetAccountInfo as GetAccountInfoParams } from '../types/api/getAccountInfo';
|
|
5
|
+
declare type Request = GetAccountInfoParams & {
|
|
6
|
+
address_n: number[];
|
|
7
|
+
coinInfo: CoinInfo;
|
|
8
|
+
};
|
|
9
|
+
export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Request[]> {
|
|
10
|
+
disposed: boolean;
|
|
11
|
+
hasBundle?: boolean;
|
|
12
|
+
discovery?: Discovery;
|
|
13
|
+
init(): void;
|
|
14
|
+
confirmation(): Promise<boolean>;
|
|
15
|
+
noBackupConfirmation(): Promise<boolean>;
|
|
16
|
+
checkFirmwareRange(isUsingPopup: boolean): Promise<"ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined>;
|
|
17
|
+
run(): Promise<AccountInfo | (AccountInfo | null)[] | {
|
|
18
|
+
utxo: AccountUtxo[] | undefined;
|
|
19
|
+
descriptor: string;
|
|
20
|
+
balance: string;
|
|
21
|
+
availableBalance: string;
|
|
22
|
+
empty: boolean;
|
|
23
|
+
tokens?: import("packages/blockchain-link/lib/types/common").TokenInfo[] | undefined;
|
|
24
|
+
addresses?: import("packages/blockchain-link/lib/types/common").AccountAddresses | undefined;
|
|
25
|
+
history: {
|
|
26
|
+
total: number;
|
|
27
|
+
tokens?: number | undefined;
|
|
28
|
+
unconfirmed: number;
|
|
29
|
+
transactions?: import("packages/blockchain-link/lib/types/common").Transaction[] | undefined;
|
|
30
|
+
txids?: string[] | undefined;
|
|
31
|
+
};
|
|
32
|
+
misc?: {
|
|
33
|
+
nonce?: string | undefined;
|
|
34
|
+
erc20Contract?: import("packages/blockchain-link/lib/types/common").TokenInfo | undefined;
|
|
35
|
+
sequence?: number | undefined;
|
|
36
|
+
reserve?: string | undefined;
|
|
37
|
+
rewards?: string | undefined;
|
|
38
|
+
staking?: {
|
|
39
|
+
address: string;
|
|
40
|
+
isActive: boolean;
|
|
41
|
+
rewards: string;
|
|
42
|
+
poolId: string | null;
|
|
43
|
+
} | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
page?: {
|
|
46
|
+
index: number;
|
|
47
|
+
size: number;
|
|
48
|
+
total: number;
|
|
49
|
+
} | undefined;
|
|
50
|
+
marker?: {
|
|
51
|
+
ledger: number;
|
|
52
|
+
seq: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
path: string;
|
|
55
|
+
}>;
|
|
56
|
+
discover(request: Request): Promise<{
|
|
57
|
+
utxo: AccountUtxo[] | undefined;
|
|
58
|
+
descriptor: string;
|
|
59
|
+
balance: string;
|
|
60
|
+
availableBalance: string;
|
|
61
|
+
empty: boolean;
|
|
62
|
+
tokens?: import("packages/blockchain-link/lib/types/common").TokenInfo[] | undefined;
|
|
63
|
+
addresses?: import("packages/blockchain-link/lib/types/common").AccountAddresses | undefined;
|
|
64
|
+
history: {
|
|
65
|
+
total: number;
|
|
66
|
+
tokens?: number | undefined;
|
|
67
|
+
unconfirmed: number;
|
|
68
|
+
transactions?: import("packages/blockchain-link/lib/types/common").Transaction[] | undefined;
|
|
69
|
+
txids?: string[] | undefined;
|
|
70
|
+
};
|
|
71
|
+
misc?: {
|
|
72
|
+
nonce?: string | undefined;
|
|
73
|
+
erc20Contract?: import("packages/blockchain-link/lib/types/common").TokenInfo | undefined;
|
|
74
|
+
sequence?: number | undefined;
|
|
75
|
+
reserve?: string | undefined;
|
|
76
|
+
rewards?: string | undefined;
|
|
77
|
+
staking?: {
|
|
78
|
+
address: string;
|
|
79
|
+
isActive: boolean;
|
|
80
|
+
rewards: string;
|
|
81
|
+
poolId: string | null;
|
|
82
|
+
} | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
page?: {
|
|
85
|
+
index: number;
|
|
86
|
+
size: number;
|
|
87
|
+
total: number;
|
|
88
|
+
} | undefined;
|
|
89
|
+
marker?: {
|
|
90
|
+
ledger: number;
|
|
91
|
+
seq: number;
|
|
92
|
+
} | undefined;
|
|
93
|
+
path: string;
|
|
94
|
+
}>;
|
|
95
|
+
dispose(): void;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=getAccountInfo.d.ts.map
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const Discovery_1 = require("./common/Discovery");
|
|
5
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
6
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
7
|
+
const accountUtils_1 = require("../utils/accountUtils");
|
|
8
|
+
const promiseUtils_1 = require("../utils/promiseUtils");
|
|
9
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
10
|
+
const constants_1 = require("../constants");
|
|
11
|
+
const events_1 = require("../events");
|
|
12
|
+
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
13
|
+
class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.disposed = false;
|
|
17
|
+
}
|
|
18
|
+
init() {
|
|
19
|
+
this.requiredPermissions = ['read'];
|
|
20
|
+
this.info = 'Export account info';
|
|
21
|
+
this.useDevice = true;
|
|
22
|
+
this.useUi = true;
|
|
23
|
+
let willUseDevice = false;
|
|
24
|
+
this.hasBundle = !!this.payload.bundle;
|
|
25
|
+
const payload = !this.payload.bundle
|
|
26
|
+
? { ...this.payload, bundle: [this.payload] }
|
|
27
|
+
: this.payload;
|
|
28
|
+
(0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
|
|
29
|
+
this.params = payload.bundle.map(batch => {
|
|
30
|
+
(0, paramsValidator_1.validateParams)(batch, [
|
|
31
|
+
{ name: 'coin', type: 'string', required: true },
|
|
32
|
+
{ name: 'descriptor', type: 'string' },
|
|
33
|
+
{ name: 'path', type: 'string' },
|
|
34
|
+
{ name: 'details', type: 'string' },
|
|
35
|
+
{ name: 'tokens', type: 'string' },
|
|
36
|
+
{ name: 'page', type: 'number' },
|
|
37
|
+
{ name: 'pageSize', type: 'number' },
|
|
38
|
+
{ name: 'from', type: 'number' },
|
|
39
|
+
{ name: 'to', type: 'number' },
|
|
40
|
+
{ name: 'contractFilter', type: 'string' },
|
|
41
|
+
{ name: 'gap', type: 'number' },
|
|
42
|
+
{ name: 'marker', type: 'object' },
|
|
43
|
+
{ name: 'defaultAccountType', type: 'string' },
|
|
44
|
+
{ name: 'derivationType', type: 'number' },
|
|
45
|
+
]);
|
|
46
|
+
const coinInfo = (0, coinInfo_1.getCoinInfo)(batch.coin);
|
|
47
|
+
if (!coinInfo) {
|
|
48
|
+
throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
|
|
49
|
+
}
|
|
50
|
+
(0, BlockchainLink_1.isBackendSupported)(coinInfo);
|
|
51
|
+
let address_n = [];
|
|
52
|
+
if (batch.path) {
|
|
53
|
+
address_n = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
54
|
+
willUseDevice = typeof batch.descriptor !== 'string';
|
|
55
|
+
}
|
|
56
|
+
if (!batch.path && !batch.descriptor) {
|
|
57
|
+
if (payload.bundle.length > 1) {
|
|
58
|
+
throw Error('Discovery for multiple coins in not supported');
|
|
59
|
+
}
|
|
60
|
+
willUseDevice = true;
|
|
61
|
+
}
|
|
62
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
63
|
+
return {
|
|
64
|
+
...batch,
|
|
65
|
+
address_n,
|
|
66
|
+
coinInfo,
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
this.useDevice = willUseDevice;
|
|
70
|
+
this.useUi = willUseDevice;
|
|
71
|
+
}
|
|
72
|
+
async confirmation() {
|
|
73
|
+
await this.getPopupPromise().promise;
|
|
74
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
75
|
+
if (this.params.length === 1 && !this.params[0].path && !this.params[0].descriptor) {
|
|
76
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
77
|
+
view: 'export-account-info',
|
|
78
|
+
label: `Export info for ${this.params[0].coinInfo.label} account of your selection`,
|
|
79
|
+
customConfirmButton: {
|
|
80
|
+
label: 'Proceed to account selection',
|
|
81
|
+
className: 'not-empty-css',
|
|
82
|
+
},
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
const keys = {};
|
|
87
|
+
this.params.forEach(b => {
|
|
88
|
+
if (!keys[b.coinInfo.label]) {
|
|
89
|
+
keys[b.coinInfo.label] = {
|
|
90
|
+
coinInfo: b.coinInfo,
|
|
91
|
+
values: [],
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
keys[b.coinInfo.label].values.push(b.descriptor || b.address_n);
|
|
95
|
+
});
|
|
96
|
+
const str = [];
|
|
97
|
+
Object.keys(keys).forEach((k, _i, _a) => {
|
|
98
|
+
const details = keys[k];
|
|
99
|
+
details.values.forEach(acc => {
|
|
100
|
+
str.push('<span>');
|
|
101
|
+
str.push(k);
|
|
102
|
+
str.push(' ');
|
|
103
|
+
if (typeof acc === 'string') {
|
|
104
|
+
str.push(acc);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
str.push((0, accountUtils_1.getAccountLabel)(acc, details.coinInfo));
|
|
108
|
+
}
|
|
109
|
+
str.push('</span>');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
113
|
+
view: 'export-account-info',
|
|
114
|
+
label: `Export info for: ${str.join('')}`,
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
const uiResp = await uiPromise.promise;
|
|
118
|
+
return uiResp.payload;
|
|
119
|
+
}
|
|
120
|
+
async noBackupConfirmation() {
|
|
121
|
+
await this.getPopupPromise().promise;
|
|
122
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
123
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
124
|
+
view: 'no-backup',
|
|
125
|
+
}));
|
|
126
|
+
const uiResp = await uiPromise.promise;
|
|
127
|
+
return uiResp.payload;
|
|
128
|
+
}
|
|
129
|
+
async checkFirmwareRange(isUsingPopup) {
|
|
130
|
+
if (isUsingPopup || this.params.length === 1) {
|
|
131
|
+
return super.checkFirmwareRange(isUsingPopup);
|
|
132
|
+
}
|
|
133
|
+
const defaultRange = {
|
|
134
|
+
1: { min: '1.0.0', max: '0' },
|
|
135
|
+
2: { min: '2.0.0', max: '0' },
|
|
136
|
+
};
|
|
137
|
+
const invalid = [];
|
|
138
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
139
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, this.params[i].coinInfo, defaultRange);
|
|
140
|
+
const exception = await super.checkFirmwareRange(false);
|
|
141
|
+
if (exception) {
|
|
142
|
+
invalid.push({
|
|
143
|
+
index: i,
|
|
144
|
+
exception,
|
|
145
|
+
coin: this.params[i].coin,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (invalid.length > 0) {
|
|
150
|
+
throw constants_1.ERRORS.TypedError('Method_Discovery_BundleException', JSON.stringify(invalid));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async run() {
|
|
154
|
+
if (this.params.length === 1 && !this.params[0].path && !this.params[0].descriptor) {
|
|
155
|
+
return this.discover(this.params[0]);
|
|
156
|
+
}
|
|
157
|
+
const responses = [];
|
|
158
|
+
const sendProgress = (progress, response, error) => {
|
|
159
|
+
if (!this.hasBundle || (this.device && this.device.getCommands().disposed))
|
|
160
|
+
return;
|
|
161
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
162
|
+
progress,
|
|
163
|
+
response,
|
|
164
|
+
error,
|
|
165
|
+
}));
|
|
166
|
+
};
|
|
167
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
168
|
+
const request = this.params[i];
|
|
169
|
+
const { address_n } = request;
|
|
170
|
+
let { descriptor } = request;
|
|
171
|
+
let legacyXpub;
|
|
172
|
+
if (this.disposed)
|
|
173
|
+
break;
|
|
174
|
+
if (address_n && typeof descriptor !== 'string') {
|
|
175
|
+
try {
|
|
176
|
+
const accountDescriptor = await this.device
|
|
177
|
+
.getCommands()
|
|
178
|
+
.getAccountDescriptor(request.coinInfo, address_n, typeof request.derivationType !== 'undefined'
|
|
179
|
+
? request.derivationType
|
|
180
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR);
|
|
181
|
+
if (accountDescriptor) {
|
|
182
|
+
descriptor = accountDescriptor.descriptor;
|
|
183
|
+
legacyXpub = accountDescriptor.legacyXpub;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
if (this.hasBundle) {
|
|
188
|
+
responses.push(null);
|
|
189
|
+
sendProgress(i, null, error.message);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (this.disposed)
|
|
198
|
+
break;
|
|
199
|
+
try {
|
|
200
|
+
if (typeof descriptor !== 'string') {
|
|
201
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'GetAccountInfo: descriptor not found');
|
|
202
|
+
}
|
|
203
|
+
const blockchain = await (0, BlockchainLink_1.initBlockchain)(request.coinInfo, this.postMessage);
|
|
204
|
+
if (this.disposed)
|
|
205
|
+
break;
|
|
206
|
+
const info = await blockchain.getAccountInfo({
|
|
207
|
+
descriptor,
|
|
208
|
+
details: request.details,
|
|
209
|
+
tokens: request.tokens,
|
|
210
|
+
page: request.page,
|
|
211
|
+
pageSize: request.pageSize,
|
|
212
|
+
from: request.from,
|
|
213
|
+
to: request.to,
|
|
214
|
+
contractFilter: request.contractFilter,
|
|
215
|
+
gap: request.gap,
|
|
216
|
+
marker: request.marker,
|
|
217
|
+
});
|
|
218
|
+
if (this.disposed)
|
|
219
|
+
break;
|
|
220
|
+
let utxo;
|
|
221
|
+
if ((0, accountUtils_1.isUtxoBased)(request.coinInfo) &&
|
|
222
|
+
typeof request.details === 'string' &&
|
|
223
|
+
request.details !== 'basic') {
|
|
224
|
+
utxo = await blockchain.getAccountUtxo(descriptor);
|
|
225
|
+
}
|
|
226
|
+
if (this.disposed)
|
|
227
|
+
break;
|
|
228
|
+
const account = {
|
|
229
|
+
path: request.path,
|
|
230
|
+
...info,
|
|
231
|
+
descriptor,
|
|
232
|
+
legacyXpub,
|
|
233
|
+
utxo,
|
|
234
|
+
};
|
|
235
|
+
responses.push(account);
|
|
236
|
+
sendProgress(i, account);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
if (this.hasBundle) {
|
|
240
|
+
responses.push(null);
|
|
241
|
+
sendProgress(i, null, error.message);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (this.disposed)
|
|
250
|
+
return new Promise(() => []);
|
|
251
|
+
return this.hasBundle ? responses : responses[0];
|
|
252
|
+
}
|
|
253
|
+
async discover(request) {
|
|
254
|
+
const { coinInfo, defaultAccountType } = request;
|
|
255
|
+
const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
|
|
256
|
+
const dfd = this.createUiPromise(events_1.UI.RECEIVE_ACCOUNT);
|
|
257
|
+
const discovery = new Discovery_1.Discovery({
|
|
258
|
+
blockchain,
|
|
259
|
+
commands: this.device.getCommands(),
|
|
260
|
+
derivationType: typeof request.derivationType !== 'undefined'
|
|
261
|
+
? request.derivationType
|
|
262
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
263
|
+
});
|
|
264
|
+
discovery.on('progress', accounts => {
|
|
265
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.SELECT_ACCOUNT, {
|
|
266
|
+
type: 'progress',
|
|
267
|
+
coinInfo,
|
|
268
|
+
accounts,
|
|
269
|
+
}));
|
|
270
|
+
});
|
|
271
|
+
discovery.on('complete', () => {
|
|
272
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.SELECT_ACCOUNT, {
|
|
273
|
+
type: 'end',
|
|
274
|
+
coinInfo,
|
|
275
|
+
}));
|
|
276
|
+
});
|
|
277
|
+
discovery.start().catch(error => {
|
|
278
|
+
dfd.reject(error);
|
|
279
|
+
});
|
|
280
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.SELECT_ACCOUNT, {
|
|
281
|
+
type: 'start',
|
|
282
|
+
accountTypes: discovery.types.map(t => t.type),
|
|
283
|
+
defaultAccountType,
|
|
284
|
+
coinInfo,
|
|
285
|
+
}));
|
|
286
|
+
const uiResp = await dfd.promise;
|
|
287
|
+
discovery.stop();
|
|
288
|
+
const account = discovery.accounts[uiResp.payload];
|
|
289
|
+
if (!discovery.completed) {
|
|
290
|
+
await (0, promiseUtils_1.resolveAfter)(501);
|
|
291
|
+
}
|
|
292
|
+
const info = await blockchain.getAccountInfo({
|
|
293
|
+
descriptor: account.descriptor,
|
|
294
|
+
details: request.details,
|
|
295
|
+
tokens: request.tokens,
|
|
296
|
+
page: request.page,
|
|
297
|
+
pageSize: request.pageSize,
|
|
298
|
+
from: request.from,
|
|
299
|
+
to: request.to,
|
|
300
|
+
contractFilter: request.contractFilter,
|
|
301
|
+
gap: request.gap,
|
|
302
|
+
marker: request.marker,
|
|
303
|
+
});
|
|
304
|
+
let utxo;
|
|
305
|
+
if ((0, accountUtils_1.isUtxoBased)(coinInfo) &&
|
|
306
|
+
typeof request.details === 'string' &&
|
|
307
|
+
request.details !== 'basic') {
|
|
308
|
+
utxo = await blockchain.getAccountUtxo(account.descriptor);
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
path: (0, pathUtils_1.getSerializedPath)(account.address_n),
|
|
312
|
+
...info,
|
|
313
|
+
utxo,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
dispose() {
|
|
317
|
+
this.disposed = true;
|
|
318
|
+
const { discovery } = this;
|
|
319
|
+
if (discovery) {
|
|
320
|
+
discovery.removeAllListeners();
|
|
321
|
+
discovery.stop();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
exports.default = GetAccountInfo;
|
|
326
|
+
//# sourceMappingURL=getAccountInfo.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
import type { BitcoinNetworkInfo } from '../types';
|
|
4
|
+
declare type Params = PROTO.GetAddress & {
|
|
5
|
+
address?: string;
|
|
6
|
+
coinInfo: BitcoinNetworkInfo;
|
|
7
|
+
};
|
|
8
|
+
export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
|
|
9
|
+
hasBundle?: boolean;
|
|
10
|
+
progress: number;
|
|
11
|
+
confirmed?: boolean;
|
|
12
|
+
init(): void;
|
|
13
|
+
getButtonRequestData(code: string): {
|
|
14
|
+
type: "address";
|
|
15
|
+
serializedPath: string;
|
|
16
|
+
address: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
confirmation(): Promise<boolean>;
|
|
19
|
+
noBackupConfirmation(): Promise<boolean>;
|
|
20
|
+
_call({ address_n, show_display, multisig, script_type, coinInfo }: Params): Promise<{
|
|
21
|
+
path: number[];
|
|
22
|
+
serializedPath: string;
|
|
23
|
+
address: string;
|
|
24
|
+
}>;
|
|
25
|
+
run(): Promise<(import("../types").Address & PROTO.Address) | (import("../types").Address & PROTO.Address)[]>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=getAddress.d.ts.map
|