@snapshot-labs/snapshot.js 0.4.97 → 0.4.98

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 CHANGED
@@ -476,6 +476,24 @@ 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
+ title: string;
486
+ minLength: number;
487
+ maxLength: number;
488
+ };
489
+ statement: {
490
+ type: string;
491
+ title: string;
492
+ };
493
+ };
494
+ required: string[];
495
+ additionalProperties: boolean;
496
+ };
479
497
  zodiac: {
480
498
  title: string;
481
499
  type: string;
@@ -472,6 +472,24 @@ 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
+ title: string;
482
+ minLength: number;
483
+ maxLength: number;
484
+ };
485
+ statement: {
486
+ type: string;
487
+ title: string;
488
+ };
489
+ };
490
+ required: string[];
491
+ additionalProperties: boolean;
492
+ };
475
493
  zodiac: {
476
494
  title: string;
477
495
  type: string;
@@ -1091,8 +1091,38 @@ var profile = {
1091
1091
  };
1092
1092
 
1093
1093
  var $schema$4 = "http://json-schema.org/draft-07/schema#";
1094
- var $ref$4 = "#/definitions/Zodiac";
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
+ title: "About",
1103
+ minLength: 1,
1104
+ maxLength: 140
1105
+ },
1106
+ statement: {
1107
+ type: "string",
1108
+ title: "Statement"
1109
+ }
1110
+ },
1111
+ required: [
1112
+ "about"
1113
+ ],
1114
+ additionalProperties: false
1115
+ }
1116
+ };
1117
+ var statement = {
1118
+ $schema: $schema$4,
1119
+ $ref: $ref$4,
1120
+ definitions: definitions$4
1121
+ };
1122
+
1123
+ var $schema$5 = "http://json-schema.org/draft-07/schema#";
1124
+ var $ref$5 = "#/definitions/Zodiac";
1125
+ var definitions$5 = {
1096
1126
  Zodiac: {
1097
1127
  title: "Zodiac",
1098
1128
  type: "object",
@@ -1129,9 +1159,9 @@ var definitions$4 = {
1129
1159
  }
1130
1160
  };
1131
1161
  var zodiac = {
1132
- $schema: $schema$4,
1133
- $ref: $ref$4,
1134
- definitions: definitions$4
1162
+ $schema: $schema$5,
1163
+ $ref: $ref$5,
1164
+ definitions: definitions$5
1135
1165
  };
1136
1166
 
1137
1167
  var schemas = {
@@ -1139,6 +1169,7 @@ var schemas = {
1139
1169
  proposal: proposal.definitions.Proposal,
1140
1170
  vote: vote.definitions.Vote,
1141
1171
  profile: profile.definitions.Profile,
1172
+ statement: statement.definitions.Statement,
1142
1173
  zodiac: zodiac.definitions.Zodiac
1143
1174
  };
1144
1175
 
@@ -1179,12 +1210,16 @@ var Multicaller = /** @class */ (function () {
1179
1210
  return Multicaller;
1180
1211
  }());
1181
1212
 
1213
+ var cache = {};
1182
1214
  function getSnapshots(network, snapshot, provider, networks) {
1183
1215
  return __awaiter(this, void 0, void 0, function () {
1184
- var snapshots, networkIn, block, query, url, data;
1216
+ var cacheKey, snapshots, networkIn, block, query, url, data;
1185
1217
  return __generator(this, function (_a) {
1186
1218
  switch (_a.label) {
1187
1219
  case 0:
1220
+ cacheKey = network + "-" + snapshot + "-" + networks.join('-');
1221
+ if (cache[cacheKey])
1222
+ return [2 /*return*/, cache[cacheKey]];
1188
1223
  snapshots = {};
1189
1224
  networks.forEach(function (n) { return (snapshots[n] = 'latest'); });
1190
1225
  if (snapshot === 'latest')
@@ -1213,11 +1248,13 @@ function getSnapshots(network, snapshot, provider, networks) {
1213
1248
  case 2:
1214
1249
  data = _a.sent();
1215
1250
  data.blocks.forEach(function (block) { return (snapshots[block.network] = block.number); });
1251
+ cache[cacheKey] = snapshots;
1216
1252
  return [2 /*return*/, snapshots];
1217
1253
  }
1218
1254
  });
1219
1255
  });
1220
- }
1256
+ }
1257
+ setInterval(function () { return (cache = {}); }, 1000 * 60 * 60 * 1); // Clear cache every 1 hour
1221
1258
 
1222
1259
  var providers = {};
1223
1260
  function getProvider(network) {
@@ -2538,7 +2575,7 @@ var networks = {
2538
2575
  "https://rpc.coredao.org/"
2539
2576
  ],
2540
2577
  explorer: {
2541
- url: "https://scan.coredao.org/"
2578
+ url: "https://scan.coredao.org"
2542
2579
  },
2543
2580
  start: 853908,
2544
2581
  logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"
@@ -1082,8 +1082,38 @@ var profile = {
1082
1082
  };
1083
1083
 
1084
1084
  var $schema$4 = "http://json-schema.org/draft-07/schema#";
1085
- var $ref$4 = "#/definitions/Zodiac";
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
+ title: "About",
1094
+ minLength: 1,
1095
+ maxLength: 140
1096
+ },
1097
+ statement: {
1098
+ type: "string",
1099
+ title: "Statement"
1100
+ }
1101
+ },
1102
+ required: [
1103
+ "about"
1104
+ ],
1105
+ additionalProperties: false
1106
+ }
1107
+ };
1108
+ var statement = {
1109
+ $schema: $schema$4,
1110
+ $ref: $ref$4,
1111
+ definitions: definitions$4
1112
+ };
1113
+
1114
+ var $schema$5 = "http://json-schema.org/draft-07/schema#";
1115
+ var $ref$5 = "#/definitions/Zodiac";
1116
+ var definitions$5 = {
1087
1117
  Zodiac: {
1088
1118
  title: "Zodiac",
1089
1119
  type: "object",
@@ -1120,9 +1150,9 @@ var definitions$4 = {
1120
1150
  }
1121
1151
  };
1122
1152
  var zodiac = {
1123
- $schema: $schema$4,
1124
- $ref: $ref$4,
1125
- definitions: definitions$4
1153
+ $schema: $schema$5,
1154
+ $ref: $ref$5,
1155
+ definitions: definitions$5
1126
1156
  };
1127
1157
 
1128
1158
  var schemas = {
@@ -1130,6 +1160,7 @@ var schemas = {
1130
1160
  proposal: proposal.definitions.Proposal,
1131
1161
  vote: vote.definitions.Vote,
1132
1162
  profile: profile.definitions.Profile,
1163
+ statement: statement.definitions.Statement,
1133
1164
  zodiac: zodiac.definitions.Zodiac
1134
1165
  };
1135
1166
 
@@ -1170,12 +1201,16 @@ var Multicaller = /** @class */ (function () {
1170
1201
  return Multicaller;
1171
1202
  }());
1172
1203
 
1204
+ var cache = {};
1173
1205
  function getSnapshots(network, snapshot, provider, networks) {
1174
1206
  return __awaiter(this, void 0, void 0, function () {
1175
- var snapshots, networkIn, block, query, url, data;
1207
+ var cacheKey, snapshots, networkIn, block, query, url, data;
1176
1208
  return __generator(this, function (_a) {
1177
1209
  switch (_a.label) {
1178
1210
  case 0:
1211
+ cacheKey = network + "-" + snapshot + "-" + networks.join('-');
1212
+ if (cache[cacheKey])
1213
+ return [2 /*return*/, cache[cacheKey]];
1179
1214
  snapshots = {};
1180
1215
  networks.forEach(function (n) { return (snapshots[n] = 'latest'); });
1181
1216
  if (snapshot === 'latest')
@@ -1204,11 +1239,13 @@ function getSnapshots(network, snapshot, provider, networks) {
1204
1239
  case 2:
1205
1240
  data = _a.sent();
1206
1241
  data.blocks.forEach(function (block) { return (snapshots[block.network] = block.number); });
1242
+ cache[cacheKey] = snapshots;
1207
1243
  return [2 /*return*/, snapshots];
1208
1244
  }
1209
1245
  });
1210
1246
  });
1211
- }
1247
+ }
1248
+ setInterval(function () { return (cache = {}); }, 1000 * 60 * 60 * 1); // Clear cache every 1 hour
1212
1249
 
1213
1250
  var providers = {};
1214
1251
  function getProvider(network) {
@@ -2529,7 +2566,7 @@ var networks = {
2529
2566
  "https://rpc.coredao.org/"
2530
2567
  ],
2531
2568
  explorer: {
2532
- url: "https://scan.coredao.org/"
2569
+ url: "https://scan.coredao.org"
2533
2570
  },
2534
2571
  start: 853908,
2535
2572
  logo: "ipfs://QmVctLQ44vhkwejja9DDjDYUdYgVRBEWs242mhd95SeM5q"