@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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var fetch = require('cross-fetch');
3
+ var crossFetch = require('cross-fetch');
4
4
  var contracts = require('@ethersproject/contracts');
5
5
  var address = require('@ethersproject/address');
6
6
  var units = require('@ethersproject/units');
@@ -19,7 +19,7 @@ var set = require('lodash.set');
19
19
 
20
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
21
 
22
- var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
22
+ var crossFetch__default = /*#__PURE__*/_interopDefaultLegacy(crossFetch);
23
23
  var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv);
24
24
  var addFormats__default = /*#__PURE__*/_interopDefaultLegacy(addFormats);
25
25
  var addErrors__default = /*#__PURE__*/_interopDefaultLegacy(addErrors);
@@ -62,227 +62,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
62
62
  });
63
63
  }
64
64
 
65
- const spaceTypes = {
66
- Space: [
67
- { name: 'from', type: 'address' },
68
- { name: 'space', type: 'string' },
69
- { name: 'timestamp', type: 'uint64' },
70
- { name: 'settings', type: 'string' }
71
- ]
72
- };
73
- const proposalTypes = {
74
- Proposal: [
75
- { name: 'from', type: 'string' },
76
- { name: 'space', type: 'string' },
77
- { name: 'timestamp', type: 'uint64' },
78
- { name: 'type', type: 'string' },
79
- { name: 'title', type: 'string' },
80
- { name: 'body', type: 'string' },
81
- { name: 'discussion', type: 'string' },
82
- { name: 'choices', type: 'string[]' },
83
- { name: 'labels', type: 'string[]' },
84
- { name: 'start', type: 'uint64' },
85
- { name: 'end', type: 'uint64' },
86
- { name: 'snapshot', type: 'uint64' },
87
- { name: 'plugins', type: 'string' },
88
- { name: 'privacy', type: 'string' },
89
- { name: 'app', type: 'string' }
90
- ]
91
- };
92
- const updateProposalTypes = {
93
- UpdateProposal: [
94
- { name: 'proposal', type: 'string' },
95
- { name: 'from', type: 'string' },
96
- { name: 'space', type: 'string' },
97
- { name: 'timestamp', type: 'uint64' },
98
- { name: 'type', type: 'string' },
99
- { name: 'title', type: 'string' },
100
- { name: 'body', type: 'string' },
101
- { name: 'discussion', type: 'string' },
102
- { name: 'choices', type: 'string[]' },
103
- { name: 'labels', type: 'string[]' },
104
- { name: 'plugins', type: 'string' },
105
- { name: 'privacy', type: 'string' }
106
- ]
107
- };
108
- const flagProposalTypes = {
109
- FlagProposal: [
110
- { name: 'from', type: 'string' },
111
- { name: 'space', type: 'string' },
112
- { name: 'proposal', type: 'string' },
113
- { name: 'timestamp', type: 'uint64' }
114
- ]
115
- };
116
- const cancelProposalTypes = {
117
- CancelProposal: [
118
- { name: 'from', type: 'string' },
119
- { name: 'space', type: 'string' },
120
- { name: 'timestamp', type: 'uint64' },
121
- { name: 'proposal', type: 'string' }
122
- ]
123
- };
124
- const cancelProposal2Types = {
125
- CancelProposal: [
126
- { name: 'from', type: 'string' },
127
- { name: 'space', type: 'string' },
128
- { name: 'timestamp', type: 'uint64' },
129
- { name: 'proposal', type: 'bytes32' }
130
- ]
131
- };
132
- const voteTypes = {
133
- Vote: [
134
- { name: 'from', type: 'string' },
135
- { name: 'space', type: 'string' },
136
- { name: 'timestamp', type: 'uint64' },
137
- { name: 'proposal', type: 'string' },
138
- { name: 'choice', type: 'uint32' },
139
- { name: 'reason', type: 'string' },
140
- { name: 'app', type: 'string' },
141
- { name: 'metadata', type: 'string' }
142
- ]
143
- };
144
- const voteArrayTypes = {
145
- Vote: [
146
- { name: 'from', type: 'string' },
147
- { name: 'space', type: 'string' },
148
- { name: 'timestamp', type: 'uint64' },
149
- { name: 'proposal', type: 'string' },
150
- { name: 'choice', type: 'uint32[]' },
151
- { name: 'reason', type: 'string' },
152
- { name: 'app', type: 'string' },
153
- { name: 'metadata', type: 'string' }
154
- ]
155
- };
156
- const voteStringTypes = {
157
- Vote: [
158
- { name: 'from', type: 'string' },
159
- { name: 'space', type: 'string' },
160
- { name: 'timestamp', type: 'uint64' },
161
- { name: 'proposal', type: 'string' },
162
- { name: 'choice', type: 'string' },
163
- { name: 'reason', type: 'string' },
164
- { name: 'app', type: 'string' },
165
- { name: 'metadata', type: 'string' }
166
- ]
167
- };
168
- const vote2Types = {
169
- Vote: [
170
- { name: 'from', type: 'string' },
171
- { name: 'space', type: 'string' },
172
- { name: 'timestamp', type: 'uint64' },
173
- { name: 'proposal', type: 'bytes32' },
174
- { name: 'choice', type: 'uint32' },
175
- { name: 'reason', type: 'string' },
176
- { name: 'app', type: 'string' },
177
- { name: 'metadata', type: 'string' }
178
- ]
179
- };
180
- const voteArray2Types = {
181
- Vote: [
182
- { name: 'from', type: 'string' },
183
- { name: 'space', type: 'string' },
184
- { name: 'timestamp', type: 'uint64' },
185
- { name: 'proposal', type: 'bytes32' },
186
- { name: 'choice', type: 'uint32[]' },
187
- { name: 'reason', type: 'string' },
188
- { name: 'app', type: 'string' },
189
- { name: 'metadata', type: 'string' }
190
- ]
191
- };
192
- const voteString2Types = {
193
- Vote: [
194
- { name: 'from', type: 'string' },
195
- { name: 'space', type: 'string' },
196
- { name: 'timestamp', type: 'uint64' },
197
- { name: 'proposal', type: 'bytes32' },
198
- { name: 'choice', type: 'string' },
199
- { name: 'reason', type: 'string' },
200
- { name: 'app', type: 'string' },
201
- { name: 'metadata', type: 'string' }
202
- ]
203
- };
204
- const followTypes = {
205
- Follow: [
206
- { name: 'from', type: 'address' },
207
- { name: 'network', type: 'string' },
208
- { name: 'space', type: 'string' },
209
- { name: 'timestamp', type: 'uint64' }
210
- ]
211
- };
212
- const unfollowTypes = {
213
- Unfollow: [
214
- { name: 'from', type: 'address' },
215
- { name: 'network', type: 'string' },
216
- { name: 'space', type: 'string' },
217
- { name: 'timestamp', type: 'uint64' }
218
- ]
219
- };
220
- const subscribeTypes = {
221
- Subscribe: [
222
- { name: 'from', type: 'address' },
223
- { name: 'space', type: 'string' },
224
- { name: 'timestamp', type: 'uint64' }
225
- ]
226
- };
227
- const unsubscribeTypes = {
228
- Unsubscribe: [
229
- { name: 'from', type: 'address' },
230
- { name: 'space', type: 'string' },
231
- { name: 'timestamp', type: 'uint64' }
232
- ]
233
- };
234
- const profileTypes = {
235
- Profile: [
236
- { name: 'from', type: 'address' },
237
- { name: 'timestamp', type: 'uint64' },
238
- { name: 'profile', type: 'string' }
239
- ]
240
- };
241
- const statementTypes = {
242
- Statement: [
243
- { name: 'from', type: 'address' },
244
- { name: 'timestamp', type: 'uint64' },
245
- { name: 'space', type: 'string' },
246
- { name: 'about', type: 'string' },
247
- { name: 'statement', type: 'string' },
248
- { name: 'discourse', type: 'string' },
249
- { name: 'status', type: 'string' },
250
- { name: 'network', type: 'string' }
251
- ]
252
- };
253
- const aliasTypes = {
254
- Alias: [
255
- { name: 'from', type: 'address' },
256
- { name: 'alias', type: 'address' },
257
- { name: 'timestamp', type: 'uint64' }
258
- ]
259
- };
260
- const deleteSpaceType = {
261
- DeleteSpace: [
262
- { name: 'from', type: 'address' },
263
- { name: 'space', type: 'string' },
264
- { name: 'timestamp', type: 'uint64' }
265
- ]
266
- };
267
-
268
- var mainnet = {
269
- hub: "https://hub.snapshot.org",
270
- sequencer: "https://seq.snapshot.org"
271
- };
272
- var testnet = {
273
- hub: "https://testnet.hub.snapshot.org",
274
- sequencer: "https://testnet.seq.snapshot.org"
275
- };
276
- var local = {
277
- hub: "http://localhost:3000",
278
- sequencer: "http://localhost:3001"
279
- };
280
- var constants = {
281
- mainnet: mainnet,
282
- testnet: testnet,
283
- local: local
284
- };
285
-
286
65
  let cache = {};
