@snapshot-labs/snapshot.js 0.4.36 → 0.4.38
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.
- package/dist/snapshot.cjs.js +7 -9
- package/dist/snapshot.esm.js +7 -9
- package/dist/snapshot.min.js +2 -2
- package/package.json +1 -1
- package/src/sign/eip1271.ts +0 -2
- package/src/sign/index.ts +3 -3
- package/src/sign/utils.ts +1 -1
- package/src/utils/provider.ts +4 -1
- package/src/utils.ts +1 -2
package/dist/snapshot.cjs.js
CHANGED
|
@@ -363,10 +363,11 @@ var Client = /** @class */ (function () {
|
|
|
363
363
|
};
|
|
364
364
|
Client.prototype.vote = function (web3, address, message) {
|
|
365
365
|
return __awaiter(this, void 0, void 0, function () {
|
|
366
|
-
var type2, type;
|
|
366
|
+
var isShutter, type2, type;
|
|
367
367
|
return __generator(this, function (_a) {
|
|
368
368
|
switch (_a.label) {
|
|
369
369
|
case 0:
|
|
370
|
+
isShutter = (message === null || message === void 0 ? void 0 : message.privacy) === 'shutter';
|
|
370
371
|
if (!message.reason)
|
|
371
372
|
message.reason = '';
|
|
372
373
|
if (!message.app)
|
|
@@ -375,11 +376,11 @@ var Client = /** @class */ (function () {
|
|
|
375
376
|
type = type2 ? vote2Types : voteTypes;
|
|
376
377
|
if (['approval', 'ranked-choice'].includes(message.type))
|
|
377
378
|
type = type2 ? voteArray2Types : voteArrayTypes;
|
|
378
|
-
if (['quadratic', 'weighted'].includes(message.type)) {
|
|
379
|
+
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
|
|
379
380
|
type = type2 ? voteString2Types : voteStringTypes;
|
|
380
381
|
message.choice = JSON.stringify(message.choice);
|
|
381
382
|
}
|
|
382
|
-
if (
|
|
383
|
+
if (isShutter)
|
|
383
384
|
type = type2 ? voteString2Types : voteStringTypes;
|
|
384
385
|
delete message.privacy;
|
|
385
386
|
delete message.type;
|
|
@@ -1467,7 +1468,6 @@ function verifyDefault(address, sig, hash, provider) {
|
|
|
1467
1468
|
return [3 /*break*/, 4];
|
|
1468
1469
|
case 3:
|
|
1469
1470
|
e_1 = _a.sent();
|
|
1470
|
-
console.log(e_1);
|
|
1471
1471
|
return [2 /*return*/, false];
|
|
1472
1472
|
case 4: return [2 /*return*/, returnValue.toLowerCase() === magicValue.toLowerCase()];
|
|
1473
1473
|
}
|
|
@@ -1491,7 +1491,6 @@ function verifyOldVersion(address, sig, hash, provider) {
|
|
|
1491
1491
|
return [3 /*break*/, 4];
|
|
1492
1492
|
case 3:
|
|
1493
1493
|
e_2 = _a.sent();
|
|
1494
|
-
console.log(e_2);
|
|
1495
1494
|
return [2 /*return*/, false];
|
|
1496
1495
|
case 4: return [2 /*return*/, returnValue.toLowerCase() === magicValue.toLowerCase()];
|
|
1497
1496
|
}
|
|
@@ -1539,7 +1538,7 @@ function verify$1(address, sig, data, network) {
|
|
|
1539
1538
|
return [2 /*return*/, true];
|
|
1540
1539
|
}
|
|
1541
1540
|
catch (e) {
|
|
1542
|
-
console.log('Could not recoverAddress:' + e.message);
|
|
1541
|
+
// console.log('Could not recoverAddress:' + e.message);
|
|
1543
1542
|
}
|
|
1544
1543
|
return [4 /*yield*/, verify(address, sig, hash, network)];
|
|
1545
1544
|
case 1:
|
|
@@ -3803,9 +3802,8 @@ function getSpaceUri(id, network) {
|
|
|
3803
3802
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3804
3803
|
case 2:
|
|
3805
3804
|
e_4 = _a.sent();
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
case 3: return [2 /*return*/, false];
|
|
3805
|
+
return [2 /*return*/, false];
|
|
3806
|
+
case 3: return [2 /*return*/];
|
|
3809
3807
|
}
|
|
3810
3808
|
});
|
|
3811
3809
|
});
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -354,10 +354,11 @@ var Client = /** @class */ (function () {
|
|
|
354
354
|
};
|
|
355
355
|
Client.prototype.vote = function (web3, address, message) {
|
|
356
356
|
return __awaiter(this, void 0, void 0, function () {
|
|
357
|
-
var type2, type;
|
|
357
|
+
var isShutter, type2, type;
|
|
358
358
|
return __generator(this, function (_a) {
|
|
359
359
|
switch (_a.label) {
|
|
360
360
|
case 0:
|
|
361
|
+
isShutter = (message === null || message === void 0 ? void 0 : message.privacy) === 'shutter';
|
|
361
362
|
if (!message.reason)
|
|
362
363
|
message.reason = '';
|
|
363
364
|
if (!message.app)
|
|
@@ -366,11 +367,11 @@ var Client = /** @class */ (function () {
|
|
|
366
367
|
type = type2 ? vote2Types : voteTypes;
|
|
367
368
|
if (['approval', 'ranked-choice'].includes(message.type))
|
|
368
369
|
type = type2 ? voteArray2Types : voteArrayTypes;
|
|
369
|
-
if (['quadratic', 'weighted'].includes(message.type)) {
|
|
370
|
+
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
|
|
370
371
|
type = type2 ? voteString2Types : voteStringTypes;
|
|
371
372
|
message.choice = JSON.stringify(message.choice);
|
|
372
373
|
}
|
|
373
|
-
if (
|
|
374
|
+
if (isShutter)
|
|
374
375
|
type = type2 ? voteString2Types : voteStringTypes;
|
|
375
376
|
delete message.privacy;
|
|
376
377
|
delete message.type;
|
|
@@ -1458,7 +1459,6 @@ function verifyDefault(address, sig, hash, provider) {
|
|
|
1458
1459
|
return [3 /*break*/, 4];
|
|
1459
1460
|
case 3:
|
|
1460
1461
|
e_1 = _a.sent();
|
|
1461
|
-
console.log(e_1);
|
|
1462
1462
|
return [2 /*return*/, false];
|
|
1463
1463
|
case 4: return [2 /*return*/, returnValue.toLowerCase() === magicValue.toLowerCase()];
|
|
1464
1464
|
}
|
|
@@ -1482,7 +1482,6 @@ function verifyOldVersion(address, sig, hash, provider) {
|
|
|
1482
1482
|
return [3 /*break*/, 4];
|
|
1483
1483
|
case 3:
|
|
1484
1484
|
e_2 = _a.sent();
|
|
1485
|
-
console.log(e_2);
|
|
1486
1485
|
return [2 /*return*/, false];
|
|
1487
1486
|
case 4: return [2 /*return*/, returnValue.toLowerCase() === magicValue.toLowerCase()];
|
|
1488
1487
|
}
|
|
@@ -1530,7 +1529,7 @@ function verify$1(address, sig, data, network) {
|
|
|
1530
1529
|
return [2 /*return*/, true];
|
|
1531
1530
|
}
|
|
1532
1531
|
catch (e) {
|
|
1533
|
-
console.log('Could not recoverAddress:' + e.message);
|
|
1532
|
+
// console.log('Could not recoverAddress:' + e.message);
|
|
1534
1533
|
}
|
|
1535
1534
|
return [4 /*yield*/, verify(address, sig, hash, network)];
|
|
1536
1535
|
case 1:
|
|
@@ -3794,9 +3793,8 @@ function getSpaceUri(id, network) {
|
|
|
3794
3793
|
case 1: return [2 /*return*/, _a.sent()];
|
|
3795
3794
|
case 2:
|
|
3796
3795
|
e_4 = _a.sent();
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
case 3: return [2 /*return*/, false];
|
|
3796
|
+
return [2 /*return*/, false];
|
|
3797
|
+
case 3: return [2 /*return*/];
|
|
3800
3798
|
}
|
|
3801
3799
|
});
|
|
3802
3800
|
});
|