@snapshot-labs/snapshot.js 0.14.17 → 0.14.19
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 +9 -48
- package/dist/snapshot.esm.js +9 -48
- package/dist/snapshot.min.js +1 -1
- package/dist/src/sign/types.d.ts +0 -18
- package/package.json +1 -1
- package/src/sign/index.ts +4 -8
- package/src/sign/types.ts +1 -40
- package/src/utils.ts +2 -4
package/dist/src/sign/types.d.ts
CHANGED
|
@@ -163,24 +163,6 @@ export declare const voteStringTypes: {
|
|
|
163
163
|
type: string;
|
|
164
164
|
}[];
|
|
165
165
|
};
|
|
166
|
-
export declare const vote2Types: {
|
|
167
|
-
Vote: {
|
|
168
|
-
name: string;
|
|
169
|
-
type: string;
|
|
170
|
-
}[];
|
|
171
|
-
};
|
|
172
|
-
export declare const voteArray2Types: {
|
|
173
|
-
Vote: {
|
|
174
|
-
name: string;
|
|
175
|
-
type: string;
|
|
176
|
-
}[];
|
|
177
|
-
};
|
|
178
|
-
export declare const voteString2Types: {
|
|
179
|
-
Vote: {
|
|
180
|
-
name: string;
|
|
181
|
-
type: string;
|
|
182
|
-
}[];
|
|
183
|
-
};
|
|
184
166
|
export declare const followTypes: {
|
|
185
167
|
Follow: {
|
|
186
168
|
name: string;
|
package/package.json
CHANGED
package/src/sign/index.ts
CHANGED
|
@@ -25,9 +25,6 @@ import {
|
|
|
25
25
|
voteTypes,
|
|
26
26
|
voteArrayTypes,
|
|
27
27
|
voteStringTypes,
|
|
28
|
-
vote2Types,
|
|
29
|
-
voteArray2Types,
|
|
30
|
-
voteString2Types,
|
|
31
28
|
followTypes,
|
|
32
29
|
subscribeTypes,
|
|
33
30
|
unfollowTypes,
|
|
@@ -169,15 +166,14 @@ export default class Client {
|
|
|
169
166
|
if (!message.reason) message.reason = '';
|
|
170
167
|
if (!message.app) message.app = '';
|
|
171
168
|
if (!message.metadata) message.metadata = '{}';
|
|
172
|
-
|
|
173
|
-
let type = type2 ? vote2Types : voteTypes;
|
|
169
|
+
let type = voteTypes;
|
|
174
170
|
if (['approval', 'ranked-choice'].includes(message.type))
|
|
175
|
-
type =
|
|
171
|
+
type = voteArrayTypes;
|
|
176
172
|
if (!isShutter && ['quadratic', 'weighted'].includes(message.type)) {
|
|
177
|
-
type =
|
|
173
|
+
type = voteStringTypes;
|
|
178
174
|
message.choice = JSON.stringify(message.choice);
|
|
179
175
|
}
|
|
180
|
-
if (isShutter) type =
|
|
176
|
+
if (isShutter) type = voteStringTypes;
|
|
181
177
|
delete message.privacy;
|
|
182
178
|
// @ts-ignore
|
|
183
179
|
delete message.type;
|
package/src/sign/types.ts
CHANGED
|
@@ -197,7 +197,7 @@ export const cancelProposal2Types = {
|
|
|
197
197
|
{ name: 'from', type: 'string' },
|
|
198
198
|
{ name: 'space', type: 'string' },
|
|
199
199
|
{ name: 'timestamp', type: 'uint64' },
|
|
200
|
-
{ name: 'proposal', type: '
|
|
200
|
+
{ name: 'proposal', type: 'string' }
|
|
201
201
|
]
|
|
202
202
|
};
|
|
203
203
|
|
|
@@ -240,45 +240,6 @@ export const voteStringTypes = {
|
|
|
240
240
|
]
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
export const vote2Types = {
|
|
244
|
-
Vote: [
|
|
245
|
-
{ name: 'from', type: 'string' },
|
|
246
|
-
{ name: 'space', type: 'string' },
|
|
247
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
248
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
249
|
-
{ name: 'choice', type: 'uint32' },
|
|
250
|
-
{ name: 'reason', type: 'string' },
|
|
251
|
-
{ name: 'app', type: 'string' },
|
|
252
|
-
{ name: 'metadata', type: 'string' }
|
|
253
|
-
]
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export const voteArray2Types = {
|
|
257
|
-
Vote: [
|
|
258
|
-
{ name: 'from', type: 'string' },
|
|
259
|
-
{ name: 'space', type: 'string' },
|
|
260
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
261
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
262
|
-
{ name: 'choice', type: 'uint32[]' },
|
|
263
|
-
{ name: 'reason', type: 'string' },
|
|
264
|
-
{ name: 'app', type: 'string' },
|
|
265
|
-
{ name: 'metadata', type: 'string' }
|
|
266
|
-
]
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
export const voteString2Types = {
|
|
270
|
-
Vote: [
|
|
271
|
-
{ name: 'from', type: 'string' },
|
|
272
|
-
{ name: 'space', type: 'string' },
|
|
273
|
-
{ name: 'timestamp', type: 'uint64' },
|
|
274
|
-
{ name: 'proposal', type: 'bytes32' },
|
|
275
|
-
{ name: 'choice', type: 'string' },
|
|
276
|
-
{ name: 'reason', type: 'string' },
|
|
277
|
-
{ name: 'app', type: 'string' },
|
|
278
|
-
{ name: 'metadata', type: 'string' }
|
|
279
|
-
]
|
|
280
|
-
};
|
|
281
|
-
|
|
282
243
|
export const followTypes = {
|
|
283
244
|
Follow: [
|
|
284
245
|
{ name: 'from', type: 'address' },
|
package/src/utils.ts
CHANGED
|
@@ -734,14 +734,12 @@ async function getEnsSpaceController(
|
|
|
734
734
|
): Promise<string> {
|
|
735
735
|
const spaceUri = await getSpaceUri(id, network, options);
|
|
736
736
|
if (spaceUri) {
|
|
737
|
-
|
|
738
|
-
if (isUriAddress) return spaceUri;
|
|
737
|
+
if (isAddress(spaceUri)) return getAddress(spaceUri);
|
|
739
738
|
|
|
740
739
|
const uriParts = spaceUri.split('/');
|
|
741
740
|
const position = uriParts.includes('testnet') ? 5 : 4;
|
|
742
741
|
const address = uriParts[position];
|
|
743
|
-
|
|
744
|
-
if (isUriAddress) return address;
|
|
742
|
+
if (isAddress(address)) return getAddress(address);
|
|
745
743
|
}
|
|
746
744
|
return await getEnsOwner(id, network, options);
|
|
747
745
|
}
|