@continuumdao/ctm-mpc-defi 0.2.34 → 0.2.36
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.
- package/dist/agent/catalog.cjs +1562 -45
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.ts +5995 -2960
- package/dist/agent/catalog.js +1502 -46
- package/dist/agent/catalog.js.map +1 -1
- package/dist/agent/skills/aave-v4/SKILL.md +19 -4
- package/dist/agent/skills/aerodrome/SKILL.md +2 -2
- package/dist/agent/skills/compound-v3/SKILL.md +2 -2
- package/dist/agent/skills/curve-dao/SKILL.md +14 -0
- package/dist/agent/skills/ethena/SKILL.md +3 -1
- package/dist/agent/skills/euler-v2/SKILL.md +1 -1
- package/dist/agent/skills/gmx/SKILL.md +1 -1
- package/dist/agent/skills/hyperliquid/SKILL.md +7 -5
- package/dist/agent/skills/lido/SKILL.md +3 -0
- package/dist/agent/skills/maple-syrup/SKILL.md +35 -3
- package/dist/agent/skills/morpho/SKILL.md +1 -1
- package/dist/agent/skills/pendle/SKILL.md +63 -0
- package/dist/agent/skills/sky/SKILL.md +2 -0
- package/dist/agent/skills/yield-compare/SKILL.md +81 -0
- package/dist/core/index.cjs +2 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +257 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +257 -28
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +170 -0
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -1
- package/dist/protocols/evm/aave-v4/index.d.ts +59 -1
- package/dist/protocols/evm/aave-v4/index.js +164 -1
- package/dist/protocols/evm/aave-v4/index.js.map +1 -1
- package/dist/protocols/evm/aerodrome/index.cjs +1308 -901
- package/dist/protocols/evm/aerodrome/index.cjs.map +1 -1
- package/dist/protocols/evm/aerodrome/index.d.ts +69 -2
- package/dist/protocols/evm/aerodrome/index.js +1217 -807
- package/dist/protocols/evm/aerodrome/index.js.map +1 -1
- package/dist/protocols/evm/compound-v3/index.cjs +82 -6
- package/dist/protocols/evm/compound-v3/index.cjs.map +1 -1
- package/dist/protocols/evm/compound-v3/index.d.ts +89 -1
- package/dist/protocols/evm/compound-v3/index.js +80 -7
- package/dist/protocols/evm/compound-v3/index.js.map +1 -1
- package/dist/protocols/evm/curve-dao/index.cjs +447 -18
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -1
- package/dist/protocols/evm/curve-dao/index.d.ts +108 -1
- package/dist/protocols/evm/curve-dao/index.js +440 -19
- package/dist/protocols/evm/curve-dao/index.js.map +1 -1
- package/dist/protocols/evm/ethena/index.cjs +89 -0
- package/dist/protocols/evm/ethena/index.cjs.map +1 -1
- package/dist/protocols/evm/ethena/index.d.ts +17 -1
- package/dist/protocols/evm/ethena/index.js +89 -2
- package/dist/protocols/evm/ethena/index.js.map +1 -1
- package/dist/protocols/evm/euler-v2/index.cjs +29 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -1
- package/dist/protocols/evm/euler-v2/index.d.ts +21 -1
- package/dist/protocols/evm/euler-v2/index.js +29 -1
- package/dist/protocols/evm/euler-v2/index.js.map +1 -1
- package/dist/protocols/evm/gmx/index.cjs +83 -1
- package/dist/protocols/evm/gmx/index.cjs.map +1 -1
- package/dist/protocols/evm/gmx/index.d.ts +22 -2
- package/dist/protocols/evm/gmx/index.js +80 -2
- package/dist/protocols/evm/gmx/index.js.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.cjs +67 -11
- package/dist/protocols/evm/hyperliquid/index.cjs.map +1 -1
- package/dist/protocols/evm/hyperliquid/index.d.ts +39 -2
- package/dist/protocols/evm/hyperliquid/index.js +64 -12
- package/dist/protocols/evm/hyperliquid/index.js.map +1 -1
- package/dist/protocols/evm/lido/index.cjs +13 -0
- package/dist/protocols/evm/lido/index.cjs.map +1 -1
- package/dist/protocols/evm/lido/index.d.ts +9 -1
- package/dist/protocols/evm/lido/index.js +13 -1
- package/dist/protocols/evm/lido/index.js.map +1 -1
- package/dist/protocols/evm/maple/index.cjs +129 -1
- package/dist/protocols/evm/maple/index.cjs.map +1 -1
- package/dist/protocols/evm/maple/index.d.ts +45 -1
- package/dist/protocols/evm/maple/index.js +124 -3
- package/dist/protocols/evm/maple/index.js.map +1 -1
- package/dist/protocols/evm/morpho/index.cjs +34 -7
- package/dist/protocols/evm/morpho/index.cjs.map +1 -1
- package/dist/protocols/evm/morpho/index.d.ts +23 -1
- package/dist/protocols/evm/morpho/index.js +34 -8
- package/dist/protocols/evm/morpho/index.js.map +1 -1
- package/dist/protocols/evm/pendle/index.cjs +1530 -0
- package/dist/protocols/evm/pendle/index.cjs.map +1 -0
- package/dist/protocols/evm/pendle/index.d.ts +463 -0
- package/dist/protocols/evm/pendle/index.js +1463 -0
- package/dist/protocols/evm/pendle/index.js.map +1 -0
- package/dist/protocols/evm/sky/index.cjs +52 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -1
- package/dist/protocols/evm/sky/index.d.ts +16 -1
- package/dist/protocols/evm/sky/index.js +50 -1
- package/dist/protocols/evm/sky/index.js.map +1 -1
- package/package.json +6 -1
package/dist/core/index.js.map
CHANGED
|
@@ -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/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;AACp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AA,CAAI;AAAA,EACtD,YAAA;AAAA,EACA,KAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;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\n/** Browser → Next.js base path for Euler V3 REST (`/v3/evk/vaults`, …). */\nlet eulerV3ApiProxyBase: string | undefined\n\nexport function setEulerV3ApiProxyBase(url: string | undefined): void {\n eulerV3ApiProxyBase = url?.trim().replace(/\\/$/, '') || undefined\n}\n\nexport function getEulerV3ApiProxyBase(): string | undefined {\n return eulerV3ApiProxyBase\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\n/** Browser → Next.js base path for Morpho Midnight REST (replaces api.morpho.org/v0/midnight). */\nlet morphoMidnightRestProxyUrl: string | undefined\n\nexport function setMorphoMidnightRestProxyUrl(url: string | undefined): void {\n morphoMidnightRestProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoMidnightRestProxyUrl(): string | undefined {\n return morphoMidnightRestProxyUrl\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\nexport async function getJsonViaOptionalProxy<T>(args: {\n directUrl: string\n /** When set, GET this URL instead of directUrl (same path semantics as caller built). */\n proxyUrl?: string\n}): Promise<T> {\n const url = args.proxyUrl?.trim() || args.directUrl\n const r = await fetch(url, { method: 'GET', headers: { accept: 'application/json' } })\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 BuildEip712MultisignLeg = {\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n}\n\nexport type BuildEip712MultisignArgs = {\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 legs: readonly BuildEip712MultisignLeg[]\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 eip712LegEnvelope(\n typedData: Eip712TypedDataPayload,\n delivery: Eip712MultisignDelivery,\n digest: `0x${string}`,\n): Record<string, unknown> {\n return {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n delivery,\n }\n}\n\nfunction eip712MsgRawHex(envelope: Record<string, unknown>): string {\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).\n * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.\n */\nexport function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult {\n if (args.legs.length < 1) {\n throw new Error('buildEip712Multisign requires at least one leg')\n }\n\n const eip712: Record<string, unknown>[] = []\n const legs = args.legs.map((leg) => {\n const digest = hashTypedData({\n domain: leg.typedData.domain,\n types: leg.typedData.types,\n primaryType: leg.typedData.primaryType,\n message: leg.typedData.message,\n })\n const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest)\n eip712.push(envelope)\n return {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(envelope),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: leg.typedData.primaryType,\n deliveryKind: leg.delivery.kind,\n ...(leg.audit ?? {}),\n },\n feeSnapshot: {},\n }\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 signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712,\n },\n expiryDate: args.expiryDate,\n legs,\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 'aerodrome',\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,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A,OAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;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\n/** Browser → Next.js base path for Euler V3 REST (`/v3/evk/vaults`, …). */\nlet eulerV3ApiProxyBase: string | undefined\n\nexport function setEulerV3ApiProxyBase(url: string | undefined): void {\n eulerV3ApiProxyBase = url?.trim().replace(/\\/$/, '') || undefined\n}\n\nexport function getEulerV3ApiProxyBase(): string | undefined {\n return eulerV3ApiProxyBase\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\n/** Browser → Next.js base path for Morpho Midnight REST (replaces api.morpho.org/v0/midnight). */\nlet morphoMidnightRestProxyUrl: string | undefined\n\nexport function setMorphoMidnightRestProxyUrl(url: string | undefined): void {\n morphoMidnightRestProxyUrl = url?.trim() || undefined\n}\n\nexport function getMorphoMidnightRestProxyUrl(): string | undefined {\n return morphoMidnightRestProxyUrl\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\nexport async function getJsonViaOptionalProxy<T>(args: {\n directUrl: string\n /** When set, GET this URL instead of directUrl (same path semantics as caller built). */\n proxyUrl?: string\n}): Promise<T> {\n const url = args.proxyUrl?.trim() || args.directUrl\n const r = await fetch(url, { method: 'GET', headers: { accept: 'application/json' } })\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 BuildEip712MultisignLeg = {\n typedData: Eip712TypedDataPayload\n delivery: Eip712MultisignDelivery\n audit?: Record<string, unknown>\n}\n\nexport type BuildEip712MultisignArgs = {\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 legs: readonly BuildEip712MultisignLeg[]\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 eip712LegEnvelope(\n typedData: Eip712TypedDataPayload,\n delivery: Eip712MultisignDelivery,\n digest: `0x${string}`,\n): Record<string, unknown> {\n return {\n version: 1,\n digest,\n domain: typedData.domain,\n types: typedData.types,\n primaryType: typedData.primaryType,\n message: typedData.message,\n delivery,\n }\n}\n\nfunction eip712MsgRawHex(envelope: Record<string, unknown>): string {\n return stringToHex(jsonStringifyForAudit(envelope))\n}\n\n/**\n * Build an mpc-auth multiSignRequest body for one or more EIP-712 digests (no EVM tx broadcast).\n * `extraJSON.eip712` is always an array. N=1 uses `msgHash`/`msgRaw`; N>=2 uses `messageHashes`/`messageRawBatch`.\n */\nexport function buildEip712Multisign(args: BuildEip712MultisignArgs): MultisignBuildResult {\n if (args.legs.length < 1) {\n throw new Error('buildEip712Multisign requires at least one leg')\n }\n\n const eip712: Record<string, unknown>[] = []\n const legs = args.legs.map((leg) => {\n const digest = hashTypedData({\n domain: leg.typedData.domain,\n types: leg.typedData.types,\n primaryType: leg.typedData.primaryType,\n message: leg.typedData.message,\n })\n const envelope = eip712LegEnvelope(leg.typedData, leg.delivery, digest)\n eip712.push(envelope)\n return {\n msgHash: msgHashNo0x(digest),\n msgRaw: eip712MsgRawHex(envelope),\n destinationAddress: args.destinationAddress,\n signatureText: eip712SignatureText(leg.typedData.domain, leg.typedData.primaryType),\n audit: {\n kind: 'EIP712',\n primaryType: leg.typedData.primaryType,\n deliveryKind: leg.delivery.kind,\n ...(leg.audit ?? {}),\n },\n feeSnapshot: {},\n }\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 signRequestKind: EIP712_SIGN_REQUEST_KIND,\n eip712,\n },\n expiryDate: args.expiryDate,\n legs,\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 'aerodrome',\n 'pendle',\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"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,113 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var continuumNodeSdk = require('@continuumdao/continuum-node-sdk');
|
|
4
3
|
var viem = require('viem');
|
|
4
|
+
var continuumNodeSdk = require('@continuumdao/continuum-node-sdk');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __esm = (fn, res) => function __init() {
|
|
8
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/core/expiry.ts
|
|
12
|
+
function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
|
|
13
|
+
if (typeof explicitExpiryDate === "number" && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {
|
|
14
|
+
return Math.floor(explicitExpiryDate);
|
|
15
|
+
}
|
|
16
|
+
if (protocolId && exports.DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {
|
|
17
|
+
return Math.floor(Date.now() / 1e3) + exports.DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS;
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
exports.DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = void 0; exports.DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = void 0;
|
|
22
|
+
var init_expiry = __esm({
|
|
23
|
+
"src/core/expiry.ts"() {
|
|
24
|
+
exports.DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = 30 * 60;
|
|
25
|
+
exports.DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
|
|
26
|
+
"uniswap-v4",
|
|
27
|
+
"gmx",
|
|
28
|
+
"hyperliquid",
|
|
29
|
+
"arcus",
|
|
30
|
+
"curve-dao",
|
|
31
|
+
"aerodrome",
|
|
32
|
+
"pendle"
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
function isAerodromeChainSupported(chainId) {
|
|
37
|
+
const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
|
|
38
|
+
return n === AERODROME_CHAIN_ID;
|
|
39
|
+
}
|
|
40
|
+
var AERODROME_PROTOCOL_ID, AERODROME_CHAIN_ID, AERODROME_WETH_BASE, AERODROME_USDC_BASE;
|
|
41
|
+
var init_support = __esm({
|
|
42
|
+
"src/protocols/evm/aerodrome/support.ts"() {
|
|
43
|
+
AERODROME_PROTOCOL_ID = "aerodrome";
|
|
44
|
+
AERODROME_CHAIN_ID = 8453;
|
|
45
|
+
AERODROME_WETH_BASE = "0x4200000000000000000000000000000000000006";
|
|
46
|
+
AERODROME_USDC_BASE = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var AERODROME_BASE_ADDRESSES_FALLBACK;
|
|
50
|
+
var init_addresses = __esm({
|
|
51
|
+
"src/protocols/evm/aerodrome/addresses.ts"() {
|
|
52
|
+
init_support();
|
|
53
|
+
AERODROME_BASE_ADDRESSES_FALLBACK = {
|
|
54
|
+
chainId: AERODROME_CHAIN_ID,
|
|
55
|
+
aero: "0x940181a94A35A4569E4529A3CDfB74e38FD98631",
|
|
56
|
+
router: "0xcF77a3Ba9A5CA399B7c97c74d54e5b1Beb874E43",
|
|
57
|
+
poolFactory: "0x420DD381b31aEf6683db6B902084cB0FFECe40Da",
|
|
58
|
+
factoryRegistry: "0x5C3F18F06CC09CA1910767A34a20F771039E37C0",
|
|
59
|
+
voter: "0x16613524e02ad97eDfeF371bC883F2F5d6C480A5",
|
|
60
|
+
votingEscrow: "0xeBf418Fe2512e7E6bd9b87a8F0f294aCDC67e6B4",
|
|
61
|
+
rewardsDistributor: "0x227f65131A261548b057215bB1D5Ab2997964C7d",
|
|
62
|
+
mixedQuoter: "0x0A5aA5D3a4d28014f967Bf0f29EAA3FF9807D5c6",
|
|
63
|
+
/** MixedRouteQuoterV3 — v2 + all three CL factories (bitmask path encoding). */
|
|
64
|
+
mixedQuoterV3: "0xCd2A7D98e82D6107eac1828ce8DeAA6acB65b555",
|
|
65
|
+
nfpm: "0x827922686190790b37229fd06084350E74485b72",
|
|
66
|
+
/** Oldest Slipstream CL factory (Gauges V1). Path bit 1<<20. */
|
|
67
|
+
clFactory: "0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A",
|
|
68
|
+
/** Slipstream CL factory 2 (gauge caps). Raw tickSpacing in MixedQuoterV3. */
|
|
69
|
+
clFactory2: "0xaDe65c38CD4849aDBA595a4323a8C7DdfE89716a",
|
|
70
|
+
/** Newest Slipstream CL factory (Gauges V3) — Coinbase B20 stock pools. Path bit 1<<19. */
|
|
71
|
+
clFactory3: "0xf8f2eB4940CFE7d13603DDDD87f123820Fc061Ef",
|
|
72
|
+
universalRouter: "0x6Cb442acF35158D5eDa88fe602221b67B400Be3E",
|
|
73
|
+
swapRouter: "0xBE6D8f0d05cC4be24d5167a3eF062215bE6D18a5",
|
|
74
|
+
swapRouter2: "0xcbBb8035cAc7D4B3Ca7aBb74cF7BdF900215Ce0D",
|
|
75
|
+
swapRouter3: "0x698Cb2b6dd822994581fEa6eA4Fc755d1363A92F",
|
|
76
|
+
pricesOracle: "0xee717411f6E44F9feE011835C8E6FAaC5dEfF166",
|
|
77
|
+
slipstreamHelper: "0x0AD09A66af0154a84e86F761313d02d0abB6edd5",
|
|
78
|
+
lpSugar: "0x69dD9db6d8f8E7d83887A704f447b1a584b599A1",
|
|
79
|
+
sugarSlipstreamHelper: "0x9c62ab10577fB3C20A22E231b7703Ed6D456CC7a",
|
|
80
|
+
swapper: "0x91616a7B9CF6D23f8C17845581051EBdC4BcB916",
|
|
81
|
+
weth: AERODROME_WETH_BASE
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
var init_stockTokens = __esm({
|
|
86
|
+
"src/protocols/evm/aerodrome/stockTokens.ts"() {
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
var init_discover = __esm({
|
|
90
|
+
"src/protocols/evm/aerodrome/discover.ts"() {
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var init_yields = __esm({
|
|
94
|
+
"src/protocols/evm/aerodrome/yields.ts"() {
|
|
95
|
+
init_addresses();
|
|
96
|
+
init_support();
|
|
97
|
+
new Set(
|
|
98
|
+
[
|
|
99
|
+
AERODROME_WETH_BASE,
|
|
100
|
+
AERODROME_USDC_BASE,
|
|
101
|
+
AERODROME_BASE_ADDRESSES_FALLBACK.aero,
|
|
102
|
+
"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
|
|
103
|
+
"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2",
|
|
104
|
+
"0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
|
|
105
|
+
"0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
|
|
106
|
+
"0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452"
|
|
107
|
+
].map((a) => a.toLowerCase())
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
7
111
|
|
|
8
112
|
// src/core/purpose.ts
|
|
9
113
|
function mergePurposeText(purposeText, purposeSuffix) {
|
|
@@ -298,25 +402,8 @@ function buildPayloadSignEd25519MultisignBody(args) {
|
|
|
298
402
|
});
|
|
299
403
|
}
|
|
300
404
|
|
|
301
|
-
// src/core/
|
|
302
|
-
|
|
303
|
-
var DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = /* @__PURE__ */ new Set([
|
|
304
|
-
"uniswap-v4",
|
|
305
|
-
"gmx",
|
|
306
|
-
"hyperliquid",
|
|
307
|
-
"arcus",
|
|
308
|
-
"curve-dao",
|
|
309
|
-
"aerodrome"
|
|
310
|
-
]);
|
|
311
|
-
function defiMultisignExpiryUnixSeconds(protocolId, explicitExpiryDate) {
|
|
312
|
-
if (typeof explicitExpiryDate === "number" && Number.isFinite(explicitExpiryDate) && explicitExpiryDate > 0) {
|
|
313
|
-
return Math.floor(explicitExpiryDate);
|
|
314
|
-
}
|
|
315
|
-
if (protocolId && DEFI_PROTOCOLS_WITH_30MIN_EXPIRY.has(protocolId)) {
|
|
316
|
-
return Math.floor(Date.now() / 1e3) + DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS;
|
|
317
|
-
}
|
|
318
|
-
return void 0;
|
|
319
|
-
}
|
|
405
|
+
// src/core/index.ts
|
|
406
|
+
init_expiry();
|
|
320
407
|
function isEvmNativeToken(address) {
|
|
321
408
|
try {
|
|
322
409
|
return viem.getAddress(address) === viem.zeroAddress;
|
|
@@ -3430,6 +3517,22 @@ var curveDaoProtocolModule = {
|
|
|
3430
3517
|
amountHuman: { type: "string", required: true, description: "Human-readable input amount" },
|
|
3431
3518
|
slippagePercent: { type: "number", required: true, description: "Slippage percent (0\u2013100 exclusive)" }
|
|
3432
3519
|
}
|
|
3520
|
+
},
|
|
3521
|
+
{
|
|
3522
|
+
id: "curve-dao.add-liquidity",
|
|
3523
|
+
protocolId: CURVE_DAO_PROTOCOL_ID,
|
|
3524
|
+
chainCategory: "evm",
|
|
3525
|
+
description: "Add liquidity to an important Curve pool (optional gauge stake)",
|
|
3526
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3527
|
+
params: {}
|
|
3528
|
+
},
|
|
3529
|
+
{
|
|
3530
|
+
id: "curve-dao.remove-liquidity",
|
|
3531
|
+
protocolId: CURVE_DAO_PROTOCOL_ID,
|
|
3532
|
+
chainCategory: "evm",
|
|
3533
|
+
description: "Remove liquidity from an important Curve pool",
|
|
3534
|
+
commonParams: ["keyGen", "purposeText", "useCustomGas"],
|
|
3535
|
+
params: {}
|
|
3433
3536
|
}
|
|
3434
3537
|
]
|
|
3435
3538
|
};
|
|
@@ -3439,14 +3542,14 @@ var curveDao = {
|
|
|
3439
3542
|
isChainSupported: isCurveApiChainSupported,
|
|
3440
3543
|
loadSession: loadFullCurveSessionForRpc
|
|
3441
3544
|
};
|
|
3442
|
-
var AERODROME_PROTOCOL_ID = "aerodrome";
|
|
3443
|
-
var AERODROME_CHAIN_ID = 8453;
|
|
3444
|
-
function isAerodromeChainSupported(chainId) {
|
|
3445
|
-
const n = typeof chainId === "number" ? chainId : Number.parseInt(String(chainId), 10);
|
|
3446
|
-
return n === AERODROME_CHAIN_ID;
|
|
3447
|
-
}
|
|
3448
3545
|
|
|
3449
3546
|
// src/protocols/evm/aerodrome/index.ts
|
|
3547
|
+
init_support();
|
|
3548
|
+
init_support();
|
|
3549
|
+
init_addresses();
|
|
3550
|
+
init_stockTokens();
|
|
3551
|
+
init_discover();
|
|
3552
|
+
init_yields();
|
|
3450
3553
|
var aerodromeProtocolModule = {
|
|
3451
3554
|
id: AERODROME_PROTOCOL_ID,
|
|
3452
3555
|
chainCategory: "evm",
|
|
@@ -3555,18 +3658,142 @@ var aerodromeProtocolModule = {
|
|
|
3555
3658
|
};
|
|
3556
3659
|
registerProtocolModule(aerodromeProtocolModule);
|
|
3557
3660
|
|
|
3661
|
+
// src/protocols/evm/pendle/support.ts
|
|
3662
|
+
var PENDLE_PROTOCOL_ID = "pendle";
|
|
3663
|
+
var PENDLE_CORE_API_BASE = "https://api-v2.pendle.finance/core";
|
|
3664
|
+
var PENDLE_CHAIN_CACHE_MS = 30 * 60 * 1e3;
|
|
3665
|
+
|
|
3666
|
+
// src/protocols/evm/pendle/api.ts
|
|
3667
|
+
var FETCH_TIMEOUT_MS = 12e4;
|
|
3668
|
+
var PendleApiError = class extends Error {
|
|
3669
|
+
status;
|
|
3670
|
+
path;
|
|
3671
|
+
constructor(message, status, path) {
|
|
3672
|
+
super(message);
|
|
3673
|
+
this.name = "PendleApiError";
|
|
3674
|
+
this.status = status;
|
|
3675
|
+
this.path = path;
|
|
3676
|
+
}
|
|
3677
|
+
};
|
|
3678
|
+
function sleep(ms) {
|
|
3679
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3680
|
+
}
|
|
3681
|
+
function queryString(params) {
|
|
3682
|
+
const q = new URLSearchParams();
|
|
3683
|
+
for (const [k, v] of Object.entries(params)) {
|
|
3684
|
+
if (v === void 0 || v === "") continue;
|
|
3685
|
+
q.set(k, String(v));
|
|
3686
|
+
}
|
|
3687
|
+
const s = q.toString();
|
|
3688
|
+
return s ? `?${s}` : "";
|
|
3689
|
+
}
|
|
3690
|
+
async function pendleCoreFetch(args) {
|
|
3691
|
+
const path = args.path.startsWith("/") ? args.path : `/${args.path}`;
|
|
3692
|
+
const url = `${PENDLE_CORE_API_BASE}${path}${queryString(args.query ?? {})}`;
|
|
3693
|
+
const headers = { Accept: "application/json" };
|
|
3694
|
+
if (args.apiKey?.trim()) headers.Authorization = `Bearer ${args.apiKey.trim()}`;
|
|
3695
|
+
if (args.body !== void 0) headers["Content-Type"] = "application/json";
|
|
3696
|
+
let lastError;
|
|
3697
|
+
for (let attempt = 0; attempt < 4; attempt++) {
|
|
3698
|
+
const ac = new AbortController();
|
|
3699
|
+
const timer = setTimeout(() => ac.abort(), FETCH_TIMEOUT_MS);
|
|
3700
|
+
try {
|
|
3701
|
+
const res = await fetch(url, {
|
|
3702
|
+
method: args.method ?? "GET",
|
|
3703
|
+
headers,
|
|
3704
|
+
body: args.body === void 0 ? void 0 : JSON.stringify(args.body),
|
|
3705
|
+
signal: ac.signal
|
|
3706
|
+
});
|
|
3707
|
+
if (res.status === 429) {
|
|
3708
|
+
const wait = Math.min(8e3, 500 * 2 ** attempt);
|
|
3709
|
+
await sleep(wait);
|
|
3710
|
+
lastError = new PendleApiError(`Pendle API rate limited (429) on ${path}`, 429, path);
|
|
3711
|
+
continue;
|
|
3712
|
+
}
|
|
3713
|
+
const text = await res.text();
|
|
3714
|
+
if (!res.ok) {
|
|
3715
|
+
throw new PendleApiError(
|
|
3716
|
+
`Pendle API ${res.status} ${path}: ${text.slice(0, 400)}`,
|
|
3717
|
+
res.status,
|
|
3718
|
+
path
|
|
3719
|
+
);
|
|
3720
|
+
}
|
|
3721
|
+
if (!text.trim()) return {};
|
|
3722
|
+
return JSON.parse(text);
|
|
3723
|
+
} catch (err) {
|
|
3724
|
+
lastError = err;
|
|
3725
|
+
if (err instanceof PendleApiError && err.status !== 429) throw err;
|
|
3726
|
+
if (attempt < 3 && (err instanceof PendleApiError || err?.name === "AbortError")) {
|
|
3727
|
+
await sleep(Math.min(8e3, 400 * 2 ** attempt));
|
|
3728
|
+
continue;
|
|
3729
|
+
}
|
|
3730
|
+
throw err;
|
|
3731
|
+
} finally {
|
|
3732
|
+
clearTimeout(timer);
|
|
3733
|
+
}
|
|
3734
|
+
}
|
|
3735
|
+
throw lastError instanceof Error ? lastError : new Error(String(lastError));
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
// src/protocols/evm/pendle/discover.ts
|
|
3739
|
+
var chainIdsCache = null;
|
|
3740
|
+
async function pendleFetchSupportedChainIds() {
|
|
3741
|
+
const now = Date.now();
|
|
3742
|
+
if (chainIdsCache && now - chainIdsCache.at < PENDLE_CHAIN_CACHE_MS) return chainIdsCache.chainIds;
|
|
3743
|
+
const json = await pendleCoreFetch({ path: "/v1/chains" });
|
|
3744
|
+
const ids = Array.isArray(json.chainIds) ? json.chainIds.map((n) => Number(n)).filter((n) => Number.isFinite(n) && n > 0) : [];
|
|
3745
|
+
chainIdsCache = { at: now, chainIds: ids };
|
|
3746
|
+
return ids;
|
|
3747
|
+
}
|
|
3748
|
+
async function isPendleChainSupported(chainId) {
|
|
3749
|
+
try {
|
|
3750
|
+
const ids = await pendleFetchSupportedChainIds();
|
|
3751
|
+
if (ids.length === 0) return true;
|
|
3752
|
+
return ids.includes(chainId);
|
|
3753
|
+
} catch {
|
|
3754
|
+
return true;
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
|
|
3758
|
+
// src/protocols/evm/pendle/index.ts
|
|
3759
|
+
var pendleProtocolModule = {
|
|
3760
|
+
id: PENDLE_PROTOCOL_ID,
|
|
3761
|
+
chainCategory: "evm",
|
|
3762
|
+
isChainSupported(ctx) {
|
|
3763
|
+
if (ctx.chainCategory !== "evm") return false;
|
|
3764
|
+
const n = typeof ctx.chainId === "number" ? ctx.chainId : Number.parseInt(String(ctx.chainId), 10);
|
|
3765
|
+
if (!Number.isFinite(n)) return false;
|
|
3766
|
+
return isPendleChainSupported(n);
|
|
3767
|
+
},
|
|
3768
|
+
isTokenSupported(token) {
|
|
3769
|
+
if (token.category !== "evm") return false;
|
|
3770
|
+
return token.kind === "native" || token.kind === "erc20";
|
|
3771
|
+
},
|
|
3772
|
+
actions: [
|
|
3773
|
+
{ id: "pendle.fetch-markets", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "List live Pendle markets (TVL-ranked, cap 100, matured omitted)", commonParams: [], params: {} },
|
|
3774
|
+
{ id: "pendle.search-assets", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Search live PT/YT/SY/underlying (matured only if address-pinned)", commonParams: [], params: {} },
|
|
3775
|
+
{ id: "pendle.swap", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Swap token \u2194 PT/YT via Hosted SDK convert", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3776
|
+
{ id: "pendle.mint-py", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Mint PT + YT", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3777
|
+
{ id: "pendle.redeem-py", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Redeem PT + YT (PT only after expiry)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3778
|
+
{ id: "pendle.add-liquidity", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Add Pendle AMM liquidity", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3779
|
+
{ id: "pendle.fetch-positions", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "List this wallet\u2019s Pendle LP (including matured)", commonParams: [], params: {} },
|
|
3780
|
+
{ id: "pendle.remove-liquidity", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Remove Pendle AMM liquidity", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} },
|
|
3781
|
+
{ id: "pendle.redeem-rewards", protocolId: PENDLE_PROTOCOL_ID, chainCategory: "evm", description: "Redeem on-chain SY/YT/LP interest and incentives (not merkle airdrops)", commonParams: ["keyGen", "purposeText", "useCustomGas"], params: {} }
|
|
3782
|
+
]
|
|
3783
|
+
};
|
|
3784
|
+
registerProtocolModule(pendleProtocolModule);
|
|
3785
|
+
|
|
3558
3786
|
// src/index.ts
|
|
3559
3787
|
registerProtocolModule(uniswapV4ProtocolModule);
|
|
3560
3788
|
registerProtocolModule(curveDaoProtocolModule);
|
|
3561
3789
|
registerProtocolModule(aerodromeProtocolModule);
|
|
3790
|
+
registerProtocolModule(pendleProtocolModule);
|
|
3562
3791
|
|
|
3563
3792
|
Object.defineProperty(exports, "firstClientIdFromKeyGen", {
|
|
3564
3793
|
enumerable: true,
|
|
3565
3794
|
get: function () { return continuumNodeSdk.getClientIdFromKeyGenResult; }
|
|
3566
3795
|
});
|
|
3567
3796
|
exports.COINGECKO_PLATFORM_BY_CHAIN_ID = COINGECKO_PLATFORM_BY_CHAIN_ID;
|
|
3568
|
-
exports.DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS = DEFAULT_DEFI_MULTISIGN_EXPIRY_SECONDS;
|
|
3569
|
-
exports.DEFI_PROTOCOLS_WITH_30MIN_EXPIRY = DEFI_PROTOCOLS_WITH_30MIN_EXPIRY;
|
|
3570
3797
|
exports.EIP712_SIGN_REQUEST_KIND = EIP712_SIGN_REQUEST_KIND;
|
|
3571
3798
|
exports.NEAR_CHAIN_CATEGORY = NEAR_CHAIN_CATEGORY;
|
|
3572
3799
|
exports.PAYLOAD_SIGN_ED25519_REQUEST_KIND = PAYLOAD_SIGN_ED25519_REQUEST_KIND;
|
|
@@ -3602,6 +3829,7 @@ exports.nearChainCategoryModule = nearChainCategoryModule;
|
|
|
3602
3829
|
exports.normalizeCurveRouterAmountString = normalizeCurveRouterAmountString;
|
|
3603
3830
|
exports.normalizeHumanDecimalAmount = normalizeHumanDecimalAmount;
|
|
3604
3831
|
exports.parseEvmChainIdToNumber = parseEvmChainIdToNumber;
|
|
3832
|
+
exports.pendleProtocolModule = pendleProtocolModule;
|
|
3605
3833
|
exports.postJsonViaOptionalProxy = postJsonViaOptionalProxy;
|
|
3606
3834
|
exports.publicClientForRpc = publicClientForRpc;
|
|
3607
3835
|
exports.registerProtocolModule = registerProtocolModule;
|