@snapshot-labs/snapshot.js 0.3.14 → 0.3.18
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/index.d.ts +3 -0
- package/dist/schemas/index.d.ts +3 -0
- package/dist/snapshot.cjs.js +13 -10
- package/dist/snapshot.esm.js +13 -10
- package/dist/snapshot.min.js +6 -6
- package/package.json +1 -1
- package/src/networks.json +1 -1
- package/src/schemas/space.json +3 -0
- package/src/sign/index.ts +2 -3
- package/src/voting/rankedChoice.ts +8 -5
package/dist/index.d.ts
CHANGED
package/dist/schemas/index.d.ts
CHANGED
package/dist/snapshot.cjs.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var fetch = require('cross-fetch');
|
|
4
|
-
var providers$1 = require('@ethersproject/providers');
|
|
5
|
-
var wallet = require('@ethersproject/wallet');
|
|
6
4
|
var bytes = require('@ethersproject/bytes');
|
|
7
5
|
var abi = require('@ethersproject/abi');
|
|
8
6
|
var contracts = require('@ethersproject/contracts');
|
|
@@ -11,6 +9,8 @@ var jsonToGraphqlQuery = require('json-to-graphql-query');
|
|
|
11
9
|
var Ajv = require('ajv');
|
|
12
10
|
var addFormats = require('ajv-formats');
|
|
13
11
|
var set = require('lodash.set');
|
|
12
|
+
var providers$1 = require('@ethersproject/providers');
|
|
13
|
+
var wallet = require('@ethersproject/wallet');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
16
|
|
|
@@ -262,10 +262,7 @@ var Client = /** @class */ (function () {
|
|
|
262
262
|
return __generator(this, function (_a) {
|
|
263
263
|
switch (_a.label) {
|
|
264
264
|
case 0:
|
|
265
|
-
|
|
266
|
-
signer = web3;
|
|
267
|
-
if (web3 instanceof providers$1.Web3Provider)
|
|
268
|
-
signer = web3.getSigner();
|
|
265
|
+
signer = (web3 === null || web3 === void 0 ? void 0 : web3.getSigner) ? web3.getSigner() : web3;
|
|
269
266
|
if (!message.from)
|
|
270
267
|
message.from = address;
|
|
271
268
|
if (!message.timestamp)
|
|
@@ -785,6 +782,9 @@ var definitions = {
|
|
|
785
782
|
},
|
|
786
783
|
blind: {
|
|
787
784
|
type: "boolean"
|
|
785
|
+
},
|
|
786
|
+
hideAbstain: {
|
|
787
|
+
type: "boolean"
|
|
788
788
|
}
|
|
789
789
|
},
|
|
790
790
|
additionalProperties: false
|
|
@@ -990,12 +990,12 @@ var networks = {
|
|
|
990
990
|
multicall: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441",
|
|
991
991
|
ensResolver: "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
|
|
992
992
|
rpc: [
|
|
993
|
-
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive",
|
|
994
993
|
{
|
|
995
994
|
url: "https://api-geth-archive.ankr.com",
|
|
996
995
|
user: "balancer_user",
|
|
997
996
|
password: "balancerAnkr20201015"
|
|
998
997
|
},
|
|
998
|
+
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive",
|
|
999
999
|
"https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main",
|
|
1000
1000
|
"https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985",
|
|
1001
1001
|
"https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv",
|
|
@@ -2034,9 +2034,12 @@ function irv(ballots, rounds) {
|
|
|
2034
2034
|
var votes = Object.entries(ballots.reduce(function (votes, _a, i, src) {
|
|
2035
2035
|
var _b = __read(_a, 1), v = _b[0];
|
|
2036
2036
|
votes[v[0]][0] += src[i][1];
|
|
2037
|
-
votes[v[0]][1].length > 1
|
|
2038
|
-
|
|
2039
|
-
|
|
2037
|
+
if (votes[v[0]][1].length > 1)
|
|
2038
|
+
votes[v[0]][1] = votes[v[0]][1].map(function (score, sI) { return score + src[i][2][sI]; });
|
|
2039
|
+
else
|
|
2040
|
+
votes[v[0]][1] = [
|
|
2041
|
+
votes[v[0]][1].concat(src[i][2]).reduce(function (a, b) { return a + b; }, 0)
|
|
2042
|
+
];
|
|
2040
2043
|
return votes;
|
|
2041
2044
|
}, Object.assign.apply(Object, __spread([{}], candidates.map(function (c) {
|
|
2042
2045
|
var _a;
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import fetch from 'cross-fetch';
|
|
2
|
-
import { Web3Provider, StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
3
|
-
import { Wallet, verifyTypedData } from '@ethersproject/wallet';
|
|
4
2
|
import { hexlify, arrayify } from '@ethersproject/bytes';
|
|
5
3
|
import { Interface } from '@ethersproject/abi';
|
|
6
4
|
import { Contract } from '@ethersproject/contracts';
|
|
@@ -9,6 +7,8 @@ import { jsonToGraphQLQuery } from 'json-to-graphql-query';
|
|
|
9
7
|
import Ajv from 'ajv';
|
|
10
8
|
import addFormats from 'ajv-formats';
|
|
11
9
|
import set from 'lodash.set';
|
|
10
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
11
|
+
import { verifyTypedData } from '@ethersproject/wallet';
|
|
12
12
|
|
|
13
13
|
/*! *****************************************************************************
|
|
14
14
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -253,10 +253,7 @@ var Client = /** @class */ (function () {
|
|
|
253
253
|
return __generator(this, function (_a) {
|
|
254
254
|
switch (_a.label) {
|
|
255
255
|
case 0:
|
|
256
|
-
|
|
257
|
-
signer = web3;
|
|
258
|
-
if (web3 instanceof Web3Provider)
|
|
259
|
-
signer = web3.getSigner();
|
|
256
|
+
signer = (web3 === null || web3 === void 0 ? void 0 : web3.getSigner) ? web3.getSigner() : web3;
|
|
260
257
|
if (!message.from)
|
|
261
258
|
message.from = address;
|
|
262
259
|
if (!message.timestamp)
|
|
@@ -776,6 +773,9 @@ var definitions = {
|
|
|
776
773
|
},
|
|
777
774
|
blind: {
|
|
778
775
|
type: "boolean"
|
|
776
|
+
},
|
|
777
|
+
hideAbstain: {
|
|
778
|
+
type: "boolean"
|
|
779
779
|
}
|
|
780
780
|
},
|
|
781
781
|
additionalProperties: false
|
|
@@ -981,12 +981,12 @@ var networks = {
|
|
|
981
981
|
multicall: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441",
|
|
982
982
|
ensResolver: "0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41",
|
|
983
983
|
rpc: [
|
|
984
|
-
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive",
|
|
985
984
|
{
|
|
986
985
|
url: "https://api-geth-archive.ankr.com",
|
|
987
986
|
user: "balancer_user",
|
|
988
987
|
password: "balancerAnkr20201015"
|
|
989
988
|
},
|
|
989
|
+
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/eth/mainnet/archive",
|
|
990
990
|
"https://apis.ankr.com/e62bc219f9c9462b8749defe472d2dc5/6106d4a3ec1d1bcc87ec72158f8fd089/eth/archive/main",
|
|
991
991
|
"https://eth-archival.gateway.pokt.network/v1/5f76124fb90218002e9ce985",
|
|
992
992
|
"https://eth-mainnet.alchemyapi.io/v2/4bdDVB5QAaorY2UE-GBUbM2yQB3QJqzv",
|
|
@@ -2025,9 +2025,12 @@ function irv(ballots, rounds) {
|
|
|
2025
2025
|
var votes = Object.entries(ballots.reduce(function (votes, _a, i, src) {
|
|
2026
2026
|
var _b = __read(_a, 1), v = _b[0];
|
|
2027
2027
|
votes[v[0]][0] += src[i][1];
|
|
2028
|
-
votes[v[0]][1].length > 1
|
|
2029
|
-
|
|
2030
|
-
|
|
2028
|
+
if (votes[v[0]][1].length > 1)
|
|
2029
|
+
votes[v[0]][1] = votes[v[0]][1].map(function (score, sI) { return score + src[i][2][sI]; });
|
|
2030
|
+
else
|
|
2031
|
+
votes[v[0]][1] = [
|
|
2032
|
+
votes[v[0]][1].concat(src[i][2]).reduce(function (a, b) { return a + b; }, 0)
|
|
2033
|
+
];
|
|
2031
2034
|
return votes;
|
|
2032
2035
|
}, Object.assign.apply(Object, __spread([{}], candidates.map(function (c) {
|
|
2033
2036
|
var _a;
|