@snapshot-labs/snapshot.js 0.3.68 → 0.3.69
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 +24 -0
- package/dist/schemas/index.d.ts +24 -0
- package/dist/sign/index.d.ts +2 -1
- package/dist/sign/types.d.ts +13 -0
- package/dist/snapshot.cjs.js +62 -5
- package/dist/snapshot.esm.js +62 -5
- package/dist/snapshot.min.js +7 -7
- package/package.json +1 -1
- package/src/schemas/index.ts +3 -1
- package/src/schemas/profile.json +30 -0
- package/src/sign/index.ts +10 -0
- package/src/sign/types.json +1 -0
- package/src/sign/types.ts +17 -0
- package/src/utils/provider.ts +20 -7
package/dist/index.d.ts
CHANGED
|
@@ -310,6 +310,30 @@ declare const _default: {
|
|
|
310
310
|
required: string[];
|
|
311
311
|
additionalProperties: boolean;
|
|
312
312
|
};
|
|
313
|
+
profile: {
|
|
314
|
+
title: string;
|
|
315
|
+
type: string;
|
|
316
|
+
properties: {
|
|
317
|
+
username: {
|
|
318
|
+
type: string;
|
|
319
|
+
title: string;
|
|
320
|
+
maxLength: number;
|
|
321
|
+
};
|
|
322
|
+
avatar: {
|
|
323
|
+
type: string;
|
|
324
|
+
title: string;
|
|
325
|
+
format: string;
|
|
326
|
+
maxLength: number;
|
|
327
|
+
};
|
|
328
|
+
bio: {
|
|
329
|
+
type: string;
|
|
330
|
+
title: string;
|
|
331
|
+
maxLength: number;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
required: never[];
|
|
335
|
+
additionalProperties: boolean;
|
|
336
|
+
};
|
|
313
337
|
};
|
|
314
338
|
utils: {
|
|
315
339
|
call: typeof import("./utils").call;
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -305,5 +305,29 @@ declare const _default: {
|
|
|
305
305
|
required: string[];
|
|
306
306
|
additionalProperties: boolean;
|
|
307
307
|
};
|
|
308
|
+
profile: {
|
|
309
|
+
title: string;
|
|
310
|
+
type: string;
|
|
311
|
+
properties: {
|
|
312
|
+
username: {
|
|
313
|
+
type: string;
|
|
314
|
+
title: string;
|
|
315
|
+
maxLength: number;
|
|
316
|
+
};
|
|
317
|
+
avatar: {
|
|
318
|
+
type: string;
|
|
319
|
+
title: string;
|
|
320
|
+
format: string;
|
|
321
|
+
maxLength: number;
|
|
322
|
+
};
|
|
323
|
+
bio: {
|
|
324
|
+
type: string;
|
|
325
|
+
title: string;
|
|
326
|
+
maxLength: number;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
required: never[];
|
|
330
|
+
additionalProperties: boolean;
|
|
331
|
+
};
|
|
308
332
|
};
|
|
309
333
|
export default _default;
|
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, Alias } from './types';
|
|
3
|
+
import { Space, Proposal, CancelProposal, Vote, Follow, Unfollow, Subscribe, Unsubscribe, Profile, Alias } from './types';
|
|
4
4
|
export declare const domain: {
|
|
5
5
|
name: string;
|
|
6
6
|
version: string;
|
|
@@ -18,5 +18,6 @@ export default class Client {
|
|
|
18
18
|
unfollow(web3: Web3Provider | Wallet, address: string, message: Unfollow): Promise<unknown>;
|
|
19
19
|
subscribe(web3: Web3Provider | Wallet, address: string, message: Subscribe): Promise<unknown>;
|
|
20
20
|
unsubscribe(web3: Web3Provider | Wallet, address: string, message: Unsubscribe): Promise<unknown>;
|
|
21
|
+
profile(web3: Web3Provider | Wallet, address: string, message: Profile): Promise<unknown>;
|
|
21
22
|
alias(web3: Web3Provider | Wallet, address: string, message: Alias): Promise<unknown>;
|
|
22
23
|
}
|
package/dist/sign/types.d.ts
CHANGED
|
@@ -56,6 +56,13 @@ export interface Unsubscribe {
|
|
|
56
56
|
space: string;
|
|
57
57
|
timestamp?: number;
|
|
58
58
|
}
|
|
59
|
+
export interface Profile {
|
|
60
|
+
from?: string;
|
|
61
|
+
timestamp?: number;
|
|
62
|
+
username?: string;
|
|
63
|
+
bio?: string;
|
|
64
|
+
avatar?: string;
|
|
65
|
+
}
|
|
59
66
|
export interface Alias {
|
|
60
67
|
from?: string;
|
|
61
68
|
alias: string;
|
|
@@ -145,6 +152,12 @@ export declare const unsubscribeTypes: {
|
|
|
145
152
|
type: string;
|
|
146
153
|
}[];
|
|
147
154
|
};
|
|
155
|
+
export declare const profileTypes: {
|
|
156
|
+
Profile: {
|
|
157
|
+
name: string;
|
|
158
|
+
type: string;
|
|
159
|
+
}[];
|
|
160
|
+
};
|
|
148
161
|
export declare const aliasTypes: {
|
|
149
162
|
Alias: {
|
|
150
163
|
name: string;
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -234,6 +234,14 @@ var unsubscribeTypes = {
|
|
|
234
234
|
{ name: 'space', type: 'string' }
|
|
235
235
|
]
|
|
236
236
|
};
|
|
237
|
+
var profileTypes = {
|
|
238
|
+
Profile: [
|
|
239
|
+
{ name: 'from', type: 'address' },
|
|
240
|
+
{ name: 'username', type: 'string' },
|
|
241
|
+
{ name: 'bio', type: 'string' },
|
|
242
|
+
{ name: 'avatar', type: 'string' }
|
|
243
|
+
]
|
|
244
|
+
};
|
|
237
245
|
var aliasTypes = {
|
|
238
246
|
Alias: [
|
|
239
247
|
{ name: 'from', type: 'address' },
|
|
@@ -403,6 +411,16 @@ var Client = /** @class */ (function () {
|
|
|
403
411
|
});
|
|
404
412
|
});
|
|
405
413
|
};
|
|
414
|
+
Client.prototype.profile = function (web3, address, message) {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
416
|
+
return __generator(this, function (_a) {
|
|
417
|
+
switch (_a.label) {
|
|
418
|
+
case 0: return [4 /*yield*/, this.sign(web3, address, message, profileTypes)];
|
|
419
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
};
|
|
406
424
|
Client.prototype.alias = function (web3, address, message) {
|
|
407
425
|
return __awaiter(this, void 0, void 0, function () {
|
|
408
426
|
return __generator(this, function (_a) {
|
|
@@ -967,10 +985,46 @@ var vote = {
|
|
|
967
985
|
definitions: definitions$2
|
|
968
986
|
};
|
|
969
987
|
|
|
988
|
+
var $schema$3 = "http://json-schema.org/draft-07/schema#";
|
|
989
|
+
var $ref$3 = "#/definitions/Profile";
|
|
990
|
+
var definitions$3 = {
|
|
991
|
+
Profile: {
|
|
992
|
+
title: "Profile",
|
|
993
|
+
type: "object",
|
|
994
|
+
properties: {
|
|
995
|
+
username: {
|
|
996
|
+
type: "string",
|
|
997
|
+
title: "username",
|
|
998
|
+
maxLength: 32
|
|
999
|
+
},
|
|
1000
|
+
avatar: {
|
|
1001
|
+
type: "string",
|
|
1002
|
+
title: "avatar",
|
|
1003
|
+
format: "uri",
|
|
1004
|
+
maxLength: 128
|
|
1005
|
+
},
|
|
1006
|
+
bio: {
|
|
1007
|
+
type: "string",
|
|
1008
|
+
title: "bio",
|
|
1009
|
+
maxLength: 256
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
required: [
|
|
1013
|
+
],
|
|
1014
|
+
additionalProperties: false
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
var profile = {
|
|
1018
|
+
$schema: $schema$3,
|
|
1019
|
+
$ref: $ref$3,
|
|
1020
|
+
definitions: definitions$3
|
|
1021
|
+
};
|
|
1022
|
+
|
|
970
1023
|
var schemas = {
|
|
971
1024
|
space: space.definitions.Space,
|
|
972
1025
|
proposal: proposal.definitions.Proposal,
|
|
973
|
-
vote: vote.definitions.Vote
|
|
1026
|
+
vote: vote.definitions.Vote,
|
|
1027
|
+
profile: profile.definitions.Profile
|
|
974
1028
|
};
|
|
975
1029
|
|
|
976
1030
|
var Multicaller = /** @class */ (function () {
|
|
@@ -2149,10 +2203,13 @@ function getProvider(network, type) {
|
|
|
2149
2203
|
var url = networks[network].rpc[0];
|
|
2150
2204
|
if (type === 'light' && ((_a = networks[network].light) === null || _a === void 0 ? void 0 : _a.length))
|
|
2151
2205
|
url = networks[network].light[0];
|
|
2152
|
-
var connectionInfo = typeof url === 'object'
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2206
|
+
var connectionInfo = typeof url === 'object'
|
|
2207
|
+
? __assign(__assign({}, url), { timeout: 25000 }) : { url: url, timeout: 25000 };
|
|
2208
|
+
if (!providers[network] || !providers[network][type]) {
|
|
2209
|
+
providers[network] = __assign({}, providers[network]);
|
|
2210
|
+
providers[network][type] = new providers$1.StaticJsonRpcProvider(connectionInfo);
|
|
2211
|
+
}
|
|
2212
|
+
return providers[network][type];
|
|
2156
2213
|
}
|
|
2157
2214
|
|
|
2158
2215
|
function validate(author, space, proposal, options) {
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -225,6 +225,14 @@ var unsubscribeTypes = {
|
|
|
225
225
|
{ name: 'space', type: 'string' }
|
|
226
226
|
]
|
|
227
227
|
};
|
|
228
|
+
var profileTypes = {
|
|
229
|
+
Profile: [
|
|
230
|
+
{ name: 'from', type: 'address' },
|
|
231
|
+
{ name: 'username', type: 'string' },
|
|
232
|
+
{ name: 'bio', type: 'string' },
|
|
233
|
+
{ name: 'avatar', type: 'string' }
|
|
234
|
+
]
|
|
235
|
+
};
|
|
228
236
|
var aliasTypes = {
|
|
229
237
|
Alias: [
|
|
230
238
|
{ name: 'from', type: 'address' },
|
|
@@ -394,6 +402,16 @@ var Client = /** @class */ (function () {
|
|
|
394
402
|
});
|
|
395
403
|
});
|
|
396
404
|
};
|
|
405
|
+
Client.prototype.profile = function (web3, address, message) {
|
|
406
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
407
|
+
return __generator(this, function (_a) {
|
|
408
|
+
switch (_a.label) {
|
|
409
|
+
case 0: return [4 /*yield*/, this.sign(web3, address, message, profileTypes)];
|
|
410
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
};
|
|
397
415
|
Client.prototype.alias = function (web3, address, message) {
|
|
398
416
|
return __awaiter(this, void 0, void 0, function () {
|
|
399
417
|
return __generator(this, function (_a) {
|
|
@@ -958,10 +976,46 @@ var vote = {
|
|
|
958
976
|
definitions: definitions$2
|
|
959
977
|
};
|
|
960
978
|
|
|
979
|
+
var $schema$3 = "http://json-schema.org/draft-07/schema#";
|
|
980
|
+
var $ref$3 = "#/definitions/Profile";
|
|
981
|
+
var definitions$3 = {
|
|
982
|
+
Profile: {
|
|
983
|
+
title: "Profile",
|
|
984
|
+
type: "object",
|
|
985
|
+
properties: {
|
|
986
|
+
username: {
|
|
987
|
+
type: "string",
|
|
988
|
+
title: "username",
|
|
989
|
+
maxLength: 32
|
|
990
|
+
},
|
|
991
|
+
avatar: {
|
|
992
|
+
type: "string",
|
|
993
|
+
title: "avatar",
|
|
994
|
+
format: "uri",
|
|
995
|
+
maxLength: 128
|
|
996
|
+
},
|
|
997
|
+
bio: {
|
|
998
|
+
type: "string",
|
|
999
|
+
title: "bio",
|
|
1000
|
+
maxLength: 256
|
|
1001
|
+
}
|
|
1002
|
+
},
|
|
1003
|
+
required: [
|
|
1004
|
+
],
|
|
1005
|
+
additionalProperties: false
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
var profile = {
|
|
1009
|
+
$schema: $schema$3,
|
|
1010
|
+
$ref: $ref$3,
|
|
1011
|
+
definitions: definitions$3
|
|
1012
|
+
};
|
|
1013
|
+
|
|
961
1014
|
var schemas = {
|
|
962
1015
|
space: space.definitions.Space,
|
|
963
1016
|
proposal: proposal.definitions.Proposal,
|
|
964
|
-
vote: vote.definitions.Vote
|
|
1017
|
+
vote: vote.definitions.Vote,
|
|
1018
|
+
profile: profile.definitions.Profile
|
|
965
1019
|
};
|
|
966
1020
|
|
|
967
1021
|
var Multicaller = /** @class */ (function () {
|
|
@@ -2140,10 +2194,13 @@ function getProvider(network, type) {
|
|
|
2140
2194
|
var url = networks[network].rpc[0];
|
|
2141
2195
|
if (type === 'light' && ((_a = networks[network].light) === null || _a === void 0 ? void 0 : _a.length))
|
|
2142
2196
|
url = networks[network].light[0];
|
|
2143
|
-
var connectionInfo = typeof url === 'object'
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2197
|
+
var connectionInfo = typeof url === 'object'
|
|
2198
|
+
? __assign(__assign({}, url), { timeout: 25000 }) : { url: url, timeout: 25000 };
|
|
2199
|
+
if (!providers[network] || !providers[network][type]) {
|
|
2200
|
+
providers[network] = __assign({}, providers[network]);
|
|
2201
|
+
providers[network][type] = new StaticJsonRpcProvider(connectionInfo);
|
|
2202
|
+
}
|
|
2203
|
+
return providers[network][type];
|
|
2147
2204
|
}
|
|
2148
2205
|
|
|
2149
2206
|
function validate(author, space, proposal, options) {
|