@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,203 +0,0 @@
|
|
|
1
|
-
import solana from "@trezor/coins-solana/runtime";
|
|
2
|
-
import { SolanaSignTransaction as SolanaSignTransactionSchema, SolanaTxAdditionalInfo } from "@trezor/connect-common";
|
|
3
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
import { BigNumber } from "@trezor/utils";
|
|
6
|
-
import { AbstractMethod } from "../../../core/AbstractMethod.mjs";
|
|
7
|
-
import { getMiscNetwork } from "../../../data/coinInfo.mjs";
|
|
8
|
-
import { validatePath } from "../../../utils/pathUtils.mjs";
|
|
9
|
-
import { PAYMENT_REQUEST_AMOUNT_BYTES, encodePaymentRequestAmount } from "../../../utils/paymentRequest.mjs";
|
|
10
|
-
import { getSolanaTokenDefinition } from "../solanaDefinitions.mjs";
|
|
11
|
-
export default class SolanaSignTransaction extends AbstractMethod {
|
|
12
|
-
constructor(message) {
|
|
13
|
-
const {
|
|
14
|
-
payload
|
|
15
|
-
} = message;
|
|
16
|
-
Assert(SolanaSignTransactionSchema, payload);
|
|
17
|
-
const path = validatePath(payload.path, 2);
|
|
18
|
-
let additional_info;
|
|
19
|
-
let symbols;
|
|
20
|
-
if (payload.additionalInfo) {
|
|
21
|
-
Assert(SolanaTxAdditionalInfo, payload.additionalInfo);
|
|
22
|
-
const token_accounts_infos = payload.additionalInfo.tokenAccountsInfos?.map(tokenAccountInfo => ({
|
|
23
|
-
base_address: tokenAccountInfo.baseAddress,
|
|
24
|
-
token_program: tokenAccountInfo.tokenProgram,
|
|
25
|
-
token_mint: tokenAccountInfo.tokenMint,
|
|
26
|
-
token_account: tokenAccountInfo.tokenAccount
|
|
27
|
-
})) ?? [];
|
|
28
|
-
symbols = payload.additionalInfo.tokenAccountsInfos?.map(tokenAccountInfo => tokenAccountInfo.symbol) ?? [];
|
|
29
|
-
additional_info = {
|
|
30
|
-
token_accounts_infos
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const proto = {
|
|
34
|
-
address_n: path,
|
|
35
|
-
serialized_tx: payload.serializedTx,
|
|
36
|
-
additional_info,
|
|
37
|
-
payment_req: payload.payment_req ? encodePaymentRequestAmount(payload.payment_req, PAYMENT_REQUEST_AMOUNT_BYTES.DEFAULT) : undefined
|
|
38
|
-
};
|
|
39
|
-
const params = {
|
|
40
|
-
proto,
|
|
41
|
-
serialize: !!payload.serialize,
|
|
42
|
-
symbols
|
|
43
|
-
};
|
|
44
|
-
super(message, params);
|
|
45
|
-
this.requiredDeviceCapabilities = ['Capability_Solana'];
|
|
46
|
-
this.requiredFirmwareCoins = [getMiscNetwork('Solana')];
|
|
47
|
-
}
|
|
48
|
-
get requiredPermissions() {
|
|
49
|
-
return ['read', 'write'];
|
|
50
|
-
}
|
|
51
|
-
async initAsync() {
|
|
52
|
-
const token = this.params.proto.additional_info?.token_accounts_infos?.[0];
|
|
53
|
-
if (token) {
|
|
54
|
-
const tokenDefinition = await getSolanaTokenDefinition({
|
|
55
|
-
mintAddress: token.token_mint
|
|
56
|
-
});
|
|
57
|
-
if (!tokenDefinition) return;
|
|
58
|
-
this.params.proto.additional_info.encoded_token = tokenDefinition;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
get info() {
|
|
62
|
-
return 'Sign Solana transaction';
|
|
63
|
-
}
|
|
64
|
-
async payloadToPrecomposed() {
|
|
65
|
-
try {
|
|
66
|
-
const {
|
|
67
|
-
getDecompiledMessage
|
|
68
|
-
} = await solana();
|
|
69
|
-
const {
|
|
70
|
-
message,
|
|
71
|
-
baseFee,
|
|
72
|
-
instructions
|
|
73
|
-
} = getDecompiledMessage(this.params.proto.serialized_tx, this.params.serialize);
|
|
74
|
-
const outputs = [];
|
|
75
|
-
let feePerUnit = new BigNumber(0);
|
|
76
|
-
let feeLimit = new BigNumber(0);
|
|
77
|
-
let rent = new BigNumber(0);
|
|
78
|
-
let sendAmount = new BigNumber(0);
|
|
79
|
-
let token;
|
|
80
|
-
for (const instruction of instructions) {
|
|
81
|
-
const {
|
|
82
|
-
type,
|
|
83
|
-
parsed
|
|
84
|
-
} = instruction;
|
|
85
|
-
switch (type) {
|
|
86
|
-
case 'unit-price':
|
|
87
|
-
{
|
|
88
|
-
feePerUnit = new BigNumber(parsed.data.microLamports.toString());
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case 'unit-limit':
|
|
92
|
-
{
|
|
93
|
-
feeLimit = new BigNumber(parsed.data.units.toString());
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case 'transfer-sol':
|
|
97
|
-
{
|
|
98
|
-
outputs.push({
|
|
99
|
-
address: parsed.accounts.destination.address,
|
|
100
|
-
amount: parsed.data.amount.toString(),
|
|
101
|
-
script_type: 'PAYTOADDRESS'
|
|
102
|
-
});
|
|
103
|
-
sendAmount = sendAmount.plus(parsed.data.amount.toString());
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case 'create-account':
|
|
107
|
-
{
|
|
108
|
-
outputs.push({
|
|
109
|
-
address: parsed.accounts.newAccount.address,
|
|
110
|
-
amount: parsed.data.lamports.toString(),
|
|
111
|
-
script_type: 'PAYTOADDRESS'
|
|
112
|
-
});
|
|
113
|
-
rent = rent.plus(parsed.data.lamports.toString());
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
case 'transfer-checked':
|
|
117
|
-
{
|
|
118
|
-
const destinationATA = parsed.accounts.destination.address;
|
|
119
|
-
const tokenAccountInfos = this.params.proto.additional_info?.token_accounts_infos ?? [];
|
|
120
|
-
const tokenInfoIndex = tokenAccountInfos.findIndex(t => t.token_account === destinationATA && t.token_mint === parsed.accounts.mint.address);
|
|
121
|
-
const tokenInfo = tokenAccountInfos[tokenInfoIndex];
|
|
122
|
-
if (!sendAmount.isZero()) {
|
|
123
|
-
throw ERRORS.TypedError('Runtime', 'Multiple token transfers in a single transaction are not supported');
|
|
124
|
-
}
|
|
125
|
-
outputs.push({
|
|
126
|
-
address: tokenInfo?.base_address || destinationATA,
|
|
127
|
-
amount: parsed.data.amount.toString(),
|
|
128
|
-
script_type: 'PAYTOADDRESS'
|
|
129
|
-
});
|
|
130
|
-
sendAmount = new BigNumber(parsed.data.amount.toString());
|
|
131
|
-
token = {
|
|
132
|
-
standard: 'SPL',
|
|
133
|
-
contract: parsed.accounts.mint.address,
|
|
134
|
-
decimals: parsed.data.decimals,
|
|
135
|
-
symbol: this.params.symbols?.[tokenInfoIndex]
|
|
136
|
-
};
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
case 'other':
|
|
140
|
-
default:
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
if (outputs.length === 0) {
|
|
145
|
-
throw ERRORS.TypedError('Runtime', 'No outputs decoded');
|
|
146
|
-
}
|
|
147
|
-
const fee = baseFee.plus(feePerUnit.multipliedBy(feeLimit).dividedBy(1e6));
|
|
148
|
-
const totalSpent = sendAmount.plus(rent).plus(fee);
|
|
149
|
-
return {
|
|
150
|
-
type: 'final',
|
|
151
|
-
inputs: [],
|
|
152
|
-
outputsPermutation: [0],
|
|
153
|
-
outputs,
|
|
154
|
-
totalSpent: token ? sendAmount.toString() : totalSpent.toString(),
|
|
155
|
-
fee: fee.toString(),
|
|
156
|
-
feePerByte: feePerUnit.toString(),
|
|
157
|
-
feeLimit: feeLimit.toString(),
|
|
158
|
-
bytes: 0,
|
|
159
|
-
max: undefined,
|
|
160
|
-
isTokenKnown: false,
|
|
161
|
-
token,
|
|
162
|
-
createdTimestamp: 'blockhash' in message.lifetimeConstraint ? new Date().getTime() : undefined
|
|
163
|
-
};
|
|
164
|
-
} catch (e) {
|
|
165
|
-
console.error('Error in payloadToPrecomposed', e);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
async run() {
|
|
169
|
-
const cmd = this.getDevice().getCommands();
|
|
170
|
-
if (this.params.serialize) {
|
|
171
|
-
const {
|
|
172
|
-
createTransactionShimFromHex
|
|
173
|
-
} = await solana();
|
|
174
|
-
const tx = createTransactionShimFromHex(this.params.proto.serialized_tx);
|
|
175
|
-
const addressCall = await cmd.typedCall('SolanaGetAddress', 'SolanaAddress', {
|
|
176
|
-
address_n: this.params.proto.address_n,
|
|
177
|
-
show_display: false,
|
|
178
|
-
chunkify: false
|
|
179
|
-
});
|
|
180
|
-
const {
|
|
181
|
-
address
|
|
182
|
-
} = addressCall.message;
|
|
183
|
-
const {
|
|
184
|
-
message
|
|
185
|
-
} = await cmd.typedCall('SolanaSignTx', 'SolanaTxSignature', {
|
|
186
|
-
...this.params.proto,
|
|
187
|
-
serialized_tx: tx.serializeMessage()
|
|
188
|
-
});
|
|
189
|
-
tx.addSignature(address, message.signature);
|
|
190
|
-
const signedSerializedTx = tx.serialize();
|
|
191
|
-
return {
|
|
192
|
-
signature: message.signature,
|
|
193
|
-
serializedTx: signedSerializedTx
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
const {
|
|
197
|
-
message
|
|
198
|
-
} = await cmd.typedCall('SolanaSignTx', 'SolanaTxSignature', this.params.proto);
|
|
199
|
-
return {
|
|
200
|
-
signature: message.signature
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MessagesSchema } from '@trezor/protobuf';
|
|
2
|
-
interface GetSolanaTokenDefinition {
|
|
3
|
-
mintAddress?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const getSolanaTokenDefinition: ({ mintAddress }: GetSolanaTokenDefinition) => Promise<ArrayBuffer | undefined>;
|
|
6
|
-
export declare const decodeSolanaTokenDefinition: (encodedDefinition: ArrayBuffer) => MessagesSchema.SolanaTokenInfo;
|
|
7
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import fetch from "cross-fetch";
|
|
2
|
-
import { MessagesSchema, protobufManager } from "@trezor/protobuf";
|
|
3
|
-
import { trzd } from "@trezor/protocol";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
export const getSolanaTokenDefinition = async ({
|
|
6
|
-
mintAddress
|
|
7
|
-
}) => {
|
|
8
|
-
try {
|
|
9
|
-
if (mintAddress) {
|
|
10
|
-
const tokenDefinitionUrl = `https://data.trezor.io/firmware/definitions/solana/token/${mintAddress}.dat`;
|
|
11
|
-
const tokenDefinition = await fetch(tokenDefinitionUrl);
|
|
12
|
-
if (tokenDefinition.status === 200) {
|
|
13
|
-
const arrayBuffer = await tokenDefinition.arrayBuffer();
|
|
14
|
-
return arrayBuffer;
|
|
15
|
-
} else if (tokenDefinition.status !== 404) {
|
|
16
|
-
throw new Error(`unexpected status: $${tokenDefinition.status}`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
} catch (err) {
|
|
20
|
-
console.warn(`unable to download or parse solana token ${mintAddress} definition. detail: ${err.message}`);
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
};
|
|
24
|
-
export const decodeSolanaTokenDefinition = encodedDefinition => {
|
|
25
|
-
const {
|
|
26
|
-
protobufPayload
|
|
27
|
-
} = trzd.decode(encodedDefinition);
|
|
28
|
-
const {
|
|
29
|
-
message: decodedTokenDefinition
|
|
30
|
-
} = protobufManager.decode('SolanaTokenInfo', protobufPayload);
|
|
31
|
-
Assert(MessagesSchema.SolanaTokenInfo, decodedTokenDefinition);
|
|
32
|
-
return decodedTokenDefinition;
|
|
33
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MethodMessage } from '../../../core/AbstractMethod';
|
|
2
|
-
import { AbstractMiscGetAddress } from '../../common/AbstractMiscGetAddress';
|
|
3
|
-
import type { MiscGetAddressParams } from '../../common/AbstractMiscGetAddress';
|
|
4
|
-
export default class StellarGetAddress extends AbstractMiscGetAddress<'stellarGetAddress'> {
|
|
5
|
-
constructor(message: MethodMessage<'stellarGetAddress'>);
|
|
6
|
-
get info(): string;
|
|
7
|
-
get confirmation(): {
|
|
8
|
-
view: "export-address";
|
|
9
|
-
label: string;
|
|
10
|
-
};
|
|
11
|
-
_call({ proto }: MiscGetAddressParams): Promise<{
|
|
12
|
-
mac?: string | undefined;
|
|
13
|
-
address: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getMiscNetwork } from "../../../data/coinInfo.mjs";
|
|
2
|
-
import { AbstractMiscGetAddress } from "../../common/AbstractMiscGetAddress.mjs";
|
|
3
|
-
export default class StellarGetAddress extends AbstractMiscGetAddress {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message, 3);
|
|
6
|
-
this.requiredDeviceCapabilities = ['Capability_Stellar'];
|
|
7
|
-
this.requiredFirmwareCoins = [getMiscNetwork('Stellar')];
|
|
8
|
-
}
|
|
9
|
-
get info() {
|
|
10
|
-
return this.getInfo('Stellar', true);
|
|
11
|
-
}
|
|
12
|
-
get confirmation() {
|
|
13
|
-
return this.getConfirmation('Stellar');
|
|
14
|
-
}
|
|
15
|
-
async _call({
|
|
16
|
-
proto
|
|
17
|
-
}) {
|
|
18
|
-
const cmd = this.getDevice().getCommands();
|
|
19
|
-
const response = await cmd.typedCall('StellarGetAddress', 'StellarAddress', proto);
|
|
20
|
-
return response.message;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { MethodPermission, PROTO, StellarTransaction } from '@trezor/connect-common';
|
|
2
|
-
import type { MethodMessage } from '../../../core/AbstractMethod';
|
|
3
|
-
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
4
|
-
type Params = {
|
|
5
|
-
path: number[];
|
|
6
|
-
networkPassphrase: string;
|
|
7
|
-
transaction: StellarTransaction;
|
|
8
|
-
payment_req?: PROTO.PaymentRequest;
|
|
9
|
-
};
|
|
10
|
-
declare const StellarSignTransactionFeatures: Readonly<{
|
|
11
|
-
manageBuyOffer: string[];
|
|
12
|
-
pathPaymentStrictSend: string[];
|
|
13
|
-
}>;
|
|
14
|
-
export default class StellarSignTransaction extends AbstractMethod<'stellarSignTransaction', Params> {
|
|
15
|
-
constructor(message: MethodMessage<'stellarSignTransaction'>);
|
|
16
|
-
get requiredPermissions(): MethodPermission[];
|
|
17
|
-
get info(): string;
|
|
18
|
-
_isFeatureSupported(feature: keyof typeof StellarSignTransactionFeatures): boolean;
|
|
19
|
-
_ensureFeatureIsSupported(feature: keyof typeof StellarSignTransactionFeatures): void;
|
|
20
|
-
_ensureFirmwareSupportsParams(): void;
|
|
21
|
-
run(): Promise<{
|
|
22
|
-
publicKey: string;
|
|
23
|
-
signature: string;
|
|
24
|
-
}>;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { StellarSignTransaction as StellarSignTransactionSchema } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
3
|
-
import { Assert } from "@trezor/schema-utils";
|
|
4
|
-
import { AbstractMethod } from "../../../core/AbstractMethod.mjs";
|
|
5
|
-
import { getMiscNetwork } from "../../../data/coinInfo.mjs";
|
|
6
|
-
import { validatePath } from "../../../utils/pathUtils.mjs";
|
|
7
|
-
import { PAYMENT_REQUEST_AMOUNT_BYTES, encodePaymentRequestAmount } from "../../../utils/paymentRequest.mjs";
|
|
8
|
-
import * as helper from "../stellarSignTx.mjs";
|
|
9
|
-
const StellarSignTransactionFeatures = Object.freeze({
|
|
10
|
-
manageBuyOffer: ['1.10.4', '2.4.3'],
|
|
11
|
-
pathPaymentStrictSend: ['1.10.4', '2.4.3']
|
|
12
|
-
});
|
|
13
|
-
export default class StellarSignTransaction extends AbstractMethod {
|
|
14
|
-
constructor(message) {
|
|
15
|
-
const {
|
|
16
|
-
payload
|
|
17
|
-
} = message;
|
|
18
|
-
Assert(StellarSignTransactionSchema, payload);
|
|
19
|
-
const path = validatePath(payload.path, 3);
|
|
20
|
-
const {
|
|
21
|
-
transaction
|
|
22
|
-
} = payload;
|
|
23
|
-
const params = {
|
|
24
|
-
path,
|
|
25
|
-
networkPassphrase: payload.networkPassphrase,
|
|
26
|
-
transaction,
|
|
27
|
-
payment_req: payload.payment_req ? encodePaymentRequestAmount(payload.payment_req, PAYMENT_REQUEST_AMOUNT_BYTES.DEFAULT) : undefined
|
|
28
|
-
};
|
|
29
|
-
super(message, params);
|
|
30
|
-
this.requiredDeviceCapabilities = ['Capability_Stellar'];
|
|
31
|
-
this.requiredFirmwareCoins = [getMiscNetwork('Stellar')];
|
|
32
|
-
}
|
|
33
|
-
get requiredPermissions() {
|
|
34
|
-
return ['read', 'write'];
|
|
35
|
-
}
|
|
36
|
-
get info() {
|
|
37
|
-
return 'Sign Stellar transaction';
|
|
38
|
-
}
|
|
39
|
-
_isFeatureSupported(feature) {
|
|
40
|
-
return this.getDevice().atLeast(StellarSignTransactionFeatures[feature]);
|
|
41
|
-
}
|
|
42
|
-
_ensureFeatureIsSupported(feature) {
|
|
43
|
-
if (!this._isFeatureSupported(feature)) {
|
|
44
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `Feature ${feature} not supported by device firmware`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
_ensureFirmwareSupportsParams() {
|
|
48
|
-
const {
|
|
49
|
-
params
|
|
50
|
-
} = this;
|
|
51
|
-
if (params.transaction.operations && params.transaction.operations.find(o => o.type === 'manageBuyOffer')) {
|
|
52
|
-
this._ensureFeatureIsSupported('manageBuyOffer');
|
|
53
|
-
}
|
|
54
|
-
if (params.transaction.operations && params.transaction.operations.find(o => o.type === 'pathPaymentStrictSend')) {
|
|
55
|
-
this._ensureFeatureIsSupported('pathPaymentStrictSend');
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async run() {
|
|
59
|
-
this._ensureFirmwareSupportsParams();
|
|
60
|
-
const response = await helper.stellarSignTx(this.getDevice().getCommands().typedCall, this.params.path, this.params.networkPassphrase, this.params.transaction, this.params.payment_req);
|
|
61
|
-
return {
|
|
62
|
-
publicKey: response.public_key,
|
|
63
|
-
signature: response.signature
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { StellarTransaction } from '@trezor/connect-common/libESM/types/api/stellar';
|
|
2
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
import type { TypedCall } from '../../device/DeviceCommands';
|
|
4
|
-
export declare const stellarSignTx: (typedCall: TypedCall, address_n: number[], networkPassphrase: string, tx: StellarTransaction, payment_req?: PROTO.PaymentRequest) => Promise<{
|
|
5
|
-
public_key: string;
|
|
6
|
-
signature: string;
|
|
7
|
-
}>;
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
2
|
-
import { StellarOperation } from "@trezor/connect-common/libESM/types/api/stellar/index.mjs";
|
|
3
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
const processTxRequest = async (typedCall, operations, index) => {
|
|
6
|
-
const lastOp = index + 1 >= operations.length;
|
|
7
|
-
const {
|
|
8
|
-
type,
|
|
9
|
-
...op
|
|
10
|
-
} = operations[index];
|
|
11
|
-
if (lastOp) {
|
|
12
|
-
const response = await typedCall(type, 'StellarSignedTx', op);
|
|
13
|
-
return response.message;
|
|
14
|
-
}
|
|
15
|
-
await typedCall(type, 'StellarTxOpRequest', op);
|
|
16
|
-
return processTxRequest(typedCall, operations, index + 1);
|
|
17
|
-
};
|
|
18
|
-
const transformSignMessage = tx => {
|
|
19
|
-
if (!tx.timebounds) {
|
|
20
|
-
throw ERRORS.TypedError('Runtime', 'transformSignMessage: Unspecified timebounds are not supported');
|
|
21
|
-
}
|
|
22
|
-
const msg = {
|
|
23
|
-
address_n: [],
|
|
24
|
-
network_passphrase: '',
|
|
25
|
-
source_account: tx.source,
|
|
26
|
-
fee: tx.fee,
|
|
27
|
-
sequence_number: tx.sequence,
|
|
28
|
-
timebounds_start: tx.timebounds.minTime,
|
|
29
|
-
timebounds_end: tx.timebounds.maxTime,
|
|
30
|
-
memo_type: PROTO.StellarMemoType.NONE,
|
|
31
|
-
num_operations: tx.operations.length
|
|
32
|
-
};
|
|
33
|
-
if (tx.memo) {
|
|
34
|
-
msg.memo_type = tx.memo.type;
|
|
35
|
-
msg.memo_text = tx.memo.text;
|
|
36
|
-
msg.memo_id = tx.memo.id;
|
|
37
|
-
msg.memo_hash = tx.memo.hash;
|
|
38
|
-
}
|
|
39
|
-
return msg;
|
|
40
|
-
};
|
|
41
|
-
const transformOperation = op => {
|
|
42
|
-
Assert(StellarOperation, op);
|
|
43
|
-
switch (op.type) {
|
|
44
|
-
case 'createAccount':
|
|
45
|
-
return {
|
|
46
|
-
type: 'StellarCreateAccountOp',
|
|
47
|
-
source_account: op.source,
|
|
48
|
-
new_account: op.destination,
|
|
49
|
-
starting_balance: op.startingBalance
|
|
50
|
-
};
|
|
51
|
-
case 'payment':
|
|
52
|
-
return {
|
|
53
|
-
type: 'StellarPaymentOp',
|
|
54
|
-
source_account: op.source,
|
|
55
|
-
destination_account: op.destination,
|
|
56
|
-
asset: op.asset,
|
|
57
|
-
amount: op.amount
|
|
58
|
-
};
|
|
59
|
-
case 'pathPaymentStrictReceive':
|
|
60
|
-
return {
|
|
61
|
-
type: 'StellarPathPaymentStrictReceiveOp',
|
|
62
|
-
source_account: op.source,
|
|
63
|
-
send_asset: op.sendAsset,
|
|
64
|
-
send_max: op.sendMax,
|
|
65
|
-
destination_account: op.destination,
|
|
66
|
-
destination_asset: op.destAsset,
|
|
67
|
-
destination_amount: op.destAmount,
|
|
68
|
-
paths: op.path
|
|
69
|
-
};
|
|
70
|
-
case 'pathPaymentStrictSend':
|
|
71
|
-
return {
|
|
72
|
-
type: 'StellarPathPaymentStrictSendOp',
|
|
73
|
-
source_account: op.source,
|
|
74
|
-
send_asset: op.sendAsset,
|
|
75
|
-
send_amount: op.sendAmount,
|
|
76
|
-
destination_account: op.destination,
|
|
77
|
-
destination_asset: op.destAsset,
|
|
78
|
-
destination_min: op.destMin,
|
|
79
|
-
paths: op.path
|
|
80
|
-
};
|
|
81
|
-
case 'createPassiveSellOffer':
|
|
82
|
-
return {
|
|
83
|
-
type: 'StellarCreatePassiveSellOfferOp',
|
|
84
|
-
source_account: op.source,
|
|
85
|
-
buying_asset: op.buying,
|
|
86
|
-
selling_asset: op.selling,
|
|
87
|
-
amount: op.amount,
|
|
88
|
-
price_n: op.price.n,
|
|
89
|
-
price_d: op.price.d
|
|
90
|
-
};
|
|
91
|
-
case 'manageSellOffer':
|
|
92
|
-
return {
|
|
93
|
-
type: 'StellarManageSellOfferOp',
|
|
94
|
-
source_account: op.source,
|
|
95
|
-
buying_asset: op.buying,
|
|
96
|
-
selling_asset: op.selling,
|
|
97
|
-
amount: op.amount,
|
|
98
|
-
offer_id: op.offerId || 0,
|
|
99
|
-
price_n: op.price.n,
|
|
100
|
-
price_d: op.price.d
|
|
101
|
-
};
|
|
102
|
-
case 'manageBuyOffer':
|
|
103
|
-
return {
|
|
104
|
-
type: 'StellarManageBuyOfferOp',
|
|
105
|
-
source_account: op.source,
|
|
106
|
-
buying_asset: op.buying,
|
|
107
|
-
selling_asset: op.selling,
|
|
108
|
-
amount: op.amount,
|
|
109
|
-
offer_id: op.offerId || 0,
|
|
110
|
-
price_n: op.price.n,
|
|
111
|
-
price_d: op.price.d
|
|
112
|
-
};
|
|
113
|
-
case 'setOptions':
|
|
114
|
-
{
|
|
115
|
-
const signer = op.signer ? {
|
|
116
|
-
signer_type: op.signer.type,
|
|
117
|
-
signer_key: op.signer.key,
|
|
118
|
-
signer_weight: op.signer.weight
|
|
119
|
-
} : undefined;
|
|
120
|
-
return {
|
|
121
|
-
type: 'StellarSetOptionsOp',
|
|
122
|
-
source_account: op.source,
|
|
123
|
-
clear_flags: op.clearFlags,
|
|
124
|
-
set_flags: op.setFlags,
|
|
125
|
-
master_weight: op.masterWeight,
|
|
126
|
-
low_threshold: op.lowThreshold,
|
|
127
|
-
medium_threshold: op.medThreshold,
|
|
128
|
-
high_threshold: op.highThreshold,
|
|
129
|
-
home_domain: op.homeDomain,
|
|
130
|
-
inflation_destination_account: op.inflationDest,
|
|
131
|
-
...signer
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
case 'changeTrust':
|
|
135
|
-
return {
|
|
136
|
-
type: 'StellarChangeTrustOp',
|
|
137
|
-
source_account: op.source,
|
|
138
|
-
asset: op.line,
|
|
139
|
-
limit: op.limit
|
|
140
|
-
};
|
|
141
|
-
case 'allowTrust':
|
|
142
|
-
return {
|
|
143
|
-
type: 'StellarAllowTrustOp',
|
|
144
|
-
source_account: op.source,
|
|
145
|
-
trusted_account: op.trustor,
|
|
146
|
-
asset_type: op.assetType,
|
|
147
|
-
asset_code: op.assetCode,
|
|
148
|
-
is_authorized: !!op.authorize
|
|
149
|
-
};
|
|
150
|
-
case 'accountMerge':
|
|
151
|
-
return {
|
|
152
|
-
type: 'StellarAccountMergeOp',
|
|
153
|
-
source_account: op.source,
|
|
154
|
-
destination_account: op.destination
|
|
155
|
-
};
|
|
156
|
-
case 'manageData':
|
|
157
|
-
return {
|
|
158
|
-
type: 'StellarManageDataOp',
|
|
159
|
-
source_account: op.source,
|
|
160
|
-
key: op.name,
|
|
161
|
-
value: op.value
|
|
162
|
-
};
|
|
163
|
-
case 'bumpSequence':
|
|
164
|
-
return {
|
|
165
|
-
type: 'StellarBumpSequenceOp',
|
|
166
|
-
source_account: op.source,
|
|
167
|
-
bump_to: op.bumpTo
|
|
168
|
-
};
|
|
169
|
-
case 'claimClaimableBalance':
|
|
170
|
-
return {
|
|
171
|
-
type: 'StellarClaimClaimableBalanceOp',
|
|
172
|
-
source_account: op.source,
|
|
173
|
-
balance_id: op.balanceId
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
export const stellarSignTx = async (typedCall, address_n, networkPassphrase, tx, payment_req) => {
|
|
178
|
-
const message = transformSignMessage(tx);
|
|
179
|
-
message.address_n = address_n;
|
|
180
|
-
message.network_passphrase = networkPassphrase;
|
|
181
|
-
message.payment_req = payment_req;
|
|
182
|
-
const operations = [];
|
|
183
|
-
tx.operations.forEach(op => {
|
|
184
|
-
const transformed = transformOperation(op);
|
|
185
|
-
if (transformed) {
|
|
186
|
-
operations.push(transformed);
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
await typedCall('StellarSignTx', 'StellarTxOpRequest', message);
|
|
190
|
-
return processTxRequest(typedCall, operations, 0);
|
|
191
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type MethodPermission } from '@trezor/connect-common';
|
|
2
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
import type { MethodMessage } from '../core/AbstractMethod';
|
|
4
|
-
import { AbstractMethod } from '../core/AbstractMethod';
|
|
5
|
-
export default class TelemetryGet extends AbstractMethod<'telemetryGet', PROTO.TelemetryGet> {
|
|
6
|
-
constructor(message: MethodMessage<'telemetryGet'>);
|
|
7
|
-
get requiredPermissions(): MethodPermission[];
|
|
8
|
-
run(): Promise<{
|
|
9
|
-
min_temp_c?: number | undefined;
|
|
10
|
-
max_temp_c?: number | undefined;
|
|
11
|
-
battery_errors?: number | undefined;
|
|
12
|
-
battery_cycles?: number | undefined;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
2
|
-
import { Assert } from "@trezor/schema-utils";
|
|
3
|
-
import { AbstractMethod } from "../core/AbstractMethod.mjs";
|
|
4
|
-
export default class TelemetryGet extends AbstractMethod {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
const {
|
|
7
|
-
payload
|
|
8
|
-
} = message;
|
|
9
|
-
Assert(PROTO.TelemetryGet, payload);
|
|
10
|
-
const params = {
|
|
11
|
-
...payload
|
|
12
|
-
};
|
|
13
|
-
super(message, params);
|
|
14
|
-
this.useDeviceState = false;
|
|
15
|
-
}
|
|
16
|
-
get requiredPermissions() {
|
|
17
|
-
return ['management'];
|
|
18
|
-
}
|
|
19
|
-
async run() {
|
|
20
|
-
const cmd = this.getDevice().getCommands();
|
|
21
|
-
const response = await cmd.typedCall('TelemetryGet', 'Telemetry', this.params);
|
|
22
|
-
return response.message;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MethodMessage } from '../../../core/AbstractMethod';
|
|
2
|
-
import { AbstractMiscGetAddress } from '../../common/AbstractMiscGetAddress';
|
|
3
|
-
import type { MiscGetAddressParams } from '../../common/AbstractMiscGetAddress';
|
|
4
|
-
export default class TezosGetAddress extends AbstractMiscGetAddress<'tezosGetAddress'> {
|
|
5
|
-
constructor(message: MethodMessage<'tezosGetAddress'>);
|
|
6
|
-
get info(): string;
|
|
7
|
-
get confirmation(): {
|
|
8
|
-
view: "export-address";
|
|
9
|
-
label: string;
|
|
10
|
-
};
|
|
11
|
-
_call({ proto }: MiscGetAddressParams): Promise<{
|
|
12
|
-
mac?: string | undefined;
|
|
13
|
-
address: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getMiscNetwork } from "../../../data/coinInfo.mjs";
|
|
2
|
-
import { AbstractMiscGetAddress } from "../../common/AbstractMiscGetAddress.mjs";
|
|
3
|
-
export default class TezosGetAddress extends AbstractMiscGetAddress {
|
|
4
|
-
constructor(message) {
|
|
5
|
-
super(message, 3);
|
|
6
|
-
this.requiredDeviceCapabilities = ['Capability_Tezos'];
|
|
7
|
-
this.requiredFirmwareCoins = [getMiscNetwork('Tezos')];
|
|
8
|
-
}
|
|
9
|
-
get info() {
|
|
10
|
-
return this.getInfo('Tezos', true);
|
|
11
|
-
}
|
|
12
|
-
get confirmation() {
|
|
13
|
-
return this.getConfirmation('Tezos');
|
|
14
|
-
}
|
|
15
|
-
async _call({
|
|
16
|
-
proto
|
|
17
|
-
}) {
|
|
18
|
-
const cmd = this.getDevice().getCommands();
|
|
19
|
-
const response = await cmd.typedCall('TezosGetAddress', 'TezosAddress', proto);
|
|
20
|
-
return response.message;
|
|
21
|
-
}
|
|
22
|
-
}
|