@onekeyfe/hd-core 1.1.10-alpha.1 → 1.1.10-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.
Files changed (38) hide show
  1. package/dist/api/aptos/AptosSignInMessage.d.ts +13 -0
  2. package/dist/api/aptos/AptosSignInMessage.d.ts.map +1 -0
  3. package/dist/api/evm/EVMSignTransaction.d.ts +2 -5
  4. package/dist/api/evm/EVMSignTransaction.d.ts.map +1 -1
  5. package/dist/api/evm/latest/signTransaction.d.ts +3 -10
  6. package/dist/api/evm/latest/signTransaction.d.ts.map +1 -1
  7. package/dist/api/index.d.ts +1 -0
  8. package/dist/api/index.d.ts.map +1 -1
  9. package/dist/api/tron/TronSignMessage.d.ts +5 -0
  10. package/dist/api/tron/TronSignMessage.d.ts.map +1 -1
  11. package/dist/index.d.ts +21 -29
  12. package/dist/index.js +215 -205
  13. package/dist/inject.d.ts.map +1 -1
  14. package/dist/types/api/aptosSignInMessage.d.ts +11 -0
  15. package/dist/types/api/aptosSignInMessage.d.ts.map +1 -0
  16. package/dist/types/api/evmSignTransaction.d.ts +1 -27
  17. package/dist/types/api/evmSignTransaction.d.ts.map +1 -1
  18. package/dist/types/api/export.d.ts +3 -1
  19. package/dist/types/api/export.d.ts.map +1 -1
  20. package/dist/types/api/index.d.ts +2 -0
  21. package/dist/types/api/index.d.ts.map +1 -1
  22. package/dist/types/api/tronSignMessage.d.ts +1 -0
  23. package/dist/types/api/tronSignMessage.d.ts.map +1 -1
  24. package/dist/utils/patch.d.ts +1 -1
  25. package/dist/utils/patch.d.ts.map +1 -1
  26. package/package.json +4 -4
  27. package/src/api/aptos/AptosSignInMessage.ts +54 -0
  28. package/src/api/evm/EVMSignTransaction.ts +5 -54
  29. package/src/api/evm/latest/signTransaction.ts +7 -101
  30. package/src/api/index.ts +1 -0
  31. package/src/api/tron/TronSignMessage.ts +32 -1
  32. package/src/data/messages/messages.json +156 -127
  33. package/src/inject.ts +2 -0
  34. package/src/types/api/aptosSignInMessage.ts +17 -0
  35. package/src/types/api/evmSignTransaction.ts +1 -30
  36. package/src/types/api/export.ts +5 -3
  37. package/src/types/api/index.ts +2 -0
  38. package/src/types/api/tronSignMessage.ts +1 -0
package/dist/index.js CHANGED
@@ -209,6 +209,7 @@ const createCoreApi = (call) => ({
209
209
  aptosGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetAddress' })),
210
210
  aptosGetPublicKey: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosGetPublicKey' })),
211
211
  aptosSignMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignMessage' })),
212
+ aptosSignInMessage: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignInMessage' })),
212
213
  aptosSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'aptosSignTransaction' })),
213
214
  algoGetAddress: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoGetAddress' })),
214
215
  algoSignTransaction: (connectId, deviceId, params) => call(Object.assign(Object.assign({}, params), { connectId, deviceId, method: 'algoSignTransaction' })),
@@ -1691,6 +1692,23 @@ var nested$1 = {
1691
1692
  }
1692
1693
  }
1693
1694
  },
