@layerzerolabs/onesig-core 0.0.7 → 0.0.8

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 (2) hide show
  1. package/dist/index.js +8 -6
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -75,16 +76,16 @@ function encodeLeafHeader({ targetOneSigAddress, oneSigId, nonce }) {
75
76
  if (targetOneSigAddress.byteLength !== 32) {
76
77
  throw new Error("Contract address must be 32 bytes");
77
78
  }
78
- const storage = Buffer.alloc(73);
79
+ const storage = Buffer.alloc(49);
79
80
  storage[0] = 1;
80
81
  const idStr = oneSigId.toString(16).padStart(16, "0");
81
- const nonceStr = nonce.toString(16).padStart(64, "0");
82
+ const nonceStr = nonce.toString(16).padStart(16, "0");
82
83
  for (let i = 0; i < 32; i++) {
83
84
  if (i < 8) {
84
85
  storage[i + 1] = readByteFromHex(idStr, i);
86
+ storage[i + 41] = readByteFromHex(nonceStr, i);
85
87
  }
86
88
  storage[i + 9] = targetOneSigAddress[i];
87
- storage[i + 41] = readByteFromHex(nonceStr, i);
88
89
  }
89
90
  return storage;
90
91
  }
@@ -101,7 +102,7 @@ function encodeLeaf(gen, index) {
101
102
  }),
102
103
  gen.encodeCalls(leaf.calls)
103
104
  ]);
104
- return import_ethers.ethers.utils.keccak256(leafData);
105
+ return import_ethers.ethers.utils.keccak256(import_ethers.ethers.utils.keccak256(leafData));
105
106
  }
106
107
  function makeOneSigTree(input) {
107
108
  const encodedLeafs = [];
@@ -184,7 +185,7 @@ var _Signature = class _Signature {
184
185
  return signature.get();
185
186
  });
186
187
  let orderedSignatures;
187
- if (!sortMethod) {
188
+ if (sortMethod === false) {
188
189
  orderedSignatures = signatureBuffers;
189
190
  } else {
190
191
  let addresses;
@@ -208,7 +209,8 @@ var _Signature = class _Signature {
208
209
  });
209
210
  orderedSignatures = indexMapping.map((index) => signatureBuffers[index]);
210
211
  }
211
- return new this(Buffer.concat(orderedSignatures));
212
+ const combined = Buffer.concat(orderedSignatures);
213
+ return new this(combined);
212
214
  }
213
215
  };
214
216
  _value = new WeakMap();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@layerzerolabs/onesig-core",
3
- "version": "0.0.7",
4
- "license": "MIT",
3
+ "version": "0.0.8",
4
+ "license": "GPL-3.0-only",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -11,6 +11,7 @@
11
11
  "./package.json": "./package.json"
12
12
  },
13
13
  "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
14
15
  "files": [
15
16
  "dist/**/*"
16
17
  ],