@snapshot-labs/snapshot.js 0.4.21 → 0.4.24
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 +5 -0
- package/dist/schemas/index.d.ts +5 -0
- package/dist/sign/index.d.ts +2 -1
- package/dist/sign/types.d.ts +12 -0
- package/dist/snapshot.cjs.js +44 -0
- package/dist/snapshot.esm.js +44 -0
- package/dist/snapshot.min.js +7 -7
- package/package.json +4 -3
- package/src/networks.json +15 -0
- package/src/schemas/vote.json +5 -0
- package/src/sign/index.ts +12 -1
- package/src/sign/types.json +8 -1
- package/src/sign/types.ts +20 -0
- package/src/voting/approval.spec.js +1 -1
- package/src/voting/quadratic.spec.js +1 -1
- package/src/voting/rankedChoice.spec.js +1 -1
- package/src/voting/singleChoice.spec.js +1 -1
- package/src/voting/weighted.spec.js +1 -1
package/dist/index.d.ts
CHANGED
package/dist/schemas/index.d.ts
CHANGED
package/dist/sign/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Web3Provider } from '@ethersproject/providers';
|
|
2
2
|
import { Wallet } from '@ethersproject/wallet';
|
|
3
|
-
import { Space, Proposal, CancelProposal, Vote, Follow, Unfollow, Subscribe, Unsubscribe, Profile, Alias } from './types';
|
|
3
|
+
import { Space, Proposal, CancelProposal, Vote, Follow, Unfollow, Subscribe, Unsubscribe, Profile, Alias, DeleteSpace } from './types';
|
|
4
4
|
export declare const domain: {
|
|
5
5
|
name: string;
|
|
6
6
|
version: string;
|
|
@@ -20,4 +20,5 @@ export default class Client {
|
|
|
20
20
|
unsubscribe(web3: Web3Provider | Wallet, address: string, message: Unsubscribe): Promise<unknown>;
|
|
21
21
|
profile(web3: Web3Provider | Wallet, address: string, message: Profile): Promise<unknown>;
|
|
22
22
|
alias(web3: Web3Provider | Wallet, address: string, message: Alias): Promise<unknown>;
|
|
23
|
+
deleteSpace(web3: Web3Provider | Wallet, address: string, message: DeleteSpace): Promise<unknown>;
|
|
23
24
|
}
|
package/dist/sign/types.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface Vote {
|
|
|
34
34
|
type: ProposalType;
|
|
35
35
|
choice: number | number[] | string;
|
|
36
36
|
privacy?: string;
|
|
37
|
+
reason?: string;
|
|
37
38
|
app?: string;
|
|
38
39
|
}
|
|
39
40
|
export interface Follow {
|
|
@@ -66,6 +67,11 @@ export interface Alias {
|
|
|
66
67
|
alias: string;
|
|
67
68
|
timestamp?: number;
|
|
68
69
|
}
|
|
70
|
+
export interface DeleteSpace {
|
|
71
|
+
from?: string;
|
|
72
|
+
space: string;
|
|
73
|
+
timestamp?: number;
|
|
74
|
+
}
|
|
69
75
|
export declare const spaceTypes: {
|
|
70
76
|
Space: {
|
|
71
77
|
name: string;
|
|
@@ -162,3 +168,9 @@ export declare const aliasTypes: {
|
|
|
162
168
|
type: string;
|
|
163
169
|
}[];
|
|
164
170
|
};
|
|
171
|
+
export declare const deleteSpaceType: {
|
|
172
|
+
DeleteSpace: {
|
|
173
|
+
name: string;
|
|
174
|
+
type: string;
|
|
175
|
+
}[];
|
|
176
|
+
};
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -155,6 +155,7 @@ var voteTypes = {
|
|
|
155
155
|
{ name: 'timestamp', type: 'uint64' },
|
|
156
156
|
{ name: 'proposal', type: 'string' },
|
|
157
157
|
{ name: 'choice', type: 'uint32' },
|
|
158
|
+
{ name: 'reason', type: 'string' },
|
|
158
159
|
{ name: 'app', type: 'string' }
|
|
159
160
|
]
|
|
160
161
|
};
|
|
@@ -165,6 +166,7 @@ var voteArrayTypes = {
|
|
|
165
166
|
{ name: 'timestamp', type: 'uint64' },
|
|
166
167
|
{ name: 'proposal', type: 'string' },
|
|
167
168
|
{ name: 'choice', type: 'uint32[]' },
|
|
169
|
+
{ name: 'reason', type: 'string' },
|
|
168
170
|
{ name: 'app', type: 'string' }
|
|
169
171
|
]
|
|
170
172
|
};
|
|
@@ -175,6 +177,7 @@ var voteStringTypes = {
|
|
|
175
177
|
{ name: 'timestamp', type: 'uint64' },
|
|
176
178
|
{ name: 'proposal', type: 'string' },
|
|
177
179
|
{ name: 'choice', type: 'string' },
|
|
180
|
+
{ name: 'reason', type: 'string' },
|
|
178
181
|
{ name: 'app', type: 'string' }
|
|
179
182
|
]
|
|
180
183
|
};
|
|
@@ -185,6 +188,7 @@ var vote2Types = {
|
|
|
185
188
|
{ name: 'timestamp', type: 'uint64' },
|
|
186
189
|
{ name: 'proposal', type: 'bytes32' },
|
|
187
190
|
{ name: 'choice', type: 'uint32' },
|
|
191
|
+
{ name: 'reason', type: 'string' },
|
|
188
192
|
{ name: 'app', type: 'string' }
|
|
189
193
|
]
|
|
190
194
|
};
|
|
@@ -195,6 +199,7 @@ var voteArray2Types = {
|
|
|
195
199
|
{ name: 'timestamp', type: 'uint64' },
|
|
196
200
|
{ name: 'proposal', type: 'bytes32' },
|
|
197
201
|
{ name: 'choice', type: 'uint32[]' },
|
|
202
|
+
{ name: 'reason', type: 'string' },
|
|
198
203
|
{ name: 'app', type: 'string' }
|
|
199
204
|
]
|
|
200
205
|
};
|
|
@@ -205,6 +210,7 @@ var voteString2Types = {
|
|
|
205
210
|
{ name: 'timestamp', type: 'uint64' },
|
|
206
211
|
{ name: 'proposal', type: 'bytes32' },
|
|
207
212
|
{ name: 'choice', type: 'string' },
|
|
213
|
+
{ name: 'reason', type: 'string' },
|
|
208
214
|
{ name: 'app', type: 'string' }
|
|
209
215
|
]
|
|
210
216
|
};
|
|
@@ -244,6 +250,12 @@ var aliasTypes = {
|
|
|
244
250
|
{ name: 'from', type: 'address' },
|
|
245
251
|
{ name: 'alias', type: 'address' }
|
|
246
252
|
]
|
|
253
|
+
};
|
|
254
|
+
var deleteSpaceType = {
|
|
255
|
+
DeleteSpace: [
|
|
256
|
+
{ name: 'from', type: 'address' },
|
|
257
|
+
{ name: 'space', type: 'string' }
|
|
258
|
+
]
|
|
247
259
|
};
|
|
248
260
|
|
|
249
261
|
var hubs = [
|
|
@@ -354,6 +366,8 @@ var Client = /** @class */ (function () {
|
|
|
354
366
|
return __generator(this, function (_a) {
|
|
355
367
|
switch (_a.label) {
|
|
356
368
|
case 0:
|
|
369
|
+
if (!message.reason)
|
|
370
|
+
message.reason = '';
|
|
357
371
|
if (!message.app)
|
|
358
372
|
message.app = '';
|
|
359
373
|
type2 = message.proposal.startsWith('0x');
|
|
@@ -434,6 +448,16 @@ var Client = /** @class */ (function () {
|
|
|
434
448
|
});
|
|
435
449
|
});
|
|
436
450
|
};
|
|
451
|
+
Client.prototype.deleteSpace = function (web3, address, message) {
|
|
452
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
453
|
+
return __generator(this, function (_a) {
|
|
454
|
+
switch (_a.label) {
|
|
455
|
+
case 0: return [4 /*yield*/, this.sign(web3, address, message, deleteSpaceType)];
|
|
456
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
};
|
|
437
461
|
return Client;
|
|
438
462
|
}());
|
|
439
463
|
|
|
@@ -1071,6 +1095,11 @@ var definitions$2 = {
|
|
|
1071
1095
|
type: "object",
|
|
1072
1096
|
title: "metadata"
|
|
1073
1097
|
},
|
|
1098
|
+
reason: {
|
|
1099
|
+
type: "string",
|
|
1100
|
+
title: "reason",
|
|
1101
|
+
maxLength: 140
|
|
1102
|
+
},
|
|
1074
1103
|
app: {
|
|
1075
1104
|
type: "string",
|
|
1076
1105
|
title: "app",
|
|
@@ -1602,6 +1631,7 @@ var networks = {
|
|
|
1602
1631
|
network: "goerli",
|
|
1603
1632
|
testnet: true,
|
|
1604
1633
|
multicall: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
|
|
1634
|
+
ensResolver: "0x4B1488B7a6B320d2D721406204aBc3eeAa9AD329",
|
|
1605
1635
|
rpc: [
|
|
1606
1636
|
"https://eth-goerli.alchemyapi.io/v2/v4nqH_J-J3STit45Mm07TxuYexMHQsYZ"
|
|
1607
1637
|
],
|
|
@@ -2125,6 +2155,20 @@ var networks = {
|
|
|
2125
2155
|
explorer: "https://phiscan.com",
|
|
2126
2156
|
start: 360030,
|
|
2127
2157
|
logo: "ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"
|
|
2158
|
+
},
|
|
2159
|
+
"188": {
|
|
2160
|
+
key: "188",
|
|
2161
|
+
name: "Bytom Sidechain",
|
|
2162
|
+
shortName: "BMC",
|
|
2163
|
+
chainId: 188,
|
|
2164
|
+
network: "mainnet",
|
|
2165
|
+
multicall: "0xDA09528B093246eC70139b657d3B7A3bd5F4C859",
|
|
2166
|
+
rpc: [
|
|
2167
|
+
"https://mainnet.bmcchain.com/"
|
|
2168
|
+
],
|
|
2169
|
+
explorer: "https://bmc.blockmeta.com/",
|
|
2170
|
+
start: 4720651,
|
|
2171
|
+
logo: "ipfs://bafkreiabhsxuq35pp4kmrbptdeypd6clhcy3ue7ydpppo6onoo4igcjqia"
|
|
2128
2172
|
},
|
|
2129
2173
|
"246": {
|
|
2130
2174
|
key: "246",
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -146,6 +146,7 @@ var voteTypes = {
|
|
|
146
146
|
{ name: 'timestamp', type: 'uint64' },
|
|
147
147
|
{ name: 'proposal', type: 'string' },
|
|
148
148
|
{ name: 'choice', type: 'uint32' },
|
|
149
|
+
{ name: 'reason', type: 'string' },
|
|
149
150
|
{ name: 'app', type: 'string' }
|
|
150
151
|
]
|
|
151
152
|
};
|
|
@@ -156,6 +157,7 @@ var voteArrayTypes = {
|
|
|
156
157
|
{ name: 'timestamp', type: 'uint64' },
|
|
157
158
|
{ name: 'proposal', type: 'string' },
|
|
158
159
|
{ name: 'choice', type: 'uint32[]' },
|
|
160
|
+
{ name: 'reason', type: 'string' },
|
|
159
161
|
{ name: 'app', type: 'string' }
|
|
160
162
|
]
|
|
161
163
|
};
|
|
@@ -166,6 +168,7 @@ var voteStringTypes = {
|
|
|
166
168
|
{ name: 'timestamp', type: 'uint64' },
|
|
167
169
|
{ name: 'proposal', type: 'string' },
|
|
168
170
|
{ name: 'choice', type: 'string' },
|
|
171
|
+
{ name: 'reason', type: 'string' },
|
|
169
172
|
{ name: 'app', type: 'string' }
|
|
170
173
|
]
|
|
171
174
|
};
|
|
@@ -176,6 +179,7 @@ var vote2Types = {
|
|
|
176
179
|
{ name: 'timestamp', type: 'uint64' },
|
|
177
180
|
{ name: 'proposal', type: 'bytes32' },
|
|
178
181
|
{ name: 'choice', type: 'uint32' },
|
|
182
|
+
{ name: 'reason', type: 'string' },
|
|
179
183
|
{ name: 'app', type: 'string' }
|
|
180
184
|
]
|
|
181
185
|
};
|
|
@@ -186,6 +190,7 @@ var voteArray2Types = {
|
|
|
186
190
|
{ name: 'timestamp', type: 'uint64' },
|
|
187
191
|
{ name: 'proposal', type: 'bytes32' },
|
|
188
192
|
{ name: 'choice', type: 'uint32[]' },
|
|
193
|
+
{ name: 'reason', type: 'string' },
|
|
189
194
|
{ name: 'app', type: 'string' }
|
|
190
195
|
]
|
|
191
196
|
};
|
|
@@ -196,6 +201,7 @@ var voteString2Types = {
|
|
|
196
201
|
{ name: 'timestamp', type: 'uint64' },
|
|
197
202
|
{ name: 'proposal', type: 'bytes32' },
|
|
198
203
|
{ name: 'choice', type: 'string' },
|
|
204
|
+
{ name: 'reason', type: 'string' },
|
|
199
205
|
{ name: 'app', type: 'string' }
|
|
200
206
|
]
|
|
201
207
|
};
|
|
@@ -235,6 +241,12 @@ var aliasTypes = {
|
|
|
235
241
|
{ name: 'from', type: 'address' },
|
|
236
242
|
{ name: 'alias', type: 'address' }
|
|
237
243
|
]
|
|
244
|
+
};
|
|
245
|
+
var deleteSpaceType = {
|
|
246
|
+
DeleteSpace: [
|
|
247
|
+
{ name: 'from', type: 'address' },
|
|
248
|
+
{ name: 'space', type: 'string' }
|
|
249
|
+
]
|
|
238
250
|
};
|
|
239
251
|
|
|
240
252
|
var hubs = [
|
|
@@ -345,6 +357,8 @@ var Client = /** @class */ (function () {
|
|
|
345
357
|
return __generator(this, function (_a) {
|
|
346
358
|
switch (_a.label) {
|
|
347
359
|
case 0:
|
|
360
|
+
if (!message.reason)
|
|
361
|
+
message.reason = '';
|
|
348
362
|
if (!message.app)
|
|
349
363
|
message.app = '';
|
|
350
364
|
type2 = message.proposal.startsWith('0x');
|
|
@@ -425,6 +439,16 @@ var Client = /** @class */ (function () {
|
|
|
425
439
|
});
|
|
426
440
|
});
|
|
427
441
|
};
|
|
442
|
+
Client.prototype.deleteSpace = function (web3, address, message) {
|
|
443
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
444
|
+
return __generator(this, function (_a) {
|
|
445
|
+
switch (_a.label) {
|
|
446
|
+
case 0: return [4 /*yield*/, this.sign(web3, address, message, deleteSpaceType)];
|
|
447
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
});
|
|
451
|
+
};
|
|
428
452
|
return Client;
|
|
429
453
|
}());
|
|
430
454
|
|
|
@@ -1062,6 +1086,11 @@ var definitions$2 = {
|
|
|
1062
1086
|
type: "object",
|
|
1063
1087
|
title: "metadata"
|
|
1064
1088
|
},
|
|
1089
|
+
reason: {
|
|
1090
|
+
type: "string",
|
|
1091
|
+
title: "reason",
|
|
1092
|
+
maxLength: 140
|
|
1093
|
+
},
|
|
1065
1094
|
app: {
|
|
1066
1095
|
type: "string",
|
|
1067
1096
|
title: "app",
|
|
@@ -1593,6 +1622,7 @@ var networks = {
|
|
|
1593
1622
|
network: "goerli",
|
|
1594
1623
|
testnet: true,
|
|
1595
1624
|
multicall: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
|
|
1625
|
+
ensResolver: "0x4B1488B7a6B320d2D721406204aBc3eeAa9AD329",
|
|
1596
1626
|
rpc: [
|
|
1597
1627
|
"https://eth-goerli.alchemyapi.io/v2/v4nqH_J-J3STit45Mm07TxuYexMHQsYZ"
|
|
1598
1628
|
],
|
|
@@ -2116,6 +2146,20 @@ var networks = {
|
|
|
2116
2146
|
explorer: "https://phiscan.com",
|
|
2117
2147
|
start: 360030,
|
|
2118
2148
|
logo: "ipfs://bafkreid6pm3mic7izp3a6zlfwhhe7etd276bjfsq2xash6a4s2vmcdf65a"
|
|
2149
|
+
},
|
|
2150
|
+
"188": {
|
|
2151
|
+
key: "188",
|
|
2152
|
+
name: "Bytom Sidechain",
|
|
2153
|
+
shortName: "BMC",
|
|
2154
|
+
chainId: 188,
|
|
2155
|
+
network: "mainnet",
|
|
2156
|
+
multicall: "0xDA09528B093246eC70139b657d3B7A3bd5F4C859",
|
|
2157
|
+
rpc: [
|
|
2158
|
+
"https://mainnet.bmcchain.com/"
|
|
2159
|
+
],
|
|
2160
|
+
explorer: "https://bmc.blockmeta.com/",
|
|
2161
|
+
start: 4720651,
|
|
2162
|
+
logo: "ipfs://bafkreiabhsxuq35pp4kmrbptdeypd6clhcy3ue7ydpppo6onoo4igcjqia"
|
|
2119
2163
|
},
|
|
2120
2164
|
"246": {
|
|
2121
2165
|
key: "246",
|