@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.
- package/dist/agent/catalog.cjs +328 -78
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +217 -27
- package/dist/agent/catalog.js +324 -79
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aerodrome/SKILL.md +8 -8
- package/dist/agent/skills/railgun/SKILL.md +10 -4
- package/dist/agent/skills/yield-compare/SKILL.md +5 -5
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +476 -282
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +38 -13
- package/dist/protocols/evm/aerodrome/index.js +473 -284
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +54 -6
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.js +54 -6
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +45 -10
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +10 -2
- package/dist/protocols/evm/euler-v2/index.js +44 -11
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/railgun/index.cjs +26 -9
- package/dist/protocols/evm/railgun/index.cjs.map +1 -1
- package/dist/protocols/evm/railgun/index.d.ts +1 -0
- package/dist/protocols/evm/railgun/index.js +26 -9
- package/dist/protocols/evm/railgun/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -253,6 +253,7 @@ type RailgunPrivateActionArgs = {
|
|
|
253
253
|
onBroadcasterNote?: (note: string) => void;
|
|
254
254
|
onProofProgress?: (progress: number) => void;
|
|
255
255
|
onProofStatusRefresh?: () => void;
|
|
256
|
+
broadcasterAddress?: string;
|
|
256
257
|
broadcasterFeesId?: string;
|
|
257
258
|
};
|
|
258
259
|
/** Railgun replaces the note-check text with a short sentence. Keep the required amount and balance when they are still attached. */
|
|
@@ -1111,6 +1111,18 @@ function orderBroadcasterChoices(rows) {
|
|
|
1111
1111
|
function defaultBroadcasterChoice(rows) {
|
|
1112
1112
|
return rows.find((row) => row.coversGas) ?? rows[0];
|
|
1113
1113
|
}
|
|
1114
|
+
function currentBroadcasterChoice(rows, feesId, railgunAddress, refused) {
|
|
1115
|
+
const id = feesId.trim();
|
|
1116
|
+
if (id && !refused.has(id)) {
|
|
1117
|
+
const exact = rows.find((row2) => row2.feesId === id);
|
|
1118
|
+
if (exact) return { row: exact, refreshed: false };
|
|
1119
|
+
}
|
|
1120
|
+
const address = railgunAddress.trim();
|
|
1121
|
+
if (!address) return void 0;
|
|
1122
|
+
const same = rows.filter((row2) => row2.railgunAddress === address && !refused.has(row2.feesId));
|
|
1123
|
+
const row = same.find((item) => item.coversGas) ?? same[0];
|
|
1124
|
+
return row ? { row, refreshed: true } : void 0;
|
|
1125
|
+
}
|
|
1114
1126
|
function nextCoveringBroadcaster(rows, refused) {
|
|
1115
1127
|
return rows.find((row) => row.coversGas && !refused.has(row.feesId));
|
|
1116
1128
|
}
|
|
@@ -1347,9 +1359,11 @@ async function listRailgunBroadcasters(args) {
|
|
|
1347
1359
|
tokenDecimals: row.tokenDecimals
|
|
1348
1360
|
}));
|
|
1349
1361
|
}
|
|
1350
|
-
function broadcasterNote(row,
|
|
1362
|
+
function broadcasterNote(row, mode) {
|
|
1351
1363
|
const ratioLabel = row.ratio ? `${row.ratio}:1` : "the selected fee";
|
|
1352
|
-
|
|
1364
|
+
if (mode === "next") return `Trying the next broadcaster at ${ratioLabel}`;
|
|
1365
|
+
if (mode === "refreshed") return `The chosen fee expired. Broadcaster ${ratioLabel}`;
|
|
1366
|
+
return `Broadcaster ${ratioLabel}`;
|
|
1353
1367
|
}
|
|
1354
1368
|
function poiListsPresent(pois) {
|
|
1355
1369
|
return Object.values(pois).some((leaves) => Object.keys(leaves).length > 0);
|
|
@@ -1414,7 +1428,9 @@ async function submitFreshProof(args) {
|
|
|
1414
1428
|
}
|
|
1415
1429
|
await args.assertSpendable?.();
|
|
1416
1430
|
const refused = /* @__PURE__ */ new Set();
|
|
1417
|
-
|
|
1431
|
+
const chosenFeesId = args.broadcasterFeesId?.trim() ?? "";
|
|
1432
|
+
const chosenAddress = args.broadcasterAddress?.trim() ?? "";
|
|
1433
|
+
let feesId = chosenFeesId;
|
|
1418
1434
|
let lastError = new Error("No Railgun broadcaster is available for this token.");
|
|
1419
1435
|
let builds = 0;
|
|
1420
1436
|
while (builds < MAX_GAS_BROADCASTERS) {
|
|
@@ -1427,11 +1443,8 @@ async function submitFreshProof(args) {
|
|
|
1427
1443
|
kind: args.kind,
|
|
1428
1444
|
waitMs: BROADCASTER_PROOF_WAIT_MS
|
|
1429
1445
|
});
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1432
|
-
throw new Error("That broadcaster fee expired. Refresh the list and choose again.");
|
|
1433
|
-
}
|
|
1434
|
-
const row = requested ?? nextCoveringBroadcaster(rows, refused) ?? (refused.size === 0 ? defaultBroadcasterChoice(rows) : void 0);
|
|
1446
|
+
const picked = refused.size === 0 ? currentBroadcasterChoice(rows, feesId, chosenAddress, refused) : void 0;
|
|
1447
|
+
const row = picked?.row ?? nextCoveringBroadcaster(rows, refused) ?? (refused.size === 0 ? defaultBroadcasterChoice(rows) : void 0);
|
|
1435
1448
|
if (!row || !broadcasterFeeStillValid(row.expiration)) {
|
|
1436
1449
|
if (!row) break;
|
|
1437
1450
|
refused.add(row.feesId);
|
|
@@ -1441,7 +1454,9 @@ async function submitFreshProof(args) {
|
|
|
1441
1454
|
}
|
|
1442
1455
|
builds += 1;
|
|
1443
1456
|
feesId = row.feesId;
|
|
1444
|
-
|
|
1457
|
+
const replaced = Boolean(chosenFeesId) && row.feesId !== chosenFeesId;
|
|
1458
|
+
const mode = refused.size > 0 ? "next" : replaced ? "refreshed" : "selected";
|
|
1459
|
+
args.onBroadcasterNote?.(broadcasterNote(row, mode));
|
|
1445
1460
|
const broadcaster = row.selected;
|
|
1446
1461
|
const proved = await args.build(broadcaster);
|
|
1447
1462
|
if (!broadcasterFeeStillValid(broadcaster.tokenFee.expiration)) {
|
|
@@ -1638,6 +1653,7 @@ async function provePrivateTransfer(args) {
|
|
|
1638
1653
|
kind: "transfer",
|
|
1639
1654
|
chain,
|
|
1640
1655
|
tokenAddress,
|
|
1656
|
+
broadcasterAddress: args.broadcasterAddress,
|
|
1641
1657
|
broadcasterFeesId: args.broadcasterFeesId,
|
|
1642
1658
|
onBroadcasterSearch: args.onBroadcasterSearch,
|
|
1643
1659
|
onBroadcasterNote: args.onBroadcasterNote,
|
|
@@ -1724,6 +1740,7 @@ async function proveUnshield(args) {
|
|
|
1724
1740
|
kind: "unshield",
|
|
1725
1741
|
chain,
|
|
1726
1742
|
tokenAddress,
|
|
1743
|
+
broadcasterAddress: args.broadcasterAddress,
|
|
1727
1744
|
broadcasterFeesId: args.broadcasterFeesId,
|
|
1728
1745
|
onBroadcasterSearch: args.onBroadcasterSearch,
|
|
1729
1746
|
onBroadcasterNote: args.onBroadcasterNote,
|