287
66
  let expirationTime = 0;
288
67
  function getSnapshots(network_1, snapshot_1, provider_1, networks_1) {
@@ -3470,14 +3249,17 @@ const ENS_ABI = [
3470
3249
  'function text(bytes32 node, string calldata key) external view returns (string memory)',
3471
3250
  'function resolver(bytes32 node) view returns (address)' // ENS registry ABI
3472
3251
  ];
3473
- const SONIC_ABI = [
3474
- 'function ownerOf(uint256 tokenId) external view returns (address address)'
3252
+ const UD_MAPPING = {
3253
+ '146': {
3254
+ tlds: ['.sonic'],
3255
+ registryContract: '0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4'
3256
+ }
3257
+ };
3258
+ const UD_REGISTRY_ABI = [
3259
+ 'function ownerOf(uint256 tokenId) view returns (address owner)'
3475
3260
  ];
3476
- const SONIC_CONTRACT_ADDRESS = '0xde1dadcf11a7447c3d093e97fdbd513f488ce3b4';
3477
3261
  const ENS_CHAIN_IDS = ['1', '11155111'];
3478
3262
  const SHIBARIUM_CHAIN_IDS = ['109', '157'];
3479
- const SONIC_CHAIN_IDS = ['146'];
3480
- const SONIC_TLD = '.sonic';
3481
3263
  const SHIBARIUM_TLD = '.shib';
3482
3264
  const EMPTY_ADDRESS = '0x0000000000000000000000000000000000000000';
3483
3265
  const scoreApiHeaders = {
@@ -3642,7 +3424,7 @@ function getDomainType(domain) {
3642
3424
  function getDNSOwner(domain) {
3643
3425
  return __awaiter(this, void 0, void 0, function* () {
3644
3426
  var _a;
3645
- const response = yield fetch__default['default'](`https://cloudflare-dns.com/dns-query?name=${domain}&type=TXT`, {
3427
+ const response = yield fetch(`https://cloudflare-dns.com/dns-query?name=${domain}&type=TXT`, {
3646
3428
  headers: {
3647
3429
  accept: 'application/dns-json'
3648
3430
  }
@@ -3676,7 +3458,7 @@ function subgraphRequest(url_1, query_1) {
3676
3458
  const body = { query: jsonToGraphqlQuery.jsonToGraphQLQuery({ query }) };
3677
3459
  if (options.variables)
3678
3460
  body.variables = options.variables;
3679
- const res = yield fetch__default['default'](url, {
3461
+ const res = yield fetch(url, {
3680
3462
  method: 'POST',
3681
3463
  headers: Object.assign({ Accept: 'application/json', 'Content-Type': 'application/json' }, options === null || options === void 0 ? void 0 : options.headers),
3682
3464
  body: JSON.stringify(body)
@@ -3711,16 +3493,73 @@ function getUrl(uri, gateway = gateways[0]) {
3711
3493
  return uri.replace('ipns://', `${ipfsGateway}/ipns/`);
3712
3494
  return uri;
3713
3495
  }
3496
+ /**
3497
+ * Enhanced fetch with timeout support - drop-in replacement for native fetch
3498
+ *
3499
+ * @param url - The URL to fetch
3500
+ * @param options - Fetch options with optional timeout
3501
+ * @param options.timeout - Request timeout in milliseconds (default: 30000ms). Set to 0 to disable timeout.
3502
+ *
3503
+ * @returns Promise that resolves to the Response object
3504
+ *
3505
+ * @throws {Error} Throws timeout error if request exceeds the specified timeout duration
3506
+ *
3507
+ * @example
3508
+ * ```typescript
3509
+ * // Uses default 30s timeout
3510
+ * const response = await fetch('https://api.example.com/data');
3511
+ *
3512
+ * // Custom 5s timeout
3513
+ * const response = await fetch('https://api.example.com/data', { timeout: 5000 });
3514
+ *
3515
+ * // Disable timeout
3516
+ * const response = await fetch('https://api.example.com/data', { timeout: 0 });
3517
+ *
3518
+ * // With additional fetch options
3519
+ * const response = await fetch('https://api.example.com/data', {
3520
+ * timeout: 10000,
3521
+ * method: 'POST',
3522
+ * headers: { 'Content-Type': 'application/json' },
3523
+ * body: JSON.stringify({ key: 'value' })
3524
+ * });
3525
+ * ```
3526
+ */
3527
+ function fetch(url_1) {
3528
+ return __awaiter(this, arguments, void 0, function* (url, options = {}) {
3529
+ const { timeout = 30000 } = options, fetchOptions = __rest(options, ["timeout"]);
3530
+ if (timeout > 0) {
3531
+ const controller = new AbortController();
3532
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
3533
+ try {
3534
+ const response = yield crossFetch__default['default'](url, Object.assign(Object.assign({}, fetchOptions), { signal: controller.signal }));
3535
+ return response;
3536
+ }
3537
+ catch (error) {
3538
+ if (error instanceof Error && error.name === 'AbortError') {
3539
+ throw new Error(`Request timeout after ${timeout}ms`);
3540
+ }
3541
+ throw error;
3542
+ }
3543
+ finally {
3544
+ clearTimeout(timeoutId);
3545
+ }
3546
+ }
3547
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3548
+ const cleanFetchOptions = __rest(fetchOptions, ["signal"]);
3549
+ return crossFetch__default['default'](url, cleanFetchOptions);
3550
+ });
3551
+ }
3714
3552
  function getJSON(uri_1) {
3715
3553
  return __awaiter(this, arguments, void 0, function* (uri, options = {}) {
3716
3554
  const url = getUrl(uri, options.gateways);
3717
- return fetch__default['default'](url).then((res) => res.json());
3555
+ const response = yield fetch(url, options);
3556
+ return response.json();
3718
3557
  });
3719
3558
  }
3720
3559
  function ipfsGet(gateway_1, ipfsHash_1) {
3721
3560
  return __awaiter(this, arguments, void 0, function* (gateway, ipfsHash, protocolType = 'ipfs') {
3722
3561
  const url = `https://${gateway}/${protocolType}/${ipfsHash}`;
3723
- return fetch__default['default'](url).then((res) => res.json());
3562
+ return fetch(url).then((res) => res.json());
3724
3563
  });
3725
3564
  }
3726
3565
  function sendTransaction(web3_1, contractAddress_1, abi_1, action_1, params_1) {
@@ -3767,7 +3606,7 @@ function getScores(space_1, strategies_1, network_1, addresses_1) {
3767
3606
  strategies,
3768
3607
  addresses
3769
3608
  };
3770
- const res = yield fetch__default['default'](url, {
3609
+ const res = yield fetch(url, {
3771
3610
  method: 'POST',
3772
3611
  headers,
3773
3612
  body: JSON.stringify({ params })
@@ -3818,7 +3657,7 @@ function getVp(address, network, strategies, snapshot, space, delegation, option
3818
3657
  })
3819
3658
  };
3820
3659
  try {
3821
- const res = yield fetch__default['default'](url, init);
3660
+ const res = yield fetch(url, init);
3822
3661
  const response = yield parseScoreAPIResponse(res);
3823
3662
  return response.result;
3824
3663
  }
@@ -3861,7 +3700,7 @@ function validate(validation, author, space, network, snapshot, params, options)
3861
3700
  })
3862
3701
  };
3863
3702
  try {
3864
- const res = yield fetch__default['default'](url, init);
3703
+ const res = yield fetch(url, init);
3865
3704
  const response = yield parseScoreAPIResponse(res);
3866
3705
  return response.result;
3867
3706
  }
@@ -3984,7 +3823,7 @@ function getShibariumNameOwner(id, network) {
3984
3823
  if (!id.endsWith(SHIBARIUM_TLD)) {
3985
3824
  return EMPTY_ADDRESS;
3986
3825
  }
3987
- const response = yield fetch__default['default']('https://stamp.fyi', {
3826
+ const response = yield fetch('https://stamp.fyi', {
3988
3827
  method: 'POST',
3989
3828
  headers: {
3990
3829
  'Content-Type': 'application/json'
@@ -3999,16 +3838,18 @@ function getShibariumNameOwner(id, network) {
3999
3838
  return data.result;
4000
3839
  });
4001
3840
  }
4002
- function getSonicNameOwner(id, network) {
3841
+ function getUDNameOwner(id, network) {
4003
3842
  return __awaiter(this, void 0, void 0, function* () {
4004
- if (!id.endsWith(SONIC_TLD)) {
3843
+ var _a;
3844
+ const tlds = ((_a = UD_MAPPING[network]) === null || _a === void 0 ? void 0 : _a.tlds) || [];
3845
+ if (!tlds.some((tld) => id.endsWith(tld))) {
4005
3846
  return Promise.resolve(EMPTY_ADDRESS);
4006
3847
  }
4007
3848
  try {
4008
3849
  const hash$1 = hash.namehash(hash.ensNormalize(id));
4009
- const tokenId = BigInt(hash$1).toString();
3850
+ const tokenId = BigInt(hash$1);
4010
3851
  const provider = getProvider(network);
4011
- return yield call(provider, SONIC_ABI, [SONIC_CONTRACT_ADDRESS, 'ownerOf', [tokenId]], {
3852
+ return yield call(provider, UD_REGISTRY_ABI, [UD_MAPPING[network].registryContract, 'ownerOf', [tokenId]], {
4012
3853
  blockTag: 'latest'
4013
3854
  });
4014
3855
  }
@@ -4025,8 +3866,8 @@ function getSpaceController(id_1) {
4025
3866
  else if (SHIBARIUM_CHAIN_IDS.includes(network)) {
4026
3867
  return getShibariumNameOwner(id, network);
4027
3868
  }
4028
- else if (SONIC_CHAIN_IDS.includes(network)) {
4029
- return getSonicNameOwner(id, network);
3869
+ else if (UD_MAPPING[String(network)]) {
3870
+ return getUDNameOwner(id, network);
4030
3871
  }
4031
3872
  throw new Error(`Network not supported: ${network}`);
4032
3873
  });
@@ -4087,6 +3928,7 @@ function inputError(message) {
4087
3928
  var utils = {
4088
3929
  call,
4089
3930
  multicall: multicall$2,
3931
+ fetch,
4090
3932
  subgraphRequest,
4091
3933
  ipfsGet,
4092
3934
  getUrl,
@@ -4118,6 +3960,227 @@ var utils = {
4118
3960
  SNAPSHOT_SUBGRAPH_URL
4119
3961
  };
4120
3962
 
3963
+ const spaceTypes = {
3964
+ Space: [
3965
+ { name: 'from', type: 'address' },
3966
+ { name: 'space', type: 'string' },
3967
+ { name: 'timestamp', type: 'uint64' },
3968
+ { name: 'settings', type: 'string' }
3969
+ ]
3970
+ };
3971
+ const proposalTypes = {
3972
+ Proposal: [
3973
+ { name: 'from', type: 'string' },
3974
+ { name: 'space', type: 'string' },
3975
+ { name: 'timestamp', type: 'uint64' },
3976
+ { name: 'type', type: 'string' },
3977
+ { name: 'title', type: 'string' },
3978
+ { name: 'body', type: 'string' },
3979
+ { name: 'discussion', type: 'string' },
3980
+ { name: 'choices', type: 'string[]' },
3981
+ { name: 'labels', type: 'string[]' },
3982
+ { name: 'start', type: 'uint64' },
3983
+ { name: 'end', type: 'uint64' },
3984
+ { name: 'snapshot', type: 'uint64' },
3985
+ { name: 'plugins', type: 'string' },
3986
+ { name: 'privacy', type: 'string' },
3987
+ { name: 'app', type: 'string' }
3988
+ ]
3989
+ };
3990
+ const updateProposalTypes = {
3991
+ UpdateProposal: [
3992
+ { name: 'proposal', type: 'string' },
3993
+ { name: 'from', type: 'string' },
3994
+ { name: 'space', type: 'string' },
3995
+ { name: 'timestamp', type: 'uint64' },
3996
+ { name: 'type', type: 'string' },
3997
+ { name: 'title', type: 'string' },
3998
+ { name: 'body', type: 'string' },
3999
+ { name: 'discussion', type: 'string' },
4000
+ { name: 'choices', type: 'string[]' },
4001
+ { name: 'labels', type: 'string[]' },
4002
+ { name: 'plugins', type: 'string' },
4003
+ { name: 'privacy', type: 'string' }
4004
+ ]
4005
+ };
4006
+ const flagProposalTypes = {
4007
+ FlagProposal: [
4008
+ { name: 'from', type: 'string' },
4009
+ { name: 'space', type: 'string' },
4010
+ { name: 'proposal', type: 'string' },
4011
+ { name: 'timestamp', type: 'uint64' }
4012
+ ]
4013
+ };
4014
+ const cancelProposalTypes = {
4015
+ CancelProposal: [
4016
+ { name: 'from', type: 'string' },
4017
+ { name: 'space', type: 'string' },
4018
+ { name: 'timestamp', type: 'uint64' },
4019
+ { name: 'proposal', type: 'string' }
4020
+ ]
4021
+ };
4022
+ const cancelProposal2Types = {
4023
+ CancelProposal: [
4024
+ { name: 'from', type: 'string' },
4025
+ { name: 'space', type: 'string' },
4026
+ { name: 'timestamp', type: 'uint64' },
4027
+ { name: 'proposal', type: 'bytes32' }
4028
+ ]
4029
+ };
4030
+ const voteTypes = {
4031
+ Vote: [
4032
+ { name: 'from', type: 'string' },
4033
+ { name: 'space', type: 'string' },
4034
+ { name: 'timestamp', type: 'uint64' },
4035
+ { name: 'proposal', type: 'string' },
4036
+ { name: 'choice', type: 'uint32' },
4037
+ { name: 'reason', type: 'string' },
4038
+ { name: 'app', type: 'string' },
4039
+ { name: 'metadata', type: 'string' }
4040
+ ]
4041
+ };
4042
+ const voteArrayTypes = {
4043
+ Vote: [
4044
+ { name: 'from', type: 'string' },
4045
+ { name: 'space', type: 'string' },
4046
+ { name: 'timestamp', type: 'uint64' },
4047
+ { name: 'proposal', type: 'string' },
4048
+ { name: 'choice', type: 'uint32[]' },
4049
+ { name: 'reason', type: 'string' },
4050
+ { name: 'app', type: 'string' },
4051
+ { name: 'metadata', type: 'string' }
4052
+ ]
4053
+ };
4054
+ const voteStringTypes = {
4055
+ Vote: [
4056
+ { name: 'from', type: 'string' },
4057
+ { name: 'space', type: 'string' },
4058
+ { name: 'timestamp', type: 'uint64' },
4059
+ { name: 'proposal', type: 'string' },
4060
+ { name: 'choice', type: 'string' },
4061
+ { name: 'reason', type: 'string' },
4062
+ { name: 'app', type: 'string' },
4063
+ { name: 'metadata', type: 'string' }
4064
+ ]
4065
+ };
4066
+ const vote2Types = {
4067
+ Vote: [
4068
+ { name: 'from', type: 'string' },
4069
+ { name: 'space', type: 'string' },
4070
+ { name: 'timestamp', type: 'uint64' },
4071
+ { name: 'proposal', type: 'bytes32' },
4072
+ { name: 'choice', type: 'uint32' },
4073
+ { name: 'reason', type: 'string' },
4074
+ { name: 'app', type: 'string' },
4075
+ { name: 'metadata', type: 'string' }
4076
+ ]
4077
+ };
4078
+ const voteArray2Types = {
4079
+ Vote: [
4080
+ { name: 'from', type: 'string' },
4081
+ { name: 'space', type: 'string' },
4082
+ { name: 'timestamp', type: 'uint64' },
4083
+ { name: 'proposal', type: 'bytes32' },
4084
+ { name: 'choice', type: 'uint32[]' },
4085
+ { name: 'reason', type: 'string' },
4086
+ { name: 'app', type: 'string' },
4087
+ { name: 'metadata', type: 'string' }
4088
+ ]
4089
+ };
4090
+ const voteString2Types = {
4091
+ Vote: [
4092
+ { name: 'from', type: 'string' },
4093
+ { name: 'space', type: 'string' },
4094
+ { name: 'timestamp', type: 'uint64' },
4095
+ { name: 'proposal', type: 'bytes32' },
4096
+ { name: 'choice', type: 'string' },
4097
+ { name: 'reason', type: 'string' },
4098
+ { name: 'app', type: 'string' },
4099
+ { name: 'metadata', type: 'string' }
4100
+ ]
4101
+ };
4102
+ const followTypes = {
4103
+ Follow: [
4104
+ { name: 'from', type: 'address' },
4105
+ { name: 'network', type: 'string' },
4106
+ { name: 'space', type: 'string' },
4107
+ { name: 'timestamp', type: 'uint64' }
4108
+ ]
4109
+ };
4110
+ const unfollowTypes = {
4111
+ Unfollow: [
4112
+ { name: 'from', type: 'address' },
4113
+ { name: 'network', type: 'string' },
4114
+ { name: 'space', type: 'string' },
4115
+ { name: 'timestamp', type: 'uint64' }
4116
+ ]
4117
+ };
4118
+ const subscribeTypes = {
4119
+ Subscribe: [
4120
+ { name: 'from', type: 'address' },
4121
+ { name: 'space', type: 'string' },
4122
+ { name: 'timestamp', type: 'uint64' }
4123
+ ]
4124
+ };
4125
+ const unsubscribeTypes = {
4126
+ Unsubscribe: [
4127
+ { name: 'from', type: 'address' },
4128
+ { name: 'space', type: 'string' },
4129
+ { name: 'timestamp', type: 'uint64' }
4130
+ ]
4131
+ };
4132
+ const profileTypes = {
4133
+ Profile: [
4134
+ { name: 'from', type: 'address' },
4135
+ { name: 'timestamp', type: 'uint64' },
4136
+ { name: 'profile', type: 'string' }
4137
+ ]
4138
+ };
4139
+ const statementTypes = {
4140
+ Statement: [
4141
+ { name: 'from', type: 'address' },
4142
+ { name: 'timestamp', type: 'uint64' },
4143
+ { name: 'space', type: 'string' },
4144
+ { name: 'about', type: 'string' },
4145
+ { name: 'statement', type: 'string' },
4146
+ { name: 'discourse', type: 'string' },
4147
+ { name: 'status', type: 'string' },
4148
+ { name: 'network', type: 'string' }
4149
+ ]
4150
+ };
4151
+ const aliasTypes = {
4152
+ Alias: [
4153
+ { name: 'from', type: 'address' },
4154
+ { name: 'alias', type: 'address' },
4155
+ { name: 'timestamp', type: 'uint64' }
4156
+ ]
4157
+ };
4158
+ const deleteSpaceType = {
4159
+ DeleteSpace: [
4160
+ { name: 'from', type: 'address' },
4161
+ { name: 'space', type: 'string' },
4162
+ { name: 'timestamp', type: 'uint64' }
4163
+ ]
4164
+ };
4165
+
4166
+ var mainnet = {
4167
+ hub: "https://hub.snapshot.org",
4168
+ sequencer: "https://seq.snapshot.org"
4169
+ };
4170
+ var testnet = {
4171
+ hub: "https://testnet.hub.snapshot.org",
4172
+ sequencer: "https://testnet.seq.snapshot.org"
4173
+ };
4174
+ var local = {
4175
+ hub: "http://localhost:3000",
4176
+ sequencer: "http://localhost:3001"
4177
+ };
4178
+ var constants = {
4179
+ mainnet: mainnet,
4180
+ testnet: testnet,
4181
+ local: local
4182
+ };
4183
+
4121
4184
  const NAME = 'snapshot';
4122
4185
  const VERSION = '0.1.4';
4123
4186
  const domain = {
@@ -4168,7 +4231,7 @@ class Client {
4168
4231
  body: JSON.stringify(envelop)
4169
4232
  };
4170
4233
  return new Promise((resolve, reject) => {
4171
- fetch__default['default'](address, init)
4234
+ fetch(address, init)
4172
4235
  .then((res) => {
4173
4236
  var _a;
4174
4237
  if (res.ok)