@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,347 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signTx = exports.validate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const bs58 = (0, tslib_1.__importStar)(require("bs58"));
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
7
|
+
const binaryToDecimal = (bignum, minDigits = 1) => {
|
|
8
|
+
const result = Array(minDigits).fill('0'.charCodeAt(0));
|
|
9
|
+
for (let i = bignum.length - 1; i >= 0; --i) {
|
|
10
|
+
let carry = bignum[i];
|
|
11
|
+
for (let j = 0; j < result.length; ++j) {
|
|
12
|
+
const x = ((result[j] - '0'.charCodeAt(0)) << 8) + carry;
|
|
13
|
+
result[j] = '0'.charCodeAt(0) + (x % 10);
|
|
14
|
+
carry = (x / 10) | 0;
|
|
15
|
+
}
|
|
16
|
+
while (carry) {
|
|
17
|
+
result.push('0'.charCodeAt(0) + (carry % 10));
|
|
18
|
+
carry = (carry / 10) | 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
result.reverse();
|
|
22
|
+
return String.fromCharCode(...result);
|
|
23
|
+
};
|
|
24
|
+
const serialize = (s) => {
|
|
25
|
+
if (typeof s !== 'string') {
|
|
26
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Eos serialization error, "${typeof s}" should be a string`);
|
|
27
|
+
}
|
|
28
|
+
const charToSymbol = (c) => {
|
|
29
|
+
if (c >= 'a'.charCodeAt(0) && c <= 'z'.charCodeAt(0)) {
|
|
30
|
+
return c - 'a'.charCodeAt(0) + 6;
|
|
31
|
+
}
|
|
32
|
+
if (c >= '1'.charCodeAt(0) && c <= '5'.charCodeAt(0)) {
|
|
33
|
+
return c - '1'.charCodeAt(0) + 1;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
};
|
|
37
|
+
const a = new Uint8Array(8);
|
|
38
|
+
let bit = 63;
|
|
39
|
+
for (let i = 0; i < s.length; ++i) {
|
|
40
|
+
let c = charToSymbol(s.charCodeAt(i));
|
|
41
|
+
if (bit < 5) {
|
|
42
|
+
c <<= 1;
|
|
43
|
+
}
|
|
44
|
+
for (let j = 4; j >= 0; --j) {
|
|
45
|
+
if (bit >= 0) {
|
|
46
|
+
a[Math.floor(bit / 8)] |= ((c >> j) & 1) << bit % 8;
|
|
47
|
+
--bit;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return binaryToDecimal(a);
|
|
52
|
+
};
|
|
53
|
+
const parseQuantity = (s) => {
|
|
54
|
+
if (typeof s !== 'string') {
|
|
55
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', `Eos serialization error. Expected string containing asset, got: ${typeof s}`);
|
|
56
|
+
}
|
|
57
|
+
s = s.trim();
|
|
58
|
+
let pos = 0;
|
|
59
|
+
let amount = '';
|
|
60
|
+
let precision = 0;
|
|
61
|
+
if (s[pos] === '-') {
|
|
62
|
+
amount += '-';
|
|
63
|
+
++pos;
|
|
64
|
+
}
|
|
65
|
+
let foundDigit = false;
|
|
66
|
+
while (pos < s.length &&
|
|
67
|
+
s.charCodeAt(pos) >= '0'.charCodeAt(0) &&
|
|
68
|
+
s.charCodeAt(pos) <= '9'.charCodeAt(0)) {
|
|
69
|
+
foundDigit = true;
|
|
70
|
+
amount += s[pos];
|
|
71
|
+
++pos;
|
|
72
|
+
}
|
|
73
|
+
if (!foundDigit) {
|
|
74
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Eos serialization error. Asset must begin with a number');
|
|
75
|
+
}
|
|
76
|
+
if (s[pos] === '.') {
|
|
77
|
+
++pos;
|
|
78
|
+
while (pos < s.length &&
|
|
79
|
+
s.charCodeAt(pos) >= '0'.charCodeAt(0) &&
|
|
80
|
+
s.charCodeAt(pos) <= '9'.charCodeAt(0)) {
|
|
81
|
+
amount += s[pos];
|
|
82
|
+
++precision;
|
|
83
|
+
++pos;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const symbol = s.substring(pos).trim();
|
|
87
|
+
const a = [precision & 0xff];
|
|
88
|
+
for (let i = 0; i < symbol.length; ++i) {
|
|
89
|
+
a.push(symbol.charCodeAt(i));
|
|
90
|
+
}
|
|
91
|
+
while (a.length < 8) {
|
|
92
|
+
a.push(0);
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
amount,
|
|
96
|
+
symbol: binaryToDecimal(a.slice(0, 8)),
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const parseAuth = (a) => {
|
|
100
|
+
const keyToBuffer = (pk) => {
|
|
101
|
+
const len = pk.indexOf('EOS') === 0 ? 3 : 7;
|
|
102
|
+
const key = bs58.decode(pk.substring(len));
|
|
103
|
+
return {
|
|
104
|
+
type: 0,
|
|
105
|
+
key: key.slice(0, key.length - 4).toString('hex'),
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
threshold: a.threshold,
|
|
110
|
+
keys: a.keys.map(k => ({
|
|
111
|
+
weight: k.weight,
|
|
112
|
+
...keyToBuffer(k.key),
|
|
113
|
+
})),
|
|
114
|
+
accounts: a.accounts.map(acc => ({
|
|
115
|
+
weight: acc.weight,
|
|
116
|
+
account: {
|
|
117
|
+
actor: serialize(acc.permission.actor),
|
|
118
|
+
permission: serialize(acc.permission.permission),
|
|
119
|
+
},
|
|
120
|
+
})),
|
|
121
|
+
waits: a.waits,
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const parseDate = (d) => {
|
|
125
|
+
if (typeof d !== 'string') {
|
|
126
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Eos serialization error. Header.expiration should be string or number');
|
|
127
|
+
}
|
|
128
|
+
if (d.substring(d.length - 1, d.length) !== 'Z') {
|
|
129
|
+
d += 'Z';
|
|
130
|
+
}
|
|
131
|
+
return Date.parse(d) / 1000;
|
|
132
|
+
};
|
|
133
|
+
const parseAck = (action) => {
|
|
134
|
+
switch (action.name) {
|
|
135
|
+
case 'transfer':
|
|
136
|
+
return {
|
|
137
|
+
transfer: {
|
|
138
|
+
sender: serialize(action.data.from),
|
|
139
|
+
receiver: serialize(action.data.to),
|
|
140
|
+
quantity: parseQuantity(action.data.quantity),
|
|
141
|
+
memo: action.data.memo,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
case 'delegatebw':
|
|
145
|
+
return {
|
|
146
|
+
delegate: {
|
|
147
|
+
sender: serialize(action.data.from),
|
|
148
|
+
receiver: serialize(action.data.receiver),
|
|
149
|
+
net_quantity: parseQuantity(action.data.stake_net_quantity),
|
|
150
|
+
cpu_quantity: parseQuantity(action.data.stake_cpu_quantity),
|
|
151
|
+
transfer: action.data.transfer,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
case 'undelegatebw':
|
|
155
|
+
return {
|
|
156
|
+
undelegate: {
|
|
157
|
+
sender: serialize(action.data.from),
|
|
158
|
+
receiver: serialize(action.data.receiver),
|
|
159
|
+
net_quantity: parseQuantity(action.data.unstake_net_quantity),
|
|
160
|
+
cpu_quantity: parseQuantity(action.data.unstake_cpu_quantity),
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
case 'buyram':
|
|
164
|
+
return {
|
|
165
|
+
buy_ram: {
|
|
166
|
+
payer: serialize(action.data.payer),
|
|
167
|
+
receiver: serialize(action.data.receiver),
|
|
168
|
+
quantity: parseQuantity(action.data.quant),
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
case 'buyrambytes':
|
|
172
|
+
return {
|
|
173
|
+
buy_ram_bytes: {
|
|
174
|
+
payer: serialize(action.data.payer),
|
|
175
|
+
receiver: serialize(action.data.receiver),
|
|
176
|
+
bytes: action.data.bytes,
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
case 'sellram':
|
|
180
|
+
return {
|
|
181
|
+
sell_ram: {
|
|
182
|
+
account: serialize(action.data.account),
|
|
183
|
+
bytes: action.data.bytes,
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
case 'voteproducer':
|
|
187
|
+
return {
|
|
188
|
+
vote_producer: {
|
|
189
|
+
voter: serialize(action.data.voter),
|
|
190
|
+
proxy: serialize(action.data.proxy),
|
|
191
|
+
producers: action.data.producers.map(p => serialize(p)),
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
case 'refund':
|
|
195
|
+
return {
|
|
196
|
+
refund: {
|
|
197
|
+
owner: serialize(action.data.owner),
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
case 'updateauth':
|
|
201
|
+
return {
|
|
202
|
+
update_auth: {
|
|
203
|
+
account: serialize(action.data.account),
|
|
204
|
+
permission: serialize(action.data.permission),
|
|
205
|
+
parent: serialize(action.data.parent),
|
|
206
|
+
auth: parseAuth(action.data.auth),
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
case 'deleteauth':
|
|
210
|
+
return {
|
|
211
|
+
delete_auth: {
|
|
212
|
+
account: serialize(action.data.account),
|
|
213
|
+
permission: serialize(action.data.permission),
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
case 'linkauth':
|
|
217
|
+
return {
|
|
218
|
+
link_auth: {
|
|
219
|
+
account: serialize(action.data.account),
|
|
220
|
+
code: serialize(action.data.code),
|
|
221
|
+
type: serialize(action.data.type),
|
|
222
|
+
requirement: serialize(action.data.requirement),
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
case 'unlinkauth':
|
|
226
|
+
return {
|
|
227
|
+
unlink_auth: {
|
|
228
|
+
account: serialize(action.data.account),
|
|
229
|
+
code: serialize(action.data.code),
|
|
230
|
+
type: serialize(action.data.type),
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
case 'newaccount':
|
|
234
|
+
return {
|
|
235
|
+
new_account: {
|
|
236
|
+
creator: serialize(action.data.creator),
|
|
237
|
+
name: serialize(action.data.name),
|
|
238
|
+
owner: parseAuth(action.data.owner),
|
|
239
|
+
active: parseAuth(action.data.active),
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
default:
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const parseUnknown = (action) => {
|
|
247
|
+
if (typeof action.data !== 'string')
|
|
248
|
+
return null;
|
|
249
|
+
return {
|
|
250
|
+
unknown: {
|
|
251
|
+
data_size: action.data.length / 2,
|
|
252
|
+
data_chunk: action.data,
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
const parseCommon = (action) => ({
|
|
257
|
+
account: serialize(action.account),
|
|
258
|
+
name: serialize(action.name),
|
|
259
|
+
authorization: action.authorization.map(a => ({
|
|
260
|
+
actor: serialize(a.actor),
|
|
261
|
+
permission: serialize(a.permission),
|
|
262
|
+
})),
|
|
263
|
+
});
|
|
264
|
+
const parseAction = (action) => {
|
|
265
|
+
const ack = parseAck(action) || parseUnknown(action);
|
|
266
|
+
return {
|
|
267
|
+
common: parseCommon(action),
|
|
268
|
+
...ack,
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
const validate = (tx) => {
|
|
272
|
+
const header = {
|
|
273
|
+
expiration: typeof tx.header.expiration === 'number'
|
|
274
|
+
? tx.header.expiration
|
|
275
|
+
: parseDate(tx.header.expiration),
|
|
276
|
+
ref_block_num: tx.header.refBlockNum,
|
|
277
|
+
ref_block_prefix: tx.header.refBlockPrefix,
|
|
278
|
+
max_net_usage_words: tx.header.maxNetUsageWords,
|
|
279
|
+
max_cpu_usage_ms: tx.header.maxCpuUsageMs,
|
|
280
|
+
delay_sec: tx.header.delaySec,
|
|
281
|
+
};
|
|
282
|
+
const ack = [];
|
|
283
|
+
tx.actions.forEach(action => {
|
|
284
|
+
ack.push(parseAction(action));
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
chain_id: tx.chainId,
|
|
288
|
+
header,
|
|
289
|
+
ack,
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
exports.validate = validate;
|
|
293
|
+
const CHUNK_SIZE = 2048;
|
|
294
|
+
const getDataChunk = (data, offset) => {
|
|
295
|
+
if (!data || offset < 0 || data.length < offset)
|
|
296
|
+
return '';
|
|
297
|
+
const o = offset > 0 ? data.length - offset * 2 : 0;
|
|
298
|
+
return data.substring(o, o + CHUNK_SIZE * 2);
|
|
299
|
+
};
|
|
300
|
+
const processTxRequest = async (typedCall, message, actions, index) => {
|
|
301
|
+
const action = actions[index];
|
|
302
|
+
const lastOp = index + 1 >= actions.length;
|
|
303
|
+
let ack;
|
|
304
|
+
const requestedDataSize = message.data_size;
|
|
305
|
+
if (action.unknown) {
|
|
306
|
+
const { unknown } = action;
|
|
307
|
+
const offset = typeof requestedDataSize === 'number' ? requestedDataSize : 0;
|
|
308
|
+
const data_chunk = getDataChunk(unknown.data_chunk, offset);
|
|
309
|
+
const params = {
|
|
310
|
+
common: action.common,
|
|
311
|
+
unknown: {
|
|
312
|
+
data_size: unknown.data_size,
|
|
313
|
+
data_chunk,
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
const sent = offset > 0 ? unknown.data_size - offset + CHUNK_SIZE : CHUNK_SIZE;
|
|
317
|
+
const lastChunk = sent >= unknown.data_size;
|
|
318
|
+
if (lastOp && lastChunk) {
|
|
319
|
+
const response = await typedCall('EosTxActionAck', 'EosSignedTx', params);
|
|
320
|
+
return response.message;
|
|
321
|
+
}
|
|
322
|
+
ack = await typedCall('EosTxActionAck', 'EosTxActionRequest', params);
|
|
323
|
+
if (lastChunk) {
|
|
324
|
+
index++;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
if (lastOp) {
|
|
329
|
+
const response = await typedCall('EosTxActionAck', 'EosSignedTx', action);
|
|
330
|
+
return response.message;
|
|
331
|
+
}
|
|
332
|
+
ack = await typedCall('EosTxActionAck', 'EosTxActionRequest', action);
|
|
333
|
+
index++;
|
|
334
|
+
}
|
|
335
|
+
return processTxRequest(typedCall, ack.message, actions, index);
|
|
336
|
+
};
|
|
337
|
+
const signTx = async (typedCall, address_n, chain_id, header, actions) => {
|
|
338
|
+
const response = await typedCall('EosSignTx', 'EosTxActionRequest', {
|
|
339
|
+
address_n,
|
|
340
|
+
chain_id,
|
|
341
|
+
header,
|
|
342
|
+
num_actions: actions.length,
|
|
343
|
+
});
|
|
344
|
+
return processTxRequest(typedCall, response.message, actions, 0);
|
|
345
|
+
};
|
|
346
|
+
exports.signTx = signTx;
|
|
347
|
+
//# sourceMappingURL=eosSignTx.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../constants';
|
|
3
|
+
export default class EosGetPublicKey extends AbstractMethod<'eosGetPublicKey', PROTO.EosGetPublicKey[]> {
|
|
4
|
+
hasBundle?: boolean;
|
|
5
|
+
confirmed?: boolean;
|
|
6
|
+
init(): void;
|
|
7
|
+
confirmation(): Promise<boolean>;
|
|
8
|
+
run(): Promise<import("../types/api/eosGetPublicKey").EosPublicKey | import("../types/api/eosGetPublicKey").EosPublicKey[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=eosGetPublicKey.d.ts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
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 EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
9
|
+
init() {
|
|
10
|
+
this.requiredPermissions = ['read'];
|
|
11
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('EOS'), this.firmwareRange);
|
|
12
|
+
this.info = 'Export Eos 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 : false,
|
|
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 Eos public keys';
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
label = `Export Eos 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('EosGetPublicKey', 'EosPublicKey', batch);
|
|
56
|
+
responses.push({
|
|
57
|
+
rawPublicKey: message.raw_public_key,
|
|
58
|
+
wifPublicKey: message.wif_public_key,
|
|
59
|
+
path: batch.address_n,
|
|
60
|
+
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
61
|
+
});
|
|
62
|
+
if (this.hasBundle) {
|
|
63
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
64
|
+
progress: i,
|
|
65
|
+
response: message,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return this.hasBundle ? responses : responses[0];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.default = EosGetPublicKey;
|
|
73
|
+
//# sourceMappingURL=eosGetPublicKey.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../constants';
|
|
3
|
+
declare type Params = {
|
|
4
|
+
path: number[];
|
|
5
|
+
chain_id: string;
|
|
6
|
+
header: PROTO.EosTxHeader;
|
|
7
|
+
ack: PROTO.EosTxActionAck[];
|
|
8
|
+
};
|
|
9
|
+
export default class EosSignTransaction extends AbstractMethod<'eosSignTransaction', Params> {
|
|
10
|
+
init(): void;
|
|
11
|
+
run(): Promise<{
|
|
12
|
+
signature: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=eosSignTransaction.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
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("./eos/eosSignTx"));
|
|
9
|
+
class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
10
|
+
init() {
|
|
11
|
+
this.requiredPermissions = ['read', 'write'];
|
|
12
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('EOS'), this.firmwareRange);
|
|
13
|
+
this.info = 'Sign EOS transaction';
|
|
14
|
+
const { payload } = this;
|
|
15
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
16
|
+
{ name: 'path', required: true },
|
|
17
|
+
{ name: 'transaction', required: true },
|
|
18
|
+
]);
|
|
19
|
+
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
20
|
+
const { chain_id, header, ack } = helper.validate(payload.transaction);
|
|
21
|
+
this.params = {
|
|
22
|
+
path,
|
|
23
|
+
chain_id,
|
|
24
|
+
header,
|
|
25
|
+
ack,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
async run() {
|
|
29
|
+
const response = await helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.chain_id, this.params.header, this.params.ack);
|
|
30
|
+
return {
|
|
31
|
+
signature: response.signature,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = EosSignTransaction;
|
|
36
|
+
//# sourceMappingURL=eosSignTransaction.js.map
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { TrezorError } from '../../../constants/errors';
|
|
3
|
+
import { PROTO } from '../../../constants';
|
|
4
|
+
export declare const parseArrayType: ({
|
|
5
|
+
description: string;
|
|
6
|
+
input: string;
|
|
7
|
+
output: {
|
|
8
|
+
entryTypeName: string;
|
|
9
|
+
arraySize: number;
|
|
10
|
+
};
|
|
11
|
+
error?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
description: string;
|
|
14
|
+
input: string;
|
|
15
|
+
output: {
|
|
16
|
+
entryTypeName: string;
|
|
17
|
+
arraySize: null;
|
|
18
|
+
};
|
|
19
|
+
error?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
description: string;
|
|
22
|
+
input: string;
|
|
23
|
+
error: (string | typeof TrezorError)[];
|
|
24
|
+
output?: undefined;
|
|
25
|
+
})[];
|
|
26
|
+
export declare const getFieldType: ({
|
|
27
|
+
description: string;
|
|
28
|
+
input: {
|
|
29
|
+
typeName: string;
|
|
30
|
+
types: {
|
|
31
|
+
ExampleStruct?: undefined;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
output: {
|
|
35
|
+
data_type: PROTO.EthereumDataType;
|
|
36
|
+
size: number;
|
|
37
|
+
entry_type?: undefined;
|
|
38
|
+
struct_name?: undefined;
|
|
39
|
+
};
|
|
40
|
+
error?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
description: string;
|
|
43
|
+
input: {
|
|
44
|
+
typeName: string;
|
|
45
|
+
types: {
|
|
46
|
+
ExampleStruct?: undefined;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
output: {
|
|
50
|
+
data_type: PROTO.EthereumDataType;
|
|
51
|
+
size?: undefined;
|
|
52
|
+
entry_type?: undefined;
|
|
53
|
+
struct_name?: undefined;
|
|
54
|
+
};
|
|
55
|
+
error?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
description: string;
|
|
58
|
+
input: {
|
|
59
|
+
typeName: string;
|
|
60
|
+
types: {
|
|
61
|
+
ExampleStruct?: undefined;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
output: {
|
|
65
|
+
data_type: PROTO.EthereumDataType;
|
|
66
|
+
size: undefined;
|
|
67
|
+
entry_type?: undefined;
|
|
68
|
+
struct_name?: undefined;
|
|
69
|
+
};
|
|
70
|
+
error?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
description: string;
|
|
73
|
+
input: {
|
|
74
|
+
typeName: string;
|
|
75
|
+
types: {
|
|
76
|
+
ExampleStruct?: undefined;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
output: {
|
|
80
|
+
data_type: PROTO.EthereumDataType;
|
|
81
|
+
size: number;
|
|
82
|
+
entry_type: {
|
|
83
|
+
data_type: PROTO.EthereumDataType;
|
|
84
|
+
size: number;
|
|
85
|
+
entry_type?: undefined;
|
|
86
|
+
};
|
|
87
|
+
struct_name?: undefined;
|
|
88
|
+
};
|
|
89
|
+
error?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
description: string;
|
|
92
|
+
input: {
|
|
93
|
+
typeName: string;
|
|
94
|
+
types: {
|
|
95
|
+
ExampleStruct?: undefined;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
output: {
|
|
99
|
+
data_type: PROTO.EthereumDataType;
|
|
100
|
+
size: undefined;
|
|
101
|
+
entry_type: {
|
|
102
|
+
data_type: PROTO.EthereumDataType;
|
|
103
|
+
size: number;
|
|
104
|
+
entry_type?: undefined;
|
|
105
|
+
};
|
|
106
|
+
struct_name?: undefined;
|
|
107
|
+
};
|
|
108
|
+
error?: undefined;
|
|
109
|
+
} | {
|
|
110
|
+
description: string;
|
|
111
|
+
input: {
|
|
112
|
+
typeName: string;
|
|
113
|
+
types: {
|
|
114
|
+
ExampleStruct?: undefined;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
output: {
|
|
118
|
+
data_type: PROTO.EthereumDataType;
|
|
119
|
+
size: number;
|
|
120
|
+
entry_type: {
|
|
121
|
+
data_type: PROTO.EthereumDataType;
|
|
122
|
+
size: number;
|
|
123
|
+
entry_type: {
|
|
124
|
+
data_type: PROTO.EthereumDataType;
|
|
125
|
+
size: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
struct_name?: undefined;
|
|
129
|
+
};
|
|
130
|
+
error?: undefined;
|
|
131
|
+
} | {
|
|
132
|
+
description: string;
|
|
133
|
+
input: {
|
|
134
|
+
typeName: string;
|
|
135
|
+
types: {
|
|
136
|
+
ExampleStruct: {
|
|
137
|
+
name: string;
|
|
138
|
+
type: string;
|
|
139
|
+
}[];
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
output: {
|
|
143
|
+
data_type: PROTO.EthereumDataType;
|
|
144
|
+
size: number;
|
|
145
|
+
struct_name: string;
|
|
146
|
+
entry_type?: undefined;
|
|
147
|
+
};
|
|
148
|
+
error?: undefined;
|
|
149
|
+
} | {
|
|
150
|
+
description: string;
|
|
151
|
+
input: {
|
|
152
|
+
typeName: string;
|
|
153
|
+
types: {
|
|
154
|
+
ExampleStruct?: undefined;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
error: (string | typeof TrezorError)[];
|
|
158
|
+
output?: undefined;
|
|
159
|
+
})[];
|
|
160
|
+
export declare const encodeData: ({
|
|
161
|
+
description: string;
|
|
162
|
+
input: {
|
|
163
|
+
typeName: string;
|
|
164
|
+
data: string;
|
|
165
|
+
};
|
|
166
|
+
output: string;
|
|
167
|
+
error?: undefined;
|
|
168
|
+
} | {
|
|
169
|
+
description: string;
|
|
170
|
+
input: {
|
|
171
|
+
typeName: string;
|
|
172
|
+
data: ArrayBufferLike;
|
|
173
|
+
};
|
|
174
|
+
output: string;
|
|
175
|
+
error?: undefined;
|
|
176
|
+
} | {
|
|
177
|
+
description: string;
|
|
178
|
+
input: {
|
|
179
|
+
typeName: string;
|
|
180
|
+
data: number;
|
|
181
|
+
};
|
|
182
|
+
output: string;
|
|
183
|
+
error?: undefined;
|
|
184
|
+
} | {
|
|
185
|
+
description: string;
|
|
186
|
+
input: {
|
|
187
|
+
typeName: string;
|
|
188
|
+
data: bigint;
|
|
189
|
+
};
|
|
190
|
+
output: string;
|
|
191
|
+
error?: undefined;
|
|
192
|
+
} | {
|
|
193
|
+
description: string;
|
|
194
|
+
input: {
|
|
195
|
+
typeName: string;
|
|
196
|
+
data: BigNumber;
|
|
197
|
+
};
|
|
198
|
+
output: string;
|
|
199
|
+
error?: undefined;
|
|
200
|
+
} | {
|
|
201
|
+
description: string;
|
|
202
|
+
input: {
|
|
203
|
+
typeName: string;
|
|
204
|
+
data: number;
|
|
205
|
+
};
|
|
206
|
+
error: (string | typeof TrezorError)[];
|
|
207
|
+
output?: undefined;
|
|
208
|
+
} | {
|
|
209
|
+
description: string;
|
|
210
|
+
input: {
|
|
211
|
+
typeName: string;
|
|
212
|
+
data: boolean;
|
|
213
|
+
};
|
|
214
|
+
output: string;
|
|
215
|
+
error?: undefined;
|
|
216
|
+
} | {
|
|
217
|
+
description: string;
|
|
218
|
+
input: {
|
|
219
|
+
typeName: string;
|
|
220
|
+
data: boolean[];
|
|
221
|
+
};
|
|
222
|
+
error: (string | typeof TrezorError)[];
|
|
223
|
+
output?: undefined;
|
|
224
|
+
})[];
|
|
225
|
+
//# sourceMappingURL=ethereumSignTypedData.d.ts.map
|