@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
|
@@ -5,7 +5,10 @@ import { getScriptType, isTaprootPath, serializedPath, validatePath } from '../h
|
|
|
5
5
|
import { BaseMethod } from '../BaseMethod';
|
|
6
6
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
7
7
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getBitcoinForkSupportedProtocols,
|
|
10
|
+
getBitcoinForkVersionRange,
|
|
11
|
+
} from './helpers/versionLimit';
|
|
9
12
|
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
10
13
|
import { createExtendedPublicKey, getVersionBytes } from './helpers/xpubUtils';
|
|
11
14
|
|
|
@@ -14,6 +17,10 @@ import type { BTCGetAddressParams } from '../../types/api/btcGetAddress';
|
|
|
14
17
|
import type { GetPublicKey } from '@onekeyfe/hd-transport';
|
|
15
18
|
|
|
16
19
|
export default class BTCGetPublicKey extends BaseMethod<GetPublicKey[]> {
|
|
20
|
+
getSupportedProtocols() {
|
|
21
|
+
return getBitcoinForkSupportedProtocols(this.params?.map(param => param.coin_name) ?? []);
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
hasBundle = false;
|
|
18
25
|
|
|
19
26
|
init() {
|
|
@@ -4,11 +4,18 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
4
4
|
import { validateParams } from '../helpers/paramsValidator';
|
|
5
5
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
6
6
|
import { getCoinAndScriptType } from './helpers/btcParamsUtils';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
getBitcoinForkSupportedProtocols,
|
|
9
|
+
getBitcoinForkVersionRange,
|
|
10
|
+
} from './helpers/versionLimit';
|
|
8
11
|
|
|
9
12
|
import type { SignMessage } from '@onekeyfe/hd-transport';
|
|
10
13
|
|
|
11
14
|
export default class BTCSignMessage extends BaseMethod<SignMessage> {
|
|
15
|
+
getSupportedProtocols() {
|
|
16
|
+
return getBitcoinForkSupportedProtocols([this.params?.coin_name]);
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
init() {
|
|
13
20
|
this.checkDeviceId = true;
|
|
14
21
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -9,6 +9,10 @@ import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
|
9
9
|
import type { SignPsbt } from '@onekeyfe/hd-transport';
|
|
10
10
|
|
|
11
11
|
export default class BTCSignPsbt extends BaseMethod<SignPsbt> {
|
|
12
|
+
getSupportedProtocols() {
|
|
13
|
+
return ['V1', 'V2'] as const;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
init() {
|
|
13
17
|
this.checkDeviceId = true;
|
|
14
18
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -7,7 +7,10 @@ import { validateParams } from '../helpers/paramsValidator';
|
|
|
7
7
|
import signtx from './helpers/signtx';
|
|
8
8
|
import signtxLegacy from './helpers/signtxLegacy';
|
|
9
9
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
getBitcoinForkSupportedProtocols,
|
|
12
|
+
getBitcoinForkVersionRange,
|
|
13
|
+
} from './helpers/versionLimit';
|
|
11
14
|
|
|
12
15
|
import type {
|
|
13
16
|
AccountAddresses,
|
|
@@ -26,6 +29,10 @@ type Params = {
|
|
|
26
29
|
coinName: string;
|
|
27
30
|
};
|
|
28
31
|
export default class BTCSignTransaction extends BaseMethod<Params> {
|
|
32
|
+
getSupportedProtocols() {
|
|
33
|
+
return getBitcoinForkSupportedProtocols([this.params?.coinName]);
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
init() {
|
|
30
37
|
this.checkDeviceId = true;
|
|
31
38
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -3,11 +3,18 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
3
3
|
import { validateParams } from '../helpers/paramsValidator';
|
|
4
4
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
5
5
|
import { getCoinInfo } from './helpers/btcParamsUtils';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
getBitcoinForkSupportedProtocols,
|
|
8
|
+
getBitcoinForkVersionRange,
|
|
9
|
+
} from './helpers/versionLimit';
|
|
7
10
|
|
|
8
11
|
import type { VerifyMessage } from '@onekeyfe/hd-transport';
|
|
9
12
|
|
|
10
13
|
export default class BTCVerifyMessage extends BaseMethod<VerifyMessage> {
|
|
14
|
+
getSupportedProtocols() {
|
|
15
|
+
return getBitcoinForkSupportedProtocols([this.params?.coin_name]);
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
init() {
|
|
12
19
|
this.checkDeviceId = true;
|
|
13
20
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DeviceFirmwareRange } from '../../../types';
|
|
2
|
+
import type { ProtocolType } from '@onekeyfe/hd-transport';
|
|
2
3
|
|
|
3
4
|
function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
4
5
|
for (let i = 0; i < coinNames.length; i++) {
|
|
@@ -13,10 +14,6 @@ function isCoinNameInList(coinName: string, coinNames: (string | undefined)[]) {
|
|
|
13
14
|
export function getBitcoinForkVersionRange(params: (string | undefined)[]): DeviceFirmwareRange {
|
|
14
15
|
if (isCoinNameInList('Neurai', params)) {
|
|
15
16
|
return {
|
|
16
|
-
pro2: {
|
|
17
|
-
min: '0.0.0',
|
|
18
|
-
unsupported: true,
|
|
19
|
-
},
|
|
20
17
|
model_mini: {
|
|
21
18
|
min: '3.7.0',
|
|
22
19
|
},
|
|
@@ -29,3 +26,9 @@ export function getBitcoinForkVersionRange(params: (string | undefined)[]): Devi
|
|
|
29
26
|
// No version restrictions for other coins
|
|
30
27
|
return {};
|
|
31
28
|
}
|
|
29
|
+
|
|
30
|
+
export function getBitcoinForkSupportedProtocols(
|
|
31
|
+
params: (string | undefined)[]
|
|
32
|
+
): readonly ProtocolType[] {
|
|
33
|
+
return isCoinNameInList('Neurai', params) ? ['V1'] : ['V1', 'V2'];
|
|
34
|
+
}
|
|
@@ -13,6 +13,10 @@ import type { CardanoAddress, CardanoGetAddressParams } from '../../types/api/ca
|
|
|
13
13
|
import type { CardanoGetAddressMethodParams } from '../../types';
|
|
14
14
|
|
|
15
15
|
export default class CardanoGetAddress extends BaseMethod<CardanoGetAddressParams[]> {
|
|
16
|
+
getSupportedProtocols() {
|
|
17
|
+
return ['V1', 'V2'] as const;
|
|
18
|
+
}
|
|
19
|
+
|
|
16
20
|
hasBundle?: boolean;
|
|
17
21
|
|
|
18
22
|
isCheck?: boolean;
|
|
@@ -7,6 +7,10 @@ import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
|
7
7
|
import type { CardanoPublicKey, CardanoPublicKeyParams } from '../../types/api/cardanoGetPublicKey';
|
|
8
8
|
|
|
9
9
|
export default class CardanoGetPublicKey extends BaseMethod<CardanoPublicKeyParams[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle?: boolean;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -7,6 +7,10 @@ import { validatePath } from '../helpers/pathUtils';
|
|
|
7
7
|
import type { CardanoSignMessageParams } from '../../types/api/cardanoSignMessage';
|
|
8
8
|
|
|
9
9
|
export default class CardanoSignMessage extends BaseMethod<CardanoSignMessageParams> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle?: boolean;
|
|
11
15
|
|
|
12
16
|
isCheck?: boolean;
|
|
@@ -7,6 +7,10 @@ import type { ConfluxGetAddress as HardwareConfluxGetAddress } from '@onekeyfe/h
|
|
|
7
7
|
import type { ConfluxAddress, ConfluxGetAddressParams } from '../../types/api/confluxGetAddress';
|
|
8
8
|
|
|
9
9
|
export default class ConfluxGetAddress extends BaseMethod<HardwareConfluxGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
checkDeviceId = true;
|
|
11
15
|
|
|
12
16
|
hasBundle = false;
|
|
@@ -7,6 +7,10 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { ConfluxSignMessage as HardwareConfluxSignMessage } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class ConfluxSignMessage extends BaseMethod<HardwareConfluxSignMessage> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
checkDeviceId = true;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -7,6 +7,10 @@ import { formatAnyHex } from '../helpers/hexUtils';
|
|
|
7
7
|
import type { ConfluxSignMessageCIP23 as HardwareConfluxSignMessageCIP23 } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class ConfluxSignMessageCIP23 extends BaseMethod<HardwareConfluxSignMessageCIP23> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
checkDeviceId = true;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -16,6 +16,10 @@ import type {
|
|
|
16
16
|
import type { ConfluxSignTx, ConfluxTxRequest } from '@onekeyfe/hd-transport';
|
|
17
17
|
|
|
18
18
|
export default class ConfluxSignTransaction extends BaseMethod {
|
|
19
|
+
getSupportedProtocols() {
|
|
20
|
+
return ['V1', 'V2'] as const;
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
checkDeviceId = true;
|
|
20
24
|
|
|
21
25
|
addressN: number[] = [];
|
|
@@ -37,7 +41,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
37
41
|
|
|
38
42
|
// check if transaction is valid
|
|
39
43
|
const schema: SchemaParam[] = [
|
|
40
|
-
{ name: 'to', type: '
|
|
44
|
+
{ name: 'to', type: 'hexString', required: true },
|
|
41
45
|
{ name: 'value', type: 'hexString', required: true },
|
|
42
46
|
{ name: 'gasLimit', type: 'hexString', required: true },
|
|
43
47
|
{ name: 'gasPrice', type: 'hexString', required: true },
|
|
@@ -50,10 +54,7 @@ export default class ConfluxSignTransaction extends BaseMethod {
|
|
|
50
54
|
|
|
51
55
|
validateParams(tx, schema);
|
|
52
56
|
|
|
53
|
-
this.formattedTx =
|
|
54
|
-
...formatAnyHex(tx),
|
|
55
|
-
to: tx.to,
|
|
56
|
-
};
|
|
57
|
+
this.formattedTx = formatAnyHex(tx);
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
processTxRequest = async (request: ConfluxTxRequest, data: string): Promise<ConfluxSignedTx> => {
|
|
@@ -6,6 +6,10 @@ import type { CosmosGetAddress as HardwareCosmosGetAddress } from '@onekeyfe/hd-
|
|
|
6
6
|
import type { CosmosAddress, CosmosGetAddressParams } from '../../types';
|
|
7
7
|
|
|
8
8
|
export default class CosmosGetAddress extends BaseMethod<HardwareCosmosGetAddress[]> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
hasBundle = false;
|
|
10
14
|
|
|
11
15
|
init() {
|
|
@@ -7,6 +7,10 @@ import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
|
7
7
|
import type { CosmosAddress, CosmosGetPublicKeyParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class CosmosGetPublicKey extends BaseMethod<any> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -9,6 +9,10 @@ import type { CosmosSignTx as HardwareCosmosSignTx } from '@onekeyfe/hd-transpor
|
|
|
9
9
|
import type { CosmosSignTransactionParams } from '../../types';
|
|
10
10
|
|
|
11
11
|
export default class CosmosSignTransaction extends BaseMethod<HardwareCosmosSignTx> {
|
|
12
|
+
getSupportedProtocols() {
|
|
13
|
+
return ['V1', 'V2'] as const;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
hasBundle = false;
|
|
13
17
|
|
|
14
18
|
init() {
|
|
@@ -3,6 +3,10 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
3
3
|
import type { Cancel } from '@onekeyfe/hd-transport';
|
|
4
4
|
|
|
5
5
|
export default class DeviceCancel extends BaseMethod<Cancel> {
|
|
6
|
+
getSupportedProtocols() {
|
|
7
|
+
return ['V1', 'V2'] as const;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
init() {
|
|
7
11
|
this.useDevicePassphraseState = false;
|
|
8
12
|
this.unlockPolicy = 'none';
|
|
@@ -7,6 +7,10 @@ import { invalidParameter } from '../helpers/filesystemValidation';
|
|
|
7
7
|
import type { ChangePin } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class DeviceChangePin extends BaseMethod<ChangePin> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
init() {
|
|
11
15
|
this.unlockPolicy = 'unlock-before-run';
|
|
12
16
|
this.useDevicePassphraseState = false;
|
|
@@ -3,6 +3,10 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
3
3
|
import type { LockDevice } from '@onekeyfe/hd-transport';
|
|
4
4
|
|
|
5
5
|
export default class DeviceLock extends BaseMethod<LockDevice> {
|
|
6
|
+
getSupportedProtocols() {
|
|
7
|
+
return ['V1', 'V2'] as const;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
init() {
|
|
7
11
|
this.useDevicePassphraseState = false;
|
|
8
12
|
this.unlockPolicy = 'none';
|
|
@@ -6,6 +6,10 @@ import type { RebootToBoardloaderParams } from '../../types/api/deviceRebootToBo
|
|
|
6
6
|
|
|
7
7
|
// Reboot BoardLoader
|
|
8
8
|
export default class DeviceRebootToBoardloader extends BaseMethod<RebootToBoardloaderParams> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
init() {
|
|
10
14
|
this.useDevicePassphraseState = false;
|
|
11
15
|
this.skipForceUpdateCheck = true;
|
|
@@ -6,6 +6,10 @@ import type { RebootToBootloader } from '@onekeyfe/hd-transport';
|
|
|
6
6
|
|
|
7
7
|
// Reboot BootLoader
|
|
8
8
|
export default class DeviceRebootToBootloader extends BaseMethod<RebootToBootloader> {
|
|
9
|
+
getSupportedProtocols() {
|
|
10
|
+
return ['V1', 'V2'] as const;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
init() {
|
|
10
14
|
this.useDevicePassphraseState = false;
|
|
11
15
|
this.skipForceUpdateCheck = true;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { BaseMethod } from '../BaseMethod';
|
|
2
2
|
|
|
3
3
|
export default class DeviceSupportFeatures extends BaseMethod {
|
|
4
|
+
getSupportedProtocols() {
|
|
5
|
+
return ['V1', 'V2'] as const;
|
|
6
|
+
}
|
|
7
|
+
|
|
4
8
|
init() {
|
|
5
9
|
this.useDevicePassphraseState = false;
|
|
6
10
|
this.skipForceUpdateCheck = true;
|
|
@@ -3,6 +3,10 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
3
3
|
import type { LockDevice } from '@onekeyfe/hd-transport';
|
|
4
4
|
|
|
5
5
|
export default class DeviceUnlock extends BaseMethod<LockDevice> {
|
|
6
|
+
getSupportedProtocols() {
|
|
7
|
+
return ['V1', 'V2'] as const;
|
|
8
|
+
}
|
|
9
|
+
|
|
6
10
|
init() {
|
|
7
11
|
this.useDevicePassphraseState = false;
|
|
8
12
|
this.unlockPolicy = 'none';
|
|
@@ -5,6 +5,10 @@ import { BaseMethod } from '../BaseMethod';
|
|
|
5
5
|
import type { WipeDevice } from '@onekeyfe/hd-transport';
|
|
6
6
|
|
|
7
7
|
export default class DeviceWipe extends BaseMethod<WipeDevice> {
|
|
8
|
+
getSupportedProtocols() {
|
|
9
|
+
return ['V1', 'V2'] as const;
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
init() {
|
|
9
13
|
this.unlockPolicy = 'unlock-before-run';
|
|
10
14
|
this.useDevicePassphraseState = false;
|
|
@@ -18,6 +18,10 @@ const parseInitOptions = (payload?: {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export default class PreInitialize extends BaseMethod {
|
|
21
|
+
getSupportedProtocols() {
|
|
22
|
+
return ['V1', 'V2'] as const;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
init() {
|
|
22
26
|
this.skipForceUpdateCheck = true;
|
|
23
27
|
this.useDevicePassphraseState = false;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createDeviceNotSupportMethodError } from '@onekeyfe/hd-shared';
|
|
2
|
-
|
|
3
1
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
2
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
5
3
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -49,10 +47,6 @@ export default class DnxGetAddress extends BaseMethod<HardwareDnxGetAddress[]> {
|
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
async run() {
|
|
52
|
-
if (this.device.isProtocolV2()) {
|
|
53
|
-
throw createDeviceNotSupportMethodError(this.name, this.device.getCurrentFirmwareType());
|
|
54
|
-
}
|
|
55
|
-
|
|
56
50
|
const responses: DnxAddress[] = [];
|
|
57
51
|
|
|
58
52
|
for (let i = 0; i < this.params.length; i++) {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createDeviceNotSupportMethodError } from '@onekeyfe/hd-shared';
|
|
2
|
-
|
|
3
1
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
2
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
5
3
|
import { BaseMethod } from '../BaseMethod';
|
|
@@ -118,10 +116,6 @@ export default class DnxSignTransaction extends BaseMethod<DnxSignTx> {
|
|
|
118
116
|
}
|
|
119
117
|
|
|
120
118
|
async run() {
|
|
121
|
-
if (this.device.isProtocolV2()) {
|
|
122
|
-
throw createDeviceNotSupportMethodError(this.name, this.device.getCurrentFirmwareType());
|
|
123
|
-
}
|
|
124
|
-
|
|
125
119
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
126
120
|
|
|
127
121
|
const res = await this.device.commands.typedCall('DnxSignTx', 'DnxInputRequest', {
|
|
@@ -10,6 +10,10 @@ import type { EVMAddress, EVMGetAddressParams } from '../../types';
|
|
|
10
10
|
import type { EthereumGetAddressOneKey } from '@onekeyfe/hd-transport';
|
|
11
11
|
|
|
12
12
|
export default class EvmGetAddress extends BaseMethod<EthereumGetAddressOneKey[]> {
|
|
13
|
+
getSupportedProtocols() {
|
|
14
|
+
return ['V1', 'V2'] as const;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
hasBundle = false;
|
|
14
18
|
|
|
15
19
|
init() {
|
|
@@ -11,6 +11,10 @@ import type { EVMGetPublicKeyParams, EVMPublicKey } from '../../types';
|
|
|
11
11
|
import type { EthereumGetPublicKey, EthereumGetPublicKeyOneKey } from '@onekeyfe/hd-transport';
|
|
12
12
|
|
|
13
13
|
export default class EVMGetPublicKey extends BaseMethod<EthereumGetPublicKeyOneKey[]> {
|
|
14
|
+
getSupportedProtocols() {
|
|
15
|
+
return ['V1', 'V2'] as const;
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
hasBundle = false;
|
|
15
19
|
|
|
16
20
|
confirmShowOnOneKey = false;
|
|
@@ -10,6 +10,10 @@ import signMessageLegacyV1 from './legacyV1/signMessage';
|
|
|
10
10
|
import type { EthereumSignMessageOneKey } from '@onekeyfe/hd-transport';
|
|
11
11
|
|
|
12
12
|
export default class EVMSignMessage extends BaseMethod<EthereumSignMessageOneKey> {
|
|
13
|
+
getSupportedProtocols() {
|
|
14
|
+
return ['V1', 'V2'] as const;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
init() {
|
|
14
18
|
this.checkDeviceId = true;
|
|
15
19
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -35,10 +35,6 @@ export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessage
|
|
|
35
35
|
|
|
36
36
|
getVersionRange(): DeviceFirmwareRange {
|
|
37
37
|
return {
|
|
38
|
-
pro2: {
|
|
39
|
-
min: '0.0.0',
|
|
40
|
-
unsupported: true,
|
|
41
|
-
},
|
|
42
38
|
model_mini: {
|
|
43
39
|
min: '2.1.9',
|
|
44
40
|
},
|
|
@@ -49,13 +45,7 @@ export default class EVMSignMessageEIP712 extends BaseMethod<EthereumSignMessage
|
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
async run() {
|
|
52
|
-
this.
|
|
53
|
-
() => true,
|
|
54
|
-
() => this.getVersionRange(),
|
|
55
|
-
{
|
|
56
|
-
strictCheckDeviceSupport: true,
|
|
57
|
-
}
|
|
58
|
-
);
|
|
48
|
+
this.assertProtocolSupported(this.device.getProtocol(), this.device.getCurrentFirmwareType());
|
|
59
49
|
|
|
60
50
|
const res = await this.device.commands.typedCall(
|
|
61
51
|
'EthereumSignMessageEIP712',
|
|
@@ -18,6 +18,10 @@ import type {
|
|
|
18
18
|
import type { SchemaParam } from '../helpers/paramsValidator';
|
|
19
19
|
|
|
20
20
|
export default class EVMSignTransaction extends BaseMethod {
|
|
21
|
+
getSupportedProtocols() {
|
|
22
|
+
return ['V1', 'V2'] as const;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
addressN: number[] = [];
|
|
22
26
|
|
|
23
27
|
isEIP1559 = false;
|
|
@@ -56,6 +56,10 @@ const MINI_MAX_ARRAY_TYPE_FIELDS = 24;
|
|
|
56
56
|
const MINI_MAX_ARRAY_ELEMENTS = 24;
|
|
57
57
|
|
|
58
58
|
export default class EVMSignTypedData extends BaseMethod<EVMSignTypedDataParams> {
|
|
59
|
+
getSupportedProtocols() {
|
|
60
|
+
return ['V1', 'V2'] as const;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
init() {
|
|
60
64
|
this.checkDeviceId = true;
|
|
61
65
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -9,6 +9,10 @@ import verifyMessage from './latest/verifyMessage';
|
|
|
9
9
|
import type { EthereumVerifyMessageOneKey } from '@onekeyfe/hd-transport';
|
|
10
10
|
|
|
11
11
|
export default class EVMSignMessage extends BaseMethod<EthereumVerifyMessageOneKey> {
|
|
12
|
+
getSupportedProtocols() {
|
|
13
|
+
return ['V1', 'V2'] as const;
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
init() {
|
|
13
17
|
this.checkDeviceId = true;
|
|
14
18
|
this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -7,6 +7,10 @@ import type { FilecoinGetAddress as HardwareFilecoinGetAddress } from '@onekeyfe
|
|
|
7
7
|
import type { FilecoinAddress, FilecoinGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class FilecoinGetAddress extends BaseMethod<HardwareFilecoinGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -7,6 +7,10 @@ import type { FilecoinSignTransactionParams } from '../../types';
|
|
|
7
7
|
import type { FilecoinSignTx as HardwareFilecoinSignTx } from '@onekeyfe/hd-transport';
|
|
8
8
|
|
|
9
9
|
export default class FilecoinSignTransaction extends BaseMethod<HardwareFilecoinSignTx> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|
|
@@ -111,7 +111,14 @@ const assertArtifactUrl = (value: unknown, label: string): string => {
|
|
|
111
111
|
{ firmwareUpdateCode: 'FirmwarePlanInvalid' }
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
let parsed: URL;
|
|
115
|
+
try {
|
|
116
|
+
parsed = new URL(raw);
|
|
117
|
+
} catch {
|
|
118
|
+
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, `${label} URL is invalid`, {
|
|
119
|
+
firmwareUpdateCode: 'FirmwarePlanInvalid',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
115
122
|
if (
|
|
116
123
|
parsed.protocol !== 'https:' ||
|
|
117
124
|
parsed.port !== '' ||
|
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as testInitializeDeviceDuration } from './test/TestInitializeDeviceDuration';
|
|
2
|
+
export { default as testProtocolV2Ping } from './protocol-v2/Ping';
|
|
2
3
|
export { default as preInitialize } from './device/PreInitialize';
|
|
3
4
|
|
|
4
5
|
export { default as searchDevices } from './SearchDevices';
|
|
@@ -7,6 +7,10 @@ import type { KaspaGetAddress as HardwareKaspaGetAddress } from '@onekeyfe/hd-tr
|
|
|
7
7
|
import type { KaspaAddress, KaspaGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class KaspaGetAddress extends BaseMethod<HardwareKaspaGetAddress[]> {
|
|
10
|
+
getSupportedProtocols() {
|
|
11
|
+
return ['V1', 'V2'] as const;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
hasBundle = false;
|
|
11
15
|
|
|
12
16
|
init() {
|