@trezor/connect 10.0.0-beta.1 → 10.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -9
- package/README.md +4 -2
- package/lib/exports.d.ts +1 -3
- package/lib/exports.js +1 -3
- package/lib/impl/core-in-module-native.d.ts +7 -0
- package/lib/impl/core-in-module-native.js +11 -0
- package/lib/impl/core-in-module-node.d.ts +8 -0
- package/lib/impl/core-in-module-node.js +12 -0
- package/lib/impl/core-in-module-web.d.ts +9 -0
- package/lib/impl/core-in-module-web.js +26 -0
- package/lib/index.browser.js +2 -26
- package/lib/index.js +1 -11
- package/lib/index.native.d.ts +4 -0
- package/lib/index.native.js +5 -0
- package/package.json +16 -67
- package/lib/api/applyFlags.d.ts +0 -20
- package/lib/api/applyFlags.js +0 -38
- package/lib/api/applySettings.d.ts +0 -20
- package/lib/api/applySettings.js +0 -57
- package/lib/api/authenticateDevice.d.ts +0 -25
- package/lib/api/authenticateDevice.js +0 -195
- package/lib/api/authorizeCoinjoin.d.ts +0 -11
- package/lib/api/authorizeCoinjoin.js +0 -44
- package/lib/api/backupDevice.d.ts +0 -19
- package/lib/api/backupDevice.js +0 -39
- package/lib/api/bitcoin/TransactionComposer.d.ts +0 -46
- package/lib/api/bitcoin/TransactionComposer.js +0 -147
- package/lib/api/bitcoin/createPendingTx.d.ts +0 -37
- package/lib/api/bitcoin/createPendingTx.js +0 -55
- package/lib/api/bitcoin/enhanceSignTx.d.ts +0 -2
- package/lib/api/bitcoin/enhanceSignTx.js +0 -23
- package/lib/api/bitcoin/index.d.ts +0 -9
- package/lib/api/bitcoin/index.js +0 -9
- package/lib/api/bitcoin/inputs.d.ts +0 -4
- package/lib/api/bitcoin/inputs.js +0 -63
- package/lib/api/bitcoin/outputs.d.ts +0 -5
- package/lib/api/bitcoin/outputs.js +0 -128
- package/lib/api/bitcoin/refTx.d.ts +0 -23
- package/lib/api/bitcoin/refTx.js +0 -249
- package/lib/api/bitcoin/signtx.d.ts +0 -30
- package/lib/api/bitcoin/signtx.js +0 -229
- package/lib/api/bitcoin/signtxLegacy.d.ts +0 -10
- package/lib/api/bitcoin/signtxLegacy.js +0 -186
- package/lib/api/bitcoin/signtxVerify.d.ts +0 -12
- package/lib/api/bitcoin/signtxVerify.js +0 -95
- package/lib/api/bitcoin/transactionBytes.d.ts +0 -3
- package/lib/api/bitcoin/transactionBytes.js +0 -65
- package/lib/api/bleUnpair.d.ts +0 -11
- package/lib/api/bleUnpair.js +0 -37
- package/lib/api/blockchainDisconnect.d.ts +0 -16
- package/lib/api/blockchainDisconnect.js +0 -37
- package/lib/api/blockchainEstimateFee.d.ts +0 -16
- package/lib/api/blockchainEstimateFee.js +0 -102
- package/lib/api/blockchainEvmRpcCall.d.ts +0 -19
- package/lib/api/blockchainEvmRpcCall.js +0 -57
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +0 -16
- package/lib/api/blockchainGetAccountBalanceHistory.js +0 -60
- package/lib/api/blockchainGetContractInfo.d.ts +0 -16
- package/lib/api/blockchainGetContractInfo.js +0 -46
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +0 -20
- package/lib/api/blockchainGetCurrentFiatRates.js +0 -49
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +0 -23
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +0 -55
- package/lib/api/blockchainGetInfo.d.ts +0 -15
- package/lib/api/blockchainGetInfo.js +0 -37
- package/lib/api/blockchainGetTransactions.d.ts +0 -18
- package/lib/api/blockchainGetTransactions.js +0 -47
- package/lib/api/blockchainSetCustomBackend.d.ts +0 -17
- package/lib/api/blockchainSetCustomBackend.js +0 -43
- package/lib/api/blockchainSubscribe.d.ts +0 -19
- package/lib/api/blockchainSubscribe.js +0 -66
- package/lib/api/blockchainSubscribeFiatRates.d.ts +0 -19
- package/lib/api/blockchainSubscribeFiatRates.js +0 -43
- package/lib/api/blockchainUnsubscribe.d.ts +0 -19
- package/lib/api/blockchainUnsubscribe.js +0 -66
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +0 -17
- package/lib/api/blockchainUnsubscribeFiatRates.js +0 -37
- package/lib/api/blockchainValidateEvmRpcUrl.d.ts +0 -17
- package/lib/api/blockchainValidateEvmRpcUrl.js +0 -54
- package/lib/api/cancelCoinjoinAuthorization.d.ts +0 -11
- package/lib/api/cancelCoinjoinAuthorization.js +0 -33
- package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +0 -10
- package/lib/api/cardano/api/cardanoComposeTransaction.js +0 -84
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +0 -34
- package/lib/api/cardano/api/cardanoGetAddress.js +0 -130
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.d.ts +0 -12
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +0 -66
- package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +0 -22
- package/lib/api/cardano/api/cardanoGetPublicKey.js +0 -92
- package/lib/api/cardano/api/cardanoSignMessage.d.ts +0 -22
- package/lib/api/cardano/api/cardanoSignMessage.js +0 -90
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +0 -81
- package/lib/api/cardano/api/cardanoSignTransaction.js +0 -301
- package/lib/api/cardano/api/index.d.ts +0 -6
- package/lib/api/cardano/api/index.js +0 -6
- package/lib/api/cardano/cardanoAddressParameters.d.ts +0 -6
- package/lib/api/cardano/cardanoAddressParameters.js +0 -79
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +0 -4
- package/lib/api/cardano/cardanoAuxiliaryData.js +0 -74
- package/lib/api/cardano/cardanoCertificate.d.ts +0 -13
- package/lib/api/cardano/cardanoCertificate.js +0 -142
- package/lib/api/cardano/cardanoInputs.d.ts +0 -25
- package/lib/api/cardano/cardanoInputs.js +0 -39
- package/lib/api/cardano/cardanoOutputs.d.ts +0 -40
- package/lib/api/cardano/cardanoOutputs.js +0 -70
- package/lib/api/cardano/cardanoTokenBundle.d.ts +0 -12
- package/lib/api/cardano/cardanoTokenBundle.js +0 -21
- package/lib/api/cardano/cardanoUtils.d.ts +0 -17
- package/lib/api/cardano/cardanoUtils.js +0 -100
- package/lib/api/cardano/cardanoWitnesses.d.ts +0 -4
- package/lib/api/cardano/cardanoWitnesses.js +0 -47
- package/lib/api/changeLanguage.d.ts +0 -18
- package/lib/api/changeLanguage.js +0 -49
- package/lib/api/changePin.d.ts +0 -11
- package/lib/api/changePin.js +0 -27
- package/lib/api/changeWipeCode.d.ts +0 -11
- package/lib/api/changeWipeCode.js +0 -29
- package/lib/api/cipherKeyValue.d.ts +0 -17
- package/lib/api/cipherKeyValue.js +0 -58
- package/lib/api/common/AbstractMiscGetAddress.d.ts +0 -37
- package/lib/api/common/AbstractMiscGetAddress.js +0 -126
- package/lib/api/common/Discovery.d.ts +0 -33
- package/lib/api/common/Discovery.js +0 -119
- package/lib/api/common/paramsValidator.d.ts +0 -24
- package/lib/api/common/paramsValidator.js +0 -136
- package/lib/api/common/requestExistingAccounts.d.ts +0 -14
- package/lib/api/common/requestExistingAccounts.js +0 -20
- package/lib/api/composeTransaction.d.ts +0 -36
- package/lib/api/composeTransaction.js +0 -404
- package/lib/api/discoverAccounts.d.ts +0 -40
- package/lib/api/discoverAccounts.js +0 -360
- package/lib/api/ethereum/api/ethereumGetAddress.d.ts +0 -30
- package/lib/api/ethereum/api/ethereumGetAddress.js +0 -150
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +0 -52
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +0 -100
- package/lib/api/ethereum/api/ethereumSignMessage.d.ts +0 -27
- package/lib/api/ethereum/api/ethereumSignMessage.js +0 -64
- package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +0 -83
- package/lib/api/ethereum/api/ethereumSignTransaction.js +0 -148
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +0 -117
- package/lib/api/ethereum/api/ethereumSignTypedData.js +0 -203
- package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +0 -12
- package/lib/api/ethereum/api/ethereumVerifyMessage.js +0 -35
- package/lib/api/ethereum/api/index.d.ts +0 -6
- package/lib/api/ethereum/api/index.js +0 -6
- package/lib/api/ethereum/ethereumDefinitions.d.ts +0 -53
- package/lib/api/ethereum/ethereumDefinitions.js +0 -135
- package/lib/api/ethereum/ethereumSignTx.d.ts +0 -16
- package/lib/api/ethereum/ethereumSignTx.js +0 -144
- package/lib/api/ethereum/ethereumSignTypedData.d.ts +0 -32
- package/lib/api/ethereum/ethereumSignTypedData.js +0 -175
- package/lib/api/evoluGetDelegatedIdentityKey.d.ts +0 -14
- package/lib/api/evoluGetDelegatedIdentityKey.js +0 -29
- package/lib/api/evoluGetNode.d.ts +0 -13
- package/lib/api/evoluGetNode.js +0 -29
- package/lib/api/evoluSignRegistrationRequest.d.ts +0 -16
- package/lib/api/evoluSignRegistrationRequest.js +0 -33
- package/lib/api/firmware/calculateFirmwareHash.d.ts +0 -18
- package/lib/api/firmware/calculateFirmwareHash.js +0 -56
- package/lib/api/firmware/calculateXPubHash.d.ts +0 -14
- package/lib/api/firmware/calculateXPubHash.js +0 -16
- package/lib/api/firmware/getBinary.d.ts +0 -14
- package/lib/api/firmware/getBinary.js +0 -33
- package/lib/api/firmware/index.d.ts +0 -6
- package/lib/api/firmware/index.js +0 -6
- package/lib/api/firmware/modifyFirmware.d.ts +0 -3
- package/lib/api/firmware/modifyFirmware.js +0 -13
- package/lib/api/firmware/parseFirmwareHeaders.d.ts +0 -4
- package/lib/api/firmware/parseFirmwareHeaders.js +0 -26
- package/lib/api/firmware/uploadFirmware.d.ts +0 -27
- package/lib/api/firmware/uploadFirmware.js +0 -99
- package/lib/api/firmware/verifyEntropy.d.ts +0 -25
- package/lib/api/firmware/verifyEntropy.js +0 -110
- package/lib/api/getAccountInfo.d.ts +0 -21
- package/lib/api/getAccountInfo.js +0 -253
- package/lib/api/getAddress.d.ts +0 -45
- package/lib/api/getAddress.js +0 -153
- package/lib/api/getCoinInfo.d.ts +0 -148
- package/lib/api/getCoinInfo.js +0 -25
- package/lib/api/getDeviceState.d.ts +0 -8
- package/lib/api/getDeviceState.js +0 -18
- package/lib/api/getFeatures.d.ts +0 -71
- package/lib/api/getFeatures.js +0 -22
- package/lib/api/getFirmwareHash.d.ts +0 -11
- package/lib/api/getFirmwareHash.js +0 -29
- package/lib/api/getNonce.d.ts +0 -10
- package/lib/api/getNonce.js +0 -18
- package/lib/api/getOwnershipId.d.ts +0 -17
- package/lib/api/getOwnershipId.js +0 -88
- package/lib/api/getOwnershipProof.d.ts +0 -17
- package/lib/api/getOwnershipProof.js +0 -95
- package/lib/api/getPublicKey.d.ts +0 -54
- package/lib/api/getPublicKey.js +0 -106
- package/lib/api/getSettings.d.ts +0 -24
- package/lib/api/getSettings.js +0 -21
- package/lib/api/index.d.ts +0 -62
- package/lib/api/index.js +0 -62
- package/lib/api/loadDevice.d.ts +0 -16
- package/lib/api/loadDevice.js +0 -46
- package/lib/api/monero/api/index.d.ts +0 -4
- package/lib/api/monero/api/index.js +0 -4
- package/lib/api/monero/api/moneroGetAddress.d.ts +0 -32
- package/lib/api/monero/api/moneroGetAddress.js +0 -117
- package/lib/api/monero/api/moneroGetWatchKey.d.ts +0 -14
- package/lib/api/monero/api/moneroGetWatchKey.js +0 -45
- package/lib/api/monero/api/moneroKeyImageSync.d.ts +0 -17
- package/lib/api/monero/api/moneroKeyImageSync.js +0 -128
- package/lib/api/monero/api/moneroSignTransaction.d.ts +0 -17
- package/lib/api/monero/api/moneroSignTransaction.js +0 -218
- package/lib/api/nostr/nostrGetPublicKey.d.ts +0 -15
- package/lib/api/nostr/nostrGetPublicKey.js +0 -38
- package/lib/api/nostr/nostrSignEvent.d.ts +0 -13
- package/lib/api/nostr/nostrSignEvent.js +0 -36
- package/lib/api/pingDevice.d.ts +0 -11
- package/lib/api/pingDevice.js +0 -29
- package/lib/api/pushTransaction.d.ts +0 -19
- package/lib/api/pushTransaction.js +0 -39
- package/lib/api/recoveryDevice.d.ts +0 -20
- package/lib/api/recoveryDevice.js +0 -52
- package/lib/api/requestLogin.d.ts +0 -14
- package/lib/api/requestLogin.js +0 -53
- package/lib/api/resetDevice.d.ts +0 -22
- package/lib/api/resetDevice.js +0 -133
- package/lib/api/ripple/api/index.d.ts +0 -2
- package/lib/api/ripple/api/index.js +0 -2
- package/lib/api/ripple/api/rippleGetAddress.d.ts +0 -17
- package/lib/api/ripple/api/rippleGetAddress.js +0 -22
- package/lib/api/ripple/api/rippleSignTransaction.d.ts +0 -13
- package/lib/api/ripple/api/rippleSignTransaction.js +0 -52
- package/lib/api/selectAccount.d.ts +0 -15
- package/lib/api/selectAccount.js +0 -42
- package/lib/api/setBrightness.d.ts +0 -12
- package/lib/api/setBrightness.js +0 -28
- package/lib/api/setBusy.d.ts +0 -11
- package/lib/api/setBusy.js +0 -31
- package/lib/api/showDeviceTutorial.d.ts +0 -11
- package/lib/api/showDeviceTutorial.js +0 -21
- package/lib/api/signMessage.d.ts +0 -25
- package/lib/api/signMessage.js +0 -75
- package/lib/api/signTransaction.d.ts +0 -199
- package/lib/api/signTransaction.js +0 -331
- package/lib/api/solana/api/index.d.ts +0 -4
- package/lib/api/solana/api/index.js +0 -4
- package/lib/api/solana/api/solanaComposeTransaction.d.ts +0 -33
- package/lib/api/solana/api/solanaComposeTransaction.js +0 -73
- package/lib/api/solana/api/solanaGetAddress.d.ts +0 -17
- package/lib/api/solana/api/solanaGetAddress.js +0 -22
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +0 -32
- package/lib/api/solana/api/solanaGetPublicKey.js +0 -86
- package/lib/api/solana/api/solanaSignTransaction.d.ts +0 -41
- package/lib/api/solana/api/solanaSignTransaction.js +0 -204
- package/lib/api/solana/solanaDefinitions.d.ts +0 -9
- package/lib/api/solana/solanaDefinitions.js +0 -33
- package/lib/api/stellar/api/index.d.ts +0 -2
- package/lib/api/stellar/api/index.js +0 -2
- package/lib/api/stellar/api/stellarGetAddress.d.ts +0 -17
- package/lib/api/stellar/api/stellarGetAddress.js +0 -22
- package/lib/api/stellar/api/stellarSignTransaction.d.ts +0 -20
- package/lib/api/stellar/api/stellarSignTransaction.js +0 -65
- package/lib/api/stellar/stellarSignTx.d.ts +0 -7
- package/lib/api/stellar/stellarSignTx.js +0 -183
- package/lib/api/telemetryGet.d.ts +0 -14
- package/lib/api/telemetryGet.js +0 -26
- package/lib/api/tezos/api/index.d.ts +0 -3
- package/lib/api/tezos/api/index.js +0 -3
- package/lib/api/tezos/api/tezosGetAddress.d.ts +0 -17
- package/lib/api/tezos/api/tezosGetAddress.js +0 -22
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +0 -28
- package/lib/api/tezos/api/tezosGetPublicKey.js +0 -84
- package/lib/api/tezos/api/tezosSignTransaction.d.ts +0 -14
- package/lib/api/tezos/api/tezosSignTransaction.js +0 -30
- package/lib/api/tezos/tezosSignTx.d.ts +0 -71
- package/lib/api/tezos/tezosSignTx.js +0 -204
- package/lib/api/thpGetCredentials.d.ts +0 -13
- package/lib/api/thpGetCredentials.js +0 -30
- package/lib/api/thpRemoveCredentials.d.ts +0 -15
- package/lib/api/thpRemoveCredentials.js +0 -44
- package/lib/api/tron/api/index.d.ts +0 -3
- package/lib/api/tron/api/index.js +0 -3
- package/lib/api/tron/api/tronComposeTransaction.d.ts +0 -17
- package/lib/api/tron/api/tronComposeTransaction.js +0 -52
- package/lib/api/tron/api/tronGetAddress.d.ts +0 -17
- package/lib/api/tron/api/tronGetAddress.js +0 -22
- package/lib/api/tron/api/tronSignTransaction.d.ts +0 -20
- package/lib/api/tron/api/tronSignTransaction.js +0 -137
- package/lib/api/tron/tronEncode.d.ts +0 -11
- package/lib/api/tron/tronEncode.js +0 -157
- package/lib/api/tron/tronProtobuf.d.ts +0 -5
- package/lib/api/tron/tronProtobuf.js +0 -28
- package/lib/api/unlockPath.d.ts +0 -12
- package/lib/api/unlockPath.js +0 -33
- package/lib/api/verifyMessage.d.ts +0 -16
- package/lib/api/verifyMessage.js +0 -46
- package/lib/api/wipeDevice.d.ts +0 -21
- package/lib/api/wipeDevice.js +0 -49
- package/lib/backend/BackendManager.d.ts +0 -30
- package/lib/backend/BackendManager.js +0 -145
- package/lib/backend/Blockchain.d.ts +0 -81
- package/lib/backend/Blockchain.js +0 -235
- package/lib/backend/BlockchainLink.d.ts +0 -10
- package/lib/backend/BlockchainLink.js +0 -19
- package/lib/backend/fees/BitcoinFeeLevels.d.ts +0 -19
- package/lib/backend/fees/BitcoinFeeLevels.js +0 -44
- package/lib/backend/fees/EthereumFeeLevels.d.ts +0 -17
- package/lib/backend/fees/EthereumFeeLevels.js +0 -63
- package/lib/backend/fees/MiscFeeLevels.d.ts +0 -18
- package/lib/backend/fees/MiscFeeLevels.js +0 -30
- package/lib/backend/fees/index.d.ts +0 -5
- package/lib/backend/fees/index.js +0 -31
- package/lib/core/AbstractMethod.d.ts +0 -63
- package/lib/core/AbstractMethod.js +0 -189
- package/lib/core/index.d.ts +0 -29
- package/lib/core/index.js +0 -805
- package/lib/core/method.d.ts +0 -3
- package/lib/core/method.js +0 -19
- package/lib/core/method.native.d.ts +0 -2
- package/lib/core/method.native.js +0 -29
- package/lib/core/onCallFirmwareUpdate.d.ts +0 -42
- package/lib/core/onCallFirmwareUpdate.js +0 -436
- package/lib/data/coinInfo.d.ts +0 -101
- package/lib/data/coinInfo.js +0 -195
- package/lib/data/config.d.ts +0 -8
- package/lib/data/config.js +0 -273
- package/lib/data/defaultFeeLevels.d.ts +0 -18
- package/lib/data/defaultFeeLevels.js +0 -200
- package/lib/data/enabledNetworksStore.d.ts +0 -5
- package/lib/data/enabledNetworksStore.js +0 -20
- package/lib/data/firmwareInfo.d.ts +0 -55
- package/lib/data/firmwareInfo.js +0 -413
- package/lib/data/firmwareReleaseStore.d.ts +0 -10
- package/lib/data/firmwareReleaseStore.js +0 -16
- package/lib/data/localFirmwareStore.d.ts +0 -3
- package/lib/data/localFirmwareStore.js +0 -8
- package/lib/data/protobufLoader.d.ts +0 -1
- package/lib/data/protobufLoader.js +0 -30
- package/lib/data/settingsStore.d.ts +0 -6
- package/lib/data/settingsStore.js +0 -21
- package/lib/device/Device.d.ts +0 -259
- package/lib/device/Device.js +0 -765
- package/lib/device/DeviceCommands.d.ts +0 -87
- package/lib/device/DeviceCommands.js +0 -248
- package/lib/device/DeviceCurrentSession.d.ts +0 -750
- package/lib/device/DeviceCurrentSession.js +0 -239
- package/lib/device/DeviceList.d.ts +0 -75
- package/lib/device/DeviceList.js +0 -243
- package/lib/device/TransportList.d.ts +0 -3
- package/lib/device/TransportList.js +0 -13
- package/lib/device/TransportManager.d.ts +0 -33
- package/lib/device/TransportManager.js +0 -144
- package/lib/device/calculateRevisionForDevice.d.ts +0 -10
- package/lib/device/calculateRevisionForDevice.js +0 -19
- package/lib/device/checkFirmwareRevision.d.ts +0 -22
- package/lib/device/checkFirmwareRevision.js +0 -104
- package/lib/device/resolveDescriptorForTaproot.d.ts +0 -17
- package/lib/device/resolveDescriptorForTaproot.js +0 -27
- package/lib/device/thp/handshake.d.ts +0 -3
- package/lib/device/thp/handshake.js +0 -100
- package/lib/device/thp/index.d.ts +0 -5
- package/lib/device/thp/index.js +0 -65
- package/lib/device/thp/pairing.d.ts +0 -16
- package/lib/device/thp/pairing.js +0 -242
- package/lib/device/thp/session.d.ts +0 -2
- package/lib/device/thp/session.js +0 -27
- package/lib/device/thp/thpCall.d.ts +0 -31
- package/lib/device/thp/thpCall.js +0 -58
- package/lib/device/validateMessageSize.d.ts +0 -2
- package/lib/device/validateMessageSize.js +0 -9
- package/lib/device/workflow/changeLanguage.d.ts +0 -18
- package/lib/device/workflow/changeLanguage.js +0 -62
- package/lib/device/workflow/checkFirmwareHash.d.ts +0 -12
- package/lib/device/workflow/checkFirmwareHash.js +0 -86
- package/lib/device/workflow/checkFirmwareHashWithRetries.d.ts +0 -8
- package/lib/device/workflow/checkFirmwareHashWithRetries.js +0 -36
- package/lib/device/workflow/handshake.d.ts +0 -13
- package/lib/device/workflow/handshake.js +0 -55
- package/lib/device/workflow/trezorPushNotification.d.ts +0 -5
- package/lib/device/workflow/trezorPushNotification.js +0 -73
- package/lib/device/workflow/validateState.d.ts +0 -2
- package/lib/device/workflow/validateState.js +0 -152
- package/lib/events/ui-promise.d.ts +0 -20
- package/lib/events/ui-promise.js +0 -1
- package/lib/impl/core-in-module.d.ts +0 -33
- package/lib/impl/core-in-module.js +0 -194
- package/lib/types/idevice.d.ts +0 -110
- package/lib/types/idevice.js +0 -1
- package/lib/types/typed-call-provider.d.ts +0 -29
- package/lib/types/typed-call-provider.js +0 -1
- package/lib/types/workflow.d.ts +0 -16
- package/lib/types/workflow.js +0 -1
- package/lib/utils/accountUtils.d.ts +0 -10
- package/lib/utils/accountUtils.js +0 -90
- package/lib/utils/addressUtils.d.ts +0 -2
- package/lib/utils/addressUtils.js +0 -24
- package/lib/utils/assetUtils.d.ts +0 -13
- package/lib/utils/assetUtils.js +0 -55
- package/lib/utils/assets.browser.d.ts +0 -1
- package/lib/utils/assets.browser.js +0 -1
- package/lib/utils/assets.d.ts +0 -2
- package/lib/utils/assets.js +0 -13
- package/lib/utils/assets.native.d.ts +0 -2
- package/lib/utils/assets.native.js +0 -23
- package/lib/utils/assetsTypes.d.ts +0 -5
- package/lib/utils/assetsTypes.js +0 -1
- package/lib/utils/buildOutputDescriptor.d.ts +0 -20
- package/lib/utils/buildOutputDescriptor.js +0 -67
- package/lib/utils/deviceFeaturesUtils.d.ts +0 -7
- package/lib/utils/deviceFeaturesUtils.js +0 -109
- package/lib/utils/ethereumUtils.d.ts +0 -3
- package/lib/utils/ethereumUtils.js +0 -7
- package/lib/utils/firmwareReleaseConfigUtils.d.ts +0 -19
- package/lib/utils/firmwareReleaseConfigUtils.js +0 -131
- package/lib/utils/firmwareUtils.d.ts +0 -15
- package/lib/utils/firmwareUtils.js +0 -57
- package/lib/utils/formatUtils.d.ts +0 -13
- package/lib/utils/formatUtils.js +0 -45
- package/lib/utils/hdnodeUtils.d.ts +0 -6
- package/lib/utils/hdnodeUtils.js +0 -62
- package/lib/utils/pathUtils.d.ts +0 -1
- package/lib/utils/pathUtils.js +0 -1
- package/lib/utils/paymentRequest.d.ts +0 -8
- package/lib/utils/paymentRequest.js +0 -25
- package/lib/utils/uiPromiseManager.d.ts +0 -8
- package/lib/utils/uiPromiseManager.js +0 -51
- package/lib/workers/workers.browser.d.ts +0 -10
- package/lib/workers/workers.browser.js +0 -16
- package/lib/workers/workers.d.ts +0 -10
- package/lib/workers/workers.js +0 -8
- package/lib/workers/workers.native.d.ts +0 -7
- package/lib/workers/workers.native.js +0 -7
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { CardanoSignTransactionExtended, CardanoSignTransaction as CardanoSignTransactionSchema } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
3
|
-
import cardano from "@trezor/network-cardano/runtime";
|
|
4
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
5
|
-
import { Assert, Type } from "@trezor/schema-utils";
|
|
6
|
-
import { AbstractMethod } from "../../../core/AbstractMethod.js";
|
|
7
|
-
import { getMiscNetwork } from "../../../data/coinInfo.js";
|
|
8
|
-
import { validatePath } from "../../../utils/pathUtils.js";
|
|
9
|
-
import { PAYMENT_REQUEST_AMOUNT_BYTES, encodePaymentRequestAmount } from "../../../utils/paymentRequest.js";
|
|
10
|
-
import { modifyAuxiliaryDataForBackwardsCompatibility, transformAuxiliaryData } from "../cardanoAuxiliaryData.js";
|
|
11
|
-
import { transformCertificate } from "../cardanoCertificate.js";
|
|
12
|
-
import { transformCollateralInput, transformInput, transformReferenceInput } from "../cardanoInputs.js";
|
|
13
|
-
import { sendOutput, transformOutput } from "../cardanoOutputs.js";
|
|
14
|
-
import { tokenBundleToProto } from "../cardanoTokenBundle.js";
|
|
15
|
-
import { gatherWitnessPaths } from "../cardanoWitnesses.js";
|
|
16
|
-
const CardanoSignTransactionFeatures = Object.freeze({
|
|
17
|
-
Conway: ['0', '2.7.1']
|
|
18
|
-
});
|
|
19
|
-
export default class CardanoSignTransaction extends AbstractMethod {
|
|
20
|
-
constructor(message) {
|
|
21
|
-
const {
|
|
22
|
-
payload
|
|
23
|
-
} = message;
|
|
24
|
-
if (payload.metadata) {
|
|
25
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Metadata field has been replaced by auxiliaryData.');
|
|
26
|
-
}
|
|
27
|
-
if (payload.auxiliaryData?.blob) {
|
|
28
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Auxiliary data can now only be sent as a hash.');
|
|
29
|
-
}
|
|
30
|
-
if (payload.auxiliaryData?.catalystRegistrationParameters) {
|
|
31
|
-
console.warn('Please use cVoteRegistrationParameters instead of catalystRegistrationParameters.');
|
|
32
|
-
payload.auxiliaryData.cVoteRegistrationParameters = payload.auxiliaryData.catalystRegistrationParameters;
|
|
33
|
-
}
|
|
34
|
-
if (payload.auxiliaryData?.governanceRegistrationParameters) {
|
|
35
|
-
console.warn('Please use cVoteRegistrationParameters instead of governanceRegistrationParameters.');
|
|
36
|
-
payload.auxiliaryData.cVoteRegistrationParameters = payload.auxiliaryData.governanceRegistrationParameters;
|
|
37
|
-
}
|
|
38
|
-
Assert(Type.Union([CardanoSignTransactionSchema, CardanoSignTransactionExtended]), payload);
|
|
39
|
-
const inputsWithPath = payload.inputs.map(transformInput);
|
|
40
|
-
const outputsWithData = payload.outputs.map(transformOutput);
|
|
41
|
-
let certificatesWithPoolOwnersAndRelays = [];
|
|
42
|
-
if (payload.certificates) {
|
|
43
|
-
certificatesWithPoolOwnersAndRelays = payload.certificates.map(transformCertificate);
|
|
44
|
-
}
|
|
45
|
-
let withdrawals = [];
|
|
46
|
-
if (payload.withdrawals) {
|
|
47
|
-
withdrawals = payload.withdrawals.map(withdrawal => ({
|
|
48
|
-
path: withdrawal.path ? validatePath(withdrawal.path, 5) : undefined,
|
|
49
|
-
amount: withdrawal.amount,
|
|
50
|
-
script_hash: withdrawal.scriptHash,
|
|
51
|
-
key_hash: withdrawal.keyHash
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
let mint = [];
|
|
55
|
-
if (payload.mint) {
|
|
56
|
-
mint = tokenBundleToProto(payload.mint);
|
|
57
|
-
}
|
|
58
|
-
let auxiliaryData;
|
|
59
|
-
if (payload.auxiliaryData) {
|
|
60
|
-
auxiliaryData = transformAuxiliaryData(payload.auxiliaryData);
|
|
61
|
-
}
|
|
62
|
-
let additionalWitnessRequests = [];
|
|
63
|
-
if (payload.additionalWitnessRequests) {
|
|
64
|
-
additionalWitnessRequests = payload.additionalWitnessRequests.map(witnessRequest => validatePath(witnessRequest, 3));
|
|
65
|
-
}
|
|
66
|
-
let collateralInputsWithPath = [];
|
|
67
|
-
if (payload.collateralInputs) {
|
|
68
|
-
collateralInputsWithPath = payload.collateralInputs.map(transformCollateralInput);
|
|
69
|
-
}
|
|
70
|
-
let requiredSigners = [];
|
|
71
|
-
if (payload.requiredSigners) {
|
|
72
|
-
requiredSigners = payload.requiredSigners.map(requiredSigner => ({
|
|
73
|
-
key_path: requiredSigner.keyPath ? validatePath(requiredSigner.keyPath, 3) : undefined,
|
|
74
|
-
key_hash: requiredSigner.keyHash
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
const collateralReturnWithData = payload.collateralReturn ? transformOutput(payload.collateralReturn) : undefined;
|
|
78
|
-
let referenceInputs = [];
|
|
79
|
-
if (payload.referenceInputs) {
|
|
80
|
-
referenceInputs = payload.referenceInputs.map(transformReferenceInput);
|
|
81
|
-
}
|
|
82
|
-
const params = {
|
|
83
|
-
signingMode: payload.signingMode,
|
|
84
|
-
inputsWithPath,
|
|
85
|
-
outputsWithData,
|
|
86
|
-
fee: payload.fee,
|
|
87
|
-
ttl: payload.ttl,
|
|
88
|
-
certificatesWithPoolOwnersAndRelays,
|
|
89
|
-
withdrawals,
|
|
90
|
-
mint,
|
|
91
|
-
auxiliaryData,
|
|
92
|
-
validityIntervalStart: payload.validityIntervalStart,
|
|
93
|
-
scriptDataHash: payload.scriptDataHash,
|
|
94
|
-
collateralInputsWithPath,
|
|
95
|
-
requiredSigners,
|
|
96
|
-
collateralReturnWithData,
|
|
97
|
-
totalCollateral: payload.totalCollateral,
|
|
98
|
-
referenceInputs,
|
|
99
|
-
protocolMagic: payload.protocolMagic,
|
|
100
|
-
networkId: payload.networkId,
|
|
101
|
-
witnessPaths: gatherWitnessPaths(inputsWithPath, certificatesWithPoolOwnersAndRelays, withdrawals, collateralInputsWithPath, requiredSigners, additionalWitnessRequests, payload.signingMode),
|
|
102
|
-
additionalWitnessRequests,
|
|
103
|
-
derivationType: typeof payload.derivationType !== 'undefined' ? payload.derivationType : PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
104
|
-
includeNetworkId: payload.includeNetworkId,
|
|
105
|
-
tagCborSets: payload.tagCborSets,
|
|
106
|
-
unsignedTx: 'unsignedTx' in payload ? payload.unsignedTx : undefined,
|
|
107
|
-
testnet: 'testnet' in payload ? payload.testnet : undefined,
|
|
108
|
-
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
109
|
-
payment_req: payload.payment_req ? encodePaymentRequestAmount(payload.payment_req, PAYMENT_REQUEST_AMOUNT_BYTES.DEFAULT) : undefined
|
|
110
|
-
};
|
|
111
|
-
super(message, params);
|
|
112
|
-
this.requiredDeviceCapabilities = ['Capability_Cardano'];
|
|
113
|
-
this.requiredFirmwareCoins = [getMiscNetwork('ada')];
|
|
114
|
-
}
|
|
115
|
-
get requiredPermissions() {
|
|
116
|
-
return this.coinPerms('sign', this.requiredFirmwareCoins);
|
|
117
|
-
}
|
|
118
|
-
get info() {
|
|
119
|
-
return 'Sign Cardano transaction';
|
|
120
|
-
}
|
|
121
|
-
_isFeatureSupported(feature) {
|
|
122
|
-
return this.getDevice().atLeast(CardanoSignTransactionFeatures[feature]);
|
|
123
|
-
}
|
|
124
|
-
_ensureFeatureIsSupported(feature) {
|
|
125
|
-
if (!this._isFeatureSupported(feature)) {
|
|
126
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `Feature ${feature} not supported by device firmware`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
_ensureFirmwareSupportsParams() {
|
|
130
|
-
const {
|
|
131
|
-
params
|
|
132
|
-
} = this;
|
|
133
|
-
params.certificatesWithPoolOwnersAndRelays.forEach(({
|
|
134
|
-
certificate
|
|
135
|
-
}) => {
|
|
136
|
-
if (certificate.type === PROTO.CardanoCertificateType.STAKE_REGISTRATION_CONWAY || certificate.type === PROTO.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY || certificate.type === PROTO.CardanoCertificateType.VOTE_DELEGATION) {
|
|
137
|
-
this._ensureFeatureIsSupported('Conway');
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
if (params.tagCborSets) {
|
|
141
|
-
this._ensureFeatureIsSupported('Conway');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async _sign_tx() {
|
|
145
|
-
const {
|
|
146
|
-
typedCall
|
|
147
|
-
} = this.getDevice().getCommands();
|
|
148
|
-
const hasAuxiliaryData = !!this.params.auxiliaryData;
|
|
149
|
-
const signTxInitMessage = {
|
|
150
|
-
signing_mode: this.params.signingMode,
|
|
151
|
-
protocol_magic: this.params.protocolMagic,
|
|
152
|
-
network_id: this.params.networkId,
|
|
153
|
-
inputs_count: this.params.inputsWithPath.length,
|
|
154
|
-
outputs_count: this.params.outputsWithData.length,
|
|
155
|
-
fee: this.params.fee,
|
|
156
|
-
ttl: this.params.ttl,
|
|
157
|
-
certificates_count: this.params.certificatesWithPoolOwnersAndRelays.length,
|
|
158
|
-
withdrawals_count: this.params.withdrawals.length,
|
|
159
|
-
has_auxiliary_data: hasAuxiliaryData,
|
|
160
|
-
validity_interval_start: this.params.validityIntervalStart,
|
|
161
|
-
witness_requests_count: this.params.witnessPaths.length,
|
|
162
|
-
minting_asset_groups_count: this.params.mint.length,
|
|
163
|
-
script_data_hash: this.params.scriptDataHash,
|
|
164
|
-
collateral_inputs_count: this.params.collateralInputsWithPath.length,
|
|
165
|
-
required_signers_count: this.params.requiredSigners.length,
|
|
166
|
-
has_collateral_return: this.params.collateralReturnWithData != null,
|
|
167
|
-
total_collateral: this.params.totalCollateral,
|
|
168
|
-
reference_inputs_count: this.params.referenceInputs.length,
|
|
169
|
-
derivation_type: this.params.derivationType,
|
|
170
|
-
include_network_id: this.params.includeNetworkId,
|
|
171
|
-
chunkify: this.params.chunkify,
|
|
172
|
-
tag_cbor_sets: this.params.tagCborSets,
|
|
173
|
-
payment_req: this.params.payment_req
|
|
174
|
-
};
|
|
175
|
-
await typedCall('CardanoSignTxInit', 'CardanoTxItemAck', signTxInitMessage);
|
|
176
|
-
for (const {
|
|
177
|
-
input
|
|
178
|
-
} of this.params.inputsWithPath) {
|
|
179
|
-
await typedCall('CardanoTxInput', 'CardanoTxItemAck', input);
|
|
180
|
-
}
|
|
181
|
-
for (const outputWithData of this.params.outputsWithData) {
|
|
182
|
-
await sendOutput(typedCall, outputWithData);
|
|
183
|
-
}
|
|
184
|
-
for (const {
|
|
185
|
-
certificate,
|
|
186
|
-
poolOwners,
|
|
187
|
-
poolRelays
|
|
188
|
-
} of this.params.certificatesWithPoolOwnersAndRelays) {
|
|
189
|
-
await typedCall('CardanoTxCertificate', 'CardanoTxItemAck', certificate);
|
|
190
|
-
for (const poolOwner of poolOwners) {
|
|
191
|
-
await typedCall('CardanoPoolOwner', 'CardanoTxItemAck', poolOwner);
|
|
192
|
-
}
|
|
193
|
-
for (const poolRelay of poolRelays) {
|
|
194
|
-
await typedCall('CardanoPoolRelayParameters', 'CardanoTxItemAck', poolRelay);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
for (const withdrawal of this.params.withdrawals) {
|
|
198
|
-
await typedCall('CardanoTxWithdrawal', 'CardanoTxItemAck', withdrawal);
|
|
199
|
-
}
|
|
200
|
-
let auxiliaryDataSupplement;
|
|
201
|
-
if (this.params.auxiliaryData) {
|
|
202
|
-
const {
|
|
203
|
-
cvote_registration_parameters
|
|
204
|
-
} = this.params.auxiliaryData;
|
|
205
|
-
if (cvote_registration_parameters) {
|
|
206
|
-
this.params.auxiliaryData = modifyAuxiliaryDataForBackwardsCompatibility(this.params.auxiliaryData);
|
|
207
|
-
}
|
|
208
|
-
const {
|
|
209
|
-
message
|
|
210
|
-
} = await typedCall('CardanoTxAuxiliaryData', 'CardanoTxAuxiliaryDataSupplement', this.params.auxiliaryData);
|
|
211
|
-
const auxiliaryDataType = PROTO.CardanoTxAuxiliaryDataSupplementType[message.type];
|
|
212
|
-
if (auxiliaryDataType !== PROTO.CardanoTxAuxiliaryDataSupplementType.NONE) {
|
|
213
|
-
auxiliaryDataSupplement = {
|
|
214
|
-
type: auxiliaryDataType,
|
|
215
|
-
auxiliaryDataHash: message.auxiliary_data_hash,
|
|
216
|
-
cVoteRegistrationSignature: message.cvote_registration_signature,
|
|
217
|
-
catalystSignature: message.cvote_registration_signature,
|
|
218
|
-
governanceSignature: message.cvote_registration_signature
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
await typedCall('CardanoTxHostAck', 'CardanoTxItemAck');
|
|
222
|
-
}
|
|
223
|
-
if (this.params.mint.length > 0) {
|
|
224
|
-
await typedCall('CardanoTxMint', 'CardanoTxItemAck', {
|
|
225
|
-
asset_groups_count: this.params.mint.length
|
|
226
|
-
});
|
|
227
|
-
for (const assetGroup of this.params.mint) {
|
|
228
|
-
await typedCall('CardanoAssetGroup', 'CardanoTxItemAck', {
|
|
229
|
-
policy_id: assetGroup.policyId,
|
|
230
|
-
tokens_count: assetGroup.tokens.length
|
|
231
|
-
});
|
|
232
|
-
for (const token of assetGroup.tokens) {
|
|
233
|
-
await typedCall('CardanoToken', 'CardanoTxItemAck', token);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (const {
|
|
238
|
-
collateralInput
|
|
239
|
-
} of this.params.collateralInputsWithPath) {
|
|
240
|
-
await typedCall('CardanoTxCollateralInput', 'CardanoTxItemAck', collateralInput);
|
|
241
|
-
}
|
|
242
|
-
for (const requiredSigner of this.params.requiredSigners) {
|
|
243
|
-
await typedCall('CardanoTxRequiredSigner', 'CardanoTxItemAck', requiredSigner);
|
|
244
|
-
}
|
|
245
|
-
if (this.params.collateralReturnWithData) {
|
|
246
|
-
await sendOutput(typedCall, this.params.collateralReturnWithData);
|
|
247
|
-
}
|
|
248
|
-
for (const referenceInput of this.params.referenceInputs) {
|
|
249
|
-
await typedCall('CardanoTxReferenceInput', 'CardanoTxItemAck', referenceInput);
|
|
250
|
-
}
|
|
251
|
-
const witnesses = [];
|
|
252
|
-
for (const path of this.params.witnessPaths) {
|
|
253
|
-
const {
|
|
254
|
-
message
|
|
255
|
-
} = await typedCall('CardanoTxWitnessRequest', 'CardanoTxWitnessResponse', {
|
|
256
|
-
path
|
|
257
|
-
});
|
|
258
|
-
witnesses.push({
|
|
259
|
-
type: PROTO.CardanoTxWitnessType[message.type],
|
|
260
|
-
pubKey: message.pub_key,
|
|
261
|
-
signature: message.signature,
|
|
262
|
-
chainCode: message.chain_code
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
const {
|
|
266
|
-
message: txBodyHashMessage
|
|
267
|
-
} = await typedCall('CardanoTxHostAck', 'CardanoTxBodyHash');
|
|
268
|
-
await typedCall('CardanoTxHostAck', 'CardanoSignTxFinished');
|
|
269
|
-
return {
|
|
270
|
-
hash: txBodyHashMessage.tx_hash,
|
|
271
|
-
witnesses,
|
|
272
|
-
auxiliaryDataSupplement
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
async run() {
|
|
276
|
-
this._ensureFirmwareSupportsParams();
|
|
277
|
-
const result = await this._sign_tx();
|
|
278
|
-
if (!this.params.unsignedTx) return result;
|
|
279
|
-
const {
|
|
280
|
-
unsignedTx,
|
|
281
|
-
testnet
|
|
282
|
-
} = this.params;
|
|
283
|
-
const {
|
|
284
|
-
hash,
|
|
285
|
-
witnesses
|
|
286
|
-
} = result;
|
|
287
|
-
if (hash !== unsignedTx.hash) {
|
|
288
|
-
throw ERRORS.TypedError('Runtime', "Constructed transaction doesn't match the hash returned by the device.");
|
|
289
|
-
}
|
|
290
|
-
const {
|
|
291
|
-
trezorUtils
|
|
292
|
-
} = await cardano();
|
|
293
|
-
const serializedTx = trezorUtils.signTransaction(unsignedTx.body, witnesses, {
|
|
294
|
-
testnet
|
|
295
|
-
});
|
|
296
|
-
return {
|
|
297
|
-
...result,
|
|
298
|
-
serializedTx
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as cardanoGetAddress } from "./cardanoGetAddress.js";
|
|
2
|
-
export { default as cardanoGetNativeScriptHash } from "./cardanoGetNativeScriptHash.js";
|
|
3
|
-
export { default as cardanoGetPublicKey } from "./cardanoGetPublicKey.js";
|
|
4
|
-
export { default as cardanoSignTransaction } from "./cardanoSignTransaction.js";
|
|
5
|
-
export { default as cardanoComposeTransaction } from "./cardanoComposeTransaction.js";
|
|
6
|
-
export { default as cardanoSignMessage } from "./cardanoSignMessage.js";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as cardanoGetAddress } from "./cardanoGetAddress.js";
|
|
2
|
-
export { default as cardanoGetNativeScriptHash } from "./cardanoGetNativeScriptHash.js";
|
|
3
|
-
export { default as cardanoGetPublicKey } from "./cardanoGetPublicKey.js";
|
|
4
|
-
export { default as cardanoSignTransaction } from "./cardanoSignTransaction.js";
|
|
5
|
-
export { default as cardanoComposeTransaction } from "./cardanoComposeTransaction.js";
|
|
6
|
-
export { default as cardanoSignMessage } from "./cardanoSignMessage.js";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CardanoAddressParameters } from '@trezor/connect-common';
|
|
2
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
export declare const validateAddressParameters: (addressParameters: CardanoAddressParameters) => void;
|
|
4
|
-
export declare const modifyAddressParametersForBackwardsCompatibility: (address_parameters: PROTO.CardanoAddressParametersType) => PROTO.CardanoAddressParametersType;
|
|
5
|
-
export declare const addressParametersToProto: (addressParameters: CardanoAddressParameters) => PROTO.CardanoAddressParametersType;
|
|
6
|
-
export declare const addressParametersFromProto: (addressParameters: PROTO.CardanoAddressParametersType) => CardanoAddressParameters;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { CardanoAddressParameters } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
3
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
import { validatePath } from "../../utils/pathUtils.js";
|
|
6
|
-
export const validateAddressParameters = addressParameters => {
|
|
7
|
-
Assert(CardanoAddressParameters, addressParameters);
|
|
8
|
-
if (addressParameters.path) {
|
|
9
|
-
validatePath(addressParameters.path);
|
|
10
|
-
}
|
|
11
|
-
if (addressParameters.stakingPath) {
|
|
12
|
-
validatePath(addressParameters.stakingPath);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export const modifyAddressParametersForBackwardsCompatibility = address_parameters => {
|
|
16
|
-
if (address_parameters.address_type === PROTO.CardanoAddressType.REWARD) {
|
|
17
|
-
let {
|
|
18
|
-
address_n,
|
|
19
|
-
address_n_staking
|
|
20
|
-
} = address_parameters;
|
|
21
|
-
if (address_n.length > 0 && address_n_staking.length > 0) {
|
|
22
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `Only stakingPath is allowed for CardanoAddressType.REWARD`);
|
|
23
|
-
}
|
|
24
|
-
if (address_n.length > 0) {
|
|
25
|
-
address_n_staking = address_n;
|
|
26
|
-
address_n = [];
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
...address_parameters,
|
|
30
|
-
address_n,
|
|
31
|
-
address_n_staking
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
return address_parameters;
|
|
35
|
-
};
|
|
36
|
-
export const addressParametersToProto = addressParameters => {
|
|
37
|
-
let path = [];
|
|
38
|
-
if (addressParameters.path) {
|
|
39
|
-
path = validatePath(addressParameters.path, 3);
|
|
40
|
-
}
|
|
41
|
-
let stakingPath = [];
|
|
42
|
-
if (addressParameters.stakingPath) {
|
|
43
|
-
stakingPath = validatePath(addressParameters.stakingPath, 3);
|
|
44
|
-
}
|
|
45
|
-
let certificatePointer;
|
|
46
|
-
if (addressParameters.certificatePointer) {
|
|
47
|
-
certificatePointer = {
|
|
48
|
-
block_index: addressParameters.certificatePointer.blockIndex,
|
|
49
|
-
tx_index: addressParameters.certificatePointer.txIndex,
|
|
50
|
-
certificate_index: addressParameters.certificatePointer.certificateIndex
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
address_type: addressParameters.addressType,
|
|
55
|
-
address_n: path,
|
|
56
|
-
address_n_staking: stakingPath,
|
|
57
|
-
staking_key_hash: addressParameters.stakingKeyHash,
|
|
58
|
-
certificate_pointer: certificatePointer,
|
|
59
|
-
script_payment_hash: addressParameters.paymentScriptHash,
|
|
60
|
-
script_staking_hash: addressParameters.stakingScriptHash
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
export const addressParametersFromProto = addressParameters => {
|
|
64
|
-
let certificatePointer;
|
|
65
|
-
if (addressParameters.certificate_pointer) {
|
|
66
|
-
certificatePointer = {
|
|
67
|
-
blockIndex: addressParameters.certificate_pointer.block_index,
|
|
68
|
-
txIndex: addressParameters.certificate_pointer.tx_index,
|
|
69
|
-
certificateIndex: addressParameters.certificate_pointer.certificate_index
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
addressType: addressParameters.address_type,
|
|
74
|
-
path: addressParameters.address_n,
|
|
75
|
-
stakingPath: addressParameters.address_n_staking,
|
|
76
|
-
stakingKeyHash: addressParameters.staking_key_hash,
|
|
77
|
-
certificatePointer
|
|
78
|
-
};
|
|
79
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CardanoAuxiliaryData } from '@trezor/connect-common';
|
|
2
|
-
import type { PROTO } from '@trezor/connect-common';
|
|
3
|
-
export declare const transformAuxiliaryData: (auxiliaryData: CardanoAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
|
|
4
|
-
export declare const modifyAuxiliaryDataForBackwardsCompatibility: (auxiliary_data: PROTO.CardanoTxAuxiliaryData) => PROTO.CardanoTxAuxiliaryData;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { CardanoAuxiliaryData, CardanoCVoteRegistrationDelegation, CardanoCVoteRegistrationParameters } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
3
|
-
import { Assert } from "@trezor/schema-utils";
|
|
4
|
-
import { addressParametersToProto, modifyAddressParametersForBackwardsCompatibility, validateAddressParameters } from "./cardanoAddressParameters.js";
|
|
5
|
-
import { validatePath } from "../../utils/pathUtils.js";
|
|
6
|
-
const MAX_DELEGATION_COUNT = 32;
|
|
7
|
-
const transformDelegation = delegation => {
|
|
8
|
-
if (delegation.votingPublicKey) {
|
|
9
|
-
console.warn('Please use votePublicKey instead of votingPublicKey.');
|
|
10
|
-
delegation.votePublicKey = delegation.votingPublicKey;
|
|
11
|
-
}
|
|
12
|
-
Assert(CardanoCVoteRegistrationDelegation, delegation);
|
|
13
|
-
return {
|
|
14
|
-
vote_public_key: delegation.votePublicKey,
|
|
15
|
-
weight: delegation.weight
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
const transformCvoteRegistrationParameters = cVoteRegistrationParameters => {
|
|
19
|
-
if (cVoteRegistrationParameters.votingPublicKey) {
|
|
20
|
-
console.warn('Please use votePublicKey instead of votingPublicKey.');
|
|
21
|
-
cVoteRegistrationParameters.votePublicKey = cVoteRegistrationParameters.votingPublicKey;
|
|
22
|
-
}
|
|
23
|
-
if (cVoteRegistrationParameters.rewardAddressParameters) {
|
|
24
|
-
console.warn('Please use paymentAddressParameters instead of rewardAddressParameters.');
|
|
25
|
-
cVoteRegistrationParameters.paymentAddressParameters = cVoteRegistrationParameters.rewardAddressParameters;
|
|
26
|
-
}
|
|
27
|
-
Assert(CardanoCVoteRegistrationParameters, cVoteRegistrationParameters);
|
|
28
|
-
const {
|
|
29
|
-
paymentAddressParameters
|
|
30
|
-
} = cVoteRegistrationParameters;
|
|
31
|
-
if (paymentAddressParameters) {
|
|
32
|
-
validateAddressParameters(paymentAddressParameters);
|
|
33
|
-
}
|
|
34
|
-
const {
|
|
35
|
-
delegations
|
|
36
|
-
} = cVoteRegistrationParameters;
|
|
37
|
-
if (delegations && delegations.length > MAX_DELEGATION_COUNT) {
|
|
38
|
-
throw ERRORS.TypedError('Method_InvalidParameter', `At most ${MAX_DELEGATION_COUNT} delegations are allowed in a CIP-36 registration`);
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
vote_public_key: cVoteRegistrationParameters.votePublicKey,
|
|
42
|
-
staking_path: validatePath(cVoteRegistrationParameters.stakingPath, 3),
|
|
43
|
-
payment_address_parameters: paymentAddressParameters ? addressParametersToProto(paymentAddressParameters) : undefined,
|
|
44
|
-
nonce: cVoteRegistrationParameters.nonce,
|
|
45
|
-
format: cVoteRegistrationParameters.format,
|
|
46
|
-
delegations: delegations?.map(transformDelegation),
|
|
47
|
-
voting_purpose: cVoteRegistrationParameters.votingPurpose,
|
|
48
|
-
payment_address: cVoteRegistrationParameters.paymentAddress
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
export const transformAuxiliaryData = auxiliaryData => {
|
|
52
|
-
Assert(CardanoAuxiliaryData, auxiliaryData);
|
|
53
|
-
let cVoteRegistrationParameters;
|
|
54
|
-
if (auxiliaryData.cVoteRegistrationParameters) {
|
|
55
|
-
cVoteRegistrationParameters = transformCvoteRegistrationParameters(auxiliaryData.cVoteRegistrationParameters);
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
hash: auxiliaryData.hash,
|
|
59
|
-
cvote_registration_parameters: cVoteRegistrationParameters
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export const modifyAuxiliaryDataForBackwardsCompatibility = auxiliary_data => {
|
|
63
|
-
const {
|
|
64
|
-
cvote_registration_parameters
|
|
65
|
-
} = auxiliary_data;
|
|
66
|
-
if (cvote_registration_parameters?.payment_address_parameters) {
|
|
67
|
-
cvote_registration_parameters.payment_address_parameters = modifyAddressParametersForBackwardsCompatibility(cvote_registration_parameters.payment_address_parameters);
|
|
68
|
-
return {
|
|
69
|
-
...auxiliary_data,
|
|
70
|
-
cvote_registration_parameters
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return auxiliary_data;
|
|
74
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CardanoCertificate } from '@trezor/connect-common';
|
|
2
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
3
|
-
export type CertificateWithPoolOwnersAndRelays = {
|
|
4
|
-
certificate: PROTO.CardanoTxCertificate;
|
|
5
|
-
poolOwners: PROTO.CardanoPoolOwner[];
|
|
6
|
-
poolRelays: PROTO.CardanoPoolRelayParameters[];
|
|
7
|
-
};
|
|
8
|
-
export type PoolParametersWithOwnersAndRelays = {
|
|
9
|
-
poolParameters?: PROTO.CardanoPoolParametersType;
|
|
10
|
-
poolOwners: PROTO.CardanoPoolOwner[];
|
|
11
|
-
poolRelays: PROTO.CardanoPoolRelayParameters[];
|
|
12
|
-
};
|
|
13
|
-
export declare const transformCertificate: (certificate: CardanoCertificate) => CertificateWithPoolOwnersAndRelays;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { CardanoCertificate, CardanoDRep, CardanoPoolParameters, CardanoPoolRelay } from "@trezor/connect-common";
|
|
2
|
-
import { ERRORS } from "@trezor/connect-common/lib/constants/index.js";
|
|
3
|
-
import { MessagesSchema as PROTO } from "@trezor/protobuf";
|
|
4
|
-
import { Assert } from "@trezor/schema-utils";
|
|
5
|
-
import { validatePath } from "../../utils/pathUtils.js";
|
|
6
|
-
const ipv4AddressToHex = ipv4Address => Buffer.from(ipv4Address.split('.').map(ipPart => parseInt(ipPart, 10))).toString('hex');
|
|
7
|
-
const ipv6AddressToHex = ipv6Address => ipv6Address.split(':').join('');
|
|
8
|
-
const validatePoolRelay = relay => {
|
|
9
|
-
Assert(CardanoPoolRelay, relay);
|
|
10
|
-
if (relay.type === PROTO.CardanoPoolRelayType.SINGLE_HOST_IP) {
|
|
11
|
-
if (!relay.ipv4Address && !relay.ipv6Address) {
|
|
12
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Either ipv4Address or ipv6Address must be supplied');
|
|
13
|
-
}
|
|
14
|
-
} else if (relay.type === PROTO.CardanoPoolRelayType.SINGLE_HOST_NAME) {
|
|
15
|
-
if (!relay.hostName) {
|
|
16
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'hostName must be supplied');
|
|
17
|
-
}
|
|
18
|
-
if (!relay.port) {
|
|
19
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'port must be supplied');
|
|
20
|
-
}
|
|
21
|
-
} else if (relay.type === PROTO.CardanoPoolRelayType.MULTIPLE_HOST_NAME) {
|
|
22
|
-
if (!relay.hostName) {
|
|
23
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'hostName must be supplied');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
const validatePoolOwners = owners => {
|
|
28
|
-
owners.forEach(owner => {
|
|
29
|
-
if (owner.stakingKeyPath) {
|
|
30
|
-
validatePath(owner.stakingKeyPath, 5);
|
|
31
|
-
}
|
|
32
|
-
if (!owner.stakingKeyHash && !owner.stakingKeyPath) {
|
|
33
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Either stakingKeyHash or stakingKeyPath must be supplied');
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const ownersAsPathCount = owners.filter(owner => !!owner.stakingKeyPath).length;
|
|
37
|
-
if (ownersAsPathCount !== 1) {
|
|
38
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'Exactly one pool owner must be given as a path');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const validatePoolParameters = poolParameters => {
|
|
42
|
-
Assert(CardanoPoolParameters, poolParameters);
|
|
43
|
-
validatePoolOwners(poolParameters.owners);
|
|
44
|
-
poolParameters.relays.forEach(validatePoolRelay);
|
|
45
|
-
};
|
|
46
|
-
const validateDRep = dRep => {
|
|
47
|
-
Assert(CardanoDRep, dRep);
|
|
48
|
-
if (dRep.type === PROTO.CardanoDRepType.KEY_HASH && !dRep.keyHash) {
|
|
49
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'keyHash must be supplied for KEY_HASH dRep type');
|
|
50
|
-
} else if (dRep.type === PROTO.CardanoDRepType.SCRIPT_HASH && !dRep.scriptHash) {
|
|
51
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'scriptHash must be supplied for SCRIPT_HASH dRep type');
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const transformPoolParameters = poolParameters => {
|
|
55
|
-
if (!poolParameters) {
|
|
56
|
-
return {
|
|
57
|
-
poolParameters: undefined,
|
|
58
|
-
poolOwners: [],
|
|
59
|
-
poolRelays: []
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
validatePoolParameters(poolParameters);
|
|
63
|
-
return {
|
|
64
|
-
poolParameters: {
|
|
65
|
-
pool_id: poolParameters.poolId,
|
|
66
|
-
vrf_key_hash: poolParameters.vrfKeyHash,
|
|
67
|
-
pledge: poolParameters.pledge,
|
|
68
|
-
cost: poolParameters.cost,
|
|
69
|
-
margin_numerator: poolParameters.margin.numerator,
|
|
70
|
-
margin_denominator: poolParameters.margin.denominator,
|
|
71
|
-
reward_account: poolParameters.rewardAccount,
|
|
72
|
-
metadata: poolParameters.metadata,
|
|
73
|
-
owners_count: poolParameters.owners.length,
|
|
74
|
-
relays_count: poolParameters.relays.length
|
|
75
|
-
},
|
|
76
|
-
poolOwners: poolParameters.owners.map(owner => ({
|
|
77
|
-
staking_key_hash: owner.stakingKeyHash,
|
|
78
|
-
staking_key_path: owner.stakingKeyPath ? validatePath(owner.stakingKeyPath, 5) : undefined
|
|
79
|
-
})),
|
|
80
|
-
poolRelays: poolParameters.relays.map(relay => ({
|
|
81
|
-
type: relay.type,
|
|
82
|
-
ipv4_address: relay.ipv4Address ? ipv4AddressToHex(relay.ipv4Address) : undefined,
|
|
83
|
-
ipv6_address: relay.ipv6Address ? ipv6AddressToHex(relay.ipv6Address) : undefined,
|
|
84
|
-
host_name: relay.hostName,
|
|
85
|
-
port: relay.port
|
|
86
|
-
}))
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
const transformDRep = dRep => {
|
|
90
|
-
if (!dRep) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
validateDRep(dRep);
|
|
94
|
-
return {
|
|
95
|
-
type: dRep.type,
|
|
96
|
-
key_hash: dRep.keyHash,
|
|
97
|
-
script_hash: dRep.scriptHash
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
export const transformCertificate = certificate => {
|
|
101
|
-
Assert(CardanoCertificate, certificate);
|
|
102
|
-
if (certificate.type === PROTO.CardanoCertificateType.STAKE_DELEGATION) {
|
|
103
|
-
if (!certificate.pool) {
|
|
104
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'pool must be supplied for STAKE_DELEGATION');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (certificate.type === PROTO.CardanoCertificateType.STAKE_POOL_REGISTRATION) {
|
|
108
|
-
if (!certificate.poolParameters) {
|
|
109
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'poolParameters must be supplied for STAKE_POOL_REGISTRATION');
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (certificate.type === PROTO.CardanoCertificateType.STAKE_REGISTRATION_CONWAY || certificate.type === PROTO.CardanoCertificateType.STAKE_DEREGISTRATION_CONWAY) {
|
|
113
|
-
if (!certificate.deposit) {
|
|
114
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'deposit must be supplied for STAKE_REGISTRATION_CONWAY or STAKE_DEREGISTRATION_CONWAY');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (certificate.type === PROTO.CardanoCertificateType.VOTE_DELEGATION) {
|
|
118
|
-
if (!certificate.dRep) {
|
|
119
|
-
throw ERRORS.TypedError('Method_InvalidParameter', 'dRep must be supplied for VOTE_DELEGATION');
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const {
|
|
123
|
-
poolParameters,
|
|
124
|
-
poolOwners,
|
|
125
|
-
poolRelays
|
|
126
|
-
} = transformPoolParameters(certificate.poolParameters);
|
|
127
|
-
const dRep = transformDRep(certificate.dRep);
|
|
128
|
-
return {
|
|
129
|
-
certificate: {
|
|
130
|
-
type: certificate.type,
|
|
131
|
-
path: certificate.path ? validatePath(certificate.path, 5) : undefined,
|
|
132
|
-
script_hash: certificate.scriptHash,
|
|
133
|
-
key_hash: certificate.keyHash,
|
|
134
|
-
pool: certificate.pool,
|
|
135
|
-
pool_parameters: poolParameters,
|
|
136
|
-
deposit: certificate.deposit,
|
|
137
|
-
drep: dRep
|
|
138
|
-
},
|
|
139
|
-
poolOwners,
|
|
140
|
-
poolRelays
|
|
141
|
-
};
|
|
142
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { MessagesSchema as PROTO } from '@trezor/protobuf';
|
|
2
|
-
import type { Static } from '@trezor/schema-utils';
|
|
3
|
-
export type Path = number[];
|
|
4
|
-
export declare const Path: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>;
|
|
5
|
-
export type CollateralInputWithPath = {
|
|
6
|
-
collateralInput: PROTO.CardanoTxCollateralInput;
|
|
7
|
-
path?: Path;
|
|
8
|
-
};
|
|
9
|
-
export type InputWithPath = Static<typeof InputWithPath>;
|
|
10
|
-
export declare const InputWithPath: import("@sinclair/typebox").TObject<{
|
|
11
|
-
input: import("@sinclair/typebox").TObject<{
|
|
12
|
-
prev_hash: import("@sinclair/typebox").TString;
|
|
13
|
-
prev_index: import("@sinclair/typebox").TNumber;
|
|
14
|
-
}>;
|
|
15
|
-
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>>;
|
|
16
|
-
}>;
|
|
17
|
-
export type InputWithPathParam = Static<typeof InputWithPath>;
|
|
18
|
-
export declare const InputWithPathParam: import("@sinclair/typebox").TObject<{
|
|
19
|
-
prev_hash: import("@sinclair/typebox").TString;
|
|
20
|
-
prev_index: import("@sinclair/typebox").TNumber;
|
|
21
|
-
path: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TNumber>]>>;
|
|
22
|
-
}>;
|
|
23
|
-
export declare const transformInput: (input: unknown) => InputWithPath;
|
|
24
|
-
export declare const transformCollateralInput: (collateralInput: unknown) => CollateralInputWithPath;
|
|
25
|
-
export declare const transformReferenceInput: (referenceInput: unknown) => PROTO.CardanoTxReferenceInput;
|