@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
@@ -1179,57 +1179,60 @@ function eip712SignatureText(domain, primaryType) {
1179
1179
  function jsonStringifyForAudit(value) {
1180
1180
  return JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v);
1181
1181
  }
1182
- function eip712MsgRawHex(typedData, delivery) {
1183
- const envelope = {
1182
+ function eip712LegEnvelope(typedData, delivery, digest) {
1183
+ return {
1184
1184
  version: 1,
1185
- ...typedData,
1186
- delivery
1187
- };
1188
- return viem.stringToHex(jsonStringifyForAudit(envelope));
1189
- }
1190
- function buildEip712MultisignBody(args) {
1191
- const { typedData, delivery } = args;
1192
- const digest = viem.hashTypedData({
1185
+ digest,
1193
1186
  domain: typedData.domain,
1194
1187
  types: typedData.types,
1195
1188
  primaryType: typedData.primaryType,
1196
- message: typedData.message
1197
- });
1198
- const extraJSON = {
1199
- signRequestKind: EIP712_SIGN_REQUEST_KIND,
1200
- eip712: {
1201
- version: 1,
1202
- digest,
1203
- domain: typedData.domain,
1204
- types: typedData.types,
1205
- primaryType: typedData.primaryType,
1206
- message: typedData.message
1207
- },
1189
+ message: typedData.message,
1208
1190
  delivery
1209
1191
  };
1192
+ }
1193
+ function eip712MsgRawHex(envelope) {
1194
+ return viem.stringToHex(jsonStringifyForAudit(envelope));
1195
+ }
1196
+ function buildEip712Multisign(args) {
1197
+ if (args.legs.length < 1) {
1198
+ throw new Error("buildEip712Multisign requires at least one leg");
1199
+ }
1200
+ const eip712 = [];
1201
+ const legs = args.legs.map((leg) => {
1202
+ const digest = viem.hashTypedData({
1203
+ domain: leg.typedData.domain,
1204
+ types: leg.typedData.types,
1205
+ primaryType: leg.typedData.primaryType,
1206
+ message: leg.typedData.message
1207
+ });
1208
+ const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest);
1209
+ eip712.push(envelope);
1210
+ return {
1211
+ msgHash: msgHashNo0x(digest),
1212
+ msgRaw: eip712MsgRawHex(envelope),
1213
+ destinationAddress: args.destinationAddress,
1214
+ signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),
1215
+ audit: {
1216
+ kind: "EIP712",
1217
+ primaryType: leg.typedData.primaryType,
1218
+ deliveryKind: leg.delivery.kind,
1219
+ ...leg.audit ?? {}
1220
+ },
1221
+ feeSnapshot: {}
1222
+ };
1223
+ });
1210
1224
  return finalizeMultisign({
1211
1225
  keyGen: args.keyGen,
1212
1226
  purposeText: args.purposeText,
1213
1227
  purposeSuffix: args.purposeSuffix,
1214
1228
  destinationChainID: args.destinationChainID,
1215
1229
  destinationAddress: args.destinationAddress,
1216
- extraJSON,
1230
+ extraJSON: {
1231
+ signRequestKind: EIP712_SIGN_REQUEST_KIND,
1232
+ eip712
1233
+ },
1217
1234
  expiryDate: args.expiryDate,
1218
- legs: [
1219
- {
1220
- msgHash: msgHashNo0x(digest),
1221
- msgRaw: eip712MsgRawHex(typedData, delivery),
1222
- destinationAddress: args.destinationAddress,
1223
- signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),
1224
- audit: {
1225
- kind: "EIP712",
1226
- primaryType: typedData.primaryType,
1227
- deliveryKind: delivery.kind,
1228
- ...args.audit ?? {}
1229
- },
1230
- feeSnapshot: {}
1231
- }
1232
- ]
1235
+ legs
1233
1236
  });
1234
1237
  }
