@trezor/connect 10.0.0-beta.1 → 10.0.0-beta.2
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/CHANGELOG.md +56 -9
- package/README.md +4 -2
- package/lib/exports.d.ts +1 -3
- package/lib/exports.js +1 -3
- package/lib/impl/core-in-module-native.d.ts +7 -0
- package/lib/impl/core-in-module-native.js +11 -0
- package/lib/impl/core-in-module-node.d.ts +8 -0
- package/lib/impl/core-in-module-node.js +12 -0
- package/lib/impl/core-in-module-web.d.ts +9 -0
- package/lib/impl/core-in-module-web.js +26 -0
- package/lib/index.browser.js +2 -26
- package/lib/index.js +1 -11
- package/lib/index.native.d.ts +4 -0
- package/lib/index.native.js +5 -0
- package/package.json +16 -67
- package/lib/api/applyFlags.d.ts +0 -20
- package/lib/api/applyFlags.js +0 -38
- package/lib/api/applySettings.d.ts +0 -20
- package/lib/api/applySettings.js +0 -57
- package/lib/api/authenticateDevice.d.ts +0 -25
- package/lib/api/authenticateDevice.js +0 -195
- package/lib/api/authorizeCoinjoin.d.ts +0 -11
- package/lib/api/authorizeCoinjoin.js +0 -44
- package/lib/api/backupDevice.d.ts +0 -19
- package/lib/api/backupDevice.js +0 -39
- package/lib/api/bitcoin/TransactionComposer.d.ts +0 -46
- package/lib/api/bitcoin/TransactionComposer.js +0 -147
- package/lib/api/bitcoin/createPendingTx.d.ts +0 -37
- package/lib/api/bitcoin/createPendingTx.js +0 -55
- package/lib/api/bitcoin/enhanceSignTx.d.ts +0 -2
- package/lib/api/bitcoin/enhanceSignTx.js +0 -23
- package/lib/api/bitcoin/index.d.ts +0 -9
- package/lib/api/bitcoin/index.js +0 -9
- package/lib/api/bitcoin/inputs.d.ts +0 -4
- package/lib/api/bitcoin/inputs.js +0 -63
- package/lib/api/bitcoin/outputs.d.ts +0 -5
- package/lib/api/bitcoin/outputs.js +0 -128
- package/lib/api/bitcoin/refTx.d.ts +0 -23
- package/lib/api/bitcoin/refTx.js +0 -249
- package/lib/api/bitcoin/signtx.d.ts +0 -30
- package/lib/api/bitcoin/signtx.js +0 -229
- package/lib/api/bitcoin/signtxLegacy.d.ts +0 -10
- package/lib/api/bitcoin/signtxLegacy.js +0 -186
- package/lib/api/bitcoin/signtxVerify.d.ts +0 -12
- package/lib/api/bitcoin/signtxVerify.js +0 -95
- package/lib/api/bitcoin/transactionBytes.d.ts +0 -3
- package/lib/api/bitcoin/transactionBytes.js +0 -65
- package/lib/api/bleUnpair.d.ts +0 -11
- package/lib/api/bleUnpair.js +0 -37
- package/lib/api/blockchainDisconnect.d.ts +0 -16
- package/lib/api/blockchainDisconnect.js +0 -37
- package/lib/api/blockchainEstimateFee.d.ts +0 -16
- package/lib/api/blockchainEstimateFee.js +0 -102
- package/lib/api/blockchainEvmRpcCall.d.ts +0 -19
- package/lib/api/blockchainEvmRpcCall.js +0 -57
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +0 -16
- package/lib/api/blockchainGetAccountBalanceHistory.js +0 -60
- package/lib/api/blockchainGetContractInfo.d.ts +0 -16
- package/lib/api/blockchainGetContractInfo.js +0 -46
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +0 -20
- package/lib/api/blockchainGetCurrentFiatRates.js +0 -49
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +0 -23
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +0 -55
- package/lib/api/blockchainGetInfo.d.ts +0 -15
- package/lib/api/blockchainGetInfo.js +0 -37
- package/lib/api/blockchainGetTransactions.d.ts +0 -18
- package/lib/api/blockchainGetTransactions.js +0 -47
- package/lib/api/blockchainSetCustomBackend.d.ts +0 -17
- package/lib/api/blockchainSetCustomBackend.js +0 -43
- package/lib/api/blockchainSubscribe.d.ts +0 -19
- package/lib/api/blockchainSubscribe.js +0 -66
- package/lib/api/blockchainSubscribeFiatRates.d.ts +0 -19
- package/lib/api/blockchainSubscribeFiatRates.js +0 -43
- package/lib/api/blockchainUnsubscribe.d.ts +0 -19
- package/lib/api/blockchainUnsubscribe.js +0 -66
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +0 -17
- package/lib/api/blockchainUnsubscribeFiatRates.js +0 -37
- package/lib/api/blockchainValidateEvmRpcUrl.d.ts +0 -17
- package/lib/api/blockchainValidateEvmRpcUrl.js +0 -54
- package/lib/api/cancelCoinjoinAuthorization.d.ts +0 -11
- package/lib/api/cancelCoinjoinAuthorization.js +0 -33
- package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +0 -10
- package/lib/api/cardano/api/cardanoComposeTransaction.js +0 -84
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +0 -34
- package/lib/api/cardano/api/cardanoGetAddress.js +0 -130
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.d.ts +0 -12
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +0 -66
- package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +0 -22
- package/lib/api/cardano/api/cardanoGetPublicKey.js +0 -92
- package/lib/api/cardano/api/cardanoSignMessage.d.ts +0 -22
- package/lib/api/cardano/api/cardanoSignMessage.js +0 -90
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +0 -81
- package/lib/api/cardano/api/cardanoSignTransaction.js +0 -301
- package/lib/api/cardano/api/index.d.ts +0 -6
- package/lib/api/cardano/api/index.js +0 -6
- package/lib/api/cardano/cardanoAddressParameters.d.ts +0 -6
- package/lib/api/cardano/cardanoAddressParameters.js +0 -79
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +0 -4
- package/lib/api/cardano/cardanoAuxiliaryData.js +0 -74
- package/lib/api/cardano/cardanoCertificate.d.ts +0 -13
- package/lib/api/cardano/cardanoCertificate.js +0 -142
- package/lib/api/cardano/cardanoInputs.d.ts +0 -25
- package/lib/api/cardano/cardanoInputs.js +0 -39
- package/lib/api/cardano/cardanoOutputs.d.ts +0 -40
- package/lib/api/cardano/cardanoOutputs.js +0 -70
- package/lib/api/cardano/cardanoTokenBundle.d.ts +0 -12
- package/lib/api/cardano/cardanoTokenBundle.js +0 -21
- package/lib/api/cardano/cardanoUtils.d.ts +0 -17
- package/lib/api/cardano/cardanoUtils.js +0 -100
- package/lib/api/cardano/cardanoWitnesses.d.ts +0 -4
- package/lib/api/cardano/cardanoWitnesses.js +0 -47
- package/lib/api/changeLanguage.d.ts +0 -18
- package/lib/api/changeLanguage.js +0 -49
- package/lib/api/changePin.d.ts +0 -11
- package/lib/api/changePin.js +0 -27
- package/lib/api/changeWipeCode.d.ts +0 -11
- package/lib/api/changeWipeCode.js +0 -29
- package/lib/api/cipherKeyValue.d.ts +0 -17
- package/lib/api/cipherKeyValue.js +0 -58
- package/lib/api/common/AbstractMiscGetAddress.d.ts +0 -37
- package/lib/api/common/AbstractMiscGetAddress.js +0 -126
- package/lib/api/common/Discovery.d.ts +0 -33
- package/lib/api/common/Discovery.js +0 -119
- package/lib/api/common/paramsValidator.d.ts +0 -24
- package/lib/api/common/paramsValidator.js +0 -136
- package/lib/api/common/requestExistingAccounts.d.ts +0 -14
- package/lib/api/common/requestExistingAccounts.js +0 -20
- package/lib/api/composeTransaction.d.ts +0 -36
- package/lib/api/composeTransaction.js +0 -404
- package/lib/api/discoverAccounts.d.ts +0 -40
- package/lib/api/discoverAccounts.js +0 -360
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +0 -30
- package/lib/api/ethereum/api/ethereumGetAddress.js +0 -150
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +0 -52
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +0 -100
- package/lib/api/ethereum/api/ethereumSignMessage.d.ts +0 -27
- package/lib/api/ethereum/api/ethereumSignMessage.js +0 -64
- package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +0 -83
- package/lib/api/ethereum/api/ethereumSignTransaction.js +0 -148
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +0 -117
- package/lib/api/ethereum/api/ethereumSignTypedData.js +0 -203
- package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +0 -12
- package/lib/api/ethereum/api/ethereumVerifyMessage.js +0 -35
- package/lib/api/ethereum/api/index.d.ts +0 -6
- package/lib/api/ethereum/api/index.js +0 -6
- package/lib/api/ethereum/ethereumDefinitions.d.ts +0 -53
- package/lib/api/ethereum/ethereumDefinitions.js +0 -135
- package/lib/api/ethereum/ethereumSignTx.d.ts +0 -16
- package/lib/api/ethereum/ethereumSignTx.js +0 -144
- package/lib/api/ethereum/ethereumSignTypedData.d.ts +0 -32
- package/lib/api/ethereum/ethereumSignTypedData.js +0 -175
- package/lib/api/evoluGetDelegatedIdentityKey.d.ts +0 -14
- package/lib/api/evoluGetDelegatedIdentityKey.js +0 -29
- package/lib/api/evoluGetNode.d.ts +0 -13
- package/lib/api/evoluGetNode.js +0 -29
- package/lib/api/evoluSignRegistrationRequest.d.ts +0 -16
- package/lib/api/evoluSignRegistrationRequest.js +0 -33
- package/lib/api/firmware/calculateFirmwareHash.d.ts +0 -18
- package/lib/api/firmware/calculateFirmwareHash.js +0 -56
- package/lib/api/firmware/calculateXPubHash.d.ts +0 -14
- package/lib/api/firmware/calculateXPubHash.js +0 -16
- package/lib/api/firmware/getBinary.d.ts +0 -14
- package/lib/api/firmware/getBinary.js +0 -33
- package/lib/api/firmware/index.d.ts +0 -6
- package/lib/api/firmware/index.js +0 -6
- package/lib/api/firmware/modifyFirmware.d.ts +0 -3
- package/lib/api/firmware/modifyFirmware.js +0 -13
- package/lib/api/firmware/parseFirmwareHeaders.d.ts +0 -4
- package/lib/api/firmware/parseFirmwareHeaders.js +0 -26
- package/lib/api/firmware/uploadFirmware.d.ts +0 -27
- package/lib/api/firmware/uploadFirmware.js +0 -99
- package/lib/api/firmware/verifyEntropy.d.ts +0 -25
- package/lib/api/firmware/verifyEntropy.js +0 -110
- package/lib/api/getAccountInfo.d.ts +0 -21
- package/lib/api/getAccountInfo.js +0 -253
- package/lib/api/getAddress.d.ts +0 -45
- package/lib/api/getAddress.js +0 -153
- package/lib/api/getCoinInfo.d.ts +0 -148
- package/lib/api/getCoinInfo.js +0 -25
- package/lib/api/getDeviceState.d.ts +0 -8
- package/lib/api/getDeviceState.js +0 -18
- package/lib/api/getFeatures.d.ts +0 -71
- package/lib/api/getFeatures.js +0 -22
- package/lib/api/getFirmwareHash.d.ts +0 -11
- package/lib/api/getFirmwareHash.js +0 -29
- package/lib/api/getNonce.d.ts +0 -10
- package/lib/api/getNonce.js +0 -18
- package/lib/api/getOwnershipId.d.ts +0 -17
- package/lib/api/getOwnershipId.js +0 -88
- package/lib/api/getOwnershipProof.d.ts +0 -17
- package/lib/api/getOwnershipProof.js +0 -95
- package/lib/api/getPublicKey.d.ts +0 -54
- package/lib/api/getPublicKey.js +0 -106
- package/lib/api/getSettings.d.ts +0 -24
- package/lib/api/getSettings.js +0 -21
- package/lib/api/index.d.ts +0 -62
- package/lib/api/index.js +0 -62
- package/lib/api/loadDevice.d.ts +0 -16
- package/lib/api/loadDevice.js +0 -46
- package/lib/api/monero/api/index.d.ts +0 -4
- package/lib/api/monero/api/index.js +0 -4
- package/lib/api/monero/api/moneroGetAddress.d.ts +0 -32
- package/lib/api/monero/api/moneroGetAddress.js +0 -117
- package/lib/api/monero/api/moneroGetWatchKey.d.ts +0 -14
- package/lib/api/monero/api/moneroGetWatchKey.js +0 -45
- package/lib/api/monero/api/moneroKeyImageSync.d.ts +0 -17
- package/lib/api/monero/api/moneroKeyImageSync.js +0 -128
- package/lib/api/monero/api/moneroSignTransaction.d.ts +0 -17
- package/lib/api/monero/api/moneroSignTransaction.js +0 -218
- package/lib/api/nostr/nostrGetPublicKey.d.ts +0 -15
- package/lib/api/nostr/nostrGetPublicKey.js +0 -38
- package/lib/api/nostr/nostrSignEvent.d.ts +0 -13
- package/lib/api/nostr/nostrSignEvent.js +0 -36
- package/lib/api/pingDevice.d.ts +0 -11
- package/lib/api/pingDevice.js +0 -29
- package/lib/api/pushTransaction.d.ts +0 -19
- package/lib/api/pushTransaction.js +0 -39
- package/lib/api/recoveryDevice.d.ts +0 -20
- package/lib/api/recoveryDevice.js +0 -52
- package/lib/api/requestLogin.d.ts +0 -14
- package/lib/api/requestLogin.js +0 -53
- package/lib/api/resetDevice.d.ts +0 -22
- package/lib/api/resetDevice.js +0 -133
- package/lib/api/ripple/api/index.d.ts +0 -2
- package/lib/api/ripple/api/index.js +0 -2
- package/lib/api/ripple/api/rippleGetAddress.d.ts +0 -17
- package/lib/api/ripple/api/rippleGetAddress.js +0 -22
- package/lib/api/ripple/api/rippleSignTransaction.d.ts +0 -13
- package/lib/api/ripple/api/rippleSignTransaction.js +0 -52
- package/lib/api/selectAccount.d.ts +0 -15
- package/lib/api/selectAccount.js +0 -42
- package/lib/api/setBrightness.d.ts +0 -12
- package/lib/api/setBrightness.js +0 -28
- package/lib/api/setBusy.d.ts +0 -11
- package/lib/api/setBusy.js +0 -31
- package/lib/api/showDeviceTutorial.d.ts +0 -11
- package/lib/api/showDeviceTutorial.js +0 -21
- package/lib/api/signMessage.d.ts +0 -25
- package/lib/api/signMessage.js +0 -75
- package/lib/api/signTransaction.d.ts +0 -199
- package/lib/api/signTransaction.js +0 -331
- package/lib/api/solana/api/index.d.ts +0 -4
- package/lib/api/solana/api/index.js +0 -4
- package/lib/api/solana/api/solanaComposeTransaction.d.ts +0 -33
- package/lib/api/solana/api/solanaComposeTransaction.js +0 -73
- package/lib/api/solana/api/solanaGetAddress.d.ts +0 -17
- package/lib/api/solana/api/solanaGetAddress.js +0 -22
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +0 -32
- package/lib/api/solana/api/solanaGetPublicKey.js +0 -86
- package/lib/api/solana/api/solanaSignTransaction.d.ts +0 -41
- package/lib/api/solana/api/solanaSignTransaction.js +0 -204
- package/lib/api/solana/solanaDefinitions.d.ts +0 -9
- package/lib/api/solana/solanaDefinitions.js +0 -33
- package/lib/api/stellar/api/index.d.ts +0 -2
- package/lib/api/stellar/api/index.js +0 -2
- package/lib/api/stellar/api/stellarGetAddress.d.ts +0 -17
- package/lib/api/stellar/api/stellarGetAddress.js +0 -22
- package/lib/api/stellar/api/stellarSignTransaction.d.ts +0 -20
- package/lib/api/stellar/api/stellarSignTransaction.js +0 -65
- package/lib/api/stellar/stellarSignTx.d.ts +0 -7
- package/lib/api/stellar/stellarSignTx.js +0 -183
- package/lib/api/telemetryGet.d.ts +0 -14
- package/lib/api/telemetryGet.js +0 -26
- package/lib/api/tezos/api/index.d.ts +0 -3
- package/lib/api/tezos/api/index.js +0 -3
- package/lib/api/tezos/api/tezosGetAddress.d.ts +0 -17
- package/lib/api/tezos/api/tezosGetAddress.js +0 -22
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +0 -28
- package/lib/api/tezos/api/tezosGetPublicKey.js +0 -84
- package/lib/api/tezos/api/tezosSignTransaction.d.ts +0 -14
- package/lib/api/tezos/api/tezosSignTransaction.js +0 -30
- package/lib/api/tezos/tezosSignTx.d.ts +0 -71
- package/lib/api/tezos/tezosSignTx.js +0 -204
- package/lib/api/thpGetCredentials.d.ts +0 -13
- package/lib/api/thpGetCredentials.js +0 -30
- package/lib/api/thpRemoveCredentials.d.ts +0 -15
- package/lib/api/thpRemoveCredentials.js +0 -44
- package/lib/api/tron/api/index.d.ts +0 -3
- package/lib/api/tron/api/index.js +0 -3
- package/lib/api/tron/api/tronComposeTransaction.d.ts +0 -17
- package/lib/api/tron/api/tronComposeTransaction.js +0 -52
- package/lib/api/tron/api/tronGetAddress.d.ts +0 -17
- package/lib/api/tron/api/tronGetAddress.js +0 -22
- package/lib/api/tron/api/tronSignTransaction.d.ts +0 -20
- package/lib/api/tron/api/tronSignTransaction.js +0 -137
- package/lib/api/tron/tronEncode.d.ts +0 -11
- package/lib/api/tron/tronEncode.js +0 -157
- package/lib/api/tron/tronProtobuf.d.ts +0 -5
- package/lib/api/tron/tronProtobuf.js +0 -28
- package/lib/api/unlockPath.d.ts +0 -12
- package/lib/api/unlockPath.js +0 -33
- package/lib/api/verifyMessage.d.ts +0 -16
- package/lib/api/verifyMessage.js +0 -46
- package/lib/api/wipeDevice.d.ts +0 -21
- package/lib/api/wipeDevice.js +0 -49
- package/lib/backend/BackendManager.d.ts +0 -30
- package/lib/backend/BackendManager.js +0 -145
- package/lib/backend/Blockchain.d.ts +0 -81
- package/lib/backend/Blockchain.js +0 -235
- package/lib/backend/BlockchainLink.d.ts +0 -10
- package/lib/backend/BlockchainLink.js +0 -19
- package/lib/backend/fees/BitcoinFeeLevels.d.ts +0 -19
- package/lib/backend/fees/BitcoinFeeLevels.js +0 -44
- package/lib/backend/fees/EthereumFeeLevels.d.ts +0 -17
- package/lib/backend/fees/EthereumFeeLevels.js +0 -63
- package/lib/backend/fees/MiscFeeLevels.d.ts +0 -18
- package/lib/backend/fees/MiscFeeLevels.js +0 -30
- package/lib/backend/fees/index.d.ts +0 -5
- package/lib/backend/fees/index.js +0 -31
- package/lib/core/AbstractMethod.d.ts +0 -63
- package/lib/core/AbstractMethod.js +0 -189
- package/lib/core/index.d.ts +0 -29
- package/lib/core/index.js +0 -805
- package/lib/core/method.d.ts +0 -3
- package/lib/core/method.js +0 -19
- package/lib/core/method.native.d.ts +0 -2
- package/lib/core/method.native.js +0 -29
- package/lib/core/onCallFirmwareUpdate.d.ts +0 -42
- package/lib/core/onCallFirmwareUpdate.js +0 -436
- package/lib/data/coinInfo.d.ts +0 -101
- package/lib/data/coinInfo.js +0 -195
- package/lib/data/config.d.ts +0 -8
- package/lib/data/config.js +0 -273
- package/lib/data/defaultFeeLevels.d.ts +0 -18
- package/lib/data/defaultFeeLevels.js +0 -200
- package/lib/data/enabledNetworksStore.d.ts +0 -5
- package/lib/data/enabledNetworksStore.js +0 -20
- package/lib/data/firmwareInfo.d.ts +0 -55
- package/lib/data/firmwareInfo.js +0 -413
- package/lib/data/firmwareReleaseStore.d.ts +0 -10
- package/lib/data/firmwareReleaseStore.js +0 -16
- package/lib/data/localFirmwareStore.d.ts +0 -3
- package/lib/data/localFirmwareStore.js +0 -8
- package/lib/data/protobufLoader.d.ts +0 -1
- package/lib/data/protobufLoader.js +0 -30
- package/lib/data/settingsStore.d.ts +0 -6
- package/lib/data/settingsStore.js +0 -21
- package/lib/device/Device.d.ts +0 -259
- package/lib/device/Device.js +0 -765
- package/lib/device/DeviceCommands.d.ts +0 -87
- package/lib/device/DeviceCommands.js +0 -248
- package/lib/device/DeviceCurrentSession.d.ts +0 -750
- package/lib/device/DeviceCurrentSession.js +0 -239
- package/lib/device/DeviceList.d.ts +0 -75
- package/lib/device/DeviceList.js +0 -243
- package/lib/device/TransportList.d.ts +0 -3
- package/lib/device/TransportList.js +0 -13
- package/lib/device/TransportManager.d.ts +0 -33
- package/lib/device/TransportManager.js +0 -144
- package/lib/device/calculateRevisionForDevice.d.ts +0 -10
- package/lib/device/calculateRevisionForDevice.js +0 -19
- package/lib/device/checkFirmwareRevision.d.ts +0 -22
- package/lib/device/checkFirmwareRevision.js +0 -104
- package/lib/device/resolveDescriptorForTaproot.d.ts +0 -17
- package/lib/device/resolveDescriptorForTaproot.js +0 -27
- package/lib/device/thp/handshake.d.ts +0 -3
- package/lib/device/thp/handshake.js +0 -100
- package/lib/device/thp/index.d.ts +0 -5
- package/lib/device/thp/index.js +0 -65
- package/lib/device/thp/pairing.d.ts +0 -16
- package/lib/device/thp/pairing.js +0 -242
- package/lib/device/thp/session.d.ts +0 -2
- package/lib/device/thp/session.js +0 -27
- package/lib/device/thp/thpCall.d.ts +0 -31
- package/lib/device/thp/thpCall.js +0 -58
- package/lib/device/validateMessageSize.d.ts +0 -2
- package/lib/device/validateMessageSize.js +0 -9
- package/lib/device/workflow/changeLanguage.d.ts +0 -18
- package/lib/device/workflow/changeLanguage.js +0 -62
- package/lib/device/workflow/checkFirmwareHash.d.ts +0 -12
- package/lib/device/workflow/checkFirmwareHash.js +0 -86
- package/lib/device/workflow/checkFirmwareHashWithRetries.d.ts +0 -8
- package/lib/device/workflow/checkFirmwareHashWithRetries.js +0 -36
- package/lib/device/workflow/handshake.d.ts +0 -13
- package/lib/device/workflow/handshake.js +0 -55
- package/lib/device/workflow/trezorPushNotification.d.ts +0 -5
- package/lib/device/workflow/trezorPushNotification.js +0 -73
- package/lib/device/workflow/validateState.d.ts +0 -2
- package/lib/device/workflow/validateState.js +0 -152
- package/lib/events/ui-promise.d.ts +0 -20
- package/lib/events/ui-promise.js +0 -1
- package/lib/impl/core-in-module.d.ts +0 -33
- package/lib/impl/core-in-module.js +0 -194
- package/lib/types/idevice.d.ts +0 -110
- package/lib/types/idevice.js +0 -1
- package/lib/types/typed-call-provider.d.ts +0 -29
- package/lib/types/typed-call-provider.js +0 -1
- package/lib/types/workflow.d.ts +0 -16
- package/lib/types/workflow.js +0 -1
- package/lib/utils/accountUtils.d.ts +0 -10
- package/lib/utils/accountUtils.js +0 -90
- package/lib/utils/addressUtils.d.ts +0 -2
- package/lib/utils/addressUtils.js +0 -24
- package/lib/utils/assetUtils.d.ts +0 -13
- package/lib/utils/assetUtils.js +0 -55
- package/lib/utils/assets.browser.d.ts +0 -1
- package/lib/utils/assets.browser.js +0 -1
- package/lib/utils/assets.d.ts +0 -2
- package/lib/utils/assets.js +0 -13
- package/lib/utils/assets.native.d.ts +0 -2
- package/lib/utils/assets.native.js +0 -23
- package/lib/utils/assetsTypes.d.ts +0 -5
- package/lib/utils/assetsTypes.js +0 -1
- package/lib/utils/buildOutputDescriptor.d.ts +0 -20
- package/lib/utils/buildOutputDescriptor.js +0 -67
- package/lib/utils/deviceFeaturesUtils.d.ts +0 -7
- package/lib/utils/deviceFeaturesUtils.js +0 -109
- package/lib/utils/ethereumUtils.d.ts +0 -3
- package/lib/utils/ethereumUtils.js +0 -7
- package/lib/utils/firmwareReleaseConfigUtils.d.ts +0 -19
- package/lib/utils/firmwareReleaseConfigUtils.js +0 -131
- package/lib/utils/firmwareUtils.d.ts +0 -15
- package/lib/utils/firmwareUtils.js +0 -57
- package/lib/utils/formatUtils.d.ts +0 -13
- package/lib/utils/formatUtils.js +0 -45
- package/lib/utils/hdnodeUtils.d.ts +0 -6
- package/lib/utils/hdnodeUtils.js +0 -62
- package/lib/utils/pathUtils.d.ts +0 -1
- package/lib/utils/pathUtils.js +0 -1
- package/lib/utils/paymentRequest.d.ts +0 -8
- package/lib/utils/paymentRequest.js +0 -25
- package/lib/utils/uiPromiseManager.d.ts +0 -8
- package/lib/utils/uiPromiseManager.js +0 -51
- package/lib/workers/workers.browser.d.ts +0 -10
- package/lib/workers/workers.browser.js +0 -16
- package/lib/workers/workers.d.ts +0 -10
- package/lib/workers/workers.js +0 -8
- package/lib/workers/workers.native.d.ts +0 -7
- package/lib/workers/workers.native.js +0 -7
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Bundle, GetAddress as GetAddressSchema, UI_REQUEST, createUiMessage } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
3
|
-
import { fromHardenedPathPart } from "@trezor/crypto-utils";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
import { bundlify } from "./paramsValidator.js";
|
|
6
|
-
import { AbstractMethod } from "../../core/AbstractMethod.js";
|
|
7
|
-
import { getSerializedPath, validatePath } from "../../utils/pathUtils.js";
|
|
8
|
-
export class AbstractMiscGetAddress extends AbstractMethod {
|
|
9
|
-
hasBundle;
|
|
10
|
-
progress = 0;
|
|
11
|
-
constructor(message, pathDepth) {
|
|
12
|
-
const {
|
|
13
|
-
hasBundle,
|
|
14
|
-
payload
|
|
15
|
-
} = bundlify(message.payload);
|
|
16
|
-
Assert(Bundle(GetAddressSchema), payload);
|
|
17
|
-
const params = payload.bundle.map(batch => ({
|
|
18
|
-
proto: {
|
|
19
|
-
address_n: validatePath(batch.path, pathDepth),
|
|
20
|
-
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
21
|
-
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false
|
|
22
|
-
},
|
|
23
|
-
address: batch.address
|
|
24
|
-
}));
|
|
25
|
-
super(message, params);
|
|
26
|
-
this.hasBundle = hasBundle;
|
|
27
|
-
this.confirmMissingBackup = true;
|
|
28
|
-
}
|
|
29
|
-
get requiredPermissions() {
|
|
30
|
-
return this.coinPerms('read_address', this.requiredFirmwareCoins);
|
|
31
|
-
}
|
|
32
|
-
getInfo(coinName, showAccountInInfo) {
|
|
33
|
-
if (this.params.length > 1) {
|
|
34
|
-
return `Export multiple ${coinName} addresses`;
|
|
35
|
-
}
|
|
36
|
-
if (showAccountInInfo) {
|
|
37
|
-
const {
|
|
38
|
-
params
|
|
39
|
-
} = this;
|
|
40
|
-
const firstParam = params[0];
|
|
41
|
-
const {
|
|
42
|
-
address_n
|
|
43
|
-
} = firstParam.proto;
|
|
44
|
-
const accountIndex = address_n[2];
|
|
45
|
-
return `Export ${coinName} address for account #${fromHardenedPathPart(accountIndex) + 1}`;
|
|
46
|
-
}
|
|
47
|
-
return `Export ${coinName} address`;
|
|
48
|
-
}
|
|
49
|
-
getButtonRequestData(code) {
|
|
50
|
-
if (code === 'ButtonRequest_Address') {
|
|
51
|
-
const {
|
|
52
|
-
params,
|
|
53
|
-
progress
|
|
54
|
-
} = this;
|
|
55
|
-
const currentParam = params[progress];
|
|
56
|
-
return {
|
|
57
|
-
type: 'address',
|
|
58
|
-
serializedPath: getSerializedPath(currentParam.proto.address_n),
|
|
59
|
-
address: currentParam.address || 'not-set'
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getConfirmation(coinName) {
|
|
64
|
-
if (this.params.length > 1) {
|
|
65
|
-
return {
|
|
66
|
-
view: 'export-address',
|
|
67
|
-
label: `Export multiple ${coinName} addresses`
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const {
|
|
71
|
-
params
|
|
72
|
-
} = this;
|
|
73
|
-
const firstParam = params[0];
|
|
74
|
-
const {
|
|
75
|
-
address_n
|
|
76
|
-
} = firstParam.proto;
|
|
77
|
-
const accountIndex = address_n[2];
|
|
78
|
-
return {
|
|
79
|
-
view: 'export-address',
|
|
80
|
-
label: `Export ${coinName} address for account #${fromHardenedPathPart(accountIndex) + 1}`
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async run({
|
|
84
|
-
sendCoreMessage
|
|
85
|
-
}) {
|
|
86
|
-
const responses = [];
|
|
87
|
-
const {
|
|
88
|
-
params
|
|
89
|
-
} = this;
|
|
90
|
-
for (let i = 0; i < params.length; i++) {
|
|
91
|
-
const batch = params[i];
|
|
92
|
-
if (batch.proto.show_display) {
|
|
93
|
-
const silent = await this._call({
|
|
94
|
-
...batch,
|
|
95
|
-
proto: {
|
|
96
|
-
...batch.proto,
|
|
97
|
-
show_display: false
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
if (typeof batch.address === 'string') {
|
|
101
|
-
if (batch.address !== silent.address) {
|
|
102
|
-
throw ERRORS.TypedError('Method_AddressNotMatch');
|
|
103
|
-
}
|
|
104
|
-
} else {
|
|
105
|
-
batch.address = silent.address;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
const response = await this._call(batch);
|
|
109
|
-
responses.push({
|
|
110
|
-
path: batch.proto.address_n,
|
|
111
|
-
serializedPath: getSerializedPath(batch.proto.address_n),
|
|
112
|
-
address: response.address,
|
|
113
|
-
mac: response.mac
|
|
114
|
-
});
|
|
115
|
-
if (this.hasBundle) {
|
|
116
|
-
sendCoreMessage(createUiMessage(UI_REQUEST.BUNDLE_PROGRESS, {
|
|
117
|
-
total: params.length,
|
|
118
|
-
progress: i,
|
|
119
|
-
response
|
|
120
|
-
}));
|
|
121
|
-
}
|
|
122
|
-
this.progress++;
|
|
123
|
-
}
|
|
124
|
-
return this.hasBundle ? responses : responses[0];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { DiscoveryAccount, DiscoveryAccountType, GetAccountInfo } from '@trezor/connect-common';
|
|
2
|
-
import { TypedEmitter } from '@trezor/utils';
|
|
3
|
-
import type { Blockchain } from "../../backend/BlockchainLink.js";
|
|
4
|
-
import type { DeviceCommands } from "../../device/DeviceCommands.js";
|
|
5
|
-
type DiscoveryType = {
|
|
6
|
-
type: DiscoveryAccountType;
|
|
7
|
-
getPath: (index: number) => number[];
|
|
8
|
-
};
|
|
9
|
-
type GetDescriptor = (path: number[]) => ReturnType<ReturnType<typeof DeviceCommands>['getAccountDescriptor']>;
|
|
10
|
-
type DiscoveryOptions = {
|
|
11
|
-
blockchain: Blockchain;
|
|
12
|
-
getDescriptor: GetDescriptor;
|
|
13
|
-
limit?: number;
|
|
14
|
-
};
|
|
15
|
-
interface Events {
|
|
16
|
-
progress: DiscoveryAccount[];
|
|
17
|
-
complete: void;
|
|
18
|
-
}
|
|
19
|
-
export declare class Discovery extends TypedEmitter<Events> {
|
|
20
|
-
types: DiscoveryType[];
|
|
21
|
-
private typeIndex;
|
|
22
|
-
accounts: DiscoveryAccount[];
|
|
23
|
-
private coinInfo;
|
|
24
|
-
private blockchain;
|
|
25
|
-
getDescriptor: GetDescriptor;
|
|
26
|
-
private index;
|
|
27
|
-
private interrupted;
|
|
28
|
-
completed: boolean;
|
|
29
|
-
constructor(options: DiscoveryOptions);
|
|
30
|
-
start(details?: GetAccountInfo['details']): Promise<void>;
|
|
31
|
-
stop(): void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
2
|
-
import { TypedEmitter } from "@trezor/utils";
|
|
3
|
-
import { getAccountAddressN } from "../../utils/accountUtils.js";
|
|
4
|
-
import { formatAmount } from "../../utils/formatUtils.js";
|
|
5
|
-
export class Discovery extends TypedEmitter {
|
|
6
|
-
types = [];
|
|
7
|
-
typeIndex;
|
|
8
|
-
accounts;
|
|
9
|
-
coinInfo;
|
|
10
|
-
blockchain;
|
|
11
|
-
getDescriptor;
|
|
12
|
-
index;
|
|
13
|
-
interrupted;
|
|
14
|
-
completed;
|
|
15
|
-
constructor(options) {
|
|
16
|
-
super();
|
|
17
|
-
this.accounts = [];
|
|
18
|
-
this.index = 0;
|
|
19
|
-
this.typeIndex = 0;
|
|
20
|
-
this.interrupted = false;
|
|
21
|
-
this.completed = false;
|
|
22
|
-
this.blockchain = options.blockchain;
|
|
23
|
-
this.coinInfo = options.blockchain.coinInfo;
|
|
24
|
-
this.getDescriptor = options.getDescriptor;
|
|
25
|
-
const {
|
|
26
|
-
coinInfo
|
|
27
|
-
} = this;
|
|
28
|
-
if (coinInfo.type === 'bitcoin') {
|
|
29
|
-
const getDescriptor = (purpose, index) => getAccountAddressN(coinInfo, index, {
|
|
30
|
-
purpose
|
|
31
|
-
});
|
|
32
|
-
if (coinInfo.xPubMagicSegwitNative) {
|
|
33
|
-
this.types.push({
|
|
34
|
-
type: 'p2wpkh',
|
|
35
|
-
getPath: getDescriptor.bind(this, 84)
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
if (coinInfo.taproot) {
|
|
39
|
-
this.types.push({
|
|
40
|
-
type: 'p2tr',
|
|
41
|
-
getPath: getDescriptor.bind(this, 86)
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (coinInfo.xPubMagicSegwit) {
|
|
45
|
-
this.types.push({
|
|
46
|
-
type: 'p2sh',
|
|
47
|
-
getPath: getDescriptor.bind(this, 49)
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
this.types.push({
|
|
51
|
-
type: 'p2pkh',
|
|
52
|
-
getPath: getDescriptor.bind(this, 44)
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
this.types.push({
|
|
56
|
-
type: 'p2pkh',
|
|
57
|
-
getPath: getAccountAddressN.bind(this, coinInfo)
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async start(details) {
|
|
62
|
-
const limit = 10;
|
|
63
|
-
this.interrupted = false;
|
|
64
|
-
while (!this.completed && !this.interrupted) {
|
|
65
|
-
const {
|
|
66
|
-
types
|
|
67
|
-
} = this;
|
|
68
|
-
const accountType = types[this.typeIndex];
|
|
69
|
-
const label = `Account #${this.index + 1}`;
|
|
70
|
-
const overTheLimit = this.index >= limit;
|
|
71
|
-
const path = accountType.getPath(this.index);
|
|
72
|
-
const descriptor = await this.getDescriptor(path);
|
|
73
|
-
if (!descriptor) {
|
|
74
|
-
throw ERRORS.TypedError('Runtime', 'Discovery: descriptor not found');
|
|
75
|
-
}
|
|
76
|
-
if (this.interrupted) return;
|
|
77
|
-
const account = {
|
|
78
|
-
...descriptor,
|
|
79
|
-
type: accountType.type,
|
|
80
|
-
label
|
|
81
|
-
};
|
|
82
|
-
this.accounts = this.accounts.filter(a => a.descriptor !== account.descriptor);
|
|
83
|
-
if (!overTheLimit) {
|
|
84
|
-
this.accounts.push(account);
|
|
85
|
-
this.emit('progress', this.accounts);
|
|
86
|
-
}
|
|
87
|
-
const info = await this.blockchain.getAccountInfo({
|
|
88
|
-
descriptor: account.descriptor,
|
|
89
|
-
details
|
|
90
|
-
});
|
|
91
|
-
if (this.interrupted) return;
|
|
92
|
-
this.accounts = this.accounts.filter(a => a.descriptor !== account.descriptor);
|
|
93
|
-
if (!overTheLimit || overTheLimit && !info.empty) {
|
|
94
|
-
const balance = formatAmount(info.availableBalance, this.coinInfo);
|
|
95
|
-
this.accounts.push({
|
|
96
|
-
...account,
|
|
97
|
-
empty: info.empty,
|
|
98
|
-
balance,
|
|
99
|
-
addresses: info.addresses
|
|
100
|
-
});
|
|
101
|
-
this.emit('progress', this.accounts);
|
|
102
|
-
}
|
|
103
|
-
if (info.empty) {
|
|
104
|
-
if (this.typeIndex + 1 < this.types.length) {
|
|
105
|
-
this.typeIndex++;
|
|
106
|
-
this.index = 0;
|
|
107
|
-
} else {
|
|
108
|
-
this.emit('complete');
|
|
109
|
-
this.completed = true;
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
this.index++;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
stop() {
|
|
117
|
-
this.interrupted = !this.completed;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { CallMethodKeys, CoinInfo, FirmwareCapability, FirmwareRange, FirmwareRule } from '@trezor/connect-common';
|
|
2
|
-
type MethodOrCapability = CallMethodKeys | FirmwareCapability;
|
|
3
|
-
type ParamType = 'string' | 'number' | 'array' | 'array-buffer' | 'boolean' | 'uint' | 'object';
|
|
4
|
-
type Param = {
|
|
5
|
-
name: string;
|
|
6
|
-
type?: ParamType | ParamType[];
|
|
7
|
-
required?: boolean;
|
|
8
|
-
allowEmpty?: boolean;
|
|
9
|
-
allowNegative?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const bundlify: <T extends {
|
|
12
|
-
bundle?: unknown[];
|
|
13
|
-
}>(payload: T) => {
|
|
14
|
-
hasBundle: boolean;
|
|
15
|
-
payload: T & {
|
|
16
|
-
bundle: unknown[];
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export declare function validateParams<P extends Record<string, any>>(params: P, schema: Param[]): P;
|
|
20
|
-
export declare const validateCoinPath: (path: number[], coinInfo?: CoinInfo) => void;
|
|
21
|
-
export declare const DEFAULT_FIRMWARE_RANGE: FirmwareRange;
|
|
22
|
-
export declare const filterByFirmwareType: (isDebug: boolean) => (rule: FirmwareRule) => boolean;
|
|
23
|
-
export declare const getFirmwareRange: (methodsOrCapabilities: MethodOrCapability[], coins: CoinInfo[], currentRange?: FirmwareRange, isDebug?: boolean) => FirmwareRange;
|
|
24
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
2
|
-
import { fromHardenedPathPart } from "@trezor/crypto-utils";
|
|
3
|
-
import { typedObjectTransformValues, versionUtils } from "@trezor/utils";
|
|
4
|
-
import { config } from "../../data/config.js";
|
|
5
|
-
const invalidParameter = message => ERRORS.TypedError('Method_InvalidParameter', message);
|
|
6
|
-
export const bundlify = payload => ({
|
|
7
|
-
hasBundle: !!payload.bundle,
|
|
8
|
-
payload: {
|
|
9
|
-
...payload,
|
|
10
|
-
bundle: payload.bundle ?? [payload]
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
export function validateParams(params, schema) {
|
|
14
|
-
schema.forEach(field => {
|
|
15
|
-
const value = params[field.name];
|
|
16
|
-
if (field.required && value == null) {
|
|
17
|
-
throw invalidParameter(`Parameter "${field.name}" is missing.`);
|
|
18
|
-
}
|
|
19
|
-
if (!field.type || value == null) return;
|
|
20
|
-
const {
|
|
21
|
-
name,
|
|
22
|
-
type
|
|
23
|
-
} = field;
|
|
24
|
-
if (Array.isArray(type)) {
|
|
25
|
-
const p = {};
|
|
26
|
-
p[name] = value;
|
|
27
|
-
const success = type.reduce((count, t) => {
|
|
28
|
-
try {
|
|
29
|
-
validateParams(p, [{
|
|
30
|
-
name: field.name,
|
|
31
|
-
type: t
|
|
32
|
-
}]);
|
|
33
|
-
return count + 1;
|
|
34
|
-
} catch {
|
|
35
|
-
return count;
|
|
36
|
-
}
|
|
37
|
-
}, 0);
|
|
38
|
-
if (!success) {
|
|
39
|
-
throw invalidParameter(`Parameter "${name}" has invalid type. Union of "${type.join('|')}" expected.`);
|
|
40
|
-
}
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (type === 'array') {
|
|
44
|
-
if (!Array.isArray(value)) {
|
|
45
|
-
throw invalidParameter(`Parameter "${name}" has invalid type. "${type}" expected.`);
|
|
46
|
-
}
|
|
47
|
-
if (!field.allowEmpty && value.length < 1) {
|
|
48
|
-
throw invalidParameter(`Parameter "${name}" is empty.`);
|
|
49
|
-
}
|
|
50
|
-
} else if (type === 'uint') {
|
|
51
|
-
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
52
|
-
throw invalidParameter(`Parameter "${name}" has invalid type. "string|number" expected.`);
|
|
53
|
-
}
|
|
54
|
-
if (typeof value === 'number' && !Number.isSafeInteger(value) || !/^(?:[1-9]\d*|\d)$/.test(value.toString().replace(/^-/, field.allowNegative ? '' : '-'))) {
|
|
55
|
-
throw invalidParameter(`Parameter "${name}" has invalid value "${value}". Integer representation expected.`);
|
|
56
|
-
}
|
|
57
|
-
} else if (type === 'array-buffer') {
|
|
58
|
-
if (!(value instanceof ArrayBuffer)) {
|
|
59
|
-
throw invalidParameter(`Parameter "${name}" has invalid type. "ArrayBuffer" expected.`);
|
|
60
|
-
}
|
|
61
|
-
} else if (typeof value !== type) {
|
|
62
|
-
throw invalidParameter(`Parameter "${name}" has invalid type. "${type}" expected.`);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return params;
|
|
66
|
-
}
|
|
67
|
-
export const validateCoinPath = (path, coinInfo) => {
|
|
68
|
-
const slip44Component = path[1];
|
|
69
|
-
if (coinInfo && coinInfo.slip44 !== fromHardenedPathPart(slip44Component)) {
|
|
70
|
-
throw invalidParameter('Parameters "path" and "coin" do not match.');
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
export const DEFAULT_FIRMWARE_RANGE = {
|
|
74
|
-
UNKNOWN: {
|
|
75
|
-
min: '1.0.0',
|
|
76
|
-
max: '0'
|
|
77
|
-
},
|
|
78
|
-
T1B1: {
|
|
79
|
-
min: '1.0.0',
|
|
80
|
-
max: '0'
|
|
81
|
-
},
|
|
82
|
-
T2T1: {
|
|
83
|
-
min: '2.0.0',
|
|
84
|
-
max: '0'
|
|
85
|
-
},
|
|
86
|
-
T2B1: {
|
|
87
|
-
min: '2.6.1',
|
|
88
|
-
max: '0'
|
|
89
|
-
},
|
|
90
|
-
T3B1: {
|
|
91
|
-
min: '2.8.1',
|
|
92
|
-
max: '0'
|
|
93
|
-
},
|
|
94
|
-
T3T1: {
|
|
95
|
-
min: '2.7.1',
|
|
96
|
-
max: '0'
|
|
97
|
-
},
|
|
98
|
-
T3W1: {
|
|
99
|
-
min: '2.7.1',
|
|
100
|
-
max: '0'
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
const intersectMin = (a, b) => a === '0' || b !== '0' && versionUtils.isNewer(a, b) ? a : b;
|
|
104
|
-
const intersectMax = (a, b) => a === '0' || b !== '0' && versionUtils.isNewer(a, b) ? b : a;
|
|
105
|
-
const intersectRange = (a, b) => typedObjectTransformValues(a, (value, model) => ({
|
|
106
|
-
min: intersectMin(value.min, b[model].min),
|
|
107
|
-
max: intersectMax(value.max, b[model].max)
|
|
108
|
-
}));
|
|
109
|
-
const ensureArray = (item = []) => Array.isArray(item) ? item : [item];
|
|
110
|
-
const filterByCoins = coins => {
|
|
111
|
-
const coinSet = new Set(coins.map(coin => coin.shortcut.toLowerCase()));
|
|
112
|
-
const coinTypeSet = new Set(coins.map(coin => coin.type));
|
|
113
|
-
return rule => !rule.coin && !rule.coinType || ensureArray(rule.coin).some(coinSet.has.bind(coinSet)) || ensureArray(rule.coinType).some(coinTypeSet.has.bind(coinTypeSet));
|
|
114
|
-
};
|
|
115
|
-
const filterByMethods = methodsOrCapabilities => {
|
|
116
|
-
const methodSet = new Set(methodsOrCapabilities);
|
|
117
|
-
return rule => !rule.methods && !rule.capabilities || ensureArray(rule.methods).some(methodSet.has.bind(methodSet)) || ensureArray(rule.capabilities).some(methodSet.has.bind(methodSet));
|
|
118
|
-
};
|
|
119
|
-
export const filterByFirmwareType = isDebug => rule => !rule.firmwareType || rule.firmwareType === 'debug' === isDebug;
|
|
120
|
-
const getCoinRules = (coins, currentRange) => coins.map(({
|
|
121
|
-
support = typedObjectTransformValues(DEFAULT_FIRMWARE_RANGE, () => false)
|
|
122
|
-
}) => ({
|
|
123
|
-
...currentRange,
|
|
124
|
-
...typedObjectTransformValues(support, value => ({
|
|
125
|
-
min: value || '0',
|
|
126
|
-
max: '0'
|
|
127
|
-
}))
|
|
128
|
-
}));
|
|
129
|
-
const getConfigRules = (methodsOrCapabilities, coins, currentRange, isDebug) => config.supportedFirmware.filter(filterByCoins(coins)).filter(filterByMethods(methodsOrCapabilities)).filter(filterByFirmwareType(isDebug)).map(({
|
|
130
|
-
min,
|
|
131
|
-
max
|
|
132
|
-
}) => typedObjectTransformValues(currentRange, (value, key) => ({
|
|
133
|
-
min: min?.[key] ?? value.min,
|
|
134
|
-
max: max?.[key] ?? value.max
|
|
135
|
-
})));
|
|
136
|
-
export const getFirmwareRange = (methodsOrCapabilities, coins, currentRange = DEFAULT_FIRMWARE_RANGE, isDebug = false) => getCoinRules(coins, currentRange).concat(getConfigRules(methodsOrCapabilities, coins, currentRange, isDebug)).reduce(intersectRange, currentRange);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type CoinInfo, type CoreEventMessage, type DiscoveryAccount } from '@trezor/connect-common';
|
|
2
|
-
import type { UiPromiseCreator } from "../../events/ui-promise.js";
|
|
3
|
-
import type { IDevice } from "../../types/idevice.js";
|
|
4
|
-
export declare const requestExistingAccounts: ({
|
|
5
|
-
postMessage,
|
|
6
|
-
createUiPromise,
|
|
7
|
-
device,
|
|
8
|
-
coinInfo
|
|
9
|
-
}: {
|
|
10
|
-
postMessage: (message: CoreEventMessage) => void;
|
|
11
|
-
createUiPromise: UiPromiseCreator;
|
|
12
|
-
device: IDevice;
|
|
13
|
-
coinInfo: CoinInfo;
|
|
14
|
-
}) => Promise<DiscoveryAccount[] | null>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UI_REQUEST, UI_RESPONSE, createUiMessage } from "@trezor/connect-common";
|
|
2
|
-
import { resolveAfter } from "@trezor/utils/lib/resolveAfter.js";
|
|
3
|
-
const REQUEST_TIMEOUT_MS = 200;
|
|
4
|
-
export const requestExistingAccounts = async ({
|
|
5
|
-
postMessage,
|
|
6
|
-
createUiPromise,
|
|
7
|
-
device,
|
|
8
|
-
coinInfo
|
|
9
|
-
}) => {
|
|
10
|
-
const dfd = createUiPromise(UI_RESPONSE.RECEIVE_DISCOVERY_ACCOUNTS, device);
|
|
11
|
-
postMessage(createUiMessage(UI_REQUEST.REQUEST_DISCOVERY_ACCOUNTS, {
|
|
12
|
-
coinInfo
|
|
13
|
-
}));
|
|
14
|
-
const result = await Promise.race([dfd.promise.then(response => response.payload), resolveAfter(REQUEST_TIMEOUT_MS).then(() => null)]);
|
|
15
|
-
if (result === null) {
|
|
16
|
-
dfd.reject(new Error('No discovery accounts handler'));
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return result.accounts.length > 0 ? result.accounts : null;
|
|
20
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type BitcoinNetworkInfo, type PermissionRequest, type PrecomposeParams, type PrecomposedResult, type SignedTransaction } from '@trezor/connect-common';
|
|
2
|
-
import { BigNumber } from '@trezor/utils/lib/bigNumber';
|
|
3
|
-
import type { ComposeOutput, TransactionInputOutputSortingStrategy } from '@trezor/utxo-lib';
|
|
4
|
-
import type { MethodContext, MethodMessage } from "../core/AbstractMethod.js";
|
|
5
|
-
import { AbstractMethod } from "../core/AbstractMethod.js";
|
|
6
|
-
import { Discovery } from "./common/Discovery.js";
|
|
7
|
-
type Params = {
|
|
8
|
-
outputs: ComposeOutput[];
|
|
9
|
-
coinInfo: BitcoinNetworkInfo;
|
|
10
|
-
identity?: string;
|
|
11
|
-
push: boolean;
|
|
12
|
-
account?: PrecomposeParams['account'];
|
|
13
|
-
feeLevels?: PrecomposeParams['feeLevels'];
|
|
14
|
-
baseFee?: PrecomposeParams['baseFee'];
|
|
15
|
-
sequence?: PrecomposeParams['sequence'];
|
|
16
|
-
total: BigNumber;
|
|
17
|
-
sortingStrategy?: TransactionInputOutputSortingStrategy;
|
|
18
|
-
};
|
|
19
|
-
export default class ComposeTransaction extends AbstractMethod<'composeTransaction', Params> {
|
|
20
|
-
constructor(message: MethodMessage<'composeTransaction'>);
|
|
21
|
-
discovery?: Discovery;
|
|
22
|
-
private disposed;
|
|
23
|
-
get requiredPermissions(): PermissionRequest[];
|
|
24
|
-
get info(): string;
|
|
25
|
-
private getBlockchain;
|
|
26
|
-
private precompose;
|
|
27
|
-
run(context: MethodContext): Promise<SignedTransaction | PrecomposedResult[]>;
|
|
28
|
-
private selectAccount;
|
|
29
|
-
private selectFromExistingAccounts;
|
|
30
|
-
private selectFromDiscovery;
|
|
31
|
-
private selectFee;
|
|
32
|
-
private _selectFeeUiResponse;
|
|
33
|
-
private _sign;
|
|
34
|
-
dispose(): void;
|
|
35
|
-
}
|
|
36
|
-
export {};
|