1695
+ AptosSignSIWAMessage: {
1696
+ fields: {
1697
+ address_n: {
1698
+ rule: "repeated",
1699
+ type: "uint32",
1700
+ id: 1,
1701
+ options: {
1702
+ packed: false
1703
+ }
1704
+ },
1705
+ siwa_payload: {
1706
+ rule: "required",
1707
+ type: "string",
1708
+ id: 2
1709
+ }
1710
+ }
1711
+ },
1694
1712
  BenfenGetAddress: {
1695
1713
  fields: {
1696
1714
  address_n: {
@@ -6602,6 +6620,20 @@ var nested$1 = {
6602
6620
  }
6603
6621
  }
6604
6622
  },
6623
+ EthereumAccessListOneKey: {
6624
+ fields: {
6625
+ address: {
6626
+ rule: "required",
6627
+ type: "string",
6628
+ id: 1
6629
+ },
6630
+ storage_keys: {
6631
+ rule: "repeated",
6632
+ type: "bytes",
6633
+ id: 2
6634
+ }
6635
+ }
6636
+ },
6605
6637
  EthereumSignTxEIP1559OneKey: {
6606
6638
  fields: {
6607
6639
  address_n: {
@@ -6666,19 +6698,124 @@ var nested$1 = {
6666
6698
  type: "EthereumAccessListOneKey",
6667
6699
  id: 11
6668
6700
  }
6701
+ }
6702
+ },
6703
+ EthereumAuthorizationSignature: {
6704
+ fields: {
6705
+ y_parity: {
6706
+ rule: "required",
6707
+ type: "uint32",
6708
+ id: 1
6709
+ },
6710
+ r: {
6711
+ rule: "required",
6712
+ type: "bytes",
6713
+ id: 2
6714
+ },
6715
+ s: {
6716
+ rule: "required",
6717
+ type: "bytes",
6718
+ id: 3
6719
+ }
6720
+ }
6721
+ },
6722
+ EthereumSignTxEIP7702OneKey: {
6723
+ fields: {
6724
+ address_n: {
6725
+ rule: "repeated",
6726
+ type: "uint32",
6727
+ id: 1,
6728
+ options: {
6729
+ packed: false
6730
+ }
6731
+ },
6732
+ nonce: {
6733
+ rule: "required",
6734
+ type: "bytes",
6735
+ id: 2
6736
+ },
6737
+ max_gas_fee: {
6738
+ rule: "required",
6739
+ type: "bytes",
6740
+ id: 3
6741
+ },
6742
+ max_priority_fee: {
6743
+ rule: "required",
6744
+ type: "bytes",
6745
+ id: 4
6746
+ },
6747
+ gas_limit: {
6748
+ rule: "required",
6749
+ type: "bytes",
6750
+ id: 5
6751
+ },
6752
+ to: {
6753
+ rule: "required",
6754
+ type: "string",
6755
+ id: 6
6756
+ },
6757
+ value: {
6758
+ rule: "required",
6759
+ type: "bytes",
6760
+ id: 7
6761
+ },
6762
+ data_initial_chunk: {
6763
+ type: "bytes",
6764
+ id: 8,
6765
+ options: {
6766
+ "default": ""
6767
+ }
6768
+ },
6769
+ data_length: {
6770
+ rule: "required",
6771
+ type: "uint32",
6772
+ id: 9
6773
+ },
6774
+ chain_id: {
6775
+ rule: "required",
6776
+ type: "uint64",
6777
+ id: 10
6778
+ },
6779
+ access_list: {
6780
+ rule: "repeated",
6781
+ type: "EthereumAccessListOneKey",
6782
+ id: 11
6783
+ },
6784
+ authorization_list: {
6785
+ rule: "repeated",
6786
+ type: "EthereumAuthorizationOneKey",
6787
+ id: 12
6788
+ }
6669
6789
  },
6670
6790
  nested: {
6671
- EthereumAccessListOneKey: {
6791
+ EthereumAuthorizationOneKey: {
6672
6792
  fields: {
6793
+ address_n: {
6794
+ rule: "repeated",
6795
+ type: "uint32",
6796
+ id: 1,
6797
+ options: {
6798
+ packed: false
6799
+ }
6800
+ },
6801
+ chain_id: {
6802
+ rule: "required",
6803
+ type: "uint64",
6804
+ id: 2
6805
+ },
6673
6806
  address: {
6674
6807
  rule: "required",
6675
6808
  type: "string",
6676
- id: 1
6809
+ id: 3
6677
6810
  },
6678
- storage_keys: {
6679
- rule: "repeated",
6811
+ nonce: {
6812
+ rule: "required",
6680
6813
  type: "bytes",
6681
- id: 2
6814
+ id: 4
6815
+ },
6816
+ signature: {
6817
+ type: "EthereumAuthorizationSignature",
6818
+ id: 5
6682
6819
  }
6683
6820
  }
6684
6821
  }
@@ -6815,127 +6952,6 @@ var nested$1 = {
6815
6952
  }
6816
6953
  }
6817
6954
  },
6818
- EthereumSignTxEIP7702OneKey: {
6819
- fields: {
6820
- address_n: {
6821
- rule: "repeated",
6822
- type: "uint32",
6823
- id: 1,
6824
- options: {
6825
- packed: false
6826
- }
6827
- },
6828
- nonce: {
6829
- rule: "required",
6830
- type: "bytes",
6831
- id: 2
6832
- },
6833
- max_gas_fee: {
6834
- rule: "required",
6835
- type: "bytes",
6836
- id: 3
6837
- },
6838
- max_priority_fee: {
6839
- rule: "required",
6840
- type: "bytes",
6841
- id: 4
6842
- },
6843
- gas_limit: {
6844
- rule: "required",
6845
- type: "bytes",
6846
- id: 5
6847
- },
6848
- to: {
6849
- rule: "required",
6850
- type: "string",
6851
- id: 6
6852
- },
6853
- value: {
6854
- rule: "required",
6855
- type: "bytes",
6856
- id: 7
6857
- },
6858
- data_initial_chunk: {
6859
- type: "bytes",
6860
- id: 8,
6861
- options: {
6862
- "default": ""
6863
- }
6864
- },
6865
- data_length: {
6866
- rule: "required",
6867
- type: "uint32",
6868
- id: 9
6869
- },
6870
- chain_id: {
6871
- rule: "required",
6872
- type: "uint64",
6873
- id: 10
6874
- },
6875
- access_list: {
6876
- rule: "repeated",
6877
- type: "EthereumAccessListOneKey",
6878
- id: 11
6879
- },
6880
- authorization_list: {
6881
- rule: "repeated",
6882
- type: "EthereumAuthorizationOneKey",
6883
- id: 12
6884
- }
6885
- },
6886
- nested: {
6887
- EthereumAuthorizationOneKey: {
6888
- fields: {
6889
- address_n: {
6890
- rule: "repeated",
6891
- type: "uint32",
6892
- id: 1,
6893
- options: {
6894
- packed: false
6895
- }
6896
- },
6897
- chain_id: {
6898
- rule: "required",
6899
- type: "uint64",
6900
- id: 2
6901
- },
6902
- address: {
6903
- rule: "required",
6904
- type: "string",
6905
- id: 3
6906
- },
6907
- nonce: {
6908
- rule: "required",
6909
- type: "bytes",
6910
- id: 4
6911
- },
6912
- signature: {
6913
- type: "EthereumAuthorizationSignature",
6914
- id: 5
6915
- }
6916
- }
6917
- }
6918
- }
6919
- },
6920
- EthereumAuthorizationSignature: {
6921
- fields: {
6922
- y_parity: {
6923
- rule: "required",
6924
- type: "uint32",
6925
- id: 1
6926
- },
6927
- r: {
6928
- rule: "required",
6929
- type: "bytes",
6930
- id: 2
6931
- },
6932
- s: {
6933
- rule: "required",
6934
- type: "bytes",
6935
- id: 3
6936
- }
6937
- }
6938
- },
6939
6955
  EthereumSignMessageEIP712: {
6940
6956
  fields: {
6941
6957
  address_n: {
@@ -13101,6 +13117,12 @@ var nested$1 = {
13101
13117
  }
13102
13118
  }
13103
13119
  },
13120
+ TronMessageType: {
13121
+ values: {
13122
+ V1: 1,
13123
+ V2: 2
13124
+ }
13125
+ },
13104
13126
  TronSignMessage: {
13105
13127
  fields: {
13106
13128
  address_n: {
@@ -13115,6 +13137,13 @@ var nested$1 = {
13115
13137
  rule: "required",
13116
13138
  type: "bytes",
13117
13139
  id: 2
13140
+ },
13141
+ message_type: {
13142
+ type: "TronMessageType",
13143
+ id: 3,
13144
+ options: {
13145
+ "default": "V1"
13146
+ }
13118
13147
  }
13119
13148
  }
13120
13149
  },
@@ -13421,7 +13450,6 @@ var nested$1 = {
13421
13450
  MessageType_EthereumAddressOneKey: 20103,
13422
13451
  MessageType_EthereumSignTxOneKey: 20104,
13423
13452
  MessageType_EthereumSignTxEIP1559OneKey: 20105,
13424
- MessageType_EthereumSignTxEIP7702OneKey: 20120,
13425
13453
  MessageType_EthereumTxRequestOneKey: 20106,
13426
13454
  MessageType_EthereumTxAckOneKey: 20107,
13427
13455
  MessageType_EthereumSignMessageOneKey: 20108,
@@ -13436,6 +13464,7 @@ var nested$1 = {
13436
13464
  MessageType_EthereumSignTypedHashOneKey: 20117,
13437
13465
  MessageType_EthereumGnosisSafeTxAck: 20118,
13438
13466
  MessageType_EthereumGnosisSafeTxRequest: 20119,
13467
+ MessageType_EthereumSignTxEIP7702OneKey: 20120,
13439
13468
  MessageType_NEMGetAddress: 67,
13440
13469
  MessageType_NEMAddress: 68,
13441
13470
  MessageType_NEMSignTx: 69,
@@ -13577,6 +13606,7 @@ var nested$1 = {
13577
13606
  MessageType_AptosSignedTx: 10603,
13578
13607
  MessageType_AptosSignMessage: 10604,
13579
13608
  MessageType_AptosMessageSignature: 10605,
13609
+ MessageType_AptosSignSIWAMessage: 10606,
13580
13610
  MessageType_WebAuthnListResidentCredentials: 800,
13581
13611
  MessageType_WebAuthnCredentials: 801,
13582
13612
  MessageType_WebAuthnAddResidentCredential: 802,
@@ -32139,26 +32169,17 @@ const processTxRequest = ({ typedCall, request, data, chainId, supportTrezor, })
32139
32169
  let v = request.signature_v;
32140
32170
  const r = request.signature_r;
32141
32171
  const s = request.signature_s;
32142
- const authorizationSignatures = request.authorization_signatures;
32143
32172
  if (v == null || r == null || s == null) {
32144
32173
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'processTxRequest: Unexpected request');
32145
32174
  }
32146
32175
  if (chainId && v <= 1) {
32147
32176
  v += 2 * chainId + 35;
32148
32177
  }
32149
- const result = {
32178
+ return Promise.resolve({
32150
32179
  v: `0x${v.toString(16)}`,
32151
32180
  r: `0x${r}`,
32152
32181
  s: `0x${s}`,
32153
- };
32154
- if (authorizationSignatures && authorizationSignatures.length > 0) {
32155
- result.authorizationSignatures = authorizationSignatures.map(sig => ({
32156
- yParity: sig.y_parity,
32157
- r: sig.r,
32158
- s: sig.s,
32159
- }));
32160
- }
32161
- return Promise.resolve(result);
32182
+ });
32162
32183
  }
32163
32184
  const [first, rest] = cutString(data, request.data_length * 2);
32164
32185
  let response;
@@ -32243,52 +32264,7 @@ const evmSignTxEip1559 = ({ typedCall, addressN, tx, supportTrezor, }) => __awai
32243
32264
  }
32244
32265
  return processTxRequest({ typedCall, request: response.message, data: rest, supportTrezor });
32245
32266
  });
32246
- const evmSignTxEip7702 = ({ typedCall, addressN, tx, supportTrezor, }) => __awaiter(void 0, void 0, void 0, function* () {
32247
- const { to, value, gasLimit, nonce, data, chainId, maxFeePerGas, maxPriorityFeePerGas, accessList, authorizationList, } = tx;
32248
- const length = data == null ? 0 : data.length / 2;
32249
- const [first, rest] = cutString(data, 1024 * 2);
32250
- const message = {
32251
- address_n: addressN,
32252
- nonce: stripHexStartZeroes(nonce),
32253
- max_gas_fee: stripHexStartZeroes(maxFeePerGas),
32254
- max_priority_fee: stripHexStartZeroes(maxPriorityFeePerGas),
32255
- gas_limit: stripHexStartZeroes(gasLimit),
32256
- to,
32257
- value: stripHexStartZeroes(value),
32258
- data_length: length,
32259
- data_initial_chunk: first,
32260
- chain_id: chainId,
32261
- access_list: (accessList || []).map(a => ({
32262
- address: a.address,
32263
- storage_keys: a.storageKeys,
32264
- })),
32265
- authorization_list: authorizationList.map(auth => ({
32266
- address_n: auth.addressN || [],
32267
- chain_id: auth.chainId,
32268
- address: addHexPrefix(auth.address),
32269
- nonce: stripHexStartZeroes(auth.nonce),
32270
- signature: auth.signature
32271
- ? {
32272
- y_parity: auth.signature.yParity,
32273
- r: auth.signature.r,
32274
- s: auth.signature.s,
32275
- }
32276
- : undefined,
32277
- })),
32278
- };
32279
- let response;
32280
- if (supportTrezor) {
32281
- throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'EIP7702 not supported by Trezor');
32282
- }
32283
- else {
32284
- response = yield typedCall('EthereumSignTxEIP7702OneKey', 'EthereumTxRequestOneKey', message);
32285
- }
32286
- return processTxRequest({ typedCall, request: response.message, data: rest, supportTrezor });
32287
- });
32288
- const signTransaction$1 = ({ typedCall, isEIP1559, isEIP7702, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
32289
- if (isEIP7702) {
32290
- return evmSignTxEip7702({ typedCall, addressN, tx: tx });
32291
- }
32267
+ const signTransaction$1 = ({ typedCall, isEIP1559, addressN, tx, }) => __awaiter(void 0, void 0, void 0, function* () {
32292
32268
  return isEIP1559
32293
32269
  ? evmSignTxEip1559({ typedCall, addressN, tx: tx })
32294
32270
  : evmSignTx({ typedCall, addressN, tx: tx });
@@ -32310,14 +32286,6 @@ class EVMSignTransaction extends BaseMethod {
32310
32286
  super(...arguments);
32311
32287
  this.addressN = [];
32312
32288
  this.isEIP1559 = false;
32313
- this.isEIP7702 = false;
32314
- }
32315
- hasEIP7702Features(tx) {
32316
- const authList = tx.authorizationList;
32317
- return !!(authList && Array.isArray(authList) && authList.length > 0);
32318
- }
32319
- hasEIP1559Features(tx) {
32320
- return !!(tx.maxFeePerGas && tx.maxPriorityFeePerGas);
32321
32289
  }
32322
32290
  init() {
32323
32291
  this.checkDeviceId = true;
@@ -32329,8 +32297,7 @@ class EVMSignTransaction extends BaseMethod {
32329
32297
  const { path, transaction } = this.payload;
32330
32298
  this.addressN = validatePath(path, 3);
32331
32299
  const tx = transaction;
32332
- this.isEIP7702 = this.hasEIP7702Features(tx);
32333
- this.isEIP1559 = this.hasEIP1559Features(tx) && !this.isEIP7702;
32300
+ this.isEIP1559 = !!tx.maxFeePerGas && !!tx.maxPriorityFeePerGas;
32334
32301
  const schema = [
32335
32302
  { name: 'to', type: 'hexString', required: true },
32336
32303
  { name: 'value', type: 'hexString', required: true },
@@ -32339,12 +32306,7 @@ class EVMSignTransaction extends BaseMethod {
32339
32306
  { name: 'chainId', type: 'number', required: true },
32340
32307
  { name: 'data', type: 'hexString' },
32341
32308
  ];
32342
- if (this.isEIP7702) {
32343
- schema.push({ name: 'maxFeePerGas', type: 'hexString', required: true });
32344
- schema.push({ name: 'maxPriorityFeePerGas', type: 'hexString', required: true });
32345
- schema.push({ name: 'authorizationList', type: 'array', required: true });
32346
- }
32347
- else if (this.isEIP1559) {
32309
+ if (this.isEIP1559) {
32348
32310
  schema.push({ name: 'maxFeePerGas', type: 'hexString', required: true });
32349
32311
  schema.push({ name: 'maxPriorityFeePerGas', type: 'hexString', required: true });
32350
32312
  }
@@ -32371,13 +32333,10 @@ class EVMSignTransaction extends BaseMethod {
32371
32333
  }
32372
32334
  run() {
32373
32335
  return __awaiter(this, void 0, void 0, function* () {
32374
- const { addressN, isEIP1559, isEIP7702, formattedTx } = this;
32336
+ const { addressN, isEIP1559, formattedTx } = this;
32375
32337
  if (formattedTx == null)
32376
32338
  throw hdShared.ERRORS.TypedError('Runtime', 'formattedTx is not set');
32377
32339
  if (TransportManager.getMessageVersion() === 'v1') {
32378
- if (isEIP7702) {
32379
- throw hdShared.ERRORS.TypedError('Runtime', 'EIP7702 not supported in legacy mode');
32380
- }
32381
32340
  return signTransaction({
32382
32341
  typedCall: this.device.commands.typedCall.bind(this.device.commands),
32383
32342
  addressN,
@@ -32390,7 +32349,6 @@ class EVMSignTransaction extends BaseMethod {
32390
32349
  addressN,
32391
32350
  tx: formattedTx,
32392
32351
  isEIP1559,
32393
- isEIP7702,
32394
32352
  });
32395
32353
  });
32396
32354
  }
@@ -33835,12 +33793,18 @@ class TronSignMessage extends BaseMethod {
33835
33793
  validateParams(this.payload, [
33836
33794
  { name: 'path', required: true },
33837
33795
  { name: 'messageHex', type: 'hexString', required: true },
33796
+ { name: 'messageType', type: 'string' },
33838
33797
  ]);
33839
33798
  const { path, messageHex } = this.payload;
33840
33799
  const addressN = validatePath(path, 3);
33800
+ if (this.payload.messageType === 'V1' || this.payload.messageType == null) {
33801
+ throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotSupportMethod, 'not support tron message v1');
33802
+ }
33803
+ const messageType = hdTransport.TronMessageType.V2;
33841
33804
  this.params = {
33842
33805
  address_n: addressN,
33843
33806
  message: stripHexPrefix(messageHex),
33807
+ message_type: messageType,
33844
33808
  };
33845
33809
  }
33846
33810
  getVersionRange() {
@@ -33850,8 +33814,18 @@ class TronSignMessage extends BaseMethod {
33850
33814
  },
33851
33815
  };
33852
33816
  }
33817
+ getMessageV2VersionRange() {
33818
+ return {
33819
+ pro: {
33820
+ min: '4.16.0',
33821
+ },
33822
+ };
33823
+ }
33853
33824
  run() {
33854
33825
  return __awaiter(this, void 0, void 0, function* () {
33826
+ this.checkFeatureVersionLimit(() => this.params.message_type === hdTransport.TronMessageType.V2, () => this.getMessageV2VersionRange(), {
33827
+ strictCheckDeviceSupport: true,
33828
+ });
33855
33829
  const response = yield this.device.commands.typedCall('TronSignMessage', 'TronMessageSignature', Object.assign({}, this.params));
33856
33830
  return Promise.resolve(response.message);
33857
33831
  });
@@ -34364,6 +34338,41 @@ class AptosSignMessage extends BaseMethod {
34364
34338
  }
34365
34339
  }
34366
34340
 
34341
+ class AptosSignInMessage extends BaseMethod {
34342
+ init() {
34343
+ this.checkDeviceId = true;
34344
+ this.allowDeviceMode = [...this.allowDeviceMode, UI_REQUEST.NOT_INITIALIZE];
34345
+ validateParams(this.payload, [
34346
+ { name: 'path', required: true },
34347
+ { name: 'payload', type: 'string', required: true },
34348
+ ]);
34349
+ const { path, payload } = this.payload;
34350
+ const addressN = validatePath(path, 3);
34351
+ this.params = {
34352
+ address_n: addressN,
34353
+ siwa_payload: payload,
34354
+ };
34355
+ }
34356
+ getVersionRange() {
34357
+ return {
34358
+ pro: {
34359
+ min: '4.16.0',
34360
+ },
34361
+ };
34362
+ }
34363
+ run() {
34364
+ return __awaiter(this, void 0, void 0, function* () {
34365
+ const res = yield this.device.commands.typedCall('AptosSignSIWAMessage', 'AptosMessageSignature', Object.assign({}, this.params));
34366
+ const { address, signature } = res.message;
34367
+ return Promise.resolve({
34368
+ path: serializedPath(this.params.address_n),
34369
+ address,
34370
+ signature,
34371
+ });
34372
+ });
34373
+ }
34374
+ }
34375
+
34367
34376
  class AlgoGetAddress extends BaseMethod {
34368
34377
  constructor() {
34369
34378
  super(...arguments);
@@ -38588,6 +38597,7 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
38588
38597
  aptosGetPublicKey: AptosGetPublicKey,
38589
38598
  aptosSignTransaction: AptosSignTransaction,
38590
38599
  aptosSignMessage: AptosSignMessage,
38600
+ aptosSignInMessage: AptosSignInMessage,
38591
38601
  algoGetAddress: AlgoGetAddress,
38592
38602
  algoSignTransaction: AlgoSignTransaction,
38593
38603
  cosmosGetAddress: CosmosGetAddress,
@@ -1 +1 @@
1
- {"version":3,"file":"inject.d.ts","sourceRoot":"","sources":["../src/inject.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAetC,QAAA,MAAM,eAAe,OAAQ,MAAM,WAAW,GAAG,EAAE,SAKlD,CAAC;AAEF,QAAA,MAAM,eAAe,OAAQ,MAAM,SAElC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAC;AAE5C,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE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,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC7C;AAED,eAAO,MAAM,MAAM,gGAShB,SAAS,KAAG,OAiCd,CAAC;AAEF,eAAO,MAAM,aAAa,SAClB,OAAO,CAAC,MAAM,CAAC,KACpB,KACD,OAAO,EACL,IAAI,GACJ,KAAK,GACL,MAAM,GACN,oBAAoB,GACpB,MAAM,GACN,MAAM,GACN,SAAS,GACT,YAAY,GACZ,QAAQ,GACR,gBAAgB,GAChB,iBAAiB,CAmTnB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { AptosMessageSignature as HardwareAptosMessageSignature } from '@onekeyfe/hd-transport';
2
+ import type { CommonParams, Response } from '../params';
3
+ export type AptosSignInMessageSignature = {
4
+ path: string;
5
+ } & HardwareAptosMessageSignature;
6
+ export type AptosSignInMessageParams = {
7
+ path: string | number[];
8
+ payload: string;
9
+ };
10
+ export declare function aptosSignInMessage(connectId: string, deviceId: string, params: CommonParams & AptosSignInMessageParams): Response<AptosSignInMessageSignature>;
11
+ //# sourceMappingURL=aptosSignInMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aptosSignInMessage.d.ts","sourceRoot":"","sources":["../../../src/types/api/aptosSignInMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,IAAI,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;CACd,GAAG,6BAA6B,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,wBAAwB,GAC9C,QAAQ,CAAC,2BAA2B,CAAC,CAAC"}
@@ -3,7 +3,6 @@ export type EVMSignedTx = {
3
3
  v: string;
4
4
  r: string;
5
5
  s: string;
6
- authorizationSignatures?: EVMAuthorizationSignature[];
7
6
  };
8
7
  export type EVMTransaction = {
9
8
  to: string;
@@ -33,34 +32,9 @@ export type EVMTransactionEIP1559 = {
33
32
  maxPriorityFeePerGas: string;
34
33
  accessList?: EVMAccessList[];
35
34
  };
36
- export type EVMAuthorizationSignature = {
37
- yParity: number;
38
- r: string;
39
- s: string;
40
- };
41
- export type EVMAuthorization = {
42
- addressN?: number[];
43
- chainId: number;
44
- address: string;
45
- nonce: string;
46
- signature?: EVMAuthorizationSignature;
47
- };
48
- export type EVMTransactionEIP7702 = {
49
- to: string;
50
- value: string;
51
- gasLimit: string;
52
- gasPrice?: typeof undefined;
53
- nonce: string;
54
- data?: string;
55
- chainId: number;
56
- maxFeePerGas: string;
57
- maxPriorityFeePerGas: string;
58
- accessList?: EVMAccessList[];
59
- authorizationList: EVMAuthorization[];
60
- };
61
35
  export type EVMSignTransactionParams = {
62
36
  path: string | number[];
63
- transaction: EVMTransaction | EVMTransactionEIP1559 | EVMTransactionEIP7702;
37
+ transaction: EVMTransaction | EVMTransactionEIP1559;
64
38
  };
65
39
  export declare function evmSignTransaction(connectId: string, deviceId: string, params: CommonParams & EVMSignTransactionParams): Response<EVMSignedTx>;
66
40
  //# sourceMappingURL=evmSignTransaction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evmSignTransaction.d.ts","sourceRoot":"","sources":["../../../src/types/api/evmSignTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAExD,MAAM,MAAM,WAA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AAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,SAAS,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,SAAS,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,SAAS,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,GAAG,qBAAqB,CAAC;CACrD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,YAAY,GAAG,wBAAwB,GAC9C,QAAQ,CAAC,WAAW,CAAC,CAAC"}
@@ -18,7 +18,7 @@ export type { EVMAddress, EVMGetAddressParams } from './evmGetAddress';
18
18
  export type { EVMPublicKey, EVMGetPublicKeyParams } from './evmGetPublicKey';
19
19
  export type { EVMSignMessageParams } from './evmSignMessage';
20
20
  export type { EVMSignMessageEIP712Params } from './evmSignMessageEIP712';
21
- export type { EVMTransaction, EVMTransactionEIP1559, EVMTransactionEIP7702, EVMAuthorization, EVMAuthorizationSignature, EVMSignedTx, EVMSignTransactionParams, EVMAccessList, } from './evmSignTransaction';
21
+ export type { EVMTransaction, EVMTransactionEIP1559, EVMSignedTx, EVMSignTransactionParams, EVMAccessList, } from './evmSignTransaction';
22
22
  export type { EthereumSignTypedDataTypes, EthereumSignTypedDataTypeProperty, EthereumSignTypedDataMessage, EVMSignTypedDataParams, } from './evmSignTypedData';
23
23
  export type { EVMVerifyMessageParams } from './evmVerifyMessage';
24
24
  export type { StarcoinAddress, StarcoinGetAddressParams } from './starcoinGetAddress';
@@ -46,6 +46,7 @@ export type { NearSignTransactionParams } from './nearSignTransaction';
46
46
  export type { AptosAddress, AptosGetAddressParams } from './aptosGetAddress';
47
47
  export type { AptosPublicKey, AptosGetPublicKeyParams } from './aptosGetPublicKey';
48
48
  export type { AptosMessageSignature, AptosSignMessageParams } from './aptosSignMessage';
49
+ export type { AptosSignInMessageSignature, AptosSignInMessageParams } from './aptosSignInMessage';
49
50
  export type { AptosSignedTx, AptosSignTransactionParams } from './aptosSignTransaction';
50
51
  export type { AlgoAddress, AlgoGetAddressParams } from './algoGetAddress';
51
52
  export type { AlgoSignedTx, AlgoSignTransactionParams } from './algoSignTransaction';
@@ -57,6 +58,7 @@ export type { SuiPublicKey, SuiGetPublicKeyParams } from './suiGetPublicKey';
57
58
  export type { SuiSignMessageParams } from './suiSignMessage';
58
59
  export type { SuiSignedTx, SuiSignTransactionParams } from './suiSignTransaction';
59
60
  export type { CardanoGetAddressMethodParams, CardanoAddress, CardanoGetAddressParams, } from './cardanoGetAddress';
61
+ export type { CardanoSignMessageMethodParams, CardanoSignMessageParams, } from './cardanoSignMessage';
60
62
  export type { CardanoSignTransaction, CardanoSignedTxData } from './cardano';
61
63
  export type { FilecoinAddress, FilecoinGetAddressParams } from './filecoinGetAddress';
62
64
  export type { FilecoinSignTransactionParams, FilecoinSignedTx } from './filecoinSignTransaction';