@continuumdao/ctm-mpc-defi 0.2.29 → 0.2.31

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 (60) hide show
  1. package/dist/agent/catalog.cjs +2892 -13
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +5454 -977
  4. package/dist/agent/catalog.js +2784 -15
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/aerodrome/SKILL.md +93 -0
  7. package/dist/agent/skills/compound-v3/SKILL.md +132 -0
  8. package/dist/agent/skills/continuum-dao/SKILL.md +139 -0
  9. package/dist/agent/skills/morpho/SKILL.md +16 -8
  10. package/dist/buildBatch-CngvebiD.d.ts +45 -0
  11. package/dist/chains/evm/index.d.ts +6 -44
  12. package/dist/core/index.cjs +44 -40
  13. package/dist/core/index.cjs.map +1 -1
  14. package/dist/core/index.d.ts +1 -1
  15. package/dist/core/index.js +44 -40
  16. package/dist/core/index.js.map +1 -1
  17. package/dist/{eip712Multisign-xhXpUYp3.d.ts → eip712Multisign-DCW7heqX.d.ts} +11 -8
  18. package/dist/index.cjs +183 -58
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.ts +5 -2
  21. package/dist/index.js +182 -58
  22. package/dist/index.js.map +1 -1
  23. package/dist/protocols/evm/aerodrome/index.cjs +3922 -0
  24. package/dist/protocols/evm/aerodrome/index.cjs.map +1 -0
  25. package/dist/protocols/evm/aerodrome/index.d.ts +792 -0
  26. package/dist/protocols/evm/aerodrome/index.js +3843 -0
  27. package/dist/protocols/evm/aerodrome/index.js.map +1 -0
  28. package/dist/protocols/evm/arcus/index.cjs +62 -55
  29. package/dist/protocols/evm/arcus/index.cjs.map +1 -1
  30. package/dist/protocols/evm/arcus/index.js +62 -55
  31. package/dist/protocols/evm/arcus/index.js.map +1 -1
  32. package/dist/protocols/evm/compound-v3/index.cjs +1542 -0
  33. package/dist/protocols/evm/compound-v3/index.cjs.map +1 -0
  34. package/dist/protocols/evm/compound-v3/index.d.ts +683 -0
  35. package/dist/protocols/evm/compound-v3/index.js +1488 -0
  36. package/dist/protocols/evm/compound-v3/index.js.map +1 -0
  37. package/dist/protocols/evm/continuum-dao/index.cjs +2237 -0
  38. package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -0
  39. package/dist/protocols/evm/continuum-dao/index.d.ts +700 -0
  40. package/dist/protocols/evm/continuum-dao/index.js +2110 -0
  41. package/dist/protocols/evm/continuum-dao/index.js.map +1 -0
  42. package/dist/protocols/evm/hyperliquid/index.cjs +125 -110
  43. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  44. package/dist/protocols/evm/hyperliquid/index.js +125 -110
  45. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  46. package/dist/protocols/evm/morpho/index.cjs +746 -39
  47. package/dist/protocols/evm/morpho/index.cjs.map +1 -1
  48. package/dist/protocols/evm/morpho/index.d.ts +161 -14
  49. package/dist/protocols/evm/morpho/index.js +736 -42
  50. package/dist/protocols/evm/morpho/index.js.map +1 -1
  51. package/dist/protocols/evm/permit2/index.cjs +66 -59
  52. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  53. package/dist/protocols/evm/permit2/index.js +66 -59
  54. package/dist/protocols/evm/permit2/index.js.map +1 -1
  55. package/dist/protocols/evm/uniswap-v4/index.cjs +63 -56
  56. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  57. package/dist/protocols/evm/uniswap-v4/index.d.ts +1 -1
  58. package/dist/protocols/evm/uniswap-v4/index.js +63 -56
  59. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  60. package/package.json +20 -1
package/dist/index.cjs CHANGED
@@ -182,57 +182,60 @@ function eip712SignatureText(domain, primaryType) {
182
182
  function jsonStringifyForAudit(value) {
183
183
  return JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v);
184
184
  }
