@trezor/connect 10.0.0-alpha.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 +159 -63
- package/README.md +5 -3
- package/lib/exports.d.ts +1 -0
- package/lib/exports.js +1 -0
- 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.d.ts +7 -0
- package/lib/index.browser.js +10 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +5 -0
- package/lib/index.native.d.ts +4 -0
- package/lib/index.native.js +5 -0
- package/package.json +30 -83
- package/libESM/api/applyFlags.d.mts +0 -20
- package/libESM/api/applyFlags.mjs +0 -36
- package/libESM/api/applySettings.d.mts +0 -20
- package/libESM/api/applySettings.mjs +0 -55
- package/libESM/api/authenticateDevice.d.mts +0 -9
- package/libESM/api/authenticateDevice.mjs +0 -108
- package/libESM/api/authorizeCoinjoin.d.mts +0 -11
- package/libESM/api/authorizeCoinjoin.mjs +0 -44
- package/libESM/api/backupDevice.d.mts +0 -19
- package/libESM/api/backupDevice.mjs +0 -36
- package/libESM/api/bitcoin/TransactionComposer.d.mts +0 -46
- package/libESM/api/bitcoin/TransactionComposer.mjs +0 -139
- package/libESM/api/bitcoin/createPendingTx.d.mts +0 -33
- package/libESM/api/bitcoin/createPendingTx.mjs +0 -54
- package/libESM/api/bitcoin/enhanceSignTx.d.mts +0 -2
- package/libESM/api/bitcoin/enhanceSignTx.mjs +0 -23
- package/libESM/api/bitcoin/index.d.mts +0 -9
- package/libESM/api/bitcoin/index.mjs +0 -9
- package/libESM/api/bitcoin/inputs.d.mts +0 -6
- package/libESM/api/bitcoin/inputs.mjs +0 -75
- package/libESM/api/bitcoin/outputs.d.mts +0 -5
- package/libESM/api/bitcoin/outputs.mjs +0 -128
- package/libESM/api/bitcoin/refTx.d.mts +0 -17
- package/libESM/api/bitcoin/refTx.mjs +0 -252
- package/libESM/api/bitcoin/signtx.d.mts +0 -22
- package/libESM/api/bitcoin/signtx.mjs +0 -213
- package/libESM/api/bitcoin/signtxLegacy.d.mts +0 -3
- package/libESM/api/bitcoin/signtxLegacy.mjs +0 -179
- package/libESM/api/bitcoin/signtxVerify.d.mts +0 -12
- package/libESM/api/bitcoin/signtxVerify.mjs +0 -86
- package/libESM/api/bitcoin/transactionBytes.d.mts +0 -3
- package/libESM/api/bitcoin/transactionBytes.mjs +0 -65
- package/libESM/api/bleUnpair.d.mts +0 -11
- package/libESM/api/bleUnpair.mjs +0 -35
- package/libESM/api/blockchainDisconnect.d.mts +0 -16
- package/libESM/api/blockchainDisconnect.mjs +0 -39
- package/libESM/api/blockchainEstimateFee.d.mts +0 -14
- package/libESM/api/blockchainEstimateFee.mjs +0 -106
- package/libESM/api/blockchainEvmRpcCall.d.mts +0 -17
- package/libESM/api/blockchainEvmRpcCall.mjs +0 -61
- package/libESM/api/blockchainGetAccountBalanceHistory.d.mts +0 -14
- package/libESM/api/blockchainGetAccountBalanceHistory.mjs +0 -64
- package/libESM/api/blockchainGetContractInfo.d.mts +0 -14
- package/libESM/api/blockchainGetContractInfo.mjs +0 -50
- package/libESM/api/blockchainGetCurrentFiatRates.d.mts +0 -18
- package/libESM/api/blockchainGetCurrentFiatRates.mjs +0 -53
- package/libESM/api/blockchainGetFiatRatesForTimestamps.d.mts +0 -21
- package/libESM/api/blockchainGetFiatRatesForTimestamps.mjs +0 -59
- package/libESM/api/blockchainGetInfo.d.mts +0 -13
- package/libESM/api/blockchainGetInfo.mjs +0 -41
- package/libESM/api/blockchainGetTransactions.d.mts +0 -15
- package/libESM/api/blockchainGetTransactions.mjs +0 -47
- package/libESM/api/blockchainSetCustomBackend.d.mts +0 -13
- package/libESM/api/blockchainSetCustomBackend.mjs +0 -41
- package/libESM/api/blockchainSubscribe.d.mts +0 -17
- package/libESM/api/blockchainSubscribe.mjs +0 -68
- package/libESM/api/blockchainSubscribeFiatRates.d.mts +0 -17
- package/libESM/api/blockchainSubscribeFiatRates.mjs +0 -47
- package/libESM/api/blockchainUnsubscribe.d.mts +0 -17
- package/libESM/api/blockchainUnsubscribe.mjs +0 -68
- package/libESM/api/blockchainUnsubscribeFiatRates.d.mts +0 -15
- package/libESM/api/blockchainUnsubscribeFiatRates.mjs +0 -41
- package/libESM/api/blockchainValidateEvmRpcUrl.d.mts +0 -17
- package/libESM/api/blockchainValidateEvmRpcUrl.mjs +0 -54
- package/libESM/api/cancelCoinjoinAuthorization.d.mts +0 -11
- package/libESM/api/cancelCoinjoinAuthorization.mjs +0 -31
- package/libESM/api/cardano/api/cardanoComposeTransaction.d.mts +0 -10
- package/libESM/api/cardano/api/cardanoComposeTransaction.mjs +0 -79
- package/libESM/api/cardano/api/cardanoGetAddress.d.mts +0 -30
- package/libESM/api/cardano/api/cardanoGetAddress.mjs +0 -116
- package/libESM/api/cardano/api/cardanoGetNativeScriptHash.d.mts +0 -12
- package/libESM/api/cardano/api/cardanoGetNativeScriptHash.mjs +0 -66
- package/libESM/api/cardano/api/cardanoGetPublicKey.d.mts +0 -20
- package/libESM/api/cardano/api/cardanoGetPublicKey.mjs +0 -72
- package/libESM/api/cardano/api/cardanoSignMessage.d.mts +0 -27
- package/libESM/api/cardano/api/cardanoSignMessage.mjs +0 -96
- package/libESM/api/cardano/api/cardanoSignTransaction.d.mts +0 -81
- package/libESM/api/cardano/api/cardanoSignTransaction.mjs +0 -298
- package/libESM/api/cardano/api/index.d.mts +0 -6
- package/libESM/api/cardano/api/index.mjs +0 -6
- package/libESM/api/cardano/cardanoAddressParameters.d.mts +0 -6
- package/libESM/api/cardano/cardanoAddressParameters.mjs +0 -79
- package/libESM/api/cardano/cardanoAuxiliaryData.d.mts +0 -4
- package/libESM/api/cardano/cardanoAuxiliaryData.mjs +0 -74
- package/libESM/api/cardano/cardanoCertificate.d.mts +0 -13
- package/libESM/api/cardano/cardanoCertificate.mjs +0 -142
- package/libESM/api/cardano/cardanoInputs.d.mts +0 -25
- package/libESM/api/cardano/cardanoInputs.mjs +0 -39
- package/libESM/api/cardano/cardanoOutputs.d.mts +0 -40
- package/libESM/api/cardano/cardanoOutputs.mjs +0 -70
- package/libESM/api/cardano/cardanoTokenBundle.d.mts +0 -12
- package/libESM/api/cardano/cardanoTokenBundle.mjs +0 -21
- package/libESM/api/cardano/cardanoUtils.d.mts +0 -9
- package/libESM/api/cardano/cardanoUtils.mjs +0 -101
- package/libESM/api/cardano/cardanoWitnesses.d.mts +0 -4
- package/libESM/api/cardano/cardanoWitnesses.mjs +0 -47
- package/libESM/api/changeLanguage.d.mts +0 -18
- package/libESM/api/changeLanguage.mjs +0 -47
- package/libESM/api/changePin.d.mts +0 -11
- package/libESM/api/changePin.mjs +0 -25
- package/libESM/api/changeWipeCode.d.mts +0 -11
- package/libESM/api/changeWipeCode.mjs +0 -27
- package/libESM/api/cipherKeyValue.d.mts +0 -15
- package/libESM/api/cipherKeyValue.mjs +0 -51
- package/libESM/api/common/AbstractMiscGetAddress.d.mts +0 -35
- package/libESM/api/common/AbstractMiscGetAddress.mjs +0 -102
- package/libESM/api/common/Discovery.d.mts +0 -33
- package/libESM/api/common/Discovery.mjs +0 -116
- package/libESM/api/common/paramsValidator.d.mts +0 -23
- package/libESM/api/common/paramsValidator.mjs +0 -134
- package/libESM/api/common/requestExistingAccounts.d.mts +0 -9
- package/libESM/api/common/requestExistingAccounts.mjs +0 -20
- package/libESM/api/composeTransaction.d.mts +0 -36
- package/libESM/api/composeTransaction.mjs +0 -386
- package/libESM/api/discoverAccounts.d.mts +0 -38
- package/libESM/api/discoverAccounts.mjs +0 -363
- package/libESM/api/ethereum/api/ethereumGetAddress.d.mts +0 -28
- package/libESM/api/ethereum/api/ethereumGetAddress.mjs +0 -135
- package/libESM/api/ethereum/api/ethereumGetPublicKey.d.mts +0 -48
- package/libESM/api/ethereum/api/ethereumGetPublicKey.mjs +0 -90
- package/libESM/api/ethereum/api/ethereumSignMessage.d.mts +0 -27
- package/libESM/api/ethereum/api/ethereumSignMessage.mjs +0 -64
- package/libESM/api/ethereum/api/ethereumSignTransaction.d.mts +0 -83
- package/libESM/api/ethereum/api/ethereumSignTransaction.mjs +0 -148
- package/libESM/api/ethereum/api/ethereumSignTypedData.d.mts +0 -116
- package/libESM/api/ethereum/api/ethereumSignTypedData.mjs +0 -202
- package/libESM/api/ethereum/api/ethereumVerifyMessage.d.mts +0 -12
- package/libESM/api/ethereum/api/ethereumVerifyMessage.mjs +0 -33
- package/libESM/api/ethereum/api/index.d.mts +0 -6
- package/libESM/api/ethereum/api/index.mjs +0 -6
- package/libESM/api/ethereum/ethereumDefinitions.d.mts +0 -46
- package/libESM/api/ethereum/ethereumDefinitions.mjs +0 -103
- package/libESM/api/ethereum/ethereumSignTx.d.mts +0 -20
- package/libESM/api/ethereum/ethereumSignTx.mjs +0 -131
- package/libESM/api/ethereum/ethereumSignTypedData.d.mts +0 -32
- package/libESM/api/ethereum/ethereumSignTypedData.mjs +0 -169
- package/libESM/api/evoluGetDelegatedIdentityKey.d.mts +0 -14
- package/libESM/api/evoluGetDelegatedIdentityKey.mjs +0 -26
- package/libESM/api/evoluGetNode.d.mts +0 -13
- package/libESM/api/evoluGetNode.mjs +0 -27
- package/libESM/api/evoluSignRegistrationRequest.d.mts +0 -15
- package/libESM/api/evoluSignRegistrationRequest.mjs +0 -31
- package/libESM/api/firmware/calculateFirmwareHash.d.mts +0 -13
- package/libESM/api/firmware/calculateFirmwareHash.mjs +0 -56
- package/libESM/api/firmware/calculateXPubHash.d.mts +0 -10
- package/libESM/api/firmware/calculateXPubHash.mjs +0 -14
- package/libESM/api/firmware/getBinary.d.mts +0 -10
- package/libESM/api/firmware/getBinary.mjs +0 -33
- package/libESM/api/firmware/index.d.mts +0 -6
- package/libESM/api/firmware/index.mjs +0 -6
- package/libESM/api/firmware/modifyFirmware.d.mts +0 -3
- package/libESM/api/firmware/modifyFirmware.mjs +0 -13
- package/libESM/api/firmware/parseFirmwareHeaders.d.mts +0 -4
- package/libESM/api/firmware/parseFirmwareHeaders.mjs +0 -26
- package/libESM/api/firmware/uploadFirmware.d.mts +0 -19
- package/libESM/api/firmware/uploadFirmware.mjs +0 -99
- package/libESM/api/firmware/verifyEntropy.d.mts +0 -18
- package/libESM/api/firmware/verifyEntropy.mjs +0 -107
- package/libESM/api/getAccountInfo.d.mts +0 -94
- package/libESM/api/getAccountInfo.mjs +0 -385
- package/libESM/api/getAddress.d.mts +0 -39
- package/libESM/api/getAddress.mjs +0 -142
- package/libESM/api/getCoinInfo.d.mts +0 -148
- package/libESM/api/getCoinInfo.mjs +0 -29
- package/libESM/api/getDeviceState.d.mts +0 -8
- package/libESM/api/getDeviceState.mjs +0 -16
- package/libESM/api/getFeatures.d.mts +0 -70
- package/libESM/api/getFeatures.mjs +0 -20
- package/libESM/api/getFirmwareHash.d.mts +0 -11
- package/libESM/api/getFirmwareHash.mjs +0 -27
- package/libESM/api/getNonce.d.mts +0 -10
- package/libESM/api/getNonce.mjs +0 -16
- package/libESM/api/getOwnershipId.d.mts +0 -15
- package/libESM/api/getOwnershipId.mjs +0 -79
- package/libESM/api/getOwnershipProof.d.mts +0 -15
- package/libESM/api/getOwnershipProof.mjs +0 -86
- package/libESM/api/getPublicKey.d.mts +0 -50
- package/libESM/api/getPublicKey.mjs +0 -88
- package/libESM/api/getSettings.d.mts +0 -8
- package/libESM/api/getSettings.mjs +0 -15
- package/libESM/api/index.d.mts +0 -59
- package/libESM/api/index.mjs +0 -59
- package/libESM/api/loadDevice.d.mts +0 -16
- package/libESM/api/loadDevice.mjs +0 -44
- package/libESM/api/monero/api/index.d.mts +0 -4
- package/libESM/api/monero/api/index.mjs +0 -4
- package/libESM/api/monero/api/moneroGetAddress.d.mts +0 -30
- package/libESM/api/monero/api/moneroGetAddress.mjs +0 -109
- package/libESM/api/monero/api/moneroGetWatchKey.d.mts +0 -14
- package/libESM/api/monero/api/moneroGetWatchKey.mjs +0 -44
- package/libESM/api/monero/api/moneroKeyImageSync.d.mts +0 -17
- package/libESM/api/monero/api/moneroKeyImageSync.mjs +0 -127
- package/libESM/api/monero/api/moneroSignTransaction.d.mts +0 -17
- package/libESM/api/monero/api/moneroSignTransaction.mjs +0 -202
- package/libESM/api/pingDevice.d.mts +0 -11
- package/libESM/api/pingDevice.mjs +0 -27
- package/libESM/api/pushTransaction.d.mts +0 -17
- package/libESM/api/pushTransaction.mjs +0 -42
- package/libESM/api/recoveryDevice.d.mts +0 -20
- package/libESM/api/recoveryDevice.mjs +0 -50
- package/libESM/api/requestLogin.d.mts +0 -14
- package/libESM/api/requestLogin.mjs +0 -48
- package/libESM/api/resetDevice.d.mts +0 -22
- package/libESM/api/resetDevice.mjs +0 -131
- package/libESM/api/ripple/api/index.d.mts +0 -2
- package/libESM/api/ripple/api/index.mjs +0 -2
- package/libESM/api/ripple/api/rippleGetAddress.d.mts +0 -15
- package/libESM/api/ripple/api/rippleGetAddress.mjs +0 -22
- package/libESM/api/ripple/api/rippleSignTransaction.d.mts +0 -13
- package/libESM/api/ripple/api/rippleSignTransaction.mjs +0 -52
- package/libESM/api/setBrightness.d.mts +0 -12
- package/libESM/api/setBrightness.mjs +0 -26
- package/libESM/api/setBusy.d.mts +0 -11
- package/libESM/api/setBusy.mjs +0 -32
- package/libESM/api/showDeviceTutorial.d.mts +0 -11
- package/libESM/api/showDeviceTutorial.mjs +0 -21
- package/libESM/api/signMessage.d.mts +0 -25
- package/libESM/api/signMessage.mjs +0 -71
- package/libESM/api/signTransaction.d.mts +0 -197
- package/libESM/api/signTransaction.mjs +0 -334
- package/libESM/api/solana/api/index.d.mts +0 -4
- package/libESM/api/solana/api/index.mjs +0 -4
- package/libESM/api/solana/api/solanaComposeTransaction.d.mts +0 -31
- package/libESM/api/solana/api/solanaComposeTransaction.mjs +0 -76
- package/libESM/api/solana/api/solanaGetAddress.d.mts +0 -15
- package/libESM/api/solana/api/solanaGetAddress.mjs +0 -22
- package/libESM/api/solana/api/solanaGetPublicKey.d.mts +0 -28
- package/libESM/api/solana/api/solanaGetPublicKey.mjs +0 -67
- package/libESM/api/solana/api/solanaSignTransaction.d.mts +0 -41
- package/libESM/api/solana/api/solanaSignTransaction.mjs +0 -203
- package/libESM/api/solana/solanaDefinitions.d.mts +0 -7
- package/libESM/api/solana/solanaDefinitions.mjs +0 -33
- package/libESM/api/stellar/api/index.d.mts +0 -2
- package/libESM/api/stellar/api/index.mjs +0 -2
- package/libESM/api/stellar/api/stellarGetAddress.d.mts +0 -15
- package/libESM/api/stellar/api/stellarGetAddress.mjs +0 -22
- package/libESM/api/stellar/api/stellarSignTransaction.d.mts +0 -26
- package/libESM/api/stellar/api/stellarSignTransaction.mjs +0 -66
- package/libESM/api/stellar/stellarSignTx.d.mts +0 -7
- package/libESM/api/stellar/stellarSignTx.mjs +0 -191
- package/libESM/api/telemetryGet.d.mts +0 -14
- package/libESM/api/telemetryGet.mjs +0 -24
- package/libESM/api/tezos/api/index.d.mts +0 -3
- package/libESM/api/tezos/api/index.mjs +0 -3
- package/libESM/api/tezos/api/tezosGetAddress.d.mts +0 -15
- package/libESM/api/tezos/api/tezosGetAddress.mjs +0 -22
- package/libESM/api/tezos/api/tezosGetPublicKey.d.mts +0 -24
- package/libESM/api/tezos/api/tezosGetPublicKey.mjs +0 -66
- package/libESM/api/tezos/api/tezosSignTransaction.d.mts +0 -14
- package/libESM/api/tezos/api/tezosSignTransaction.mjs +0 -30
- package/libESM/api/tezos/tezosSignTx.d.mts +0 -71
- package/libESM/api/tezos/tezosSignTx.mjs +0 -204
- package/libESM/api/thpGetCredentials.d.mts +0 -13
- package/libESM/api/thpGetCredentials.mjs +0 -28
- package/libESM/api/thpRemoveCredentials.d.mts +0 -15
- package/libESM/api/thpRemoveCredentials.mjs +0 -42
- package/libESM/api/tron/api/index.d.mts +0 -3
- package/libESM/api/tron/api/index.mjs +0 -3
- package/libESM/api/tron/api/tronComposeTransaction.d.mts +0 -17
- package/libESM/api/tron/api/tronComposeTransaction.mjs +0 -51
- package/libESM/api/tron/api/tronGetAddress.d.mts +0 -15
- package/libESM/api/tron/api/tronGetAddress.mjs +0 -20
- package/libESM/api/tron/api/tronSignTransaction.d.mts +0 -19
- package/libESM/api/tron/api/tronSignTransaction.mjs +0 -129
- package/libESM/api/tron/tronEncode.d.mts +0 -12
- package/libESM/api/tron/tronEncode.mjs +0 -77
- package/libESM/api/tron/tronProtobuf.d.mts +0 -5
- package/libESM/api/tron/tronProtobuf.mjs +0 -28
- package/libESM/api/unlockPath.d.mts +0 -12
- package/libESM/api/unlockPath.mjs +0 -31
- package/libESM/api/verifyMessage.d.mts +0 -16
- package/libESM/api/verifyMessage.mjs +0 -46
- package/libESM/api/wipeDevice.d.mts +0 -21
- package/libESM/api/wipeDevice.mjs +0 -47
- package/libESM/backend/BackendManager.d.mts +0 -24
- package/libESM/backend/BackendManager.mjs +0 -137
- package/libESM/backend/Blockchain.d.mts +0 -81
- package/libESM/backend/Blockchain.mjs +0 -232
- package/libESM/backend/BlockchainLink.d.mts +0 -9
- package/libESM/backend/BlockchainLink.mjs +0 -13
- package/libESM/backend/fees/BitcoinFeeLevels.d.mts +0 -19
- package/libESM/backend/fees/BitcoinFeeLevels.mjs +0 -43
- package/libESM/backend/fees/EthereumFeeLevels.d.mts +0 -17
- package/libESM/backend/fees/EthereumFeeLevels.mjs +0 -52
- package/libESM/backend/fees/MiscFeeLevels.d.mts +0 -18
- package/libESM/backend/fees/MiscFeeLevels.mjs +0 -25
- package/libESM/backend/fees/index.d.mts +0 -5
- package/libESM/backend/fees/index.mjs +0 -30
- package/libESM/core/AbstractMethod.d.mts +0 -65
- package/libESM/core/AbstractMethod.mjs +0 -153
- package/libESM/core/index.d.mts +0 -27
- package/libESM/core/index.mjs +0 -795
- package/libESM/core/method.d.mts +0 -3
- package/libESM/core/method.mjs +0 -19
- package/libESM/core/method.native.d.mts +0 -2
- package/libESM/core/method.native.mjs +0 -29
- package/libESM/core/onCallFirmwareUpdate.d.mts +0 -39
- package/libESM/core/onCallFirmwareUpdate.mjs +0 -436
- package/libESM/data/coinInfo.d.mts +0 -374
- package/libESM/data/coinInfo.mjs +0 -183
- package/libESM/data/config.d.mts +0 -8
- package/libESM/data/config.mjs +0 -265
- package/libESM/data/defaultFeeLevels.d.mts +0 -18
- package/libESM/data/defaultFeeLevels.mjs +0 -174
- package/libESM/data/firmwareInfo.d.mts +0 -41
- package/libESM/data/firmwareInfo.mjs +0 -411
- package/libESM/data/firmwareReleaseStore.d.mts +0 -10
- package/libESM/data/firmwareReleaseStore.mjs +0 -16
- package/libESM/data/localFirmwareStore.d.mts +0 -3
- package/libESM/data/localFirmwareStore.mjs +0 -8
- package/libESM/data/protobufLoader.d.mts +0 -1
- package/libESM/data/protobufLoader.mjs +0 -29
- package/libESM/data/settingsStore.d.mts +0 -6
- package/libESM/data/settingsStore.mjs +0 -21
- package/libESM/device/Device.d.mts +0 -237
- package/libESM/device/Device.mjs +0 -729
- package/libESM/device/DeviceCommands.d.mts +0 -77
- package/libESM/device/DeviceCommands.mjs +0 -245
- package/libESM/device/DeviceCurrentSession.d.mts +0 -3208
- package/libESM/device/DeviceCurrentSession.mjs +0 -240
- package/libESM/device/DeviceList.d.mts +0 -68
- package/libESM/device/DeviceList.mjs +0 -246
- package/libESM/device/TransportList.d.mts +0 -9
- package/libESM/device/TransportList.mjs +0 -41
- package/libESM/device/TransportManager.d.mts +0 -30
- package/libESM/device/TransportManager.mjs +0 -142
- package/libESM/device/calculateRevisionForDevice.d.mts +0 -7
- package/libESM/device/calculateRevisionForDevice.mjs +0 -19
- package/libESM/device/checkFirmwareRevision.d.mts +0 -12
- package/libESM/device/checkFirmwareRevision.mjs +0 -75
- package/libESM/device/resolveDescriptorForTaproot.d.mts +0 -14
- package/libESM/device/resolveDescriptorForTaproot.mjs +0 -25
- package/libESM/device/thp/handshake.d.mts +0 -3
- package/libESM/device/thp/handshake.mjs +0 -100
- package/libESM/device/thp/index.d.mts +0 -5
- package/libESM/device/thp/index.mjs +0 -65
- package/libESM/device/thp/pairing.d.mts +0 -16
- package/libESM/device/thp/pairing.mjs +0 -237
- package/libESM/device/thp/session.d.mts +0 -2
- package/libESM/device/thp/session.mjs +0 -27
- package/libESM/device/thp/thpCall.d.mts +0 -40
- package/libESM/device/thp/thpCall.mjs +0 -58
- package/libESM/device/validateMessageSize.d.mts +0 -2
- package/libESM/device/validateMessageSize.mjs +0 -9
- package/libESM/device/workflow/changeLanguage.d.mts +0 -14
- package/libESM/device/workflow/changeLanguage.mjs +0 -59
- package/libESM/device/workflow/checkFirmwareHash.d.mts +0 -9
- package/libESM/device/workflow/checkFirmwareHash.mjs +0 -86
- package/libESM/device/workflow/checkFirmwareHashWithRetries.d.mts +0 -8
- package/libESM/device/workflow/checkFirmwareHashWithRetries.mjs +0 -36
- package/libESM/device/workflow/handshake.d.mts +0 -9
- package/libESM/device/workflow/handshake.mjs +0 -55
- package/libESM/device/workflow/trezorPushNotification.d.mts +0 -2
- package/libESM/device/workflow/trezorPushNotification.mjs +0 -73
- package/libESM/device/workflow/validateState.d.mts +0 -2
- package/libESM/device/workflow/validateState.mjs +0 -153
- package/libESM/events/ui-promise.d.mts +0 -22
- package/libESM/events/ui-promise.mjs +0 -1
- package/libESM/exports.d.mts +0 -3
- package/libESM/exports.mjs +0 -3
- package/libESM/impl/core-in-module.d.mts +0 -27
- package/libESM/impl/core-in-module.mjs +0 -173
- package/libESM/index.browser.d.mts +0 -9
- package/libESM/index.browser.mjs +0 -50
- package/libESM/index.d.mts +0 -6
- package/libESM/index.mjs +0 -32
- package/libESM/index.renderer.d.mts +0 -6
- package/libESM/index.renderer.mjs +0 -19
- package/libESM/tsconfig.libESM.tsbuildinfo +0 -1
- package/libESM/types/idevice.d.mts +0 -109
- package/libESM/types/idevice.mjs +0 -1
- package/libESM/types/typed-call-provider.d.mts +0 -29
- package/libESM/types/typed-call-provider.mjs +0 -1
- package/libESM/types/workflow.d.mts +0 -16
- package/libESM/types/workflow.mjs +0 -1
- package/libESM/utils/accountUtils.d.mts +0 -10
- package/libESM/utils/accountUtils.mjs +0 -83
- package/libESM/utils/addressUtils.d.mts +0 -2
- package/libESM/utils/addressUtils.mjs +0 -24
- package/libESM/utils/assetUtils.d.mts +0 -13
- package/libESM/utils/assetUtils.mjs +0 -56
- package/libESM/utils/assets.browser.d.mts +0 -1
- package/libESM/utils/assets.browser.mjs +0 -1
- package/libESM/utils/assets.d.mts +0 -2
- package/libESM/utils/assets.mjs +0 -13
- package/libESM/utils/assets.native.d.mts +0 -2
- package/libESM/utils/assets.native.mjs +0 -23
- package/libESM/utils/assetsTypes.d.mts +0 -5
- package/libESM/utils/assetsTypes.mjs +0 -1
- package/libESM/utils/buildOutputDescriptor.d.mts +0 -12
- package/libESM/utils/buildOutputDescriptor.mjs +0 -67
- package/libESM/utils/deviceFeaturesUtils.d.mts +0 -7
- package/libESM/utils/deviceFeaturesUtils.mjs +0 -109
- package/libESM/utils/ethereumUtils.d.mts +0 -3
- package/libESM/utils/ethereumUtils.mjs +0 -7
- package/libESM/utils/firmwareReleaseConfigUtils.d.mts +0 -19
- package/libESM/utils/firmwareReleaseConfigUtils.mjs +0 -131
- package/libESM/utils/firmwareUtils.d.mts +0 -13
- package/libESM/utils/firmwareUtils.mjs +0 -54
- package/libESM/utils/formatUtils.d.mts +0 -15
- package/libESM/utils/formatUtils.mjs +0 -45
- package/libESM/utils/hdnodeUtils.d.mts +0 -6
- package/libESM/utils/hdnodeUtils.mjs +0 -62
- package/libESM/utils/pathUtils.d.mts +0 -17
- package/libESM/utils/pathUtils.mjs +0 -141
- package/libESM/utils/paymentRequest.d.mts +0 -8
- package/libESM/utils/paymentRequest.mjs +0 -25
- package/libESM/utils/uiPromiseManager.d.mts +0 -8
- package/libESM/utils/uiPromiseManager.mjs +0 -51
- package/libESM/workers/workers.browser.d.mts +0 -10
- package/libESM/workers/workers.browser.mjs +0 -16
- package/libESM/workers/workers.d.mts +0 -10
- package/libESM/workers/workers.mjs +0 -8
- package/libESM/workers/workers.native.d.mts +0 -7
- package/libESM/workers/workers.native.mjs +0 -7
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { BlockchainLink } from "@trezor/blockchain-link";
|
|
2
|
-
import { BLOCKCHAIN, createBlockchainMessage } from "@trezor/connect-common";
|
|
3
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
4
|
-
import { BlockbookWorker, BlockfrostWorker, ElectrumWorker, EvmRpcWorker, RippleWorker, SolanaWorker, StellarWorker } from "../workers/workers.mjs";
|
|
5
|
-
const getWorker = type => {
|
|
6
|
-
switch (type) {
|
|
7
|
-
case 'blockbook':
|
|
8
|
-
return BlockbookWorker;
|
|
9
|
-
case 'ripple':
|
|
10
|
-
return RippleWorker;
|
|
11
|
-
case 'blockfrost':
|
|
12
|
-
return BlockfrostWorker;
|
|
13
|
-
case 'electrum':
|
|
14
|
-
return ElectrumWorker;
|
|
15
|
-
case 'solana':
|
|
16
|
-
return SolanaWorker;
|
|
17
|
-
case 'stellar':
|
|
18
|
-
return StellarWorker;
|
|
19
|
-
case 'evm-rpc':
|
|
20
|
-
return EvmRpcWorker;
|
|
21
|
-
default:
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const getNormalizedTrezorShortcut = shortcut => {
|
|
26
|
-
if (shortcut === 'tXRP') {
|
|
27
|
-
return 'XRP';
|
|
28
|
-
}
|
|
29
|
-
return shortcut;
|
|
30
|
-
};
|
|
31
|
-
export class Blockchain {
|
|
32
|
-
link;
|
|
33
|
-
serverInfo;
|
|
34
|
-
identity;
|
|
35
|
-
coinInfo;
|
|
36
|
-
postMessage;
|
|
37
|
-
onDisconnected;
|
|
38
|
-
initPromise;
|
|
39
|
-
constructor(options) {
|
|
40
|
-
this.identity = options.identity;
|
|
41
|
-
this.coinInfo = options.coinInfo;
|
|
42
|
-
this.postMessage = options.postMessage;
|
|
43
|
-
this.onDisconnected = options.onDisconnected;
|
|
44
|
-
const {
|
|
45
|
-
blockchainLink
|
|
46
|
-
} = options.coinInfo;
|
|
47
|
-
if (!blockchainLink) {
|
|
48
|
-
throw ERRORS.TypedError('Backend_NotSupported');
|
|
49
|
-
}
|
|
50
|
-
const worker = getWorker(blockchainLink.type);
|
|
51
|
-
if (!worker) {
|
|
52
|
-
throw ERRORS.TypedError('Backend_WorkerMissing', `BlockchainLink worker not found ${blockchainLink.type}`);
|
|
53
|
-
}
|
|
54
|
-
const server = blockchainLink.url;
|
|
55
|
-
this.link = new BlockchainLink({
|
|
56
|
-
name: this.coinInfo.shortcut,
|
|
57
|
-
worker,
|
|
58
|
-
server,
|
|
59
|
-
debug: options.debug,
|
|
60
|
-
proxy: options.proxy,
|
|
61
|
-
...(this.coinInfo.type === 'ethereum' ? {
|
|
62
|
-
throttleBlockEvent: 10 * 1000
|
|
63
|
-
} : {}),
|
|
64
|
-
...(['ripple', 'stellar'].includes(blockchainLink.type) ? {
|
|
65
|
-
throttleBlockEvent: 60 * 1000
|
|
66
|
-
} : {})
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
onBackendDisconnected(pendingSubscriptions = false) {
|
|
70
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.ERROR, {
|
|
71
|
-
coin: this.coinInfo,
|
|
72
|
-
identity: this.identity,
|
|
73
|
-
error: ERRORS.ERROR_CODES.Backend_Disconnected,
|
|
74
|
-
code: 'Backend_Disconnected'
|
|
75
|
-
}));
|
|
76
|
-
this.onDisconnected?.(!!pendingSubscriptions);
|
|
77
|
-
}
|
|
78
|
-
async initLink() {
|
|
79
|
-
let info;
|
|
80
|
-
try {
|
|
81
|
-
await this.link.connect();
|
|
82
|
-
info = await this.link.getInfo();
|
|
83
|
-
} catch (error) {
|
|
84
|
-
throw ERRORS.TypedError('Backend_Error', error.message);
|
|
85
|
-
}
|
|
86
|
-
this.serverInfo = info;
|
|
87
|
-
const trezorNetworkShortcut = getNormalizedTrezorShortcut(this.coinInfo.shortcut);
|
|
88
|
-
const backendNetworkShortcut = this.serverInfo.network;
|
|
89
|
-
if (backendNetworkShortcut.toLowerCase() !== trezorNetworkShortcut.toLowerCase()) {
|
|
90
|
-
throw ERRORS.TypedError('Backend_Invalid');
|
|
91
|
-
}
|
|
92
|
-
this.link.on('disconnected', () => {
|
|
93
|
-
const pendingSubscriptions = this.link.listenerCount('block') || this.link.listenerCount('notification') || this.link.listenerCount('fiatRates');
|
|
94
|
-
this.link.dispose();
|
|
95
|
-
this.onBackendDisconnected(!!pendingSubscriptions);
|
|
96
|
-
});
|
|
97
|
-
return info;
|
|
98
|
-
}
|
|
99
|
-
init() {
|
|
100
|
-
if (!this.initPromise) {
|
|
101
|
-
this.initPromise = this.initLink().then(info => {
|
|
102
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.CONNECT, {
|
|
103
|
-
coin: this.coinInfo,
|
|
104
|
-
identity: this.identity,
|
|
105
|
-
...info
|
|
106
|
-
}));
|
|
107
|
-
this.initPromise = Promise.resolve(info);
|
|
108
|
-
return info;
|
|
109
|
-
}).catch(error => {
|
|
110
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.ERROR, {
|
|
111
|
-
coin: this.coinInfo,
|
|
112
|
-
identity: this.identity,
|
|
113
|
-
error: error.message,
|
|
114
|
-
code: error.code
|
|
115
|
-
}));
|
|
116
|
-
this.initPromise = Promise.reject(error);
|
|
117
|
-
this.link.dispose();
|
|
118
|
-
return this.initPromise;
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return this.initPromise;
|
|
122
|
-
}
|
|
123
|
-
getTransactions(txs) {
|
|
124
|
-
return Promise.all(txs.map(id => this.link.getTransaction(id)));
|
|
125
|
-
}
|
|
126
|
-
getTransactionHexes(txids) {
|
|
127
|
-
return Promise.all(txids.map(id => this.link.getTransactionHex(id)));
|
|
128
|
-
}
|
|
129
|
-
getCurrentFiatRates(params) {
|
|
130
|
-
return this.link.getCurrentFiatRates(params);
|
|
131
|
-
}
|
|
132
|
-
getContractInfo(params) {
|
|
133
|
-
return this.link.getContractInfo(params);
|
|
134
|
-
}
|
|
135
|
-
getFiatRatesForTimestamps(params) {
|
|
136
|
-
return this.link.getFiatRatesForTimestamps(params);
|
|
137
|
-
}
|
|
138
|
-
getAccountBalanceHistory(params) {
|
|
139
|
-
return this.link.getAccountBalanceHistory(params);
|
|
140
|
-
}
|
|
141
|
-
getNetworkInfo() {
|
|
142
|
-
return this.link.getInfo();
|
|
143
|
-
}
|
|
144
|
-
getAccountInfo(request) {
|
|
145
|
-
return this.link.getAccountInfo(request);
|
|
146
|
-
}
|
|
147
|
-
getAccountUtxo(descriptor) {
|
|
148
|
-
return this.link.getAccountUtxo(descriptor);
|
|
149
|
-
}
|
|
150
|
-
rpcCall(params) {
|
|
151
|
-
return this.link.rpcCall(params);
|
|
152
|
-
}
|
|
153
|
-
estimateFee(request) {
|
|
154
|
-
return this.link.estimateFee(request);
|
|
155
|
-
}
|
|
156
|
-
subscribeBlocks() {
|
|
157
|
-
if (this.link.listenerCount('block') === 0) {
|
|
158
|
-
this.link.on('block', block => {
|
|
159
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.BLOCK, {
|
|
160
|
-
coin: this.coinInfo,
|
|
161
|
-
...block
|
|
162
|
-
}));
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
return this.link.subscribe({
|
|
166
|
-
type: 'block'
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
subscribeAccounts(accounts) {
|
|
170
|
-
if (this.link.listenerCount('notification') === 0) {
|
|
171
|
-
this.link.on('notification', notification => {
|
|
172
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.NOTIFICATION, {
|
|
173
|
-
coin: this.coinInfo,
|
|
174
|
-
notification
|
|
175
|
-
}));
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
return this.link.subscribe({
|
|
179
|
-
type: 'accounts',
|
|
180
|
-
accounts
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
subscribeFiatRates(_currency) {
|
|
184
|
-
if (this.link.listenerCount('fiatRates') === 0) {
|
|
185
|
-
this.link.on('fiatRates', ({
|
|
186
|
-
rates
|
|
187
|
-
}) => {
|
|
188
|
-
this.postMessage(createBlockchainMessage(BLOCKCHAIN.FIAT_RATES_UPDATE, {
|
|
189
|
-
coin: this.coinInfo,
|
|
190
|
-
rates
|
|
191
|
-
}));
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return this.link.subscribe({
|
|
195
|
-
type: 'fiatRates'
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
unsubscribeBlocks() {
|
|
199
|
-
this.link.removeAllListeners('block');
|
|
200
|
-
return this.link.unsubscribe({
|
|
201
|
-
type: 'block'
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
unsubscribeAccounts(accounts) {
|
|
205
|
-
return this.link.unsubscribe({
|
|
206
|
-
type: 'accounts',
|
|
207
|
-
accounts
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
unsubscribeFiatRates() {
|
|
211
|
-
this.link.removeAllListeners('fiatRates');
|
|
212
|
-
return this.link.unsubscribe({
|
|
213
|
-
type: 'fiatRates'
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
async unsubscribeAll() {
|
|
217
|
-
this.link.removeAllListeners('notification');
|
|
218
|
-
await this.unsubscribeFiatRates();
|
|
219
|
-
return this.unsubscribeBlocks();
|
|
220
|
-
}
|
|
221
|
-
pushTransaction(tx) {
|
|
222
|
-
const data = typeof tx === 'string' ? {
|
|
223
|
-
hex: tx
|
|
224
|
-
} : tx;
|
|
225
|
-
return this.link.pushTransaction(data);
|
|
226
|
-
}
|
|
227
|
-
disconnect() {
|
|
228
|
-
this.link.removeAllListeners();
|
|
229
|
-
this.link.disconnect().then(() => this.link.dispose());
|
|
230
|
-
this.onBackendDisconnected();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { CoinInfo } from '@trezor/connect-common';
|
|
2
|
-
import type { BlockchainOptions as Options } from './Blockchain';
|
|
3
|
-
export { Blockchain } from './Blockchain';
|
|
4
|
-
export declare const findBackend: (coin: string, identity?: string) => import("./Blockchain").Blockchain | null;
|
|
5
|
-
export declare const setCustomBackend: (coinInfo: CoinInfo, blockchainLink: CoinInfo["blockchainLink"]) => void;
|
|
6
|
-
export declare const isBackendSupported: (coinInfo: CoinInfo) => void;
|
|
7
|
-
export declare const initBlockchain: (coinInfo: CoinInfo, postMessage: Options["postMessage"], identity?: string) => Promise<import("./Blockchain").Blockchain>;
|
|
8
|
-
export declare const reconnectAllBackends: (coinInfo?: CoinInfo) => Promise<import("./Blockchain").Blockchain[]>;
|
|
9
|
-
export declare const dispose: () => void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { BackendManager } from "./BackendManager.mjs";
|
|
2
|
-
export { Blockchain } from "./Blockchain.mjs";
|
|
3
|
-
const backends = new BackendManager();
|
|
4
|
-
export const findBackend = (coin, identity) => backends.get(coin, identity);
|
|
5
|
-
export const setCustomBackend = (coinInfo, blockchainLink) => backends.setCustom(coinInfo.shortcut, blockchainLink?.url.length ? blockchainLink : coinInfo.blockchainLink);
|
|
6
|
-
export const isBackendSupported = coinInfo => backends.isSupported(coinInfo);
|
|
7
|
-
export const initBlockchain = (coinInfo, postMessage, identity) => backends.getOrConnect({
|
|
8
|
-
coinInfo,
|
|
9
|
-
identity,
|
|
10
|
-
postMessage
|
|
11
|
-
});
|
|
12
|
-
export const reconnectAllBackends = coinInfo => backends.reconnectAll(coinInfo);
|
|
13
|
-
export const dispose = () => backends.dispose();
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BitcoinNetworkInfo } from '@trezor/connect-common';
|
|
2
|
-
import type { Blockchain } from '../Blockchain';
|
|
3
|
-
import { MiscFeeLevels } from './MiscFeeLevels';
|
|
4
|
-
export declare class BitcoinFeeLevels extends MiscFeeLevels {
|
|
5
|
-
coinInfo: BitcoinNetworkInfo;
|
|
6
|
-
longTermFeeRate: string;
|
|
7
|
-
constructor(coinInfo: BitcoinNetworkInfo);
|
|
8
|
-
load(blockchain: Blockchain): Promise<{
|
|
9
|
-
feePerTx?: string | undefined;
|
|
10
|
-
feeLimit?: string | undefined;
|
|
11
|
-
baseFeePerGas?: string | undefined;
|
|
12
|
-
maxFeePerGas?: string | undefined;
|
|
13
|
-
maxPriorityFeePerGas?: string | undefined;
|
|
14
|
-
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
15
|
-
blocks: number;
|
|
16
|
-
feePerUnit: string;
|
|
17
|
-
}[]>;
|
|
18
|
-
updateBitcoinCustomFee(feePerUnit: string): void;
|
|
19
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from "@trezor/utils/libESM/bigNumber.mjs";
|
|
2
|
-
import { clamp } from "@trezor/utils/libESM/number.mjs";
|
|
3
|
-
import { MiscFeeLevels } from "./MiscFeeLevels.mjs";
|
|
4
|
-
import { DEFAULT_BITCOIN_LONGTERM_FEE_RATE } from "../../data/defaultFeeLevels.mjs";
|
|
5
|
-
export class BitcoinFeeLevels extends MiscFeeLevels {
|
|
6
|
-
coinInfo;
|
|
7
|
-
longTermFeeRate;
|
|
8
|
-
constructor(coinInfo) {
|
|
9
|
-
super(coinInfo);
|
|
10
|
-
this.coinInfo = coinInfo;
|
|
11
|
-
this.longTermFeeRate = DEFAULT_BITCOIN_LONGTERM_FEE_RATE;
|
|
12
|
-
}
|
|
13
|
-
async load(blockchain) {
|
|
14
|
-
try {
|
|
15
|
-
const {
|
|
16
|
-
minFee,
|
|
17
|
-
maxFee
|
|
18
|
-
} = this.coinInfo;
|
|
19
|
-
const blocks = this.levels.map(level => level.blocks).filter(b => b > 0);
|
|
20
|
-
const response = await blockchain.estimateFee({
|
|
21
|
-
blocks
|
|
22
|
-
});
|
|
23
|
-
response.forEach(({
|
|
24
|
-
feePerUnit: feePerKB
|
|
25
|
-
}, index) => {
|
|
26
|
-
const feePerB = new BigNumber(feePerKB).div(1000).toNumber();
|
|
27
|
-
if (isNaN(feePerB) || feePerB < 0) return;
|
|
28
|
-
const trimmedFeePerUnit = clamp(feePerB, minFee, maxFee);
|
|
29
|
-
this.levels[index].feePerUnit = trimmedFeePerUnit.toString();
|
|
30
|
-
});
|
|
31
|
-
this.wasFetchedSuccessfully = true;
|
|
32
|
-
} catch {}
|
|
33
|
-
return this.levels;
|
|
34
|
-
}
|
|
35
|
-
updateBitcoinCustomFee(feePerUnit) {
|
|
36
|
-
this.levels = this.levels.filter(l => l.label !== 'custom');
|
|
37
|
-
this.levels.push({
|
|
38
|
-
label: 'custom',
|
|
39
|
-
feePerUnit,
|
|
40
|
-
blocks: -1
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { EthereumNetworkInfo } from '@trezor/connect-common';
|
|
2
|
-
import type { Blockchain } from '../Blockchain';
|
|
3
|
-
import { MiscFeeLevels } from './MiscFeeLevels';
|
|
4
|
-
export declare class EthereumFeeLevels extends MiscFeeLevels {
|
|
5
|
-
coinInfo: EthereumNetworkInfo;
|
|
6
|
-
constructor(coinInfo: EthereumNetworkInfo);
|
|
7
|
-
load(blockchain: Blockchain, request: Parameters<typeof blockchain.estimateFee>[0]): Promise<{
|
|
8
|
-
feePerTx?: string | undefined;
|
|
9
|
-
feeLimit?: string | undefined;
|
|
10
|
-
baseFeePerGas?: string | undefined;
|
|
11
|
-
maxFeePerGas?: string | undefined;
|
|
12
|
-
maxPriorityFeePerGas?: string | undefined;
|
|
13
|
-
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
14
|
-
blocks: number;
|
|
15
|
-
feePerUnit: string;
|
|
16
|
-
}[]>;
|
|
17
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from "@trezor/utils/libESM/bigNumber.mjs";
|
|
2
|
-
import { clamp } from "@trezor/utils/libESM/number.mjs";
|
|
3
|
-
import { MiscFeeLevels } from "./MiscFeeLevels.mjs";
|
|
4
|
-
export class EthereumFeeLevels extends MiscFeeLevels {
|
|
5
|
-
coinInfo;
|
|
6
|
-
constructor(coinInfo) {
|
|
7
|
-
super(coinInfo);
|
|
8
|
-
this.coinInfo = coinInfo;
|
|
9
|
-
}
|
|
10
|
-
async load(blockchain, request) {
|
|
11
|
-
try {
|
|
12
|
-
const [response] = await blockchain.estimateFee(request);
|
|
13
|
-
const {
|
|
14
|
-
eip1559
|
|
15
|
-
} = response;
|
|
16
|
-
const maxFeeInWei = new BigNumber(this.coinInfo.maxFee).multipliedBy('1e+9').toNumber();
|
|
17
|
-
const minFeeInWei = new BigNumber(this.coinInfo.minFee).multipliedBy('1e+9').toNumber();
|
|
18
|
-
const feeInWei = new BigNumber(response.feePerUnit).toNumber();
|
|
19
|
-
const feePerUnit = new BigNumber(clamp(feeInWei, minFeeInWei, maxFeeInWei)).toFixed(0);
|
|
20
|
-
if (eip1559?.baseFeePerGas) {
|
|
21
|
-
const minMaxPriorityFeePerGas = new BigNumber(this.coinInfo.minPriorityFee).multipliedBy('1e+9').toNumber();
|
|
22
|
-
const levels = ['low', 'medium', 'high'].map(levelKey => {
|
|
23
|
-
const level = eip1559[levelKey];
|
|
24
|
-
const label = levelKey === 'medium' ? 'normal' : levelKey;
|
|
25
|
-
if (!level?.maxFeePerGas || !level?.maxPriorityFeePerGas) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const maxFeePerGas = BigNumber.max(minFeeInWei, level.maxFeePerGas, minMaxPriorityFeePerGas).toFixed(0);
|
|
29
|
-
const maxPriorityFeePerGas = BigNumber.max(minMaxPriorityFeePerGas, BigNumber.min(maxFeePerGas, level.maxPriorityFeePerGas)).toFixed(0);
|
|
30
|
-
return {
|
|
31
|
-
label,
|
|
32
|
-
feePerUnit,
|
|
33
|
-
feeLimit: response.feeLimit,
|
|
34
|
-
blocks: Math.ceil(Math.max(1, (level?.maxWaitTimeEstimate || 0) / 1000 / this.coinInfo.blockTime)),
|
|
35
|
-
baseFeePerGas: eip1559.baseFeePerGas,
|
|
36
|
-
maxFeePerGas,
|
|
37
|
-
maxPriorityFeePerGas
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
this.levels = levels.filter(level => level);
|
|
41
|
-
} else {
|
|
42
|
-
this.levels[0] = {
|
|
43
|
-
...this.levels[0],
|
|
44
|
-
...response,
|
|
45
|
-
feePerUnit
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
this.wasFetchedSuccessfully = true;
|
|
49
|
-
} catch {}
|
|
50
|
-
return this.levels;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CoinInfo, FeeLevel } from '@trezor/connect-common';
|
|
2
|
-
import type { Blockchain } from '../Blockchain';
|
|
3
|
-
export declare class MiscFeeLevels {
|
|
4
|
-
coinInfo: CoinInfo;
|
|
5
|
-
levels: FeeLevel[];
|
|
6
|
-
wasFetchedSuccessfully: boolean;
|
|
7
|
-
constructor(coinInfo: CoinInfo);
|
|
8
|
-
load(blockchain: Blockchain, request: Parameters<typeof blockchain.estimateFee>[0]): Promise<{
|
|
9
|
-
feePerTx?: string | undefined;
|
|
10
|
-
feeLimit?: string | undefined;
|
|
11
|
-
baseFeePerGas?: string | undefined;
|
|
12
|
-
maxFeePerGas?: string | undefined;
|
|
13
|
-
maxPriorityFeePerGas?: string | undefined;
|
|
14
|
-
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
15
|
-
blocks: number;
|
|
16
|
-
feePerUnit: string;
|
|
17
|
-
}[]>;
|
|
18
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { BigNumber } from "@trezor/utils/libESM/bigNumber.mjs";
|
|
2
|
-
import { cloneObject } from "@trezor/utils/libESM/cloneObject.mjs";
|
|
3
|
-
export class MiscFeeLevels {
|
|
4
|
-
coinInfo;
|
|
5
|
-
levels;
|
|
6
|
-
wasFetchedSuccessfully = false;
|
|
7
|
-
constructor(coinInfo) {
|
|
8
|
-
this.coinInfo = coinInfo;
|
|
9
|
-
this.levels = cloneObject(coinInfo.defaultFees);
|
|
10
|
-
}
|
|
11
|
-
async load(blockchain, request) {
|
|
12
|
-
try {
|
|
13
|
-
const [response] = await blockchain.estimateFee(request);
|
|
14
|
-
const fee = new BigNumber(response.feePerUnit).toNumber();
|
|
15
|
-
const feePerUnit = Math.min(this.coinInfo.maxFee, Math.max(this.coinInfo.minFee, fee)).toString();
|
|
16
|
-
this.levels[0] = {
|
|
17
|
-
...this.levels[0],
|
|
18
|
-
...response,
|
|
19
|
-
feePerUnit
|
|
20
|
-
};
|
|
21
|
-
this.wasFetchedSuccessfully = true;
|
|
22
|
-
} catch {}
|
|
23
|
-
return this.levels;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BitcoinNetworkInfo, CoinInfo } from '@trezor/connect-common';
|
|
2
|
-
import { BitcoinFeeLevels } from './BitcoinFeeLevels';
|
|
3
|
-
import { MiscFeeLevels } from './MiscFeeLevels';
|
|
4
|
-
export declare const getOrInitFeeLevels: (coinInfo: CoinInfo) => MiscFeeLevels;
|
|
5
|
-
export declare const getOrInitBitcoinFeeLevels: (coinInfo: BitcoinNetworkInfo) => BitcoinFeeLevels;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { exhaustive } from "@trezor/type-utils";
|
|
2
|
-
import { BitcoinFeeLevels } from "./BitcoinFeeLevels.mjs";
|
|
3
|
-
import { EthereumFeeLevels } from "./EthereumFeeLevels.mjs";
|
|
4
|
-
import { MiscFeeLevels } from "./MiscFeeLevels.mjs";
|
|
5
|
-
const instancesPerCoin = {};
|
|
6
|
-
const feeLevelsPerTypeFactory = coinInfo => {
|
|
7
|
-
const {
|
|
8
|
-
type
|
|
9
|
-
} = coinInfo;
|
|
10
|
-
switch (type) {
|
|
11
|
-
case 'bitcoin':
|
|
12
|
-
return new BitcoinFeeLevels(coinInfo);
|
|
13
|
-
case 'ethereum':
|
|
14
|
-
return new EthereumFeeLevels(coinInfo);
|
|
15
|
-
case 'misc':
|
|
16
|
-
return new MiscFeeLevels(coinInfo);
|
|
17
|
-
default:
|
|
18
|
-
return exhaustive(type);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
export const getOrInitFeeLevels = coinInfo => {
|
|
22
|
-
const {
|
|
23
|
-
shortcut
|
|
24
|
-
} = coinInfo;
|
|
25
|
-
if (!Object.prototype.hasOwnProperty.call(instancesPerCoin, shortcut)) {
|
|
26
|
-
instancesPerCoin[shortcut] = feeLevelsPerTypeFactory(coinInfo);
|
|
27
|
-
}
|
|
28
|
-
return instancesPerCoin[shortcut];
|
|
29
|
-
};
|
|
30
|
-
export const getOrInitBitcoinFeeLevels = coinInfo => getOrInitFeeLevels(coinInfo);
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { UI_REQUEST } from '@trezor/connect-common';
|
|
2
|
-
import type { CallMethodPayload, CallMethodResponse, CoinInfo, CoreEventMessage, DeviceState, FirmwareCapability, MethodInfo, MethodPermission, PrecomposeResultFinal, UiRequestButtonData, UiRequestConfirmation } from '@trezor/connect-common';
|
|
3
|
-
import type { Capability } from '@trezor/protobuf/libESM/definitions';
|
|
4
|
-
import { DEFAULT_FIRMWARE_RANGE } from '../api/common/paramsValidator';
|
|
5
|
-
import type { Device } from '../device/Device';
|
|
6
|
-
import type { UiPromiseCreator } from '../events/ui-promise';
|
|
7
|
-
export { DEFAULT_FIRMWARE_RANGE };
|
|
8
|
-
export type Payload<M> = Extract<CallMethodPayload, {
|
|
9
|
-
method: M;
|
|
10
|
-
}> & {
|
|
11
|
-
override?: boolean;
|
|
12
|
-
};
|
|
13
|
-
export type MethodReturnType<M extends CallMethodPayload['method']> = CallMethodResponse<M>;
|
|
14
|
-
export type DeviceMode = typeof UI_REQUEST.SEEDLESS | typeof UI_REQUEST.BOOTLOADER | typeof UI_REQUEST.INITIALIZE;
|
|
15
|
-
export type MethodContext = {
|
|
16
|
-
sendCoreMessage: (message: CoreEventMessage) => void;
|
|
17
|
-
createUiPromise: UiPromiseCreator;
|
|
18
|
-
};
|
|
19
|
-
export type MethodMessage<Name extends CallMethodPayload['method']> = {
|
|
20
|
-
id?: string;
|
|
21
|
-
payload: Payload<Name>;
|
|
22
|
-
};
|
|
23
|
-
export declare abstract class AbstractMethod<Name extends CallMethodPayload['method'], Params = undefined> {
|
|
24
|
-
responseID: string;
|
|
25
|
-
callId?: string;
|
|
26
|
-
device: Device | undefined;
|
|
27
|
-
protected params: Params;
|
|
28
|
-
deviceState?: DeviceState;
|
|
29
|
-
keepSession: boolean;
|
|
30
|
-
skipFinalReload: boolean;
|
|
31
|
-
overridePreviousCall: boolean;
|
|
32
|
-
overridden: boolean;
|
|
33
|
-
readonly name: Name;
|
|
34
|
-
protected get info(): string;
|
|
35
|
-
protected get confirmation(): UiRequestConfirmation['payload'] | undefined;
|
|
36
|
-
useUi: boolean;
|
|
37
|
-
useDevice: boolean;
|
|
38
|
-
useDeviceState: boolean;
|
|
39
|
-
preauthorized?: boolean;
|
|
40
|
-
useEmptyPassphrase: boolean;
|
|
41
|
-
abstract get requiredPermissions(): MethodPermission[];
|
|
42
|
-
allowDeviceMode: DeviceMode[];
|
|
43
|
-
protected requiredDeviceCapabilities: Capability[];
|
|
44
|
-
protected requiredFirmwareCapabilities: FirmwareCapability[];
|
|
45
|
-
protected requiredFirmwareCoins: (CoinInfo | undefined)[];
|
|
46
|
-
useCardanoDerivation: boolean;
|
|
47
|
-
confirmMissingBackup: boolean;
|
|
48
|
-
getButtonRequestData?(code: string, name?: string): UiRequestButtonData | undefined;
|
|
49
|
-
initAsync?(): Promise<void>;
|
|
50
|
-
constructor(message: MethodMessage<Name>, params: Params);
|
|
51
|
-
protected getUseUi(params: {
|
|
52
|
-
address?: string;
|
|
53
|
-
proto: {
|
|
54
|
-
show_display?: boolean;
|
|
55
|
-
};
|
|
56
|
-
}[], useEventListener: boolean | undefined): boolean;
|
|
57
|
-
setDevice(device: Device): void;
|
|
58
|
-
getDevice(): Device;
|
|
59
|
-
checkFirmwareRange(): "ui-device_firmware_old" | "ui-device_firmware_unsupported" | "ui-device_firmware_not_compatible" | "ui-device_firmware_not_installed" | undefined;
|
|
60
|
-
getMethodInfo(): MethodInfo;
|
|
61
|
-
payloadToPrecomposed(): Promise<PrecomposeResultFinal | undefined>;
|
|
62
|
-
checkDeviceCapability(): void;
|
|
63
|
-
abstract run(context: MethodContext): Promise<MethodReturnType<Name>>;
|
|
64
|
-
dispose(): void;
|
|
65
|
-
}
|