@owney/sdk 0.7.28-beta.0 → 0.7.28-beta.1

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.cjs CHANGED
@@ -2151,6 +2151,9 @@ var ZyfaiAgent = class _ZyfaiAgent {
2151
2151
 
2152
2152
  // src/lib/history-fanout.ts
2153
2153
  var SEPARATOR = "@";
2154
+ function isSupportedChainId(value) {
2155
+ return SUPPORTED_CHAIN_IDS.includes(value);
2156
+ }
2154
2157
  function fanoutKey(leg) {
2155
2158
  return leg.chainId === void 0 ? leg.agentId : `${leg.agentId}${SEPARATOR}${leg.chainId}`;
2156
2159
  }
@@ -2173,6 +2176,16 @@ function decodeFanoutCursor(token) {
2173
2176
  }
2174
2177
  return parsed;
2175
2178
  }
2179
+ function transactionChainId(entry) {
2180
+ let found;
2181
+ for (const tx of entry.transactions ?? []) {
2182
+ if (tx.chainId === void 0) continue;
2183
+ if (!isSupportedChainId(tx.chainId)) return void 0;
2184
+ if (found !== void 0 && found !== tx.chainId) return void 0;
2185
+ found = tx.chainId;
2186
+ }
2187
+ return found;
2188
+ }
2176
2189
  function mergeHistoryPages(pages) {
2177
2190
  const merged = [];
2178
2191
  const nextCursorMap = {};
@@ -2191,7 +2204,9 @@ function mergeHistoryPages(pages) {
2191
2204
  const prior = seen.get(id);
2192
2205
  if (prior) {
2193
2206
  prior.legs += 1;
2194
- if (prior.entry.chainId !== e.chainId) delete prior.entry.chainId;
2207
+ const own = transactionChainId(prior.entry);
2208
+ if (own === void 0) delete prior.entry.chainId;
2209
+ else prior.entry.chainId = own;
2195
2210
  continue;
2196
2211
  }
2197
2212
  const entry = leg.chainId === void 0 ? { ...e } : { ...e, chainId: leg.chainId };
package/dist/index.js CHANGED
@@ -2111,6 +2111,9 @@ var ZyfaiAgent = class _ZyfaiAgent {
2111
2111
 
2112
2112
  // src/lib/history-fanout.ts
2113
2113
  var SEPARATOR = "@";
2114
+ function isSupportedChainId(value) {
2115
+ return SUPPORTED_CHAIN_IDS.includes(value);
2116
+ }
2114
2117
  function fanoutKey(leg) {
2115
2118
  return leg.chainId === void 0 ? leg.agentId : `${leg.agentId}${SEPARATOR}${leg.chainId}`;
2116
2119
  }
@@ -2133,6 +2136,16 @@ function decodeFanoutCursor(token) {
2133
2136
  }
2134
2137
  return parsed;
2135
2138
  }
2139
+ function transactionChainId(entry) {
2140
+ let found;
2141
+ for (const tx of entry.transactions ?? []) {
2142
+ if (tx.chainId === void 0) continue;
2143
+ if (!isSupportedChainId(tx.chainId)) return void 0;
2144
+ if (found !== void 0 && found !== tx.chainId) return void 0;
2145
+ found = tx.chainId;
2146
+ }
2147
+ return found;
2148
+ }
2136
2149
  function mergeHistoryPages(pages) {
2137
2150
  const merged = [];
2138
2151
  const nextCursorMap = {};
@@ -2151,7 +2164,9 @@ function mergeHistoryPages(pages) {
2151
2164
  const prior = seen.get(id);
2152
2165
  if (prior) {
2153
2166
  prior.legs += 1;
2154
- if (prior.entry.chainId !== e.chainId) delete prior.entry.chainId;
2167
+ const own = transactionChainId(prior.entry);
2168
+ if (own === void 0) delete prior.entry.chainId;
2169
+ else prior.entry.chainId = own;
2155
2170
  continue;
2156
2171
  }
2157
2172
  const entry = leg.chainId === void 0 ? { ...e } : { ...e, chainId: leg.chainId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.28-beta.0",
3
+ "version": "0.7.28-beta.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",