1235
1238
  var EXCHANGE_DOMAIN = {
@@ -1475,40 +1478,44 @@ async function buildHyperliquidLimitOrderWithTpslMultisign(args) {
1475
1478
  const nonce = args.nonce ?? Date.now();
1476
1479
  const isTestnet = args.chainId === 998;
1477
1480
  const typed = buildHyperliquidAgentTypedData({ action, nonce, isTestnet });
1478
- return buildEip712MultisignBody({
1481
+ return buildEip712Multisign({
1479
1482
  keyGen: args.keyGen,
1480
1483
  purposeText: args.purposeText,
1481
1484
  destinationChainID: String(args.chainId),
1482
1485
  destinationAddress: ZERO_ADDRESS,
1483
- typedData: {
1484
- domain: typed.domain,
1485
- types: typed.types,
1486
- primaryType: typed.primaryType,
1487
- message: typed.message
1488
- },
1489
- delivery: {
1490
- kind: "hyperliquid_exchange",
1491
- chainId: args.chainId,
1492
- isTestnet,
1493
- action,
1494
- nonce
1495
- },
1496
- audit: {
1497
- protocol: "hyperliquid",
1498
- action: "limitOrderWithTpsl",
1499
- coin: args.coin,
1500
- marketKind,
1501
- asset,
1502
- isBuy: args.isBuy,
1503
- limitPxHuman: args.limitPxHuman,
1504
- szHuman: args.szHuman,
1505
- takeProfitTriggerPxHuman: tp ?? null,
1506
- stopLossTriggerPxHuman: sl ?? null,
1507
- tpslExecMode: args.tpslExecMode ?? "limit_at_trigger",
1508
- grouping: "normalTpsl",
1509
- nonce,
1510
- connectionId: typed.connectionId
1511
- }
1486
+ legs: [
1487
+ {
1488
+ typedData: {
1489
+ domain: typed.domain,
1490
+ types: typed.types,
1491
+ primaryType: typed.primaryType,
1492
+ message: typed.message
1493
+ },
1494
+ delivery: {
1495
+ kind: "hyperliquid_exchange",
1496
+ chainId: args.chainId,
1497
+ isTestnet,
1498
+ action,
1499
+ nonce
1500
+ },
1501
+ audit: {
1502
+ protocol: "hyperliquid",
1503
+ action: "limitOrderWithTpsl",
1504
+ coin: args.coin,
1505
+ marketKind,
1506
+ asset,
1507
+ isBuy: args.isBuy,
1508
+ limitPxHuman: args.limitPxHuman,
1509
+ szHuman: args.szHuman,
1510
+ takeProfitTriggerPxHuman: tp ?? null,
1511
+ stopLossTriggerPxHuman: sl ?? null,
1512
+ tpslExecMode: args.tpslExecMode ?? "limit_at_trigger",
1513
+ grouping: "normalTpsl",
1514
+ nonce,
1515
+ connectionId: typed.connectionId
1516
+ }
1517
+ }
1518
+ ]
1512
1519
  });
1513
1520
  }
1514
1521
  async function buildHyperliquidUpdateLeverageMultisign(args) {
@@ -1527,35 +1534,39 @@ async function buildHyperliquidUpdateLeverageMultisign(args) {
1527
1534
  const nonce = args.nonce ?? Date.now();
1528
1535
  const isTestnet = args.chainId === 998;
1529
1536
  const typed = buildHyperliquidAgentTypedData({ action, nonce, isTestnet });
1530
- return buildEip712MultisignBody({
1537
+ return buildEip712Multisign({
1531
1538
  keyGen: args.keyGen,
1532
1539
  purposeText: args.purposeText,
1533
1540
  destinationChainID: String(args.chainId),
1534
1541
  destinationAddress: ZERO_ADDRESS,
1535
- typedData: {
1536
- domain: typed.domain,
1537
- types: typed.types,
1538
- primaryType: typed.primaryType,
1539
- message: typed.message
1540
- },
1541
- delivery: {
1542
- kind: "hyperliquid_exchange",
1543
- chainId: args.chainId,
1544
- isTestnet,
1545
- action,
1546
- nonce
1547
- },
1548
- audit: {
1549
- protocol: "hyperliquid",
1550
- action: "updateLeverage",
1551
- coin: args.coin,
1552
- marketKind,
1553
- asset,
1554
- leverage: action.leverage,
1555
- isCross: action.isCross,
1556
- nonce,
1557
- connectionId: typed.connectionId
1558
- }
1542
+ legs: [
1543
+ {
1544
+ typedData: {
1545
+ domain: typed.domain,
1546
+ types: typed.types,
1547
+ primaryType: typed.primaryType,
1548
+ message: typed.message
1549
+ },
1550
+ delivery: {
1551
+ kind: "hyperliquid_exchange",
1552
+ chainId: args.chainId,
1553
+ isTestnet,
1554
+ action,
1555
+ nonce
1556
+ },
1557
+ audit: {
1558
+ protocol: "hyperliquid",
1559
+ action: "updateLeverage",
1560
+ coin: args.coin,
1561
+ marketKind,
1562
+ asset,
1563
+ leverage: action.leverage,
1564
+ isCross: action.isCross,
1565
+ nonce,
1566
+ connectionId: typed.connectionId
1567
+ }
1568
+ }
1569
+ ]
1559
1570
  });
1560
1571
  }
1561
1572
 
@@ -1928,27 +1939,31 @@ async function buildHyperliquidBridgeWithdrawMultisign(args) {
1928
1939
  isTestnet
1929
1940
  });
1930
1941
  const typed = buildHyperliquidWithdraw3TypedData({ action });
1931
- return buildEip712MultisignBody({
1942
+ return buildEip712Multisign({
1932
1943
  keyGen: args.keyGen,
1933
1944
  purposeText: args.purposeText,
1934
1945
  destinationChainID: String(args.chainId),
1935
1946
  destinationAddress: ZERO_ADDRESS2,
1936
- typedData: typed,
1937
- delivery: {
1938
- kind: "hyperliquid_exchange",
1939
- chainId: args.chainId,
1940
- isTestnet,
1941
- action,
1942
- nonce
1943
- },
1944
- audit: {
1945
- protocol: "hyperliquid",
1946
- action: "bridgeWithdraw",
1947
- usdHuman: args.usdHuman,
1948
- destination,
1949
- nonce,
1950
- hyperliquidChain: action.hyperliquidChain
1951
- }
1947
+ legs: [
1948
+ {
1949
+ typedData: typed,
1950
+ delivery: {
1951
+ kind: "hyperliquid_exchange",
1952
+ chainId: args.chainId,
1953
+ isTestnet,
1954
+ action,
1955
+ nonce
1956
+ },
1957
+ audit: {
1958
+ protocol: "hyperliquid",
1959
+ action: "bridgeWithdraw",
1960
+ usdHuman: args.usdHuman,
1961
+ destination,
1962
+ nonce,
1963
+ hyperliquidChain: action.hyperliquidChain
1964
+ }
1965
+ }
1966
+ ]
1952
1967
  });
1953
1968
  }
1954
1969