@clonegod/ttd-bsc-common 1.0.73 → 1.0.75

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.
@@ -13,17 +13,29 @@ exports.SoulPointSignature = void 0;
13
13
  const ethers_1 = require("ethers");
14
14
  class SoulPointSignature {
15
15
  static generate48SPSignature(privateKey, txs) {
16
+ var _a;
16
17
  try {
17
18
  const wallet = new ethers_1.ethers.Wallet(privateKey);
19
+ const keccak256 = ((_a = ethers_1.ethers.utils) === null || _a === void 0 ? void 0 : _a.keccak256) || ethers_1.ethers.keccak256;
18
20
  const txHashes = txs.map(tx => {
19
21
  if (tx.startsWith('0x')) {
20
- return ethers_1.ethers.utils.keccak256(tx);
22
+ return keccak256(tx);
21
23
  }
22
24
  return tx;
23
25
  });
24
- const concatenatedHashes = ethers_1.ethers.utils.concat(txHashes);
25
- const messageHash = ethers_1.ethers.utils.keccak256(concatenatedHashes);
26
- const signature = wallet._signingKey().signDigest(messageHash);
26
+ const concatenatedHashes = ethers_1.ethers.utils
27
+ ? ethers_1.ethers.utils.concat(txHashes)
28
+ : ethers_1.ethers.concat(txHashes);
29
+ const messageHash = ethers_1.ethers.utils
30
+ ? ethers_1.ethers.utils.keccak256(concatenatedHashes)
31
+ : ethers_1.ethers.keccak256(concatenatedHashes);
32
+ let signature;
33
+ try {
34
+ signature = wallet._signingKey().signDigest(messageHash);
35
+ }
36
+ catch (error) {
37
+ signature = wallet.signingKey.signDigest(messageHash);
38
+ }
27
39
  const r = signature.r.slice(2).padStart(64, '0');
28
40
  const s = signature.s.slice(2).padStart(64, '0');
29
41
  const v = signature.recoveryParam.toString(16).padStart(2, '0');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",
@@ -14,7 +14,7 @@
14
14
  "push": "npm run build && npm publish"
15
15
  },
16
16
  "dependencies": {
17
- "@clonegod/ttd-core": "2.0.92",
17
+ "@clonegod/ttd-core": "2.0.94",
18
18
  "axios": "^1.12.0",
19
19
  "dotenv": "^16.4.7",
20
20
  "ethers": "^5.8.0"