185
- function eip712MsgRawHex(typedData, delivery) {
186
- const envelope = {
185
+ function eip712LegEnvelope(typedData, delivery, digest) {
186
+ return {
187
187
  version: 1,
188
- ...typedData,
189
- delivery
190
- };
191
- return viem.stringToHex(jsonStringifyForAudit(envelope));
192
- }
193
- function buildEip712MultisignBody(args) {
194
- const { typedData, delivery } = args;
195
- const digest = viem.hashTypedData({
188
+ digest,
196
189
  domain: typedData.domain,
197
190
  types: typedData.types,
198
191
  primaryType: typedData.primaryType,
199
- message: typedData.message
200
- });
201
- const extraJSON = {
202
- signRequestKind: EIP712_SIGN_REQUEST_KIND,
203
- eip712: {
204
- version: 1,
205
- digest,
206
- domain: typedData.domain,
207
- types: typedData.types,
208
- primaryType: typedData.primaryType,
209
- message: typedData.message
210
- },
192
+ message: typedData.message,
211
193
  delivery
212
194
  };
195
+ }
196
+ function eip712MsgRawHex(envelope) {
197
+ return viem.stringToHex(jsonStringifyForAudit(envelope));
198
+ }
199
+ function buildEip712Multisign(args) {
200
+ if (args.legs.length < 1) {
201
+ throw new Error("buildEip712Multisign requires at least one leg");
202
+ }
203
+ const eip712 = [];
204
+ const legs = args.legs.map((leg) => {
205
+ const digest = viem.hashTypedData({
206
+ domain: leg.typedData.domain,
207
+ types: leg.typedData.types,
208
+ primaryType: leg.typedData.primaryType,
209
+ message: leg.typedData.message
210
+ });
211
+ const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest);
212
+ eip712.push(envelope);
213
+ return {
214
+ msgHash: msgHashNo0x(digest),
215
+ msgRaw: eip712MsgRawHex(envelope),
216
+ destinationAddress: args.destinationAddress,
217
+ signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),
218
+ audit: {
219
+ kind: "EIP712",
220
+ primaryType: leg.typedData.primaryType,
221
+ deliveryKind: leg.delivery.kind,
222
+ ...leg.audit ?? {}
223
+ },
224
+ feeSnapshot: {}
225
+ };
226
+ });
213
227
  return finalizeMultisign({
214
228
  keyGen: args.keyGen,
215
229
  purposeText: args.purposeText,
216
230
  purposeSuffix: args.purposeSuffix,
217
231
  destinationChainID: args.destinationChainID,
218
232
  destinationAddress: args.destinationAddress,
219
- extraJSON,
233
+ extraJSON: {
234
+ signRequestKind: EIP712_SIGN_REQUEST_KIND,
235
+ eip712
236
+ },
220
237
  expiryDate: args.expiryDate,
221
- legs: [
222
- {
223
- msgHash: msgHashNo0x(digest),
224
- msgRaw: eip712MsgRawHex(typedData, delivery),
225
- destinationAddress: args.destinationAddress,
226
- signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),
227
- audit: {
228
- kind: "EIP712",
229
- primaryType: typedData.primaryType,
230
- deliveryKind: delivery.kind,
231
- ...args.audit ?? {}
232
- },
233
- feeSnapshot: {}
234
- }
235
- ]
238
+ legs
236
239
  });
237
240
  }
238
241
  var PAYLOAD_SIGN_ED25519_REQUEST_KIND = "payload_sign_ed25519";
@@ -295,7 +298,8 @@ var DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
295
298
  "gmx",
296
299
  "hyperliquid",
297
300
  "arcus",
298
- "curve-dao"
301
+ "curve-dao",
302
+ "aerodrome"
299
303
  ]);
300
304
  function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
