@onekeyfe/hd-core 1.1.19-alpha.2 → 1.1.19-alpha.4
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/api/btc/helpers/btcParamsUtils.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotGetAddress.d.ts +2 -2
- package/dist/api/polkadot/PolkadotGetAddress.d.ts.map +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts +1 -1
- package/dist/api/polkadot/PolkadotSignTransaction.d.ts.map +1 -1
- package/dist/api/polkadot/networks.d.ts +7 -1
- package/dist/api/polkadot/networks.d.ts.map +1 -1
- package/dist/api/tron/TronGetAddress.d.ts +2 -2
- package/dist/api/tron/TronGetAddress.d.ts.map +1 -1
- package/dist/api/tron/TronSignMessage.d.ts +4 -1
- package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
- package/dist/api/tron/TronSignTransaction.d.ts +3 -3
- package/dist/api/tron/TronSignTransaction.d.ts.map +1 -1
- package/dist/api/xrp/XrpGetAddress.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +50 -26
- package/dist/types/api/polkadotSignTransaction.d.ts +2 -1
- package/dist/types/api/polkadotSignTransaction.d.ts.map +1 -1
- package/package.json +6 -8
- package/src/api/btc/helpers/btcParamsUtils.ts +1 -0
- package/src/api/polkadot/PolkadotGetAddress.ts +5 -5
- package/src/api/polkadot/PolkadotSignTransaction.ts +8 -5
- package/src/api/polkadot/networks.ts +16 -0
- package/src/api/tron/TronGetAddress.ts +3 -2
- package/src/api/tron/TronSignMessage.ts +7 -4
- package/src/api/tron/TronSignTransaction.ts +14 -3
- package/src/api/xrp/XrpGetAddress.ts +0 -19
- package/src/core/index.ts +9 -6
- package/src/data/messages/messages.json +4 -0
- package/src/types/api/polkadotSignTransaction.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"btcParamsUtils.d.ts","sourceRoot":"","sources":["../../../../src/api/btc/helpers/btcParamsUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"btcParamsUtils.d.ts","sourceRoot":"","sources":["../../../../src/api/btc/helpers/btcParamsUtils.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,WAAW,SAAU,MAAM,EAAE,GAAG,SAAS,QAAQ,MAAM,GAAG,SAAS,gBA6B/E,CAAC;AAEF,eAAO,MAAM,oBAAoB,SACzB,MAAM,EAAE,QACR,MAAM,GAAG,SAAS,aACb,OAAO;;;CAkBnB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PolkadotGetAddress as HardwarePolkadotGetAddress } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import {
|
|
2
|
+
import type { PolkadotGetAddress as HardwarePolkadotGetAddress } from '@onekeyfe/hd-transport';
|
|
3
|
+
import type { PolkadotAddress } from '../../types';
|
|
4
4
|
export default class PolkadotGetAddress extends BaseMethod<HardwarePolkadotGetAddress[]> {
|
|
5
5
|
hasBundle: boolean;
|
|
6
6
|
init(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolkadotGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/PolkadotGetAddress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolkadotGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/PolkadotGetAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,KAAK,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;AAE7E,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,0BAA0B,EAAE,CAAC;IACtF,SAAS,UAAS;IAElB,IAAI;IAkCJ,eAAe;;;;;;;;IAKT,GAAG;CAgCV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PolkadotSignTx as HardwarePolkadotSignTx } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import type { PolkadotSignTx as HardwarePolkadotSignTx } from '@onekeyfe/hd-transport';
|
|
3
3
|
export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadotSignTx> {
|
|
4
4
|
hasBundle: boolean;
|
|
5
5
|
init(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolkadotSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/PolkadotSignTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PolkadotSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/PolkadotSignTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,OAAO,KAAK,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrF,SAAS,UAAS;IAElB,IAAI;IAwBJ,eAAe;IAIT,GAAG;;;;CAYV"}
|
|
@@ -5,7 +5,12 @@ declare enum Networks {
|
|
|
5
5
|
Kusama = "kusama",
|
|
6
6
|
Astar = "astar",
|
|
7
7
|
JoyStream = "joystream",
|
|
8
|
-
Manta = "manta"
|
|
8
|
+
Manta = "manta",
|
|
9
|
+
Hydration = "hydration",
|
|
10
|
+
Bifrost = "bifrost",
|
|
11
|
+
BifrostKusama = "bifrost-ksm",
|
|
12
|
+
PolkadotAssetHub = "polkadot-assethub",
|
|
13
|
+
KusamaAssetHub = "kusama-assethub"
|
|
9
14
|
}
|
|
10
15
|
export default Networks;
|
|
11
16
|
export declare function getPolkadotVersionRange(network: string): DeviceFirmwareRange;
|
|
@@ -17,4 +22,5 @@ export declare function getPolkadotVersionRangeWithBundle(networks: string[]): D
|
|
|
17
22
|
min: string;
|
|
18
23
|
};
|
|
19
24
|
};
|
|
25
|
+
export declare function parseNetwork(network: string): string;
|
|
20
26
|
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/networks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,aAAK,QAAQ;IACX,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,KAAK,UAAU;
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../../../src/api/polkadot/networks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,aAAK,QAAQ;IACX,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,aAAa,gBAAgB;IAC7B,gBAAgB,sBAAsB;IACtC,cAAc,oBAAoB;CACnC;AA+BD,eAAe,QAAQ,CAAC;AAExB,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,uBAEtD;AAED,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE;;;;;;;EAQnE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAS3C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TronGetAddress as HardwareTronGetAddress } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import {
|
|
2
|
+
import type { TronGetAddress as HardwareTronGetAddress } from '@onekeyfe/hd-transport';
|
|
3
|
+
import type { TronAddress } from '../../types';
|
|
4
4
|
export default class TronGetAddress extends BaseMethod<HardwareTronGetAddress[]> {
|
|
5
5
|
hasBundle: boolean;
|
|
6
6
|
init(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronGetAddress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TronGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronGetAddress.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,KAAK,EAAwB,WAAW,EAAE,MAAM,aAAa,CAAC;AAErE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,sBAAsB,EAAE,CAAC;IAC9E,SAAS,UAAS;IAElB,IAAI;IA6BJ,eAAe;;;;;IAQT,GAAG;CA0BV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TronSignMessage as HardwareTronSignMessage } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { BaseMethod } from '../BaseMethod';
|
|
2
|
+
import type { TronSignMessage as HardwareTronSignMessage } from '@onekeyfe/hd-transport';
|
|
3
3
|
export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage> {
|
|
4
4
|
init(): void;
|
|
5
5
|
getVersionRange(): {
|
|
@@ -11,6 +11,9 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
11
11
|
pro: {
|
|
12
12
|
min: string;
|
|
13
13
|
};
|
|
14
|
+
touch: {
|
|
15
|
+
min: string;
|
|
16
|
+
};
|
|
14
17
|
classic1s: {
|
|
15
18
|
min: string;
|
|
16
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignMessage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TronSignMessage.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignMessage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,eAAe,IAAI,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAC9E,IAAI;IA+BJ,eAAe;;;;;IAQf,wBAAwB;;;;;;;;;;;IAclB,GAAG;CAmBV"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TronSignTx } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { BaseMethod } from '../BaseMethod';
|
|
3
|
-
import { TronTransaction } from '../../types/api/tronSignTransaction';
|
|
4
|
-
import {
|
|
2
|
+
import type { TronTransaction } from '../../types/api/tronSignTransaction';
|
|
3
|
+
import type { TronSignTx } from '@onekeyfe/hd-transport';
|
|
4
|
+
import type { DeviceFirmwareRange } from '../../types';
|
|
5
5
|
export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
6
6
|
parseTx(tx: TronTransaction, address_n: number[]): TronSignTx;
|
|
7
7
|
init(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TronSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TronSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/api/tron/TronSignTransaction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,UAAU,CAAC,UAAU,CAAC;IACrE,OAAO,CAAC,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,UAAU;IA6G7D,IAAI;IAyBJ,eAAe;;;;;IAQf,0BAA0B,IAAI,mBAAmB;IAcjD,uCAAuC;IASvC,6CAA6C,IAAI,mBAAmB;IAcpE,sCAAsC;IAWhC,GAAG;CAUV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"XrpGetAddress.d.ts","sourceRoot":"","sources":["../../../src/api/xrp/XrpGetAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAU,CACnD;IACE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACvB,EAAE,CACJ;IACC,SAAS,UAAS;IAElB,aAAa,UAAS;IAEtB,IAAI;IA+BJ,eAAe;;;;;IAQT,GAAG;CAuCV"}
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAsClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EAEV,6BAA6B,EAE9B,MAAM,wBAAwB,CAAC;AAKhC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AA8D7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAuEvE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAsClC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAiB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAmD,MAAM,WAAW,CAAC;AAI9F,OAAO,KAAK,EAEV,6BAA6B,EAE9B,MAAM,wBAAwB,CAAC;AAKhC,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;AA8D7D,eAAO,MAAM,OAAO,YAAmB,WAAW,WAAW,WAAW,iBAuEvE,CAAC;AAipBF,eAAO,MAAM,MAAM,YAAa,WAAW,cAAc,MAAM,SAkF9D,CAAC;AAsEF,eAAO,MAAM,qBAAqB,gFAejC,CAAC;AAyFF,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,YAAY;IAC5C,OAAO,CAAC,cAAc,CAAoB;IAE1C,SAAgB,aAAa,EAAE,MAAM,CAAC;IAEtC,OAAO,CAAC,YAAY,CAAsB;IAG1C,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,iBAAiB,CAAoB;;IAS7C,OAAO,CAAC,cAAc;IAoBhB,aAAa,CAAC,OAAO,EAAE,WAAW;IA0DxC,OAAO;CAMR;AAED,eAAO,MAAM,QAAQ,YAGpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAIzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAoBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1810,6 +1810,7 @@ type PolkadotSignedTx = {
|
|
|
1810
1810
|
type PolkadotSignTransactionParams = {
|
|
1811
1811
|
path: string | number[];
|
|
1812
1812
|
network: string;
|
|
1813
|
+
prefix: number;
|
|
1813
1814
|
rawTx?: string;
|
|
1814
1815
|
};
|
|
1815
1816
|
declare function polkadotSignTransaction(connectId: string, deviceId: string, params: CommonParams & PolkadotSignTransactionParams): Response<PolkadotSignedTx>;
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,6 @@ var blake2s = require('@noble/hashes/blake2s');
|
|
|
14
14
|
var sha256 = require('@noble/hashes/sha256');
|
|
15
15
|
var JSZip = require('jszip');
|
|
16
16
|
var sha3 = require('@noble/hashes/sha3');
|
|
17
|
-
var rippleKeypairs = require('ripple-keypairs');
|
|
18
17
|
var blake2b = require('@noble/hashes/blake2b');
|
|
19
18
|
var buffer = require('buffer');
|
|
20
19
|
|
|
@@ -11099,6 +11098,10 @@ var nested$1 = {
|
|
|
11099
11098
|
rule: "required",
|
|
11100
11099
|
type: "string",
|
|
11101
11100
|
id: 3
|
|
11101
|
+
},
|
|
11102
|
+
prefix: {
|
|
11103
|
+
type: "uint32",
|
|
11104
|
+
id: 4
|
|
11102
11105
|
}
|
|
11103
11106
|
}
|
|
11104
11107
|
},
|
|
@@ -34485,6 +34488,9 @@ class TronSignMessage extends BaseMethod {
|
|
|
34485
34488
|
pro: {
|
|
34486
34489
|
min: '4.16.0',
|
|
34487
34490
|
},
|
|
34491
|
+
touch: {
|
|
34492
|
+
min: '4.12.0',
|
|
34493
|
+
},
|
|
34488
34494
|
classic1s: {
|
|
34489
34495
|
min: '3.13.0',
|
|
34490
34496
|
},
|
|
@@ -34631,6 +34637,9 @@ class TronSignTransaction extends BaseMethod {
|
|
|
34631
34637
|
pro: {
|
|
34632
34638
|
min: '4.13.0',
|
|
34633
34639
|
},
|
|
34640
|
+
touch: {
|
|
34641
|
+
min: '4.12.0',
|
|
34642
|
+
},
|
|
34634
34643
|
model_classic1s: {
|
|
34635
34644
|
min: '3.12.0',
|
|
34636
34645
|
},
|
|
@@ -34646,6 +34655,12 @@ class TronSignTransaction extends BaseMethod {
|
|
|
34646
34655
|
pro: {
|
|
34647
34656
|
min: '4.15.0',
|
|
34648
34657
|
},
|
|
34658
|
+
touch: {
|
|
34659
|
+
min: '4.12.0',
|
|
34660
|
+
},
|
|
34661
|
+
model_classic1s: {
|
|
34662
|
+
min: '3.13.0',
|
|
34663
|
+
},
|
|
34649
34664
|
};
|
|
34650
34665
|
}
|
|
34651
34666
|
checkSupportDelegateContractLockPeriod() {
|
|
@@ -35340,21 +35355,8 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
35340
35355
|
};
|
|
35341
35356
|
}
|
|
35342
35357
|
run() {
|
|
35343
|
-
var _a, _b, _c, _d
|
|
35358
|
+
var _a, _b, _c, _d;
|
|
35344
35359
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35345
|
-
if (this.hasBundle && supportBatchPublicKey((_a = this.device) === null || _a === void 0 ? void 0 : _a.features) && !this.shouldConfirm) {
|
|
35346
|
-
const res = yield batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
35347
|
-
const result = res.public_keys.map((publicKey, index) => ({
|
|
35348
|
-
path: serializedPath(this.params[index].address_n),
|
|
35349
|
-
address: rippleKeypairs.deriveAddress(publicKey),
|
|
35350
|
-
publicKey,
|
|
35351
|
-
pub: publicKey,
|
|
35352
|
-
}));
|
|
35353
|
-
validateResult(result, ['address', 'publicKey'], {
|
|
35354
|
-
expectedLength: this.params.length,
|
|
35355
|
-
});
|
|
35356
|
-
return Promise.resolve(result);
|
|
35357
|
-
}
|
|
35358
35360
|
const responses = [];
|
|
35359
35361
|
for (let i = 0; i < this.params.length; i++) {
|
|
35360
35362
|
const param = this.params[i];
|
|
@@ -35368,8 +35370,8 @@ class XrpGetAddress$1 extends BaseMethod {
|
|
|
35368
35370
|
responses.push({
|
|
35369
35371
|
path,
|
|
35370
35372
|
address,
|
|
35371
|
-
publicKey: (
|
|
35372
|
-
pub: (
|
|
35373
|
+
publicKey: (_b = (_a = publicKey.message) === null || _a === void 0 ? void 0 : _a.public_keys) === null || _b === void 0 ? void 0 : _b[0],
|
|
35374
|
+
pub: (_d = (_c = publicKey.message) === null || _c === void 0 ? void 0 : _c.public_keys) === null || _d === void 0 ? void 0 : _d[0],
|
|
35373
35375
|
});
|
|
35374
35376
|
this.postPreviousAddressMessage({
|
|
35375
35377
|
path,
|
|
@@ -36852,6 +36854,11 @@ var Networks;
|
|
|
36852
36854
|
Networks["Astar"] = "astar";
|
|
36853
36855
|
Networks["JoyStream"] = "joystream";
|
|
36854
36856
|
Networks["Manta"] = "manta";
|
|
36857
|
+
Networks["Hydration"] = "hydration";
|
|
36858
|
+
Networks["Bifrost"] = "bifrost";
|
|
36859
|
+
Networks["BifrostKusama"] = "bifrost-ksm";
|
|
36860
|
+
Networks["PolkadotAssetHub"] = "polkadot-assethub";
|
|
36861
|
+
Networks["KusamaAssetHub"] = "kusama-assethub";
|
|
36855
36862
|
})(Networks || (Networks = {}));
|
|
36856
36863
|
const baseVersionRange = {
|
|
36857
36864
|
model_mini: {
|
|
@@ -36892,6 +36899,16 @@ function getPolkadotVersionRangeWithBundle(networks) {
|
|
|
36892
36899
|
}
|
|
36893
36900
|
return baseVersionRange;
|
|
36894
36901
|
}
|
|
36902
|
+
function parseNetwork(network) {
|
|
36903
|
+
switch (network) {
|
|
36904
|
+
case Networks.PolkadotAssetHub:
|
|
36905
|
+
return Networks.Polkadot;
|
|
36906
|
+
case Networks.KusamaAssetHub:
|
|
36907
|
+
return Networks.Kusama;
|
|
36908
|
+
default:
|
|
36909
|
+
return network;
|
|
36910
|
+
}
|
|
36911
|
+
}
|
|
36895
36912
|
|
|
36896
36913
|
class PolkadotGetAddress extends BaseMethod {
|
|
36897
36914
|
constructor() {
|
|
@@ -36920,7 +36937,7 @@ class PolkadotGetAddress extends BaseMethod {
|
|
|
36920
36937
|
this.params.push({
|
|
36921
36938
|
address_n: addressN,
|
|
36922
36939
|
prefix,
|
|
36923
|
-
network,
|
|
36940
|
+
network: parseNetwork(network),
|
|
36924
36941
|
show_display: showOnOneKey,
|
|
36925
36942
|
});
|
|
36926
36943
|
});
|
|
@@ -36967,13 +36984,15 @@ class PolkadotSignTransaction extends BaseMethod {
|
|
|
36967
36984
|
validateParams(this.payload, [
|
|
36968
36985
|
{ name: 'path', required: true },
|
|
36969
36986
|
{ name: 'network', required: true },
|
|
36987
|
+
{ name: 'prefix' },
|
|
36970
36988
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
36971
36989
|
]);
|
|
36972
|
-
const { path, rawTx, network } = this.payload;
|
|
36990
|
+
const { path, rawTx, network, prefix } = this.payload;
|
|
36973
36991
|
const addressN = validatePath(path, 3);
|
|
36974
36992
|
this.params = {
|
|
36975
36993
|
address_n: addressN,
|
|
36976
|
-
network,
|
|
36994
|
+
network: parseNetwork(network),
|
|
36995
|
+
prefix,
|
|
36977
36996
|
raw_tx: formatAnyHex(rawTx),
|
|
36978
36997
|
};
|
|
36979
36998
|
}
|
|
@@ -39943,9 +39962,6 @@ function initDevice(method) {
|
|
|
39943
39962
|
if (!device) {
|
|
39944
39963
|
const env = DataManager.getSettings('env');
|
|
39945
39964
|
if (DataManager.isWebUsbConnect(env)) {
|
|
39946
|
-
if (!method.payload.skipWebDevicePrompt) {
|
|
39947
|
-
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
39948
|
-
}
|
|
39949
39965
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission);
|
|
39950
39966
|
}
|
|
39951
39967
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound);
|
|
@@ -40000,6 +40016,7 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40000
40016
|
Log.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${MAX_RETRY_COUNT}, POLL_INTERVAL_TIME=${POLL_INTERVAL_TIME} `);
|
|
40001
40017
|
const poll = (time = POLL_INTERVAL_TIME) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40002
40018
|
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40019
|
+
var _k;
|
|
40003
40020
|
const abort = () => {
|
|
40004
40021
|
if (abortSignal && abortSignal.aborted) {
|
|
40005
40022
|
if (timer) {
|
|
@@ -40093,7 +40110,6 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40093
40110
|
hdShared.HardwareErrorCode.SelectDevice,
|
|
40094
40111
|
hdShared.HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
40095
40112
|
hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
40096
|
-
hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission,
|
|
40097
40113
|
hdShared.HardwareErrorCode.BridgeNeedsPermission,
|
|
40098
40114
|
].includes(error.errorCode)) {
|
|
40099
40115
|
reject(error);
|
|
@@ -40105,7 +40121,15 @@ const ensureConnected = (_context, method, pollingId, abortSignal) => __awaiter(
|
|
|
40105
40121
|
clearTimeout(timer);
|
|
40106
40122
|
}
|
|
40107
40123
|
Log.debug('EnsureConnected get to max try count, will return: ', tryCount);
|
|
40108
|
-
|
|
40124
|
+
if (DataManager.isWebUsbConnect(env)) {
|
|
40125
|
+
if (!((_k = method.payload) === null || _k === void 0 ? void 0 : _k.skipWebDevicePrompt)) {
|
|
40126
|
+
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
40127
|
+
}
|
|
40128
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission));
|
|
40129
|
+
}
|
|
40130
|
+
else {
|
|
40131
|
+
reject(hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound));
|
|
40132
|
+
}
|
|
40109
40133
|
return;
|
|
40110
40134
|
}
|
|
40111
40135
|
if (abort()) {
|
|
@@ -40391,7 +40415,7 @@ const init = (settings, Transport, plugin) => __awaiter(void 0, void 0, void 0,
|
|
|
40391
40415
|
yield DataManager.load(settings);
|
|
40392
40416
|
initTransport(Transport, plugin);
|
|
40393
40417
|
}
|
|
40394
|
-
catch (
|
|
40418
|
+
catch (_l) {
|
|
40395
40419
|
Log.error('DataManager.load error');
|
|
40396
40420
|
}
|
|
40397
40421
|
enableLog(DataManager.getSettings('debug'));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PolkadotSignedTx as HardwarePolkadotSignedTx } from '@onekeyfe/hd-transport';
|
|
1
|
+
import type { PolkadotSignedTx as HardwarePolkadotSignedTx } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
3
|
export type PolkadotSignedTx = {
|
|
4
4
|
path: string;
|
|
@@ -6,6 +6,7 @@ export type PolkadotSignedTx = {
|
|
|
6
6
|
export type PolkadotSignTransactionParams = {
|
|
7
7
|
path: string | number[];
|
|
8
8
|
network: string;
|
|
9
|
+
prefix: number;
|
|
9
10
|
rawTx?: string;
|
|
10
11
|
};
|
|
11
12
|
export declare function polkadotSignTransaction(connectId: string, deviceId: string, params: CommonParams & PolkadotSignTransactionParams): Response<PolkadotSignedTx>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polkadotSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/polkadotSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"polkadotSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/polkadotSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,wBAAwB,CAAC;AAE7B,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,6BAA6B,GACnD,QAAQ,CAAC,gBAAgB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.1.19-alpha.
|
|
3
|
+
"version": "1.1.19-alpha.4",
|
|
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.19-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.1.19-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.1.19-alpha.4",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.1.19-alpha.4",
|
|
30
30
|
"axios": "1.12.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"bytebuffer": "^5.0.1",
|
|
@@ -35,16 +35,14 @@
|
|
|
35
35
|
"semver": "^7.3.7"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@noble/hashes": "^1.1.3"
|
|
39
|
-
"ripple-keypairs": "^1.3.1"
|
|
38
|
+
"@noble/hashes": "^1.1.3"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@noble/hashes": "^1.1.3",
|
|
43
42
|
"@types/parse-uri": "^1.0.0",
|
|
44
43
|
"@types/semver": "^7.3.9",
|
|
45
44
|
"@types/w3c-web-usb": "^1.0.10",
|
|
46
|
-
"@types/web-bluetooth": "^0.0.21"
|
|
47
|
-
"ripple-keypairs": "^1.3.1"
|
|
45
|
+
"@types/web-bluetooth": "^0.0.21"
|
|
48
46
|
},
|
|
49
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "69284804bddd892cb4a4231bb1ad41a039ac80cc"
|
|
50
48
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PolkadotGetAddress as HardwarePolkadotGetAddress } from '@onekeyfe/hd-transport';
|
|
2
|
-
|
|
3
1
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
2
|
import { BaseMethod } from '../BaseMethod';
|
|
5
3
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import { getPolkadotVersionRangeWithBundle, parseNetwork } from './networks';
|
|
5
|
+
|
|
6
|
+
import type { PolkadotGetAddress as HardwarePolkadotGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
+
import type { PolkadotAddress, PolkadotGetAddressParams } from '../../types';
|
|
8
8
|
|
|
9
9
|
export default class PolkadotGetAddress extends BaseMethod<HardwarePolkadotGetAddress[]> {
|
|
10
10
|
hasBundle = false;
|
|
@@ -37,7 +37,7 @@ export default class PolkadotGetAddress extends BaseMethod<HardwarePolkadotGetAd
|
|
|
37
37
|
this.params.push({
|
|
38
38
|
address_n: addressN,
|
|
39
39
|
prefix,
|
|
40
|
-
network,
|
|
40
|
+
network: parseNetwork(network),
|
|
41
41
|
show_display: showOnOneKey,
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { PolkadotSignTx as HardwarePolkadotSignTx } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
3
2
|
import { BaseMethod } from '../BaseMethod';
|
|
4
3
|
import { validateParams } from '../helpers/paramsValidator';
|
|
5
|
-
import { PolkadotSignTransactionParams } from '../../types';
|
|
6
4
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
7
|
-
import { getPolkadotVersionRange } from './networks';
|
|
5
|
+
import { getPolkadotVersionRange, parseNetwork } from './networks';
|
|
6
|
+
|
|
7
|
+
import type { PolkadotSignTransactionParams } from '../../types';
|
|
8
|
+
import type { PolkadotSignTx as HardwarePolkadotSignTx } from '@onekeyfe/hd-transport';
|
|
8
9
|
|
|
9
10
|
export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadotSignTx> {
|
|
10
11
|
hasBundle = false;
|
|
@@ -17,16 +18,18 @@ export default class PolkadotSignTransaction extends BaseMethod<HardwarePolkadot
|
|
|
17
18
|
validateParams(this.payload, [
|
|
18
19
|
{ name: 'path', required: true },
|
|
19
20
|
{ name: 'network', required: true },
|
|
21
|
+
{ name: 'prefix' },
|
|
20
22
|
{ name: 'rawTx', type: 'hexString', required: true },
|
|
21
23
|
]);
|
|
22
24
|
|
|
23
25
|
// init params
|
|
24
|
-
const { path, rawTx, network } = this.payload as PolkadotSignTransactionParams;
|
|
26
|
+
const { path, rawTx, network, prefix } = this.payload as PolkadotSignTransactionParams;
|
|
25
27
|
const addressN = validatePath(path, 3);
|
|
26
28
|
|
|
27
29
|
this.params = {
|
|
28
30
|
address_n: addressN,
|
|
29
|
-
network,
|
|
31
|
+
network: parseNetwork(network),
|
|
32
|
+
prefix,
|
|
30
33
|
raw_tx: formatAnyHex(rawTx),
|
|
31
34
|
};
|
|
32
35
|
}
|
|
@@ -8,6 +8,11 @@ enum Networks {
|
|
|
8
8
|
Astar = 'astar',
|
|
9
9
|
JoyStream = 'joystream',
|
|
10
10
|
Manta = 'manta',
|
|
11
|
+
Hydration = 'hydration',
|
|
12
|
+
Bifrost = 'bifrost',
|
|
13
|
+
BifrostKusama = 'bifrost-ksm',
|
|
14
|
+
PolkadotAssetHub = 'polkadot-assethub',
|
|
15
|
+
KusamaAssetHub = 'kusama-assethub',
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
// All polkadot networks are included in no special case
|
|
@@ -54,3 +59,14 @@ export function getPolkadotVersionRangeWithBundle(networks: string[]) {
|
|
|
54
59
|
}
|
|
55
60
|
return baseVersionRange;
|
|
56
61
|
}
|
|
62
|
+
|
|
63
|
+
export function parseNetwork(network: string) {
|
|
64
|
+
switch (network) {
|
|
65
|
+
case Networks.PolkadotAssetHub:
|
|
66
|
+
return Networks.Polkadot;
|
|
67
|
+
case Networks.KusamaAssetHub:
|
|
68
|
+
return Networks.Kusama;
|
|
69
|
+
default:
|
|
70
|
+
return network;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { TronGetAddress as HardwareTronGetAddress } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
2
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
4
3
|
import { BaseMethod } from '../BaseMethod';
|
|
5
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
6
|
-
|
|
5
|
+
|
|
6
|
+
import type { TronGetAddress as HardwareTronGetAddress } from '@onekeyfe/hd-transport';
|
|
7
|
+
import type { TronGetAddressParams, TronAddress } from '../../types';
|
|
7
8
|
|
|
8
9
|
export default class TronGetAddress extends BaseMethod<HardwareTronGetAddress[]> {
|
|
9
10
|
hasBundle = false;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TronSignMessage as HardwareTronSignMessage,
|
|
3
|
-
TronMessageType,
|
|
4
|
-
} from '@onekeyfe/hd-transport';
|
|
1
|
+
import { TronMessageType } from '@onekeyfe/hd-transport';
|
|
5
2
|
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
3
|
+
|
|
6
4
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
7
5
|
import { validatePath } from '../helpers/pathUtils';
|
|
8
6
|
import { BaseMethod } from '../BaseMethod';
|
|
9
7
|
import { validateParams } from '../helpers/paramsValidator';
|
|
10
8
|
import { stripHexPrefix } from '../helpers/hexUtils';
|
|
11
9
|
|
|
10
|
+
import type { TronSignMessage as HardwareTronSignMessage } from '@onekeyfe/hd-transport';
|
|
11
|
+
|
|
12
12
|
export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage> {
|
|
13
13
|
init() {
|
|
14
14
|
this.checkDeviceId = true;
|
|
@@ -54,6 +54,9 @@ export default class TronSignMessage extends BaseMethod<HardwareTronSignMessage>
|
|
|
54
54
|
pro: {
|
|
55
55
|
min: '4.16.0',
|
|
56
56
|
},
|
|
57
|
+
touch: {
|
|
58
|
+
min: '4.12.0',
|
|
59
|
+
},
|
|
57
60
|
classic1s: {
|
|
58
61
|
min: '3.13.0',
|
|
59
62
|
},
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { TronSignTx } from '@onekeyfe/hd-transport';
|
|
2
1
|
import { isEmpty } from 'lodash';
|
|
2
|
+
|
|
3
3
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
4
4
|
import { validatePath } from '../helpers/pathUtils';
|
|
5
5
|
import { BaseMethod } from '../BaseMethod';
|
|
6
6
|
import { validateParams } from '../helpers/paramsValidator';
|
|
7
|
-
import { TronTransaction } from '../../types/api/tronSignTransaction';
|
|
8
7
|
import { formatAnyHex } from '../helpers/hexUtils';
|
|
9
|
-
|
|
8
|
+
|
|
9
|
+
import type { TronTransaction } from '../../types/api/tronSignTransaction';
|
|
10
|
+
import type { TronSignTx } from '@onekeyfe/hd-transport';
|
|
11
|
+
import type { DeviceFirmwareRange } from '../../types';
|
|
10
12
|
|
|
11
13
|
export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
12
14
|
parseTx(tx: TronTransaction, address_n: number[]): TronSignTx {
|
|
@@ -156,6 +158,9 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
156
158
|
pro: {
|
|
157
159
|
min: '4.13.0',
|
|
158
160
|
},
|
|
161
|
+
touch: {
|
|
162
|
+
min: '4.12.0',
|
|
163
|
+
},
|
|
159
164
|
model_classic1s: {
|
|
160
165
|
min: '3.12.0',
|
|
161
166
|
},
|
|
@@ -176,6 +181,12 @@ export default class TronSignTransaction extends BaseMethod<TronSignTx> {
|
|
|
176
181
|
pro: {
|
|
177
182
|
min: '4.15.0',
|
|
178
183
|
},
|
|
184
|
+
touch: {
|
|
185
|
+
min: '4.12.0',
|
|
186
|
+
},
|
|
187
|
+
model_classic1s: {
|
|
188
|
+
min: '3.13.0',
|
|
189
|
+
},
|
|
179
190
|
};
|
|
180
191
|
}
|
|
181
192
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { deriveAddress } from 'ripple-keypairs';
|
|
2
1
|
import { UI_REQUEST } from '../../constants/ui-request';
|
|
3
2
|
import { XrpAddress, XrpGetAddressParams } from '../../types/api/xrpGetAddress';
|
|
4
|
-
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';
|
|
5
3
|
import { BaseMethod } from '../BaseMethod';
|
|
6
4
|
import { validateParams, validateResult } from '../helpers/paramsValidator';
|
|
7
5
|
import { serializedPath, validatePath } from '../helpers/pathUtils';
|
|
8
|
-
import { batchGetPublickeys } from '../helpers/batchGetPublickeys';
|
|
9
6
|
|
|
10
7
|
export default class XrpGetAddress extends BaseMethod<
|
|
11
8
|
{
|
|
@@ -57,22 +54,6 @@ export default class XrpGetAddress extends BaseMethod<
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
async run() {
|
|
60
|
-
if (this.hasBundle && supportBatchPublicKey(this.device?.features) && !this.shouldConfirm) {
|
|
61
|
-
const res = await batchGetPublickeys(this.device, this.params, 'secp256k1', 144);
|
|
62
|
-
const result = res.public_keys.map((publicKey: string, index: number) => ({
|
|
63
|
-
path: serializedPath((this.params as unknown as any[])[index].address_n),
|
|
64
|
-
address: deriveAddress(publicKey),
|
|
65
|
-
publicKey,
|
|
66
|
-
pub: publicKey,
|
|
67
|
-
}));
|
|
68
|
-
|
|
69
|
-
validateResult(result, ['address', 'publicKey'], {
|
|
70
|
-
expectedLength: this.params.length,
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
return Promise.resolve(result);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
57
|
const responses: XrpAddress[] = [];
|
|
77
58
|
for (let i = 0; i < this.params.length; i++) {
|
|
78
59
|
const param = this.params[i];
|
package/src/core/index.ts
CHANGED
|
@@ -644,9 +644,6 @@ function initDevice(method: BaseMethod) {
|
|
|
644
644
|
if (!device) {
|
|
645
645
|
const env = DataManager.getSettings('env');
|
|
646
646
|
if (DataManager.isWebUsbConnect(env)) {
|
|
647
|
-
if (!method.payload.skipWebDevicePrompt) {
|
|
648
|
-
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
649
|
-
}
|
|
650
647
|
throw ERRORS.TypedError(HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission);
|
|
651
648
|
}
|
|
652
649
|
throw ERRORS.TypedError(HardwareErrorCode.DeviceNotFound);
|
|
@@ -716,7 +713,6 @@ const ensureConnected = async (
|
|
|
716
713
|
const POLL_INTERVAL_TIME = (method.payload && method.payload.pollIntervalTime) || 1000;
|
|
717
714
|
const TIME_OUT = (method.payload && method.payload.timeout) || 10000;
|
|
718
715
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
719
|
-
|
|
720
716
|
Log.debug(
|
|
721
717
|
`EnsureConnected function start, MAX_RETRY_COUNT=${MAX_RETRY_COUNT}, POLL_INTERVAL_TIME=${POLL_INTERVAL_TIME} `
|
|
722
718
|
);
|
|
@@ -830,7 +826,6 @@ const ensureConnected = async (
|
|
|
830
826
|
HardwareErrorCode.SelectDevice,
|
|
831
827
|
HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
832
828
|
HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
833
|
-
HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission,
|
|
834
829
|
HardwareErrorCode.BridgeNeedsPermission,
|
|
835
830
|
].includes(error.errorCode)
|
|
836
831
|
) {
|
|
@@ -844,7 +839,15 @@ const ensureConnected = async (
|
|
|
844
839
|
clearTimeout(timer);
|
|
845
840
|
}
|
|
846
841
|
Log.debug('EnsureConnected get to max try count, will return: ', tryCount);
|
|
847
|
-
|
|
842
|
+
// WebUSB scenario: after all retries failed, send permission prompt and return error
|
|
843
|
+
if (DataManager.isWebUsbConnect(env)) {
|
|
844
|
+
if (!method.payload?.skipWebDevicePrompt) {
|
|
845
|
+
postMessage(createUiMessage(UI_REQUEST.WEB_DEVICE_PROMPT_ACCESS_PERMISSION));
|
|
846
|
+
}
|
|
847
|
+
reject(ERRORS.TypedError(HardwareErrorCode.WebDeviceNotFoundOrNeedsPermission));
|
|
848
|
+
} else {
|
|
849
|
+
reject(ERRORS.TypedError(HardwareErrorCode.DeviceNotFound));
|
|
850
|
+
}
|
|
848
851
|
return;
|
|
849
852
|
}
|
|
850
853
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PolkadotSignedTx as HardwarePolkadotSignedTx } from '@onekeyfe/hd-transport';
|
|
1
|
+
import type { PolkadotSignedTx as HardwarePolkadotSignedTx } from '@onekeyfe/hd-transport';
|
|
2
2
|
import type { CommonParams, Response } from '../params';
|
|
3
3
|
|
|
4
4
|
export type PolkadotSignedTx = {
|
|
@@ -8,6 +8,7 @@ export type PolkadotSignedTx = {
|
|
|
8
8
|
export type PolkadotSignTransactionParams = {
|
|
9
9
|
path: string | number[];
|
|
10
10
|
network: string;
|
|
11
|
+
prefix: number;
|
|
11
12
|
rawTx?: string;
|
|
12
13
|
};
|
|
13
14
|
|