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