@onekeyfe/hd-transport 1.2.10-alpha.1 → 1.2.10-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/static-protobuf.test.js +436 -0
- package/__tests__/transport-log.test.js +10 -0
- package/dist/index.d.ts +47 -37
- package/dist/index.js +109040 -39
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/serialization/protobuf/messages.d.ts +1 -1
- package/dist/serialization/protobuf/messages.d.ts.map +1 -1
- package/dist/types/messages.d.ts +31 -25
- package/dist/types/messages.d.ts.map +1 -1
- package/jest.config.js +3 -0
- package/messages-protocol-v2.json +93 -78
- package/package.json +6 -4
- package/scripts/protobuf-build.sh +7 -0
- package/scripts/protobuf-static-csp.js +103 -0
- package/scripts/protobuf-static.js +85 -0
- package/src/protocols/index.ts +10 -23
- package/src/serialization/protobuf/generated/codecs.d.ts +3 -0
- package/src/serialization/protobuf/generated/codecs.js +108990 -0
- package/src/serialization/protobuf/legacy-protocol-info.json +16 -0
- package/src/serialization/protobuf/messages.ts +12 -6
- package/src/types/messages.ts +41 -31
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nested": {
|
|
3
|
+
"LegacyProtocolInfo": {
|
|
4
|
+
"fields": {
|
|
5
|
+
"version": { "rule": "required", "type": "uint32", "id": 1 },
|
|
6
|
+
"supported_messages": {
|
|
7
|
+
"rule": "repeated",
|
|
8
|
+
"type": "uint32",
|
|
9
|
+
"id": 2,
|
|
10
|
+
"options": { "packed": false }
|
|
11
|
+
},
|
|
12
|
+
"protobuf_definition": { "type": "string", "id": 3 }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as protobuf from 'protobufjs/light';
|
|
2
|
+
import Long from 'long';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { installStaticCodecs } from './generated/codecs';
|
|
5
|
+
|
|
6
|
+
// protobufjs optional dependency discovery uses Function, which CSP can disable.
|
|
7
|
+
protobuf.util.Long = Long;
|
|
8
|
+
protobuf.configure();
|
|
9
|
+
|
|
10
|
+
export function parseConfigure(data: protobuf.INamespace | string) {
|
|
11
|
+
const root = protobuf.Root.fromJSON(typeof data === 'string' ? JSON.parse(data) : data);
|
|
12
|
+
// Unrecognized custom schemas retain the existing reflection-based API.
|
|
13
|
+
installStaticCodecs(root);
|
|
14
|
+
return root;
|
|
9
15
|
}
|
|
10
16
|
|
|
11
17
|
export const createMessageFromName = (messages: protobuf.Root, name: string) => {
|
package/src/types/messages.ts
CHANGED
|
@@ -4680,6 +4680,43 @@ export type UiAnimationRequest = {
|
|
|
4680
4680
|
type?: UiAnimationType;
|
|
4681
4681
|
};
|
|
4682
4682
|
|
|
4683
|
+
export enum ZcashAddressType {
|
|
4684
|
+
UNIFIED_ORCHARD_P2PKH = 0,
|
|
4685
|
+
TRANSPARENT_P2PKH = 1,
|
|
4686
|
+
UNIFIED_ORCHARD = 2,
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
export enum ZcashAddressScope {
|
|
4690
|
+
EXTERNAL = 0,
|
|
4691
|
+
INTERNAL = 1,
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
// ZcashGetAddress
|
|
4695
|
+
export type ZcashGetAddress = {
|
|
4696
|
+
address_n: number[];
|
|
4697
|
+
show_display?: boolean;
|
|
4698
|
+
include_seed_fingerprint?: boolean;
|
|
4699
|
+
diversifier_index?: number;
|
|
4700
|
+
address_type?: ZcashAddressType;
|
|
4701
|
+
scope?: ZcashAddressScope;
|
|
4702
|
+
};
|
|
4703
|
+
|
|
4704
|
+
// ZcashAddress
|
|
4705
|
+
export type ZcashAddress = {
|
|
4706
|
+
address: string;
|
|
4707
|
+
seed_fingerprint?: string;
|
|
4708
|
+
};
|
|
4709
|
+
|
|
4710
|
+
// ZcashGetFullViewingKey
|
|
4711
|
+
export type ZcashGetFullViewingKey = {
|
|
4712
|
+
address_n: number[];
|
|
4713
|
+
};
|
|
4714
|
+
|
|
4715
|
+
// ZcashFullViewingKey
|
|
4716
|
+
export type ZcashFullViewingKey = {
|
|
4717
|
+
ufvk: string;
|
|
4718
|
+
};
|
|
4719
|
+
|
|
4683
4720
|
// ZcashSignPczt
|
|
4684
4721
|
export type ZcashSignPczt = {
|
|
4685
4722
|
pczt_length: number;
|
|
@@ -5401,35 +5438,6 @@ export type ViewVerifyPage = {
|
|
|
5401
5438
|
content?: ViewContentPreview;
|
|
5402
5439
|
};
|
|
5403
5440
|
|
|
5404
|
-
export enum ZcashAddressType {
|
|
5405
|
-
UNIFIED_ORCHARD_P2PKH = 0,
|
|
5406
|
-
TRANSPARENT_P2PKH = 1,
|
|
5407
|
-
UNIFIED_ORCHARD = 2,
|
|
5408
|
-
}
|
|
5409
|
-
|
|
5410
|
-
export enum ZcashAddressScope {
|
|
5411
|
-
EXTERNAL = 0,
|
|
5412
|
-
INTERNAL = 1,
|
|
5413
|
-
}
|
|
5414
|
-
|
|
5415
|
-
// ZcashGetAddress
|
|
5416
|
-
export type ZcashGetAddress = {
|
|
5417
|
-
address_n: number[];
|
|
5418
|
-
show_display?: boolean;
|
|
5419
|
-
include_seed_fingerprint?: boolean;
|
|
5420
|
-
include_ufvk?: boolean;
|
|
5421
|
-
diversifier_index?: number;
|
|
5422
|
-
address_type?: ZcashAddressType;
|
|
5423
|
-
scope?: ZcashAddressScope;
|
|
5424
|
-
};
|
|
5425
|
-
|
|
5426
|
-
// ZcashAddress
|
|
5427
|
-
export type ZcashAddress = {
|
|
5428
|
-
address: string;
|
|
5429
|
-
ufvk?: string;
|
|
5430
|
-
seed_fingerprint?: string;
|
|
5431
|
-
};
|
|
5432
|
-
|
|
5433
5441
|
export enum ProtocolV2FailureType {
|
|
5434
5442
|
Failure_InvalidMessage = 1,
|
|
5435
5443
|
Failure_UndefinedError = 2,
|
|
@@ -6044,6 +6052,10 @@ export type MessageType = {
|
|
|
6044
6052
|
UnlockPath: UnlockPath;
|
|
6045
6053
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
6046
6054
|
UiAnimationRequest: UiAnimationRequest;
|
|
6055
|
+
ZcashGetAddress: ZcashGetAddress;
|
|
6056
|
+
ZcashAddress: ZcashAddress;
|
|
6057
|
+
ZcashGetFullViewingKey: ZcashGetFullViewingKey;
|
|
6058
|
+
ZcashFullViewingKey: ZcashFullViewingKey;
|
|
6047
6059
|
ZcashSignPczt: ZcashSignPczt;
|
|
6048
6060
|
ZcashPcztChunkRequest: ZcashPcztChunkRequest;
|
|
6049
6061
|
ZcashPcztChunkAck: ZcashPcztChunkAck;
|
|
@@ -6125,8 +6137,6 @@ export type MessageType = {
|
|
|
6125
6137
|
ViewSignPage: ViewSignPage;
|
|
6126
6138
|
ViewWarningPage: ViewWarningPage;
|
|
6127
6139
|
ViewVerifyPage: ViewVerifyPage;
|
|
6128
|
-
ZcashGetAddress: ZcashGetAddress;
|
|
6129
|
-
ZcashAddress: ZcashAddress;
|
|
6130
6140
|
};
|
|
6131
6141
|
|
|
6132
6142
|
export type MessageKey = keyof MessageType;
|