@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
package/lib/exports.d.ts
ADDED
package/lib/exports.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseConnectSettings = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
(0, tslib_1.__exportStar)(require("./constants"), exports);
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./events"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./types"), exports);
|
|
8
|
+
var connectSettings_1 = require("./data/connectSettings");
|
|
9
|
+
Object.defineProperty(exports, "parseConnectSettings", { enumerable: true, get: function () { return connectSettings_1.parseConnectSettings; } });
|
|
10
|
+
//# sourceMappingURL=exports.js.map
|
package/lib/factory.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { EventEmitter } from 'events';
|
|
3
|
+
import type { TrezorConnect } from './types';
|
|
4
|
+
import type { CallMethod } from './events/call';
|
|
5
|
+
interface Dependencies {
|
|
6
|
+
call: CallMethod;
|
|
7
|
+
eventEmitter: EventEmitter;
|
|
8
|
+
manifest: TrezorConnect['manifest'];
|
|
9
|
+
init: TrezorConnect['init'];
|
|
10
|
+
customMessage: TrezorConnect['customMessage'];
|
|
11
|
+
requestLogin: TrezorConnect['requestLogin'];
|
|
12
|
+
uiResponse: TrezorConnect['uiResponse'];
|
|
13
|
+
renderWebUSBButton: TrezorConnect['renderWebUSBButton'];
|
|
14
|
+
disableWebUSB: TrezorConnect['disableWebUSB'];
|
|
15
|
+
cancel: TrezorConnect['cancel'];
|
|
16
|
+
dispose: TrezorConnect['dispose'];
|
|
17
|
+
}
|
|
18
|
+
export declare const factory: ({ eventEmitter, manifest, init, call, customMessage, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, cancel, dispose, }: Dependencies) => TrezorConnect;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=factory.d.ts.map
|
package/lib/factory.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.factory = void 0;
|
|
4
|
+
const events_1 = require("./events");
|
|
5
|
+
const factory = ({ eventEmitter, manifest, init, call, customMessage, requestLogin, uiResponse, renderWebUSBButton, disableWebUSB, cancel, dispose, }) => {
|
|
6
|
+
const api = {
|
|
7
|
+
manifest,
|
|
8
|
+
init,
|
|
9
|
+
getSettings: () => call({ method: 'getSettings' }),
|
|
10
|
+
on: (type, fn) => {
|
|
11
|
+
eventEmitter.on(type, fn);
|
|
12
|
+
},
|
|
13
|
+
off: (type, fn) => {
|
|
14
|
+
eventEmitter.removeListener(type, fn);
|
|
15
|
+
},
|
|
16
|
+
removeAllListeners: type => {
|
|
17
|
+
eventEmitter.removeAllListeners(type);
|
|
18
|
+
},
|
|
19
|
+
uiResponse,
|
|
20
|
+
blockchainGetAccountBalanceHistory: params => call({ ...params, method: 'blockchainGetAccountBalanceHistory' }),
|
|
21
|
+
blockchainGetCurrentFiatRates: params => call({ ...params, method: 'blockchainGetCurrentFiatRates' }),
|
|
22
|
+
blockchainGetFiatRatesForTimestamps: params => call({ ...params, method: 'blockchainGetFiatRatesForTimestamps' }),
|
|
23
|
+
blockchainDisconnect: params => call({ ...params, method: 'blockchainDisconnect' }),
|
|
24
|
+
blockchainEstimateFee: params => call({ ...params, method: 'blockchainEstimateFee' }),
|
|
25
|
+
blockchainGetTransactions: params => call({ ...params, method: 'blockchainGetTransactions' }),
|
|
26
|
+
blockchainSetCustomBackend: params => call({ ...params, method: 'blockchainSetCustomBackend' }),
|
|
27
|
+
blockchainSubscribe: params => call({ ...params, method: 'blockchainSubscribe' }),
|
|
28
|
+
blockchainSubscribeFiatRates: params => call({ ...params, method: 'blockchainSubscribeFiatRates' }),
|
|
29
|
+
blockchainUnsubscribe: params => call({ ...params, method: 'blockchainUnsubscribe' }),
|
|
30
|
+
blockchainUnsubscribeFiatRates: params => call({ ...params, method: 'blockchainUnsubscribeFiatRates' }),
|
|
31
|
+
customMessage: params => customMessage(params),
|
|
32
|
+
requestLogin: params => requestLogin(params),
|
|
33
|
+
cardanoGetAddress: params => call({
|
|
34
|
+
...params,
|
|
35
|
+
method: 'cardanoGetAddress',
|
|
36
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
37
|
+
}),
|
|
38
|
+
cardanoGetNativeScriptHash: params => call({ ...params, method: 'cardanoGetNativeScriptHash' }),
|
|
39
|
+
cardanoGetPublicKey: params => call({ ...params, method: 'cardanoGetPublicKey' }),
|
|
40
|
+
cardanoSignTransaction: params => call({ ...params, method: 'cardanoSignTransaction' }),
|
|
41
|
+
cipherKeyValue: params => call({ ...params, method: 'cipherKeyValue' }),
|
|
42
|
+
composeTransaction: params => call({ ...params, method: 'composeTransaction' }),
|
|
43
|
+
ethereumGetAddress: params => call({
|
|
44
|
+
...params,
|
|
45
|
+
method: 'ethereumGetAddress',
|
|
46
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
47
|
+
}),
|
|
48
|
+
ethereumGetPublicKey: params => call({ ...params, method: 'ethereumGetPublicKey' }),
|
|
49
|
+
ethereumSignMessage: params => call({ ...params, method: 'ethereumSignMessage' }),
|
|
50
|
+
ethereumSignTransaction: params => call({ ...params, method: 'ethereumSignTransaction' }),
|
|
51
|
+
ethereumSignTypedData: params => call({ ...params, method: 'ethereumSignTypedData' }),
|
|
52
|
+
ethereumVerifyMessage: params => call({ ...params, method: 'ethereumVerifyMessage' }),
|
|
53
|
+
getAccountInfo: params => call({ ...params, method: 'getAccountInfo' }),
|
|
54
|
+
getAddress: params => call({
|
|
55
|
+
...params,
|
|
56
|
+
method: 'getAddress',
|
|
57
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
58
|
+
}),
|
|
59
|
+
getDeviceState: params => call({ ...params, method: 'getDeviceState' }),
|
|
60
|
+
getFeatures: params => call({ ...params, method: 'getFeatures' }),
|
|
61
|
+
getOwnershipId: params => call({ ...params, method: 'getOwnershipId' }),
|
|
62
|
+
getOwnershipProof: params => call({ ...params, method: 'getOwnershipProof' }),
|
|
63
|
+
getPublicKey: params => call({ ...params, method: 'getPublicKey' }),
|
|
64
|
+
nemGetAddress: params => call({
|
|
65
|
+
...params,
|
|
66
|
+
method: 'nemGetAddress',
|
|
67
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
68
|
+
}),
|
|
69
|
+
nemSignTransaction: params => call({ ...params, method: 'nemSignTransaction' }),
|
|
70
|
+
pushTransaction: params => call({ ...params, method: 'pushTransaction' }),
|
|
71
|
+
rippleGetAddress: params => call({
|
|
72
|
+
...params,
|
|
73
|
+
method: 'rippleGetAddress',
|
|
74
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
75
|
+
}),
|
|
76
|
+
rippleSignTransaction: params => call({ ...params, method: 'rippleSignTransaction' }),
|
|
77
|
+
signMessage: params => call({ ...params, method: 'signMessage' }),
|
|
78
|
+
signTransaction: params => call({ ...params, method: 'signTransaction' }),
|
|
79
|
+
stellarGetAddress: params => call({
|
|
80
|
+
...params,
|
|
81
|
+
method: 'stellarGetAddress',
|
|
82
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
83
|
+
}),
|
|
84
|
+
stellarSignTransaction: params => call({ ...params, method: 'stellarSignTransaction' }),
|
|
85
|
+
tezosGetAddress: params => call({
|
|
86
|
+
...params,
|
|
87
|
+
method: 'tezosGetAddress',
|
|
88
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
89
|
+
}),
|
|
90
|
+
tezosGetPublicKey: params => call({ ...params, method: 'tezosGetPublicKey' }),
|
|
91
|
+
tezosSignTransaction: params => call({ ...params, method: 'tezosSignTransaction' }),
|
|
92
|
+
eosGetPublicKey: params => call({ ...params, method: 'eosGetPublicKey' }),
|
|
93
|
+
eosSignTransaction: params => call({ ...params, method: 'eosSignTransaction' }),
|
|
94
|
+
binanceGetAddress: params => call({
|
|
95
|
+
...params,
|
|
96
|
+
method: 'binanceGetAddress',
|
|
97
|
+
useEventListener: eventEmitter.listenerCount(events_1.UI.ADDRESS_VALIDATION) > 0,
|
|
98
|
+
}),
|
|
99
|
+
binanceGetPublicKey: params => call({ ...params, method: 'binanceGetPublicKey' }),
|
|
100
|
+
binanceSignTransaction: params => call({ ...params, method: 'binanceSignTransaction' }),
|
|
101
|
+
verifyMessage: params => call({ ...params, method: 'verifyMessage' }),
|
|
102
|
+
resetDevice: params => call({ ...params, method: 'resetDevice' }),
|
|
103
|
+
wipeDevice: params => call({ ...params, method: 'wipeDevice' }),
|
|
104
|
+
applyFlags: params => call({ ...params, method: 'applyFlags' }),
|
|
105
|
+
applySettings: params => call({ ...params, method: 'applySettings' }),
|
|
106
|
+
authorizeCoinJoin: params => call({ ...params, method: 'authorizeCoinJoin' }),
|
|
107
|
+
backupDevice: params => call({ ...params, method: 'backupDevice' }),
|
|
108
|
+
changePin: params => call({ ...params, method: 'changePin' }),
|
|
109
|
+
firmwareUpdate: params => call({ ...params, method: 'firmwareUpdate' }),
|
|
110
|
+
recoveryDevice: params => call({ ...params, method: 'recoveryDevice' }),
|
|
111
|
+
getCoinInfo: params => call({ ...params, method: 'getCoinInfo' }),
|
|
112
|
+
rebootToBootloader: params => call({ ...params, method: 'rebootToBootloader' }),
|
|
113
|
+
setProxy: params => call({ ...params, method: 'setProxy' }),
|
|
114
|
+
dispose,
|
|
115
|
+
cancel,
|
|
116
|
+
renderWebUSBButton,
|
|
117
|
+
disableWebUSB,
|
|
118
|
+
};
|
|
119
|
+
return api;
|
|
120
|
+
};
|
|
121
|
+
exports.factory = factory;
|
|
122
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const errors_1 = require("./constants/errors");
|
|
5
|
+
const factory_1 = require("./factory");
|
|
6
|
+
const fallback = () => {
|
|
7
|
+
throw (0, errors_1.TypedError)('Method_InvalidPackage');
|
|
8
|
+
};
|
|
9
|
+
const TrezorConnect = (0, factory_1.factory)({
|
|
10
|
+
eventEmitter: {
|
|
11
|
+
on: fallback,
|
|
12
|
+
off: fallback,
|
|
13
|
+
removeAllListeners: fallback,
|
|
14
|
+
listenerCount: fallback,
|
|
15
|
+
},
|
|
16
|
+
manifest: fallback,
|
|
17
|
+
init: fallback,
|
|
18
|
+
call: fallback,
|
|
19
|
+
customMessage: fallback,
|
|
20
|
+
requestLogin: fallback,
|
|
21
|
+
uiResponse: fallback,
|
|
22
|
+
renderWebUSBButton: fallback,
|
|
23
|
+
disableWebUSB: fallback,
|
|
24
|
+
cancel: fallback,
|
|
25
|
+
dispose: fallback,
|
|
26
|
+
});
|
|
27
|
+
exports.default = TrezorConnect;
|
|
28
|
+
(0, tslib_1.__exportStar)(require("./exports"), exports);
|
|
29
|
+
//# sourceMappingURL=index-browser.js.map
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import EventEmitter from 'events';
|
|
3
|
+
import { Deferred } from '@trezor/utils';
|
|
4
|
+
export declare const eventEmitter: EventEmitter;
|
|
5
|
+
export declare const messagePromises: {
|
|
6
|
+
[key: number]: Deferred<any>;
|
|
7
|
+
};
|
|
8
|
+
declare const TrezorConnect: import("./types").TrezorConnect;
|
|
9
|
+
export default TrezorConnect;
|
|
10
|
+
export * from './exports';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messagePromises = exports.eventEmitter = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const events_1 = (0, tslib_1.__importDefault)(require("events"));
|
|
6
|
+
const utils_1 = require("@trezor/utils");
|
|
7
|
+
const core_1 = require("./core");
|
|
8
|
+
const factory_1 = require("./factory");
|
|
9
|
+
const connectSettings_1 = require("./data/connectSettings");
|
|
10
|
+
const debug_1 = require("./utils/debug");
|
|
11
|
+
const events_2 = require("./events");
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
exports.eventEmitter = new events_1.default();
|
|
14
|
+
const _log = (0, debug_1.initLog)('@trezor/connect');
|
|
15
|
+
let _settings = (0, connectSettings_1.parseConnectSettings)();
|
|
16
|
+
let _core = null;
|
|
17
|
+
let _messageID = 0;
|
|
18
|
+
exports.messagePromises = {};
|
|
19
|
+
const manifest = (data) => {
|
|
20
|
+
_settings = (0, connectSettings_1.parseConnectSettings)({
|
|
21
|
+
..._settings,
|
|
22
|
+
manifest: data,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const dispose = () => {
|
|
26
|
+
exports.eventEmitter.removeAllListeners();
|
|
27
|
+
_settings = (0, connectSettings_1.parseConnectSettings)();
|
|
28
|
+
if (_core) {
|
|
29
|
+
_core.dispose();
|
|
30
|
+
_core = null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const handleMessage = (message) => {
|
|
34
|
+
const { event, type, payload } = message;
|
|
35
|
+
const id = message.id || 0;
|
|
36
|
+
if (!_core)
|
|
37
|
+
return;
|
|
38
|
+
if (type === events_2.UI.REQUEST_UI_WINDOW) {
|
|
39
|
+
_core.handleMessage({ event: events_2.UI_EVENT, type: events_2.POPUP.HANDSHAKE }, true);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (type === events_2.POPUP.CANCEL_POPUP_REQUEST)
|
|
43
|
+
return;
|
|
44
|
+
_log.debug('handleMessage', message);
|
|
45
|
+
switch (event) {
|
|
46
|
+
case events_2.RESPONSE_EVENT:
|
|
47
|
+
if (exports.messagePromises[id]) {
|
|
48
|
+
exports.messagePromises[id].resolve({
|
|
49
|
+
id,
|
|
50
|
+
success: message.success,
|
|
51
|
+
payload,
|
|
52
|
+
});
|
|
53
|
+
delete exports.messagePromises[id];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
_log.warn(`Unknown message id ${id}`);
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
case events_2.DEVICE_EVENT:
|
|
60
|
+
exports.eventEmitter.emit(event, message);
|
|
61
|
+
exports.eventEmitter.emit(type, payload);
|
|
62
|
+
break;
|
|
63
|
+
case events_2.TRANSPORT_EVENT:
|
|
64
|
+
exports.eventEmitter.emit(event, message);
|
|
65
|
+
exports.eventEmitter.emit(type, payload);
|
|
66
|
+
break;
|
|
67
|
+
case events_2.BLOCKCHAIN_EVENT:
|
|
68
|
+
exports.eventEmitter.emit(event, message);
|
|
69
|
+
exports.eventEmitter.emit(type, payload);
|
|
70
|
+
break;
|
|
71
|
+
case events_2.UI_EVENT:
|
|
72
|
+
exports.eventEmitter.emit(event, message);
|
|
73
|
+
exports.eventEmitter.emit(type, payload);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
_log.warn('Undefined message', event, message);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
function postMessage(message, usePromise = true) {
|
|
80
|
+
if (!_core) {
|
|
81
|
+
throw constants_1.ERRORS.TypedError('Runtime', 'postMessage: _core not found');
|
|
82
|
+
}
|
|
83
|
+
if (usePromise) {
|
|
84
|
+
_messageID++;
|
|
85
|
+
exports.messagePromises[_messageID] = (0, utils_1.createDeferred)();
|
|
86
|
+
const { promise } = exports.messagePromises[_messageID];
|
|
87
|
+
_core.handleMessage({ ...message, id: _messageID }, true);
|
|
88
|
+
return promise;
|
|
89
|
+
}
|
|
90
|
+
_core.handleMessage(message, true);
|
|
91
|
+
}
|
|
92
|
+
const init = async (settings = {}) => {
|
|
93
|
+
if (_core) {
|
|
94
|
+
throw constants_1.ERRORS.TypedError('Init_AlreadyInitialized');
|
|
95
|
+
}
|
|
96
|
+
_settings = (0, connectSettings_1.parseConnectSettings)({ ..._settings, ...settings });
|
|
97
|
+
_settings.origin = 'http://node.trezor.io/';
|
|
98
|
+
_settings.popup = false;
|
|
99
|
+
_settings.env = 'node';
|
|
100
|
+
if (!_settings.manifest) {
|
|
101
|
+
throw constants_1.ERRORS.TypedError('Init_ManifestMissing');
|
|
102
|
+
}
|
|
103
|
+
if (_settings.lazyLoad) {
|
|
104
|
+
_settings.lazyLoad = false;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
_core = await (0, core_1.init)(_settings);
|
|
108
|
+
_core.on(events_2.CORE_EVENT, handleMessage);
|
|
109
|
+
await (0, core_1.initTransport)(_settings);
|
|
110
|
+
};
|
|
111
|
+
const call = async (params) => {
|
|
112
|
+
if (!_core) {
|
|
113
|
+
try {
|
|
114
|
+
await init(_settings);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
return (0, events_2.createErrorMessage)(error);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
try {
|
|
121
|
+
const response = await postMessage({
|
|
122
|
+
type: events_2.IFRAME.CALL,
|
|
123
|
+
payload: params,
|
|
124
|
+
});
|
|
125
|
+
if (response) {
|
|
126
|
+
return response;
|
|
127
|
+
}
|
|
128
|
+
return (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_NoResponse'));
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
_log.error('call', error);
|
|
132
|
+
return (0, events_2.createErrorMessage)(error);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const customMessageResponse = (payload) => {
|
|
136
|
+
if (!_core) {
|
|
137
|
+
return Promise.resolve((0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Init_NotInitialized')));
|
|
138
|
+
}
|
|
139
|
+
_core.handleMessage({
|
|
140
|
+
event: events_2.UI_EVENT,
|
|
141
|
+
type: events_2.UI.CUSTOM_MESSAGE_RESPONSE,
|
|
142
|
+
payload,
|
|
143
|
+
}, true);
|
|
144
|
+
};
|
|
145
|
+
const uiResponse = (response) => {
|
|
146
|
+
if (!_core) {
|
|
147
|
+
throw constants_1.ERRORS.TypedError('Init_NotInitialized');
|
|
148
|
+
}
|
|
149
|
+
const { type, payload } = response;
|
|
150
|
+
_core.handleMessage({ event: events_2.UI_EVENT, type, payload }, true);
|
|
151
|
+
};
|
|
152
|
+
const customMessage = async (params) => {
|
|
153
|
+
if (typeof params.callback !== 'function') {
|
|
154
|
+
return (0, events_2.createErrorMessage)(constants_1.ERRORS.TypedError('Method_CustomMessage_Callback'));
|
|
155
|
+
}
|
|
156
|
+
const { callback } = params;
|
|
157
|
+
const customMessageListener = async (event) => {
|
|
158
|
+
const { data } = event;
|
|
159
|
+
if (data && data.type === events_2.UI.CUSTOM_MESSAGE_REQUEST) {
|
|
160
|
+
const payload = await callback(data.payload);
|
|
161
|
+
if (payload) {
|
|
162
|
+
customMessageResponse(payload);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
customMessageResponse({ message: 'release' });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
_core === null || _core === void 0 ? void 0 : _core.on(events_2.CORE_EVENT, customMessageListener);
|
|
170
|
+
const response = await call({ method: 'customMessage', ...params, callback: null });
|
|
171
|
+
_core === null || _core === void 0 ? void 0 : _core.removeListener(events_2.CORE_EVENT, customMessageListener);
|
|
172
|
+
return response;
|
|
173
|
+
};
|
|
174
|
+
const requestLogin = async (params) => {
|
|
175
|
+
if (typeof params.callback === 'function') {
|
|
176
|
+
const { callback } = params;
|
|
177
|
+
const loginChallengeListener = async (event) => {
|
|
178
|
+
const { data } = event;
|
|
179
|
+
if (data && data.type === events_2.UI.LOGIN_CHALLENGE_REQUEST) {
|
|
180
|
+
try {
|
|
181
|
+
const payload = await callback();
|
|
182
|
+
_core === null || _core === void 0 ? void 0 : _core.handleMessage({
|
|
183
|
+
event: events_2.UI_EVENT,
|
|
184
|
+
type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
|
|
185
|
+
payload,
|
|
186
|
+
}, true);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
_core === null || _core === void 0 ? void 0 : _core.handleMessage({
|
|
190
|
+
event: events_2.UI_EVENT,
|
|
191
|
+
type: events_2.UI.LOGIN_CHALLENGE_RESPONSE,
|
|
192
|
+
payload: error.message,
|
|
193
|
+
}, true);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
_core === null || _core === void 0 ? void 0 : _core.on(events_2.CORE_EVENT, loginChallengeListener);
|
|
198
|
+
const response = await call({
|
|
199
|
+
method: 'requestLogin',
|
|
200
|
+
...params,
|
|
201
|
+
asyncChallenge: true,
|
|
202
|
+
callback: null,
|
|
203
|
+
});
|
|
204
|
+
_core === null || _core === void 0 ? void 0 : _core.removeListener(events_2.CORE_EVENT, loginChallengeListener);
|
|
205
|
+
return response;
|
|
206
|
+
}
|
|
207
|
+
return call({ method: 'requestLogin', ...params });
|
|
208
|
+
};
|
|
209
|
+
const cancel = (error) => {
|
|
210
|
+
postMessage({
|
|
211
|
+
type: events_2.POPUP.CLOSED,
|
|
212
|
+
payload: error ? { error } : null,
|
|
213
|
+
}, false);
|
|
214
|
+
};
|
|
215
|
+
const renderWebUSBButton = (_className) => {
|
|
216
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidPackage');
|
|
217
|
+
};
|
|
218
|
+
const disableWebUSB = () => {
|
|
219
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidPackage');
|
|
220
|
+
};
|
|
221
|
+
const TrezorConnect = (0, factory_1.factory)({
|
|
222
|
+
eventEmitter: exports.eventEmitter,
|
|
223
|
+
manifest,
|
|
224
|
+
init,
|
|
225
|
+
call,
|
|
226
|
+
customMessage,
|
|
227
|
+
requestLogin,
|
|
228
|
+
uiResponse,
|
|
229
|
+
renderWebUSBButton,
|
|
230
|
+
disableWebUSB,
|
|
231
|
+
cancel,
|
|
232
|
+
dispose,
|
|
233
|
+
});
|
|
234
|
+
exports.default = TrezorConnect;
|
|
235
|
+
(0, tslib_1.__exportStar)(require("./exports"), exports);
|
|
236
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AccountInfo as AccountInfoBase, AccountAddresses, Utxo as AccountUtxo } from '@trezor/blockchain-link';
|
|
2
|
+
export type { AccountAddresses, Utxo as AccountUtxo, Address as AccountAddress, } from '@trezor/blockchain-link';
|
|
3
|
+
export declare type DiscoveryAccountType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh';
|
|
4
|
+
export interface AccountInfo extends AccountInfoBase {
|
|
5
|
+
path?: string;
|
|
6
|
+
legacyXpub?: string;
|
|
7
|
+
utxo?: AccountUtxo[];
|
|
8
|
+
}
|
|
9
|
+
export interface DiscoveryAccount {
|
|
10
|
+
type: DiscoveryAccountType;
|
|
11
|
+
label: string;
|
|
12
|
+
descriptor: string;
|
|
13
|
+
address_n: number[];
|
|
14
|
+
empty?: boolean;
|
|
15
|
+
balance?: string;
|
|
16
|
+
addresses?: AccountAddresses;
|
|
17
|
+
}
|
|
18
|
+
export interface FeeLevel {
|
|
19
|
+
label: 'high' | 'normal' | 'economy' | 'low' | 'custom';
|
|
20
|
+
feePerUnit: string;
|
|
21
|
+
blocks: number;
|
|
22
|
+
feeLimit?: string;
|
|
23
|
+
feePerTx?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare type SelectFeeLevel = {
|
|
26
|
+
name: string;
|
|
27
|
+
fee: '0';
|
|
28
|
+
feePerByte?: undefined;
|
|
29
|
+
disabled: true;
|
|
30
|
+
} | {
|
|
31
|
+
name: string;
|
|
32
|
+
fee: string;
|
|
33
|
+
feePerByte: string;
|
|
34
|
+
minutes: number;
|
|
35
|
+
total: string;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PROTO } from '../../constants';
|
|
2
|
+
import type { Params, Response } from '../params';
|
|
3
|
+
export interface AuthorizeCoinJoin {
|
|
4
|
+
path: string | number[];
|
|
5
|
+
coordinator: string;
|
|
6
|
+
maxRounds: number;
|
|
7
|
+
maxCoordinatorFeeRate: number;
|
|
8
|
+
maxFeePerKvbyte: number;
|
|
9
|
+
coin?: string;
|
|
10
|
+
scriptType?: PROTO.InternalInputScriptType;
|
|
11
|
+
amountUnit?: PROTO.AmountUnit;
|
|
12
|
+
}
|
|
13
|
+
export declare function authorizeCoinJoin(params: Params<AuthorizeCoinJoin>): Response<PROTO.Success>;
|
|
14
|
+
//# sourceMappingURL=authorizeCoinJoin.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GetAddress, Address, Params, BundledParams, Response } from '../params';
|
|
2
|
+
export declare function binanceGetAddress(params: Params<GetAddress>): Response<Address>;
|
|
3
|
+
export declare function binanceGetAddress(params: BundledParams<GetAddress>): Response<Address[]>;
|
|
4
|
+
//# sourceMappingURL=binanceGetAddress.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GetPublicKey, PublicKey, Params, BundledParams, Response } from '../params';
|
|
2
|
+
export declare function binanceGetPublicKey(params: Params<GetPublicKey>): Response<PublicKey>;
|
|
3
|
+
export declare function binanceGetPublicKey(params: BundledParams<GetPublicKey>): Response<PublicKey[]>;
|
|
4
|
+
//# sourceMappingURL=binanceGetPublicKey.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PROTO } from '../../constants';
|
|
2
|
+
import type { Params, Response } from '../params';
|
|
3
|
+
export interface BinanceSDKTransaction {
|
|
4
|
+
chain_id: string;
|
|
5
|
+
account_number?: number;
|
|
6
|
+
memo?: string;
|
|
7
|
+
sequence?: number;
|
|
8
|
+
source?: number;
|
|
9
|
+
transfer?: PROTO.BinanceTransferMsg;
|
|
10
|
+
placeOrder?: PROTO.BinanceOrderMsg;
|
|
11
|
+
cancelOrder?: PROTO.BinanceCancelMsg;
|
|
12
|
+
}
|
|
13
|
+
export declare type BinancePreparedMessage = (PROTO.BinanceTransferMsg & {
|
|
14
|
+
type: 'BinanceTransferMsg';
|
|
15
|
+
}) | (PROTO.BinanceOrderMsg & {
|
|
16
|
+
type: 'BinanceOrderMsg';
|
|
17
|
+
}) | (PROTO.BinanceCancelMsg & {
|
|
18
|
+
type: 'BinanceCancelMsg';
|
|
19
|
+
});
|
|
20
|
+
export interface BinancePreparedTransaction extends BinanceSDKTransaction {
|
|
21
|
+
messages: BinancePreparedMessage[];
|
|
22
|
+
account_number: number;
|
|
23
|
+
sequence: number;
|
|
24
|
+
source: number;
|
|
25
|
+
}
|
|
26
|
+
export interface BinanceSignTransaction {
|
|
27
|
+
path: string | number[];
|
|
28
|
+
transaction: BinanceSDKTransaction;
|
|
29
|
+
}
|
|
30
|
+
export declare function binanceSignTransaction(params: Params<BinanceSignTransaction>): Response<PROTO.BinanceSignedTx>;
|
|
31
|
+
//# sourceMappingURL=binanceSignTransaction.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BlockchainLinkParams, BlockchainLinkResponse } from '@trezor/blockchain-link';
|
|
2
|
+
import type { FeeLevel } from '../account';
|
|
3
|
+
import type { CommonParamsWithCoin, Response } from '../params';
|
|
4
|
+
export interface BlockchainEstimateFee {
|
|
5
|
+
request?: BlockchainLinkParams<'estimateFee'> & {
|
|
6
|
+
feeLevels?: undefined;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface BlockchainEstimateFeeLevel {
|
|
10
|
+
request: BlockchainLinkParams<'estimateFee'> & {
|
|
11
|
+
feeLevels: 'preloaded' | 'smart';
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface EstimatedFee {
|
|
15
|
+
blockTime: number;
|
|
16
|
+
minFee: number;
|
|
17
|
+
maxFee: number;
|
|
18
|
+
dustLimit?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface BlockchainEstimatedFee extends EstimatedFee {
|
|
21
|
+
levels: BlockchainLinkResponse<'estimateFee'>;
|
|
22
|
+
}
|
|
23
|
+
export interface BlockchainEstimatedFeeLevel extends EstimatedFee {
|
|
24
|
+
levels: FeeLevel[];
|
|
25
|
+
}
|
|
26
|
+
export declare function blockchainEstimateFee(params: CommonParamsWithCoin & BlockchainEstimateFee): Response<BlockchainEstimatedFee>;
|
|
27
|
+
export declare function blockchainEstimateFee(params: CommonParamsWithCoin & BlockchainEstimateFeeLevel): Response<BlockchainEstimatedFeeLevel>;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=blockchainEstimateFee.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BlockchainLinkParams, BlockchainLinkResponse } from '@trezor/blockchain-link';
|
|
2
|
+
import type { CommonParamsWithCoin, Response } from '../params';
|
|
3
|
+
export declare function blockchainGetAccountBalanceHistory(params: CommonParamsWithCoin & BlockchainLinkParams<'getAccountBalanceHistory'>): Response<BlockchainLinkResponse<'getAccountBalanceHistory'>>;
|
|
4
|
+
//# sourceMappingURL=blockchainGetAccountBalanceHistory.d.ts.map
|