@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,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTx = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bs58check = (0, tslib_1.__importStar)(require("bs58check"));
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const paramsValidator_1 = require("../common/paramsValidator");
|
|
8
|
+
const PREFIX = {
|
|
9
|
+
B: new Uint8Array([1, 52]),
|
|
10
|
+
tz1: new Uint8Array([6, 161, 159]),
|
|
11
|
+
tz2: new Uint8Array([6, 161, 161]),
|
|
12
|
+
tz3: new Uint8Array([6, 161, 164]),
|
|
13
|
+
KT1: new Uint8Array([2, 90, 121]),
|
|
14
|
+
edpk: new Uint8Array([13, 15, 37, 217]),
|
|
15
|
+
sppk: new Uint8Array([3, 254, 226, 86]),
|
|
16
|
+
p2pk: new Uint8Array([3, 178, 139, 127]),
|
|
17
|
+
};
|
|
18
|
+
const bs58checkDecode = (prefix, enc) => bs58check.decode(enc).slice(prefix.length);
|
|
19
|
+
const concatArray = (first, second) => {
|
|
20
|
+
const result = new Uint8Array(first.length + second.length);
|
|
21
|
+
result.set(first);
|
|
22
|
+
result.set(second, first.length);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const publicKeyHash2buffer = (publicKeyHash) => {
|
|
26
|
+
switch (publicKeyHash.substring(0, 3)) {
|
|
27
|
+
case 'tz1':
|
|
28
|
+
return {
|
|
29
|
+
originated: 0,
|
|
30
|
+
hash: concatArray(new Uint8Array([0]), bs58checkDecode(PREFIX.tz1, publicKeyHash)),
|
|
31
|
+
};
|
|
32
|
+
case 'tz2':
|
|
33
|
+
return {
|
|
34
|
+
originated: 0,
|
|
35
|
+
hash: concatArray(new Uint8Array([1]), bs58checkDecode(PREFIX.tz2, publicKeyHash)),
|
|
36
|
+
};
|
|
37
|
+
case 'tz3':
|
|
38
|
+
return {
|
|
39
|
+
originated: 0,
|
|
40
|
+
hash: concatArray(new Uint8Array([2]), bs58checkDecode(PREFIX.tz3, publicKeyHash)),
|
|
41
|
+
};
|
|
42
|
+
case 'KT1':
|
|
43
|
+
return {
|
|
44
|
+
originated: 1,
|
|
45
|
+
hash: concatArray(bs58checkDecode(PREFIX.KT1, publicKeyHash), new Uint8Array([0])),
|
|
46
|
+
};
|
|
47
|
+
default:
|
|
48
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Wrong Tezos publicKeyHash address');
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const publicKey2buffer = (publicKey) => {
|
|
52
|
+
switch (publicKey.substring(0, 4)) {
|
|
53
|
+
case 'edpk':
|
|
54
|
+
return concatArray(new Uint8Array([0]), bs58checkDecode(PREFIX.edpk, publicKey));
|
|
55
|
+
case 'sppk':
|
|
56
|
+
return concatArray(new Uint8Array([1]), bs58checkDecode(PREFIX.sppk, publicKey));
|
|
57
|
+
case 'p2pk':
|
|
58
|
+
return concatArray(new Uint8Array([2]), bs58checkDecode(PREFIX.p2pk, publicKey));
|
|
59
|
+
default:
|
|
60
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Wrong Tezos publicKey');
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const createTx = (address_n, branch, operation) => {
|
|
64
|
+
let message = {
|
|
65
|
+
address_n,
|
|
66
|
+
branch: bs58checkDecode(PREFIX.B, branch),
|
|
67
|
+
};
|
|
68
|
+
if (operation.reveal) {
|
|
69
|
+
const { reveal } = operation;
|
|
70
|
+
(0, paramsValidator_1.validateParams)(reveal, [
|
|
71
|
+
{ name: 'source', type: 'string', required: true },
|
|
72
|
+
{ name: 'public_key', type: 'string', required: true },
|
|
73
|
+
{ name: 'fee', type: 'uint', required: true },
|
|
74
|
+
{ name: 'counter', type: 'number', required: true },
|
|
75
|
+
{ name: 'gas_limit', type: 'number', required: true },
|
|
76
|
+
{ name: 'storage_limit', type: 'number', required: true },
|
|
77
|
+
]);
|
|
78
|
+
message = {
|
|
79
|
+
...message,
|
|
80
|
+
reveal: {
|
|
81
|
+
source: publicKeyHash2buffer(reveal.source).hash,
|
|
82
|
+
public_key: publicKey2buffer(reveal.public_key),
|
|
83
|
+
fee: reveal.fee,
|
|
84
|
+
counter: reveal.counter,
|
|
85
|
+
gas_limit: reveal.gas_limit,
|
|
86
|
+
storage_limit: reveal.storage_limit,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (operation.transaction) {
|
|
91
|
+
const { transaction } = operation;
|
|
92
|
+
(0, paramsValidator_1.validateParams)(transaction, [
|
|
93
|
+
{ name: 'source', type: 'string', required: true },
|
|
94
|
+
{ name: 'destination', type: 'string', required: true },
|
|
95
|
+
{ name: 'amount', type: 'uint', required: true },
|
|
96
|
+
{ name: 'counter', type: 'number', required: true },
|
|
97
|
+
{ name: 'fee', type: 'uint', required: true },
|
|
98
|
+
{ name: 'gas_limit', type: 'number', required: true },
|
|
99
|
+
{ name: 'storage_limit', type: 'number', required: true },
|
|
100
|
+
]);
|
|
101
|
+
message = {
|
|
102
|
+
...message,
|
|
103
|
+
transaction: {
|
|
104
|
+
source: publicKeyHash2buffer(transaction.source).hash,
|
|
105
|
+
destination: {
|
|
106
|
+
tag: publicKeyHash2buffer(transaction.destination).originated,
|
|
107
|
+
hash: publicKeyHash2buffer(transaction.destination).hash,
|
|
108
|
+
},
|
|
109
|
+
amount: transaction.amount,
|
|
110
|
+
counter: transaction.counter,
|
|
111
|
+
fee: transaction.fee,
|
|
112
|
+
gas_limit: transaction.gas_limit,
|
|
113
|
+
storage_limit: transaction.storage_limit,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
if (Object.prototype.hasOwnProperty.call(transaction, 'parameters')) {
|
|
117
|
+
message = {
|
|
118
|
+
...message,
|
|
119
|
+
transaction: {
|
|
120
|
+
...message.transaction,
|
|
121
|
+
parameters: transaction.parameters,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (transaction.parameters_manager) {
|
|
126
|
+
const { parameters_manager } = transaction;
|
|
127
|
+
(0, paramsValidator_1.validateParams)(parameters_manager, [
|
|
128
|
+
{ name: 'set_delegate', type: 'string', required: false },
|
|
129
|
+
{ name: 'cancel_delegate', type: 'boolean', required: false },
|
|
130
|
+
{ name: 'transfer', type: 'object', required: false },
|
|
131
|
+
]);
|
|
132
|
+
if (parameters_manager.set_delegate) {
|
|
133
|
+
message = {
|
|
134
|
+
...message,
|
|
135
|
+
transaction: {
|
|
136
|
+
...message.transaction,
|
|
137
|
+
parameters_manager: {
|
|
138
|
+
set_delegate: publicKeyHash2buffer(parameters_manager.set_delegate)
|
|
139
|
+
.hash,
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
if (Object.prototype.hasOwnProperty.call(parameters_manager, 'cancel_delegate')) {
|
|
145
|
+
message = {
|
|
146
|
+
...message,
|
|
147
|
+
transaction: {
|
|
148
|
+
...message.transaction,
|
|
149
|
+
parameters_manager: {
|
|
150
|
+
cancel_delegate: true,
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
if (parameters_manager.transfer) {
|
|
156
|
+
const { transfer } = parameters_manager;
|
|
157
|
+
(0, paramsValidator_1.validateParams)(transfer, [
|
|
158
|
+
{ name: 'amount', type: 'uint', required: true },
|
|
159
|
+
{ name: 'destination', type: 'string', required: true },
|
|
160
|
+
]);
|
|
161
|
+
message = {
|
|
162
|
+
...message,
|
|
163
|
+
transaction: {
|
|
164
|
+
...message.transaction,
|
|
165
|
+
parameters_manager: {
|
|
166
|
+
transfer: {
|
|
167
|
+
destination: {
|
|
168
|
+
tag: publicKeyHash2buffer(transfer.destination).originated,
|
|
169
|
+
hash: publicKeyHash2buffer(transfer.destination).hash,
|
|
170
|
+
},
|
|
171
|
+
amount: transfer.amount,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (operation.origination) {
|
|
180
|
+
const { origination } = operation;
|
|
181
|
+
(0, paramsValidator_1.validateParams)(origination, [
|
|
182
|
+
{ name: 'source', type: 'string', required: true },
|
|
183
|
+
{ name: 'balance', type: 'number', required: true },
|
|
184
|
+
{ name: 'fee', type: 'uint', required: true },
|
|
185
|
+
{ name: 'counter', type: 'number', required: true },
|
|
186
|
+
{ name: 'gas_limit', type: 'number', required: true },
|
|
187
|
+
{ name: 'storage_limit', type: 'number', required: true },
|
|
188
|
+
{ name: 'script', type: 'string', required: true },
|
|
189
|
+
]);
|
|
190
|
+
message = {
|
|
191
|
+
...message,
|
|
192
|
+
origination: {
|
|
193
|
+
source: publicKeyHash2buffer(origination.source).hash,
|
|
194
|
+
balance: origination.balance,
|
|
195
|
+
fee: origination.fee,
|
|
196
|
+
counter: origination.counter,
|
|
197
|
+
gas_limit: origination.gas_limit,
|
|
198
|
+
storage_limit: origination.storage_limit,
|
|
199
|
+
script: origination.script,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
if (origination.delegate) {
|
|
203
|
+
message = {
|
|
204
|
+
...message,
|
|
205
|
+
origination: {
|
|
206
|
+
...message.origination,
|
|
207
|
+
delegate: publicKeyHash2buffer(origination.delegate).hash,
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (operation.delegation) {
|
|
213
|
+
const { delegation } = operation;
|
|
214
|
+
(0, paramsValidator_1.validateParams)(delegation, [
|
|
215
|
+
{ name: 'source', type: 'string', required: true },
|
|
216
|
+
{ name: 'delegate', type: 'string', required: true },
|
|
217
|
+
{ name: 'fee', type: 'uint', required: true },
|
|
218
|
+
{ name: 'counter', type: 'number', required: true },
|
|
219
|
+
{ name: 'gas_limit', type: 'number', required: true },
|
|
220
|
+
{ name: 'storage_limit', type: 'number', required: true },
|
|
221
|
+
]);
|
|
222
|
+
message = {
|
|
223
|
+
...message,
|
|
224
|
+
delegation: {
|
|
225
|
+
source: publicKeyHash2buffer(delegation.source).hash,
|
|
226
|
+
delegate: publicKeyHash2buffer(delegation.delegate).hash,
|
|
227
|
+
fee: delegation.fee,
|
|
228
|
+
counter: delegation.counter,
|
|
229
|
+
gas_limit: delegation.gas_limit,
|
|
230
|
+
storage_limit: delegation.storage_limit,
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return message;
|
|
235
|
+
};
|
|
236
|
+
exports.createTx = createTx;
|
|
237
|
+
//# sourceMappingURL=tezosSignTx.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
declare type Params = PROTO.TezosGetAddress & {
|
|
4
|
+
address?: string;
|
|
5
|
+
};
|
|
6
|
+
export default class TezosGetAddress extends AbstractMethod<'tezosGetAddress', Params[]> {
|
|
7
|
+
hasBundle?: boolean;
|
|
8
|
+
progress: number;
|
|
9
|
+
confirmed?: boolean;
|
|
10
|
+
init(): void;
|
|
11
|
+
getButtonRequestData(code: string): {
|
|
12
|
+
type: "address";
|
|
13
|
+
serializedPath: string;
|
|
14
|
+
address: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
confirmation(): Promise<boolean>;
|
|
17
|
+
noBackupConfirmation(): Promise<boolean>;
|
|
18
|
+
_call({ address_n, show_display }: Params): Promise<PROTO.TezosAddress>;
|
|
19
|
+
run(): Promise<import("..").Address | import("..").Address[]>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=tezosGetAddress.d.ts.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
5
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
6
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const events_1 = require("../events");
|
|
9
|
+
class TezosGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.progress = 0;
|
|
13
|
+
}
|
|
14
|
+
init() {
|
|
15
|
+
this.requiredPermissions = ['read'];
|
|
16
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Tezos'), this.firmwareRange);
|
|
17
|
+
this.hasBundle = !!this.payload.bundle;
|
|
18
|
+
const payload = !this.payload.bundle
|
|
19
|
+
? { ...this.payload, bundle: [this.payload] }
|
|
20
|
+
: this.payload;
|
|
21
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
22
|
+
{ name: 'bundle', type: 'array' },
|
|
23
|
+
{ name: 'useEventListener', type: 'boolean' },
|
|
24
|
+
]);
|
|
25
|
+
this.params = payload.bundle.map(batch => {
|
|
26
|
+
(0, paramsValidator_1.validateParams)(batch, [
|
|
27
|
+
{ name: 'path', required: true },
|
|
28
|
+
{ name: 'address', type: 'string' },
|
|
29
|
+
{ name: 'showOnTrezor', type: 'boolean' },
|
|
30
|
+
]);
|
|
31
|
+
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
32
|
+
return {
|
|
33
|
+
address_n: path,
|
|
34
|
+
address: batch.address,
|
|
35
|
+
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const useEventListener = payload.useEventListener &&
|
|
39
|
+
this.params.length === 1 &&
|
|
40
|
+
typeof this.params[0].address === 'string' &&
|
|
41
|
+
this.params[0].show_display;
|
|
42
|
+
this.confirmed = useEventListener;
|
|
43
|
+
this.useUi = !useEventListener;
|
|
44
|
+
if (this.params.length === 1) {
|
|
45
|
+
this.info = `Export Tezos address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.info = 'Export multiple Tezos addresses';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
getButtonRequestData(code) {
|
|
52
|
+
if (code === 'ButtonRequest_Address') {
|
|
53
|
+
return {
|
|
54
|
+
type: 'address',
|
|
55
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(this.params[this.progress].address_n),
|
|
56
|
+
address: this.params[this.progress].address || 'not-set',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async confirmation() {
|
|
61
|
+
if (this.confirmed)
|
|
62
|
+
return true;
|
|
63
|
+
await this.getPopupPromise().promise;
|
|
64
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
65
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
66
|
+
view: 'export-address',
|
|
67
|
+
label: this.info,
|
|
68
|
+
}));
|
|
69
|
+
const uiResp = await uiPromise.promise;
|
|
70
|
+
this.confirmed = uiResp.payload;
|
|
71
|
+
return this.confirmed;
|
|
72
|
+
}
|
|
73
|
+
async noBackupConfirmation() {
|
|
74
|
+
await this.getPopupPromise().promise;
|
|
75
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
76
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
77
|
+
view: 'no-backup',
|
|
78
|
+
}));
|
|
79
|
+
const uiResp = await uiPromise.promise;
|
|
80
|
+
return uiResp.payload;
|
|
81
|
+
}
|
|
82
|
+
async _call({ address_n, show_display }) {
|
|
83
|
+
const cmd = this.device.getCommands();
|
|
84
|
+
const response = await cmd.typedCall('TezosGetAddress', 'TezosAddress', {
|
|
85
|
+
address_n,
|
|
86
|
+
show_display,
|
|
87
|
+
});
|
|
88
|
+
return response.message;
|
|
89
|
+
}
|
|
90
|
+
async run() {
|
|
91
|
+
const responses = [];
|
|
92
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
93
|
+
const batch = this.params[i];
|
|
94
|
+
if (batch.show_display) {
|
|
95
|
+
const silent = await this._call({
|
|
96
|
+
...batch,
|
|
97
|
+
show_display: false,
|
|
98
|
+
});
|
|
99
|
+
if (typeof batch.address === 'string') {
|
|
100
|
+
if (batch.address !== silent.address) {
|
|
101
|
+
throw constants_1.ERRORS.TypedError('Method_AddressNotMatch');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
batch.address = silent.address;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const response = await this._call(batch);
|
|
109
|
+
responses.push({
|
|
110
|
+
path: batch.address_n,
|
|
111
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
112
|
+
address: response.address,
|
|
113
|
+
});
|
|
114
|
+
if (this.hasBundle) {
|
|
115
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
116
|
+
progress: i,
|
|
117
|
+
response,
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
this.progress++;
|
|
121
|
+
}
|
|
122
|
+
return this.hasBundle ? responses : responses[0];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.default = TezosGetAddress;
|
|
126
|
+
//# sourceMappingURL=tezosGetAddress.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../constants';
|
|
3
|
+
export default class TezosGetPublicKey extends AbstractMethod<'tezosGetPublicKey', PROTO.TezosGetPublicKey[]> {
|
|
4
|
+
hasBundle?: boolean;
|
|
5
|
+
confirmed?: boolean;
|
|
6
|
+
init(): void;
|
|
7
|
+
confirmation(): Promise<boolean>;
|
|
8
|
+
run(): Promise<import("..").PublicKey | import("..").PublicKey[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=tezosGetPublicKey.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
5
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
6
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
7
|
+
const events_1 = require("../events");
|
|
8
|
+
class TezosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
9
|
+
init() {
|
|
10
|
+
this.requiredPermissions = ['read'];
|
|
11
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Tezos'), this.firmwareRange);
|
|
12
|
+
this.info = 'Export Tezos public key';
|
|
13
|
+
this.hasBundle = !!this.payload.bundle;
|
|
14
|
+
const payload = !this.payload.bundle
|
|
15
|
+
? { ...this.payload, bundle: [this.payload] }
|
|
16
|
+
: this.payload;
|
|
17
|
+
(0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
|
|
18
|
+
this.params = payload.bundle.map(batch => {
|
|
19
|
+
(0, paramsValidator_1.validateParams)(batch, [
|
|
20
|
+
{ name: 'path', required: true },
|
|
21
|
+
{ name: 'showOnTrezor', type: 'boolean' },
|
|
22
|
+
]);
|
|
23
|
+
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
24
|
+
return {
|
|
25
|
+
address_n: path,
|
|
26
|
+
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async confirmation() {
|
|
31
|
+
if (this.confirmed)
|
|
32
|
+
return true;
|
|
33
|
+
await this.getPopupPromise().promise;
|
|
34
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
35
|
+
let label;
|
|
36
|
+
if (this.params.length > 1) {
|
|
37
|
+
label = 'Export multiple Tezos public keys';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
label = `Export Tezos public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
|
|
41
|
+
}
|
|
42
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
43
|
+
view: 'export-address',
|
|
44
|
+
label,
|
|
45
|
+
}));
|
|
46
|
+
const uiResp = await uiPromise.promise;
|
|
47
|
+
this.confirmed = uiResp.payload;
|
|
48
|
+
return this.confirmed;
|
|
49
|
+
}
|
|
50
|
+
async run() {
|
|
51
|
+
const responses = [];
|
|
52
|
+
const cmd = this.device.getCommands();
|
|
53
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
54
|
+
const batch = this.params[i];
|
|
55
|
+
const { message } = await cmd.typedCall('TezosGetPublicKey', 'TezosPublicKey', batch);
|
|
56
|
+
responses.push({
|
|
57
|
+
path: batch.address_n,
|
|
58
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
59
|
+
publicKey: message.public_key,
|
|
60
|
+
});
|
|
61
|
+
if (this.hasBundle) {
|
|
62
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
63
|
+
progress: i,
|
|
64
|
+
response: message,
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return this.hasBundle ? responses : responses[0];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.default = TezosGetPublicKey;
|
|
72
|
+
//# sourceMappingURL=tezosGetPublicKey.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../constants';
|
|
3
|
+
export default class TezosSignTransaction extends AbstractMethod<'tezosSignTransaction', PROTO.TezosSignTx> {
|
|
4
|
+
init(): void;
|
|
5
|
+
run(): Promise<PROTO.TezosSignedTx>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=tezosSignTransaction.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
5
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
6
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
7
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
8
|
+
const helper = (0, tslib_1.__importStar)(require("./tezos/tezosSignTx"));
|
|
9
|
+
class TezosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
10
|
+
init() {
|
|
11
|
+
this.requiredPermissions = ['read', 'write'];
|
|
12
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Tezos'), this.firmwareRange);
|
|
13
|
+
this.info = 'Sign Tezos transaction';
|
|
14
|
+
const { payload } = this;
|
|
15
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
16
|
+
{ name: 'path', required: true },
|
|
17
|
+
{ name: 'branch', type: 'string', required: true },
|
|
18
|
+
{ name: 'operation', required: true },
|
|
19
|
+
]);
|
|
20
|
+
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
21
|
+
this.params = helper.createTx(path, payload.branch, payload.operation);
|
|
22
|
+
}
|
|
23
|
+
async run() {
|
|
24
|
+
const cmd = this.device.getCommands();
|
|
25
|
+
const response = await cmd.typedCall('TezosSignTx', 'TezosSignedTx', this.params);
|
|
26
|
+
return response.message;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = TezosSignTransaction;
|
|
30
|
+
//# sourceMappingURL=tezosSignTransaction.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
export default class VerifyMessage extends AbstractMethod<'verifyMessage', PROTO.VerifyMessage> {
|
|
4
|
+
init(): void;
|
|
5
|
+
run(): Promise<PROTO.Success>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=verifyMessage.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
5
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
6
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
7
|
+
const formatUtils_1 = require("../utils/formatUtils");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
class VerifyMessage extends AbstractMethod_1.AbstractMethod {
|
|
10
|
+
init() {
|
|
11
|
+
this.requiredPermissions = ['read', 'write'];
|
|
12
|
+
this.info = 'Verify message';
|
|
13
|
+
const { payload } = this;
|
|
14
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
15
|
+
{ name: 'address', type: 'string', required: true },
|
|
16
|
+
{ name: 'signature', type: 'string', required: true },
|
|
17
|
+
{ name: 'message', type: 'string', required: true },
|
|
18
|
+
{ name: 'coin', type: 'string', required: true },
|
|
19
|
+
{ name: 'hex', type: 'boolean' },
|
|
20
|
+
]);
|
|
21
|
+
const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(payload.coin);
|
|
22
|
+
if (!coinInfo) {
|
|
23
|
+
throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, this.firmwareRange);
|
|
27
|
+
this.info = (0, pathUtils_1.getLabel)('Verify #NETWORK message', coinInfo);
|
|
28
|
+
}
|
|
29
|
+
const messageHex = payload.hex
|
|
30
|
+
? (0, formatUtils_1.messageToHex)(payload.message)
|
|
31
|
+
: Buffer.from(payload.message, 'utf8').toString('hex');
|
|
32
|
+
const signatureHex = Buffer.from(payload.signature, 'base64').toString('hex');
|
|
33
|
+
this.params = {
|
|
34
|
+
address: payload.address,
|
|
35
|
+
signature: signatureHex,
|
|
36
|
+
message: messageHex,
|
|
37
|
+
coin_name: coinInfo.name,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async run() {
|
|
41
|
+
const cmd = this.device.getCommands();
|
|
42
|
+
const response = await cmd.typedCall('VerifyMessage', 'Success', this.params);
|
|
43
|
+
return response.message;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.default = VerifyMessage;
|
|
47
|
+
//# sourceMappingURL=verifyMessage.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
export default class WipeDevice extends AbstractMethod<'wipeDevice'> {
|
|
3
|
+
confirmed?: boolean;
|
|
4
|
+
init(): void;
|
|
5
|
+
confirmation(): Promise<boolean>;
|
|
6
|
+
run(): Promise<import("packages/transport/lib/types/messages").Success>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=wipeDevice.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const events_1 = require("../events");
|
|
5
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
6
|
+
class WipeDevice extends AbstractMethod_1.AbstractMethod {
|
|
7
|
+
init() {
|
|
8
|
+
this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS, events_1.UI.BOOTLOADER];
|
|
9
|
+
this.useDeviceState = false;
|
|
10
|
+
this.requiredPermissions = ['management'];
|
|
11
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
|
|
12
|
+
this.info = 'Wipe device';
|
|
13
|
+
}
|
|
14
|
+
async confirmation() {
|
|
15
|
+
if (this.confirmed)
|
|
16
|
+
return true;
|
|
17
|
+
await this.getPopupPromise().promise;
|
|
18
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
19
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
20
|
+
view: 'device-management',
|
|
21
|
+
customConfirmButton: {
|
|
22
|
+
className: 'wipe',
|
|
23
|
+
label: `Wipe ${this.device.toMessageObject().label}`,
|
|
24
|
+
},
|
|
25
|
+
label: 'Are you sure you want to wipe your device?',
|
|
26
|
+
}));
|
|
27
|
+
const uiResp = await uiPromise.promise;
|
|
28
|
+
this.confirmed = uiResp.payload;
|
|
29
|
+
return this.confirmed;
|
|
30
|
+
}
|
|
31
|
+
async run() {
|
|
32
|
+
const cmd = this.device.getCommands();
|
|
33
|
+
if (this.device.isBootloader()) {
|
|
34
|
+
this.device.emit(events_1.DEVICE.BUTTON, this.device, { code: 'ButtonRequest_WipeDevice' });
|
|
35
|
+
}
|
|
36
|
+
const response = await cmd.typedCall('WipeDevice', 'Success');
|
|
37
|
+
return response.message;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = WipeDevice;
|
|
41
|
+
//# sourceMappingURL=wipeDevice.js.map
|