@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,158 @@
|
|
|
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 cardanoAddressParameters_1 = require("./cardano/cardanoAddressParameters");
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const events_1 = require("../events");
|
|
10
|
+
class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.progress = 0;
|
|
14
|
+
}
|
|
15
|
+
init() {
|
|
16
|
+
this.requiredPermissions = ['read'];
|
|
17
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
|
|
18
|
+
this.hasBundle = !!this.payload.bundle;
|
|
19
|
+
const payload = !this.payload.bundle
|
|
20
|
+
? { ...this.payload, bundle: [this.payload] }
|
|
21
|
+
: this.payload;
|
|
22
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
23
|
+
{ name: 'bundle', type: 'array' },
|
|
24
|
+
{ name: 'useEventListener', type: 'boolean' },
|
|
25
|
+
]);
|
|
26
|
+
this.params = payload.bundle.map(batch => {
|
|
27
|
+
(0, paramsValidator_1.validateParams)(batch, [
|
|
28
|
+
{ name: 'addressParameters', type: 'object', required: true },
|
|
29
|
+
{ name: 'networkId', type: 'number', required: true },
|
|
30
|
+
{ name: 'protocolMagic', type: 'number', required: true },
|
|
31
|
+
{ name: 'derivationType', type: 'number' },
|
|
32
|
+
{ name: 'address', type: 'string' },
|
|
33
|
+
{ name: 'showOnTrezor', type: 'boolean' },
|
|
34
|
+
]);
|
|
35
|
+
(0, cardanoAddressParameters_1.validateAddressParameters)(batch.addressParameters);
|
|
36
|
+
return {
|
|
37
|
+
address_parameters: (0, cardanoAddressParameters_1.addressParametersToProto)(batch.addressParameters),
|
|
38
|
+
address: batch.address,
|
|
39
|
+
protocol_magic: batch.protocolMagic,
|
|
40
|
+
network_id: batch.networkId,
|
|
41
|
+
derivation_type: typeof batch.derivationType !== 'undefined'
|
|
42
|
+
? batch.derivationType
|
|
43
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
44
|
+
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const useEventListener = payload.useEventListener &&
|
|
48
|
+
this.params.length === 1 &&
|
|
49
|
+
typeof this.params[0].address === 'string' &&
|
|
50
|
+
this.params[0].show_display;
|
|
51
|
+
this.confirmed = useEventListener;
|
|
52
|
+
this.useUi = !useEventListener;
|
|
53
|
+
if (this.params.length === 1) {
|
|
54
|
+
this.info = `Export Cardano address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_parameters.address_n[2]) + 1}`;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.info = 'Export multiple Cardano addresses';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
getButtonRequestData(code) {
|
|
61
|
+
if (code === 'ButtonRequest_Address') {
|
|
62
|
+
return {
|
|
63
|
+
type: 'address',
|
|
64
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(this.params[this.progress].address_parameters.address_n),
|
|
65
|
+
address: this.params[this.progress].address || 'not-set',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async confirmation() {
|
|
70
|
+
if (this.confirmed)
|
|
71
|
+
return true;
|
|
72
|
+
await this.getPopupPromise().promise;
|
|
73
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
74
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
75
|
+
view: 'export-address',
|
|
76
|
+
label: this.info,
|
|
77
|
+
}));
|
|
78
|
+
const uiResp = await uiPromise.promise;
|
|
79
|
+
this.confirmed = uiResp.payload;
|
|
80
|
+
return this.confirmed;
|
|
81
|
+
}
|
|
82
|
+
async noBackupConfirmation() {
|
|
83
|
+
await this.getPopupPromise().promise;
|
|
84
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
85
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
86
|
+
view: 'no-backup',
|
|
87
|
+
}));
|
|
88
|
+
const uiResp = await uiPromise.promise;
|
|
89
|
+
return uiResp.payload;
|
|
90
|
+
}
|
|
91
|
+
async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, }) {
|
|
92
|
+
const cmd = this.device.getCommands();
|
|
93
|
+
const response = await cmd.typedCall('CardanoGetAddress', 'CardanoAddress', {
|
|
94
|
+
address_parameters,
|
|
95
|
+
protocol_magic,
|
|
96
|
+
network_id,
|
|
97
|
+
derivation_type,
|
|
98
|
+
show_display,
|
|
99
|
+
});
|
|
100
|
+
return response.message;
|
|
101
|
+
}
|
|
102
|
+
_ensureFirmwareSupportsBatch(batch) {
|
|
103
|
+
const SCRIPT_ADDRESSES_TYPES = [
|
|
104
|
+
constants_1.PROTO.CardanoAddressType.BASE_SCRIPT_KEY,
|
|
105
|
+
constants_1.PROTO.CardanoAddressType.BASE_KEY_SCRIPT,
|
|
106
|
+
constants_1.PROTO.CardanoAddressType.BASE_SCRIPT_SCRIPT,
|
|
107
|
+
constants_1.PROTO.CardanoAddressType.POINTER_SCRIPT,
|
|
108
|
+
constants_1.PROTO.CardanoAddressType.ENTERPRISE_SCRIPT,
|
|
109
|
+
constants_1.PROTO.CardanoAddressType.REWARD_SCRIPT,
|
|
110
|
+
];
|
|
111
|
+
if (SCRIPT_ADDRESSES_TYPES.includes(batch.address_parameters.address_type)) {
|
|
112
|
+
if (!this.device.atLeast(['0', '2.4.3'])) {
|
|
113
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Address type not supported by device firmware`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async run() {
|
|
118
|
+
const responses = [];
|
|
119
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
120
|
+
const batch = this.params[i];
|
|
121
|
+
this._ensureFirmwareSupportsBatch(batch);
|
|
122
|
+
batch.address_parameters = (0, cardanoAddressParameters_1.modifyAddressParametersForBackwardsCompatibility)(this.device, batch.address_parameters);
|
|
123
|
+
if (batch.show_display) {
|
|
124
|
+
const silent = await this._call({
|
|
125
|
+
...batch,
|
|
126
|
+
show_display: false,
|
|
127
|
+
});
|
|
128
|
+
if (typeof batch.address === 'string') {
|
|
129
|
+
if (batch.address !== silent.address) {
|
|
130
|
+
throw constants_1.ERRORS.TypedError('Method_AddressNotMatch');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
batch.address = silent.address;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const response = await this._call(batch);
|
|
138
|
+
responses.push({
|
|
139
|
+
addressParameters: (0, cardanoAddressParameters_1.addressParametersFromProto)(batch.address_parameters),
|
|
140
|
+
protocolMagic: batch.protocol_magic,
|
|
141
|
+
networkId: batch.network_id,
|
|
142
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_parameters.address_n),
|
|
143
|
+
serializedStakingPath: (0, pathUtils_1.getSerializedPath)(batch.address_parameters.address_n_staking),
|
|
144
|
+
address: response.address,
|
|
145
|
+
});
|
|
146
|
+
if (this.hasBundle) {
|
|
147
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
148
|
+
progress: i,
|
|
149
|
+
response,
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
this.progress++;
|
|
153
|
+
}
|
|
154
|
+
return this.hasBundle ? responses : responses[0];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
exports.default = CardanoGetAddress;
|
|
158
|
+
//# sourceMappingURL=cardanoGetAddress.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PROTO } from '../constants';
|
|
2
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
3
|
+
import type { CardanoNativeScript } from '../types/api/cardanoGetNativeScriptHash';
|
|
4
|
+
export default class CardanoGetNativeScriptHash extends AbstractMethod<'cardanoGetNativeScriptHash', PROTO.CardanoGetNativeScriptHash> {
|
|
5
|
+
init(): void;
|
|
6
|
+
validateScript(script: CardanoNativeScript): void;
|
|
7
|
+
scriptToProto(script: CardanoNativeScript): PROTO.CardanoNativeScript;
|
|
8
|
+
run(): Promise<{
|
|
9
|
+
scriptHash: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=cardanoGetNativeScriptHash.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../constants");
|
|
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
|
+
class CardanoGetNativeScriptHash extends AbstractMethod_1.AbstractMethod {
|
|
9
|
+
init() {
|
|
10
|
+
this.requiredPermissions = ['read'];
|
|
11
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
|
|
12
|
+
this.info = 'Get Cardano native script hash';
|
|
13
|
+
const { payload } = this;
|
|
14
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
15
|
+
{ name: 'script', type: 'object', required: true },
|
|
16
|
+
{ name: 'displayFormat', type: 'number', required: true },
|
|
17
|
+
{ name: 'derivationType', type: 'number' },
|
|
18
|
+
]);
|
|
19
|
+
this.validateScript(payload.script);
|
|
20
|
+
this.params = {
|
|
21
|
+
script: this.scriptToProto(payload.script),
|
|
22
|
+
display_format: payload.displayFormat,
|
|
23
|
+
derivation_type: typeof payload.derivationType !== 'undefined'
|
|
24
|
+
? payload.derivationType
|
|
25
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
validateScript(script) {
|
|
29
|
+
(0, paramsValidator_1.validateParams)(script, [
|
|
30
|
+
{ name: 'type', type: 'number', required: true },
|
|
31
|
+
{ name: 'scripts', type: 'array', allowEmpty: true },
|
|
32
|
+
{ name: 'keyHash', type: 'string' },
|
|
33
|
+
{ name: 'requiredSignaturesCount', type: 'number' },
|
|
34
|
+
{ name: 'invalidBefore', type: 'uint' },
|
|
35
|
+
{ name: 'invalidHereafter', type: 'uint' },
|
|
36
|
+
]);
|
|
37
|
+
if (script.keyPath) {
|
|
38
|
+
(0, pathUtils_1.validatePath)(script.keyPath, 3);
|
|
39
|
+
}
|
|
40
|
+
if (script.scripts) {
|
|
41
|
+
script.scripts.forEach(nestedScript => {
|
|
42
|
+
this.validateScript(nestedScript);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
scriptToProto(script) {
|
|
47
|
+
let scripts = [];
|
|
48
|
+
if (script.scripts) {
|
|
49
|
+
scripts = script.scripts.map(nestedScript => this.scriptToProto(nestedScript));
|
|
50
|
+
}
|
|
51
|
+
let keyPath = [];
|
|
52
|
+
if (script.keyPath) {
|
|
53
|
+
keyPath = (0, pathUtils_1.validatePath)(script.keyPath, 3);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
type: script.type,
|
|
57
|
+
scripts,
|
|
58
|
+
key_hash: script.keyHash,
|
|
59
|
+
key_path: keyPath,
|
|
60
|
+
required_signatures_count: script.requiredSignaturesCount,
|
|
61
|
+
invalid_before: script.invalidBefore,
|
|
62
|
+
invalid_hereafter: script.invalidHereafter,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async run() {
|
|
66
|
+
const { message } = await this.device
|
|
67
|
+
.getCommands()
|
|
68
|
+
.typedCall('CardanoGetNativeScriptHash', 'CardanoNativeScriptHash', {
|
|
69
|
+
script: this.params.script,
|
|
70
|
+
display_format: this.params.display_format,
|
|
71
|
+
derivation_type: this.params.derivation_type,
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
scriptHash: message.script_hash,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = CardanoGetNativeScriptHash;
|
|
79
|
+
//# sourceMappingURL=cardanoGetNativeScriptHash.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PROTO } from '../constants';
|
|
2
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
3
|
+
export default class CardanoGetPublicKey extends AbstractMethod<'cardanoGetPublicKey', PROTO.CardanoGetPublicKey[]> {
|
|
4
|
+
hasBundle?: boolean;
|
|
5
|
+
confirmed?: boolean;
|
|
6
|
+
init(): void;
|
|
7
|
+
confirmation(): Promise<boolean>;
|
|
8
|
+
run(): Promise<import("../types/api/cardanoGetPublicKey").CardanoPublicKey | import("../types/api/cardanoGetPublicKey").CardanoPublicKey[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=cardanoGetPublicKey.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("../constants");
|
|
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 events_1 = require("../events");
|
|
9
|
+
class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
10
|
+
init() {
|
|
11
|
+
this.requiredPermissions = ['read'];
|
|
12
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
|
|
13
|
+
this.info = 'Export Cardano public key';
|
|
14
|
+
this.hasBundle = !!this.payload.bundle;
|
|
15
|
+
const payload = !this.payload.bundle
|
|
16
|
+
? { ...this.payload, bundle: [this.payload] }
|
|
17
|
+
: this.payload;
|
|
18
|
+
(0, paramsValidator_1.validateParams)(payload, [{ name: 'bundle', type: 'array' }]);
|
|
19
|
+
this.params = payload.bundle.map(batch => {
|
|
20
|
+
(0, paramsValidator_1.validateParams)(batch, [
|
|
21
|
+
{ name: 'path', required: true },
|
|
22
|
+
{ name: 'derivationType', type: 'number' },
|
|
23
|
+
{ name: 'showOnTrezor', type: 'boolean' },
|
|
24
|
+
]);
|
|
25
|
+
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
26
|
+
return {
|
|
27
|
+
address_n: path,
|
|
28
|
+
derivation_type: typeof batch.derivationType !== 'undefined'
|
|
29
|
+
? batch.derivationType
|
|
30
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
31
|
+
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : false,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async confirmation() {
|
|
36
|
+
if (this.confirmed)
|
|
37
|
+
return true;
|
|
38
|
+
await this.getPopupPromise().promise;
|
|
39
|
+
const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
|
|
40
|
+
let label;
|
|
41
|
+
if (this.params.length > 1) {
|
|
42
|
+
label = 'Export multiple Cardano public keys';
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
label = `Export Cardano public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
|
|
46
|
+
}
|
|
47
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
|
|
48
|
+
view: 'export-xpub',
|
|
49
|
+
label,
|
|
50
|
+
}));
|
|
51
|
+
const uiResp = await uiPromise.promise;
|
|
52
|
+
this.confirmed = uiResp.payload;
|
|
53
|
+
return this.confirmed;
|
|
54
|
+
}
|
|
55
|
+
async run() {
|
|
56
|
+
const responses = [];
|
|
57
|
+
const cmd = this.device.getCommands();
|
|
58
|
+
for (let i = 0; i < this.params.length; i++) {
|
|
59
|
+
const batch = this.params[i];
|
|
60
|
+
const { message } = await cmd.typedCall('CardanoGetPublicKey', 'CardanoPublicKey', batch);
|
|
61
|
+
responses.push({
|
|
62
|
+
path: batch.address_n,
|
|
63
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
64
|
+
publicKey: message.xpub,
|
|
65
|
+
node: message.node,
|
|
66
|
+
});
|
|
67
|
+
if (this.hasBundle) {
|
|
68
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
69
|
+
progress: i,
|
|
70
|
+
response: message,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return this.hasBundle ? responses : responses[0];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.default = CardanoGetPublicKey;
|
|
78
|
+
//# sourceMappingURL=cardanoGetPublicKey.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { CertificateWithPoolOwnersAndRelays } from './cardano/cardanoCertificate';
|
|
3
|
+
import type { Path, InputWithPath, CollateralInputWithPath } from './cardano/cardanoInputs';
|
|
4
|
+
import type { OutputWithTokens } from './cardano/cardanoOutputs';
|
|
5
|
+
import { PROTO } from '../constants';
|
|
6
|
+
import type { CardanoSignedTxData } from '../types/api/cardanoSignTransaction';
|
|
7
|
+
import type { AssetGroupWithTokens } from './cardano/cardanoTokenBundle';
|
|
8
|
+
declare const CardanoSignTransactionFeatures: Readonly<{
|
|
9
|
+
TransactionStreaming: string[];
|
|
10
|
+
TokenMinting: string[];
|
|
11
|
+
Multisig: string[];
|
|
12
|
+
NetworkIdInTxBody: string[];
|
|
13
|
+
OutputDatumHash: string[];
|
|
14
|
+
ScriptDataHash: string[];
|
|
15
|
+
Plutus: string[];
|
|
16
|
+
KeyHashStakeCredential: string[];
|
|
17
|
+
}>;
|
|
18
|
+
export declare type CardanoSignTransactionParams = {
|
|
19
|
+
signingMode: PROTO.CardanoTxSigningMode;
|
|
20
|
+
inputsWithPath: InputWithPath[];
|
|
21
|
+
outputsWithTokens: OutputWithTokens[];
|
|
22
|
+
fee: PROTO.UintType;
|
|
23
|
+
ttl?: PROTO.UintType;
|
|
24
|
+
certificatesWithPoolOwnersAndRelays: CertificateWithPoolOwnersAndRelays[];
|
|
25
|
+
withdrawals: PROTO.CardanoTxWithdrawal[];
|
|
26
|
+
mint: AssetGroupWithTokens[];
|
|
27
|
+
auxiliaryData?: PROTO.CardanoTxAuxiliaryData;
|
|
28
|
+
validityIntervalStart?: PROTO.UintType;
|
|
29
|
+
scriptDataHash?: string;
|
|
30
|
+
collateralInputsWithPath: CollateralInputWithPath[];
|
|
31
|
+
requiredSigners: PROTO.CardanoTxRequiredSigner[];
|
|
32
|
+
protocolMagic: number;
|
|
33
|
+
networkId: number;
|
|
34
|
+
witnessPaths: Path[];
|
|
35
|
+
additionalWitnessRequests: Path[];
|
|
36
|
+
derivationType: PROTO.CardanoDerivationType;
|
|
37
|
+
includeNetworkId?: boolean;
|
|
38
|
+
};
|
|
39
|
+
export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignTransaction', CardanoSignTransactionParams> {
|
|
40
|
+
init(): void;
|
|
41
|
+
_isFeatureSupported(feature: keyof typeof CardanoSignTransactionFeatures): boolean;
|
|
42
|
+
_ensureFeatureIsSupported(feature: keyof typeof CardanoSignTransactionFeatures): void;
|
|
43
|
+
_ensureFirmwareSupportsParams(): void;
|
|
44
|
+
_sign_tx(): Promise<CardanoSignedTxData>;
|
|
45
|
+
run(): Promise<CardanoSignedTxData>;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=cardanoSignTransaction.d.ts.map
|
|
@@ -0,0 +1,283 @@
|
|
|
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 cardanoAuxiliaryData_1 = require("./cardano/cardanoAuxiliaryData");
|
|
8
|
+
const cardanoCertificate_1 = require("./cardano/cardanoCertificate");
|
|
9
|
+
const cardanoInputs_1 = require("./cardano/cardanoInputs");
|
|
10
|
+
const cardanoOutputs_1 = require("./cardano/cardanoOutputs");
|
|
11
|
+
const constants_1 = require("../constants");
|
|
12
|
+
const cardanoWitnesses_1 = require("./cardano/cardanoWitnesses");
|
|
13
|
+
const cardanoTokenBundle_1 = require("./cardano/cardanoTokenBundle");
|
|
14
|
+
const CardanoSignTransactionFeatures = Object.freeze({
|
|
15
|
+
TransactionStreaming: ['0', '2.4.2'],
|
|
16
|
+
TokenMinting: ['0', '2.4.3'],
|
|
17
|
+
Multisig: ['0', '2.4.3'],
|
|
18
|
+
NetworkIdInTxBody: ['0', '2.4.4'],
|
|
19
|
+
OutputDatumHash: ['0', '2.4.4'],
|
|
20
|
+
ScriptDataHash: ['0', '2.4.4'],
|
|
21
|
+
Plutus: ['0', '2.4.4'],
|
|
22
|
+
KeyHashStakeCredential: ['0', '2.4.4'],
|
|
23
|
+
});
|
|
24
|
+
class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
25
|
+
init() {
|
|
26
|
+
this.requiredPermissions = ['read', 'write'];
|
|
27
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
|
|
28
|
+
this.info = 'Sign Cardano transaction';
|
|
29
|
+
const { payload } = this;
|
|
30
|
+
if (payload.metadata) {
|
|
31
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Metadata field has been replaced by auxiliaryData.');
|
|
32
|
+
}
|
|
33
|
+
if (payload.auxiliaryData && payload.auxiliaryData.blob) {
|
|
34
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Auxiliary data can now only be sent as a hash.');
|
|
35
|
+
}
|
|
36
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
37
|
+
{ name: 'signingMode', type: 'number', required: true },
|
|
38
|
+
{ name: 'inputs', type: 'array', required: true },
|
|
39
|
+
{ name: 'outputs', type: 'array', required: true, allowEmpty: true },
|
|
40
|
+
{ name: 'fee', type: 'uint', required: true },
|
|
41
|
+
{ name: 'ttl', type: 'uint' },
|
|
42
|
+
{ name: 'certificates', type: 'array', allowEmpty: true },
|
|
43
|
+
{ name: 'withdrawals', type: 'array', allowEmpty: true },
|
|
44
|
+
{ name: 'mint', type: 'array', allowEmpty: true },
|
|
45
|
+
{ name: 'validityIntervalStart', type: 'uint' },
|
|
46
|
+
{ name: 'scriptDataHash', type: 'string' },
|
|
47
|
+
{ name: 'collateralInputs', type: 'array', allowEmpty: true },
|
|
48
|
+
{ name: 'requiredSigners', type: 'array', allowEmpty: true },
|
|
49
|
+
{ name: 'protocolMagic', type: 'number', required: true },
|
|
50
|
+
{ name: 'networkId', type: 'number', required: true },
|
|
51
|
+
{ name: 'additionalWitnessRequests', type: 'array', allowEmpty: true },
|
|
52
|
+
{ name: 'derivationType', type: 'number' },
|
|
53
|
+
{ name: 'includeNetworkId', type: 'boolean' },
|
|
54
|
+
]);
|
|
55
|
+
const inputsWithPath = payload.inputs.map(cardanoInputs_1.transformInput);
|
|
56
|
+
const outputsWithTokens = payload.outputs.map(cardanoOutputs_1.transformOutput);
|
|
57
|
+
let certificatesWithPoolOwnersAndRelays = [];
|
|
58
|
+
if (payload.certificates) {
|
|
59
|
+
certificatesWithPoolOwnersAndRelays = payload.certificates.map(cardanoCertificate_1.transformCertificate);
|
|
60
|
+
}
|
|
61
|
+
let withdrawals = [];
|
|
62
|
+
if (payload.withdrawals) {
|
|
63
|
+
withdrawals = payload.withdrawals.map(withdrawal => {
|
|
64
|
+
(0, paramsValidator_1.validateParams)(withdrawal, [
|
|
65
|
+
{ name: 'amount', type: 'uint', required: true },
|
|
66
|
+
{ name: 'scriptHash', type: 'string' },
|
|
67
|
+
{ name: 'keyHash', type: 'string' },
|
|
68
|
+
]);
|
|
69
|
+
return {
|
|
70
|
+
path: withdrawal.path ? (0, pathUtils_1.validatePath)(withdrawal.path, 5) : undefined,
|
|
71
|
+
amount: withdrawal.amount,
|
|
72
|
+
script_hash: withdrawal.scriptHash,
|
|
73
|
+
key_hash: withdrawal.keyHash,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
let mint = [];
|
|
78
|
+
if (payload.mint) {
|
|
79
|
+
mint = (0, cardanoTokenBundle_1.tokenBundleToProto)(payload.mint);
|
|
80
|
+
}
|
|
81
|
+
let auxiliaryData;
|
|
82
|
+
if (payload.auxiliaryData) {
|
|
83
|
+
auxiliaryData = (0, cardanoAuxiliaryData_1.transformAuxiliaryData)(payload.auxiliaryData);
|
|
84
|
+
}
|
|
85
|
+
let additionalWitnessRequests = [];
|
|
86
|
+
if (payload.additionalWitnessRequests) {
|
|
87
|
+
additionalWitnessRequests = payload.additionalWitnessRequests.map(witnessRequest => (0, pathUtils_1.validatePath)(witnessRequest, 3));
|
|
88
|
+
}
|
|
89
|
+
let collateralInputsWithPath = [];
|
|
90
|
+
if (payload.collateralInputs) {
|
|
91
|
+
collateralInputsWithPath = payload.collateralInputs.map(cardanoInputs_1.transformCollateralInput);
|
|
92
|
+
}
|
|
93
|
+
let requiredSigners = [];
|
|
94
|
+
if (payload.requiredSigners) {
|
|
95
|
+
requiredSigners = payload.requiredSigners.map(requiredSigner => {
|
|
96
|
+
(0, paramsValidator_1.validateParams)(requiredSigner, [{ name: 'keyHash', type: 'string' }]);
|
|
97
|
+
return {
|
|
98
|
+
key_path: requiredSigner.keyPath
|
|
99
|
+
? (0, pathUtils_1.validatePath)(requiredSigner.keyPath, 3)
|
|
100
|
+
: undefined,
|
|
101
|
+
key_hash: requiredSigner.keyHash,
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
this.params = {
|
|
106
|
+
signingMode: payload.signingMode,
|
|
107
|
+
inputsWithPath,
|
|
108
|
+
outputsWithTokens,
|
|
109
|
+
fee: payload.fee,
|
|
110
|
+
ttl: payload.ttl,
|
|
111
|
+
certificatesWithPoolOwnersAndRelays,
|
|
112
|
+
withdrawals,
|
|
113
|
+
mint,
|
|
114
|
+
auxiliaryData,
|
|
115
|
+
validityIntervalStart: payload.validityIntervalStart,
|
|
116
|
+
scriptDataHash: payload.scriptDataHash,
|
|
117
|
+
collateralInputsWithPath,
|
|
118
|
+
requiredSigners,
|
|
119
|
+
protocolMagic: payload.protocolMagic,
|
|
120
|
+
networkId: payload.networkId,
|
|
121
|
+
witnessPaths: (0, cardanoWitnesses_1.gatherWitnessPaths)(inputsWithPath, certificatesWithPoolOwnersAndRelays, withdrawals, collateralInputsWithPath, requiredSigners, additionalWitnessRequests, payload.signingMode),
|
|
122
|
+
additionalWitnessRequests,
|
|
123
|
+
derivationType: typeof payload.derivationType !== 'undefined'
|
|
124
|
+
? payload.derivationType
|
|
125
|
+
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
126
|
+
includeNetworkId: payload.includeNetworkId,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
_isFeatureSupported(feature) {
|
|
130
|
+
return this.device.atLeast(CardanoSignTransactionFeatures[feature]);
|
|
131
|
+
}
|
|
132
|
+
_ensureFeatureIsSupported(feature) {
|
|
133
|
+
if (!this._isFeatureSupported(feature)) {
|
|
134
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Feature ${feature} not supported by device firmware`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
_ensureFirmwareSupportsParams() {
|
|
138
|
+
const { params } = this;
|
|
139
|
+
this._ensureFeatureIsSupported('TransactionStreaming');
|
|
140
|
+
params.certificatesWithPoolOwnersAndRelays.forEach(({ certificate }) => {
|
|
141
|
+
if (certificate.key_hash) {
|
|
142
|
+
this._ensureFeatureIsSupported('KeyHashStakeCredential');
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
params.outputsWithTokens.forEach(({ output }) => {
|
|
146
|
+
if (output.datum_hash) {
|
|
147
|
+
this._ensureFeatureIsSupported('OutputDatumHash');
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
params.withdrawals.forEach(withdrawal => {
|
|
151
|
+
if (withdrawal.key_hash) {
|
|
152
|
+
this._ensureFeatureIsSupported('KeyHashStakeCredential');
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
if (params.mint.length > 0) {
|
|
156
|
+
this._ensureFeatureIsSupported('TokenMinting');
|
|
157
|
+
}
|
|
158
|
+
if (params.additionalWitnessRequests.length > 0 ||
|
|
159
|
+
params.signingMode === constants_1.PROTO.CardanoTxSigningMode.MULTISIG_TRANSACTION) {
|
|
160
|
+
this._ensureFeatureIsSupported('Multisig');
|
|
161
|
+
}
|
|
162
|
+
if (params.includeNetworkId) {
|
|
163
|
+
this._ensureFeatureIsSupported('NetworkIdInTxBody');
|
|
164
|
+
}
|
|
165
|
+
if (params.scriptDataHash) {
|
|
166
|
+
this._ensureFeatureIsSupported('ScriptDataHash');
|
|
167
|
+
}
|
|
168
|
+
if (params.signingMode === constants_1.PROTO.CardanoTxSigningMode.PLUTUS_TRANSACTION) {
|
|
169
|
+
this._ensureFeatureIsSupported('Plutus');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async _sign_tx() {
|
|
173
|
+
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
174
|
+
const hasAuxiliaryData = !!this.params.auxiliaryData;
|
|
175
|
+
const signTxInitMessage = {
|
|
176
|
+
signing_mode: this.params.signingMode,
|
|
177
|
+
protocol_magic: this.params.protocolMagic,
|
|
178
|
+
network_id: this.params.networkId,
|
|
179
|
+
inputs_count: this.params.inputsWithPath.length,
|
|
180
|
+
outputs_count: this.params.outputsWithTokens.length,
|
|
181
|
+
fee: this.params.fee,
|
|
182
|
+
ttl: this.params.ttl,
|
|
183
|
+
certificates_count: this.params.certificatesWithPoolOwnersAndRelays.length,
|
|
184
|
+
withdrawals_count: this.params.withdrawals.length,
|
|
185
|
+
has_auxiliary_data: hasAuxiliaryData,
|
|
186
|
+
validity_interval_start: this.params.validityIntervalStart,
|
|
187
|
+
witness_requests_count: this.params.witnessPaths.length,
|
|
188
|
+
minting_asset_groups_count: this.params.mint.length,
|
|
189
|
+
script_data_hash: this.params.scriptDataHash,
|
|
190
|
+
collateral_inputs_count: this.params.collateralInputsWithPath.length,
|
|
191
|
+
required_signers_count: this.params.requiredSigners.length,
|
|
192
|
+
derivation_type: this.params.derivationType,
|
|
193
|
+
include_network_id: this.params.includeNetworkId,
|
|
194
|
+
};
|
|
195
|
+
await typedCall('CardanoSignTxInit', 'CardanoTxItemAck', signTxInitMessage);
|
|
196
|
+
for (const { input } of this.params.inputsWithPath) {
|
|
197
|
+
await typedCall('CardanoTxInput', 'CardanoTxItemAck', input);
|
|
198
|
+
}
|
|
199
|
+
for (const { output, tokenBundle } of this.params.outputsWithTokens) {
|
|
200
|
+
await typedCall('CardanoTxOutput', 'CardanoTxItemAck', output);
|
|
201
|
+
if (tokenBundle) {
|
|
202
|
+
for (const assetGroup of tokenBundle) {
|
|
203
|
+
await typedCall('CardanoAssetGroup', 'CardanoTxItemAck', {
|
|
204
|
+
policy_id: assetGroup.policyId,
|
|
205
|
+
tokens_count: assetGroup.tokens.length,
|
|
206
|
+
});
|
|
207
|
+
for (const token of assetGroup.tokens) {
|
|
208
|
+
await typedCall('CardanoToken', 'CardanoTxItemAck', token);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
for (const { certificate, poolOwners, poolRelays } of this.params
|
|
214
|
+
.certificatesWithPoolOwnersAndRelays) {
|
|
215
|
+
await typedCall('CardanoTxCertificate', 'CardanoTxItemAck', certificate);
|
|
216
|
+
for (const poolOwner of poolOwners) {
|
|
217
|
+
await typedCall('CardanoPoolOwner', 'CardanoTxItemAck', poolOwner);
|
|
218
|
+
}
|
|
219
|
+
for (const poolRelay of poolRelays) {
|
|
220
|
+
await typedCall('CardanoPoolRelayParameters', 'CardanoTxItemAck', poolRelay);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
for (const withdrawal of this.params.withdrawals) {
|
|
224
|
+
await typedCall('CardanoTxWithdrawal', 'CardanoTxItemAck', withdrawal);
|
|
225
|
+
}
|
|
226
|
+
let auxiliaryDataSupplement;
|
|
227
|
+
if (this.params.auxiliaryData) {
|
|
228
|
+
const { catalyst_registration_parameters } = this.params.auxiliaryData;
|
|
229
|
+
if (catalyst_registration_parameters) {
|
|
230
|
+
this.params.auxiliaryData = (0, cardanoAuxiliaryData_1.modifyAuxiliaryDataForBackwardsCompatibility)(this.device, this.params.auxiliaryData);
|
|
231
|
+
}
|
|
232
|
+
const { message } = await typedCall('CardanoTxAuxiliaryData', 'CardanoTxAuxiliaryDataSupplement', this.params.auxiliaryData);
|
|
233
|
+
const auxiliaryDataType = constants_1.PROTO.CardanoTxAuxiliaryDataSupplementType[message.type];
|
|
234
|
+
if (auxiliaryDataType !== constants_1.PROTO.CardanoTxAuxiliaryDataSupplementType.NONE) {
|
|
235
|
+
auxiliaryDataSupplement = {
|
|
236
|
+
type: auxiliaryDataType,
|
|
237
|
+
auxiliaryDataHash: message.auxiliary_data_hash,
|
|
238
|
+
catalystSignature: message.catalyst_signature,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
await typedCall('CardanoTxHostAck', 'CardanoTxItemAck');
|
|
242
|
+
}
|
|
243
|
+
if (this.params.mint.length > 0) {
|
|
244
|
+
await typedCall('CardanoTxMint', 'CardanoTxItemAck', {
|
|
245
|
+
asset_groups_count: this.params.mint.length,
|
|
246
|
+
});
|
|
247
|
+
for (const assetGroup of this.params.mint) {
|
|
248
|
+
await typedCall('CardanoAssetGroup', 'CardanoTxItemAck', {
|
|
249
|
+
policy_id: assetGroup.policyId,
|
|
250
|
+
tokens_count: assetGroup.tokens.length,
|
|
251
|
+
});
|
|
252
|
+
for (const token of assetGroup.tokens) {
|
|
253
|
+
await typedCall('CardanoToken', 'CardanoTxItemAck', token);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
for (const { collateralInput } of this.params.collateralInputsWithPath) {
|
|
258
|
+
await typedCall('CardanoTxCollateralInput', 'CardanoTxItemAck', collateralInput);
|
|
259
|
+
}
|
|
260
|
+
for (const requiredSigner of this.params.requiredSigners) {
|
|
261
|
+
await typedCall('CardanoTxRequiredSigner', 'CardanoTxItemAck', requiredSigner);
|
|
262
|
+
}
|
|
263
|
+
const witnesses = [];
|
|
264
|
+
for (const path of this.params.witnessPaths) {
|
|
265
|
+
const { message } = await typedCall('CardanoTxWitnessRequest', 'CardanoTxWitnessResponse', { path });
|
|
266
|
+
witnesses.push({
|
|
267
|
+
type: constants_1.PROTO.CardanoTxWitnessType[message.type],
|
|
268
|
+
pubKey: message.pub_key,
|
|
269
|
+
signature: message.signature,
|
|
270
|
+
chainCode: message.chain_code,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
const { message: txBodyHashMessage } = await typedCall('CardanoTxHostAck', 'CardanoTxBodyHash');
|
|
274
|
+
await typedCall('CardanoTxHostAck', 'CardanoSignTxFinished');
|
|
275
|
+
return { hash: txBodyHashMessage.tx_hash, witnesses, auxiliaryDataSupplement };
|
|
276
|
+
}
|
|
277
|
+
run() {
|
|
278
|
+
this._ensureFirmwareSupportsParams();
|
|
279
|
+
return this._sign_tx();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
exports.default = CardanoSignTransaction;
|
|
283
|
+
//# sourceMappingURL=cardanoSignTransaction.js.map
|