@continuumdao/ctm-mpc-defi 0.2.22 → 0.2.25

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 (43) hide show
  1. package/dist/agent/catalog.cjs +806 -18
  2. package/dist/agent/catalog.cjs.map +1 -1
  3. package/dist/agent/catalog.d.ts +2400 -43
  4. package/dist/agent/catalog.js +772 -19
  5. package/dist/agent/catalog.js.map +1 -1
  6. package/dist/agent/skills/arcus/SKILL.md +72 -0
  7. package/dist/agent/skills/gmx/SKILL.md +32 -0
  8. package/dist/agent/skills/hyperliquid/SKILL.md +44 -3
  9. package/dist/agent/skills/uniswap-v4/SKILL.md +31 -1
  10. package/dist/core/index.cjs +55 -0
  11. package/dist/core/index.cjs.map +1 -1
  12. package/dist/core/index.d.ts +15 -21
  13. package/dist/core/index.js +54 -1
  14. package/dist/core/index.js.map +1 -1
  15. package/dist/eip712Multisign-xhXpUYp3.d.ts +36 -0
  16. package/dist/index.cjs +399 -12
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +2 -1
  19. package/dist/index.js +398 -13
  20. package/dist/index.js.map +1 -1
  21. package/dist/protocols/evm/arcus/index.cjs +2061 -0
  22. package/dist/protocols/evm/arcus/index.cjs.map +1 -0
  23. package/dist/protocols/evm/arcus/index.d.ts +726 -0
  24. package/dist/protocols/evm/arcus/index.js +1964 -0
  25. package/dist/protocols/evm/arcus/index.js.map +1 -0
  26. package/dist/protocols/evm/gmx/index.cjs +39 -0
  27. package/dist/protocols/evm/gmx/index.cjs.map +1 -1
  28. package/dist/protocols/evm/gmx/index.d.ts +21 -1
  29. package/dist/protocols/evm/gmx/index.js +38 -1
  30. package/dist/protocols/evm/gmx/index.js.map +1 -1
  31. package/dist/protocols/evm/hyperliquid/index.cjs +478 -208
  32. package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
  33. package/dist/protocols/evm/hyperliquid/index.d.ts +166 -51
  34. package/dist/protocols/evm/hyperliquid/index.js +467 -210
  35. package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
  36. package/dist/protocols/evm/permit2/index.cjs.map +1 -1
  37. package/dist/protocols/evm/permit2/index.js.map +1 -1
  38. package/dist/protocols/evm/uniswap-v4/index.cjs +734 -15
  39. package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -1
  40. package/dist/protocols/evm/uniswap-v4/index.d.ts +189 -17
  41. package/dist/protocols/evm/uniswap-v4/index.js +698 -16
  42. package/dist/protocols/evm/uniswap-v4/index.js.map +1 -1
  43. package/package.json +6 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts","../../src/core/eip712Multisign.ts","../../src/core/expiry.ts"],"names":["r"],"mappings":";;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAiC,aAAA,EAAgC;AAChG,EAAA,MAAM,CAAA,GAAA,CAAK,WAAA,IAAe,EAAA,EAAI,IAAA,EAAK;AACnC,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,CAAA,GAAI,GAAG,CAAC;;AAAA,EAAO,MAAM,CAAA,CAAA,GAAK,MAAA;AACnC;ACgCO,SAAS,kBAAkB,KAAA,EAAsD;AACtF,EAAA,MAAM,EAAE,MAAA,EAAQ,kBAAA,EAAoB,IAAA,EAAK,GAAI,KAAA;AAC7C,EAAA,IAAI,IAAA,CAAK,WAAW,CAAA,EAAG;AACrB,IAAA,MAAM,IAAI,MAAM,6CAA6C,CAAA;AAAA,EAC/D;AAEA,EAAA,MAAM,EAAA,GAAA,CAAM,MAAA,CAAO,SAAA,IAAa,EAAA,EAAI,IAAA,EAAK;AACzC,EAAA,IAAI,CAAC,EAAA,EAAI,MAAM,IAAI,MAAM,uCAAuC,CAAA;AAEhE,EAAA,MAAM,OAAA,GAA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A,IAAS;AAAC,SACrB;AAAA,QACA,aAAa;AAAC;AAChB;AACF,GACD,CAAA;AACH;;;ACxGO,IAAM,wCAAwC,EAAA,GAAK;AAGnD,IAAM,gCAAA,uBAAuC,GAAA,CAAI;AAAA,EACtD,YAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF,CAAC;AAEM,SAAS,8BAAA,CACd,YACA,kBAAA,EACoB;AACpB,EAAA,IAAI,OAAO,uBAAuB,QAAA,IAAY,MAAA,CAAO,SAAS,kBAAkB,CAAA,IAAK,qBAAqB,CAAA,EAAG;AAC3G,IAAA,OAAO,IAAA,CAAK,MAAM,kBAAkB,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,UAAA,IAAc,gCAAA,CAAiC,GAAA,CAAI,UAAU,CAAA,EAAG;AAClE,IAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,GAAA,EAAI,GAAI,GAAI,CAAA,GAAI,qCAAA;AAAA,EACzC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string | undefined, purposeSuffix?: string): string {\n const t = (purposeText ?? '').trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */\n expiryDate?: number\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n if (input.expiryDate != null && input.expiryDate > 0) {\n bodyForSign.expiryDate = Math.floor(input.expiryDate)\n }\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet morphoGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setMorphoGraphqlProxyUrl(url: string | undefined): void {\n morphoGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoGraphqlProxyUrl(): string | undefined {\n return morphoGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json()) as T\n}\n","import { hashTypedData, stringToHex, type TypedDataDomain } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const EIP712_SIGN_REQUEST_KIND = 'eip712' as const\n\nexport type Eip712TypedDataField = { name: string; type: string }\n\nexport type Eip712TypedDataPayload = {\n domain: TypedDataDomain\n types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>\n primaryType: string\n message: Record<string, unknown>\n}\n\nexport type Eip712MultisignDelivery = Record<string, unknown> & { kind: string }\n\nexport type BuildEip712MultisignBodyArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */\n destinationChainID: string\n destinationAddress: string\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n expiryDate?: number\n}\n\nfunction msgHashNo0x(digest: `0x${string}`): string {\n return digest.startsWith('0x') ? digest.slice(2) : digest\n}\n\nfunction eip712SignatureText(domain: TypedDataDomain, primaryType: string): string {\n return JSON.stringify({\n kind: 'EIP-712',\n ...(typeof domain.name === 'string' ? { name: domain.name } : {}),\n primaryType,\n })\n}\n\nfunction jsonStringifyForAudit(value: unknown): string {\n return JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n}\n\nfunction eip712MsgRawHex(typedData: Eip712TypedDataPayload, delivery: Eip712MultisignDelivery): string {\n const envelope = {\n version: 1,\n ...typedData,\n delivery,\n }\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for a single-leg EIP-712 digest (no EVM tx broadcast).\n * `msgHash` is the EIP-712 hash; `msgRaw` is UTF-8 hex JSON audit envelope (not RLP calldata).\n */\nexport function buildEip712MultisignBody(args: BuildEip712MultisignBodyArgs): MultisignBuildResult {\n const { typedData, delivery } = args\n const digest = hashTypedData({\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n })\n\n const extraJSON: Record<string, unknown> = {\n signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712: {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n },\n delivery,\n }\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON,\n expiryDate: args.expiryDate,\n legs: [\n {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(typedData, delivery),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: typedData.primaryType,\n deliveryKind: delivery.kind,\n ...(args.audit ?? {}),\n },\n feeSnapshot: {},\n },\n ],\n })\n}\n","/** Default MPC sign-request agreement window for fast-moving DeFi protocols (30 minutes). */\nexport const DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60\n\n/** Protocol ids that default to 30-minute expiry when `expiryDate` is omitted on multisign MCP tools. */\nexport const DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = new Set([\n 'uniswap-v4',\n 'gmx',\n 'hyperliquid',\n 'curve-dao',\n])\n\nexport function defiMultisignExpiryUnixSeconds(\n protocolId: string | undefined,\n explicitExpiryDate?: number | null,\n): number | undefined {\n if (typeof explicitExpiryDate === 'number' && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {\n return Math.floor(explicitExpiryDate)\n }\n if (protocolId && DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {\n return Math.floor(Date.now() / 1000) + DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS\n }\n return undefined\n}\n"]}
1
+ {"version":3,"sources":["../../src/core/purpose.ts","../../src/core/envelope.ts","../../src/core/registry.ts","../../src/core/defiProxy.ts","../../src/core/eip712Multisign.ts","../../src/core/payloadSignEd25519Multisign.ts","../../src/core/expiry.ts"],"names":["r","stringToHex"],"mappings":";;;;;;;AACO,SAAS,gBAAA,CAAiB,aAAiC,aAAA,EAAgC;AAChG,EAAA,MAAM,CAAA,GAAA,CAAK,WAAA,IAAe,EAAA,EAAI,IAAA,EAAK;AACnC,EAAA,MAAM,MAAA,GAAA,CAAU,aAAA,IAAiB,EAAA,EAAI,IAAA,EAAK;AAC1C,EAAA,IAAI,CAAC,QAAQ,OAAO,CAAA;AACpB,EAAA,OAAO,CAAA,GAAI,GAAG,CAAC;;AAAA,EAAO,MAAM,CAAA,CAAA,GAAK,MAAA;AACnC;ACgCO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AAA,CAAK,MAAM,kBAAkB,CAAA;AAAA,EACtC;AACA,EAAA,IAAI,UAAA,IAAc,gCAAA,CAAiC,GAAA,CAAI,UAAU,CAAA,EAAG;AAClE,IAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,GAAA,EAAI,GAAI,GAAI,CAAA,GAAI,qCAAA;AAAA,EACzC;AACA,EAAA,OAAO,MAAA;AACT","file":"index.js","sourcesContent":["/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string | undefined, purposeSuffix?: string): string {\n const t = (purposeText ?? '').trim()\n const suffix = (purposeSuffix ?? '').trim()\n if (!suffix) return t\n return t ? `${t}\\n\\n${suffix}` : suffix\n}\n","import type { ChainCategory, MultisignBuildResult, KeyGenSubset } from './types.js'\nimport { getClientIdFromKeyGenResult } from '@continuumdao/continuum-node-sdk'\nimport { mergePurposeText } from './purpose.js'\n\nexport interface MultisignLeg {\n msgHash: string\n msgRaw: string\n destinationAddress: string\n signatureText: string\n audit: Record<string, unknown>\n feeSnapshot: Record<string, unknown>\n proposalTxParams?: Record<string, unknown>\n /** Payable value wei string for first leg only when relevant */\n valueWei?: bigint\n}\n\nexport interface ChainCategoryBuildInput {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n legs: MultisignLeg[]\n extraJSON?: Record<string, unknown>\n /** Top-level destination address (first leg destination if omitted) */\n destinationAddress?: string\n /** Unix seconds (UTC) for mpc-auth multiSignRequest expiryDate. */\n expiryDate?: number\n}\n\nexport interface ChainCategoryModule {\n category: ChainCategory\n finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult\n}\n\n/**\n * Assemble mpc-auth `bodyForSign` from category-built legs.\n * Supports single-tx and batch (messageHashes / messageRawBatch / proposalTxParams).\n */\nexport function finalizeMultisign(input: ChainCategoryBuildInput): MultisignBuildResult {\n const { keyGen, destinationChainID, legs } = input\n if (legs.length === 0) {\n throw new Error('finalizeMultisign requires at least one leg')\n }\n\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n\n const keyList = keyGen.keylist ?? []\n const clientId = getClientIdFromKeyGenResult(keyGen)\n const first = legs[0]!\n\n const messageHashes = legs.map((l) => l.msgHash)\n const messageRawBatch = legs.map((l) => l.msgRaw)\n const batchMeta = legs.map((l) => ({\n destinationAddress: l.destinationAddress,\n signatureText: l.signatureText,\n ...l.audit,\n }))\n\n const proposalTxParams = legs\n .map((l) => l.proposalTxParams)\n .filter((p): p is Record<string, unknown> => p != null && typeof p === 'object')\n\n const extraPayload: Record<string, unknown> = {\n batchMeta,\n ...(input.extraJSON ?? {}),\n }\n const extraJSON = JSON.stringify(extraPayload, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n\n const bodyForSign: Record<string, unknown> = {\n keyList,\n pubKey: ph,\n msgHash: messageHashes[0],\n msgRaw: first.msgRaw,\n destinationChainID,\n destinationAddress: input.destinationAddress ?? first.destinationAddress,\n extraJSON,\n signatureText: first.signatureText,\n purpose: mergePurposeText(input.purposeText, input.purposeSuffix),\n ...first.feeSnapshot,\n }\n\n if (legs.length > 1) {\n bodyForSign.messageHashes = messageHashes\n bodyForSign.messageRawBatch = messageRawBatch\n }\n\n if (proposalTxParams.length > 0) {\n bodyForSign.proposalTxParams = proposalTxParams\n }\n\n const valueWei = first.valueWei\n if (valueWei != null && valueWei > 0n) {\n bodyForSign.value = valueWei.toString()\n }\n\n if (clientId) bodyForSign.clientId = clientId\n\n if (input.expiryDate != null && input.expiryDate > 0) {\n bodyForSign.expiryDate = Math.floor(input.expiryDate)\n }\n\n return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import type { ProtocolModule } from './types.js'\n\nconst modules: ProtocolModule[] = []\n\nexport function registerProtocolModule(mod: ProtocolModule): void {\n const existing = modules.findIndex((m) => m.id === mod.id)\n if (existing >= 0) {\n modules[existing] = mod\n } else {\n modules.push(mod)\n }\n}\n\nexport function getProtocolModules(): readonly ProtocolModule[] {\n return modules\n}\n\nexport function getProtocolModule(id: string): ProtocolModule | undefined {\n return modules.find((m) => m.id === id)\n}\n\nexport function getActionsByChainCategory(category: string): ProtocolModule['actions'] {\n return modules.filter((m) => m.chainCategory === category).flatMap((m) => m.actions)\n}\n","/**\n * Optional browser → Next.js API proxy paths for DeFi upstream calls.\n * Set once from continuumdao-node-app client bootstrap.\n */\n\nlet aaveGraphqlProxyUrl: string | undefined\nlet eulerGraphqlProxyUrl: string | undefined\nlet mapleGraphqlProxyUrl: string | undefined\nlet morphoGraphqlProxyUrl: string | undefined\nlet coingeckoProxyUrl: string | undefined\n\nexport function setAaveGraphqlProxyUrl(url: string | undefined): void {\n aaveGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getAaveGraphqlProxyUrl(): string | undefined {\n return aaveGraphqlProxyUrl\n}\n\nexport function setEulerGraphqlProxyUrl(url: string | undefined): void {\n eulerGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getEulerGraphqlProxyUrl(): string | undefined {\n return eulerGraphqlProxyUrl\n}\n\nexport function setMapleGraphqlProxyUrl(url: string | undefined): void {\n mapleGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMapleGraphqlProxyUrl(): string | undefined {\n return mapleGraphqlProxyUrl\n}\n\nexport function setMorphoGraphqlProxyUrl(url: string | undefined): void {\n morphoGraphqlProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoGraphqlProxyUrl(): string | undefined {\n return morphoGraphqlProxyUrl\n}\n\nexport function setCoingeckoProxyUrl(url: string | undefined): void {\n coingeckoProxyUrl = url?.trim() || undefined\n}\n\nexport function getCoingeckoProxyUrl(): string | undefined {\n return coingeckoProxyUrl\n}\n\nexport async function postJsonViaOptionalProxy<T>(args: {\n directUrl: string\n body: unknown\n proxyUrl?: string\n proxyEnvelope?: unknown\n}): Promise<T> {\n const proxy = args.proxyUrl?.trim()\n if (proxy) {\n const r = await fetch(proxy, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.proxyEnvelope ?? args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `Proxy HTTP ${r.status}: ${t.slice(0, 200)}` : `Proxy HTTP ${r.status}`)\n }\n return (await r.json()) as T\n }\n const r = await fetch(args.directUrl, {\n method: 'POST',\n headers: {'content-type': 'application/json'},\n body: JSON.stringify(args.body),\n })\n if (!r.ok) {\n const t = await r.text().catch(() => '')\n throw new Error(t ? `HTTP ${r.status}: ${t.slice(0, 200)}` : `HTTP ${r.status}`)\n }\n return (await r.json()) as T\n}\n","import { hashTypedData, stringToHex, type TypedDataDomain } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const EIP712_SIGN_REQUEST_KIND = 'eip712' as const\n\nexport type Eip712TypedDataField = { name: string; type: string }\n\nexport type Eip712TypedDataPayload = {\n domain: TypedDataDomain\n types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>\n primaryType: string\n message: Record<string, unknown>\n}\n\nexport type Eip712MultisignDelivery = Record<string, unknown> & { kind: string }\n\nexport type BuildEip712MultisignBodyArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */\n destinationChainID: string\n destinationAddress: string\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n expiryDate?: number\n}\n\nfunction msgHashNo0x(digest: `0x${string}`): string {\n return digest.startsWith('0x') ? digest.slice(2) : digest\n}\n\nfunction eip712SignatureText(domain: TypedDataDomain, primaryType: string): string {\n return JSON.stringify({\n kind: 'EIP-712',\n ...(typeof domain.name === 'string' ? { name: domain.name } : {}),\n primaryType,\n })\n}\n\nfunction jsonStringifyForAudit(value: unknown): string {\n return JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v))\n}\n\nfunction eip712MsgRawHex(typedData: Eip712TypedDataPayload, delivery: Eip712MultisignDelivery): string {\n const envelope = {\n version: 1,\n ...typedData,\n delivery,\n }\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for a single-leg EIP-712 digest (no EVM tx broadcast).\n * `msgHash` is the EIP-712 hash; `msgRaw` is UTF-8 hex JSON audit envelope (not RLP calldata).\n */\nexport function buildEip712MultisignBody(args: BuildEip712MultisignBodyArgs): MultisignBuildResult {\n const { typedData, delivery } = args\n const digest = hashTypedData({\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n })\n\n const extraJSON: Record<string, unknown> = {\n signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712: {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n },\n delivery,\n }\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON,\n expiryDate: args.expiryDate,\n legs: [\n {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(typedData, delivery),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(typedData.domain, typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: typedData.primaryType,\n deliveryKind: delivery.kind,\n ...(args.audit ?? {}),\n },\n feeSnapshot: {},\n },\n ],\n })\n}\n","import { stringToHex } from 'viem'\nimport type { KeyGenSubset, MultisignBuildResult } from './types.js'\nimport { finalizeMultisign } from './envelope.js'\n\nexport const PAYLOAD_SIGN_ED25519_REQUEST_KIND = 'payload_sign_ed25519' as const\n\nexport type PayloadSignEd25519Delivery = Record<string, unknown> & { kind: string }\n\nexport type BuildPayloadSignEd25519MultisignBodyArgs = {\n keyGen: KeyGenSubset\n purposeText: string\n purposeSuffix?: string\n destinationChainID: string\n destinationAddress: string\n /** UTF-8 bytes to sign (Arcus canonical JSON). */\n messageUtf8: string\n /** secp256k1 pub key hex for billing when signing with paired ed25519 KeyGen. */\n billingKeyGenPubKey?: string\n delivery: PayloadSignEd25519Delivery\n audit?: Record<string, unknown>\n expiryDate?: number\n signatureText?: string\n}\n\nfunction msgHashNo0xFromBytes(bytes: Uint8Array): string {\n return Buffer.from(bytes).toString('hex')\n}\n\nfunction payloadMsgRawHex(messageUtf8: string, delivery: PayloadSignEd25519Delivery): string {\n const envelope = {\n version: 1,\n messageUtf8,\n delivery,\n }\n return stringToHex(JSON.stringify(envelope))\n}\n\n/**\n * Build mpc-auth multiSignRequest for Ed25519 FROST signing over variable-length UTF-8 (Arcus Scheme 1).\n * `msgHash` is hex of the raw message bytes (not SHA-256); mpc-auth givre worker signs these bytes directly.\n */\nexport function buildPayloadSignEd25519MultisignBody(\n args: BuildPayloadSignEd25519MultisignBodyArgs,\n): MultisignBuildResult {\n const messageBytes = Buffer.from(args.messageUtf8, 'utf8')\n const msgHash = msgHashNo0xFromBytes(messageBytes)\n\n const extraJSON: Record<string, unknown> = {\n signRequestKind: PAYLOAD_SIGN_ED25519_REQUEST_KIND,\n payloadSignEd25519: {\n version: 1,\n messageHex: msgHash,\n messageLength: messageBytes.length,\n },\n delivery: args.delivery,\n }\n if (args.billingKeyGenPubKey?.trim()) {\n extraJSON.billingKeyGenPubKey = args.billingKeyGenPubKey.trim()\n }\n\n return finalizeMultisign({\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: args.destinationChainID,\n destinationAddress: args.destinationAddress,\n extraJSON,\n expiryDate: args.expiryDate,\n legs: [\n {\n msgHash,\n msgRaw: payloadMsgRawHex(args.messageUtf8, args.delivery),\n destinationAddress: args.destinationAddress,\n signatureText: args.signatureText ?? 'Arcus Ed25519 payload sign',\n audit: {\n kind: 'PAYLOAD_SIGN_ED25519',\n deliveryKind: args.delivery.kind,\n messageLength: messageBytes.length,\n ...(args.audit ?? {}),\n },\n feeSnapshot: {},\n },\n ],\n })\n}\n","/** Default MPC sign-request agreement window for fast-moving DeFi protocols (30 minutes). */\nexport const DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60\n\n/** Protocol ids that default to 30-minute expiry when `expiryDate` is omitted on multisign MCP tools. */\nexport const DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = new Set([\n 'uniswap-v4',\n 'gmx',\n 'hyperliquid',\n 'arcus',\n 'curve-dao',\n])\n\nexport function defiMultisignExpiryUnixSeconds(\n protocolId: string | undefined,\n explicitExpiryDate?: number | null,\n): number | undefined {\n if (typeof explicitExpiryDate === 'number' && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {\n return Math.floor(explicitExpiryDate)\n }\n if (protocolId && DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {\n return Math.floor(Date.now() / 1000) + DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS\n }\n return undefined\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { TypedDataDomain } from 'viem';
2
+ import { K as KeyGenSubset, M as MultisignBuildResult } from './types-PZrvtjv8.js';
3
+
4
+ declare const EIP712_SIGN_REQUEST_KIND: "eip712";
5
+ type Eip712TypedDataField = {
6
+ name: string;
7
+ type: string;
8
+ };
9
+ type Eip712TypedDataPayload = {
10
+ domain: TypedDataDomain;
11
+ types: Record<string, readonly Eip712TypedDataField[] | Eip712TypedDataField[]>;
12
+ primaryType: string;
13
+ message: Record<string, unknown>;
14
+ };
15
+ type Eip712MultisignDelivery = Record<string, unknown> & {
16
+ kind: string;
17
+ };
18
+ type BuildEip712MultisignBodyArgs = {
19
+ keyGen: KeyGenSubset;
20
+ purposeText: string;
21
+ purposeSuffix?: string;
22
+ /** Chain id stored on the sign request (protocol context; may differ from EIP-712 domain chainId). */
23
+ destinationChainID: string;
24
+ destinationAddress: string;
25
+ typedData: Eip712TypedDataPayload;
26
+ delivery: Eip712MultisignDelivery;
27
+ audit?: Record<string, unknown>;
28
+ expiryDate?: number;
29
+ };
30
+ /**
31
+ * Build an mpc-auth multiSignRequest body for a single-leg EIP-712 digest (no EVM tx broadcast).
32
+ * `msgHash` is the EIP-712 hash; `msgRaw` is UTF-8 hex JSON audit envelope (not RLP calldata).
33
+ */
34
+ declare function buildEip712MultisignBody(args: BuildEip712MultisignBodyArgs): MultisignBuildResult;
35
+
36
+ export { type BuildEip712MultisignBodyArgs as B, EIP712_SIGN_REQUEST_KIND as E, type Eip712MultisignDelivery as a, type Eip712TypedDataField as b, type Eip712TypedDataPayload as c, buildEip712MultisignBody as d };
package/dist/index.cjs CHANGED
@@ -219,6 +219,58 @@ function buildEip712MultisignBody(args) {
219
219
  ]
220
220
  });
221
221
  }
222
+ var PAYLOAD_SIGN_ED25519_REQUEST_KIND = "payload_sign_ed25519";
223
+ function msgHashNo0xFromBytes(bytes) {
224
+ return Buffer.from(bytes).toString("hex");
225
+ }
226
+ function payloadMsgRawHex(messageUtf8, delivery) {
227
+ const envelope = {
228
+ version: 1,
229
+ messageUtf8,
230
+ delivery
231
+ };
232
+ return viem.stringToHex(JSON.stringify(envelope));
233
+ }
234
+ function buildPayloadSignEd25519MultisignBody(args) {
235
+ const messageBytes = Buffer.from(args.messageUtf8, "utf8");
236
+ const msgHash = msgHashNo0xFromBytes(messageBytes);
237
+ const extraJSON = {
238
+ signRequestKind: PAYLOAD_SIGN_ED25519_REQUEST_KIND,
239
+ payloadSignEd25519: {
240
+ version: 1,
241
+ messageHex: msgHash,
242
+ messageLength: messageBytes.length
243
+ },
244
+ delivery: args.delivery
245
+ };
246
+ if (args.billingKeyGenPubKey?.trim()) {
247
+ extraJSON.billingKeyGenPubKey = args.billingKeyGenPubKey.trim();
248
+ }
249
+ return finalizeMultisign({
250
+ keyGen: args.keyGen,
251
+ purposeText: args.purposeText,
252
+ purposeSuffix: args.purposeSuffix,
253
+ destinationChainID: args.destinationChainID,
254
+ destinationAddress: args.destinationAddress,
255
+ extraJSON,
256
+ expiryDate: args.expiryDate,
257
+ legs: [
258
+ {
259
+ msgHash,
260
+ msgRaw: payloadMsgRawHex(args.messageUtf8, args.delivery),
261
+ destinationAddress: args.destinationAddress,
262
+ signatureText: args.signatureText ?? "Arcus Ed25519 payload sign",
263
+ audit: {
264
+ kind: "PAYLOAD_SIGN_ED25519",
265
+ deliveryKind: args.delivery.kind,
266
+ messageLength: messageBytes.length,
267
+ ...args.audit ?? {}
268
+ },
269
+ feeSnapshot: {}
270
+ }
271
+ ]
272
+ });
273
+ }
222
274
 
223
275
  // src/core/expiry.ts
224
276
  var DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60;
@@ -226,6 +278,7 @@ var DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
226
278
  "uniswap-v4",
227
279
  "gmx",
228
280
  "hyperliquid",
281
+ "arcus",
229
282
  "curve-dao"
230
283
  ]);
