@secondlayer/subgraphs 3.6.0 → 3.7.0

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/src/index.js CHANGED
@@ -654,9 +654,11 @@ function buildEventPayload(filter, tx, event) {
654
654
  };
655
655
  }
656
656
  case "contract_call": {
657
+ const ccRawHex = event.data?.raw_value;
658
+ const normalized = typeof ccRawHex === "string" && ccRawHex.startsWith("0x") ? { ...decoded, value: decodeClarityValue(ccRawHex) } : decoded;
657
659
  const input = buildContractCallInput(filter, tx);
658
660
  return {
659
- ...decoded,
661
+ ...normalized,
660
662
  type: "contract_call",
661
663
  _eventType: event.type,
662
664
  contractId: tx.contract_id ?? "",
@@ -1165,7 +1167,7 @@ function reconstructEvent(e) {
1165
1167
  sender: e.sender,
1166
1168
  recipient: e.recipient,
1167
1169
  amount: e.amount,
1168
- ..."memo" in e ? { memo: e.memo ?? undefined } : {}
1170
+ ...e.event_type === "stx_transfer" ? { memo: e.memo ?? "" } : {}
1169
1171
  }
1170
1172
  };
1171
1173
  case "stx_lock":
@@ -1184,7 +1186,6 @@ function reconstructEvent(e) {
1184
1186
  type: "contract_event",
1185
1187
  data: {
1186
1188
  topic: e.payload.topic,
1187
- contract_id: e.contract_id,
1188
1189
  contract_identifier: e.contract_id,
1189
1190
  value: e.payload.value,
1190
1191
  raw_value: e.payload.raw_value
@@ -1224,19 +1225,21 @@ function sourceFilters(subgraph) {
1224
1225
  const sources = subgraph.sources;
1225
1226
  return Array.isArray(sources) ? sources : Object.values(sources);
1226
1227
  }
1227
- function referencedIndexEventTypes(subgraph) {
1228
- const filters = sourceFilters(subgraph);
1229
- if (filters.some((f) => TX_SOURCE_TYPES.has(f.type))) {
1228
+ function indexEventTypesForFilterTypes(filterTypes) {
1229
+ if (filterTypes.some((t) => TX_SOURCE_TYPES.has(t))) {
1230
1230
  return ALL_INDEX_EVENT_TYPES;
1231
1231
  }
1232
1232
  const types = new Set;
1233
- for (const f of filters) {
1234
- const t = EVENT_FILTER_TO_INDEX_TYPE[f.type];
1235
- if (t)
1236
- types.add(t);
1233
+ for (const t of filterTypes) {
1234
+ const indexType = EVENT_FILTER_TO_INDEX_TYPE[t];
1235
+ if (indexType)
1236
+ types.add(indexType);
1237
1237
  }
1238
1238
  return [...types];
1239
1239
  }
1240
+ function referencedIndexEventTypes(subgraph) {
1241
+ return indexEventTypesForFilterTypes(sourceFilters(subgraph).map((f) => f.type));
1242
+ }
1240
1243
  function isStreamsIndexEligible(subgraph) {
1241
1244
  if (Array.isArray(subgraph.sources))
1242
1245
  return false;
@@ -1498,6 +1501,8 @@ class SubscriptionMatcher {
1498
1501
  for (const sub of subs) {
1499
1502
  if (sub.status !== "active")
1500
1503
  continue;
1504
+ if (sub.kind !== "subgraph" || !sub.subgraph_name || !sub.table_name)
1505
+ continue;
1501
1506
  this.byId.set(sub.id, sub);
1502
1507
  const k = key(sub.subgraph_name, sub.table_name);
1503
1508
  const arr = this.byKey.get(k);
@@ -2838,5 +2843,5 @@ export {
2838
2843
  backfillSubgraph
2839
2844
  };
2840
2845
 
2841
- //# debugId=4E10631FF8DB802F64756E2164756E21
2846
+ //# debugId=2BE22F6928E6804264756E2164756E21
2842
2847
  //# sourceMappingURL=index.js.map