@snapshot-labs/snapshot.js 0.4.0 → 0.4.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.
@@ -31,6 +31,7 @@ export interface Vote {
31
31
  proposal: string;
32
32
  type: string;
33
33
  choice: number | number[] | string;
34
+ privacy?: string;
34
35
  }
35
36
  export interface Follow {
36
37
  from?: string;
@@ -1,2 +1,2 @@
1
1
  export declare function getHash(data: any): string;
2
- export declare function verify(address: any, sig: any, data: any): Promise<boolean>;
2
+ export declare function verify(address: any, sig: any, data: any, network?: string): Promise<boolean>;
@@ -353,7 +353,9 @@ var Client = /** @class */ (function () {
353
353
  type = type2 ? voteString2Types : voteStringTypes;
354
354
  message.choice = JSON.stringify(message.choice);
355
355
  }
356
- // @ts-ignore
356
+ if ((message === null || message === void 0 ? void 0 : message.privacy) === 'shutter')
357
+ type = type2 ? voteString2Types : voteStringTypes;
358
+ delete message.privacy;
357
359
  delete message.type;
358
360
  return [4 /*yield*/, this.sign(web3, address, message, type)];
359
361
  case 1: return [2 /*return*/, _a.sent()];
@@ -1002,7 +1004,8 @@ var definitions$2 = {
1002
1004
  "number",
1003
1005
  "array",
1004
1006
  "object",
1005
- "boolean"
1007
+ "boolean",
1008
+ "string"
1006
1009
  ],
1007
1010
  title: "choice"
1008
1011
  },
@@ -2393,8 +2396,8 @@ var networks = {
2393
2396
  testnet: true,
2394
2397
  multicall: "0x08411ADd0b5AA8ee47563b146743C13b3556c9Cc",
2395
2398
  rpc: [
2396
- "https://rpc-mumbai.matic.today",
2397
- "https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mumbai/archive"
2399
+ "https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive",
2400
+ "https://rpc-mumbai.matic.today"
2398
2401
  ],
2399
2402
  ws: [
2400
2403
  "wss://ws-mumbai.matic.today"
@@ -2744,7 +2747,8 @@ function getHash(data) {
2744
2747
  var domain = data.domain, types = data.types, message = data.message;
2745
2748
  return hash._TypedDataEncoder.hash(domain, types, message);
2746
2749
  }
2747
- function verify$1(address, sig, data) {
2750
+ function verify$1(address, sig, data, network) {
2751
+ if (network === void 0) { network = '1'; }
2748
2752
  return __awaiter(this, void 0, void 0, function () {
2749
2753
  var domain, types, message, hash, recoverAddress;
2750
2754
  return __generator(this, function (_a) {
@@ -2764,7 +2768,7 @@ function verify$1(address, sig, data) {
2764
2768
  console.log('Could not recoverAddress:' + e.message);
2765
2769
  }
2766
2770
  console.log('Check EIP1271 signature');
2767
- return [4 /*yield*/, verify(address, sig, hash)];
2771
+ return [4 /*yield*/, verify(address, sig, hash, network)];
2768
2772
  case 1: return [2 /*return*/, _a.sent()];
2769
2773
  }
2770
2774
  });
@@ -344,7 +344,9 @@ var Client = /** @class */ (function () {
344
344
  type = type2 ? voteString2Types : voteStringTypes;
345
345
  message.choice = JSON.stringify(message.choice);
346
346
  }
347
- // @ts-ignore
347
+ if ((message === null || message === void 0 ? void 0 : message.privacy) === 'shutter')
348
+ type = type2 ? voteString2Types : voteStringTypes;
349
+ delete message.privacy;
348
350
  delete message.type;
349
351
  return [4 /*yield*/, this.sign(web3, address, message, type)];
350
352
  case 1: return [2 /*return*/, _a.sent()];
@@ -993,7 +995,8 @@ var definitions$2 = {
993
995
  "number",
994
996
  "array",
995
997
  "object",
996
- "boolean"
998
+ "boolean",
999
+ "string"
997
1000
  ],
998
1001
  title: "choice"
999
1002
  },
@@ -2384,8 +2387,8 @@ var networks = {
2384
2387
  testnet: true,
2385
2388
  multicall: "0x08411ADd0b5AA8ee47563b146743C13b3556c9Cc",
2386
2389
  rpc: [
2387
- "https://rpc-mumbai.matic.today",
2388
- "https://speedy-nodes-nyc.moralis.io/f2963e29bec0de5787da3164/polygon/mumbai/archive"
2390
+ "https://speedy-nodes-nyc.moralis.io/9e03baabdc27be2a35bdec4a/polygon/mumbai/archive",
2391
+ "https://rpc-mumbai.matic.today"
2389
2392
  ],
2390
2393
  ws: [
2391
2394
  "wss://ws-mumbai.matic.today"
@@ -2735,7 +2738,8 @@ function getHash(data) {
2735
2738
  var domain = data.domain, types = data.types, message = data.message;
2736
2739
  return _TypedDataEncoder.hash(domain, types, message);
2737
2740
  }
2738
- function verify$1(address, sig, data) {
2741
+ function verify$1(address, sig, data, network) {
2742
+ if (network === void 0) { network = '1'; }
2739
2743
  return __awaiter(this, void 0, void 0, function () {
2740
2744
  var domain, types, message, hash, recoverAddress;
2741
2745
  return __generator(this, function (_a) {
@@ -2755,7 +2759,7 @@ function verify$1(address, sig, data) {
2755
2759
  console.log('Could not recoverAddress:' + e.message);
2756
2760
  }
2757
2761
  console.log('Check EIP1271 signature');
2758
- return [4 /*yield*/, verify(address, sig, hash)];
2762
+ return [4 /*yield*/, verify(address, sig, hash, network)];
2759
2763
  case 1: return [2 /*return*/, _a.sent()];
2760
2764
  }
2761
2765
  });