231
284
  function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
@@ -616,8 +669,18 @@ var UNIVERSAL_ROUTER_SPENDER = {
616
669
  143: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
617
670
  59144: "0x661e93cca42afacb172121ef892830ca3b70f08d",
618
671
  4217: "0x1febb76be10aaf3a1402f04e8e835f2c382f7914",
619
- 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff"
672
+ 196: "0x5507749f2c558bb3e162c6e90c314c092e7372ff",
673
+ /** Robinhood Chain mainnet — Universal Router v2.1.1 (Trade API / interface) */
674
+ 4663: "0x8876789976decbfcbbbe364623c63652db8c0904"
675
+ };
676
+ var UNIVERSAL_ROUTER_VERSION_BY_CHAIN = {
677
+ /** Robinhood has UR 2.1.1 only in the supported-chains table (no 2.0 Trade API column). */
678
+ 4663: "2.1.1"
620
679
  };
680
+ function getUniswapUniversalRouterVersion(chainId) {
681
+ const v = UNIVERSAL_ROUTER_VERSION_BY_CHAIN[chainId];
682
+ return typeof v === "string" && v.trim() ? v.trim() : UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT;
683
+ }
621
684
  function isUniswapV4ChainSupported(chainId) {
622
685
  if (chainId == null) return false;
623
686
  const n = parseEvmChainIdToNumber(chainId);
@@ -652,7 +715,9 @@ var POSITION_MANAGER_BY_CHAIN = {
652
715
  11155111: "0x4B2C77d209D3405F41a037Ec6c77F7F5b8e2ca80",
653
716
  130: "0x0d97dc33264bfc1c226207428a79b26757fb9dc3",
654
717
  1868: "0x0e2850543f69f678257266e0907ff9a58b3f13de",
655
- 59144: "0x661e93cca42afacb172121ef892830ca3b70f08d"
718
+ 59144: "0x661e93cca42afacb172121ef892830ca3b70f08d",
719
+ /** Robinhood Chain mainnet */
720
+ 4663: "0x58daec3116aae6D93017bAAea7749052E8a04fA7"
656
721
  };
657
722
  function getUniswapV4PositionManagerOrThrow(chainId) {
658
723
  const raw = POSITION_MANAGER_BY_CHAIN[chainId];
@@ -699,8 +764,8 @@ function parseUniswapChainId(value) {
699
764
  function trimAddr(a) {
700
765
  return a.trim();
701
766
  }
702
- function isUniswapTokenInAddressNative(tokenIn) {
703
- const t = (tokenIn ?? "").toString().trim();
767
+ function isUniswapNativeTokenAddress(token) {
768
+ const t = (token ?? "").toString().trim();
704
769
  if (!t) return false;
705
770
  try {
706
771
  return viem.getAddress(t) === viem.zeroAddress;
@@ -715,7 +780,16 @@ function isUniswapFullQuoteResponseNativeIn(stored) {
715
780
  const input = q.input;
716
781
  if (!input) return false;
717
782
  const raw = (input.address ?? input.token ?? "").toString().trim();
718
- return isUniswapTokenInAddressNative(raw);
783
+ return isUniswapNativeTokenAddress(raw);
784
+ }
785
+ function isUniswapFullQuoteResponseNativeOut(stored) {
786
+ if (!stored) return false;
787
+ const q = stored.quote;
788
+ if (!q || typeof q !== "object" || Array.isArray(q)) return false;
789
+ const output = q.output;
790
+ if (!output) return false;
791
+ const raw = (output.address ?? output.token ?? "").toString().trim();
792
+ return isUniswapNativeTokenAddress(raw);
719
793
  }
720
794
  async function fetchEthereumAddressForKeyGen(managementNodeUrl, keyGenId, readAuth = { bearerOnGet: true, jwt: null }, init) {
721
795
  const base = managementNodeUrl.trim().replace(/\/$/, "");
@@ -777,6 +851,31 @@ function buildUniswapQuoteRequestBody(args) {
777
851
  }
778
852
  return body;
779
853
  }
854
+ function resolveChainIdFromStoredUniswapQuote(stored) {
855
+ if (!stored) return 0;
856
+ const top = stored;
857
+ for (const key of ["tokenInChainId", "chainId"]) {
858
+ const raw = top[key];
859
+ if (raw != null && String(raw).trim() !== "") {
860
+ try {
861
+ return parseUniswapChainId(raw);
862
+ } catch {
863
+ }
864
+ }
865
+ }
866
+ const q = top.quote;
867
+ if (q && typeof q === "object" && !Array.isArray(q)) {
868
+ const input = q.input;
869
+ const chain = input?.chainId;
870
+ if (chain != null && String(chain).trim() !== "") {
871
+ try {
872
+ return parseUniswapChainId(chain);
873
+ } catch {
874
+ }
875
+ }
876
+ }
877
+ return 0;
878
+ }
780
879
  function errorMessageFromUniswapJsonBody(value) {
781
880
  if (value == null) return null;
782
881
  if (typeof value === "string") {
@@ -889,16 +988,18 @@ async function uniswapTradeQuote(args) {
889
988
  }
890
989
  const base = args.baseUrl && args.baseUrl.trim() ? args.baseUrl.trim().replace(/\/$/, "") : DEFAULT_TRADE_BASE;
891
990
  const quoteUrl = `${base}/quote`;
892
- const urv = args.universalRouterVersion && args.universalRouterVersion.trim() || "2.0";
991
+ const chainIdForRouter = parseUniswapChainId(resolveInputChainId(args));
992
+ const urv = args.universalRouterVersion && args.universalRouterVersion.trim() || getUniswapUniversalRouterVersion(chainIdForRouter);
893
993
  const body = buildUniswapQuoteRequestBody({ ...args, swapper });
894
- const nativeIn = isUniswapTokenInAddressNative(args.tokenIn);
994
+ const nativeIn = isUniswapNativeTokenAddress(args.tokenIn);
995
+ const nativeOut = isUniswapNativeTokenAddress(args.tokenOut);
895
996
  const headers = {
896
997
  ...UNISWAP_QUOTE_HEADERS_BASE,
897
998
  "x-api-key": apiKey,
898
999
  "x-universal-router-version": urv,
899
1000
  "x-permit2-disabled": args.permit2Disabled === true ? "true" : "false",
900
- /** Native (0x0) as token in: Trade API needs this for classic routes and payable /swap. */
901
- "x-erc20eth-enabled": nativeIn ? "true" : "false"
1001
+ /** Native (0x0) in or out: enables ERC20↔ETH routes (incl. UniswapX on Robinhood). */
1002
+ "x-erc20eth-enabled": nativeIn || nativeOut ? "true" : "false"
902
1003
  };
903
1004
  const fetchFn = args.fetchImpl ?? globalThis.fetch;
904
1005
  const res = await fetchFn(quoteUrl, {
@@ -909,7 +1010,11 @@ async function uniswapTradeQuote(args) {
909
1010
  });
910
1011
  const text = await res.text();
911
1012
  if (!res.ok) {
912
- throw new Error(messageFromUniswapHttpResponseBody(text, res.status, res.statusText));
1013
+ let msg = messageFromUniswapHttpResponseBody(text, res.status, res.statusText);
1014
+ if (res.status === 404 && chainIdForRouter === 4663) {
1015
+ msg += " On Robinhood Chain, confirm USDG is 0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168, use Native ETH or WETH (0x0Bd7\u2026) as output, and try at least ~$300 notional (UniswapX minimum).";
1016
+ }
1017
+ throw new Error(msg);
913
1018
  }
914
1019
  const forParse = text.replace(/^\uFEFF/, "");
915
1020
  try {
@@ -1016,16 +1121,17 @@ async function uniswapCreateSwap(args) {
1016
1121
  quote: classic,
1017
1122
  deadline
1018
1123
  };
1019
- const urv = (args.universalRouterVersion ?? UNISWAP_UNIVERSAL_ROUTER_VERSION_DEFAULT).trim() || "2.0";
1124
+ const urv = (args.universalRouterVersion ?? "").trim() || getUniswapUniversalRouterVersion(resolveChainIdFromStoredUniswapQuote(args.fullQuoteFromPermit));
1020
1125
  const fn = args.fetchImpl ?? globalThis.fetch;
1021
1126
  const nativeIn = isUniswapFullQuoteResponseNativeIn(args.fullQuoteFromPermit);
1127
+ const nativeOut = isUniswapFullQuoteResponseNativeOut(args.fullQuoteFromPermit);
1022
1128
  const res = await fn(url, {
1023
1129
  method: "POST",
1024
1130
  headers: {
1025
1131
  "Content-Type": "application/json",
1026
1132
  "x-api-key": args.uniswapApiKey.trim(),
1027
1133
  "x-universal-router-version": urv,
1028
- "x-erc20eth-enabled": nativeIn ? "true" : "false",
1134
+ "x-erc20eth-enabled": nativeIn || nativeOut ? "true" : "false",
1029
1135
  "x-permit2-disabled": "true"
1030
1136
  },
1031
1137
  body: JSON.stringify(body)
@@ -2225,6 +2331,270 @@ async function swapExactInput(args) {
2225
2331
  return swapFromQuote({ ...args, swap });
2226
2332
  }
2227
2333
 
2334
+ // src/protocols/evm/uniswap-v4/limitOrder.ts
2335
+ function trimAddr3(a) {
2336
+ return a.trim();
2337
+ }
2338
+ var UNISWAP_LIMIT_ORDER_CHAIN_ID = 1;
2339
+ var DEFAULT_UNISWAPX_ORDER_BASE = "https://api.uniswap.org/v2";
2340
+ var DEFAULT_LIMIT_ORDER_QUOTE_PATH = "/limit_order_quote";
2341
+ var UNISWAP_QUOTE_HEADERS_BASE2 = {
2342
+ "Content-Type": "application/json",
2343
+ "User-Agent": "ctm-mpc-defi uniswapLimitOrderQuote/1.0 (TS)"
2344
+ };
2345
+ function isUniswapLimitOrderChainSupported(chainId) {
2346
+ return parseUniswapChainId(chainId) === UNISWAP_LIMIT_ORDER_CHAIN_ID;
2347
+ }
2348
+ function assertUniswapLimitOrderChain(chainId) {
2349
+ if (!isUniswapLimitOrderChainSupported(chainId)) {
2350
+ throw new Error(
2351
+ `UniswapX limit orders are only supported on Ethereum mainnet (chainId ${UNISWAP_LIMIT_ORDER_CHAIN_ID}). Got ${chainId}. Use market swap on this chain or wait for UniswapX limit support.`
2352
+ );
2353
+ }
2354
+ }
2355
+ function inferPrimaryTypeFromPermitTypes(types) {
2356
+ for (const key of Object.keys(types)) {
2357
+ if (key !== "EIP712Domain") {
2358
+ return key;
2359
+ }
2360
+ }
2361
+ throw new Error("permitData.types missing primaryType (no non-EIP712Domain entry)");
2362
+ }
2363
+ function permitDataToEip712Payload(permitData) {
2364
+ const domain = permitData.domain;
2365
+ const types = permitData.types;
2366
+ const message = permitData.values ?? permitData.message;
2367
+ if (domain == null || typeof domain !== "object" || Array.isArray(domain)) {
2368
+ throw new Error("limit order quote: permitData.domain missing");
2369
+ }
2370
+ if (types == null || typeof types !== "object" || Array.isArray(types)) {
2371
+ throw new Error("limit order quote: permitData.types missing");
2372
+ }
2373
+ if (message == null || typeof message !== "object" || Array.isArray(message)) {
2374
+ throw new Error("limit order quote: permitData.values (message) missing");
2375
+ }
2376
+ const primaryType = typeof permitData.primaryType === "string" && permitData.primaryType.trim() ? permitData.primaryType.trim() : inferPrimaryTypeFromPermitTypes(
2377
+ types
2378
+ );
2379
+ return {
2380
+ domain,
2381
+ types,
2382
+ primaryType,
2383
+ message
2384
+ };
2385
+ }
2386
+ function extractPermitDataFromLimitQuote(quoteResponse) {
2387
+ const permitData = quoteResponse.permitData;
2388
+ if (permitData == null) return null;
2389
+ if (typeof permitData !== "object" || Array.isArray(permitData)) {
2390
+ throw new Error("limit order quote: permitData is not an object");
2391
+ }
2392
+ return permitData;
2393
+ }
2394
+ function buildLimitOrderQuoteRequestBody(args) {
2395
+ const base = buildUniswapQuoteRequestBody({
2396
+ type: args.type,
2397
+ amount: args.amount,
2398
+ tokenIn: args.tokenIn,
2399
+ tokenOut: args.tokenOut,
2400
+ chainId: args.chainId,
2401
+ tokenInChainId: args.tokenInChainId,
2402
+ tokenOutChainId: args.tokenOutChainId,
2403
+ swapper: args.swapper
2404
+ });
2405
+ assertUniswapLimitOrderChain(base.tokenInChainId);
2406
+ return {
2407
+ ...base,
2408
+ limitPrice: String(args.limitPrice).trim(),
2409
+ orderDeadline: args.orderDeadline
2410
+ };
2411
+ }
2412
+ async function uniswapLimitOrderQuote(args) {
2413
+ const apiKey = (args.uniswapApiKey || "").trim();
2414
+ if (!apiKey) {
2415
+ throw new Error("uniswapApiKey (x-api-key) is required");
2416
+ }
2417
+ let swapper;
2418
+ if ((args.swapper || "").trim()) {
2419
+ swapper = trimAddr3(args.swapper);
2420
+ } else {
2421
+ const keyGen = (args.keyGen || "").trim();
2422
+ if (!keyGen) {
2423
+ throw new Error("keyGen is required when swapper is not provided");
2424
+ }
2425
+ const mpc = (args.managementNodeUrl || "").trim();
2426
+ if (!mpc) {
2427
+ throw new Error("managementNodeUrl is required when swapper is not provided (to resolve keyGen)");
2428
+ }
2429
+ swapper = await fetchEthereumAddressForKeyGen(
2430
+ mpc,
2431
+ keyGen,
2432
+ args.nodeReadAuth ?? { bearerOnGet: true, jwt: null }
2433
+ );
2434
+ }
2435
+ const chainIdForGuard = parseUniswapChainId(resolveInputChainId(args));
2436
+ assertUniswapLimitOrderChain(chainIdForGuard);
2437
+ const base = args.baseUrl && args.baseUrl.trim() ? args.baseUrl.trim().replace(/\/$/, "") : "https://trade-api.gateway.uniswap.org/v1";
2438
+ const quoteUrl = `${base}${DEFAULT_LIMIT_ORDER_QUOTE_PATH}`;
2439
+ const body = buildLimitOrderQuoteRequestBody({ ...args, swapper });
2440
+ const headers = {
2441
+ ...UNISWAP_QUOTE_HEADERS_BASE2,
2442
+ "x-api-key": apiKey
2443
+ };
2444
+ const fetchFn = args.fetchImpl ?? globalThis.fetch;
2445
+ const res = await fetchFn(quoteUrl, {
2446
+ method: "POST",
2447
+ headers,
2448
+ body: JSON.stringify(body),
2449
+ signal: args.signal
2450
+ });
2451
+ const text = await res.text();
2452
+ if (!res.ok) {
2453
+ throw new Error(messageFromUniswapHttpResponseBody(text, res.status, res.statusText));
2454
+ }
2455
+ const forParse = text.replace(/^\uFEFF/, "");
2456
+ try {
2457
+ return JSON.parse(forParse);
2458
+ } catch {
2459
+ throw new Error(
2460
+ `Limit order quote: ${messageFromUniswapHttpResponseBody(text, res.status, res.statusText)}`
2461
+ );
2462
+ }
2463
+ }
2464
+ function buildUniswapXLimitOrderSubmitBody(args) {
2465
+ const quote = args.quoteResponse.quote;
2466
+ if (quote == null || typeof quote !== "object" || Array.isArray(quote)) {
2467
+ throw new Error("limit order submit: quoteResponse.quote missing");
2468
+ }
2469
+ const routing = typeof args.quoteResponse.routing === "string" && args.quoteResponse.routing.trim() ? args.quoteResponse.routing.trim() : "LIMIT_ORDER";
2470
+ const chainId = args.quoteResponse.chainId ?? quote.chainId ?? UNISWAP_LIMIT_ORDER_CHAIN_ID;
2471
+ const quoteId = typeof args.quoteResponse.quoteId === "string" ? args.quoteResponse.quoteId : void 0;
2472
+ const requestId = typeof args.quoteResponse.requestId === "string" ? args.quoteResponse.requestId : void 0;
2473
+ return {
2474
+ signature: args.signatureHex.startsWith("0x") ? args.signatureHex : `0x${args.signatureHex}`,
2475
+ quote,
2476
+ chainId: parseUniswapChainId(chainId),
2477
+ orderType: "Limit",
2478
+ routing,
2479
+ ...quoteId ? { quoteId } : {},
2480
+ ...requestId ? { requestId } : {}
2481
+ };
2482
+ }
2483
+ async function fetchUniswapXLimitOrders(args) {
2484
+ const chainId = args.chainId ?? UNISWAP_LIMIT_ORDER_CHAIN_ID;
2485
+ assertUniswapLimitOrderChain(chainId);
2486
+ const base = args.baseUrl && args.baseUrl.trim() ? args.baseUrl.trim().replace(/\/$/, "") : DEFAULT_UNISWAPX_ORDER_BASE;
2487
+ const params = new URLSearchParams({
2488
+ chainId: String(chainId),
2489
+ swapper: trimAddr3(args.swapper)
2490
+ });
2491
+ if (args.limit != null && args.limit > 0) {
2492
+ params.set("limit", String(Math.floor(args.limit)));
2493
+ }
2494
+ const url = `${base}/limit-orders?${params.toString()}`;
2495
+ const headers = {
2496
+ Accept: "application/json",
2497
+ "User-Agent": "ctm-mpc-defi uniswapLimitOrdersList/1.0 (TS)"
2498
+ };
2499
+ const apiKey = (args.uniswapApiKey || "").trim();
2500
+ if (apiKey) {
2501
+ headers["x-api-key"] = apiKey;
2502
+ }
2503
+ const fetchFn = args.fetchImpl ?? globalThis.fetch;
2504
+ const res = await fetchFn(url, { method: "GET", headers });
2505
+ const text = await res.text();
2506
+ if (!res.ok) {
2507
+ const parsed = (() => {
2508
+ try {
2509
+ return JSON.parse(text);
2510
+ } catch {
2511
+ return null;
2512
+ }
2513
+ })();
2514
+ const msg = errorMessageFromUniswapJsonBody(parsed) ?? (text.trim() || res.statusText);
2515
+ throw new Error(`List limit orders HTTP ${res.status}: ${msg}`);
2516
+ }
2517
+ return JSON.parse(text.replace(/^\uFEFF/, ""));
2518
+ }
2519
+ async function uniswapFetchLimitOrdersMcp(args) {
2520
+ let swapper;
2521
+ if ((args.swapper || "").trim()) {
2522
+ swapper = trimAddr3(args.swapper);
2523
+ } else {
2524
+ const keyGen = (args.keyGen || "").trim();
2525
+ if (!keyGen) {
2526
+ throw new Error("swapper or keyGen is required");
2527
+ }
2528
+ const mpc = (args.managementNodeUrl || "").trim();
2529
+ if (!mpc) {
2530
+ throw new Error("managementNodeUrl is required when swapper is not provided");
2531
+ }
2532
+ swapper = await fetchEthereumAddressForKeyGen(
2533
+ mpc,
2534
+ keyGen,
2535
+ args.nodeReadAuth ?? { bearerOnGet: true, jwt: null }
2536
+ );
2537
+ }
2538
+ return fetchUniswapXLimitOrders({
2539
+ swapper,
2540
+ chainId: args.chainId,
2541
+ uniswapApiKey: args.uniswapApiKey,
2542
+ limit: args.limit,
2543
+ baseUrl: args.baseUrl,
2544
+ fetchImpl: args.fetchImpl
2545
+ });
2546
+ }
2547
+ async function buildEvmMultisignBodyUniswapV4LimitOrderBatch(args) {
2548
+ assertUniswapLimitOrderChain(args.chainId);
2549
+ const permitRaw = extractPermitDataFromLimitQuote(args.fullLimitQuote);
2550
+ if (!permitRaw) {
2551
+ throw new Error(
2552
+ "Limit order quote has no permitData \u2014 cannot build EIP-712 sign request. Re-quote or confirm mainnet limit order support for this pair."
2553
+ );
2554
+ }
2555
+ const typedData = permitDataToEip712Payload(permitRaw);
2556
+ const submitTemplate = buildUniswapXLimitOrderSubmitBody({
2557
+ quoteResponse: args.fullLimitQuote,
2558
+ signatureHex: "0x"
2559
+ });
2560
+ return buildEip712MultisignBody({
2561
+ keyGen: args.keyGen,
2562
+ purposeText: args.purposeText,
2563
+ destinationChainID: String(UNISWAP_LIMIT_ORDER_CHAIN_ID),
2564
+ destinationAddress: PERMIT2_ADDRESS,
2565
+ typedData,
2566
+ delivery: {
2567
+ kind: "uniswapx_limit_order",
2568
+ chainId: UNISWAP_LIMIT_ORDER_CHAIN_ID,
2569
+ swapper: viem.getAddress(args.swapper),
2570
+ submitBodyTemplate: submitTemplate,
2571
+ quoteResponse: args.fullLimitQuote,
2572
+ uniswapApiKey: args.uniswapApiKey,
2573
+ tradeApiBaseUrl: args.tradeApiBaseUrl ?? "https://trade-api.gateway.uniswap.org/v1"
2574
+ },
2575
+ audit: {
2576
+ protocol: "uniswap-v4",
2577
+ action: "limitOrder",
2578
+ routing: args.fullLimitQuote.routing ?? "LIMIT_ORDER",
2579
+ orderType: "Limit",
2580
+ primaryType: typedData.primaryType
2581
+ },
2582
+ expiryDate: args.expiryDate
2583
+ });
2584
+ }
2585
+ async function buildEvmMultisignBodyUniswapV4LimitOrderBatchFromMcp(args) {
2586
+ return buildEvmMultisignBodyUniswapV4LimitOrderBatch({
2587
+ keyGen: args.keyGen,
2588
+ chainId: args.chainId,
2589
+ purposeText: args.purposeText,
2590
+ fullLimitQuote: args.fullLimitQuote,
2591
+ swapper: viem.getAddress(args.executorAddress),
2592
+ uniswapApiKey: args.uniswapApiKey,
2593
+ tradeApiBaseUrl: args.tradeApiBaseUrl,
2594
+ expiryDate: args.expiryDate
2595
+ });
2596
+ }
2597
+
2228
2598
  // src/protocols/evm/uniswap-v4/index.ts
2229
2599
  var UNISWAP_V4_PROTOCOL_ID = "uniswap-v4";
2230
2600
  var uniswapV4ProtocolModule = {
@@ -2271,6 +2641,17 @@ var uniswapV4ProtocolModule = {
2271
2641
  type: { type: "EXACT_INPUT | EXACT_OUTPUT", required: true, description: "Trade type" }
2272
2642
  }
2273
2643
  },
2644
+ {
2645
+ id: "uniswap-v4.limit-order",
2646
+ protocolId: UNISWAP_V4_PROTOCOL_ID,
2647
+ chainCategory: "evm",
2648
+ description: "Place UniswapX limit order via EIP-712 sign + POST /order (Ethereum mainnet only)",
2649
+ commonParams: ["keyGen", "purposeText"],
2650
+ params: {
2651
+ fullLimitQuote: { type: "object", required: true, description: "Full limit order quote from Trade API" },
2652
+ uniswapApiKey: { type: "string", required: true, description: "Uniswap Trade API key" }
2653
+ }
2654
+ },
2274
2655
  {
2275
2656
  id: "uniswap-v4.mint-liquidity",
2276
2657
  protocolId: UNISWAP_V4_PROTOCOL_ID,
@@ -2326,6 +2707,10 @@ var uniswapV4 = {
2326
2707
  swapExactInput,
2327
2708
  swapFromQuote,
2328
2709
  buildSwapMultisignBody: buildEvmMultisignBodyUniswapV4SkipPermit2Batch,
2710
+ limitOrderQuote: uniswapLimitOrderQuote,
2711
+ buildLimitOrderMultisignBody: buildEvmMultisignBodyUniswapV4LimitOrderBatchFromMcp,
2712
+ fetchLimitOrders: fetchUniswapXLimitOrders,
2713
+ fetchLimitOrdersMcp: uniswapFetchLimitOrdersMcp,
2329
2714
  quote: uniswapTradeQuote,
2330
2715
  createLiquidityPosition: uniswapLpCreatePosition,
2331
2716
  increaseLiquidityPosition: uniswapLpIncreasePosition,
@@ -2715,11 +3100,13 @@ exports.DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = DEFAULT_DEFI_MULTISIGN_EXPIRY_SE
2715
3100
  exports.DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = DEFI_PROTOCOLS_WITH_30MIN_EXPIRY;
2716
3101
  exports.EIP712_SIGN_REQUEST_KIND = EIP712_SIGN_REQUEST_KIND;
2717
3102
  exports.NEAR_CHAIN_CATEGORY = NEAR_CHAIN_CATEGORY;
3103
+ exports.PAYLOAD_SIGN_ED25519_REQUEST_KIND = PAYLOAD_SIGN_ED25519_REQUEST_KIND;
2718
3104
  exports.SOLANA_CHAIN_CATEGORY = SOLANA_CHAIN_CATEGORY;
2719
3105
  exports.approveStepsToEvmTxSteps = approveStepsToEvmTxSteps;
2720
3106
  exports.buildConditionalErc20ApproveSteps = buildConditionalErc20ApproveSteps;
2721
3107
  exports.buildEip712MultisignBody = buildEip712MultisignBody;
2722
3108
  exports.buildEvmMultisignBatch = buildEvmMultisignBatch;
3109
+ exports.buildPayloadSignEd25519MultisignBody = buildPayloadSignEd25519MultisignBody;
2723
3110
  exports.coingeckoPlatformForChainId = coingeckoPlatformForChainId;
2724
3111
  exports.coreChainCategoryModule = coreChainCategoryModule;
2725
3112
  exports.curveDao = curveDao;