@owney/sdk 0.7.32-beta.6 → 0.7.32-beta.7

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
@@ -1683,7 +1683,7 @@ var SnapshotHistory = class {
1683
1683
  };
1684
1684
 
1685
1685
  // src/lib/funding-ledger.ts
1686
- var SDK_VERSION = "0.7.32-beta.6";
1686
+ var SDK_VERSION = "0.7.32-beta.7";
1687
1687
  var SCOPE2 = "funding-ledger";
1688
1688
  var REQUEST_TIMEOUT_MS2 = 5e3;
1689
1689
  var RETRY_DELAYS_MS = [1e3, 4e3, 16e3];
@@ -4545,19 +4545,31 @@ function mapAvailablePools(raw2) {
4545
4545
  for (const [token, entry] of Object.entries(byToken ?? {})) {
4546
4546
  for (const pool of entry?.pools ?? []) {
4547
4547
  if (!pool?.name) continue;
4548
+ const link = pool.info?.url || pool.info?.link || null;
4549
+ const address = vaultAddressFromLink(link);
4548
4550
  result.push({
4549
4551
  chainId,
4550
4552
  token,
4551
4553
  name: pool.name,
4552
4554
  apy: pool.info?.combined_apy ?? null,
4553
4555
  tvlUsd: pool.info?.tvlUsd ?? null,
4554
- link: pool.info?.link ?? null
4556
+ link,
4557
+ ...address !== void 0 && { address }
4555
4558
  });
4556
4559
  }
4557
4560
  }
4558
4561
  }
4559
4562
  return result;
4560
4563
  }
4564
+ var VAULT_IN_PATH = /\/(?:vault|lend)\/(0x[0-9a-fA-F]{40})(?=\/|$)/;
4565
+ function vaultAddressFromLink(link) {
4566
+ if (!link) return void 0;
4567
+ try {
4568
+ return new URL(link).pathname.match(VAULT_IN_PATH)?.[1];
4569
+ } catch {
4570
+ return void 0;
4571
+ }
4572
+ }
4561
4573
  function assemblePoolCatalog(protocols, poolsByProtocol, asset, chains) {
4562
4574
  const wanted = asset.toUpperCase();
4563
4575
  const allowedChains = chains && chains.length > 0 ? new Set(chains) : void 0;
package/dist/index.d.cts CHANGED
@@ -560,9 +560,11 @@ type AvailablePool = {
560
560
  /** Per-pool deep link (e.g. the Morpho vault page). null when absent. */
561
561
  link: string | null;
562
562
  /**
563
- * The pool's on-chain vault address. Set for Yieldseeker, whose pools are
564
- * identified by vault address; unset for Zyfai, whose pools are identified
565
- * by name.
563
+ * The pool's on-chain vault address. Yieldseeker identifies its pools by it.
564
+ * Zyfai identifies its pools by name and sends no address, so for Zyfai it is
565
+ * read from the pool's link where that names a vault (Morpho and Euler
566
+ * vaults) and is unset otherwise. It is how the same vault offered by two
567
+ * agents is recognised.
566
568
  */
567
569
  address?: string;
568
570
  };
package/dist/index.d.ts CHANGED
@@ -560,9 +560,11 @@ type AvailablePool = {
560
560
  /** Per-pool deep link (e.g. the Morpho vault page). null when absent. */
561
561
  link: string | null;
562
562
  /**
563
- * The pool's on-chain vault address. Set for Yieldseeker, whose pools are
564
- * identified by vault address; unset for Zyfai, whose pools are identified
565
- * by name.
563
+ * The pool's on-chain vault address. Yieldseeker identifies its pools by it.
564
+ * Zyfai identifies its pools by name and sends no address, so for Zyfai it is
565
+ * read from the pool's link where that names a vault (Morpho and Euler
566
+ * vaults) and is unset otherwise. It is how the same vault offered by two
567
+ * agents is recognised.
566
568
  */
567
569
  address?: string;
568
570
  };
package/dist/index.js CHANGED
@@ -1011,7 +1011,7 @@ var SnapshotHistory = class {
1011
1011
  };
1012
1012
 
1013
1013
  // src/lib/funding-ledger.ts
1014
- var SDK_VERSION = "0.7.32-beta.6";
1014
+ var SDK_VERSION = "0.7.32-beta.7";
1015
1015
  var SCOPE2 = "funding-ledger";
1016
1016
  var REQUEST_TIMEOUT_MS2 = 5e3;
1017
1017
  var RETRY_DELAYS_MS = [1e3, 4e3, 16e3];
@@ -3860,19 +3860,31 @@ function mapAvailablePools(raw2) {
3860
3860
  for (const [token, entry] of Object.entries(byToken ?? {})) {
3861
3861
  for (const pool of entry?.pools ?? []) {
3862
3862
  if (!pool?.name) continue;
3863
+ const link = pool.info?.url || pool.info?.link || null;
3864
+ const address = vaultAddressFromLink(link);
3863
3865
  result.push({
3864
3866
  chainId,
3865
3867
  token,
3866
3868
  name: pool.name,
3867
3869
  apy: pool.info?.combined_apy ?? null,
3868
3870
  tvlUsd: pool.info?.tvlUsd ?? null,
3869
- link: pool.info?.link ?? null
3871
+ link,
3872
+ ...address !== void 0 && { address }
3870
3873
  });
3871
3874
  }
3872
3875
  }
3873
3876
  }
3874
3877
  return result;
3875
3878
  }
3879
+ var VAULT_IN_PATH = /\/(?:vault|lend)\/(0x[0-9a-fA-F]{40})(?=\/|$)/;
3880
+ function vaultAddressFromLink(link) {
3881
+ if (!link) return void 0;
3882
+ try {
3883
+ return new URL(link).pathname.match(VAULT_IN_PATH)?.[1];
3884
+ } catch {
3885
+ return void 0;
3886
+ }
3887
+ }
3876
3888
  function assemblePoolCatalog(protocols, poolsByProtocol, asset, chains) {
3877
3889
  const wanted = asset.toUpperCase();
3878
3890
  const allowedChains = chains && chains.length > 0 ? new Set(chains) : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.32-beta.6",
3
+ "version": "0.7.32-beta.7",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",