@continuumdao/ctm-mpc-defi 0.2.28 → 0.2.30

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 (52) hide show
  1. package/dist/agent/catalog.cjs +1305 -21
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +1468 -1
  4. package/dist/agent/catalog.js +1236 -23
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/continuum-dao/SKILL.md +139 -0
  7. package/dist/agent/skills/ethena/SKILL.md +1 -1
  8. package/dist/agent/skills/lido/SKILL.md +4 -1
  9. package/dist/core/index.cjs +42 -39
  10. package/dist/core/index.cjs.map +1 -1
  11. package/dist/core/index.d.ts +1 -1
  12. package/dist/core/index.js +42 -39
  13. package/dist/core/index.js.map +1 -1
  14. package/dist/{eip712Multisign-xhXpUYp3.d.ts → eip712Multisign-DCW7heqX.d.ts} +11 -8
  15. package/dist/index.cjs +64 -57
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +64 -57
  19. package/dist/index.js.map +1 -1
  20. package/dist/protocols/evm/arcus/index.cjs +62 -55
  21. package/dist/protocols/evm/arcus/index.cjs.map +1 -1
  22. package/dist/protocols/evm/arcus/index.js +62 -55
  23. package/dist/protocols/evm/arcus/index.js.map +1 -1
  24. package/dist/protocols/evm/continuum-dao/index.cjs +2237 -0
  25. package/dist/protocols/evm/continuum-dao/index.cjs.map +1 -0
  26. package/dist/protocols/evm/continuum-dao/index.d.ts +700 -0
  27. package/dist/protocols/evm/continuum-dao/index.js +2110 -0
  28. package/dist/protocols/evm/continuum-dao/index.js.map +1 -0
  29. package/dist/protocols/evm/ethena/index.cjs +41 -4
  30. package/dist/protocols/evm/ethena/index.cjs.map +1 -1
  31. package/dist/protocols/evm/ethena/index.d.ts +12 -2
  32. package/dist/protocols/evm/ethena/index.js +38 -5
  33. package/dist/protocols/evm/ethena/index.js.map +1 -1
  34. package/dist/protocols/evm/hyperliquid/index.cjs +125 -110
  35. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  36. package/dist/protocols/evm/hyperliquid/index.js +125 -110
  37. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  38. package/dist/protocols/evm/lido/index.cjs +66 -1
  39. package/dist/protocols/evm/lido/index.cjs.map +1 -1
  40. package/dist/protocols/evm/lido/index.d.ts +11 -1
  41. package/dist/protocols/evm/lido/index.js +60 -2
  42. package/dist/protocols/evm/lido/index.js.map +1 -1
  43. package/dist/protocols/evm/permit2/index.cjs +66 -59
  44. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  45. package/dist/protocols/evm/permit2/index.js +66 -59
  46. package/dist/protocols/evm/permit2/index.js.map +1 -1
  47. package/dist/protocols/evm/uniswap-v4/index.cjs +63 -56
  48. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  49. package/dist/protocols/evm/uniswap-v4/index.d.ts +1 -1
  50. package/dist/protocols/evm/uniswap-v4/index.js +63 -56
  51. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  52. package/package.json +6 -1
@@ -1177,57 +1177,60 @@ function eip712SignatureText(domain, primaryType) {
1177
1177
  function jsonStringifyForAudit(value) {
1178
1178
  return JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v);
1179
1179
  }
