@snapshot-labs/snapshot.js 0.14.4 → 0.14.6
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 +306 -243
- package/dist/snapshot.esm.js +297 -234
- package/dist/snapshot.min.js +23 -23
- package/dist/src/index.d.ts +1 -0
- package/dist/src/utils.d.ts +37 -1
- package/package.json +1 -1
- package/src/sign/index.ts +1 -1
- package/src/utils.ts +86 -14
package/dist/snapshot.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import crossFetch from 'cross-fetch';
|
|
2
2
|
import { Contract as Contract$1 } from '@ethersproject/contracts';
|
|
3
3
|
import { isAddress, getAddress } from '@ethersproject/address';
|
|
4
4
|
import { parseUnits } from '@ethersproject/units';
|
|
@@ -52,227 +52,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const spaceTypes = {
|
|
56
|
-
Space: [
|
|
57
|
-
{ name: 'from', type: 'address' },
|
|
58
|
-
{ name: 'space', type: 'string' },
|
|
59
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
60
|
-
{ name: 'settings', type: 'string' }
|
|
61
|
-
]
|
|
62
|
-
};
|
|
63
|
-
const proposalTypes = {
|
|
64
|
-
Proposal: [
|
|
65
|
-
{ name: 'from', type: 'string' },
|
|
66
|
-
{ name: 'space', type: 'string' },
|
|
67
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
68
|
-
{ name: 'type', type: 'string' },
|
|
69
|
-
{ name: 'title', type: 'string' },
|
|
70
|
-
{ name: 'body', type: 'string' },
|
|
71
|
-
{ name: 'discussion', type: 'string' },
|
|
72
|
-
{ name: 'choices', type: 'string[]' },
|
|
73
|
-
{ name: 'labels', type: 'string[]' },
|
|
74
|
-
{ name: 'start', type: 'uint64' },
|
|
75
|
-
{ name: 'end', type: 'uint64' },
|
|
76
|
-
{ name: 'snapshot', type: 'uint64' },
|
|
77
|
-
{ name: 'plugins', type: 'string' },
|
|
78
|
-
{ name: 'privacy', type: 'string' },
|
|
79
|
-
{ name: 'app', type: 'string' }
|
|
80
|
-
]
|
|
81
|
-
};
|
|
82
|
-
const updateProposalTypes = {
|
|
83
|
-
UpdateProposal: [
|
|
84
|
-
{ name: 'proposal', type: 'string' },
|
|
85
|
-
{ name: 'from', type: 'string' },
|
|
86
|
-
{ name: 'space', type: 'string' },
|
|
87
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
88
|
-
{ name: 'type', type: 'string' },
|
|
89
|
-
{ name: 'title', type: 'string' },
|
|
90
|
-
{ name: 'body', type: 'string' },
|
|
91
|
-
{ name: 'discussion', type: 'string' },
|
|
92
|
-
{ name: 'choices', type: 'string[]' },
|
|
93
|
-
{ name: 'labels', type: 'string[]' },
|
|
94
|
-
{ name: 'plugins', type: 'string' },
|
|
95
|
-
{ name: 'privacy', type: 'string' }
|
|
96
|
-
]
|
|
97
|
-
};
|
|
98
|
-
const flagProposalTypes = {
|
|
99
|
-
FlagProposal: [
|
|
100
|
-
{ name: 'from', type: 'string' },
|
|
101
|
-
{ name: 'space', type: 'string' },
|
|
102
|
-
{ name: 'proposal', type: 'string' },
|
|
103
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
104
|
-
]
|
|
105
|
-
};
|
|
106
|
-
const cancelProposalTypes = {
|
|
107
|
-
CancelProposal: [
|
|
108
|
-
{ name: 'from', type: 'string' },
|
|
109
|
-
{ name: 'space', type: 'string' },
|
|
110
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
111
|
-
{ name: 'proposal', type: 'string' }
|
|
112
|
-
]
|
|
113
|
-
};
|
|
114
|
-
const cancelProposal2Types = {
|
|
115
|
-
CancelProposal: [
|
|
116
|
-
{ name: 'from', type: 'string' },
|
|
117
|
-
{ name: 'space', type: 'string' },
|
|
118
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
119
|
-
{ name: 'proposal', type: 'bytes32' }
|
|
120
|
-
]
|
|
121
|
-
};
|
|
122
|
-
const voteTypes = {
|
|
123
|
-
Vote: [
|
|
124
|
-
{ name: 'from', type: 'string' },
|
|
125
|
-
{ name: 'space', type: 'string' },
|
|
126
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
127
|
-
{ name: 'proposal', type: 'string' },
|
|
128
|
-
{ name: 'choice', type: 'uint32' },
|
|
129
|
-
{ name: 'reason', type: 'string' },
|
|
130
|
-
{ name: 'app', type: 'string' },
|
|
131
|
-
{ name: 'metadata', type: 'string' }
|
|
132
|
-
]
|
|
133
|
-
};
|
|
134
|
-
const voteArrayTypes = {
|
|
135
|
-
Vote: [
|
|
136
|
-
{ name: 'from', type: 'string' },
|
|
137
|
-
{ name: 'space', type: 'string' },
|
|
138
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
139
|
-
{ name: 'proposal', type: 'string' },
|
|
140
|
-
{ name: 'choice', type: 'uint32[]' },
|
|
141
|
-
{ name: 'reason', type: 'string' },
|
|
142
|
-
{ name: 'app', type: 'string' },
|
|
143
|
-
{ name: 'metadata', type: 'string' }
|
|
144
|
-
]
|
|
145
|
-
};
|
|
146
|
-
const voteStringTypes = {
|
|
147
|
-
Vote: [
|
|
148
|
-
{ name: 'from', type: 'string' },
|
|
149
|
-
{ name: 'space', type: 'string' },
|
|
150
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
151
|
-
{ name: 'proposal', type: 'string' },
|
|
152
|
-
{ name: 'choice', type: 'string' },
|
|
153
|
-
{ name: 'reason', type: 'string' },
|
|
154
|
-
{ name: 'app', type: 'string' },
|
|
155
|
-
{ name: 'metadata', type: 'string' }
|
|
156
|
-
]
|
|
157
|
-
};
|
|
158
|
-
const vote2Types = {
|
|
159
|
-
Vote: [
|
|
160
|
-
{ name: 'from', type: 'string' },
|
|
161
|
-
{ name: 'space', type: 'string' },
|
|
162
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
163
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
164
|
-
{ name: 'choice', type: 'uint32' },
|
|
165
|
-
{ name: 'reason', type: 'string' },
|
|
166
|
-
{ name: 'app', type: 'string' },
|
|
167
|
-
{ name: 'metadata', type: 'string' }
|
|
168
|
-
]
|
|
169
|
-
};
|
|
170
|
-
const voteArray2Types = {
|
|
171
|
-
Vote: [
|
|
172
|
-
{ name: 'from', type: 'string' },
|
|
173
|
-
{ name: 'space', type: 'string' },
|
|
174
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
175
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
176
|
-
{ name: 'choice', type: 'uint32[]' },
|
|
177
|
-
{ name: 'reason', type: 'string' },
|
|
178
|
-
{ name: 'app', type: 'string' },
|
|
179
|
-
{ name: 'metadata', type: 'string' }
|
|
180
|
-
]
|
|
181
|
-
};
|
|
182
|
-
const voteString2Types = {
|
|
183
|
-
Vote: [
|
|
184
|
-
{ name: 'from', type: 'string' },
|
|
185
|
-
{ name: 'space', type: 'string' },
|
|
186
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
187
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
188
|
-
{ name: 'choice', type: 'string' },
|
|
189
|
-
{ name: 'reason', type: 'string' },
|
|
190
|
-
{ name: 'app', type: 'string' },
|
|
191
|
-
{ name: 'metadata', type: 'string' }
|
|
192
|
-
]
|
|
193
|
-
};
|
|
194
|
-
const followTypes = {
|
|
195
|
-
Follow: [
|
|
196
|
-
{ name: 'from', type: 'address' },
|
|
197
|
-
{ name: 'network', type: 'string' },
|
|
198
|
-
{ name: 'space', type: 'string' },
|
|
199
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
200
|
-
]
|
|
201
|
-
};
|
|
202
|
-
const unfollowTypes = {
|
|
203
|
-
Unfollow: [
|
|
204
|
-
{ name: 'from', type: 'address' },
|
|
205
|
-
{ name: 'network', type: 'string' },
|
|
206
|
-
{ name: 'space', type: 'string' },
|
|
207
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
208
|
-
]
|
|
209
|
-
};
|
|
210
|
-
const subscribeTypes = {
|
|
211
|
-
Subscribe: [
|
|
212
|
-
{ name: 'from', type: 'address' },
|
|
213
|
-
{ name: 'space', type: 'string' },
|
|
214
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
215
|
-
]
|
|
216
|
-
};
|
|
217
|
-
const unsubscribeTypes = {
|
|
218
|
-
Unsubscribe: [
|
|
219
|
-
{ name: 'from', type: 'address' },
|
|
220
|
-
{ name: 'space', type: 'string' },
|
|
221
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
222
|
-
]
|
|
223
|
-
};
|
|
224
|
-
const profileTypes = {
|
|
225
|
-
Profile: [
|
|
226
|
-
{ name: 'from', type: 'address' },
|
|
227
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
228
|
-
{ name: 'profile', type: 'string' }
|
|
229
|
-
]
|
|
230
|
-
};
|
|
231
|
-
const statementTypes = {
|
|
232
|
-
Statement: [
|
|
233
|
-
{ name: 'from', type: 'address' },
|
|
234
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
235
|
-
{ name: 'space', type: 'string' },
|
|
236
|
-
{ name: 'about', type: 'string' },
|
|
237
|
-
{ name: 'statement', type: 'string' },
|
|
238
|
-
{ name: 'discourse', type: 'string' },
|
|
239
|
-
{ name: 'status', type: 'string' },
|
|
240
|
-
{ name: 'network', type: 'string' }
|
|
241
|
-
]
|
|
242
|
-
};
|
|
243
|
-
const aliasTypes = {
|
|
244
|
-
Alias: [
|
|
245
|
-
{ name: 'from', type: 'address' },
|
|
246
|
-
{ name: 'alias', type: 'address' },
|
|
247
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
248
|
-
]
|
|
249
|
-
};
|
|
250
|
-
const deleteSpaceType = {
|
|
251
|
-
DeleteSpace: [
|
|
252
|
-
{ name: 'from', type: 'address' },
|
|
253
|
-
{ name: 'space', type: 'string' },
|
|
254
|
-
{ name: 'timestamp', type: 'uint64' }
|
|
255
|
-
]
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
var mainnet = {
|
|
259
|
-
hub: "https://hub.snapshot.org",
|
|
260
|
-
sequencer: "https://seq.snapshot.org"
|
|
261
|
-
};
|
|
262
|
-
var testnet = {
|
|
263
|
-
hub: "https://testnet.hub.snapshot.org",
|
|
264
|
-
sequencer: "https://testnet.seq.snapshot.org"
|
|
265
|
-
};
|
|
266
|
-
var local = {
|
|
267
|
-
hub: "http://localhost:3000",
|
|
268
|
-
sequencer: "http://localhost:3001"
|
|
269
|
-
};
|
|
270
|
-
var constants = {
|
|
271
|
-
mainnet: mainnet,
|
|
272
|
-
testnet: testnet,
|
|
273
|
-
local: local
|
|
274
|
-
};
|
|
275
|
-
|
|
276
55
|
let cache = {};
|
|
277
56
|
let expirationTime = 0;
|
|
278
57
|
function getSnapshots(network_1, snapshot_1, provider_1, networks_1) {
|
|
@@ -3460,14 +3239,17 @@ const ENS_ABI = [
|
|
|
3460
3239
|
'function text(bytes32 node, string calldata key) external view returns (string memory)',
|
|
3461
3240
|
'function resolver(bytes32 node) view returns (address)' // ENS registry ABI
|
|
3462
3241
|
];
|
|
3463
|
-
const
|
|
3464
|
-
'
|
|
3242
|
+
const UD_MAPPING = {
|
|
3243
|
+
'146': {
|
|
3244
|
+
tlds: ['.sonic'],
|
|
3245
|
+
registryContract: '0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4'
|
|
3246
|
+
}
|
|
3247
|
+
};
|
|
3248
|
+
const UD_REGISTRY_ABI = [
|
|
3249
|
+
'function ownerOf(uint256 tokenId) view returns (address owner)'
|
|
3465
3250
|
];
|
|
3466
|
-
const SONIC_CONTRACT_ADDRESS = '0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4';
|
|
3467
3251
|
const ENS_CHAIN_IDS = ['1', '11155111'];
|
|
3468
3252
|
const SHIBARIUM_CHAIN_IDS = ['109', '157'];
|
|
3469
|
-
const SONIC_CHAIN_IDS = ['146'];
|
|
3470
|
-
const SONIC_TLD = '.sonic';
|
|
3471
3253
|
const SHIBARIUM_TLD = '.shib';
|
|
3472
3254
|
const EMPTY_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
3473
3255
|
const scoreApiHeaders = {
|
|
@@ -3701,10 +3483,67 @@ function getUrl(uri, gateway = gateways[0]) {
|
|
|
3701
3483
|
return uri.replace('ipns://', `${ipfsGateway}/ipns/`);
|
|
3702
3484
|
return uri;
|
|
3703
3485
|
}
|
|
3486
|
+
/**
|
|
3487
|
+
* Enhanced fetch with timeout support - drop-in replacement for native fetch
|
|
3488
|
+
*
|
|
3489
|
+
* @param url - The URL to fetch
|
|
3490
|
+
* @param options - Fetch options with optional timeout
|
|
3491
|
+
* @param options.timeout - Request timeout in milliseconds (default: 30000ms). Set to 0 to disable timeout.
|
|
3492
|
+
*
|
|
3493
|
+
* @returns Promise that resolves to the Response object
|
|
3494
|
+
*
|
|
3495
|
+
* @throws {Error} Throws timeout error if request exceeds the specified timeout duration
|
|
3496
|
+
*
|
|
3497
|
+
* @example
|
|
3498
|
+
* ```typescript
|
|
3499
|
+
* // Uses default 30s timeout
|
|
3500
|
+
* const response = await fetch('https://api.example.com/data');
|
|
3501
|
+
*
|
|
3502
|
+
* // Custom 5s timeout
|
|
3503
|
+
* const response = await fetch('https://api.example.com/data', { timeout: 5000 });
|
|
3504
|
+
*
|
|
3505
|
+
* // Disable timeout
|
|
3506
|
+
* const response = await fetch('https://api.example.com/data', { timeout: 0 });
|
|
3507
|
+
*
|
|
3508
|
+
* // With additional fetch options
|
|
3509
|
+
* const response = await fetch('https://api.example.com/data', {
|
|
3510
|
+
* timeout: 10000,
|
|
3511
|
+
* method: 'POST',
|
|
3512
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
3513
|
+
* body: JSON.stringify({ key: 'value' })
|
|
3514
|
+
* });
|
|
3515
|
+
* ```
|
|
3516
|
+
*/
|
|
3517
|
+
function fetch(url_1) {
|
|
3518
|
+
return __awaiter(this, arguments, void 0, function* (url, options = {}) {
|
|
3519
|
+
const { timeout = 30000 } = options, fetchOptions = __rest(options, ["timeout"]);
|
|
3520
|
+
if (timeout > 0) {
|
|
3521
|
+
const controller = new AbortController();
|
|
3522
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
3523
|
+
try {
|
|
3524
|
+
const response = yield crossFetch(url, Object.assign(Object.assign({}, fetchOptions), { signal: controller.signal }));
|
|
3525
|
+
return response;
|
|
3526
|
+
}
|
|
3527
|
+
catch (error) {
|
|
3528
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
3529
|
+
throw new Error(`Request timeout after ${timeout}ms`);
|
|
3530
|
+
}
|
|
3531
|
+
throw error;
|
|
3532
|
+
}
|
|
3533
|
+
finally {
|
|
3534
|
+
clearTimeout(timeoutId);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3538
|
+
const cleanFetchOptions = __rest(fetchOptions, ["signal"]);
|
|
3539
|
+
return crossFetch(url, cleanFetchOptions);
|
|
3540
|
+
});
|
|
3541
|
+
}
|
|
3704
3542
|
function getJSON(uri_1) {
|
|
3705
3543
|
return __awaiter(this, arguments, void 0, function* (uri, options = {}) {
|
|
3706
3544
|
const url = getUrl(uri, options.gateways);
|
|
3707
|
-
|
|
3545
|
+
const response = yield fetch(url, options);
|
|
3546
|
+
return response.json();
|
|
3708
3547
|
});
|
|
3709
3548
|
}
|
|
3710
3549
|
function ipfsGet(gateway_1, ipfsHash_1) {
|
|
@@ -3989,16 +3828,18 @@ function getShibariumNameOwner(id, network) {
|
|
|
3989
3828
|
return data.result;
|
|
3990
3829
|
});
|
|
3991
3830
|
}
|
|
3992
|
-
function
|
|
3831
|
+
function getUDNameOwner(id, network) {
|
|
3993
3832
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3994
|
-
|
|
3833
|
+
var _a;
|
|
3834
|
+
const tlds = ((_a = UD_MAPPING[network]) === null || _a === void 0 ? void 0 : _a.tlds) || [];
|
|
3835
|
+
if (!tlds.some((tld) => id.endsWith(tld))) {
|
|
3995
3836
|
return Promise.resolve(EMPTY_ADDRESS);
|
|
3996
3837
|
}
|
|
3997
3838
|
try {
|
|
3998
3839
|
const hash = namehash(ensNormalize(id));
|
|
3999
|
-
const tokenId = BigInt(hash)
|
|
3840
|
+
const tokenId = BigInt(hash);
|
|
4000
3841
|
const provider = getProvider(network);
|
|
4001
|
-
return yield call(provider,
|
|
3842
|
+
return yield call(provider, UD_REGISTRY_ABI, [UD_MAPPING[network].registryContract, 'ownerOf', [tokenId]], {
|
|
4002
3843
|
blockTag: 'latest'
|
|
4003
3844
|
});
|
|
4004
3845
|
}
|
|
@@ -4015,8 +3856,8 @@ function getSpaceController(id_1) {
|
|
|
4015
3856
|
else if (SHIBARIUM_CHAIN_IDS.includes(network)) {
|
|
4016
3857
|
return getShibariumNameOwner(id, network);
|
|
4017
3858
|
}
|
|
4018
|
-
else if (
|
|
4019
|
-
return
|
|
3859
|
+
else if (UD_MAPPING[String(network)]) {
|
|
3860
|
+
return getUDNameOwner(id, network);
|
|
4020
3861
|
}
|
|
4021
3862
|
throw new Error(`Network not supported: ${network}`);
|
|
4022
3863
|
});
|
|
@@ -4077,6 +3918,7 @@ function inputError(message) {
|
|
|
4077
3918
|
var utils = {
|
|
4078
3919
|
call,
|
|
4079
3920
|
multicall: multicall$2,
|
|
3921
|
+
fetch,
|
|
4080
3922
|
subgraphRequest,
|
|
4081
3923
|
ipfsGet,
|
|
4082
3924
|
getUrl,
|
|
@@ -4108,6 +3950,227 @@ var utils = {
|
|
|
4108
3950
|
SNAPSHOT_SUBGRAPH_URL
|
|
4109
3951
|
};
|
|
4110
3952
|
|
|
3953
|
+
const spaceTypes = {
|
|
3954
|
+
Space: [
|
|
3955
|
+
{ name: 'from', type: 'address' },
|
|
3956
|
+
{ name: 'space', type: 'string' },
|
|
3957
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
3958
|
+
{ name: 'settings', type: 'string' }
|
|
3959
|
+
]
|
|
3960
|
+
};
|
|
3961
|
+
const proposalTypes = {
|
|
3962
|
+
Proposal: [
|
|
3963
|
+
{ name: 'from', type: 'string' },
|
|
3964
|
+
{ name: 'space', type: 'string' },
|
|
3965
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
3966
|
+
{ name: 'type', type: 'string' },
|
|
3967
|
+
{ name: 'title', type: 'string' },
|
|
3968
|
+
{ name: 'body', type: 'string' },
|
|
3969
|
+
{ name: 'discussion', type: 'string' },
|
|
3970
|
+
{ name: 'choices', type: 'string[]' },
|
|
3971
|
+
{ name: 'labels', type: 'string[]' },
|
|
3972
|
+
{ name: 'start', type: 'uint64' },
|
|
3973
|
+
{ name: 'end', type: 'uint64' },
|
|
3974
|
+
{ name: 'snapshot', type: 'uint64' },
|
|
3975
|
+
{ name: 'plugins', type: 'string' },
|
|
3976
|
+
{ name: 'privacy', type: 'string' },
|
|
3977
|
+
{ name: 'app', type: 'string' }
|
|
3978
|
+
]
|
|
3979
|
+
};
|
|
3980
|
+
const updateProposalTypes = {
|
|
3981
|
+
UpdateProposal: [
|
|
3982
|
+
{ name: 'proposal', type: 'string' },
|
|
3983
|
+
{ name: 'from', type: 'string' },
|
|
3984
|
+
{ name: 'space', type: 'string' },
|
|
3985
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
3986
|
+
{ name: 'type', type: 'string' },
|
|
3987
|
+
{ name: 'title', type: 'string' },
|
|
3988
|
+
{ name: 'body', type: 'string' },
|
|
3989
|
+
{ name: 'discussion', type: 'string' },
|
|
3990
|
+
{ name: 'choices', type: 'string[]' },
|
|
3991
|
+
{ name: 'labels', type: 'string[]' },
|
|
3992
|
+
{ name: 'plugins', type: 'string' },
|
|
3993
|
+
{ name: 'privacy', type: 'string' }
|
|
3994
|
+
]
|
|
3995
|
+
};
|
|
3996
|
+
const flagProposalTypes = {
|
|
3997
|
+
FlagProposal: [
|
|
3998
|
+
{ name: 'from', type: 'string' },
|
|
3999
|
+
{ name: 'space', type: 'string' },
|
|
4000
|
+
{ name: 'proposal', type: 'string' },
|
|
4001
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4002
|
+
]
|
|
4003
|
+
};
|
|
4004
|
+
const cancelProposalTypes = {
|
|
4005
|
+
CancelProposal: [
|
|
4006
|
+
{ name: 'from', type: 'string' },
|
|
4007
|
+
{ name: 'space', type: 'string' },
|
|
4008
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4009
|
+
{ name: 'proposal', type: 'string' }
|
|
4010
|
+
]
|
|
4011
|
+
};
|
|
4012
|
+
const cancelProposal2Types = {
|
|
4013
|
+
CancelProposal: [
|
|
4014
|
+
{ name: 'from', type: 'string' },
|
|
4015
|
+
{ name: 'space', type: 'string' },
|
|
4016
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4017
|
+
{ name: 'proposal', type: 'bytes32' }
|
|
4018
|
+
]
|
|
4019
|
+
};
|
|
4020
|
+
const voteTypes = {
|
|
4021
|
+
Vote: [
|
|
4022
|
+
{ name: 'from', type: 'string' },
|
|
4023
|
+
{ name: 'space', type: 'string' },
|
|
4024
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4025
|
+
{ name: 'proposal', type: 'string' },
|
|
4026
|
+
{ name: 'choice', type: 'uint32' },
|
|
4027
|
+
{ name: 'reason', type: 'string' },
|
|
4028
|
+
{ name: 'app', type: 'string' },
|
|
4029
|
+
{ name: 'metadata', type: 'string' }
|
|
4030
|
+
]
|
|
4031
|
+
};
|
|
4032
|
+
const voteArrayTypes = {
|
|
4033
|
+
Vote: [
|
|
4034
|
+
{ name: 'from', type: 'string' },
|
|
4035
|
+
{ name: 'space', type: 'string' },
|
|
4036
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4037
|
+
{ name: 'proposal', type: 'string' },
|
|
4038
|
+
{ name: 'choice', type: 'uint32[]' },
|
|
4039
|
+
{ name: 'reason', type: 'string' },
|
|
4040
|
+
{ name: 'app', type: 'string' },
|
|
4041
|
+
{ name: 'metadata', type: 'string' }
|
|
4042
|
+
]
|
|
4043
|
+
};
|
|
4044
|
+
const voteStringTypes = {
|
|
4045
|
+
Vote: [
|
|
4046
|
+
{ name: 'from', type: 'string' },
|
|
4047
|
+
{ name: 'space', type: 'string' },
|
|
4048
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4049
|
+
{ name: 'proposal', type: 'string' },
|
|
4050
|
+
{ name: 'choice', type: 'string' },
|
|
4051
|
+
{ name: 'reason', type: 'string' },
|
|
4052
|
+
{ name: 'app', type: 'string' },
|
|
4053
|
+
{ name: 'metadata', type: 'string' }
|
|
4054
|
+
]
|
|
4055
|
+
};
|
|
4056
|
+
const vote2Types = {
|
|
4057
|
+
Vote: [
|
|
4058
|
+
{ name: 'from', type: 'string' },
|
|
4059
|
+
{ name: 'space', type: 'string' },
|
|
4060
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4061
|
+
{ name: 'proposal', type: 'bytes32' },
|
|
4062
|
+
{ name: 'choice', type: 'uint32' },
|
|
4063
|
+
{ name: 'reason', type: 'string' },
|
|
4064
|
+
{ name: 'app', type: 'string' },
|
|
4065
|
+
{ name: 'metadata', type: 'string' }
|
|
4066
|
+
]
|
|
4067
|
+
};
|
|
4068
|
+
const voteArray2Types = {
|
|
4069
|
+
Vote: [
|
|
4070
|
+
{ name: 'from', type: 'string' },
|
|
4071
|
+
{ name: 'space', type: 'string' },
|
|
4072
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4073
|
+
{ name: 'proposal', type: 'bytes32' },
|
|
4074
|
+
{ name: 'choice', type: 'uint32[]' },
|
|
4075
|
+
{ name: 'reason', type: 'string' },
|
|
4076
|
+
{ name: 'app', type: 'string' },
|
|
4077
|
+
{ name: 'metadata', type: 'string' }
|
|
4078
|
+
]
|
|
4079
|
+
};
|
|
4080
|
+
const voteString2Types = {
|
|
4081
|
+
Vote: [
|
|
4082
|
+
{ name: 'from', type: 'string' },
|
|
4083
|
+
{ name: 'space', type: 'string' },
|
|
4084
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4085
|
+
{ name: 'proposal', type: 'bytes32' },
|
|
4086
|
+
{ name: 'choice', type: 'string' },
|
|
4087
|
+
{ name: 'reason', type: 'string' },
|
|
4088
|
+
{ name: 'app', type: 'string' },
|
|
4089
|
+
{ name: 'metadata', type: 'string' }
|
|
4090
|
+
]
|
|
4091
|
+
};
|
|
4092
|
+
const followTypes = {
|
|
4093
|
+
Follow: [
|
|
4094
|
+
{ name: 'from', type: 'address' },
|
|
4095
|
+
{ name: 'network', type: 'string' },
|
|
4096
|
+
{ name: 'space', type: 'string' },
|
|
4097
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4098
|
+
]
|
|
4099
|
+
};
|
|
4100
|
+
const unfollowTypes = {
|
|
4101
|
+
Unfollow: [
|
|
4102
|
+
{ name: 'from', type: 'address' },
|
|
4103
|
+
{ name: 'network', type: 'string' },
|
|
4104
|
+
{ name: 'space', type: 'string' },
|
|
4105
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4106
|
+
]
|
|
4107
|
+
};
|
|
4108
|
+
const subscribeTypes = {
|
|
4109
|
+
Subscribe: [
|
|
4110
|
+
{ name: 'from', type: 'address' },
|
|
4111
|
+
{ name: 'space', type: 'string' },
|
|
4112
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4113
|
+
]
|
|
4114
|
+
};
|
|
4115
|
+
const unsubscribeTypes = {
|
|
4116
|
+
Unsubscribe: [
|
|
4117
|
+
{ name: 'from', type: 'address' },
|
|
4118
|
+
{ name: 'space', type: 'string' },
|
|
4119
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4120
|
+
]
|
|
4121
|
+
};
|
|
4122
|
+
const profileTypes = {
|
|
4123
|
+
Profile: [
|
|
4124
|
+
{ name: 'from', type: 'address' },
|
|
4125
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4126
|
+
{ name: 'profile', type: 'string' }
|
|
4127
|
+
]
|
|
4128
|
+
};
|
|
4129
|
+
const statementTypes = {
|
|
4130
|
+
Statement: [
|
|
4131
|
+
{ name: 'from', type: 'address' },
|
|
4132
|
+
{ name: 'timestamp', type: 'uint64' },
|
|
4133
|
+
{ name: 'space', type: 'string' },
|
|
4134
|
+
{ name: 'about', type: 'string' },
|
|
4135
|
+
{ name: 'statement', type: 'string' },
|
|
4136
|
+
{ name: 'discourse', type: 'string' },
|
|
4137
|
+
{ name: 'status', type: 'string' },
|
|
4138
|
+
{ name: 'network', type: 'string' }
|
|
4139
|
+
]
|
|
4140
|
+
};
|
|
4141
|
+
const aliasTypes = {
|
|
4142
|
+
Alias: [
|
|
4143
|
+
{ name: 'from', type: 'address' },
|
|
4144
|
+
{ name: 'alias', type: 'address' },
|
|
4145
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4146
|
+
]
|
|
4147
|
+
};
|
|
4148
|
+
const deleteSpaceType = {
|
|
4149
|
+
DeleteSpace: [
|
|
4150
|
+
{ name: 'from', type: 'address' },
|
|
4151
|
+
{ name: 'space', type: 'string' },
|
|
4152
|
+
{ name: 'timestamp', type: 'uint64' }
|
|
4153
|
+
]
|
|
4154
|
+
};
|
|
4155
|
+
|
|
4156
|
+
var mainnet = {
|
|
4157
|
+
hub: "https://hub.snapshot.org",
|
|
4158
|
+
sequencer: "https://seq.snapshot.org"
|
|
4159
|
+
};
|
|
4160
|
+
var testnet = {
|
|
4161
|
+
hub: "https://testnet.hub.snapshot.org",
|
|
4162
|
+
sequencer: "https://testnet.seq.snapshot.org"
|
|
4163
|
+
};
|
|
4164
|
+
var local = {
|
|
4165
|
+
hub: "http://localhost:3000",
|
|
4166
|
+
sequencer: "http://localhost:3001"
|
|
4167
|
+
};
|
|
4168
|
+
var constants = {
|
|
4169
|
+
mainnet: mainnet,
|
|
4170
|
+
testnet: testnet,
|
|
4171
|
+
local: local
|
|
4172
|
+
};
|
|
4173
|
+
|
|
4111
4174
|
const NAME = 'snapshot';
|
|
4112
4175
|
const VERSION = '0.1.4';
|
|
4113
4176
|
const domain = {
|