@continuumdao/ctm-mpc-defi 0.2.61 → 0.2.63

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.
Files changed (32) hide show
  1. package/dist/agent/catalog.cjs +328 -78
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +217 -27
  4. package/dist/agent/catalog.js +324 -79
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/aerodrome/SKILL.md +8 -8
  7. package/dist/agent/skills/railgun/SKILL.md +10 -4
  8. package/dist/agent/skills/yield-compare/SKILL.md +5 -5
  9. package/dist/index.cjs +5 -4
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.js +5 -4
  12. package/dist/index.js.map +1 -1
  13. package/dist/protocols/evm/aerodrome/index.cjs +476 -282
  14. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
  15. package/dist/protocols/evm/aerodrome/index.d.ts +38 -13
  16. package/dist/protocols/evm/aerodrome/index.js +473 -284
  17. package/dist/protocols/evm/aerodrome/index.js.map +1 -1
  18. package/dist/protocols/evm/curve-dao/index.cjs +54 -6
  19. package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
  20. package/dist/protocols/evm/curve-dao/index.js +54 -6
  21. package/dist/protocols/evm/curve-dao/index.js.map +1 -1
  22. package/dist/protocols/evm/euler-v2/index.cjs +45 -10
  23. package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
  24. package/dist/protocols/evm/euler-v2/index.d.ts +10 -2
  25. package/dist/protocols/evm/euler-v2/index.js +44 -11
  26. package/dist/protocols/evm/euler-v2/index.js.map +1 -1
  27. package/dist/protocols/evm/railgun/index.cjs +26 -9
  28. package/dist/protocols/evm/railgun/index.cjs.map +1 -1
  29. package/dist/protocols/evm/railgun/index.d.ts +1 -0
  30. package/dist/protocols/evm/railgun/index.js +26 -9
  31. package/dist/protocols/evm/railgun/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -1114,6 +1114,18 @@ function orderBroadcasterChoices(rows) {
1114
1114
  function defaultBroadcasterChoice(rows) {
1115
1115
  return rows.find((row) => row.coversGas) ?? rows[0];
1116
1116
  }
1117
+ function currentBroadcasterChoice(rows, feesId, railgunAddress, refused) {
1118
+ const id = feesId.trim();
1119
+ if (id && !refused.has(id)) {
1120
+ const exact = rows.find((row2) => row2.feesId === id);
1121
+ if (exact) return { row: exact, refreshed: false };
1122
+ }
1123
+ const address = railgunAddress.trim();
1124
+ if (!address) return void 0;
1125
+ const same = rows.filter((row2) => row2.railgunAddress === address && !refused.has(row2.feesId));
1126
+ const row = same.find((item) => item.coversGas) ?? same[0];
1127
+ return row ? { row, refreshed: true } : void 0;
1128
+ }
1117
1129
  function nextCoveringBroadcaster(rows, refused) {
1118
1130
  return rows.find((row) => row.coversGas && !refused.has(row.feesId));
1119
1131
  }
@@ -1350,9 +1362,11 @@ async function listRailgunBroadcasters(args) {
1350
1362
  tokenDecimals: row.tokenDecimals
1351
1363
  }));
1352
1364
  }
1353
- function broadcasterNote(row, switching) {
1365
+ function broadcasterNote(row, mode) {
1354
1366
  const ratioLabel = row.ratio ? `${row.ratio}:1` : "the selected fee";
1355
- return switching ? `Trying the next broadcaster at ${ratioLabel}` : `Broadcaster ${ratioLabel}`;
1367
+ if (mode === "next") return `Trying the next broadcaster at ${ratioLabel}`;
1368
+ if (mode === "refreshed") return `The chosen fee expired. Broadcaster ${ratioLabel}`;
1369
+ return `Broadcaster ${ratioLabel}`;
1356
1370
  }
1357
1371
  function poiListsPresent(pois) {
1358
1372
  return Object.values(pois).some((leaves) => Object.keys(leaves).length > 0);
@@ -1417,7 +1431,9 @@ async function submitFreshProof(args) {
1417
1431
  }
1418
1432
  await args.assertSpendable?.();
1419
1433
  const refused = /* @__PURE__ */ new Set();
1420
- let feesId = args.broadcasterFeesId?.trim() ?? "";
1434
+ const chosenFeesId = args.broadcasterFeesId?.trim() ?? "";
1435
+ const chosenAddress = args.broadcasterAddress?.trim() ?? "";
1436
+ let feesId = chosenFeesId;
1421
1437
  let lastError = new Error("No Railgun broadcaster is available for this token.");
1422
1438
  let builds = 0;
1423
1439
  while (builds < MAX_GAS_BROADCASTERS) {
@@ -1430,11 +1446,8 @@ async function submitFreshProof(args) {
1430
1446
  kind: args.kind,
1431
1447
  waitMs: BROADCASTER_PROOF_WAIT_MS
1432
1448
  });
1433
- const requested = feesId && !refused.has(feesId) ? rows.find((row2) => row2.feesId === feesId) : void 0;
1434
- if (builds === 0 && args.broadcasterFeesId?.trim() && !requested) {
1435
- throw new Error("That broadcaster fee expired. Refresh the list and choose again.");
1436
- }
1437
- const row = requested ?? nextCoveringBroadcaster(rows, refused) ?? (refused.size === 0 ? defaultBroadcasterChoice(rows) : void 0);
1449
+ const picked = refused.size === 0 ? currentBroadcasterChoice(rows, feesId, chosenAddress, refused) : void 0;
1450
+ const row = picked?.row ?? nextCoveringBroadcaster(rows, refused) ?? (refused.size === 0 ? defaultBroadcasterChoice(rows) : void 0);
1438
1451
  if (!row || !broadcasterFeeStillValid(row.expiration)) {
1439
1452
  if (!row) break;
1440
1453
  refused.add(row.feesId);
@@ -1444,7 +1457,9 @@ async function submitFreshProof(args) {
1444
1457
  }
1445
1458
  builds += 1;
1446
1459
  feesId = row.feesId;
1447
- args.onBroadcasterNote?.(broadcasterNote(row, refused.size > 0));
1460
+ const replaced = Boolean(chosenFeesId) && row.feesId !== chosenFeesId;
1461
+ const mode = refused.size > 0 ? "next" : replaced ? "refreshed" : "selected";
1462
+ args.onBroadcasterNote?.(broadcasterNote(row, mode));
1448
1463
  const broadcaster = row.selected;
1449
1464
  const proved = await args.build(broadcaster);
1450
1465
  if (!broadcasterFeeStillValid(broadcaster.tokenFee.expiration)) {
@@ -1641,6 +1656,7 @@ async function provePrivateTransfer(args) {
1641
1656
  kind: "transfer",
1642
1657
  chain,
1643
1658
  tokenAddress,
1659
+ broadcasterAddress: args.broadcasterAddress,
1644
1660
  broadcasterFeesId: args.broadcasterFeesId,
1645
1661
  onBroadcasterSearch: args.onBroadcasterSearch,
1646
1662
  onBroadcasterNote: args.onBroadcasterNote,
@@ -1727,6 +1743,7 @@ async function proveUnshield(args) {
1727
1743
  kind: "unshield",
1728
1744
  chain,
1729
1745
  tokenAddress,
1746
+ broadcasterAddress: args.broadcasterAddress,
1730
1747
  broadcasterFeesId: args.broadcasterFeesId,
1731
1748
  onBroadcasterSearch: args.onBroadcasterSearch,
1732
1749
  onBroadcasterNote: args.onBroadcasterNote,