@onekeyfe/hd-core 1.1.19-alpha.2 → 1.1.19-alpha.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"btcParamsUtils.d.ts","sourceRoot":"","sources":["../../../../src/api/btc/helpers/btcParamsUtils.ts"],"names":[],"mappings":"AAIA,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
+ {"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 { PolkadotAddress } from '../../types';
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":"AAAA,OAAO,EAAE,kBAAkB,IAAI,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAA4B,MAAM,aAAa,CAAC;AAGxE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,UAAU,CAAC,0BAA0B,EAAE,CAAC;IACtF,SAAS,UAAS;IAElB,IAAI;IAkCJ,eAAe;;;;;;;;IAKT,GAAG;CAgCV"}
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":"AAAA,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAM3C,MAAM,CAAC,OAAO,OAAO,uBAAwB,SAAQ,UAAU,CAAC,sBAAsB,CAAC;IACrF,SAAS,UAAS;IAElB,IAAI;IAsBJ,eAAe;IAIT,GAAG;;;;CAYV"}
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;CAChB;AA+BD,eAAe,QAAQ,CAAC;AAExB,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,uBAEtD;AAED,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,EAAE;;;;;;;EAQnE"}
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 { TronAddress } from '../../types';
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":"AAAA,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAwB,WAAW,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CAAC,sBAAsB,EAAE,CAAC;IAC9E,SAAS,UAAS;IAElB,IAAI;IA6BJ,eAAe;;;;;IAQT,GAAG;CA0BV"}
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":"AAAA,OAAO,EACL,eAAe,IAAI,uBAAuB,EAE3C,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,UAAU,CAAC,uBAAuB,CAAC;IAC9E,IAAI;IA+BJ,eAAe;;;;;IAQf,wBAAwB;;;;;;;;IAWlB,GAAG;CAmBV"}
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 { DeviceFirmwareRange } from '../../types';
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":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,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;IAWjD,uCAAuC;IASvC,6CAA6C,IAAI,mBAAmB;IAQpE,sCAAsC;IAWhC,GAAG;CAUV"}
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":"AAEA,OAAO,EAAE,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,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;CAuDV"}
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/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, _e;
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: (_c = (_b = publicKey.message) === null || _b === void 0 ? void 0 : _b.public_keys) === null || _c === void 0 ? void 0 : _c[0],
35372
- pub: (_e = (_d = publicKey.message) === null || _d === void 0 ? void 0 : _d.public_keys) === null || _e === void 0 ? void 0 : _e[0],
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
  }
@@ -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;AACtF,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,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"}
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.2",
3
+ "version": "1.1.19-alpha.3",
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.2",
29
- "@onekeyfe/hd-transport": "1.1.19-alpha.2",
28
+ "@onekeyfe/hd-shared": "1.1.19-alpha.3",
29
+ "@onekeyfe/hd-transport": "1.1.19-alpha.3",
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": "fb0244c624d5546c09262f366ef090f5fa906d03"
47
+ "gitHead": "9039715c7d1ec7ebaf71ec8e22737f3f2b013ca5"
50
48
  }
@@ -1,4 +1,5 @@
1
1
  import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
2
+
2
3
  import { getScriptType, isMultisigPath, fromHardened } from '../../helpers/pathUtils';
3
4
  import bitcoin from '../../../data/coins/bitcoin.json';
4
5
 
@@ -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 { PolkadotAddress, PolkadotGetAddressParams } from '../../types';
7
- import { getPolkadotVersionRangeWithBundle } from './networks';
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
- import { TronGetAddressParams, TronAddress } from '../../types';
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
- import { DeviceFirmwareRange } from '../../types';
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];
@@ -9603,6 +9603,10 @@
9603
9603
  "rule": "required",
9604
9604
  "type": "string",
9605
9605
  "id": 3
9606
+ },
9607
+ "prefix": {
9608
+ "type": "uint32",
9609
+ "id": 4
9606
9610
  }
9607
9611
  }
9608
9612
  },
@@ -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