@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,9 +0,0 @@
|
|
|
1
|
-
export * from "./createPendingTx.mjs";
|
|
2
|
-
export * from "./enhanceSignTx.mjs";
|
|
3
|
-
export * from "./inputs.mjs";
|
|
4
|
-
export * from "./outputs.mjs";
|
|
5
|
-
export * from "./refTx.mjs";
|
|
6
|
-
export * from "./signtx.mjs";
|
|
7
|
-
export * from "./signtxLegacy.mjs";
|
|
8
|
-
export * from "./signtxVerify.mjs";
|
|
9
|
-
export * from "./TransactionComposer.mjs";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { BitcoinNetworkInfo, ComposeUtxo, ProtoWithDerivationPath } from '@trezor/connect-common';
|
|
2
|
-
import type { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
import type { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib';
|
|
4
|
-
export declare const validateTrezorInputs: (inputs: ProtoWithDerivationPath<PROTO.TxInputType>[], coinInfo: BitcoinNetworkInfo) => PROTO.TxInputType[];
|
|
5
|
-
export declare const enhanceTrezorInputs: (inputs: PROTO.TxInputType[], rawTxs: BitcoinJsTransaction[]) => void;
|
|
6
|
-
export declare const inputToTrezor: (input: ComposeUtxo, sequence?: number) => PROTO.TxInputType;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { convertMultisigPubKey } from "../../utils/hdnodeUtils.mjs";
|
|
2
|
-
import { fixPath, getHDPath, getScriptType, isSegwitPath, validatePath } from "../../utils/pathUtils.mjs";
|
|
3
|
-
import { validateParams } from "../common/paramsValidator.mjs";
|
|
4
|
-
export const validateTrezorInputs = (inputs, coinInfo) => inputs.map(i => fixPath(i)).map(i => convertMultisigPubKey(coinInfo.network, i)).map(input => {
|
|
5
|
-
const useAmount = input.script_type === 'EXTERNAL' || isSegwitPath(input.address_n);
|
|
6
|
-
validateParams(input, [{
|
|
7
|
-
name: 'prev_hash',
|
|
8
|
-
type: 'string',
|
|
9
|
-
required: true
|
|
10
|
-
}, {
|
|
11
|
-
name: 'prev_index',
|
|
12
|
-
type: 'number',
|
|
13
|
-
required: true
|
|
14
|
-
}, {
|
|
15
|
-
name: 'amount',
|
|
16
|
-
type: 'uint',
|
|
17
|
-
required: useAmount
|
|
18
|
-
}, {
|
|
19
|
-
name: 'script_type',
|
|
20
|
-
type: 'string'
|
|
21
|
-
}, {
|
|
22
|
-
name: 'sequence',
|
|
23
|
-
type: 'number'
|
|
24
|
-
}, {
|
|
25
|
-
name: 'multisig',
|
|
26
|
-
type: 'object'
|
|
27
|
-
}, {
|
|
28
|
-
name: 'coinjoin_flags',
|
|
29
|
-
type: 'number'
|
|
30
|
-
}]);
|
|
31
|
-
if (input.script_type === 'EXTERNAL') {
|
|
32
|
-
validateParams(input, [{
|
|
33
|
-
name: 'script_pubkey',
|
|
34
|
-
type: 'string',
|
|
35
|
-
required: true
|
|
36
|
-
}, {
|
|
37
|
-
name: 'commitment_data',
|
|
38
|
-
type: 'string'
|
|
39
|
-
}, {
|
|
40
|
-
name: 'ownership_proof',
|
|
41
|
-
type: 'string'
|
|
42
|
-
}, {
|
|
43
|
-
name: 'script_sig',
|
|
44
|
-
type: 'string'
|
|
45
|
-
}, {
|
|
46
|
-
name: 'witness',
|
|
47
|
-
type: 'string'
|
|
48
|
-
}]);
|
|
49
|
-
} else {
|
|
50
|
-
validatePath(input.address_n);
|
|
51
|
-
}
|
|
52
|
-
return input;
|
|
53
|
-
});
|
|
54
|
-
export const enhanceTrezorInputs = (inputs, rawTxs) => {
|
|
55
|
-
inputs.forEach(input => {
|
|
56
|
-
if (!input.amount) {
|
|
57
|
-
console.warn('TrezorConnect.signTransaction deprecation: missing input amount.');
|
|
58
|
-
const refTx = rawTxs.find(t => t.getId() === input.prev_hash);
|
|
59
|
-
if (refTx && refTx.outs[input.prev_index]) {
|
|
60
|
-
input.amount = refTx.outs[input.prev_index].value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
export const inputToTrezor = (input, sequence = 0xffffffff) => {
|
|
66
|
-
const address_n = getHDPath(input.path);
|
|
67
|
-
return {
|
|
68
|
-
address_n,
|
|
69
|
-
prev_index: input.vout,
|
|
70
|
-
prev_hash: input.txid,
|
|
71
|
-
script_type: getScriptType(address_n),
|
|
72
|
-
amount: input.amount,
|
|
73
|
-
sequence
|
|
74
|
-
};
|
|
75
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { BitcoinNetworkInfo, ComposeOutput, ComposeResultFinal, PROTO, ProtoWithDerivationPath } from '@trezor/connect-common';
|
|
2
|
-
import type { ComposeOutput as ComposeOutputBase } from '@trezor/utxo-lib';
|
|
3
|
-
export declare const validateTrezorOutputs: (outputs: ProtoWithDerivationPath<PROTO.TxOutputType>[], coinInfo: BitcoinNetworkInfo) => PROTO.TxOutputType[];
|
|
4
|
-
export declare const validateHDOutput: (output: ComposeOutput, coinInfo: BitcoinNetworkInfo) => ComposeOutputBase;
|
|
5
|
-
export declare const outputToTrezor: (output: ComposeResultFinal["outputs"][number]) => PROTO.TxOutputType;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { ERRORS } from "@trezor/connect-common/libESM/constants/index.mjs";
|
|
2
|
-
import { isValidAddress } from "../../utils/addressUtils.mjs";
|
|
3
|
-
import { convertMultisigPubKey } from "../../utils/hdnodeUtils.mjs";
|
|
4
|
-
import { fixPath, getHDPath, getOutputScriptType } from "../../utils/pathUtils.mjs";
|
|
5
|
-
import { validateParams } from "../common/paramsValidator.mjs";
|
|
6
|
-
export const validateTrezorOutputs = (outputs, coinInfo) => {
|
|
7
|
-
const trezorOutputs = outputs.map(o => fixPath(o)).map(o => convertMultisigPubKey(coinInfo.network, o));
|
|
8
|
-
trezorOutputs.forEach(output => {
|
|
9
|
-
validateParams(output, [{
|
|
10
|
-
name: 'address_n',
|
|
11
|
-
type: 'array'
|
|
12
|
-
}, {
|
|
13
|
-
name: 'address',
|
|
14
|
-
type: 'string'
|
|
15
|
-
}, {
|
|
16
|
-
name: 'amount',
|
|
17
|
-
type: 'uint'
|
|
18
|
-
}, {
|
|
19
|
-
name: 'op_return_data',
|
|
20
|
-
type: 'string'
|
|
21
|
-
}, {
|
|
22
|
-
name: 'script_type',
|
|
23
|
-
type: 'string'
|
|
24
|
-
}, {
|
|
25
|
-
name: 'multisig',
|
|
26
|
-
type: 'object'
|
|
27
|
-
}]);
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(output, 'address_n') && Object.prototype.hasOwnProperty.call(output, 'address')) {
|
|
29
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Cannot use address and address_n in one output');
|
|
30
|
-
}
|
|
31
|
-
if (output.address_n && !output.script_type) {
|
|
32
|
-
output.script_type = getOutputScriptType(output.address_n);
|
|
33
|
-
}
|
|
34
|
-
if ('address' in output && typeof output.address === 'string') {
|
|
35
|
-
const externalOutput = output;
|
|
36
|
-
if (!externalOutput.script_type) {
|
|
37
|
-
externalOutput.script_type = 'PAYTOADDRESS';
|
|
38
|
-
} else if (externalOutput.script_type !== 'PAYTOADDRESS') {
|
|
39
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `External output (with address) must use script_type PAYTOADDRESS, got ${externalOutput.script_type}`);
|
|
40
|
-
}
|
|
41
|
-
if (!isValidAddress(externalOutput.address, coinInfo)) {
|
|
42
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `Invalid ${coinInfo.label} output address ${externalOutput.address}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
return trezorOutputs;
|
|
47
|
-
};
|
|
48
|
-
export const validateHDOutput = (output, coinInfo) => {
|
|
49
|
-
const validateAddress = address => {
|
|
50
|
-
if (!address || !isValidAddress(address, coinInfo)) {
|
|
51
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `Invalid ${coinInfo.label} output address format`);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
switch (output.type) {
|
|
55
|
-
case 'opreturn':
|
|
56
|
-
validateParams(output, [{
|
|
57
|
-
name: 'dataHex',
|
|
58
|
-
type: 'string'
|
|
59
|
-
}]);
|
|
60
|
-
return {
|
|
61
|
-
type: 'opreturn',
|
|
62
|
-
dataHex: output.dataHex
|
|
63
|
-
};
|
|
64
|
-
case 'send-max':
|
|
65
|
-
validateParams(output, [{
|
|
66
|
-
name: 'address',
|
|
67
|
-
type: 'string',
|
|
68
|
-
required: true
|
|
69
|
-
}]);
|
|
70
|
-
validateAddress(output.address);
|
|
71
|
-
return {
|
|
72
|
-
type: 'send-max',
|
|
73
|
-
address: output.address
|
|
74
|
-
};
|
|
75
|
-
case 'payment-noaddress':
|
|
76
|
-
validateParams(output, [{
|
|
77
|
-
name: 'amount',
|
|
78
|
-
type: 'uint',
|
|
79
|
-
required: true
|
|
80
|
-
}]);
|
|
81
|
-
return {
|
|
82
|
-
type: 'payment-noaddress',
|
|
83
|
-
amount: output.amount
|
|
84
|
-
};
|
|
85
|
-
case 'send-max-noaddress':
|
|
86
|
-
return {
|
|
87
|
-
type: 'send-max-noaddress'
|
|
88
|
-
};
|
|
89
|
-
default:
|
|
90
|
-
validateParams(output, [{
|
|
91
|
-
name: 'amount',
|
|
92
|
-
type: 'uint',
|
|
93
|
-
required: true
|
|
94
|
-
}, {
|
|
95
|
-
name: 'address',
|
|
96
|
-
type: 'string',
|
|
97
|
-
required: true
|
|
98
|
-
}]);
|
|
99
|
-
validateAddress(output.address);
|
|
100
|
-
return {
|
|
101
|
-
type: 'payment',
|
|
102
|
-
address: output.address,
|
|
103
|
-
amount: output.amount
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
export const outputToTrezor = output => {
|
|
108
|
-
if (output.type === 'opreturn') {
|
|
109
|
-
return {
|
|
110
|
-
amount: '0',
|
|
111
|
-
op_return_data: output.dataHex,
|
|
112
|
-
script_type: 'PAYTOOPRETURN'
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
if (output.type === 'change') {
|
|
116
|
-
const address_n = getHDPath(output.path);
|
|
117
|
-
return {
|
|
118
|
-
address_n,
|
|
119
|
-
amount: output.amount,
|
|
120
|
-
script_type: getOutputScriptType(address_n)
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
address: output.address,
|
|
125
|
-
amount: output.amount,
|
|
126
|
-
script_type: 'PAYTOADDRESS'
|
|
127
|
-
};
|
|
128
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { AccountAddresses, AccountTransaction, BitcoinNetworkInfo, CoinInfo, RefTransaction, TransactionOptions } from '@trezor/connect-common';
|
|
2
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
import { Transaction as BitcoinJsTransaction, type Network } from '@trezor/utxo-lib';
|
|
4
|
-
export declare const requireReferencedTransactions: (inputs: PROTO.TxInputType[], options?: TransactionOptions, coinInfo?: CoinInfo) => boolean;
|
|
5
|
-
export declare const getReferencedTransactions: (inputs: PROTO.TxInputType[]) => string[];
|
|
6
|
-
export declare const getOrigTransactions: (inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[]) => string[];
|
|
7
|
-
export declare const parseTransactionHexes: (network?: Network) => (hexes: string[]) => (import("@trezor/utxo-lib/libESM/transaction/base").TransactionBase<undefined> | import("@trezor/utxo-lib/libESM/transaction/base").TransactionBase<import("@trezor/utxo-lib/libESM/transaction/dash").DashSpecific> | import("@trezor/utxo-lib/libESM/transaction/base").TransactionBase<import("@trezor/utxo-lib/libESM/transaction/zcash").ZcashSpecific>)[];
|
|
8
|
-
export declare const transformOrigTransactions: (txs: BitcoinJsTransaction[], coinInfo: BitcoinNetworkInfo, currentInputs: PROTO.TxInputType[], addresses: AccountAddresses) => RefTransaction[];
|
|
9
|
-
export declare const transformReferencedTransaction: (tx: BitcoinJsTransaction) => RefTransaction;
|
|
10
|
-
export declare const transformReferencedTransactions: (txs: BitcoinJsTransaction[]) => RefTransaction[];
|
|
11
|
-
export declare const validateReferencedTransactions: ({ transactions, inputs, outputs, addresses, coinInfo, }: {
|
|
12
|
-
transactions?: (RefTransaction | AccountTransaction)[];
|
|
13
|
-
inputs: PROTO.TxInputType[];
|
|
14
|
-
outputs: PROTO.TxOutputType[];
|
|
15
|
-
addresses?: AccountAddresses;
|
|
16
|
-
coinInfo: BitcoinNetworkInfo;
|
|
17
|
-
}) => RefTransaction[] | undefined;
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
import { TypedError } from "@trezor/connect-common/libESM/constants/errors.mjs";
|
|
2
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
3
|
-
import { Assert, Type } from "@trezor/schema-utils";
|
|
4
|
-
import { bufferUtils } from "@trezor/utils";
|
|
5
|
-
import { address as BitcoinJsAddress, payments as BitcoinJsPayments, Transaction as BitcoinJsTransaction } from "@trezor/utxo-lib";
|
|
6
|
-
import { getHDPath, getOutputScriptType, getScriptType } from "../../utils/pathUtils.mjs";
|
|
7
|
-
export const requireReferencedTransactions = (inputs, options = {}, coinInfo) => {
|
|
8
|
-
if (coinInfo?.shortcut === 'ZEC' || coinInfo?.shortcut === 'TAZ') {
|
|
9
|
-
return !(options.version && options.version >= 5);
|
|
10
|
-
}
|
|
11
|
-
const inputTypes = ['SPENDTAPROOT', 'EXTERNAL'];
|
|
12
|
-
return !!inputs.find(input => !inputTypes.find(t => t === input.script_type));
|
|
13
|
-
};
|
|
14
|
-
export const getReferencedTransactions = inputs => {
|
|
15
|
-
const result = [];
|
|
16
|
-
inputs.forEach(input => {
|
|
17
|
-
if (input.prev_hash && !result.includes(input.prev_hash)) {
|
|
18
|
-
result.push(input.prev_hash);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
export const getOrigTransactions = (inputs, outputs) => {
|
|
24
|
-
const result = [];
|
|
25
|
-
inputs.forEach(input => {
|
|
26
|
-
if (input.orig_hash && !result.includes(input.orig_hash)) {
|
|
27
|
-
result.push(input.orig_hash);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
outputs.forEach(output => {
|
|
31
|
-
if (output.orig_hash && !result.includes(output.orig_hash)) {
|
|
32
|
-
result.push(output.orig_hash);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
export const parseTransactionHexes = network => hexes => hexes.map(hex => BitcoinJsTransaction.fromHex(hex, {
|
|
38
|
-
network
|
|
39
|
-
}));
|
|
40
|
-
const enhanceTransaction = (refTx, srcTx) => {
|
|
41
|
-
const extraData = srcTx.getExtraData();
|
|
42
|
-
if (extraData) {
|
|
43
|
-
refTx.extra_data = extraData.toString('hex');
|
|
44
|
-
}
|
|
45
|
-
const specific = srcTx.getSpecificData();
|
|
46
|
-
if (specific) {
|
|
47
|
-
if (specific.type === 'zcash' && specific.versionGroupId && refTx.version >= 3) {
|
|
48
|
-
refTx.version_group_id = specific.versionGroupId;
|
|
49
|
-
}
|
|
50
|
-
if (specific.type === 'dash' && srcTx.type && srcTx.version >= 3) {
|
|
51
|
-
refTx.version |= srcTx.type << 16;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return refTx;
|
|
55
|
-
};
|
|
56
|
-
const parseOutputScript = (output, network) => {
|
|
57
|
-
try {
|
|
58
|
-
const address = BitcoinJsAddress.fromOutputScript(output, network);
|
|
59
|
-
return {
|
|
60
|
-
type: 'address',
|
|
61
|
-
address
|
|
62
|
-
};
|
|
63
|
-
} catch {
|
|
64
|
-
try {
|
|
65
|
-
const {
|
|
66
|
-
data
|
|
67
|
-
} = BitcoinJsPayments.embed({
|
|
68
|
-
output
|
|
69
|
-
}, {
|
|
70
|
-
validate: true
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
type: 'data',
|
|
74
|
-
data
|
|
75
|
-
};
|
|
76
|
-
} catch {
|
|
77
|
-
return {
|
|
78
|
-
type: 'unknown'
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const transformOrigTransaction = (tx, coinInfo, currentInputs, addresses) => {
|
|
84
|
-
const inputsMap = (input, i) => {
|
|
85
|
-
const prev_hash = bufferUtils.reverseBuffer(input.hash).toString('hex');
|
|
86
|
-
const currentInput = currentInputs.find(inp => inp.prev_hash === prev_hash && inp.prev_index === input.index);
|
|
87
|
-
if (!currentInput?.address_n) {
|
|
88
|
-
throw TypedError('Method_InvalidParameter', `transformOrigTransactions: invalid input at ${tx.getId()} [${i}]`);
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
address_n: currentInput.address_n,
|
|
92
|
-
prev_hash,
|
|
93
|
-
prev_index: input.index,
|
|
94
|
-
script_sig: input.script.toString('hex'),
|
|
95
|
-
sequence: input.sequence,
|
|
96
|
-
script_type: getScriptType(currentInput.address_n),
|
|
97
|
-
multisig: undefined,
|
|
98
|
-
amount: currentInput.amount,
|
|
99
|
-
witness: tx.getWitness(i)?.toString('hex'),
|
|
100
|
-
ownership_proof: undefined,
|
|
101
|
-
commitment_data: undefined
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
const outputsMap = (output, i) => {
|
|
105
|
-
const parsed = parseOutputScript(output.script, coinInfo.network);
|
|
106
|
-
switch (parsed.type) {
|
|
107
|
-
case 'data':
|
|
108
|
-
{
|
|
109
|
-
const op_return_data = parsed.data?.shift()?.toString('hex');
|
|
110
|
-
if (typeof op_return_data !== 'string') {
|
|
111
|
-
throw TypedError('Method_InvalidParameter', `transformOrigTransactions: invalid op_return_data at ${tx.getId()} [${i}]`);
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
script_type: 'PAYTOOPRETURN',
|
|
115
|
-
amount: '0',
|
|
116
|
-
op_return_data
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
case 'address':
|
|
120
|
-
{
|
|
121
|
-
const {
|
|
122
|
-
address
|
|
123
|
-
} = parsed;
|
|
124
|
-
const changeAddress = addresses.change.find(addr => addr.address === address);
|
|
125
|
-
const address_n = changeAddress && getHDPath(changeAddress.path);
|
|
126
|
-
const amount = output.value.toString();
|
|
127
|
-
return address_n ? {
|
|
128
|
-
address_n,
|
|
129
|
-
amount,
|
|
130
|
-
script_type: getOutputScriptType(address_n)
|
|
131
|
-
} : {
|
|
132
|
-
address,
|
|
133
|
-
amount,
|
|
134
|
-
script_type: 'PAYTOADDRESS'
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
case 'unknown':
|
|
138
|
-
default:
|
|
139
|
-
throw TypedError('Method_InvalidParameter', `transformOrigTransactions: invalid output at ${tx.getId()} [${i}]`);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const refTx = {
|
|
143
|
-
version: tx.version,
|
|
144
|
-
hash: tx.getId(),
|
|
145
|
-
inputs: tx.ins.map(inputsMap),
|
|
146
|
-
outputs: tx.outs.map(outputsMap),
|
|
147
|
-
lock_time: tx.locktime,
|
|
148
|
-
timestamp: tx.timestamp,
|
|
149
|
-
expiry: tx.expiry
|
|
150
|
-
};
|
|
151
|
-
return enhanceTransaction(refTx, tx);
|
|
152
|
-
};
|
|
153
|
-
export const transformOrigTransactions = (txs, coinInfo, currentInputs, addresses) => txs.map(tx => transformOrigTransaction(tx, coinInfo, currentInputs, addresses));
|
|
154
|
-
export const transformReferencedTransaction = tx => {
|
|
155
|
-
const inputsMap = input => ({
|
|
156
|
-
prev_index: input.index,
|
|
157
|
-
sequence: input.sequence,
|
|
158
|
-
prev_hash: bufferUtils.reverseBuffer(input.hash).toString('hex'),
|
|
159
|
-
script_sig: input.script.toString('hex')
|
|
160
|
-
});
|
|
161
|
-
const binOutputsMap = output => ({
|
|
162
|
-
amount: output.value.toString(),
|
|
163
|
-
script_pubkey: output.script.toString('hex')
|
|
164
|
-
});
|
|
165
|
-
const refTx = {
|
|
166
|
-
version: tx.version,
|
|
167
|
-
hash: tx.getId(),
|
|
168
|
-
inputs: tx.ins.map(inputsMap),
|
|
169
|
-
bin_outputs: tx.outs.map(binOutputsMap),
|
|
170
|
-
lock_time: tx.locktime,
|
|
171
|
-
timestamp: tx.timestamp,
|
|
172
|
-
expiry: tx.expiry
|
|
173
|
-
};
|
|
174
|
-
return enhanceTransaction(refTx, tx);
|
|
175
|
-
};
|
|
176
|
-
export const transformReferencedTransactions = txs => txs.map(transformReferencedTransaction);
|
|
177
|
-
export const validateReferencedTransactions = ({
|
|
178
|
-
transactions,
|
|
179
|
-
inputs,
|
|
180
|
-
outputs,
|
|
181
|
-
addresses,
|
|
182
|
-
coinInfo
|
|
183
|
-
}) => {
|
|
184
|
-
if (!Array.isArray(transactions) || transactions.length === 0) return;
|
|
185
|
-
const refTxs = requireReferencedTransactions(inputs) ? getReferencedTransactions(inputs) : [];
|
|
186
|
-
const origTxs = getOrigTransactions(inputs, outputs);
|
|
187
|
-
const transformedTxs = transactions.map(tx => {
|
|
188
|
-
if ('details' in tx) {
|
|
189
|
-
if (!tx.hex) throw TypedError('Method_InvalidParameter', `refTx: hex for ${tx.txid} not provided`);
|
|
190
|
-
const srcTx = BitcoinJsTransaction.fromHex(tx.hex, {
|
|
191
|
-
network: coinInfo.network
|
|
192
|
-
});
|
|
193
|
-
if (origTxs.includes(tx.txid)) {
|
|
194
|
-
if (!addresses) throw TypedError('Method_InvalidParameter', `refTx: addresses for ${tx.txid} not provided`);
|
|
195
|
-
return transformOrigTransaction(srcTx, coinInfo, inputs, addresses);
|
|
196
|
-
}
|
|
197
|
-
return transformReferencedTransaction(srcTx);
|
|
198
|
-
}
|
|
199
|
-
Assert(Type.Object({
|
|
200
|
-
hash: Type.String(),
|
|
201
|
-
version: Type.Number(),
|
|
202
|
-
lock_time: Type.Number(),
|
|
203
|
-
extra_data: Type.Optional(Type.String()),
|
|
204
|
-
timestamp: Type.Optional(Type.Number()),
|
|
205
|
-
version_group_id: Type.Optional(Type.Number())
|
|
206
|
-
}), tx);
|
|
207
|
-
if (origTxs.includes(tx.hash)) {
|
|
208
|
-
Assert(Type.Object({
|
|
209
|
-
inputs: Type.Array(PROTO.TxInput, {
|
|
210
|
-
minItems: 1
|
|
211
|
-
}),
|
|
212
|
-
outputs: Type.Array(PROTO.TxOutputType, {
|
|
213
|
-
minItems: 1
|
|
214
|
-
})
|
|
215
|
-
}), tx);
|
|
216
|
-
return tx;
|
|
217
|
-
}
|
|
218
|
-
Assert(Type.Object({
|
|
219
|
-
inputs: Type.Array(PROTO.PrevInput, {
|
|
220
|
-
minItems: 1
|
|
221
|
-
}),
|
|
222
|
-
bin_outputs: Type.Array(PROTO.TxOutputBinType, {
|
|
223
|
-
minItems: 1
|
|
224
|
-
})
|
|
225
|
-
}), tx);
|
|
226
|
-
return {
|
|
227
|
-
hash: tx.hash,
|
|
228
|
-
version: tx.version,
|
|
229
|
-
extra_data: tx.extra_data,
|
|
230
|
-
lock_time: tx.lock_time,
|
|
231
|
-
timestamp: tx.timestamp,
|
|
232
|
-
version_group_id: tx.version_group_id,
|
|
233
|
-
expiry: tx.expiry,
|
|
234
|
-
inputs: tx.inputs.map(input => ({
|
|
235
|
-
prev_hash: input.prev_hash,
|
|
236
|
-
prev_index: input.prev_index,
|
|
237
|
-
script_sig: input.script_sig,
|
|
238
|
-
sequence: input.sequence
|
|
239
|
-
})),
|
|
240
|
-
bin_outputs: tx.bin_outputs.map(output => ({
|
|
241
|
-
amount: output.amount,
|
|
242
|
-
script_pubkey: output.script_pubkey
|
|
243
|
-
}))
|
|
244
|
-
};
|
|
245
|
-
});
|
|
246
|
-
refTxs.concat(origTxs).forEach(hash => {
|
|
247
|
-
if (!transformedTxs.find(tx => tx.hash === hash)) {
|
|
248
|
-
throw TypedError('Method_InvalidParameter', `refTx: ${hash} not provided`);
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
return transformedTxs;
|
|
252
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { BitcoinNetworkInfo, PROTO, RefTransaction, SignedTransaction, TransactionOptions } from '@trezor/connect-common';
|
|
2
|
-
import type { TypedCall } from '../../device/DeviceCommands';
|
|
3
|
-
export interface SignTxHelperProps {
|
|
4
|
-
typedCall: TypedCall;
|
|
5
|
-
txRequest: PROTO.TxRequest;
|
|
6
|
-
refTxs: Record<string, RefTransaction>;
|
|
7
|
-
inputs: PROTO.TxInputType[];
|
|
8
|
-
outputs: PROTO.TxOutputType[];
|
|
9
|
-
paymentRequests: PROTO.PaymentRequest[];
|
|
10
|
-
serializedTx: string[];
|
|
11
|
-
signatures: string[];
|
|
12
|
-
}
|
|
13
|
-
export interface SignTxHelperParams {
|
|
14
|
-
typedCall: TypedCall;
|
|
15
|
-
inputs: PROTO.TxInputType[];
|
|
16
|
-
outputs: PROTO.TxOutputType[];
|
|
17
|
-
paymentRequests?: PROTO.PaymentRequest[];
|
|
18
|
-
refTxs: RefTransaction[];
|
|
19
|
-
options: TransactionOptions;
|
|
20
|
-
coinInfo: BitcoinNetworkInfo;
|
|
21
|
-
}
|
|
22
|
-
export declare const signTx: ({ typedCall, inputs, outputs, paymentRequests, refTxs, options, coinInfo, }: SignTxHelperParams) => Promise<SignedTransaction>;
|