@onekeyfe/hd-transport 1.2.0-alpha.17 → 1.2.0-alpha.19
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/dist/index.d.ts +128 -6
- package/dist/index.js +23 -1
- package/dist/serialization/protobuf/decode.d.ts.map +1 -1
- package/dist/types/messages.d.ts +94 -5
- package/dist/types/messages.d.ts.map +1 -1
- package/messages-protocol-v2.json +22 -13
- package/package.json +2 -2
- package/scripts/protobuf-patches/index.js +1 -0
- package/scripts/protobuf-types.js +3 -0
- package/src/serialization/protobuf/decode.ts +4 -1
- package/src/types/messages.ts +114 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-transport",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.19",
|
|
4
4
|
"description": "Transport layer abstractions and utilities for OneKey hardware SDK.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"long": "^4.0.0",
|
|
29
29
|
"protobufjs": "^6.11.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "4e79f6a400463f342285b9a761b6b84523f1d6b9"
|
|
32
32
|
}
|
|
@@ -70,7 +70,10 @@ function messageToJSON(Message: Message<Record<string, unknown>>, fields: Type['
|
|
|
70
70
|
}
|
|
71
71
|
// message type
|
|
72
72
|
else if (field.resolvedType!.fields) {
|
|
73
|
-
|
|
73
|
+
// [compatibility]: absent optional sub-messages are not own properties
|
|
74
|
+
// of the decoded instance, so value is undefined here; decode them to
|
|
75
|
+
// null, matching the optional primitive-field convention above.
|
|
76
|
+
res[key] = value == null ? null : messageToJSON(value, (field.resolvedType as Type).fields);
|
|
74
77
|
} else {
|
|
75
78
|
throw new Error(`case not handled: ${key}`);
|
|
76
79
|
}
|
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;
|
|
@@ -4621,6 +4719,7 @@ export enum ViewSignLayout {
|
|
|
4621
4719
|
LayoutFinalConfirm = 2,
|
|
4622
4720
|
Layout7702 = 3,
|
|
4623
4721
|
LayoutFlat = 4,
|
|
4722
|
+
LayoutEthApprove = 5,
|
|
4624
4723
|
}
|
|
4625
4724
|
|
|
4626
4725
|
// ViewSignPage
|
|
@@ -4639,6 +4738,9 @@ export type ViewVerifyPage = {
|
|
|
4639
4738
|
title: string;
|
|
4640
4739
|
address: string;
|
|
4641
4740
|
path: string;
|
|
4741
|
+
network?: string;
|
|
4742
|
+
derive_type?: string;
|
|
4743
|
+
value_key?: number;
|
|
4642
4744
|
};
|
|
4643
4745
|
|
|
4644
4746
|
// ProtocolInfoRequest
|
|
@@ -4681,7 +4783,6 @@ export type DeviceSettings = {
|
|
|
4681
4783
|
bt_enable?: boolean;
|
|
4682
4784
|
language?: string;
|
|
4683
4785
|
wallpaper_path?: string;
|
|
4684
|
-
passphrase_enable?: boolean;
|
|
4685
4786
|
brightness?: number;
|
|
4686
4787
|
autolock_delay_ms?: number;
|
|
4687
4788
|
autoshutdown_delay_ms?: number;
|
|
@@ -4690,10 +4791,10 @@ export type DeviceSettings = {
|
|
|
4690
4791
|
haptic_feedback?: boolean;
|
|
4691
4792
|
device_name_display_enabled?: boolean;
|
|
4692
4793
|
airgap_mode?: boolean;
|
|
4693
|
-
fido_enabled?: boolean;
|
|
4694
|
-
experimental_features?: boolean;
|
|
4695
4794
|
usb_lock_enable?: boolean;
|
|
4696
4795
|
random_keypad?: boolean;
|
|
4796
|
+
passphrase_enable?: boolean;
|
|
4797
|
+
fido_enabled?: boolean;
|
|
4697
4798
|
};
|
|
4698
4799
|
|
|
4699
4800
|
// DeviceSettingsGet
|
|
@@ -5454,6 +5555,15 @@ export type MessageType = {
|
|
|
5454
5555
|
KaspaSignTx: KaspaSignTx;
|
|
5455
5556
|
KaspaTxInputRequest: KaspaTxInputRequest;
|
|
5456
5557
|
KaspaTxInputAck: KaspaTxInputAck;
|
|
5558
|
+
KaspaOutpoint: KaspaOutpoint;
|
|
5559
|
+
KaspaTxRequestSignature: KaspaTxRequestSignature;
|
|
5560
|
+
KaspaTxRequest: KaspaTxRequest;
|
|
5561
|
+
KaspaTxAckInput: KaspaTxAckInput;
|
|
5562
|
+
KaspaTxAckOutput: KaspaTxAckOutput;
|
|
5563
|
+
KaspaTxAckPayloadChunk: KaspaTxAckPayloadChunk;
|
|
5564
|
+
KaspaTxAckPrevMeta: KaspaTxAckPrevMeta;
|
|
5565
|
+
KaspaTxAckPrevInput: KaspaTxAckPrevInput;
|
|
5566
|
+
KaspaTxAckPrevOutput: KaspaTxAckPrevOutput;
|
|
5457
5567
|
KaspaSignedTx: KaspaSignedTx;
|
|
5458
5568
|
LnurlAuth: LnurlAuth;
|
|
5459
5569
|
LnurlAuthResp: LnurlAuthResp;
|