@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
@@ -1639,57 +1639,60 @@ function eip712SignatureText(domain, primaryType) {
1639
1639
  function jsonStringifyForAudit(value) {
1640
1640
  return JSON.stringify(value, (_, v) => typeof v === "bigint" ? v.toString() : v);
1641
1641
  }
1642
- function eip712MsgRawHex(typedData, delivery) {
1643
- const envelope = {
1642
+ function eip712LegEnvelope(typedData, delivery, digest) {
1643
+ return {
1644
1644
  version: 1,
1645
- ...typedData,
1646
- delivery
1647
- };
1648
- return stringToHex(jsonStringifyForAudit(envelope));
1649
- }
1650
- function buildEip712MultisignBody(args) {
1651
- const { typedData, delivery } = args;
1652
- const digest = hashTypedData({
1645
+ digest,
1653
1646
  domain: typedData.domain,
1654
1647
  types: typedData.types,
1655
1648
  primaryType: typedData.primaryType,
1656
- message: typedData.message
1657
- });
1658
- const extraJSON = {
1659
- signRequestKind: EIP712_SIGN_REQUEST_KIND,
1660
- eip712: {
1661
- version: 1,
1662
- digest,
1663
- domain: typedData.domain,
1664
- types: typedData.types,
1665
- primaryType: typedData.primaryType,
1666
- message: typedData.message
1667
- },
1649
+ message: typedData.message,
1668
1650
  delivery
1669
1651
  };
1652
+ }
1653
+ function eip712MsgRawHex(envelope) {
1654
+ return stringToHex(jsonStringifyForAudit(envelope));
1655
+ }
1656
+ function buildEip712Multisign(args) {
1657
+ if (args.legs.length < 1) {
1658
+ throw new Error("buildEip712Multisign requires at least one leg");
1659
+ }
1660
+ const eip712 = [];
1661
+ const legs = args.legs.map((leg) => {
1662
+ const digest = hashTypedData({
1663
+ domain: leg.typedData.domain,
1664
+ types: leg.typedData.types,
1665
+ primaryType: leg.typedData.primaryType,
1666
+ message: leg.typedData.message
1667
+ });
1668
+ const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest);
1669
+ eip712.push(envelope);
1670
+ return {
1671
+ msgHash: msgHashNo0x(digest),
1672
+ msgRaw: eip712MsgRawHex(envelope),
1673
+ destinationAddress: args.destinationAddress,
1674
+ signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),
1675
+ audit: {
1676
+ kind: "EIP712",
1677
+ primaryType: leg.typedData.primaryType,
1678
+ deliveryKind: leg.delivery.kind,
1679
+ ...leg.audit ?? {}
1680
+ },
1681
+ feeSnapshot: {}
1682
+ };
1683
+ });
1670
1684
  return finalizeMultisign({
1671
1685
  keyGen: args.keyGen,
1672
1686
  purposeText: args.purposeText,
1673
1687
  purposeSuffix: args.purposeSuffix,
1674
1688
  destinationChainID: args.destinationChainID,
1675
1689
  destinationAddress: args.destinationAddress,
1676
- extraJSON,
1690
+ extraJSON: {
1691
+ signRequestKind: EIP712_SIGN_REQUEST_KIND,
1692
+ eip712
1693
+ },
1677
1694
  expiryDate: args.expiryDate,
1678
- legs: [
1679
- {
1680
- msgHash: msgHashNo0x(digest),
1681
- msgRaw: eip712MsgRawHex(typedData, delivery),
1682
- destinationAddress: args.destinationAddress,
1683
- signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),
1684
- audit: {
1685
- kind: "EIP712",
1686
- primaryType: typedData.primaryType,
1687
- deliveryKind: delivery.kind,
1688
- ...args.audit ?? {}
1689
- },
1690
- feeSnapshot: {}
1691
- }
1692
- ]
1695
+ legs
1693
1696
  });
1694
1697
  }
1695
1698
 
@@ -1809,27 +1812,31 @@ async function buildArcusWithdrawMultisign(args) {
1809
1812
  if (typed.message.amount < minQuantums) {
1810
1813
  throw new Error(`Arcus withdraw must be at least ${ARCUS_MIN_WITHDRAW_USD} USD`);
1811
1814
  }
1812
- return buildEip712MultisignBody({
1815
+ return buildEip712Multisign({
1813
1816
  keyGen: args.keyGen,
1814
1817
  purposeText: args.purposeText,
1815
1818
  destinationChainID: String(args.chainId),
1816
1819
  destinationAddress: getAddress(args.executorAddress),
1817
- typedData: typed,
1818
- delivery: {
1819
- kind: "arcus_withdraw",
1820
- chainId: args.chainId,
1821
- product: args.product,
1822
- accountIndex: typed.message.accountIndex,
1823
- body: typed.requestBody
1824
- },
1825
- audit: {
1826
- protocol: ARCUS_PROTOCOL_ID,
1827
- action: "withdraw",
1828
- product: args.product,
1829
- usdHuman: args.usdHuman,
1830
- accountIndex: typed.message.accountIndex,
1831
- nonce: typed.message.nonce
1832
- }
1820
+ legs: [
1821
+ {
1822
+ typedData: typed,
1823
+ delivery: {
1824
+ kind: "arcus_withdraw",
1825
+ chainId: args.chainId,
1826
+ product: args.product,
1827
+ accountIndex: typed.message.accountIndex,
1828
+ body: typed.requestBody
1829
+ },
1830
+ audit: {
1831
+ protocol: ARCUS_PROTOCOL_ID,
1832
+ action: "withdraw",
1833
+ product: args.product,
1834
+ usdHuman: args.usdHuman,
1835
+ accountIndex: typed.message.accountIndex,
1836
+ nonce: typed.message.nonce
1837
+ }
1838
+ }
1839
+ ]
1833
1840
  });
1834
1841
  }
1835
1842
  async function buildEvmMultisignBodyArcusDepositBatch(args) {