@onekeyfe/hd-transport 1.2.8 → 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__/babylon-context-hash.test.js +44 -0
- package/__tests__/protocol-v2-file-write-pipeline.test.js +478 -0
- package/__tests__/protocol-v2.test.js +3 -3
- package/__tests__/static-protobuf.test.js +436 -0
- package/__tests__/transport-log.test.js +176 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/index.d.ts +158 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +109280 -98
- package/dist/protocols/index.d.ts.map +1 -1
- package/dist/protocols/v2/session.d.ts +7 -1
- package/dist/protocols/v2/session.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 +72 -0
- package/dist/types/messages.d.ts.map +1 -1
- package/dist/types/transport.d.ts +6 -0
- package/dist/types/transport.d.ts.map +1 -1
- package/dist/utils/transportLog.d.ts.map +1 -1
- package/jest.config.js +3 -0
- package/messages-protocol-v2.json +152 -0
- package/package.json +6 -4
- package/scripts/protobuf-build.sh +37 -0
- package/scripts/protobuf-static-csp.js +103 -0
- package/scripts/protobuf-static.js +85 -0
- package/scripts/protobuf-types.js +1 -0
- package/src/constants.ts +10 -1
- package/src/index.ts +1 -0
- package/src/protocols/index.ts +10 -23
- package/src/protocols/v2/session.ts +326 -96
- 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 +97 -0
- package/src/types/transport.ts +25 -0
- package/src/utils/transportLog.ts +17 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocols/index.ts"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,qBAAqB,EAA+C,MAAM,cAAc,CAAC;AAElG,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,cAAc,CAAC;AAQhE,OAAO,EAGL,kBAAkB,EAClB,UAAU,EACX,MAAM,MAAM,CAAC;AAId,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,eAAO,MAAM,iCAAiC,QAAQ,CAAC;AAEvD,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAkGF,eAAO,MAAM,UAAU;;;;;;;;;;CAOtB,CAAC;AAEF,eAAO,MAAM,UAAU;;;0BAIC,iBAAiB,SAAS,UAAU;;;;;;;;;;yBAgB/C,iBAAiB,QACpB,MAAM,QACN,OAAO,MAAM,EAAE,OAAO,CAAC,YACpB,sBAAsB;yBAkBZ,iBAAiB,SAAS,UAAU;;;;;;;;;;;;;;;;;;;;;;CAqC1D,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProtocolV2FrameAssembler, concatUint8Arrays } from './frame-assembler';
|
|
2
2
|
import { ProtocolV2SequenceCursor } from './sequence-cursor';
|
|
3
3
|
import type { Root } from 'protobufjs/light';
|
|
4
|
-
import type { MessageFromOneKey, TransportWriteMetrics } from '../../types';
|
|
4
|
+
import type { MessageFromOneKey, ProtocolV2FileWritePipeline, TransportWriteMetrics } from '../../types';
|
|
5
5
|
export * from './errors';
|
|
6
6
|
export type ProtocolV2Schemas = {
|
|
7
7
|
protocolV1: Root;
|
|
@@ -42,6 +42,7 @@ export type ProtocolV2CallOptions = {
|
|
|
42
42
|
returnAfterWrite?: boolean;
|
|
43
43
|
onResponseAfterWrite?: (response: MessageFromOneKey) => void;
|
|
44
44
|
writeWithResponse?: boolean;
|
|
45
|
+
fileWritePipeline?: ProtocolV2FileWritePipeline;
|
|
45
46
|
};
|
|
46
47
|
export { concatUint8Arrays, ProtocolV2FrameAssembler };
|
|
47
48
|
export { ProtocolV2SequenceCursor };
|
|
@@ -66,7 +67,12 @@ export declare class ProtocolV2Session {
|
|
|
66
67
|
call(name: string, data: Record<string, unknown>, callOptions?: ProtocolV2CallOptions): Promise<MessageFromOneKey>;
|
|
67
68
|
sendFlowControl(name: string, data: Record<string, unknown>): Promise<MessageFromOneKey>;
|
|
68
69
|
private serializeWrite;
|
|
70
|
+
private reportWriteCompleted;
|
|
71
|
+
private createCallTimeoutError;
|
|
69
72
|
private executeCall;
|
|
73
|
+
private encodeRequestFrame;
|
|
74
|
+
private parseResponseFrame;
|
|
75
|
+
private executeFileWritePipeline;
|
|
70
76
|
}
|
|
71
77
|
export declare function probeProtocolV2({ call, timeoutMs, logger, logPrefix, onBeforeProbe, onProbeFailed, shouldRethrow, }: {
|
|
72
78
|
call: (name: string, data: Record<string, unknown>, options?: ProtocolV2CallOptions) => Promise<MessageFromOneKey>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/protocols/v2/session.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,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,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC3C,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC;CAC7C,oBAiCA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as protobuf from 'protobufjs/light';
|
|
2
|
-
export declare function parseConfigure(data: protobuf.INamespace): protobuf.Root;
|
|
2
|
+
export declare function parseConfigure(data: protobuf.INamespace | string): protobuf.Root;
|
|
3
3
|
export declare const createMessageFromName: (messages: protobuf.Root, name: string) => {
|
|
4
4
|
Message: protobuf.Type;
|
|
5
5
|
messageTypeId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/serialization/protobuf/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAS7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,MAAM,iBAKhE;AAED,eAAO,MAAM,qBAAqB,aAAc,SAAS,IAAI,QAAQ,MAAM;;;CAiB1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,aAAc,SAAS,IAAI,UAAU,MAAM;;;CAgB5E,CAAC"}
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -3416,6 +3416,23 @@ export declare enum CommandFlags {
|
|
|
3416
3416
|
Default = 0,
|
|
3417
3417
|
Factory_Only = 1
|
|
3418
3418
|
}
|
|
3419
|
+
export declare enum Enum_CanonicalBitcoinNetwork {
|
|
3420
|
+
BITCOIN_MAINNET = 0,
|
|
3421
|
+
BITCOIN_TESTNET = 1,
|
|
3422
|
+
BITCOIN_SIGNET = 2,
|
|
3423
|
+
BITCOIN_REGTEST = 3
|
|
3424
|
+
}
|
|
3425
|
+
export type CanonicalBitcoinNetwork = keyof typeof Enum_CanonicalBitcoinNetwork;
|
|
3426
|
+
export type BabylonDeriveContextHash = {
|
|
3427
|
+
address_n: number[];
|
|
3428
|
+
script_type: InputScriptType;
|
|
3429
|
+
app_name: string;
|
|
3430
|
+
context: string;
|
|
3431
|
+
network: CanonicalBitcoinNetwork;
|
|
3432
|
+
};
|
|
3433
|
+
export type BabylonDerivedContextHash = {
|
|
3434
|
+
secret: string;
|
|
3435
|
+
};
|
|
3419
3436
|
export type TextMemo = {
|
|
3420
3437
|
text: string;
|
|
3421
3438
|
};
|
|
@@ -3491,6 +3508,50 @@ export type UiAnimationRequest = {
|
|
|
3491
3508
|
command: UiAnimationCommand;
|
|
3492
3509
|
type?: UiAnimationType;
|
|
3493
3510
|
};
|
|
3511
|
+
export declare enum ZcashAddressType {
|
|
3512
|
+
UNIFIED_ORCHARD_P2PKH = 0,
|
|
3513
|
+
TRANSPARENT_P2PKH = 1,
|
|
3514
|
+
UNIFIED_ORCHARD = 2
|
|
3515
|
+
}
|
|
3516
|
+
export declare enum ZcashAddressScope {
|
|
3517
|
+
EXTERNAL = 0,
|
|
3518
|
+
INTERNAL = 1
|
|
3519
|
+
}
|
|
3520
|
+
export type ZcashGetAddress = {
|
|
3521
|
+
address_n: number[];
|
|
3522
|
+
show_display?: boolean;
|
|
3523
|
+
include_seed_fingerprint?: boolean;
|
|
3524
|
+
diversifier_index?: number;
|
|
3525
|
+
address_type?: ZcashAddressType;
|
|
3526
|
+
scope?: ZcashAddressScope;
|
|
3527
|
+
};
|
|
3528
|
+
export type ZcashAddress = {
|
|
3529
|
+
address: string;
|
|
3530
|
+
seed_fingerprint?: string;
|
|
3531
|
+
};
|
|
3532
|
+
export type ZcashGetFullViewingKey = {
|
|
3533
|
+
address_n: number[];
|
|
3534
|
+
};
|
|
3535
|
+
export type ZcashFullViewingKey = {
|
|
3536
|
+
ufvk: string;
|
|
3537
|
+
};
|
|
3538
|
+
export type ZcashSignPczt = {
|
|
3539
|
+
pczt_length: number;
|
|
3540
|
+
pczt_initial_chunk: string;
|
|
3541
|
+
};
|
|
3542
|
+
export type ZcashPcztChunkRequest = {
|
|
3543
|
+
chunk_length: number;
|
|
3544
|
+
};
|
|
3545
|
+
export type ZcashPcztChunkAck = {
|
|
3546
|
+
data_chunk: string;
|
|
3547
|
+
};
|
|
3548
|
+
export type ZcashSignedPczt = {
|
|
3549
|
+
pczt_length: number;
|
|
3550
|
+
pczt_initial_chunk: string;
|
|
3551
|
+
};
|
|
3552
|
+
export type ZcashSignedPcztChunkRequest = {
|
|
3553
|
+
chunk_length: number;
|
|
3554
|
+
};
|
|
3494
3555
|
export type experimental_message = {};
|
|
3495
3556
|
export type experimental_field = {};
|
|
3496
3557
|
export type ProtocolInfoRequest = {
|
|
@@ -4604,6 +4665,8 @@ export type MessageType = {
|
|
|
4604
4665
|
TronSignMessage: TronSignMessage;
|
|
4605
4666
|
TronMessageSignature: TronMessageSignature;
|
|
4606
4667
|
facotry: facotry;
|
|
4668
|
+
BabylonDeriveContextHash: BabylonDeriveContextHash;
|
|
4669
|
+
BabylonDerivedContextHash: BabylonDerivedContextHash;
|
|
4607
4670
|
TextMemo: TextMemo;
|
|
4608
4671
|
RefundMemo: RefundMemo;
|
|
4609
4672
|
CoinPurchaseMemo: CoinPurchaseMemo;
|
|
@@ -4619,6 +4682,15 @@ export type MessageType = {
|
|
|
4619
4682
|
UnlockPath: UnlockPath;
|
|
4620
4683
|
UnlockedPathRequest: UnlockedPathRequest;
|
|
4621
4684
|
UiAnimationRequest: UiAnimationRequest;
|
|
4685
|
+
ZcashGetAddress: ZcashGetAddress;
|
|
4686
|
+
ZcashAddress: ZcashAddress;
|
|
4687
|
+
ZcashGetFullViewingKey: ZcashGetFullViewingKey;
|
|
4688
|
+
ZcashFullViewingKey: ZcashFullViewingKey;
|
|
4689
|
+
ZcashSignPczt: ZcashSignPczt;
|
|
4690
|
+
ZcashPcztChunkRequest: ZcashPcztChunkRequest;
|
|
4691
|
+
ZcashPcztChunkAck: ZcashPcztChunkAck;
|
|
4692
|
+
ZcashSignedPczt: ZcashSignedPczt;
|
|
4693
|
+
ZcashSignedPcztChunkRequest: ZcashSignedPcztChunkRequest;
|
|
4622
4694
|
experimental_message: experimental_message;
|
|
4623
4695
|
experimental_field: experimental_field;
|
|
4624
4696
|
ProtocolInfoRequest: ProtocolInfoRequest;
|