@snapshot-labs/snapshot.js 0.4.97 → 0.4.99
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 +20 -0
- package/dist/schemas/index.d.ts +20 -0
- package/dist/snapshot.cjs.js +85 -7
- package/dist/snapshot.esm.js +85 -7
- package/dist/snapshot.min.js +7 -7
- package/dist/utils/blockfinder.d.ts +1 -1
- package/package.json +1 -1
- package/src/networks.json +40 -1
- package/src/schemas/index.ts +2 -0
- package/src/schemas/statement.json +26 -0
- package/src/utils/blockfinder.ts +6 -0
package/dist/index.d.ts
CHANGED
|
@@ -476,6 +476,26 @@ declare const _default: {
|
|
|
476
476
|
required: never[];
|
|
477
477
|
additionalProperties: boolean;
|
|
478
478
|
};
|
|
479
|
+
statement: {
|
|
480
|
+
title: string;
|
|
481
|
+
type: string;
|
|
482
|
+
properties: {
|
|
483
|
+
about: {
|
|
484
|
+
type: string;
|
|
485
|
+
format: string;
|
|
486
|
+
title: string;
|
|
487
|
+
minLength: number;
|
|
488
|
+
maxLength: number;
|
|
489
|
+
};
|
|
490
|
+
statement: {
|
|
491
|
+
type: string;
|
|
492
|
+
format: string;
|
|
493
|
+
title: string;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
required: string[];
|
|
497
|
+
additionalProperties: boolean;
|
|
498
|
+
};
|
|
479
499
|
zodiac: {
|
|
480
500
|
title: string;
|
|
481
501
|
type: string;
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -472,6 +472,26 @@ declare const _default: {
|
|
|
472
472
|
required: never[];
|
|
473
473
|
additionalProperties: boolean;
|
|
474
474
|
};
|
|
475
|
+
statement: {
|
|
476
|
+
title: string;
|
|
477
|
+
type: string;
|
|
478
|
+
properties: {
|
|
479
|
+
about: {
|
|
480
|
+
type: string;
|
|
481
|
+
format: string;
|
|
482
|
+
title: string;
|
|
483
|
+
minLength: number;
|
|
484
|
+
maxLength: number;
|
|
485
|
+
};
|
|
486
|
+
statement: {
|
|
487
|
+
type: string;
|
|
488
|
+
format: string;
|
|
489
|
+
title: string;
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
required: string[];
|
|
493
|
+
additionalProperties: boolean;
|
|
494
|
+
};
|
|
475
495
|
zodiac: {
|
|
476
496
|
title: string;
|
|
477
497
|
type: string;
|
package/dist/snapshot.cjs.js
CHANGED
|
@@ -1091,8 +1091,40 @@ var profile = {
|
|
|
1091
1091
|
};
|
|
1092
1092
|
|
|
1093
1093
|
var $schema$4 = "http://json-schema.org/draft-07/schema#";
|
|
1094
|
-
var $ref$4 = "#/definitions/
|
|
1094
|
+
var $ref$4 = "#/definitions/Statement";
|
|
1095
1095
|
var definitions$4 = {
|
|
1096
|
+
Statement: {
|
|
1097
|
+
title: "Statement",
|
|
1098
|
+
type: "object",
|
|
1099
|
+
properties: {
|
|
1100
|
+
about: {
|
|
1101
|
+
type: "string",
|
|
1102
|
+
format: "long",
|
|
1103
|
+
title: "About",
|
|
1104
|
+
minLength: 1,
|
|
1105
|
+
maxLength: 140
|
|
1106
|
+
},
|
|
1107
|
+
statement: {
|
|
1108
|
+
type: "string",
|
|
1109
|
+
format: "long",
|
|
1110
|
+
title: "Statement"
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
required: [
|
|
1114
|
+
"about"
|
|
1115
|
+
],
|
|
1116
|
+
additionalProperties: false
|
|
1117
|
+
}
|
|
1118
|
+
};
|
|
1119
|
+
var statement = {
|
|
1120
|
+
$schema: $schema$4,
|
|
1121
|
+
$ref: $ref$4,
|
|
1122
|
+
definitions: definitions$4
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
var $schema$5 = "http://json-schema.org/draft-07/schema#";
|
|
1126
|
+
var $ref$5 = "#/definitions/Zodiac";
|
|
1127
|
+
var definitions$5 = {
|
|
1096
1128
|
Zodiac: {
|
|
1097
1129
|
title: "Zodiac",
|
|
1098
1130
|
type: "object",
|
|
@@ -1129,9 +1161,9 @@ var definitions$4 = {
|
|
|
1129
1161
|
}
|
|
1130
1162
|
};
|
|
1131
1163
|
var zodiac = {
|
|
1132
|
-
$schema: $schema$
|
|
1133
|
-
$ref: $ref$
|
|
1134
|
-
definitions: definitions$
|
|
1164
|
+
$schema: $schema$5,
|
|
1165
|
+
$ref: $ref$5,
|
|
1166
|
+
definitions: definitions$5
|
|
1135
1167
|
};
|
|
1136
1168
|
|
|
1137
1169
|
var schemas = {
|
|
@@ -1139,6 +1171,7 @@ var schemas = {
|
|
|
1139
1171
|
proposal: proposal.definitions.Proposal,
|
|
1140
1172
|
vote: vote.definitions.Vote,
|
|
1141
1173
|
profile: profile.definitions.Profile,
|
|
1174
|
+
statement: statement.definitions.Statement,
|
|
1142
1175
|
zodiac: zodiac.definitions.Zodiac
|
|
1143
1176
|
};
|
|
1144
1177
|
|
|
@@ -1179,12 +1212,16 @@ var Multicaller = /** @class */ (function () {
|
|
|
1179
1212
|
return Multicaller;
|
|
1180
1213
|
}());
|
|
1181
1214
|
|
|
1215
|
+
var cache = {};
|
|
1182
1216
|
function getSnapshots(network, snapshot, provider, networks) {
|
|
1183
1217
|
return __awaiter(this, void 0, void 0, function () {
|
|
1184
|
-
var snapshots, networkIn, block, query, url, data;
|
|
1218
|
+
var cacheKey, snapshots, networkIn, block, query, url, data;
|
|
1185
1219
|
return __generator(this, function (_a) {
|
|
1186
1220
|
switch (_a.label) {
|
|
1187
1221
|
case 0:
|
|
1222
|
+
cacheKey = network + "-" + snapshot + "-" + networks.join('-');
|
|
1223
|
+
if (cache[cacheKey])
|
|
1224
|
+
return [2 /*return*/, cache[cacheKey]];
|
|
1188
1225
|
snapshots = {};
|
|
1189
1226
|
networks.forEach(function (n) { return (snapshots[n] = 'latest'); });
|
|
1190
1227
|
if (snapshot === 'latest')
|
|
@@ -1213,11 +1250,13 @@ function getSnapshots(network, snapshot, provider, networks) {
|
|
|
1213
1250
|
case 2:
|
|
1214
1251
|
data = _a.sent();
|
|
1215
1252
|
data.blocks.forEach(function (block) { return (snapshots[block.network] = block.number); });
|
|
1253
|
+
cache[cacheKey] = snapshots;
|
|
1216
1254
|
return [2 /*return*/, snapshots];
|
|
1217
1255
|
}
|
|
1218
1256
|
});
|
|
1219
1257
|
});
|
|
1220
|
-
}
|
|
1258
|
+
}
|
|
1259
|
+
setInterval(function () { return (cache = {}); }, 1000 * 60 * 60 * 1); // Clear cache every 1 hour
|
|
1221
1260
|
|
|
1222
1261
|
var providers = {};
|
|
1223
1262
|
function getProvider(network) {
|
|
@@ -2404,6 +2443,45 @@ var networks = {
|
|
|
2404
2443
|
},
|
|
2405
2444
|
start: 43317,
|
|
2406
2445
|
logo: "ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"
|
|
2446
|
+
},
|
|
2447
|
+
"841": {
|
|
2448
|
+
key: "841",
|
|
2449
|
+
name: "Taraxa Mainnet",
|
|
2450
|
+
shortName: "841",
|
|
2451
|
+
chainId: 841,
|
|
2452
|
+
network: "mainnet",
|
|
2453
|
+
multicall: "0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",
|
|
2454
|
+
rpc: [
|
|
2455
|
+
"https://rpc.mainnet.taraxa.io"
|
|
2456
|
+
],
|
|
2457
|
+
ws: [
|
|
2458
|
+
"wss://ws.mainnet.taraxa.io"
|
|
2459
|
+
],
|
|
2460
|
+
explorer: {
|
|
2461
|
+
url: "https://mainnet.explorer.taraxa.io"
|
|
2462
|
+
},
|
|
2463
|
+
start: 1515906,
|
|
2464
|
+
logo: "ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"
|
|
2465
|
+
},
|
|
2466
|
+
"842": {
|
|
2467
|
+
key: "842",
|
|
2468
|
+
name: "Taraxa Testnet",
|
|
2469
|
+
shortName: "842",
|
|
2470
|
+
chainId: 842,
|
|
2471
|
+
network: "testnet",
|
|
2472
|
+
testnet: true,
|
|
2473
|
+
multicall: "0x7749051abc57e1105941Ea3Eb2a3F873F300E861",
|
|
2474
|
+
rpc: [
|
|
2475
|
+
"https://rpc.testnet.taraxa.io"
|
|
2476
|
+
],
|
|
2477
|
+
ws: [
|
|
2478
|
+
"wss://ws.testnet.taraxa.io"
|
|
2479
|
+
],
|
|
2480
|
+
explorer: {
|
|
2481
|
+
url: "https://testnet.explorer.taraxa.io"
|
|
2482
|
+
},
|
|
2483
|
+
start: 1462328,
|
|
2484
|
+
logo: "ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"
|
|
2407
2485
|
},
|
|
2408
2486
|
"888": {
|
|
2409
2487
|
key: "888",
|
|
@@ -2538,7 +2616,7 @@ var networks = {
|
|
|
2538
2616
|
"https://rpc.coredao.org/"
|
|
2539
2617
|
],
|
|
2540
2618
|
explorer: {
|
|
2541
|
-
url: "https://scan.coredao.org
|
|
2619
|
+
url: "https://scan.coredao.org"
|
|
2542
2620
|
},
|
|
2543
2621
|
start: 853908,
|
|
2544
2622
|
logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
|
package/dist/snapshot.esm.js
CHANGED
|
@@ -1082,8 +1082,40 @@ var profile = {
|
|
|
1082
1082
|
};
|
|
1083
1083
|
|
|
1084
1084
|
var $schema$4 = "http://json-schema.org/draft-07/schema#";
|
|
1085
|
-
var $ref$4 = "#/definitions/
|
|
1085
|
+
var $ref$4 = "#/definitions/Statement";
|
|
1086
1086
|
var definitions$4 = {
|
|
1087
|
+
Statement: {
|
|
1088
|
+
title: "Statement",
|
|
1089
|
+
type: "object",
|
|
1090
|
+
properties: {
|
|
1091
|
+
about: {
|
|
1092
|
+
type: "string",
|
|
1093
|
+
format: "long",
|
|
1094
|
+
title: "About",
|
|
1095
|
+
minLength: 1,
|
|
1096
|
+
maxLength: 140
|
|
1097
|
+
},
|
|
1098
|
+
statement: {
|
|
1099
|
+
type: "string",
|
|
1100
|
+
format: "long",
|
|
1101
|
+
title: "Statement"
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
required: [
|
|
1105
|
+
"about"
|
|
1106
|
+
],
|
|
1107
|
+
additionalProperties: false
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
var statement = {
|
|
1111
|
+
$schema: $schema$4,
|
|
1112
|
+
$ref: $ref$4,
|
|
1113
|
+
definitions: definitions$4
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
var $schema$5 = "http://json-schema.org/draft-07/schema#";
|
|
1117
|
+
var $ref$5 = "#/definitions/Zodiac";
|
|
1118
|
+
var definitions$5 = {
|
|
1087
1119
|
Zodiac: {
|
|
1088
1120
|
title: "Zodiac",
|
|
1089
1121
|
type: "object",
|
|
@@ -1120,9 +1152,9 @@ var definitions$4 = {
|
|
|
1120
1152
|
}
|
|
1121
1153
|
};
|
|
1122
1154
|
var zodiac = {
|
|
1123
|
-
$schema: $schema$
|
|
1124
|
-
$ref: $ref$
|
|
1125
|
-
definitions: definitions$
|
|
1155
|
+
$schema: $schema$5,
|
|
1156
|
+
$ref: $ref$5,
|
|
1157
|
+
definitions: definitions$5
|
|
1126
1158
|
};
|
|
1127
1159
|
|
|
1128
1160
|
var schemas = {
|
|
@@ -1130,6 +1162,7 @@ var schemas = {
|
|
|
1130
1162
|
proposal: proposal.definitions.Proposal,
|
|
1131
1163
|
vote: vote.definitions.Vote,
|
|
1132
1164
|
profile: profile.definitions.Profile,
|
|
1165
|
+
statement: statement.definitions.Statement,
|
|
1133
1166
|
zodiac: zodiac.definitions.Zodiac
|
|
1134
1167
|
};
|
|
1135
1168
|
|
|
@@ -1170,12 +1203,16 @@ var Multicaller = /** @class */ (function () {
|
|
|
1170
1203
|
return Multicaller;
|
|
1171
1204
|
}());
|
|
1172
1205
|
|
|
1206
|
+
var cache = {};
|
|
1173
1207
|
function getSnapshots(network, snapshot, provider, networks) {
|
|
1174
1208
|
return __awaiter(this, void 0, void 0, function () {
|
|
1175
|
-
var snapshots, networkIn, block, query, url, data;
|
|
1209
|
+
var cacheKey, snapshots, networkIn, block, query, url, data;
|
|
1176
1210
|
return __generator(this, function (_a) {
|
|
1177
1211
|
switch (_a.label) {
|
|
1178
1212
|
case 0:
|
|
1213
|
+
cacheKey = network + "-" + snapshot + "-" + networks.join('-');
|
|
1214
|
+
if (cache[cacheKey])
|
|
1215
|
+
return [2 /*return*/, cache[cacheKey]];
|
|
1179
1216
|
snapshots = {};
|
|
1180
1217
|
networks.forEach(function (n) { return (snapshots[n] = 'latest'); });
|
|
1181
1218
|
if (snapshot === 'latest')
|
|
@@ -1204,11 +1241,13 @@ function getSnapshots(network, snapshot, provider, networks) {
|
|
|
1204
1241
|
case 2:
|
|
1205
1242
|
data = _a.sent();
|
|
1206
1243
|
data.blocks.forEach(function (block) { return (snapshots[block.network] = block.number); });
|
|
1244
|
+
cache[cacheKey] = snapshots;
|
|
1207
1245
|
return [2 /*return*/, snapshots];
|
|
1208
1246
|
}
|
|
1209
1247
|
});
|
|
1210
1248
|
});
|
|
1211
|
-
}
|
|
1249
|
+
}
|
|
1250
|
+
setInterval(function () { return (cache = {}); }, 1000 * 60 * 60 * 1); // Clear cache every 1 hour
|
|
1212
1251
|
|
|
1213
1252
|
var providers = {};
|
|
1214
1253
|
function getProvider(network) {
|
|
@@ -2395,6 +2434,45 @@ var networks = {
|
|
|
2395
2434
|
},
|
|
2396
2435
|
start: 43317,
|
|
2397
2436
|
logo: "ipfs://QmXvum7SNVaAqAc2jNzR1NpNZN1GGvNaKWydg8a1GEDQ7y"
|
|
2437
|
+
},
|
|
2438
|
+
"841": {
|
|
2439
|
+
key: "841",
|
|
2440
|
+
name: "Taraxa Mainnet",
|
|
2441
|
+
shortName: "841",
|
|
2442
|
+
chainId: 841,
|
|
2443
|
+
network: "mainnet",
|
|
2444
|
+
multicall: "0xFCe7a3121B42664AaD145712e1c2Bf2e38f60AA1",
|
|
2445
|
+
rpc: [
|
|
2446
|
+
"https://rpc.mainnet.taraxa.io"
|
|
2447
|
+
],
|
|
2448
|
+
ws: [
|
|
2449
|
+
"wss://ws.mainnet.taraxa.io"
|
|
2450
|
+
],
|
|
2451
|
+
explorer: {
|
|
2452
|
+
url: "https://mainnet.explorer.taraxa.io"
|
|
2453
|
+
},
|
|
2454
|
+
start: 1515906,
|
|
2455
|
+
logo: "ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"
|
|
2456
|
+
},
|
|
2457
|
+
"842": {
|
|
2458
|
+
key: "842",
|
|
2459
|
+
name: "Taraxa Testnet",
|
|
2460
|
+
shortName: "842",
|
|
2461
|
+
chainId: 842,
|
|
2462
|
+
network: "testnet",
|
|
2463
|
+
testnet: true,
|
|
2464
|
+
multicall: "0x7749051abc57e1105941Ea3Eb2a3F873F300E861",
|
|
2465
|
+
rpc: [
|
|
2466
|
+
"https://rpc.testnet.taraxa.io"
|
|
2467
|
+
],
|
|
2468
|
+
ws: [
|
|
2469
|
+
"wss://ws.testnet.taraxa.io"
|
|
2470
|
+
],
|
|
2471
|
+
explorer: {
|
|
2472
|
+
url: "https://testnet.explorer.taraxa.io"
|
|
2473
|
+
},
|
|
2474
|
+
start: 1462328,
|
|
2475
|
+
logo: "ipfs://Qmcc6ZCAGESMzZzoj5LsTVcCo2E35x3Ydk71uPJyov6Mwx"
|
|
2398
2476
|
},
|
|
2399
2477
|
"888": {
|
|
2400
2478
|
key: "888",
|
|
@@ -2529,7 +2607,7 @@ var networks = {
|
|
|
2529
2607
|
"https://rpc.coredao.org/"
|
|
2530
2608
|
],
|
|
2531
2609
|
explorer: {
|
|
2532
|
-
url: "https://scan.coredao.org
|
|
2610
|
+
url: "https://scan.coredao.org"
|
|
2533
2611
|
},
|
|
2534
2612
|
start: 853908,
|
|
2535
2613
|
logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
|