@onekeyfe/hd-core 1.2.0-alpha.23 → 1.2.0-alpha.25
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/__tests__/AllNetworkGetAddressBase.tracing.test.ts +2 -0
- package/__tests__/DeviceCommands.test.ts +35 -0
- package/__tests__/chain-params-onekey-compatibility.test.ts +229 -0
- package/__tests__/device-lifecycle-events.test.ts +59 -0
- package/__tests__/device-state-events.test.ts +124 -0
- package/__tests__/evmLedgerLegacySafety.test.ts +3 -1
- package/__tests__/firmware-update/check-all-firmware-release.test.ts +68 -27
- package/__tests__/firmware-update/firmware-update-plan.test.ts +28 -0
- package/__tests__/kaspa-public-types.type-test.ts +16 -0
- package/__tests__/kaspaSignTransaction.test.ts +4 -3
- package/__tests__/method-protocol-support.test.ts +113 -0
- package/__tests__/open-wallet-session.test.ts +192 -129
- package/__tests__/protocol-v2-ping.test.ts +28 -0
- package/__tests__/protocol-v2.test.ts +346 -230
- package/__tests__/public-device-state-api.test.ts +10 -8
- package/__tests__/public-pro2-api-boundary.test.ts +22 -0
- package/__tests__/tron-sign-message-init.test.ts +46 -0
- package/dist/api/BaseMethod.d.ts +6 -2
- package/dist/api/BaseMethod.d.ts.map +1 -1
- package/dist/api/CheckAllFirmwareRelease.d.ts.map +1 -1
- package/dist/api/CipherKeyValue.d.ts +1 -0
- package/dist/api/CipherKeyValue.d.ts.map +1 -1
- package/dist/api/DirList.d.ts +1 -0
- package/dist/api/DirList.d.ts.map +1 -1
- package/dist/api/DirMake.d.ts +1 -0
- package/dist/api/DirMake.d.ts.map +1 -1
- package/dist/api/DirRemove.d.ts +1 -0
- package/dist/api/DirRemove.d.ts.map +1 -1
- package/dist/api/FileDelete.d.ts +1 -0
- package/dist/api/FileDelete.d.ts.map +1 -1
- package/dist/api/FileRead.d.ts +1 -0
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts +1 -0
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdate.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV3.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +2 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceState.d.ts +1 -0
- package/dist/api/GetDeviceState.d.ts.map +1 -1
- package/dist/api/GetFeatures.d.ts.map +1 -1
- package/dist/api/GetOnekeyFeatures.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +1 -0
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/OpenWalletSession.d.ts +2 -8
- package/dist/api/OpenWalletSession.d.ts.map +1 -1
- package/dist/api/PathInfo.d.ts +1 -0
- package/dist/api/PathInfo.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumGetAddress.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignMessage.d.ts.map +1 -1
- package/dist/api/alephium/AlephiumSignTransaction.d.ts.map +1 -1
- package/dist/api/algo/AlgoGetAddress.d.ts +1 -0
- package/dist/api/algo/AlgoGetAddress.d.ts.map +1 -1
- package/dist/api/algo/AlgoSignTransaction.d.ts +1 -0
- package/dist/api/algo/AlgoSignTransaction.d.ts.map +1 -1
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts +1 -0
- package/dist/api/allnetwork/AllNetworkGetAddressBase.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetAddress.d.ts +1 -0
- package/dist/api/aptos/AptosGetAddress.d.ts.map +1 -1
- package/dist/api/aptos/AptosGetPublicKey.d.ts +1 -0
- package/dist/api/aptos/AptosGetPublicKey.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignInMessage.d.ts +1 -0
- package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignMessage.d.ts +1 -0
- package/dist/api/aptos/AptosSignMessage.d.ts.map +1 -1
- package/dist/api/aptos/AptosSignTransaction.d.ts +1 -0
- package/dist/api/aptos/AptosSignTransaction.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetAddress.d.ts.map +1 -1
- package/dist/api/benfen/BenfenGetPublicKey.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignMessage.d.ts.map +1 -1
- package/dist/api/benfen/BenfenSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCGetAddress.d.ts +1 -0
- package/dist/api/btc/BTCGetAddress.d.ts.map +1 -1
- package/dist/api/btc/BTCGetPublicKey.d.ts +1 -0
- package/dist/api/btc/BTCGetPublicKey.d.ts.map +1 -1
- package/dist/api/btc/BTCSignMessage.d.ts +1 -0
- package/dist/api/btc/BTCSignMessage.d.ts.map +1 -1
- package/dist/api/btc/BTCSignPsbt.d.ts +1 -0
- package/dist/api/btc/BTCSignPsbt.d.ts.map +1 -1
- package/dist/api/btc/BTCSignTransaction.d.ts +1 -0
- package/dist/api/btc/BTCSignTransaction.d.ts.map +1 -1
- package/dist/api/btc/BTCVerifyMessage.d.ts +1 -0
- package/dist/api/btc/BTCVerifyMessage.d.ts.map +1 -1
- package/dist/api/btc/helpers/versionLimit.d.ts +2 -0
- package/dist/api/btc/helpers/versionLimit.d.ts.map +1 -1
- package/dist/api/cardano/CardanoGetAddress.d.ts +1 -0
- package/dist/api/cardano/CardanoGetAddress.d.ts.map +1 -1
- package/dist/api/cardano/CardanoGetPublicKey.d.ts +1 -0
- package/dist/api/cardano/CardanoGetPublicKey.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignMessage.d.ts +1 -0
- package/dist/api/cardano/CardanoSignMessage.d.ts.map +1 -1
- package/dist/api/cardano/CardanoSignTransaction.d.ts +1 -0
- package/dist/api/cardano/CardanoSignTransaction.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxGetAddress.d.ts +1 -0
- package/dist/api/conflux/ConfluxGetAddress.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessage.d.ts +1 -0
- package/dist/api/conflux/ConfluxSignMessage.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts +1 -0
- package/dist/api/conflux/ConfluxSignMessageCIP23.d.ts.map +1 -1
- package/dist/api/conflux/ConfluxSignTransaction.d.ts +1 -0
- package/dist/api/conflux/ConfluxSignTransaction.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetAddress.d.ts +1 -0
- package/dist/api/cosmos/CosmosGetAddress.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts +1 -0
- package/dist/api/cosmos/CosmosGetPublicKey.d.ts.map +1 -1
- package/dist/api/cosmos/CosmosSignTransaction.d.ts +1 -0
- package/dist/api/cosmos/CosmosSignTransaction.d.ts.map +1 -1
- package/dist/api/device/DeviceCancel.d.ts +1 -0
- package/dist/api/device/DeviceCancel.d.ts.map +1 -1
- package/dist/api/device/DeviceChangePin.d.ts +1 -0
- package/dist/api/device/DeviceChangePin.d.ts.map +1 -1
- package/dist/api/device/DeviceLock.d.ts +1 -0
- package/dist/api/device/DeviceLock.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBoardloader.d.ts +1 -0
- package/dist/api/device/DeviceRebootToBoardloader.d.ts.map +1 -1
- package/dist/api/device/DeviceRebootToBootloader.d.ts +1 -0
- package/dist/api/device/DeviceRebootToBootloader.d.ts.map +1 -1
- package/dist/api/device/DeviceSettings.d.ts +1 -0
- package/dist/api/device/DeviceSettings.d.ts.map +1 -1
- package/dist/api/device/DeviceSupportFeatures.d.ts +1 -0
- package/dist/api/device/DeviceSupportFeatures.d.ts.map +1 -1
- package/dist/api/device/DeviceUnlock.d.ts +1 -0
- package/dist/api/device/DeviceUnlock.d.ts.map +1 -1
- package/dist/api/device/DeviceWipe.d.ts +1 -0
- package/dist/api/device/DeviceWipe.d.ts.map +1 -1
- package/dist/api/device/PreInitialize.d.ts +1 -0
- package/dist/api/device/PreInitialize.d.ts.map +1 -1
- package/dist/api/dynex/DnxGetAddress.d.ts.map +1 -1
- package/dist/api/dynex/DnxSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMGetAddress.d.ts +1 -0
- package/dist/api/evm/EVMGetAddress.d.ts.map +1 -1
- package/dist/api/evm/EVMGetPublicKey.d.ts +1 -0
- package/dist/api/evm/EVMGetPublicKey.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessage.d.ts +1 -0
- package/dist/api/evm/EVMSignMessage.d.ts.map +1 -1
- package/dist/api/evm/EVMSignMessageEIP712.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTransaction.d.ts +1 -0
- package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
- package/dist/api/evm/EVMSignTypedData.d.ts +1 -0
- package/dist/api/evm/EVMSignTypedData.d.ts.map +1 -1
- package/dist/api/evm/EVMVerifyMessage.d.ts +1 -0
- package/dist/api/evm/EVMVerifyMessage.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinGetAddress.d.ts +1 -0
- package/dist/api/filecoin/FilecoinGetAddress.d.ts.map +1 -1
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts +1 -0
- package/dist/api/filecoin/FilecoinSignTransaction.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdatePlan.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaGetAddress.d.ts +1 -0
- package/dist/api/kaspa/KaspaGetAddress.d.ts.map +1 -1
- package/dist/api/kaspa/KaspaSignTransaction.d.ts +1 -0
- package/dist/api/kaspa/KaspaSignTransaction.d.ts.map +1 -1
- package/dist/api/kaspa/helpers/TransferSerialize.d.ts.map +1 -1
- package/dist/api/lightning/LnurlAuth.d.ts +0 -4
- package/dist/api/lightning/LnurlAuth.d.ts.map +1 -1
- package/dist/api/near/NearGetAddress.d.ts +1 -0
- package/dist/api/near/NearGetAddress.d.ts.map +1 -1
- package/dist/api/near/NearSignTransaction.d.ts +1 -0
- package/dist/api/near/NearSignTransaction.d.ts.map +1 -1
- package/dist/api/nem/NEMGetAddress.d.ts +1 -0
- package/dist/api/nem/NEMGetAddress.d.ts.map +1 -1
- package/dist/api/nem/NEMSignTransaction.d.ts +1 -0
- package/dist/api/nem/NEMSignTransaction.d.ts.map +1 -1
- package/dist/api/neo/NeoGetAddress.d.ts.map +1 -1
- package/dist/api/neo/NeoSignTransaction.d.ts.map +1 -1
- package/dist/api/nervos/NervosGetAddress.d.ts.map +1 -1
- package/dist/api/nervos/NervosSignTransaction.d.ts.map +1 -1
- package/dist/api/nexa/NexaGetAddress.d.ts.map +1 -1
- package/dist/api/nexa/NexaSignTransaction.d.ts.map +1 -1
- package/dist/api/nostr/NostrDecryptMessage.d.ts +1 -0
- package/dist/api/nostr/NostrDecryptMessage.d.ts.map +1 -1
- package/dist/api/nostr/NostrEncryptMessage.d.ts +1 -0
- package/dist/api/nostr/NostrEncryptMessage.d.ts.map +1 -1
- package/dist/api/nostr/NostrGetPublicKey.d.ts +1 -0
- package/dist/api/nostr/NostrGetPublicKey.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignEvent.d.ts +1 -0
- package/dist/api/nostr/NostrSignEvent.d.ts.map +1 -1
- package/dist/api/nostr/NostrSignSchnorr.d.ts +1 -0
- package/dist/api/nostr/NostrSignSchnorr.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +1 -0
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts +1 -0
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceReboot.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceReboot.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceStatusGet.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts +1 -0
- package/dist/api/protocol-v2/DeviceUploadWallpaper.d.ts.map +1 -1
- package/dist/api/protocol-v2/FilesystemFormat.d.ts +1 -0
- package/dist/api/protocol-v2/FilesystemFormat.d.ts.map +1 -1
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts +1 -0
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -1
- package/dist/api/protocol-v2/Ping.d.ts +3 -0
- package/dist/api/protocol-v2/Ping.d.ts.map +1 -1
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +1 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -1
- package/dist/api/scdo/ScdoGetAddress.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignMessage.d.ts.map +1 -1
- package/dist/api/scdo/ScdoSignTransaction.d.ts.map +1 -1
- package/dist/api/solana/SolGetAddress.d.ts +1 -0
- package/dist/api/solana/SolGetAddress.d.ts.map +1 -1
- package/dist/api/solana/SolSignMessage.d.ts +1 -0
- package/dist/api/solana/SolSignMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignOffchainMessage.d.ts +1 -0
- package/dist/api/solana/SolSignOffchainMessage.d.ts.map +1 -1
- package/dist/api/solana/SolSignTransaction.d.ts +1 -0
- package/dist/api/solana/SolSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetAddress.d.ts +1 -0
- package/dist/api/starcoin/StarcoinGetAddress.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts +1 -0
- package/dist/api/starcoin/StarcoinGetPublicKey.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignMessage.d.ts +1 -0
- package/dist/api/starcoin/StarcoinSignMessage.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts +1 -0
- package/dist/api/starcoin/StarcoinSignTransaction.d.ts.map +1 -1
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts +1 -0
- package/dist/api/starcoin/StarcoinVerifyMessage.d.ts.map +1 -1
- package/dist/api/stellar/StellarGetAddress.d.ts +1 -2
- package/dist/api/stellar/StellarGetAddress.d.ts.map +1 -1
- package/dist/api/stellar/StellarSignTransaction.d.ts +1 -2
- package/dist/api/stellar/StellarSignTransaction.d.ts.map +1 -1
- package/dist/api/sui/SuiGetAddress.d.ts +1 -0
- package/dist/api/sui/SuiGetAddress.d.ts.map +1 -1
- package/dist/api/sui/SuiGetPublicKey.d.ts +1 -0
- package/dist/api/sui/SuiGetPublicKey.d.ts.map +1 -1
- package/dist/api/sui/SuiSignMessage.d.ts +1 -0
- package/dist/api/sui/SuiSignMessage.d.ts.map +1 -1
- package/dist/api/sui/SuiSignTransaction.d.ts +1 -0
- package/dist/api/sui/SuiSignTransaction.d.ts.map +1 -1
- package/dist/api/ton/TonGetAddress.d.ts +1 -0
- package/dist/api/ton/TonGetAddress.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -0
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/api/ton/TonSignMessage.d.ts +1 -0
- package/dist/api/ton/TonSignMessage.d.ts.map +1 -1
- package/dist/api/ton/TonSignProof.d.ts +1 -0
- package/dist/api/ton/TonSignProof.d.ts.map +1 -1
- package/dist/api/tron/TronGetAddress.d.ts +1 -0
- package/dist/api/tron/TronGetAddress.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +2 -0
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +1 -0
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpGetAddress.d.ts +1 -0
- package/dist/api/xrp/XrpGetAddress.d.ts.map +1 -1
- package/dist/api/xrp/XrpSignTransaction.d.ts +1 -0
- package/dist/api/xrp/XrpSignTransaction.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +3 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/index.d.ts +25 -25
- package/dist/index.js +669 -367
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/unlockRetry.d.ts +2 -3
- package/dist/protocols/protocol-v2/unlockRetry.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/walletSession.d.ts +12 -0
- package/dist/protocols/protocol-v2/walletSession.d.ts.map +1 -1
- package/dist/types/api/export.d.ts +1 -1
- package/dist/types/api/export.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +3 -1
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/kaspaSignTransaction.d.ts +15 -2
- package/dist/types/api/kaspaSignTransaction.d.ts.map +1 -1
- package/dist/types/api/openWalletSession.d.ts +0 -12
- package/dist/types/api/openWalletSession.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +4 -0
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts +0 -1
- package/dist/types/device.d.ts.map +1 -1
- package/dist/utils/deviceInfoUtils.d.ts +0 -1
- package/dist/utils/deviceInfoUtils.d.ts.map +1 -1
- package/dist/utils/deviceVersionUtils.d.ts +1 -0
- package/dist/utils/deviceVersionUtils.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/BaseMethod.ts +21 -18
- package/src/api/CheckAllFirmwareRelease.ts +23 -3
- package/src/api/CipherKeyValue.ts +4 -0
- package/src/api/DirList.ts +4 -1
- package/src/api/DirMake.ts +4 -1
- package/src/api/DirRemove.ts +4 -1
- package/src/api/FileDelete.ts +4 -1
- package/src/api/FileRead.ts +4 -1
- package/src/api/FileWrite.ts +4 -1
- package/src/api/FirmwareUpdate.ts +0 -8
- package/src/api/FirmwareUpdateV3.ts +0 -6
- package/src/api/FirmwareUpdateV4.ts +36 -18
- package/src/api/GetDeviceState.ts +4 -0
- package/src/api/GetFeatures.ts +1 -4
- package/src/api/GetOnekeyFeatures.ts +0 -5
- package/src/api/GetPassphraseState.ts +4 -0
- package/src/api/OpenWalletSession.ts +27 -86
- package/src/api/PathInfo.ts +4 -1
- package/src/api/alephium/AlephiumGetAddress.ts +0 -4
- package/src/api/alephium/AlephiumSignMessage.ts +0 -4
- package/src/api/alephium/AlephiumSignTransaction.ts +0 -4
- package/src/api/algo/AlgoGetAddress.ts +4 -0
- package/src/api/algo/AlgoSignTransaction.ts +4 -0
- package/src/api/allnetwork/AllNetworkGetAddressBase.ts +5 -13
- package/src/api/aptos/AptosGetAddress.ts +4 -0
- package/src/api/aptos/AptosGetPublicKey.ts +4 -0
- package/src/api/aptos/AptosSignInMessage.ts +4 -0
- package/src/api/aptos/AptosSignMessage.ts +4 -0
- package/src/api/aptos/AptosSignTransaction.ts +4 -0
- package/src/api/benfen/BenfenGetAddress.ts +11 -7
- package/src/api/benfen/BenfenGetPublicKey.ts +0 -4
- package/src/api/benfen/BenfenSignMessage.ts +0 -4
- package/src/api/benfen/BenfenSignTransaction.ts +0 -4
- package/src/api/btc/BTCGetAddress.ts +8 -1
- package/src/api/btc/BTCGetPublicKey.ts +8 -1
- package/src/api/btc/BTCSignMessage.ts +8 -1
- package/src/api/btc/BTCSignPsbt.ts +4 -0
- package/src/api/btc/BTCSignTransaction.ts +8 -1
- package/src/api/btc/BTCVerifyMessage.ts +8 -1
- package/src/api/btc/helpers/versionLimit.ts +7 -4
- package/src/api/cardano/CardanoGetAddress.ts +4 -0
- package/src/api/cardano/CardanoGetPublicKey.ts +4 -0
- package/src/api/cardano/CardanoSignMessage.ts +4 -0
- package/src/api/cardano/CardanoSignTransaction.ts +4 -0
- package/src/api/conflux/ConfluxGetAddress.ts +4 -0
- package/src/api/conflux/ConfluxSignMessage.ts +4 -0
- package/src/api/conflux/ConfluxSignMessageCIP23.ts +4 -0
- package/src/api/conflux/ConfluxSignTransaction.ts +6 -5
- package/src/api/cosmos/CosmosGetAddress.ts +4 -0
- package/src/api/cosmos/CosmosGetPublicKey.ts +4 -0
- package/src/api/cosmos/CosmosSignTransaction.ts +4 -0
- package/src/api/device/DeviceCancel.ts +4 -0
- package/src/api/device/DeviceChangePin.ts +4 -0
- package/src/api/device/DeviceLock.ts +4 -0
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -0
- package/src/api/device/DeviceRebootToBootloader.ts +4 -0
- package/src/api/device/DeviceSettings.ts +4 -0
- package/src/api/device/DeviceSupportFeatures.ts +4 -0
- package/src/api/device/DeviceUnlock.ts +4 -0
- package/src/api/device/DeviceWipe.ts +4 -0
- package/src/api/device/PreInitialize.ts +4 -0
- package/src/api/dynex/DnxGetAddress.ts +0 -6
- package/src/api/dynex/DnxSignTransaction.ts +0 -6
- package/src/api/evm/EVMGetAddress.ts +4 -0
- package/src/api/evm/EVMGetPublicKey.ts +4 -0
- package/src/api/evm/EVMSignMessage.ts +4 -0
- package/src/api/evm/EVMSignMessageEIP712.ts +1 -11
- package/src/api/evm/EVMSignTransaction.ts +4 -0
- package/src/api/evm/EVMSignTypedData.ts +4 -0
- package/src/api/evm/EVMVerifyMessage.ts +4 -0
- package/src/api/filecoin/FilecoinGetAddress.ts +4 -0
- package/src/api/filecoin/FilecoinSignTransaction.ts +4 -0
- package/src/api/firmware/FirmwareUpdatePlan.ts +8 -1
- package/src/api/index.ts +1 -0
- package/src/api/kaspa/KaspaGetAddress.ts +4 -0
- package/src/api/kaspa/KaspaSignTransaction.ts +37 -15
- package/src/api/kaspa/helpers/TransferSerialize.ts +3 -7
- package/src/api/lightning/LnurlAuth.ts +0 -4
- package/src/api/near/NearGetAddress.ts +4 -0
- package/src/api/near/NearSignTransaction.ts +4 -0
- package/src/api/nem/NEMGetAddress.ts +4 -0
- package/src/api/nem/NEMSignTransaction.ts +4 -0
- package/src/api/neo/NeoGetAddress.ts +0 -4
- package/src/api/neo/NeoSignTransaction.ts +0 -4
- package/src/api/nervos/NervosGetAddress.ts +0 -4
- package/src/api/nervos/NervosSignTransaction.ts +0 -4
- package/src/api/nexa/NexaGetAddress.ts +0 -4
- package/src/api/nexa/NexaSignTransaction.ts +0 -4
- package/src/api/nostr/NostrDecryptMessage.ts +4 -0
- package/src/api/nostr/NostrEncryptMessage.ts +4 -0
- package/src/api/nostr/NostrGetPublicKey.ts +4 -0
- package/src/api/nostr/NostrSignEvent.ts +4 -0
- package/src/api/nostr/NostrSignSchnorr.ts +4 -0
- package/src/api/polkadot/PolkadotGetAddress.ts +4 -0
- package/src/api/polkadot/PolkadotSignTransaction.ts +4 -0
- package/src/api/protocol-v2/DeviceFactoryInfoGet.ts +4 -1
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +4 -1
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +4 -1
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +4 -1
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +4 -1
- package/src/api/protocol-v2/DeviceInfoGet.ts +4 -8
- package/src/api/protocol-v2/DeviceReboot.ts +4 -2
- package/src/api/protocol-v2/DeviceStatusGet.ts +4 -1
- package/src/api/protocol-v2/DeviceUploadWallpaper.ts +4 -1
- package/src/api/protocol-v2/FilesystemFormat.ts +4 -1
- package/src/api/protocol-v2/FilesystemPermissionFix.ts +4 -1
- package/src/api/protocol-v2/Ping.ts +36 -2
- package/src/api/protocol-v2/ProtocolInfoRequest.ts +4 -1
- package/src/api/scdo/ScdoGetAddress.ts +0 -4
- package/src/api/scdo/ScdoSignMessage.ts +0 -4
- package/src/api/scdo/ScdoSignTransaction.ts +0 -4
- package/src/api/solana/SolGetAddress.ts +4 -0
- package/src/api/solana/SolSignMessage.ts +4 -0
- package/src/api/solana/SolSignOffchainMessage.ts +4 -0
- package/src/api/solana/SolSignTransaction.ts +4 -0
- package/src/api/starcoin/StarcoinGetAddress.ts +4 -0
- package/src/api/starcoin/StarcoinGetPublicKey.ts +4 -0
- package/src/api/starcoin/StarcoinSignMessage.ts +4 -0
- package/src/api/starcoin/StarcoinSignTransaction.ts +4 -0
- package/src/api/starcoin/StarcoinVerifyMessage.ts +4 -0
- package/src/api/stellar/StellarGetAddress.ts +1 -10
- package/src/api/stellar/StellarSignTransaction.ts +1 -14
- package/src/api/sui/SuiGetAddress.ts +4 -0
- package/src/api/sui/SuiGetPublicKey.ts +4 -0
- package/src/api/sui/SuiSignMessage.ts +4 -0
- package/src/api/sui/SuiSignTransaction.ts +4 -0
- package/src/api/ton/TonGetAddress.ts +4 -0
- package/src/api/ton/TonSignData.ts +5 -1
- package/src/api/ton/TonSignMessage.ts +4 -0
- package/src/api/ton/TonSignProof.ts +4 -0
- package/src/api/tron/TronGetAddress.ts +4 -0
- package/src/api/tron/TronSignMessage.ts +15 -7
- package/src/api/tron/TronSignTransaction.ts +4 -0
- package/src/api/xrp/XrpGetAddress.ts +4 -0
- package/src/api/xrp/XrpSignTransaction.ts +5 -1
- package/src/core/index.ts +43 -24
- package/src/data/messages/messages-protocol-v2.json +33 -1
- package/src/device/Device.ts +60 -62
- package/src/device/DeviceCommands.ts +19 -0
- package/src/inject.ts +2 -0
- package/src/protocols/protocol-v2/unlockRetry.ts +20 -3
- package/src/protocols/protocol-v2/walletSession.ts +26 -8
- package/src/types/api/export.ts +2 -0
- package/src/types/api/index.ts +3 -0
- package/src/types/api/kaspaSignTransaction.ts +20 -2
- package/src/types/api/openWalletSession.ts +0 -19
- package/src/types/api/protocolV2.ts +10 -0
- package/src/types/device.ts +0 -1
- package/src/utils/deviceInfoUtils.ts +15 -6
- package/src/utils/deviceVersionUtils.ts +1 -1
- package/src/utils/index.ts +0 -1
- package/tsconfig.type-tests.json +8 -0
|
@@ -7,6 +7,10 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { SolanaSignUnsafeMessage as HardwareSolSignUnsafeMessage } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class SolSignMessage extends BaseMethod<HardwareSolSignUnsafeMessage> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.checkDeviceId = true;
|
|
12
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -7,6 +7,10 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { SolanaSignOffChainMessage as HardwareSolSignOffChainMessage } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class SolSignOffchainMessage extends BaseMethod<HardwareSolSignOffChainMessage> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.checkDeviceId = true;
|
|
12
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -8,6 +8,10 @@ import type { SolanaSignTransactionParams, SolanaSignedTx } from '../../types';
|
|
|
8
8
|
import type { SolanaSignTx as HardwareSolanaSignTx } from '@onekeyfe/hd-transport';
|
|
9
9
|
|
|
10
10
|
export default class SolSignTransaction extends BaseMethod<HardwareSolanaSignTx[]> {
|
|
11
|
+
getSupportedProtocols() {
|
|
12
|
+
return ['V1', 'V2'] as const;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
hasBundle = false;
|
|
12
16
|
|
|
13
17
|
init() {
|
|
@@ -7,6 +7,10 @@ import type { StarcoinGetAddress as HardwareStarcoinGetAddress } from '@onekeyfe
|
|
|
7
7
|
import type { StarcoinAddress, StarcoinGetAddressParams } from '../../types/api/starcoinGetAddress';
|
|
8
8
|
|
|
9
9
|
export default class StarcoinGetAddress extends BaseMethod<HardwareStarcoinGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -10,6 +10,10 @@ import type {
|
|
|
10
10
|
} from '../../types/api/starcoinGetPublicKey';
|
|
11
11
|
|
|
12
12
|
export default class StarcoinGetPublicKey extends BaseMethod<HardwareStarcoinGetPublicKey[]> {
|
|
13
|
+
getSupportedProtocols() {
|
|
14
|
+
return ['V1', 'V2'] as const;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
hasBundle = false;
|
|
14
18
|
|
|
15
19
|
init() {
|
|
@@ -7,6 +7,10 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { StarcoinSignMessage as HardwareStarcoinSignMessage } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class StarcoinSignMessage extends BaseMethod<HardwareStarcoinSignMessage> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.checkDeviceId = true;
|
|
12
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -7,6 +7,10 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { StarcoinSignTx } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class StarcoinSignTransaction extends BaseMethod<StarcoinSignTx> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.checkDeviceId = true;
|
|
12
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -6,6 +6,10 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
6
6
|
import type { StarcoinVerifyMessage as HardwareStarcoinVerifyMessage } from '@onekeyfe/hd-transport';
|
|
7
7
|
|
|
8
8
|
export default class EVMSignMessage extends BaseMethod<HardwareStarcoinVerifyMessage> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
init() {
|
|
10
14
|
this.checkDeviceId = true;
|
|
11
15
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -4,7 +4,7 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
5
5
|
|
|
6
6
|
import type { StellarGetAddress as HardwareStellarGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
-
import type {
|
|
7
|
+
import type { StellarAddress, StellarGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -38,15 +38,6 @@ export default class StellarGetAddress extends BaseMethod<HardwareStellarGetAddr
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
getVersionRange(): DeviceFirmwareRange {
|
|
42
|
-
return {
|
|
43
|
-
pro2: {
|
|
44
|
-
min: '0.0.0',
|
|
45
|
-
unsupported: true,
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
41
|
async run() {
|
|
51
42
|
const responses: StellarAddress[] = [];
|
|
52
43
|
|
|
@@ -10,11 +10,7 @@ import type {
|
|
|
10
10
|
StellarSignTx as HardwareStellarSignTx,
|
|
11
11
|
StellarSignedTx,
|
|
12
12
|
} from '@onekeyfe/hd-transport';
|
|
13
|
-
import type {
|
|
14
|
-
DeviceFirmwareRange,
|
|
15
|
-
StellarOperation,
|
|
16
|
-
StellarSignTransactionParams,
|
|
17
|
-
} from '../../types';
|
|
13
|
+
import type { StellarOperation, StellarSignTransactionParams } from '../../types';
|
|
18
14
|
|
|
19
15
|
// Firmware accepts up to 1024 bytes per chunk; 1 byte = 2 hex chars
|
|
20
16
|
const SOROBAN_CHUNK_BYTES = 1024;
|
|
@@ -32,15 +28,6 @@ export default class StellarSignTransaction extends BaseMethod<HardwareStellarSi
|
|
|
32
28
|
extSent: number;
|
|
33
29
|
};
|
|
34
30
|
|
|
35
|
-
getVersionRange(): DeviceFirmwareRange {
|
|
36
|
-
return {
|
|
37
|
-
pro2: {
|
|
38
|
-
min: '0.0.0',
|
|
39
|
-
unsupported: true,
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
31
|
parseOperation = (op: StellarOperation) => {
|
|
45
32
|
switch (op.type) {
|
|
46
33
|
case 'createAccount':
|
|
@@ -9,6 +9,10 @@ import type { SuiAddress, SuiGetAddressParams } from '../../types';
|
|
|
9
9
|
import type { SuiGetAddress as HardwareSuiGetAddress } from '@onekeyfe/hd-transport';
|
|
10
10
|
|
|
11
11
|
export default class SuiGetAddress extends BaseMethod<HardwareSuiGetAddress[]> {
|
|
12
|
+
getSupportedProtocols() {
|
|
13
|
+
return ['V1', 'V2'] as const;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
hasBundle = false;
|
|
13
17
|
|
|
14
18
|
shouldConfirm = false;
|
|
@@ -7,6 +7,10 @@ import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
|
7
7
|
import type { SuiGetAddressParams, SuiPublicKey } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class SuiGetPublicKey extends BaseMethod<any> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -7,6 +7,10 @@ import { stripHexPrefix } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { SuiSignMessage as HardwareSuiSignMessage } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class SuiSignMessage extends BaseMethod<HardwareSuiSignMessage> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.checkDeviceId = true;
|
|
12
16
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -15,6 +15,10 @@ import type { TypedCall, TypedResponseMessage } from '../../device/DeviceCommand
|
|
|
15
15
|
type SuiSignTx = Omit<HardwareSuiSignTx, 'data_initial_chunk' | 'data_length'> & HardwareSuiSignTx;
|
|
16
16
|
|
|
17
17
|
export default class SuiSignTransaction extends BaseMethod<SuiSignTx> {
|
|
18
|
+
getSupportedProtocols() {
|
|
19
|
+
return ['V1', 'V2'] as const;
|
|
20
|
+
}
|
|
21
|
+
|
|
18
22
|
init() {
|
|
19
23
|
this.checkDeviceId = true;
|
|
20
24
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -7,6 +7,10 @@ import type { TonGetAddress as HardwareTonGetAddress } from '@onekeyfe/hd-transp
|
|
|
7
7
|
import type { TonAddress, TonGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class TonGetAddress extends BaseMethod<HardwareTonGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
shouldConfirm = false;
|
|
@@ -8,9 +8,13 @@ import type { TonSignData as HardwareTonSignData } from '@onekeyfe/hd-transport'
|
|
|
8
8
|
import type { TonSignDataParams } from '../../types/api/tonSignData';
|
|
9
9
|
|
|
10
10
|
export default class TonSignData extends BaseMethod<HardwareTonSignData> {
|
|
11
|
+
getSupportedProtocols() {
|
|
12
|
+
return ['V1', 'V2'] as const;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
init() {
|
|
12
16
|
// Keep strict-check off for touch/classic1s until their firmware release
|
|
13
|
-
// versions are decided.
|
|
17
|
+
// versions are decided. Protocol V2 support is declared independently.
|
|
14
18
|
this.strictCheckDeviceSupport = false;
|
|
15
19
|
this.checkDeviceId = true;
|
|
16
20
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -19,6 +19,10 @@ import type {
|
|
|
19
19
|
import type { TonSignedMessageResponse } from '../../types/api/tonSignMessage';
|
|
20
20
|
|
|
21
21
|
export default class TonSignMessage extends BaseMethod<HardwareTonSignMessage> {
|
|
22
|
+
getSupportedProtocols() {
|
|
23
|
+
return ['V1', 'V2'] as const;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
initState: string | null = null;
|
|
23
27
|
|
|
24
28
|
init() {
|
|
@@ -7,6 +7,10 @@ import type { TonSignProof as HardwareTonSignProof } from '@onekeyfe/hd-transpor
|
|
|
7
7
|
import type { TonSignProofParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class TonSignProof extends BaseMethod<HardwareTonSignProof> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.strictCheckDeviceSupport = true;
|
|
12
16
|
this.checkDeviceId = true;
|
|
@@ -7,6 +7,10 @@ import type { TronGetAddress as HardwareTronGetAddress } from '@onekeyfe/hd-tran
|
|
|
7
7
|
import type { TronAddress, TronGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class TronGetAddress extends BaseMethod<HardwareTronGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -6,11 +6,16 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
6
6
|
import { BaseMethod } from '../BaseMethod';
|
|
7
7
|
import { validateParams } from '../helpers/paramsValidator';
|
|
8
8
|
import { stripHexPrefix } from '../helpers/hexUtils';
|
|
9
|
-
import { getFirmwareType } from '../../utils';
|
|
10
9
|
|
|
11
10
|
import type { TronSignMessage as HardwareTronSignMessage } from '@onekeyfe/hd-transport';
|
|
12
11
|
|
|
13
12
|
export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage> {
|
|
13
|
+
private isLegacyMessageType = false;
|
|
14
|
+
|
|
15
|
+
getSupportedProtocols() {
|
|
16
|
+
return ['V1', 'V2'] as const;
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
init() {
|
|
15
20
|
this.checkDeviceId = true;
|
|
16
21
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -26,12 +31,8 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
26
31
|
const { path, messageHex } = this.payload;
|
|
27
32
|
const addressN = validatePath(path, 3);
|
|
28
33
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
'TronSignMessage',
|
|
32
|
-
getFirmwareType(this.device?.features)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
34
|
+
this.isLegacyMessageType =
|
|
35
|
+
this.payload.messageType === 'V1' || this.payload.messageType == null;
|
|
35
36
|
|
|
36
37
|
const messageType = TronMessageType.V2;
|
|
37
38
|
|
|
@@ -72,6 +73,13 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
async run() {
|
|
76
|
+
if (this.isLegacyMessageType) {
|
|
77
|
+
throw createDeviceNotSupportMethodError(
|
|
78
|
+
'TronSignMessage',
|
|
79
|
+
this.device.getCurrentFirmwareType()
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
this.checkFeatureVersionLimit(
|
|
76
84
|
() => this.params.message_type === TronMessageType.V2,
|
|
77
85
|
() => this.getMessageV2VersionRange(),
|
|
@@ -11,6 +11,10 @@ import type { TronSignTx } from '@onekeyfe/hd-transport';
|
|
|
11
11
|
import type { DeviceFirmwareRange } from '../../types';
|
|
12
12
|
|
|
13
13
|
export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
14
|
+
getSupportedProtocols() {
|
|
15
|
+
return ['V1', 'V2'] as const;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
parseTx(tx: TronTransaction, address_n: number[]): TronSignTx {
|
|
15
19
|
const unSignTx = {
|
|
16
20
|
address_n,
|
|
@@ -6,6 +6,10 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
6
6
|
import type { XrpSignTransactionParams } from '../../types/api/xrpSignTransaction';
|
|
7
7
|
|
|
8
8
|
export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
hasBundle = false;
|
|
10
14
|
|
|
11
15
|
init() {
|
|
@@ -30,7 +34,7 @@ export default class XrpGetAddress extends BaseMethod<XrpSignTransactionParams>
|
|
|
30
34
|
{ name: 'payment', type: 'object' },
|
|
31
35
|
]);
|
|
32
36
|
validateParams(transaction.payment, [
|
|
33
|
-
{ name: 'amount', type: '
|
|
37
|
+
{ name: 'amount', type: 'number', required: true },
|
|
34
38
|
{ name: 'destination', type: 'string', required: true },
|
|
35
39
|
{ name: 'destinationTag', type: 'number' },
|
|
36
40
|
]);
|
package/src/core/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import EventEmitter from 'events';
|
|
3
|
+
import { TRANSPORT_EVENT } from '@onekeyfe/hd-transport';
|
|
3
4
|
import {
|
|
4
5
|
ERRORS,
|
|
5
6
|
ERROR_CODES_REQUIRE_RELEASE,
|
|
@@ -14,14 +15,7 @@ import {
|
|
|
14
15
|
createNewFirmwareUnReleaseHardwareError,
|
|
15
16
|
} from '@onekeyfe/hd-shared';
|
|
16
17
|
|
|
17
|
-
import {
|
|
18
|
-
LoggerNames,
|
|
19
|
-
enableLog,
|
|
20
|
-
getLogger,
|
|
21
|
-
isMethodVersionRangeUnsupported,
|
|
22
|
-
setLoggerPostMessage,
|
|
23
|
-
wait,
|
|
24
|
-
} from '../utils';
|
|
18
|
+
import { LoggerNames, enableLog, getLogger, setLoggerPostMessage, wait } from '../utils';
|
|
25
19
|
import {
|
|
26
20
|
findDefectiveBatchDevice,
|
|
27
21
|
getDefectiveDeviceInfo,
|
|
@@ -70,7 +64,11 @@ import type { CoreMessage, IFrameCallMessage, UiPromise, UiPromiseResponse } fro
|
|
|
70
64
|
import type { DeviceEvents, InitOptions, RunOptions } from '../device/Device';
|
|
71
65
|
import type { SdkTracingContext } from '../utils/tracing';
|
|
72
66
|
import type { Deferred } from '@onekeyfe/hd-shared';
|
|
73
|
-
import type {
|
|
67
|
+
import type {
|
|
68
|
+
LowlevelTransportSharedPlugin,
|
|
69
|
+
OneKeyDeviceInfo,
|
|
70
|
+
TransportDeviceDisconnectEvent,
|
|
71
|
+
} from '@onekeyfe/hd-transport';
|
|
74
72
|
import type { BaseMethod } from '../api/BaseMethod';
|
|
75
73
|
|
|
76
74
|
const Log = getLogger(LoggerNames.Core);
|
|
@@ -173,8 +171,6 @@ export const callAPI = async (context: CoreContext, message: CoreMessage) => {
|
|
|
173
171
|
return createResponseMessage(method?.responseID ?? message.id, false, { error });
|
|
174
172
|
}
|
|
175
173
|
|
|
176
|
-
DevicePool.emitter.on(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
177
|
-
|
|
178
174
|
if (!method.useDevice) {
|
|
179
175
|
updateMethodRequestContext(method, { status: 'running' });
|
|
180
176
|
try {
|
|
@@ -236,7 +232,6 @@ const handlePreWarmSignal = async (
|
|
|
236
232
|
method: BaseMethod
|
|
237
233
|
): Promise<any> => {
|
|
238
234
|
const createAckResponse = () => {
|
|
239
|
-
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
240
235
|
completeMethodRequestContext(method);
|
|
241
236
|
method.dispose();
|
|
242
237
|
return createResponseMessage(method.responseID, true, true);
|
|
@@ -438,11 +433,9 @@ const onCallDevice = async (
|
|
|
438
433
|
await waitForPendingPromise(getPrePendingCallPromise, setPrePendingCallPromise);
|
|
439
434
|
|
|
440
435
|
const inner = async (): Promise<void> => {
|
|
441
|
-
//
|
|
442
|
-
// methods
|
|
443
|
-
|
|
444
|
-
throw createDeviceNotSupportMethodError(method.name, device.getCurrentFirmwareType());
|
|
445
|
-
}
|
|
436
|
+
// Protocol is established from an active device response during acquire/initialize.
|
|
437
|
+
// Reject unsupported methods before any method-specific device command is sent.
|
|
438
|
+
method.assertProtocolSupported(device.getProtocol(), device.getCurrentFirmwareType());
|
|
446
439
|
|
|
447
440
|
// check firmware version
|
|
448
441
|
const versionRange = device.getCurrentMethodVersionRange(
|
|
@@ -502,10 +495,6 @@ const onCallDevice = async (
|
|
|
502
495
|
}
|
|
503
496
|
}
|
|
504
497
|
|
|
505
|
-
if (isMethodVersionRangeUnsupported(versionRange)) {
|
|
506
|
-
throw createDeviceNotSupportMethodError(method.name, deviceFirmwareType);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
498
|
if (versionRange) {
|
|
510
499
|
if (semver.valid(versionRange.min) && semver.lt(currentFirmwareVersion, versionRange.min)) {
|
|
511
500
|
if (newVersionStatus === 'none' || newVersionStatus === 'valid') {
|
|
@@ -874,8 +863,15 @@ function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown)
|
|
|
874
863
|
*/
|
|
875
864
|
async function connectDeviceForBle(method: BaseMethod, device: Device, retryCount = 0) {
|
|
876
865
|
try {
|
|
877
|
-
|
|
866
|
+
const shouldAcquire =
|
|
867
|
+
!device.hasDeviceAcquire() || !device.commands || device.commands.disposed;
|
|
868
|
+
if (shouldAcquire) {
|
|
869
|
+
await device.acquire(method.payload.connectProtocol);
|
|
870
|
+
}
|
|
878
871
|
if (method.payload?.onlyConnectBleDevice) {
|
|
872
|
+
if (shouldAcquire) {
|
|
873
|
+
DevicePool.emitter.emit(DEVICE.CONNECT, device);
|
|
874
|
+
}
|
|
879
875
|
return;
|
|
880
876
|
}
|
|
881
877
|
// Skip initialize if conditions are met
|
|
@@ -886,6 +882,9 @@ async function connectDeviceForBle(method: BaseMethod, device: Device, retryCoun
|
|
|
886
882
|
passphraseState: initOptions.passphraseState,
|
|
887
883
|
});
|
|
888
884
|
}
|
|
885
|
+
if (shouldAcquire) {
|
|
886
|
+
DevicePool.emitter.emit(DEVICE.CONNECT, device);
|
|
887
|
+
}
|
|
889
888
|
} catch (err) {
|
|
890
889
|
if (
|
|
891
890
|
(err.errorCode === HardwareErrorCode.BleTimeoutError ||
|
|
@@ -1186,8 +1185,6 @@ const cleanup = () => {
|
|
|
1186
1185
|
|
|
1187
1186
|
const removeDeviceListener = (device: Device) => {
|
|
1188
1187
|
device.removeAllListeners();
|
|
1189
|
-
DevicePool.emitter.removeAllListeners(DEVICE.CONNECT);
|
|
1190
|
-
// DevicePool.emitter.removeListener(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1191
1188
|
};
|
|
1192
1189
|
|
|
1193
1190
|
/**
|
|
@@ -1210,6 +1207,20 @@ const onDeviceDisconnectHandler = (device: Device) => {
|
|
|
1210
1207
|
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
|
|
1211
1208
|
};
|
|
1212
1209
|
|
|
1210
|
+
const onTransportDeviceDisconnectHandler = (event: TransportDeviceDisconnectEvent) => {
|
|
1211
|
+
const device =
|
|
1212
|
+
deviceCacheMap.get(event.connectId) ??
|
|
1213
|
+
DevicePool.devicesCache[event.connectId] ??
|
|
1214
|
+
DevicePool.getDeviceByPath(event.connectId);
|
|
1215
|
+
if (!device) {
|
|
1216
|
+
Log.debug('Ignoring transport disconnect for an unknown device:', event.connectId);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
device.markTransportDisconnected();
|
|
1221
|
+
DevicePool.emitter.emit(DEVICE.DISCONNECT, device);
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1213
1224
|
const onDevicePinHandler = async (...[device, type, callback]: DeviceEvents['pin']) => {
|
|
1214
1225
|
Log.log('request Input PIN');
|
|
1215
1226
|
// create ui promise
|
|
@@ -1528,7 +1539,15 @@ export const initCore = () => {
|
|
|
1528
1539
|
|
|
1529
1540
|
export const initConnector = () => {
|
|
1530
1541
|
_connector = new DeviceConnector();
|
|
1542
|
+
DevicePool.emitter.removeListener(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
1543
|
+
DevicePool.emitter.removeListener(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1544
|
+
DevicePool.emitter.removeListener(
|
|
1545
|
+
TRANSPORT_EVENT.DEVICE_DISCONNECT,
|
|
1546
|
+
onTransportDeviceDisconnectHandler
|
|
1547
|
+
);
|
|
1548
|
+
DevicePool.emitter.on(DEVICE.CONNECT, onDeviceConnectHandler);
|
|
1531
1549
|
DevicePool.emitter.on(DEVICE.DISCONNECT, onDeviceDisconnectHandler);
|
|
1550
|
+
DevicePool.emitter.on(TRANSPORT_EVENT.DEVICE_DISCONNECT, onTransportDeviceDisconnectHandler);
|
|
1532
1551
|
return _connector;
|
|
1533
1552
|
};
|
|
1534
1553
|
|
|
@@ -11506,6 +11506,33 @@
|
|
|
11506
11506
|
}
|
|
11507
11507
|
}
|
|
11508
11508
|
},
|
|
11509
|
+
"UiAnimationType": {
|
|
11510
|
+
"values": {
|
|
11511
|
+
"Unknown": 0,
|
|
11512
|
+
"Signing": 1
|
|
11513
|
+
}
|
|
11514
|
+
},
|
|
11515
|
+
"UiAnimationCommand": {
|
|
11516
|
+
"values": {
|
|
11517
|
+
"CommandUnknown": 0,
|
|
11518
|
+
"Start": 1,
|
|
11519
|
+
"Stop": 2,
|
|
11520
|
+
"Refresh": 3
|
|
11521
|
+
}
|
|
11522
|
+
},
|
|
11523
|
+
"UiAnimationRequest": {
|
|
11524
|
+
"fields": {
|
|
11525
|
+
"command": {
|
|
11526
|
+
"rule": "required",
|
|
11527
|
+
"type": "UiAnimationCommand",
|
|
11528
|
+
"id": 1
|
|
11529
|
+
},
|
|
11530
|
+
"type": {
|
|
11531
|
+
"type": "UiAnimationType",
|
|
11532
|
+
"id": 2
|
|
11533
|
+
}
|
|
11534
|
+
}
|
|
11535
|
+
},
|
|
11509
11536
|
"ViewAmount": {
|
|
11510
11537
|
"fields": {
|
|
11511
11538
|
"is_unlimited": {
|
|
@@ -12482,7 +12509,12 @@
|
|
|
12482
12509
|
}
|
|
12483
12510
|
},
|
|
12484
12511
|
"DeviceSessionAskPassphrase": {
|
|
12485
|
-
"fields": {
|
|
12512
|
+
"fields": {
|
|
12513
|
+
"passphrase": {
|
|
12514
|
+
"type": "string",
|
|
12515
|
+
"id": 1
|
|
12516
|
+
}
|
|
12517
|
+
}
|
|
12486
12518
|
},
|
|
12487
12519
|
"DeviceSessionAskPin_FailureSubCodes": {
|
|
12488
12520
|
"values": {
|