@snapshot-labs/snapshot.js 0.3.12 → 0.3.16
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 +22 -4
- package/dist/snapshot.esm.js +22 -4
- package/dist/snapshot.min.js +3 -3
- package/package.json +1 -1
- package/src/networks/44.png +0 -0
- package/src/networks.json +11 -1
- package/src/schemas/space.json +3 -0
- 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
|
@@ -785,6 +785,9 @@ var definitions = {
|
|
|
785
785
|
},
|
|
786
786
|
blind: {
|
|
787
787
|
type: "boolean"
|
|
788
|
+
},
|
|
789
|
+
hideAbstain: {
|
|
790
|
+
type: "boolean"
|
|
788
791
|
}
|
|
789
792
|
},
|
|
790
793
|
additionalProperties: false
|
|
@@ -1117,6 +1120,18 @@ var networks = {
|
|
|
1117
1120
|
"wss://eth-kovan.ws.alchemyapi.io/v2/QCsM2iU0bQ49eGDmZ7-Y--Wpu0lVWXSO"
|
|
1118
1121
|
],
|
|
1119
1122
|
explorer: "https://kovan.etherscan.io"
|
|
1123
|
+
},
|
|
1124
|
+
"44": {
|
|
1125
|
+
key: "44",
|
|
1126
|
+
name: "Crab Network",
|
|
1127
|
+
shortName: "Crab",
|
|
1128
|
+
chainId: 44,
|
|
1129
|
+
network: "mainnet",
|
|
1130
|
+
multicall: "0x4617D470F847Ce166019d19a7944049ebB017400",
|
|
1131
|
+
rpc: [
|
|
1132
|
+
"https://crab-rpc.darwinia.network"
|
|
1133
|
+
],
|
|
1134
|
+
explorer: "https://crab.subscan.io/"
|
|
1120
1135
|
},
|
|
1121
1136
|
"50": {
|
|
1122
1137
|
key: "50",
|
|
@@ -1141,8 +1156,8 @@ var networks = {
|
|
|
1141
1156
|
network: "mainnet",
|
|
1142
1157
|
multicall: "0x1ee38d535d541c55c9dae27b12edf090c608e6fb",
|
|
1143
1158
|
rpc: [
|
|
1144
|
-
"https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
|
|
1145
1159
|
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive",
|
|
1160
|
+
"https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
|
|
1146
1161
|
"https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7",
|
|
1147
1162
|
"https://bsc-private-dataseed1.nariox.org",
|
|
1148
1163
|
"https://bsc-private-dataseed2.nariox.org",
|
|
@@ -2022,9 +2037,12 @@ function irv(ballots, rounds) {
|
|
|
2022
2037
|
var votes = Object.entries(ballots.reduce(function (votes, _a, i, src) {
|
|
2023
2038
|
var _b = __read(_a, 1), v = _b[0];
|
|
2024
2039
|
votes[v[0]][0] += src[i][1];
|
|
2025
|
-
votes[v[0]][1].length > 1
|
|
2026
|
-
|
|
2027
|
-
|
|
2040
|
+
if (votes[v[0]][1].length > 1)
|
|
2041
|
+
votes[v[0]][1] = votes[v[0]][1].map(function (score, sI) { return score + src[i][2][sI]; });
|
|
2042
|
+
else
|
|
2043
|
+
votes[v[0]][1] = [
|
|
2044
|
+
votes[v[0]][1].concat(src[i][2]).reduce(function (a, b) { return a + b; }, 0)
|
|
2045
|
+
];
|
|
2028
2046
|
return votes;
|
|
2029
2047
|
}, Object.assign.apply(Object, __spread([{}], candidates.map(function (c) {
|
|
2030
2048
|
var _a;
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -776,6 +776,9 @@ var definitions = {
|
|
|
776
776
|
},
|
|
777
777
|
blind: {
|
|
778
778
|
type: "boolean"
|
|
779
|
+
},
|
|
780
|
+
hideAbstain: {
|
|
781
|
+
type: "boolean"
|
|
779
782
|
}
|
|
780
783
|
},
|
|
781
784
|
additionalProperties: false
|
|
@@ -1108,6 +1111,18 @@ var networks = {
|
|
|
1108
1111
|
"wss://eth-kovan.ws.alchemyapi.io/v2/QCsM2iU0bQ49eGDmZ7-Y--Wpu0lVWXSO"
|
|
1109
1112
|
],
|
|
1110
1113
|
explorer: "https://kovan.etherscan.io"
|
|
1114
|
+
},
|
|
1115
|
+
"44": {
|
|
1116
|
+
key: "44",
|
|
1117
|
+
name: "Crab Network",
|
|
1118
|
+
shortName: "Crab",
|
|
1119
|
+
chainId: 44,
|
|
1120
|
+
network: "mainnet",
|
|
1121
|
+
multicall: "0x4617D470F847Ce166019d19a7944049ebB017400",
|
|
1122
|
+
rpc: [
|
|
1123
|
+
"https://crab-rpc.darwinia.network"
|
|
1124
|
+
],
|
|
1125
|
+
explorer: "https://crab.subscan.io/"
|
|
1111
1126
|
},
|
|
1112
1127
|
"50": {
|
|
1113
1128
|
key: "50",
|
|
@@ -1132,8 +1147,8 @@ var networks = {
|
|
|
1132
1147
|
network: "mainnet",
|
|
1133
1148
|
multicall: "0x1ee38d535d541c55c9dae27b12edf090c608e6fb",
|
|
1134
1149
|
rpc: [
|
|
1135
|
-
"https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
|
|
1136
1150
|
"https://speedy-nodes-nyc.moralis.io/b9aed21e7bb7bdeb35972c9a/bsc/mainnet/archive",
|
|
1151
|
+
"https://apis.ankr.com/c0d871dd3c6d4529b01c9362a9b79e89/6106d4a3ec1d1bcc87ec72158f8fd089/binance/archive/main",
|
|
1137
1152
|
"https://bsc.getblock.io/mainnet/?api_key=91f8195f-bf46-488f-846a-73d6853790e7",
|
|
1138
1153
|
"https://bsc-private-dataseed1.nariox.org",
|
|
1139
1154
|
"https://bsc-private-dataseed2.nariox.org",
|
|
@@ -2013,9 +2028,12 @@ function irv(ballots, rounds) {
|
|
|
2013
2028
|
var votes = Object.entries(ballots.reduce(function (votes, _a, i, src) {
|
|
2014
2029
|
var _b = __read(_a, 1), v = _b[0];
|
|
2015
2030
|
votes[v[0]][0] += src[i][1];
|
|
2016
|
-
votes[v[0]][1].length > 1
|
|
2017
|
-
|
|
2018
|
-
|
|
2031
|
+
if (votes[v[0]][1].length > 1)
|
|
2032
|
+
votes[v[0]][1] = votes[v[0]][1].map(function (score, sI) { return score + src[i][2][sI]; });
|
|
2033
|
+
else
|
|
2034
|
+
votes[v[0]][1] = [
|
|
2035
|
+
votes[v[0]][1].concat(src[i][2]).reduce(function (a, b) { return a + b; }, 0)
|
|
2036
|
+
];
|
|
2019
2037
|
return votes;
|
|
2020
2038
|
}, Object.assign.apply(Object, __spread([{}], candidates.map(function (c) {
|
|
2021
2039
|
var _a;
|