@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.
@@ -578,9 +578,11 @@ function buildEventPayload(filter, tx, event) {
578
578
  };
579
579
  }
580
580
  case "contract_call": {
581
+ const ccRawHex = event.data?.raw_value;
582
+ const normalized = typeof ccRawHex === "string" && ccRawHex.startsWith("0x") ? { ...decoded, value: decodeClarityValue(ccRawHex) } : decoded;
581
583
  const input = buildContractCallInput(filter, tx);
582
584
  return {
583
- ...decoded,
585
+ ...normalized,
584
586
  type: "contract_call",
585
587
  _eventType: event.type,
586
588
  contractId: tx.contract_id ?? "",
@@ -1089,7 +1091,7 @@ function reconstructEvent(e) {
1089
1091
  sender: e.sender,
1090
1092
  recipient: e.recipient,
1091
1093
  amount: e.amount,
1092
- ..."memo" in e ? { memo: e.memo ?? undefined } : {}
1094
+ ...e.event_type === "stx_transfer" ? { memo: e.memo ?? "" } : {}
1093
1095
  }
1094
1096
  };
1095
1097
  case "stx_lock":
@@ -1108,7 +1110,6 @@ function reconstructEvent(e) {
1108
1110
  type: "contract_event",
1109
1111
  data: {
1110
1112
  topic: e.payload.topic,
1111
- contract_id: e.contract_id,
1112
1113
  contract_identifier: e.contract_id,
1113
1114
  value: e.payload.value,
1114
1115
  raw_value: e.payload.raw_value
@@ -1148,19 +1149,21 @@ function sourceFilters(subgraph) {
1148
1149
  const sources = subgraph.sources;
1149
1150
  return Array.isArray(sources) ? sources : Object.values(sources);
1150
1151
  }
1151
- function referencedIndexEventTypes(subgraph) {
1152
- const filters = sourceFilters(subgraph);
1153
- if (filters.some((f) => TX_SOURCE_TYPES.has(f.type))) {
1152
+ function indexEventTypesForFilterTypes(filterTypes) {
1153
+ if (filterTypes.some((t) => TX_SOURCE_TYPES.has(t))) {
1154
1154
  return ALL_INDEX_EVENT_TYPES;
1155
1155
  }
1156
1156
  const types = new Set;
1157
- for (const f of filters) {
1158
- const t = EVENT_FILTER_TO_INDEX_TYPE[f.type];
1159
- if (t)
1160
- types.add(t);
1157
+ for (const t of filterTypes) {
1158
+ const indexType = EVENT_FILTER_TO_INDEX_TYPE[t];
1159
+ if (indexType)
1160
+ types.add(indexType);
1161
1161
  }
1162
1162
  return [...types];
1163
1163
  }
1164
+ function referencedIndexEventTypes(subgraph) {
1165
+ return indexEventTypesForFilterTypes(sourceFilters(subgraph).map((f) => f.type));
1166
+ }
1164
1167
  function isStreamsIndexEligible(subgraph) {
1165
1168
  if (Array.isArray(subgraph.sources))
1166
1169
  return false;
@@ -1422,6 +1425,8 @@ class SubscriptionMatcher {
1422
1425
  for (const sub of subs) {
1423
1426
  if (sub.status !== "active")
1424
1427
  continue;
1428
+ if (sub.kind !== "subgraph" || !sub.subgraph_name || !sub.table_name)
1429
+ continue;
1425
1430
  this.byId.set(sub.id, sub);
1426
1431
  const k = key(sub.subgraph_name, sub.table_name);
1427
1432
  const arr = this.byKey.get(k);
@@ -1726,5 +1731,5 @@ export {
1726
1731
  handleSubgraphReorg
1727
1732
  };
1728
1733
 
1729
- //# debugId=BCA72BAE451BCFF564756E2164756E21
1734
+ //# debugId=8D4035CB7910BD6C64756E2164756E21
1730
1735
  //# sourceMappingURL=reorg.js.map