1180
- function eip712MsgRawHex(typedData, delivery) {
1181
- const envelope = {
1180
+ function eip712LegEnvelope(typedData, delivery, digest) {
1181
+ return {
1182
1182
  version: 1,
1183
- ...typedData,
1184
- delivery
1185
- };
1186
- return stringToHex(jsonStringifyForAudit(envelope));
1187
- }
1188
- function buildEip712MultisignBody(args) {
1189
- const { typedData, delivery } = args;
1190
- const digest = hashTypedData({
1183
+ digest,
1191
1184
  domain: typedData.domain,
1192
1185
  types: typedData.types,
1193
1186
  primaryType: typedData.primaryType,
1194
- message: typedData.message
1195
- });
1196
- const extraJSON = {
1197
- signRequestKind: EIP712_SIGN_REQUEST_KIND,
1198
- eip712: {
1199
- version: 1,
1200
- digest,
1201
- domain: typedData.domain,
1202
- types: typedData.types,
1203
- primaryType: typedData.primaryType,
1204
- message: typedData.message
1205
- },
1187
+ message: typedData.message,
1206
1188
  delivery
1207
1189
  };
1190
+ }
1191
+ function eip712MsgRawHex(envelope) {
1192
+ return stringToHex(jsonStringifyForAudit(envelope));
1193
+ }
1194
+ function buildEip712Multisign(args) {
1195
+ if (args.legs.length < 1) {
1196
+ throw new Error("buildEip712Multisign requires at least one leg");
1197
+ }
1198
+ const eip712 = [];
1199
+ const legs = args.legs.map((leg) => {
1200
+ const digest = hashTypedData({
1201
+ domain: leg.typedData.domain,
1202
+ types: leg.typedData.types,
1203
+ primaryType: leg.typedData.primaryType,
1204
+ message: leg.typedData.message
1205
+ });
1206
+ const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest);
1207
+ eip712.push(envelope);
1208
+ return {
1209
+ msgHash: msgHashNo0x(digest),
1210
+ msgRaw: eip712MsgRawHex(envelope),
1211
+ destinationAddress: args.destinationAddress,
1212
+ signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),
1213
+ audit: {
1214
+ kind: "EIP712",
1215
+ primaryType: leg.typedData.primaryType,
1216
+ deliveryKind: leg.delivery.kind,
1217
+ ...leg.audit ?? {}
1218
+ },
1219
+ feeSnapshot: {}
1220
+ };
1221
+ });
1208
1222
  return finalizeMultisign({
1209
1223
  keyGen: args.keyGen,
1210
1224
  purposeText: args.purposeText,
1211
1225
  purposeSuffix: args.purposeSuffix,
1212
1226
  destinationChainID: args.destinationChainID,
1213
1227
  destinationAddress: args.destinationAddress,
1214
- extraJSON,
1228
+ extraJSON: {
1229
+ signRequestKind: EIP712_SIGN_REQUEST_KIND,
1230
+ eip712
1231
+ },
1215
1232
  expiryDate: args.expiryDate,
1216
- legs: [
1217
- {
1218
- msgHash: msgHashNo0x(digest),
1219
- msgRaw: eip712MsgRawHex(typedData, delivery),
1220
- destinationAddress: args.destinationAddress,
1221
- signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),
1222
- audit: {
1223
- kind: "EIP712",
1224
- primaryType: typedData.primaryType,
1225
- deliveryKind: delivery.kind,
1226
- ...args.audit ?? {}
1227
- },
1228
- feeSnapshot: {}
1229
- }
1230
- ]
1233
+ legs
1231
1234
  });
1232
1235
  }
