@onekeyfe/hd-transport 1.2.0-alpha.16 → 1.2.0-alpha.18
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__/messages.test.js +37 -2
- package/__tests__/protocol-v2.test.js +6 -39
- package/dist/index.d.ts +216 -30
- package/dist/index.js +69 -43
- package/dist/protocols/v2/session.d.ts.map +1 -1
- package/dist/serialization/protobuf/decode.d.ts.map +1 -1
- package/dist/types/messages.d.ts +153 -23
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +3 -1
- package/dist/types/transport.d.ts.map +1 -1
- package/messages-protocol-v2.json +122 -23
- package/package.json +2 -2
- package/scripts/protobuf-build.sh +112 -32
- package/scripts/protobuf-patches/index.js +1 -0
- package/scripts/protobuf-types.js +3 -0
- package/src/protocols/v2/session.ts +12 -6
- package/src/serialization/protobuf/decode.ts +4 -1
- package/src/types/messages.ts +190 -24
- package/src/types/transport.ts +5 -1
package/src/types/messages.ts
CHANGED
|
@@ -2209,11 +2209,17 @@ export type KaspaAddress = {
|
|
|
2209
2209
|
// KaspaSignTx
|
|
2210
2210
|
export type KaspaSignTx = {
|
|
2211
2211
|
address_n: number[];
|
|
2212
|
-
raw_message
|
|
2212
|
+
raw_message?: string;
|
|
2213
2213
|
scheme?: string;
|
|
2214
2214
|
prefix?: string;
|
|
2215
2215
|
input_count?: number;
|
|
2216
2216
|
use_tweak?: boolean;
|
|
2217
|
+
output_count?: number;
|
|
2218
|
+
version?: number;
|
|
2219
|
+
lock_time?: number;
|
|
2220
|
+
subnetwork_id?: string;
|
|
2221
|
+
gas?: number;
|
|
2222
|
+
payload_length?: number;
|
|
2217
2223
|
};
|
|
2218
2224
|
|
|
2219
2225
|
// KaspaTxInputRequest
|
|
@@ -2228,6 +2234,98 @@ export type KaspaTxInputAck = {
|
|
|
2228
2234
|
raw_message: string;
|
|
2229
2235
|
};
|
|
2230
2236
|
|
|
2237
|
+
// KaspaOutpoint
|
|
2238
|
+
export type KaspaOutpoint = {
|
|
2239
|
+
tx_id: string;
|
|
2240
|
+
index: number;
|
|
2241
|
+
};
|
|
2242
|
+
|
|
2243
|
+
export enum Enum_KaspaInputScriptType {
|
|
2244
|
+
KASPA_SPEND_P2PK_SCHNORR = 0,
|
|
2245
|
+
KASPA_SPEND_P2PK_ECDSA = 1,
|
|
2246
|
+
}
|
|
2247
|
+
export type KaspaInputScriptType = keyof typeof Enum_KaspaInputScriptType;
|
|
2248
|
+
|
|
2249
|
+
export enum Enum_KaspaOutputScriptType {
|
|
2250
|
+
KASPA_PAYTOADDRESS = 0,
|
|
2251
|
+
KASPA_PAYTOCHANGE = 1,
|
|
2252
|
+
}
|
|
2253
|
+
export type KaspaOutputScriptType = keyof typeof Enum_KaspaOutputScriptType;
|
|
2254
|
+
|
|
2255
|
+
export enum Enum_KaspaRequestType {
|
|
2256
|
+
KASPA_TX_INPUT = 0,
|
|
2257
|
+
KASPA_TX_OUTPUT = 1,
|
|
2258
|
+
KASPA_TX_PAYLOAD = 2,
|
|
2259
|
+
KASPA_TX_FINISHED = 3,
|
|
2260
|
+
KASPA_TX_PREV_META = 4,
|
|
2261
|
+
}
|
|
2262
|
+
export type KaspaRequestType = keyof typeof Enum_KaspaRequestType;
|
|
2263
|
+
|
|
2264
|
+
// KaspaTxRequestSignature
|
|
2265
|
+
export type KaspaTxRequestSignature = {
|
|
2266
|
+
signature_index: number;
|
|
2267
|
+
signature: string;
|
|
2268
|
+
};
|
|
2269
|
+
|
|
2270
|
+
// KaspaTxRequest
|
|
2271
|
+
export type KaspaTxRequest = {
|
|
2272
|
+
request_type: KaspaRequestType;
|
|
2273
|
+
request_index?: number;
|
|
2274
|
+
signature?: KaspaTxRequestSignature;
|
|
2275
|
+
request_payload_length?: number;
|
|
2276
|
+
prev_tx_id?: string;
|
|
2277
|
+
};
|
|
2278
|
+
|
|
2279
|
+
// KaspaTxAckInput
|
|
2280
|
+
export type KaspaTxAckInput = {
|
|
2281
|
+
address_n: number[];
|
|
2282
|
+
previous_outpoint: KaspaOutpoint;
|
|
2283
|
+
amount: UintType;
|
|
2284
|
+
sequence: number;
|
|
2285
|
+
sig_op_count: number;
|
|
2286
|
+
script_type?: KaspaInputScriptType;
|
|
2287
|
+
use_tweak?: boolean;
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2290
|
+
// KaspaTxAckOutput
|
|
2291
|
+
export type KaspaTxAckOutput = {
|
|
2292
|
+
script_type?: KaspaOutputScriptType;
|
|
2293
|
+
amount: UintType;
|
|
2294
|
+
address_n: number[];
|
|
2295
|
+
address?: string;
|
|
2296
|
+
scheme?: string;
|
|
2297
|
+
use_tweak?: boolean;
|
|
2298
|
+
};
|
|
2299
|
+
|
|
2300
|
+
// KaspaTxAckPayloadChunk
|
|
2301
|
+
export type KaspaTxAckPayloadChunk = {
|
|
2302
|
+
payload_chunk: string;
|
|
2303
|
+
};
|
|
2304
|
+
|
|
2305
|
+
// KaspaTxAckPrevMeta
|
|
2306
|
+
export type KaspaTxAckPrevMeta = {
|
|
2307
|
+
version: number;
|
|
2308
|
+
input_count: number;
|
|
2309
|
+
output_count: number;
|
|
2310
|
+
lock_time: number;
|
|
2311
|
+
subnetwork_id: string;
|
|
2312
|
+
gas: number;
|
|
2313
|
+
payload_length: number;
|
|
2314
|
+
};
|
|
2315
|
+
|
|
2316
|
+
// KaspaTxAckPrevInput
|
|
2317
|
+
export type KaspaTxAckPrevInput = {
|
|
2318
|
+
previous_outpoint: KaspaOutpoint;
|
|
2319
|
+
sequence: number;
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
// KaspaTxAckPrevOutput
|
|
2323
|
+
export type KaspaTxAckPrevOutput = {
|
|
2324
|
+
amount: UintType;
|
|
2325
|
+
script_version: number;
|
|
2326
|
+
script_public_key: string;
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2231
2329
|
// KaspaSignedTx
|
|
2232
2330
|
export type KaspaSignedTx = {
|
|
2233
2331
|
signature: string;
|
|
@@ -2924,8 +3022,6 @@ export type UnLockDeviceResponse = {
|
|
|
2924
3022
|
// GetPassphraseState
|
|
2925
3023
|
export type GetPassphraseState = {
|
|
2926
3024
|
passphrase_state?: string;
|
|
2927
|
-
_only_main_pin?: boolean;
|
|
2928
|
-
allow_create_attach_pin?: boolean;
|
|
2929
3025
|
};
|
|
2930
3026
|
|
|
2931
3027
|
// PassphraseState
|
|
@@ -4950,9 +5046,33 @@ export type ProtocolV2DeviceInfo = {
|
|
|
4950
5046
|
status?: DeviceStatus;
|
|
4951
5047
|
};
|
|
4952
5048
|
|
|
4953
|
-
//
|
|
4954
|
-
export type
|
|
4955
|
-
session_id
|
|
5049
|
+
// DeviceSessionResume
|
|
5050
|
+
export type DeviceSessionResume = {
|
|
5051
|
+
session_id: string;
|
|
5052
|
+
};
|
|
5053
|
+
|
|
5054
|
+
// DeviceHostPassphrase
|
|
5055
|
+
export type DeviceHostPassphrase = {
|
|
5056
|
+
passphrase: string;
|
|
5057
|
+
};
|
|
5058
|
+
|
|
5059
|
+
// DevicePassphraseOnDevice
|
|
5060
|
+
export type DevicePassphraseOnDevice = {};
|
|
5061
|
+
|
|
5062
|
+
// DeviceAttachPinOnDevice
|
|
5063
|
+
export type DeviceAttachPinOnDevice = {};
|
|
5064
|
+
|
|
5065
|
+
// DeviceWalletSelect
|
|
5066
|
+
export type DeviceWalletSelect = {
|
|
5067
|
+
host_passphrase?: DeviceHostPassphrase;
|
|
5068
|
+
passphrase_on_device?: DevicePassphraseOnDevice;
|
|
5069
|
+
attach_pin_on_device?: DeviceAttachPinOnDevice;
|
|
5070
|
+
};
|
|
5071
|
+
|
|
5072
|
+
// DeviceSessionOpen
|
|
5073
|
+
export type DeviceSessionOpen = {
|
|
5074
|
+
resume?: DeviceSessionResume;
|
|
5075
|
+
select?: DeviceWalletSelect;
|
|
4956
5076
|
};
|
|
4957
5077
|
|
|
4958
5078
|
// DeviceSession
|
|
@@ -4982,30 +5102,61 @@ export type DeviceStatus = {
|
|
|
4982
5102
|
// DeviceStatusGet
|
|
4983
5103
|
export type DeviceStatusGet = {};
|
|
4984
5104
|
|
|
4985
|
-
export enum
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
5105
|
+
export enum DevOnboardingStep {
|
|
5106
|
+
DEV_ONBOARDING_STEP_UNKNOWN = 0,
|
|
5107
|
+
DEV_ONBOARDING_STEP_CHECKING = 1,
|
|
5108
|
+
DEV_ONBOARDING_STEP_PERSONALIZATION = 2,
|
|
5109
|
+
DEV_ONBOARDING_STEP_PIN = 3,
|
|
5110
|
+
DEV_ONBOARDING_STEP_SETUP = 4,
|
|
5111
|
+
DEV_ONBOARDING_STEP_DONE = 5,
|
|
5112
|
+
}
|
|
5113
|
+
|
|
5114
|
+
export enum DevOnboardingPhase {
|
|
5115
|
+
DEV_ONBOARDING_PHASE_UNKNOWN = 0,
|
|
5116
|
+
DEV_ONBOARDING_PHASE_SAFETY_CHECK = 1,
|
|
5117
|
+
DEV_ONBOARDING_PHASE_PIN_SETUP = 2,
|
|
5118
|
+
DEV_ONBOARDING_PHASE_FINGERPRINT_SETUP = 3,
|
|
5119
|
+
DEV_ONBOARDING_PHASE_SETUP_CHOICE = 4,
|
|
5120
|
+
DEV_ONBOARDING_PHASE_WALLET_CREATE_START = 5,
|
|
5121
|
+
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_VIEW = 6,
|
|
5122
|
+
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_CONFIRM = 7,
|
|
5123
|
+
DEV_ONBOARDING_PHASE_RESTORE_METHOD_CHOICE = 8,
|
|
5124
|
+
DEV_ONBOARDING_PHASE_RECOVERY_PHRASE_RESTORE = 9,
|
|
5125
|
+
DEV_ONBOARDING_PHASE_SEEDCARD_RESTORE = 10,
|
|
5126
|
+
DEV_ONBOARDING_PHASE_WALLET_READY = 11,
|
|
5127
|
+
DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP_PROMPT = 12,
|
|
5128
|
+
DEV_ONBOARDING_PHASE_SEEDCARD_BACKUP = 13,
|
|
5129
|
+
}
|
|
5130
|
+
|
|
5131
|
+
export enum DevOnboardingSetupKind {
|
|
5132
|
+
DEV_ONBOARDING_SETUP_KIND_UNKNOWN = 0,
|
|
5133
|
+
DEV_ONBOARDING_SETUP_KIND_CHOICE = 1,
|
|
5134
|
+
DEV_ONBOARDING_SETUP_KIND_CREATE = 2,
|
|
5135
|
+
DEV_ONBOARDING_SETUP_KIND_RESTORE = 3,
|
|
4999
5136
|
}
|
|
5000
5137
|
|
|
5138
|
+
export enum DevOnboardingSetupMethod {
|
|
5139
|
+
DEV_ONBOARDING_SETUP_METHOD_UNKNOWN = 0,
|
|
5140
|
+
DEV_ONBOARDING_SETUP_METHOD_RECOVERY_PHRASE = 1,
|
|
5141
|
+
DEV_ONBOARDING_SETUP_METHOD_SEEDCARD = 2,
|
|
5142
|
+
}
|
|
5143
|
+
|
|
5144
|
+
// DevOnboardingSetupStatus
|
|
5145
|
+
export type DevOnboardingSetupStatus = {
|
|
5146
|
+
kind?: DevOnboardingSetupKind;
|
|
5147
|
+
method?: DevOnboardingSetupMethod;
|
|
5148
|
+
};
|
|
5149
|
+
|
|
5001
5150
|
// DevGetOnboardingStatus
|
|
5002
5151
|
export type DevGetOnboardingStatus = {};
|
|
5003
5152
|
|
|
5004
5153
|
// DevOnboardingStatus
|
|
5005
5154
|
export type DevOnboardingStatus = {
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5155
|
+
step?: DevOnboardingStep;
|
|
5156
|
+
phase?: DevOnboardingPhase;
|
|
5157
|
+
setup?: DevOnboardingSetupStatus;
|
|
5158
|
+
pin_set?: boolean;
|
|
5159
|
+
wallet_initialized?: boolean;
|
|
5009
5160
|
};
|
|
5010
5161
|
|
|
5011
5162
|
// FilesystemPermissionFix
|
|
@@ -5401,6 +5552,15 @@ export type MessageType = {
|
|
|
5401
5552
|
KaspaSignTx: KaspaSignTx;
|
|
5402
5553
|
KaspaTxInputRequest: KaspaTxInputRequest;
|
|
5403
5554
|
KaspaTxInputAck: KaspaTxInputAck;
|
|
5555
|
+
KaspaOutpoint: KaspaOutpoint;
|
|
5556
|
+
KaspaTxRequestSignature: KaspaTxRequestSignature;
|
|
5557
|
+
KaspaTxRequest: KaspaTxRequest;
|
|
5558
|
+
KaspaTxAckInput: KaspaTxAckInput;
|
|
5559
|
+
KaspaTxAckOutput: KaspaTxAckOutput;
|
|
5560
|
+
KaspaTxAckPayloadChunk: KaspaTxAckPayloadChunk;
|
|
5561
|
+
KaspaTxAckPrevMeta: KaspaTxAckPrevMeta;
|
|
5562
|
+
KaspaTxAckPrevInput: KaspaTxAckPrevInput;
|
|
5563
|
+
KaspaTxAckPrevOutput: KaspaTxAckPrevOutput;
|
|
5404
5564
|
KaspaSignedTx: KaspaSignedTx;
|
|
5405
5565
|
LnurlAuth: LnurlAuth;
|
|
5406
5566
|
LnurlAuthResp: LnurlAuthResp;
|
|
@@ -5742,11 +5902,17 @@ export type MessageType = {
|
|
|
5742
5902
|
DeviceInfoTargets: DeviceInfoTargets;
|
|
5743
5903
|
DeviceInfoTypes: DeviceInfoTypes;
|
|
5744
5904
|
DeviceInfoGet: DeviceInfoGet;
|
|
5745
|
-
|
|
5905
|
+
DeviceSessionResume: DeviceSessionResume;
|
|
5906
|
+
DeviceHostPassphrase: DeviceHostPassphrase;
|
|
5907
|
+
DevicePassphraseOnDevice: DevicePassphraseOnDevice;
|
|
5908
|
+
DeviceAttachPinOnDevice: DeviceAttachPinOnDevice;
|
|
5909
|
+
DeviceWalletSelect: DeviceWalletSelect;
|
|
5910
|
+
DeviceSessionOpen: DeviceSessionOpen;
|
|
5746
5911
|
DeviceSession: DeviceSession;
|
|
5747
5912
|
DeviceSessionAskPin: DeviceSessionAskPin;
|
|
5748
5913
|
DeviceStatus: DeviceStatus;
|
|
5749
5914
|
DeviceStatusGet: DeviceStatusGet;
|
|
5915
|
+
DevOnboardingSetupStatus: DevOnboardingSetupStatus;
|
|
5750
5916
|
DevGetOnboardingStatus: DevGetOnboardingStatus;
|
|
5751
5917
|
DevOnboardingStatus: DevOnboardingStatus;
|
|
5752
5918
|
FilesystemPermissionFix: FilesystemPermissionFix;
|
package/src/types/transport.ts
CHANGED
|
@@ -105,7 +105,11 @@ export type Transport = {
|
|
|
105
105
|
export type LowLevelDevice = OneKeyDeviceInfoBase & { id: string; name: string };
|
|
106
106
|
export type LowlevelTransportSharedPlugin = {
|
|
107
107
|
enumerate: () => Promise<LowLevelDevice[]>;
|
|
108
|
-
send: (
|
|
108
|
+
send: (
|
|
109
|
+
uuid: string,
|
|
110
|
+
data: string,
|
|
111
|
+
options?: { withoutResponse?: boolean }
|
|
112
|
+
) => Promise<void>;
|
|
109
113
|
receive: (uuid?: string) => Promise<string>;
|
|
110
114
|
connect: (uuid: string) => Promise<void>;
|
|
111
115
|
disconnect: (uuid: string) => Promise<void>;
|