@onekeyfe/hd-core 1.1.32 → 1.1.34-alpha.0
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.
|
@@ -454,6 +454,66 @@ describe('KaspaSignTransaction protocol negotiation', () => {
|
|
|
454
454
|
// Back to the current transaction after the previous one is streamed.
|
|
455
455
|
expect(mockTypedCall.mock.calls[4][0]).toBe('KaspaTxAckInput');
|
|
456
456
|
});
|
|
457
|
+
|
|
458
|
+
describe('previous-transaction id mismatch', () => {
|
|
459
|
+
const PREV_ID = 'aa'.repeat(32);
|
|
460
|
+
const withRefTxs = {
|
|
461
|
+
outputs: [{ satoshis: 100000, script: SCRIPT, address: ADDRESS }],
|
|
462
|
+
refTxs: [
|
|
463
|
+
{
|
|
464
|
+
txId: PREV_ID,
|
|
465
|
+
version: 0,
|
|
466
|
+
inputs: [],
|
|
467
|
+
outputs: [{ satoshis: '200000', script: SCRIPT }],
|
|
468
|
+
},
|
|
469
|
+
],
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
const streamThenReject = (error: unknown) =>
|
|
473
|
+
mockTypedCall
|
|
474
|
+
.mockResolvedValueOnce(
|
|
475
|
+
txRequest({ request_type: 'KASPA_TX_PREV_META', prev_tx_id: PREV_ID })
|
|
476
|
+
)
|
|
477
|
+
.mockRejectedValueOnce(error);
|
|
478
|
+
|
|
479
|
+
it('surfaces the device rejection under its own error code', async () => {
|
|
480
|
+
streamThenReject(
|
|
481
|
+
ERRORS.TypedError(
|
|
482
|
+
HardwareErrorCode.RuntimeError,
|
|
483
|
+
'Failure_ProcessError,Kaspa previous transaction id mismatch'
|
|
484
|
+
)
|
|
485
|
+
);
|
|
486
|
+
|
|
487
|
+
await expect(runMethod(withRefTxs)).rejects.toMatchObject({
|
|
488
|
+
errorCode: HardwareErrorCode.KaspaPrevTxIdMismatch,
|
|
489
|
+
});
|
|
490
|
+
// Never silently re-signs without refTxs.
|
|
491
|
+
expect(mockTypedCall).toHaveBeenCalledTimes(2);
|
|
492
|
+
});
|
|
493
|
+
|
|
494
|
+
it('leaves an unrelated device error untouched', async () => {
|
|
495
|
+
streamThenReject(
|
|
496
|
+
ERRORS.TypedError(
|
|
497
|
+
HardwareErrorCode.RuntimeError,
|
|
498
|
+
'Failure_ProcessError,some other device error'
|
|
499
|
+
)
|
|
500
|
+
);
|
|
501
|
+
|
|
502
|
+
await expect(runMethod(withRefTxs)).rejects.toMatchObject({
|
|
503
|
+
errorCode: HardwareErrorCode.RuntimeError,
|
|
504
|
+
});
|
|
505
|
+
expect(mockTypedCall).toHaveBeenCalledTimes(2);
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
it('leaves user cancellation untouched', async () => {
|
|
509
|
+
streamThenReject(ERRORS.TypedError(HardwareErrorCode.ActionCancelled));
|
|
510
|
+
|
|
511
|
+
await expect(runMethod(withRefTxs)).rejects.toMatchObject({
|
|
512
|
+
errorCode: HardwareErrorCode.ActionCancelled,
|
|
513
|
+
});
|
|
514
|
+
expect(mockTypedCall).toHaveBeenCalledTimes(2);
|
|
515
|
+
});
|
|
516
|
+
});
|
|
457
517
|
});
|
|
458
518
|
|
|
459
519
|
describe('KaspaSignTransaction wire encoding', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KaspaSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/kaspa/KaspaSignTransaction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAGV,0BAA0B,EAC1B,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAEV,cAAc,EAEd,SAAS,EACV,MAAM,wBAAwB,CAAC;AAQhC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IACtF,SAAS,UAAS;IAGlB,cAAc,UAAS;IAEvB,iBAAiB,UAAS;IAE1B,IAAI;IA4GJ,eAAe;;;;;;;;IAWf,uBAAuB;;;;;;;;IAejB,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,GAAG,oBAAoB,CAAC,eAAe,CAAC,EACxF,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,cAAc,EAAE,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC;IA0CtB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM;IA8ElF,YAAY,CAChB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,GACpD,OAAO,CAAC,cAAc,EAAE,CAAC;IAmGtB,GAAG;
|
|
1
|
+
{"version":3,"file":"KaspaSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/kaspa/KaspaSignTransaction.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,KAAK,EAGV,0BAA0B,EAC1B,cAAc,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAEV,cAAc,EAEd,SAAS,EACV,MAAM,wBAAwB,CAAC;AAQhC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU,CAAC,0BAA0B,CAAC;IACtF,SAAS,UAAS;IAGlB,cAAc,UAAS;IAEvB,iBAAiB,UAAS;IAE1B,IAAI;IA4GJ,eAAe;;;;;;;;IAWf,uBAAuB;;;;;;;;IAejB,gBAAgB,CACpB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,GAAG,oBAAoB,CAAC,eAAe,CAAC,EACxF,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,cAAc,EAAE,GAC1B,OAAO,CAAC,cAAc,EAAE,CAAC;IA0CtB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM;IA8ElF,YAAY,CAChB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,GACpD,OAAO,CAAC,cAAc,EAAE,CAAC;IAmGtB,GAAG;CAuGV"}
|
|
@@ -31,7 +31,7 @@ export declare const cancelDeviceInPrompt: (device: Device, expectResponse?: boo
|
|
|
31
31
|
};
|
|
32
32
|
} | {
|
|
33
33
|
success: boolean;
|
|
34
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
34
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
35
35
|
payload: {
|
|
36
36
|
message: string;
|
|
37
37
|
};
|
|
@@ -50,7 +50,7 @@ export declare const cancelDeviceWithInitialize: (device: Device) => Promise<{
|
|
|
50
50
|
};
|
|
51
51
|
} | {
|
|
52
52
|
success: boolean;
|
|
53
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
53
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
54
54
|
payload: {
|
|
55
55
|
message: string;
|
|
56
56
|
};
|
|
@@ -80,7 +80,7 @@ export declare class DeviceCommands {
|
|
|
80
80
|
};
|
|
81
81
|
} | {
|
|
82
82
|
success: boolean;
|
|
83
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
83
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
84
84
|
payload: {
|
|
85
85
|
message: string;
|
|
86
86
|
};
|
|
@@ -99,7 +99,7 @@ export declare class DeviceCommands {
|
|
|
99
99
|
};
|
|
100
100
|
} | {
|
|
101
101
|
success: boolean;
|
|
102
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
102
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
103
103
|
payload: {
|
|
104
104
|
message: string;
|
|
105
105
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3035,7 +3035,7 @@ declare class DeviceCommands {
|
|
|
3035
3035
|
};
|
|
3036
3036
|
} | {
|
|
3037
3037
|
success: boolean;
|
|
3038
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
3038
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
3039
3039
|
payload: {
|
|
3040
3040
|
message: string;
|
|
3041
3041
|
};
|
|
@@ -3054,7 +3054,7 @@ declare class DeviceCommands {
|
|
|
3054
3054
|
};
|
|
3055
3055
|
} | {
|
|
3056
3056
|
success: boolean;
|
|
3057
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 900 | 901 | 902;
|
|
3057
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 900 | 901 | 902;
|
|
3058
3058
|
payload: {
|
|
3059
3059
|
message: string;
|
|
3060
3060
|
};
|
package/dist/index.js
CHANGED
|
@@ -38949,7 +38949,16 @@ class KaspaSignTransaction extends BaseMethod {
|
|
|
38949
38949
|
if (!this.supportsStreaming) {
|
|
38950
38950
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, 'KaspaSignTransaction: device firmware uses the streaming protocol; every output requires address or addressN');
|
|
38951
38951
|
}
|
|
38952
|
-
|
|
38952
|
+
try {
|
|
38953
|
+
return yield this.signTxStream(typedCall, response);
|
|
38954
|
+
}
|
|
38955
|
+
catch (error) {
|
|
38956
|
+
if (error instanceof hdShared.HardwareError &&
|
|
38957
|
+
String(error.message).toLowerCase().includes('previous transaction id mismatch')) {
|
|
38958
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.KaspaPrevTxIdMismatch, String(error.message));
|
|
38959
|
+
}
|
|
38960
|
+
throw error;
|
|
38961
|
+
}
|
|
38953
38962
|
}
|
|
38954
38963
|
if (!this.supportsLegacy) {
|
|
38955
38964
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'KaspaSignTransaction: device chose the legacy protocol but the transaction is not legacy-signable');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.34-alpha.0",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "1.1.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.1.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.1.34-alpha.0",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.1.34-alpha.0",
|
|
30
30
|
"axios": "1.15.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"@types/w3c-web-usb": "^1.0.10",
|
|
45
45
|
"@types/web-bluetooth": "^0.0.21"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "178851631a3d06dd52c8dd9df24cbaaff7aa6390"
|
|
48
48
|
}
|
|
@@ -476,7 +476,18 @@ export default class KaspaSignTransaction extends BaseMethod<KaspaSignTransactio
|
|
|
476
476
|
'KaspaSignTransaction: device firmware uses the streaming protocol; every output requires address or addressN'
|
|
477
477
|
);
|
|
478
478
|
}
|
|
479
|
-
|
|
479
|
+
try {
|
|
480
|
+
return await this.signTxStream(typedCall, response);
|
|
481
|
+
} catch (error) {
|
|
482
|
+
// Device rejected our refTxs; the caller decides whether to sign without them.
|
|
483
|
+
if (
|
|
484
|
+
error instanceof HardwareError &&
|
|
485
|
+
String(error.message).toLowerCase().includes('previous transaction id mismatch')
|
|
486
|
+
) {
|
|
487
|
+
throw ERRORS.TypedError(HardwareErrorCode.KaspaPrevTxIdMismatch, String(error.message));
|
|
488
|
+
}
|
|
489
|
+
throw error;
|
|
490
|
+
}
|
|
480
491
|
}
|
|
481
492
|
|
|
482
493
|
// Legacy answer to a streaming-only packet: no prehash material exists.
|