1233
1236
  var EXCHANGE_DOMAIN = {
@@ -1473,40 +1476,44 @@ async function buildHyperliquidLimitOrderWithTpslMultisign(args) {
1473
1476
  const nonce = args.nonce ?? Date.now();
1474
1477
  const isTestnet = args.chainId === 998;
1475
1478
  const typed = buildHyperliquidAgentTypedData({ action, nonce, isTestnet });
1476
- return buildEip712MultisignBody({
1479
+ return buildEip712Multisign({
1477
1480
  keyGen: args.keyGen,
1478
1481
  purposeText: args.purposeText,
1479
1482
  destinationChainID: String(args.chainId),
1480
1483
  destinationAddress: ZERO_ADDRESS,
1481
- typedData: {
1482
- domain: typed.domain,
1483
- types: typed.types,
1484
- primaryType: typed.primaryType,
1485
- message: typed.message
1486
- },
1487
- delivery: {
1488
- kind: "hyperliquid_exchange",
1489
- chainId: args.chainId,
1490
- isTestnet,
1491
- action,
1492
- nonce
1493
- },
1494
- audit: {
1495
- protocol: "hyperliquid",
1496
- action: "limitOrderWithTpsl",
1497
- coin: args.coin,
1498
- marketKind,
1499
- asset,
1500
- isBuy: args.isBuy,
1501
- limitPxHuman: args.limitPxHuman,
1502
- szHuman: args.szHuman,
1503
- takeProfitTriggerPxHuman: tp ?? null,
1504
- stopLossTriggerPxHuman: sl ?? null,
1505
- tpslExecMode: args.tpslExecMode ?? "limit_at_trigger",
1506
- grouping: "normalTpsl",
1507
- nonce,
1508
- connectionId: typed.connectionId
1509
- }
1484
+ legs: [
1485
+ {
1486
+ typedData: {
1487
+ domain: typed.domain,
1488
+ types: typed.types,
1489
+ primaryType: typed.primaryType,
1490
+ message: typed.message
1491
+ },
1492
+ delivery: {
1493
+ kind: "hyperliquid_exchange",
1494
+ chainId: args.chainId,
1495
+ isTestnet,
1496
+ action,
1497
+ nonce
1498
+ },
1499
+ audit: {
1500
+ protocol: "hyperliquid",
1501
+ action: "limitOrderWithTpsl",
1502
+ coin: args.coin,
1503
+ marketKind,
1504
+ asset,
1505
+ isBuy: args.isBuy,
1506
+ limitPxHuman: args.limitPxHuman,
1507
+ szHuman: args.szHuman,
1508
+ takeProfitTriggerPxHuman: tp ?? null,
1509
+ stopLossTriggerPxHuman: sl ?? null,
1510
+ tpslExecMode: args.tpslExecMode ?? "limit_at_trigger",
1511
+ grouping: "normalTpsl",
1512
+ nonce,
1513
+ connectionId: typed.connectionId
1514
+ }
1515
+ }
1516
+ ]
1510
1517
  });
1511
1518
  }
1512
1519
  async function buildHyperliquidUpdateLeverageMultisign(args) {
@@ -1525,35 +1532,39 @@ async function buildHyperliquidUpdateLeverageMultisign(args) {
1525
1532
  const nonce = args.nonce ?? Date.now();
1526
1533
  const isTestnet = args.chainId === 998;
1527
1534
  const typed = buildHyperliquidAgentTypedData({ action, nonce, isTestnet });
1528
- return buildEip712MultisignBody({
1535
+ return buildEip712Multisign({
1529
1536
  keyGen: args.keyGen,
1530
1537
  purposeText: args.purposeText,
1531
1538
  destinationChainID: String(args.chainId),
1532
1539
  destinationAddress: ZERO_ADDRESS,
1533
- typedData: {
1534
- domain: typed.domain,
1535
- types: typed.types,
1536
- primaryType: typed.primaryType,
1537
- message: typed.message
1538
- },
1539
- delivery: {
1540
- kind: "hyperliquid_exchange",
1541
- chainId: args.chainId,
1542
- isTestnet,
1543
- action,
1544
- nonce
1545
- },
1546
- audit: {
1547
- protocol: "hyperliquid",
1548
- action: "updateLeverage",
1549
- coin: args.coin,
1550
- marketKind,
1551
- asset,
1552
- leverage: action.leverage,
1553
- isCross: action.isCross,
1554
- nonce,
1555
- connectionId: typed.connectionId
1556
- }
1540
+ legs: [
1541
+ {
1542
+ typedData: {
1543
+ domain: typed.domain,
1544
+ types: typed.types,
1545
+ primaryType: typed.primaryType,
1546
+ message: typed.message
1547
+ },
1548
+ delivery: {
1549
+ kind: "hyperliquid_exchange",
1550
+ chainId: args.chainId,
1551
+ isTestnet,
1552
+ action,
1553
+ nonce
1554
+ },
1555
+ audit: {
1556
+ protocol: "hyperliquid",
1557
+ action: "updateLeverage",
1558
+ coin: args.coin,
1559
+ marketKind,
1560
+ asset,
1561
+ leverage: action.leverage,
1562
+ isCross: action.isCross,
1563
+ nonce,
1564
+ connectionId: typed.connectionId
1565
+ }
1566
+ }
1567
+ ]
1557
1568
  });
1558
1569
  }
1559
1570
 
@@ -1926,27 +1937,31 @@ async function buildHyperliquidBridgeWithdrawMultisign(args) {
1926
1937
  isTestnet
1927
1938
  });
1928
1939
  const typed = buildHyperliquidWithdraw3TypedData({ action });
1929
- return buildEip712MultisignBody({
1940
+ return buildEip712Multisign({
1930
1941
  keyGen: args.keyGen,
1931
1942
  purposeText: args.purposeText,
1932
1943
  destinationChainID: String(args.chainId),
1933
1944
  destinationAddress: ZERO_ADDRESS2,
1934
- typedData: typed,
1935
- delivery: {
1936
- kind: "hyperliquid_exchange",
1937
- chainId: args.chainId,
1938
- isTestnet,
1939
- action,
1940
- nonce
1941
- },
1942
- audit: {
1943
- protocol: "hyperliquid",
1944
- action: "bridgeWithdraw",
1945
- usdHuman: args.usdHuman,
1946
- destination,
1947
- nonce,
1948
- hyperliquidChain: action.hyperliquidChain
1949
- }
1945
+ legs: [
1946
+ {
1947
+ typedData: typed,
1948
+ delivery: {
1949
+ kind: "hyperliquid_exchange",
1950
+ chainId: args.chainId,
1951
+ isTestnet,
1952
+ action,
1953
+ nonce
1954
+ },
1955
+ audit: {
1956
+ protocol: "hyperliquid",
1957
+ action: "bridgeWithdraw",
1958
+ usdHuman: args.usdHuman,
1959
+ destination,
1960
+ nonce,
1961
+ hyperliquidChain: action.hyperliquidChain
1962
+ }
1963
+ }
1964
+ ]
1950
1965
  });
1951
1966
  }
1952
1967