301
305
  if (typeof explicitExpiryDate === "number" && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {
@@ -2895,28 +2899,32 @@ async function buildEvmMultisignBodyUniswapV4LimitOrderBatch(args) {
2895
2899
  quoteResponse: args.fullLimitQuote,
2896
2900
  signatureHex: "0x"
2897
2901
  });
2898
- return buildEip712MultisignBody({
2902
+ return buildEip712Multisign({
2899
2903
  keyGen: args.keyGen,
2900
2904
  purposeText: args.purposeText,
2901
2905
  destinationChainID: String(UNISWAP_LIMIT_ORDER_CHAIN_ID),
2902
2906
  destinationAddress: PERMIT2_ADDRESS,
2903
- typedData,
2904
- delivery: {
2905
- kind: "uniswapx_limit_order",
2906
- chainId: UNISWAP_LIMIT_ORDER_CHAIN_ID,
2907
- swapper: viem.getAddress(args.swapper),
2908
- submitBodyTemplate: submitTemplate,
2909
- quoteResponse: args.fullLimitQuote,
2910
- uniswapApiKey: args.uniswapApiKey,
2911
- tradeApiBaseUrl: args.tradeApiBaseUrl ?? "https://trade-api.gateway.uniswap.org/v1"
2912
- },
2913
- audit: {
2914
- protocol: "uniswap-v4",
2915
- action: "limitOrder",
2916
- routing: args.fullLimitQuote.routing ?? "LIMIT_ORDER",
2917
- orderType: "Limit",
2918
- primaryType: typedData.primaryType
2919
- },
2907
+ legs: [
2908
+ {
2909
+ typedData,
2910
+ delivery: {
2911
+ kind: "uniswapx_limit_order",
2912
+ chainId: UNISWAP_LIMIT_ORDER_CHAIN_ID,
2913
+ swapper: viem.getAddress(args.swapper),
2914
+ submitBodyTemplate: submitTemplate,
2915
+ quoteResponse: args.fullLimitQuote,
2916
+ uniswapApiKey: args.uniswapApiKey,
2917
+ tradeApiBaseUrl: args.tradeApiBaseUrl ?? "https://trade-api.gateway.uniswap.org/v1"
2918
+ },
2919
+ audit: {
2920
+ protocol: "uniswap-v4",
2921
+ action: "limitOrder",
2922
+ routing: args.fullLimitQuote.routing ?? "LIMIT_ORDER",
2923
+ orderType: "Limit",
2924
+ primaryType: typedData.primaryType
2925
+ }
2926
+ }
2927
+ ],
2920
2928
  expiryDate: args.expiryDate
2921
2929
  });
2922
2930
  }
@@ -3424,10 +3432,126 @@ var curveDao = {
3424
3432
  isChainSupported: isCurveApiChainSupported,
3425
3433
  loadSession: loadFullCurveSessionForRpc
3426
3434
  };
3435
+ var AERODROME_PROTOCOL_ID = "aerodrome";
3436
+ var AERODROME_CHAIN_ID = 8453;
3437
+ function isAerodromeChainSupported(chainId) {
3438
+ const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
3439
+ return n === AERODROME_CHAIN_ID;
3440
+ }
3441
+
3442
+ // src/protocols/evm/aerodrome/index.ts
3443
+ var aerodromeProtocolModule = {
3444
+ id: AERODROME_PROTOCOL_ID,
3445
+ chainCategory: "evm",
3446
+ isChainSupported(ctx) {
3447
+ if (ctx.chainCategory !== "evm") return false;
3448
+ return isAerodromeChainSupported(ctx.chainId);
3449
+ },
3450
+ isTokenSupported(token) {
3451
+ if (token.category !== "evm") return false;
3452
+ return token.kind === "native" || token.kind === "erc20";
3453
+ },
3454
+ actions: [
3455
+ {
3456
+ id: "aerodrome.quote",
3457
+ protocolId: AERODROME_PROTOCOL_ID,
3458
+ chainCategory: "evm",
3459
+ description: "Quote an Aerodrome swap on Base via factory discovery + MixedRouteQuoterV3 / Router. Tickers (AAPLc, USDC, ETH) accepted.",
3460
+ commonParams: [],
3461
+ params: {
3462
+ chainId: { type: "number", required: true, description: `Must be ${AERODROME_CHAIN_ID}` },
3463
+ tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
3464
+ tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH, WETH, AERO) or 0x / 0x0 native" },
3465
+ amountHuman: { type: "string", required: true, description: "Human-readable input amount (B20 stocks are 8 decimals)" }
3466
+ }
3467
+ },
3468
+ {
3469
+ id: "aerodrome.swap",
3470
+ protocolId: AERODROME_PROTOCOL_ID,
3471
+ chainCategory: "evm",
3472
+ description: "Swap via Aerodrome Router / Slipstream SwapRouter (optional ERC-20 approve batch)",
3473
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3474
+ params: {
3475
+ tokenIn: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
3476
+ tokenOut: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
3477
+ amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
3478
+ slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
3479
+ }
3480
+ },
3481
+ {
3482
+ id: "aerodrome.add-liquidity",
3483
+ protocolId: AERODROME_PROTOCOL_ID,
3484
+ chainCategory: "evm",
3485
+ description: "Deposit into a basic vAMM/sAMM pool (one-sided amounts; tickers OK)",
3486
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3487
+ params: {
3488
+ tokenA: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
3489
+ tokenB: { type: "address", required: true, description: "Ticker (AAPLc, USDC, ETH) or 0x / 0x0 native" },
3490
+ stable: { type: "boolean", required: true, description: "true = sAMM, false = vAMM" },
3491
+ amountAHuman: { type: "string", required: false, description: "Amount A; omit to solve from B" },
3492
+ amountBHuman: { type: "string", required: false, description: "Amount B; omit to solve from A" },
3493
+ slippagePercent: { type: "number", required: true, description: "Slippage percent" }
3494
+ }
3495
+ },
3496
+ {
3497
+ id: "aerodrome.remove-liquidity",
3498
+ protocolId: AERODROME_PROTOCOL_ID,
3499
+ chainCategory: "evm",
3500
+ description: "Withdraw from a basic vAMM/sAMM pool",
3501
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3502
+ params: {
3503
+ lpToken: { type: "address", required: true, description: "LP token" },
3504
+ liquidityHuman: { type: "string", required: true, description: "LP amount" }
3505
+ }
3506
+ },
3507
+ {
3508
+ id: "aerodrome.cl-mint",
3509
+ protocolId: AERODROME_PROTOCOL_ID,
3510
+ chainCategory: "evm",
3511
+ description: "Mint a Slipstream concentrated liquidity NFT",
3512
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3513
+ params: {
3514
+ token0: { type: "address", required: true, description: "Token0" },
3515
+ token1: { type: "address", required: true, description: "Token1" },
3516
+ tickSpacing: { type: "number", required: true, description: "Pool tick spacing" },
3517
+ tickLower: { type: "number", required: true, description: "Lower tick" },
3518
+ tickUpper: { type: "number", required: true, description: "Upper tick" }
3519
+ }
3520
+ },
3521
+ {
3522
+ id: "aerodrome.gauge-stake",
3523
+ protocolId: AERODROME_PROTOCOL_ID,
3524
+ chainCategory: "evm",
3525
+ description: "Stake basic LP tokens or a Slipstream NFT in a gauge",
3526
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3527
+ params: {
3528
+ gauge: { type: "address", required: true, description: "Gauge address" }
3529
+ }
3530
+ },
3531
+ {
3532
+ id: "aerodrome.claim-fees",
3533
+ protocolId: AERODROME_PROTOCOL_ID,
3534
+ chainCategory: "evm",
3535
+ description: "Claim unstaked fees from the pool (not the gauge)",
3536
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3537
+ params: { pool: { type: "address", required: true, description: "Pool lp from fetch_positions claimFees.pool" } }
3538
+ },
3539
+ {
3540
+ id: "aerodrome.claim-emissions",
3541
+ protocolId: AERODROME_PROTOCOL_ID,
3542
+ chainCategory: "evm",
3543
+ description: "Claim gauge emissions in AERO (not the pool)",
3544
+ commonParams: ["keyGen", "purposeText", "useCustomGas"],
3545
+ params: { gauge: { type: "address", required: true, description: "Gauge from fetch_positions claimEmissions" } }
3546
+ }
3547
+ ]
3548
+ };
3549
+ registerProtocolModule(aerodromeProtocolModule);
3427
3550
 
3428
3551
  // src/index.ts
3429
3552
  registerProtocolModule(uniswapV4ProtocolModule);
3430
3553
  registerProtocolModule(curveDaoProtocolModule);
3554
+ registerProtocolModule(aerodromeProtocolModule);
3431
3555
 
3432
3556
  Object.defineProperty(exports, "firstClientIdFromKeyGen", {
3433
3557
  enumerable: true,
@@ -3440,9 +3564,10 @@ exports.EIP712_SIGN_REQUEST_KIND = EIP712_SIGN_REQUEST_KIND;
3440
3564
  exports.NEAR_CHAIN_CATEGORY = NEAR_CHAIN_CATEGORY;
3441
3565
  exports.PAYLOAD_SIGN_ED25519_REQUEST_KIND = PAYLOAD_SIGN_ED25519_REQUEST_KIND;
3442
3566
  exports.SOLANA_CHAIN_CATEGORY = SOLANA_CHAIN_CATEGORY;
3567
+ exports.aerodromeProtocolModule = aerodromeProtocolModule;
3443
3568
  exports.approveStepsToEvmTxSteps = approveStepsToEvmTxSteps;
3444
3569
  exports.buildConditionalErc20ApproveSteps = buildConditionalErc20ApproveSteps;
3445
- exports.buildEip712MultisignBody = buildEip712MultisignBody;
3570
+ exports.buildEip712Multisign = buildEip712Multisign;
3446
3571
  exports.buildEvmMultisignBatch = buildEvmMultisignBatch;
3447
3572
  exports.buildPayloadSignEd25519MultisignBody = buildPayloadSignEd25519MultisignBody;
3448
3573
  exports.coingeckoPlatformForChainId = coingeckoPlatformForChainId;