@continuumdao/ctm-mpc-defi 0.1.3
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/LICENSE +18 -0
- package/README.md +111 -0
- package/dist/agent/catalog.cjs +484 -0
- package/dist/agent/catalog.cjs.map +1 -0
- package/dist/agent/catalog.d.cts +117 -0
- package/dist/agent/catalog.d.ts +117 -0
- package/dist/agent/catalog.js +474 -0
- package/dist/agent/catalog.js.map +1 -0
- package/dist/chains/evm/index.cjs +474 -0
- package/dist/chains/evm/index.cjs.map +1 -0
- package/dist/chains/evm/index.d.cts +62 -0
- package/dist/chains/evm/index.d.ts +62 -0
- package/dist/chains/evm/index.js +459 -0
- package/dist/chains/evm/index.js.map +1 -0
- package/dist/chains/near/index.cjs +25 -0
- package/dist/chains/near/index.cjs.map +1 -0
- package/dist/chains/near/index.d.cts +37 -0
- package/dist/chains/near/index.d.ts +37 -0
- package/dist/chains/near/index.js +20 -0
- package/dist/chains/near/index.js.map +1 -0
- package/dist/chains/solana/index.cjs +25 -0
- package/dist/chains/solana/index.cjs.map +1 -0
- package/dist/chains/solana/index.d.cts +40 -0
- package/dist/chains/solana/index.d.ts +40 -0
- package/dist/chains/solana/index.js +20 -0
- package/dist/chains/solana/index.js.map +1 -0
- package/dist/core/index.cjs +128 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +10 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +116 -0
- package/dist/core/index.js.map +1 -0
- package/dist/envelope-CcE5Cz_q.d.ts +35 -0
- package/dist/envelope-DYDPnrHZ.d.cts +35 -0
- package/dist/index.cjs +2481 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +2446 -0
- package/dist/index.js.map +1 -0
- package/dist/keygen-CfNp8yKJ.d.cts +9 -0
- package/dist/keygen-DsINazx8.d.ts +9 -0
- package/dist/nodeRead-BnmSaMGO.d.cts +8 -0
- package/dist/nodeRead-BnmSaMGO.d.ts +8 -0
- package/dist/protocols/evm/curve-dao/index.cjs +869 -0
- package/dist/protocols/evm/curve-dao/index.cjs.map +1 -0
- package/dist/protocols/evm/curve-dao/index.d.cts +147 -0
- package/dist/protocols/evm/curve-dao/index.d.ts +147 -0
- package/dist/protocols/evm/curve-dao/index.js +846 -0
- package/dist/protocols/evm/curve-dao/index.js.map +1 -0
- package/dist/protocols/evm/uniswap-v4/index.cjs +1700 -0
- package/dist/protocols/evm/uniswap-v4/index.cjs.map +1 -0
- package/dist/protocols/evm/uniswap-v4/index.d.cts +323 -0
- package/dist/protocols/evm/uniswap-v4/index.d.ts +323 -0
- package/dist/protocols/evm/uniswap-v4/index.js +1659 -0
- package/dist/protocols/evm/uniswap-v4/index.js.map +1 -0
- package/dist/registry-BwZoE668.d.cts +8 -0
- package/dist/registry-oMKlO_5z.d.ts +8 -0
- package/dist/txParams-BC7ogvdR.d.cts +19 -0
- package/dist/txParams-BC7ogvdR.d.ts +19 -0
- package/dist/types-5u863Fd9.d.ts +34 -0
- package/dist/types-B8idm_gu.d.cts +34 -0
- package/dist/types-Ce2qNHai.d.cts +57 -0
- package/dist/types-Ce2qNHai.d.ts +57 -0
- package/package.json +94 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/core/registry.ts","../../../../src/chains/evm/chainIdParse.ts","../../../../src/protocols/evm/curve-dao/support.ts","../../../../src/protocols/evm/curve-dao/swapDestinations.ts","../../../../src/protocols/evm/curve-dao/apiSession.ts","../../../../src/protocols/evm/curve-dao/purpose.ts","../../../../src/protocols/evm/curve-dao/executeHelpers.ts","../../../../src/core/keygen.ts","../../../../src/core/purpose.ts","../../../../src/core/envelope.ts","../../../../src/chains/evm/fees/chainFees.ts","../../../../src/chains/evm/fees/eip1559Align.ts","../../../../src/chains/evm/txParams.ts","../../../../src/chains/evm/buildBatch.ts","../../../../src/protocols/evm/curve-dao/multisign.ts","../../../../src/protocols/evm/curve-dao/index.ts"],"names":["isAddress","getAddress","parseUnits","formatUnits","defineChain","createPublicClient","http","gasPriceGwei","parseGwei","serializeTransaction","keccak256","ETH_PLACEHOLDER","parseAbi","encodeFunctionData"],"mappings":";;;;;AAEA,IAAM,UAA4B,EAAC;AAE5B,SAAS,uBAAuB,GAAA,EAA2B;AAChE,EAAA,MAAM,QAAA,GAAW,QAAQ,SAAA,CAAU,CAAC,MAAM,CAAA,CAAE,EAAA,KAAO,IAAI,EAAE,CAAA;AACzD,EAAA,IAAI,YAAY,CAAA,EAAG;AACjB,IAAA,OAAA,CAAQ,QAAQ,CAAA,GAAI,GAAA;AAAA,EACtB,CAAA,MAAO;AACL,IAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAAA,EAClB;AACF;;;ACVO,SAAS,wBAAwB,OAAA,EAA8D;AACpG,EAAA,IAAI,OAAA,IAAW,IAAA,EAAM,OAAO,MAAA,CAAO,GAAA;AACnC,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,MAAM,CAAA,GAAI,OAAO,OAAO,CAAA;AACxB,IAAA,OAAO,OAAO,aAAA,CAAc,CAAC,KAAK,CAAA,IAAK,CAAA,GAAI,IAAI,MAAA,CAAO,GAAA;AAAA,EACxD;AACA,EAAA,IAAI,OAAO,YAAY,QAAA,EAAU;AAC/B,IAAA,OAAO,OAAO,SAAA,CAAU,OAAO,KAAK,OAAA,IAAW,CAAA,GAAI,UAAU,MAAA,CAAO,GAAA;AAAA,EACtE;AACA,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,EAAK;AAC/B,EAAA,IAAI,CAAC,CAAA,EAAG,OAAO,MAAA,CAAO,GAAA;AACtB,EAAA,MAAM,GAAA,GAAM,EAAE,WAAA,EAAY;AAC1B,EAAA,IAAI,GAAA,CAAI,UAAA,CAAW,SAAS,CAAA,EAAG;AAC7B,IAAA,MAAM,OAAO,CAAA,CAAE,KAAA,CAAM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;AAAA,MACZ,aAAA,EAAe,KAAA;AAAA,MACf,WAAA,EAAa,0DAAA;AAAA,MACb,YAAA,EAAc,CAAC,QAAA,EAAU,aAAA,EAAe,cAAc,CAAA;AAAA,MACtD,MAAA,EAAQ;AAAA,QACN,SAAS,EAAE,IAAA,EAAM,WAAW,QAAA,EAAU,IAAA,EAAM,aAAa,+CAAA,EAAgD;AAAA,QACzG,UAAU,EAAE,IAAA,EAAM,WAAW,QAAA,EAAU,IAAA,EAAM,aAAa,iDAAA,EAA6C;AAAA,QACvG,aAAa,EAAE,IAAA,EAAM,UAAU,QAAA,EAAU,IAAA,EAAM,aAAa,6BAAA,EAA8B;AAAA,QAC1F,iBAAiB,EAAE,IAAA,EAAM,UAAU,QAAA,EAAU,IAAA,EAAM,aAAa,yCAAA;AAAqC;AACvG;AACF;AAEJ;AAEA,sBAAA,CAAuB,sBAAsB,CAAA;AAKtC,IAAM,QAAA,GAAW;AAAA,EACtB,sBAAA,EAAwB,kCAAA;AAAA,EACxB,gBAAA,EAAkB,wBAAA;AAAA,EAClB,WAAA,EAAa;AACf","file":"index.cjs","sourcesContent":["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","/** Parse chain id for comparisons (decimal, 0x hex, CAIP-2 eip155:N, bigint). */\nexport function parseEvmChainIdToNumber(chainId: string | number | bigint | null | undefined): number {\n if (chainId == null) return Number.NaN\n if (typeof chainId === 'bigint') {\n const n = Number(chainId)\n return Number.isSafeInteger(n) && n >= 0 ? n : Number.NaN\n }\n if (typeof chainId === 'number') {\n return Number.isInteger(chainId) && chainId >= 0 ? chainId : Number.NaN\n }\n const t = String(chainId).trim()\n if (!t) return Number.NaN\n const low = t.toLowerCase()\n if (low.startsWith('eip155:')) {\n const rest = t.slice('eip155:'.length).trim()\n const n = Number.parseInt(rest, 10)\n return Number.isNaN(n) || n < 0 ? Number.NaN : n\n }\n if (low.startsWith('0x')) {\n return Number.parseInt(t, 16)\n }\n return Number.parseInt(t, 10)\n}\n","import { parseEvmChainIdToNumber } from '../../../chains/evm/chainIdParse.js'\n\nconst CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS: ReadonlySet<number> = new Set([\n 1, 10, 56, 100, 137, 146, 196, 250, 252, 324, 999, 1284, 2222, 5000, 8453, 42161, 42220, 43114, 1313161554,\n])\n\nexport function isCurveApiChainSupported(chainId: string | number | bigint | null | undefined): boolean {\n const n = parseEvmChainIdToNumber(chainId)\n if (Number.isNaN(n) || n < 0) return false\n return CURVE_FULL_NETWORK_CONSTANTS_CHAIN_IDS.has(n)\n}\n\nexport { isCurveApiChainSupported as isCurveDaoChainSupported }\n","import { formatUnits, getAddress, isAddress, parseUnits } from 'viem'\n\nexport const CURVE_NATIVE_PLACEHOLDER = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'\n\nconst ETH_PLACEHOLDER = CURVE_NATIVE_PLACEHOLDER\n\nfunction normalizeAddr(a: string): string {\n return a.toLowerCase()\n}\n\n/** Map token in list to the address shape Curve uses in pool graphs (native → 0xeeee…). */\nexport function toCurveTokenKey(tokenInAddress: string, wrappedNative: string | undefined): string {\n if (!isAddress(tokenInAddress)) return normalizeAddr(tokenInAddress)\n try {\n const a = getAddress(tokenInAddress)\n if (wrappedNative && a.toLowerCase() === wrappedNative.toLowerCase()) {\n return ETH_PLACEHOLDER\n }\n return a.toLowerCase()\n } catch {\n return normalizeAddr(tokenInAddress)\n }\n}\n\n/**\n * Router / `getBestRouteAndOutput` expect the same coin id as the pool graph: wrapped native\n * is represented as `0xeeee…`, not the WETH (etc.) contract. Without this, route discovery can\n * return an empty route while BFS (which uses `toCurveTokenKey`) still finds a path.\n */\nexport function toCurveRouterTokenId(tokenAddress: string, wrappedNative: string | undefined): string {\n const t = (tokenAddress ?? '').trim().toLowerCase()\n if (t === ETH_PLACEHOLDER) return ETH_PLACEHOLDER\n if (!isAddress((tokenAddress ?? '').trim())) return normalizeAddr((tokenAddress ?? '').trim())\n try {\n const a = getAddress((tokenAddress ?? '').trim())\n if (wrappedNative && a.toLowerCase() === wrappedNative.toLowerCase()) {\n return ETH_PLACEHOLDER\n }\n /** Lowercase matches pool graph keys and `@curvefi/api`’s `DECIMALS` lookups. */\n return a.toLowerCase()\n } catch {\n return normalizeAddr((tokenAddress ?? '').trim())\n }\n}\n\n/**\n * Turn the user’s decimal string into a canonical form using **this chain’s** token-in decimals\n * (from the asset row). `@curvefi/api` uses the same for `parseUnits` when building routes; an\n * over-long fraction (e.g. 1e-8 on USDC) can make internal calls fail and yield an empty route / 0.0.\n */\nexport function normalizeCurveRouterAmountString(raw: string, tokenInDecimals: number): string {\n const t = raw.trim().replace(/,/g, '')\n if (!t) return ''\n if (!Number.isInteger(tokenInDecimals) || tokenInDecimals < 0 || tokenInDecimals > 18) {\n throw new Error('Invalid token-in decimals for amount normalization.')\n }\n const wei = parseUnits(t, tokenInDecimals)\n return formatUnits(wei, tokenInDecimals)\n}\n\nfunction addEdge(adj: Map<string, Set<string>>, a: string, b: string) {\n if (a === b) return\n if (!adj.has(a)) adj.set(a, new Set())\n if (!adj.has(b)) adj.set(b, new Set())\n adj.get(a)!.add(b)\n adj.get(b)!.add(a)\n}\n\n/**\n * Build graph from the same pool list the Curve router uses (`getPool` / `getPoolList` on the\n * public `@curvefi/api` instance; `getPoolsData` is internal).\n */\nexport function buildCurveLiquidityGraphFromApi(curve: {\n getPoolList: () => string[]\n getPool: (id: string) => {\n underlyingCoinAddresses: string[] | undefined\n wrappedCoinAddresses: string[] | undefined\n }\n}): Map<string, Set<string>> {\n const adj = new Map<string, Set<string>>()\n for (const id of curve.getPoolList()) {\n try {\n const pool = curve.getPool(id)\n const w = (pool.wrappedCoinAddresses ?? []).map(normalizeAddr)\n const u = (pool.underlyingCoinAddresses ?? []).map(normalizeAddr)\n const all = [...new Set([...w, ...u])]\n for (let i = 0; i < all.length; i++) {\n for (let j = i + 1; j < all.length; j++) {\n addEdge(adj, all[i], all[j])\n }\n }\n } catch {\n /* pool constructor can throw for stale ids */\n }\n }\n return adj\n}\n\n/**\n * Add bidirectional edge between the SDK's native placeholder coin and WETH, when the chain uses\n * wrapped native in pools (mirrors the Curve dialog graph).\n */\nexport function addNativeWethBridge(adj: Map<string, Set<string>>, wrappedNative: string | undefined) {\n if (!wrappedNative) return\n const w = wrappedNative.toLowerCase()\n const a = ETH_PLACEHOLDER\n const b = w\n if (a === b) return\n if (!adj.has(a)) adj.set(a, new Set())\n if (!adj.has(b)) adj.set(b, new Set())\n adj.get(a)!.add(b)\n adj.get(b)!.add(a)\n}\n\n/** True when the token key appears in the graph with at least one swap neighbor. */\nexport function isCurveTokenKeySwappable(\n swappableNodeKeys: ReadonlySet<string>,\n graphTokenKey: string,\n): boolean {\n return swappableNodeKeys.has(graphTokenKey)\n}\n\n/**\n * All token keys in `adj` that have at least one pool neighbor (candidates to start a path from).\n */\nexport function swappableCurveGraphNodeKeys(adj: Map<string, Set<string>>): Set<string> {\n const out = new Set<string>()\n for (const [k, neigh] of adj) {\n if (neigh.size > 0) out.add(k)\n }\n return out\n}\n\n/**\n * All tokens in the same connected component as `start` (excluding `start`), for router discovery.\n */\nexport function bfsCurveSwapDestinations(adj: Map<string, Set<string>>, start: string): Set<string> {\n const s = normalizeAddr(start)\n const visited = new Set<string>([s])\n const q: string[] = [s]\n while (q.length) {\n const n = q.shift()!\n for (const nxt of adj.get(n) ?? []) {\n if (!visited.has(nxt)) {\n visited.add(nxt)\n q.push(nxt)\n }\n }\n }\n visited.delete(s)\n return visited\n}\n\nexport type CurveDestToken = {\n address: string\n symbol: string\n name: string\n /** From Curve `getCoinsData` (on-chain), when available. */\n decimals: number | null\n}\n","import {\n addNativeWethBridge,\n buildCurveLiquidityGraphFromApi,\n swappableCurveGraphNodeKeys,\n} from './swapDestinations.js'\n\n/** Live `@curvefi/api` instance with pools already fetched, plus the routing graph. */\nexport type CurveFullSession = {\n /** Same reference used for getCoinsData / router; pools already loaded. */\n curve: any\n adj: Map<string, Set<string>>\n swappableNodeKeys: ReadonlySet<string>\n wrappedNative: string | undefined\n}\n\n/**\n * Fetches all factory pools in parallel (best-effort; failures are ignored per factory,\n * same as the Curve dialog).\n */\nexport async function fetchAllCurvePools(curve: {\n factory: { fetchPools: () => Promise<unknown> }\n crvUSDFactory: { fetchPools: () => Promise<unknown> }\n EYWAFactory: { fetchPools: () => Promise<unknown> }\n cryptoFactory: { fetchPools: () => Promise<unknown> }\n twocryptoFactory: { fetchPools: () => Promise<unknown> }\n tricryptoFactory: { fetchPools: () => Promise<unknown> }\n stableNgFactory: { fetchPools: () => Promise<unknown> }\n}): Promise<void> {\n const run = (p: Promise<unknown>) => p.catch(() => undefined)\n await Promise.all([\n run(curve.factory.fetchPools()),\n run(curve.crvUSDFactory.fetchPools()),\n run(curve.EYWAFactory.fetchPools()),\n run(curve.cryptoFactory.fetchPools()),\n run(curve.twocryptoFactory.fetchPools()),\n run(curve.tricryptoFactory.fetchPools()),\n run(curve.stableNgFactory.fetchPools()),\n ])\n}\n\n/**\n * One init + `fetchAllCurvePools` + graph build. Reuse this session for the asset list and the\n * Curve dialog to avoid duplicating the Curve API work.\n */\nexport async function loadFullCurveSessionForRpc(rpcUrl: string): Promise<CurveFullSession | null> {\n const url = (rpcUrl ?? '').trim()\n if (!url) return null\n try {\n const { default: curve } = await import('@curvefi/api')\n await curve.init('JsonRpc', { url }, {})\n const wrapped = (curve.getNetworkConstants() as { NATIVE_COIN?: { wrappedAddress?: string } })\n .NATIVE_COIN?.wrappedAddress\n if (!curve.hasRouter || !curve.hasRouter()) {\n return {\n curve,\n adj: new Map(),\n swappableNodeKeys: new Set<string>(),\n wrappedNative: wrapped,\n }\n }\n await fetchAllCurvePools(curve)\n const adj = buildCurveLiquidityGraphFromApi(curve)\n addNativeWethBridge(adj, wrapped)\n return {\n curve,\n adj,\n swappableNodeKeys: swappableCurveGraphNodeKeys(adj),\n wrappedNative: wrapped,\n }\n } catch {\n return null\n }\n}\n\n","/**\n * One-line prefill for multi-sign \"Purpose\" on Curve (DAO) swap (user may add detail below).\n * Matches the spirit of `buildUniswapV4PurposePrefill` for Uniswap.\n */\nexport function buildCurveDaoPurposePrefill(args: {\n tokenInSymbol: string\n tokenOutSymbol: string\n amountIn: string\n /** Quoted output from `getBestRouteAndOutput` (decimal string, no symbol). */\n quoteOutAmount: string | null\n slippageInput: string\n chainName: string\n chainId: number\n}): string {\n const symIn = (args.tokenInSymbol || '').trim() || 'token in'\n const symOut = (args.tokenOutSymbol || '').trim() || 'token out'\n const rawS = String(args.slippageInput || '0.5').trim().replace(/,/g, '')\n const parsedSlip = Number.parseFloat(rawS)\n const slip = Number.isFinite(parsedSlip) ? parsedSlip : 0.5\n const slipText = (Math.round(slip * 100) / 100).toString()\n const cname = (args.chainName || '').trim() || 'chain'\n const amt = (args.amountIn || '').trim()\n const qo = (args.quoteOutAmount || '').trim()\n let mid: string\n if (amt && qo) {\n mid = `${amt} ${symIn} for an estimated ${qo} ${symOut}`\n } else if (amt) {\n mid = `${amt} ${symIn} for an estimated output in ${symOut}`\n } else {\n mid = `… ${symIn} → ${symOut}`\n }\n return `Curve: swap ${mid} (max slippage ${slipText}%) on ${cname} (chainId ${args.chainId})`\n}\n","import type { ProposalTxParams } from '../../../chains/evm/txParams.js'\n\nfunction parseOptionalGasLimitString(raw: string | number | undefined): bigint | null {\n if (raw == null) return null\n const s = String(raw).trim()\n if (!s) return null\n try {\n if (/^0x[0-9a-fA-F]+$/.test(s)) return BigInt(s)\n return BigInt(s)\n } catch {\n return null\n }\n}\n\nfunction parseExtraJsonObject(detail: Record<string, unknown> | null | undefined): Record<string, unknown> | null {\n if (!detail) return null\n const raw = detail.ExtraJSON ?? detail.extraJSON\n if (raw == null) return null\n if (typeof raw === 'object' && !Array.isArray(raw)) return raw as Record<string, unknown>\n if (typeof raw === 'string' && raw.trim()) {\n try {\n const p = JSON.parse(raw) as unknown\n if (p && typeof p === 'object' && !Array.isArray(p)) return p as Record<string, unknown>\n } catch {\n return null\n }\n }\n return null\n}\n\nexport const CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS = 1_200_000n\n\nexport function isCurveDaoSwapEvmSignRequest(\n detail: Record<string, unknown> | null | undefined,\n batchIndex?: number,\n): boolean {\n const ex = parseExtraJsonObject(detail)\n if (batchIndex != null && batchIndex >= 0 && ex) {\n const bm = ex.batchMeta\n if (Array.isArray(bm) && bm[batchIndex] && typeof bm[batchIndex] === 'object' && !Array.isArray(bm[batchIndex])) {\n const evm0 = (bm[batchIndex] as Record<string, unknown>).evm\n if (evm0 && typeof evm0 === 'object' && !Array.isArray(evm0)) {\n if (String((evm0 as Record<string, unknown>).type ?? '') === 'curve_dao_router_exchange') return true\n }\n }\n }\n const evm = ex?.evm\n if (!evm || typeof evm !== 'object' || Array.isArray(evm)) return false\n return String((evm as Record<string, unknown>).type ?? '') === 'curve_dao_router_exchange'\n}\n\nexport function isCurveDaoErc20ApproveEvmSignRequest(\n detail: Record<string, unknown> | null | undefined,\n batchIndex?: number,\n): boolean {\n const ex = parseExtraJsonObject(detail)\n const index = batchIndex != null && batchIndex >= 0 ? batchIndex : 0\n const bm = ex?.batchMeta\n if (Array.isArray(bm) && bm[index] && typeof bm[index] === 'object' && !Array.isArray(bm[index])) {\n const evm0 = (bm[index] as Record<string, unknown>).evm\n if (evm0 && typeof evm0 === 'object' && !Array.isArray(evm0)) {\n const t = String((evm0 as Record<string, unknown>).type ?? '')\n return t === 'curve_dao_erc20_approve'\n }\n }\n return false\n}\n\nexport function resolveCurveDaoRouterGasUnitsFromSignRequest(\n detail: Record<string, unknown> | null | undefined,\n batchIndex?: number,\n): bigint | null {\n if (!detail) return null\n const propBatch = (detail.proposal_tx_params ??\n detail.proposalTxParams ??\n detail.ProposalTxParams) as unknown\n const index = batchIndex != null && batchIndex >= 0 ? batchIndex : 0\n if (Array.isArray(propBatch) && propBatch.length > index) {\n const row = propBatch[index]\n if (row && typeof row === 'object' && !Array.isArray(row)) {\n const r = row as Record<string, unknown>\n const gl = parseOptionalGasLimitString(\n (r.gas_limit ?? r.gasLimit ?? r.GasLimit) as string | number | undefined,\n )\n if (gl != null && gl > 0n) return gl\n }\n }\n const ex = parseExtraJsonObject(detail)\n const bm = ex?.batchMeta\n if (Array.isArray(bm)) {\n for (const item of bm) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) continue\n const cd = (item as Record<string, unknown>).curveDao as Record<string, unknown> | undefined\n const gb = cd?.gasBuildExchange as Record<string, unknown> | undefined\n const base = parseOptionalGasLimitString(gb?.baseGasUnits as string | number | undefined)\n if (base != null && base > 0n) return base\n }\n }\n return null\n}\n\nexport type { ProposalTxParams }\n","import type { KeyGenSubset } from './types.js'\n\nexport type { KeyGenSubset }\n\n/** App-compatible alias used by existing multisign builders. */\nexport type KeyGenSubsetForPermit = KeyGenSubset\n\nexport function firstClientIdFromKeyGen(data: KeyGenSubset | null | undefined): string | null {\n const map = data?.ClientKeys\n if (!map || typeof map !== 'object') return null\n for (const v of Object.values(map)) {\n if (typeof v === 'string' && v.trim()) return v.trim()\n }\n return null\n}\n\nexport function requirePubKeyHex(keyGen: KeyGenSubset): string {\n const ph = (keyGen.pubkeyhex ?? '').trim()\n if (!ph) throw new Error('keyGen pubKey (pubkeyhex) is required')\n return ph\n}\n\nexport function keyListFromKeyGen(keyGen: KeyGenSubset): string[] {\n return keyGen.keylist ?? []\n}\n","/** Merge user purpose text with an optional batch / protocol suffix. */\nexport function mergePurposeText(purposeText: string, 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 } from './types.js'\nimport type { KeyGenSubset } from './keygen.js'\nimport { firstClientIdFromKeyGen } from './keygen.js'\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}\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 = firstClientIdFromKeyGen(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)\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 return { bodyForSign, messageToSign: JSON.stringify(bodyForSign) }\n}\n\nexport const coreChainCategoryModule: ChainCategoryModule = {\n category: 'evm',\n finalizeMultisign,\n}\n","import { createPublicClient, http, defineChain, formatUnits } from 'viem'\n\nexport interface ChainFeeParams {\n isEip1559: boolean\n baseFeeGwei?: number\n priorityFeeGwei?: number\n gasPriceGwei?: number\n}\n\nexport async function fetchChainFeeParams(\n rpcUrl: string,\n chainId: number | string,\n): Promise<ChainFeeParams> {\n const url = rpcUrl.trim()\n if (!url) return { isEip1559: false }\n\n const chainIdNum = typeof chainId === 'string' ? parseInt(chainId, 10) : chainId\n if (Number.isNaN(chainIdNum)) return { isEip1559: false }\n\n const chain = defineChain({\n id: chainIdNum,\n name: 'Discovery',\n nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },\n rpcUrls: { default: { http: [url] } },\n })\n\n const publicClient = createPublicClient({\n chain,\n transport: http(url),\n })\n\n const getGasPriceGwei = async (): Promise<number> => {\n const gasPriceWei = await publicClient.getGasPrice()\n return parseFloat(formatUnits(gasPriceWei, 9))\n }\n\n try {\n const block = await publicClient.getBlock({ blockTag: 'latest' })\n const baseFeePerGas = block?.baseFeePerGas\n if (baseFeePerGas == null || baseFeePerGas === undefined) {\n const gasPriceGwei = await getGasPriceGwei()\n return { isEip1559: false, gasPriceGwei }\n }\n\n const baseFeeGwei = parseFloat(formatUnits(baseFeePerGas, 9))\n\n let priorityFeeGwei: number | undefined\n try {\n const priorityWei = await publicClient.estimateMaxPriorityFeePerGas()\n priorityFeeGwei = parseFloat(formatUnits(priorityWei, 9))\n } catch {\n /* chain may not support eth_maxPriorityFeePerGas */\n }\n\n const gasPriceGwei = await getGasPriceGwei()\n return {\n isEip1559: true,\n baseFeeGwei,\n priorityFeeGwei,\n gasPriceGwei,\n }\n } catch {\n try {\n const gasPriceWei = await publicClient.getGasPrice()\n const gasPriceGwei = parseFloat(formatUnits(gasPriceWei, 9))\n return { isEip1559: false, gasPriceGwei }\n } catch {\n return { isEip1559: false }\n }\n }\n}\n","import { parseGwei } from 'viem'\n\nexport type ResolvedEip1559Fees = {\n maxFeePerGas: bigint\n maxPriorityFeePerGas: bigint\n}\n\nfunction finalizeEip1559Fees(\n maxFeePerGas: bigint,\n maxPriorityFeePerGas: bigint,\n floor: { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint } | null | undefined,\n baseWei: bigint,\n): ResolvedEip1559Fees {\n let maxP = maxPriorityFeePerGas\n let maxF = maxFeePerGas\n if (floor) {\n if (maxP < floor.maxPriorityFeePerGas) maxP = floor.maxPriorityFeePerGas\n if (maxF < floor.maxFeePerGas) maxF = floor.maxFeePerGas\n }\n if (baseWei > 0n && maxF < baseWei + maxP) {\n maxF = baseWei + maxP + parseGwei('0.001')\n }\n if (maxF < maxP) {\n maxF = baseWei > 0n ? baseWei + maxP + parseGwei('0.001') : maxP * 2n\n }\n return { maxFeePerGas: maxF, maxPriorityFeePerGas: maxP }\n}\n\n/** Align EIP-1559 fees with the latest head base fee (same rules as Get Sig). */\nexport function alignEip1559FeesWithLatestBase(\n maxFeePerGas: bigint,\n maxPriorityFeePerGas: bigint,\n latestBlockBaseFeeWei: bigint,\n): ResolvedEip1559Fees {\n return finalizeEip1559Fees(maxFeePerGas, maxPriorityFeePerGas, null, latestBlockBaseFeeWei)\n}\n\nexport function gweiToDecimalString(n: number): string {\n if (!Number.isFinite(n)) return '0'\n if (n === 0) return '0'\n const s = String(n)\n if (s.indexOf('e') !== -1 || s.indexOf('E') !== -1) return n.toFixed(9).replace(/\\.?0+$/, '') || '0'\n return s\n}\n","/**\n * Proposal-time EVM fields for POST /multiSignRequest (mpc-auth).\n * Same shape as trigger txParams and GET /getSignRequestById?tx_params=1.\n */\n\nexport type ProposalTxParams = {\n nonce: number\n gasLimit: string\n txType: 'eip1559' | 'legacy'\n maxFeePerGas?: string\n maxPriorityFeePerGas?: string\n gasPrice?: string\n}\n\nexport function gasLimitFromEstimateAndChainConfig(\n estimatedGas: bigint,\n chainGasLimit?: number,\n): bigint {\n if (chainGasLimit == null || !Number.isFinite(chainGasLimit) || chainGasLimit <= 0) {\n return estimatedGas\n }\n const cfg = BigInt(Math.floor(chainGasLimit))\n return cfg > estimatedGas ? cfg : estimatedGas\n}\n\nexport function routerSwapGasLimitFromEstimate(\n estimatedGas: bigint,\n chainGasLimit?: number | null,\n): bigint {\n if (chainGasLimit != null && Number.isFinite(chainGasLimit) && chainGasLimit > 0) {\n return gasLimitFromEstimateAndChainConfig(estimatedGas, chainGasLimit)\n }\n return (estimatedGas * 12n + 9n) / 10n\n}\n\nexport function composeFeePayloadToTxParams(\n p: Record<string, unknown>,\n legacy: boolean,\n): ProposalTxParams | undefined {\n const gl = p.txGasLimit ?? p.txgaslimit\n if (gl == null || String(gl).trim() === '') return undefined\n const n = p.txNonce ?? p.txnonce\n let nonce = 0\n if (typeof n === 'bigint') nonce = Number(n)\n else if (typeof n === 'number') nonce = n\n else if (n != null) nonce = parseInt(String(n), 10)\n if (!Number.isFinite(nonce)) nonce = 0\n const gasLimit = String(gl)\n if (legacy) {\n const gp = p.txGasPrice ?? p.txgasprice\n return {\n nonce,\n gasLimit,\n txType: 'legacy',\n gasPrice: gp != null ? String(gp) : '0',\n }\n }\n return {\n nonce,\n gasLimit,\n txType: 'eip1559',\n maxFeePerGas: String(p.txMaxFeePerGas ?? ''),\n maxPriorityFeePerGas: String(p.txMaxPriorityFeePerGas ?? ''),\n }\n}\n\nexport function triggerTxParamsFromComposeBody(body: Record<string, unknown>): ProposalTxParams {\n const existing = body.txParams\n if (existing && typeof existing === 'object' && !Array.isArray(existing)) {\n const o = existing as ProposalTxParams & { gasLimit?: string }\n if (String(o.gasLimit ?? '').trim() !== '') {\n return { ...o }\n }\n }\n const pb = body.proposalTxParams\n if (Array.isArray(pb) && pb.length > 0 && typeof pb[0] === 'object' && pb[0] !== null) {\n const first = pb[0] as ProposalTxParams & { gasLimit?: string }\n if (String(first.gasLimit ?? '').trim() !== '') {\n return { ...first }\n }\n }\n const fromSnapshot = composeFeePayloadToTxParams(\n body,\n body.txMaxFeePerGas == null && body.txMaxPriorityFeePerGas == null,\n )\n if (fromSnapshot) return fromSnapshot\n return {\n nonce: 0,\n gasLimit: '',\n txType: 'legacy',\n gasPrice: '0',\n }\n}\n\nexport function proposalTxParamsToFeeSnapshot(\n params: ProposalTxParams,\n): Record<string, unknown> {\n if (params.txType === 'legacy') {\n return {\n txNonce: params.nonce,\n txGasLimit: params.gasLimit,\n txGasPrice: params.gasPrice ?? '0',\n }\n }\n return {\n txNonce: params.nonce,\n txGasLimit: params.gasLimit,\n txMaxFeePerGas: params.maxFeePerGas ?? '',\n txMaxPriorityFeePerGas: params.maxPriorityFeePerGas ?? '',\n }\n}\n","import {\n keccak256,\n createPublicClient,\n defineChain,\n http,\n serializeTransaction,\n getAddress,\n parseGwei,\n type Address,\n type PublicClient,\n} from 'viem'\nimport type { MultisignBuildResult } from '../../core/types.js'\nimport { finalizeMultisign, type MultisignLeg } from '../../core/envelope.js'\nimport type { KeyGenSubset } from '../../core/keygen.js'\nimport { fetchChainFeeParams } from './fees/chainFees.js'\nimport { alignEip1559FeesWithLatestBase, gweiToDecimalString } from './fees/eip1559Align.js'\nimport {\n gasLimitFromEstimateAndChainConfig,\n routerSwapGasLimitFromEstimate,\n proposalTxParamsToFeeSnapshot,\n type ProposalTxParams,\n} from './txParams.js'\nimport type { EvmProtocolContext, EvmTxStep } from './types.js'\n\nexport type EvmBatchMetaBuilder = (args: {\n step: EvmTxStep\n index: number\n gasLimit: bigint\n}) => Record<string, unknown>\n\nexport type EvmBuildBatchArgs = {\n context: EvmProtocolContext\n steps: EvmTxStep[]\n purposeSuffix?: string\n buildBatchMeta: EvmBatchMetaBuilder\n /** First leg msgRaw without 0x prefix; defaults to first step calldata */\n firstMsgRawNo0x?: string\n destinationAddress?: Address\n /** Top-level `value` on bodyForSign when the payable amount is not on the first leg */\n payableValueWei?: bigint\n resolveGasLimit?: (args: {\n step: EvmTxStep\n index: number\n estimatedGas: bigint\n publicClient: PublicClient\n }) => Promise<bigint> | bigint\n}\n\n/**\n * Build unsigned EVM txs, estimate gas, serialize, hash — then assemble mpc-auth body via core envelope.\n */\nexport async function buildEvmMultisignBatch(args: EvmBuildBatchArgs): Promise<MultisignBuildResult> {\n const { context, steps } = args\n const {\n chainId,\n rpcUrl,\n executorAddress,\n chainDetail,\n useCustomGas,\n customGasChainDetails,\n keyGen,\n purposeText,\n } = context\n\n if (steps.length === 0) throw new Error('buildEvmMultisignBatch requires at least one step')\n\n const ch = defineChain({\n id: chainId,\n name: 'Destination',\n nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },\n rpcUrls: { default: { http: [rpcUrl] } },\n })\n const publicClient = createPublicClient({ chain: ch, transport: http(rpcUrl) })\n\n const feeParams = await fetchChainFeeParams(rpcUrl, chainId)\n const legacy = Boolean(chainDetail?.legacy) || !feeParams.isEip1559\n const latestBaseFeeWei = !legacy\n ? ((await publicClient.getBlock({ blockTag: 'latest' })).baseFeePerGas ?? 0n)\n : 0n\n\n const gasLimitConfig =\n useCustomGas && chainDetail?.gasLimit != null ? Number(chainDetail.gasLimit) : undefined\n const chainGasLimitRouter =\n chainDetail?.gasLimit != null &&\n Number.isFinite(Number(chainDetail.gasLimit)) &&\n Number(chainDetail.gasLimit) > 0\n ? Number(chainDetail.gasLimit)\n : undefined\n const gasFeeMultiplier =\n useCustomGas && chainDetail?.gasMultiplier != null ? Number(chainDetail.gasMultiplier) : undefined\n\n const executor = getAddress(executorAddress)\n const baseNonce = await publicClient.getTransactionCount({ address: executor, blockTag: 'pending' })\n\n const legs: MultisignLeg[] = []\n\n for (let i = 0; i < steps.length; i++) {\n const step = steps[i]!\n const currentNonce = baseNonce + i\n\n let estimatedGas: bigint\n try {\n estimatedGas = await publicClient.estimateGas({\n to: step.to,\n data: step.data,\n value: step.value,\n account: executor,\n })\n } catch {\n estimatedGas = step.fallbackGas ?? 100_000n\n }\n\n let gasLimitI: bigint\n if (args.resolveGasLimit) {\n gasLimitI = await args.resolveGasLimit({ step, index: i, estimatedGas, publicClient })\n } else if (step.routerSwap) {\n gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter)\n } else {\n gasLimitI = useCustomGas\n ? gasLimitFromEstimateAndChainConfig(estimatedGas, gasLimitConfig)\n : estimatedGas\n }\n\n let proposalTxParams: ProposalTxParams\n let feeSnapshot: Record<string, unknown>\n let serialized: `0x${string}`\n\n if (legacy) {\n let gasPriceWei = await publicClient.getGasPrice()\n if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {\n gasPriceWei = (gasPriceWei * BigInt(100 + gasFeeMultiplier)) / 100n\n }\n if (useCustomGas && chainDetail?.gasPrice != null && chainDetail.gasPrice > 0) {\n const configured = parseGwei(gweiToDecimalString(Number(chainDetail.gasPrice)))\n if (configured > gasPriceWei) gasPriceWei = configured\n }\n serialized = serializeTransaction({\n type: 'legacy',\n to: step.to,\n data: step.data,\n value: step.value,\n gas: gasLimitI,\n gasPrice: gasPriceWei,\n nonce: currentNonce,\n chainId,\n })\n proposalTxParams = {\n nonce: currentNonce,\n gasLimit: gasLimitI.toString(),\n txType: 'legacy',\n gasPrice: gasPriceWei.toString(),\n }\n feeSnapshot = proposalTxParamsToFeeSnapshot(proposalTxParams)\n } else {\n const fetchedBase = feeParams.baseFeeGwei ?? 0\n const fetchedPriority = feeParams.priorityFeeGwei ?? 0\n const configuredBase =\n useCustomGas && chainDetail?.baseFee != null ? Number(chainDetail.baseFee) : 0\n const configuredPriority =\n useCustomGas && chainDetail?.priorityFee != null ? Number(chainDetail.priorityFee) : 0\n const effectiveBaseFeeGwei = Math.max(fetchedBase, configuredBase)\n const effectivePriorityFeeGwei = Math.max(fetchedPriority, configuredPriority)\n const baseFeeMultiplierPct =\n useCustomGas && chainDetail?.baseFeeMultiplier != null\n ? Math.max(100, Number(chainDetail.baseFeeMultiplier))\n : 100\n const baseComponentGwei = (effectiveBaseFeeGwei * baseFeeMultiplierPct) / 100\n const maxFeePerGasGwei = baseComponentGwei + effectivePriorityFeeGwei\n let maxPriorityFeePerGas =\n effectivePriorityFeeGwei > 0\n ? parseGwei(gweiToDecimalString(effectivePriorityFeeGwei))\n : parseGwei('1')\n let maxFeePerGas = parseGwei(gweiToDecimalString(maxFeePerGasGwei))\n if (useCustomGas && gasFeeMultiplier != null && gasFeeMultiplier > 0) {\n maxPriorityFeePerGas = (maxPriorityFeePerGas * BigInt(100 + gasFeeMultiplier)) / 100n\n maxFeePerGas = (maxFeePerGas * BigInt(100 + gasFeeMultiplier)) / 100n\n }\n ;({ maxFeePerGas, maxPriorityFeePerGas } = alignEip1559FeesWithLatestBase(\n maxFeePerGas,\n maxPriorityFeePerGas,\n latestBaseFeeWei,\n ))\n serialized = serializeTransaction({\n type: 'eip1559',\n to: step.to,\n data: step.data,\n value: step.value,\n gas: gasLimitI,\n maxFeePerGas,\n maxPriorityFeePerGas,\n nonce: currentNonce,\n chainId,\n })\n proposalTxParams = {\n nonce: currentNonce,\n gasLimit: gasLimitI.toString(),\n txType: 'eip1559',\n maxFeePerGas: maxFeePerGas.toString(),\n maxPriorityFeePerGas: maxPriorityFeePerGas.toString(),\n }\n feeSnapshot = i === 0 ? proposalTxParamsToFeeSnapshot(proposalTxParams) : {}\n }\n\n const h = keccak256(serialized)\n const msgHash = h.startsWith('0x') ? h.slice(2) : h\n\n const batchMetaExtra = args.buildBatchMeta({ step, index: i, gasLimit: gasLimitI })\n\n legs.push({\n msgHash,\n msgRaw: i === 0 && args.firstMsgRawNo0x != null ? args.firstMsgRawNo0x : serialized,\n destinationAddress: step.to,\n signatureText:\n typeof batchMetaExtra.signatureText === 'string'\n ? batchMetaExtra.signatureText\n : JSON.stringify(batchMetaExtra.signatureText ?? {}),\n audit: batchMetaExtra,\n feeSnapshot: i === 0 ? feeSnapshot : {},\n proposalTxParams,\n valueWei: i === 0 ? step.value : undefined,\n })\n\n if (i === 0 && args.firstMsgRawNo0x != null) {\n legs[0]!.msgRaw = args.firstMsgRawNo0x\n }\n }\n\n const extraJSON: Record<string, unknown> = {}\n if (useCustomGas && customGasChainDetails && Object.keys(customGasChainDetails).length > 0) {\n extraJSON.customGasChainDetails = customGasChainDetails\n }\n\n const result = finalizeMultisign({\n keyGen: keyGen as KeyGenSubset,\n purposeText,\n purposeSuffix: args.purposeSuffix,\n destinationChainID: String(chainId),\n destinationAddress: args.destinationAddress ?? steps[0]!.to,\n legs,\n extraJSON: Object.keys(extraJSON).length > 0 ? extraJSON : undefined,\n })\n const pv = args.payableValueWei\n if (pv != null && pv > 0n) {\n result.bodyForSign.value = pv.toString()\n }\n return result\n}\n\nexport const evmChainCategoryModule = {\n category: 'evm' as const,\n finalizeMultisign,\n buildEvmMultisignBatch,\n}\n","import {\n type Address,\n createPublicClient,\n defineChain,\n encodeFunctionData,\n getAddress,\n http,\n parseAbi,\n parseUnits,\n} from 'viem'\nimport type { KeyGenSubsetForPermit } from '../../../core/keygen.js'\nimport type { EvmChainDetail, EvmTxStep } from '../../../chains/evm/types.js'\nimport { buildEvmMultisignBatch } from '../../../chains/evm/buildBatch.js'\nimport { loadFullCurveSessionForRpc } from './apiSession.js'\nimport { toCurveRouterTokenId } from './swapDestinations.js'\nimport { CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS } from './executeHelpers.js'\nimport { routerSwapGasLimitFromEstimate } from '../../../chains/evm/txParams.js'\n\nconst ETH_PLACEHOLDER = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const\n\ntype CurveStepKind = 'approve' | 'exchange'\ntype CurveStep = EvmTxStep & { kind: CurveStepKind; routerSwap?: boolean; fallbackGas?: bigint }\n\nfunction txToViemStep(tx: {\n to?: string | null\n data?: string | null\n value?: string | bigint | number | null\n}): { to: Address; data: `0x${string}`; value: bigint } {\n if (!tx.to) throw new Error('Transaction missing `to`')\n const to = getAddress((tx.to ?? '').trim() as `0x${string}`)\n const raw = (tx.data ?? '0x').toString()\n const data = (raw.startsWith('0x') ? raw : `0x${raw}`) as `0x${string}`\n let value = 0n\n if (tx.value != null) {\n if (typeof tx.value === 'bigint') value = tx.value\n else value = BigInt(String(tx.value))\n }\n return { to, data, value }\n}\n\n/**\n * Build `POST /multiSignRequest` body: optional ERC-20 approve(s) to the Curve router, then\n * `CurveRouterNG.exchange` via `@curvefi/api` `router.populateSwap`.\n */\nexport async function buildEvmMultisignBodyCurveDaoBatch(args: {\n keyGen: KeyGenSubsetForPermit\n chainId: number\n rpcUrl: string\n chainDetail: EvmChainDetail\n useCustomGas: boolean\n customGasChainDetails?: Record<string, unknown> | null\n tokenIn: Address\n tokenOut: string\n amountHuman: string\n slippagePercent: number\n executorAddress: Address\n purposeText: string\n}) {\n const tokenIn = getAddress(args.tokenIn)\n const executor = getAddress(args.executorAddress)\n\n const session = await loadFullCurveSessionForRpc(args.rpcUrl)\n if (!session?.curve?.router?.populateSwap) {\n throw new Error('Curve router is not available (load session failed or chain has no router).')\n }\n const { curve, wrappedNative } = session\n const wn = wrappedNative as string | undefined\n const tokenInId = toCurveRouterTokenId(tokenIn, wn)\n const outTrim = (args.tokenOut ?? '').trim()\n const tokenOutId = toCurveRouterTokenId(\n outTrim.toLowerCase() === ETH_PLACEHOLDER ? ETH_PLACEHOLDER : getAddress(outTrim),\n wn,\n )\n const isNativeIn = tokenInId.toLowerCase() === ETH_PLACEHOLDER\n const slip = args.slippagePercent\n if (!Number.isFinite(slip) || slip <= 0 || slip >= 100) {\n throw new Error('Slippage must be between 0 and 100 (exclusive).')\n }\n\n const swapPop = await curve.router.populateSwap(tokenInId, tokenOutId, args.amountHuman, slip)\n const swapBase = txToViemStep(swapPop as Parameters<typeof txToViemStep>[0])\n const rawTo = (swapPop as { to?: string | null })?.to\n if (rawTo == null || String(rawTo).trim() === '') {\n throw new Error('Curve populateSwap did not return a destination address (router).')\n }\n const routerAddr = getAddress(String(rawTo).trim() as `0x${string}`)\n\n const ch = defineChain({\n id: args.chainId,\n name: 'Destination',\n nativeCurrency: { decimals: 18, name: 'Ether', symbol: 'ETH' },\n rpcUrls: { default: { http: [args.rpcUrl] } },\n })\n const publicClient = createPublicClient({ chain: ch, transport: http(args.rpcUrl) })\n\n const erc20AllowanceAbi = parseAbi([\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function decimals() view returns (uint8)',\n ])\n const erc20ApproveAbi = parseAbi(['function approve(address spender, uint256 amount) returns (bool)'])\n\n const steps: CurveStep[] = []\n\n if (!isNativeIn) {\n const decimalsN = await publicClient.readContract({\n address: tokenIn,\n abi: erc20AllowanceAbi,\n functionName: 'decimals',\n })\n const amountWei = parseUnits(args.amountHuman, Number(decimalsN))\n const currentAllowance = await publicClient.readContract({\n address: tokenIn,\n abi: erc20AllowanceAbi,\n functionName: 'allowance',\n args: [executor, routerAddr],\n })\n if (currentAllowance < amountWei) {\n if (currentAllowance > 0n) {\n const dataReset = encodeFunctionData({\n abi: erc20ApproveAbi,\n functionName: 'approve',\n args: [routerAddr, 0n],\n })\n steps.push({ to: tokenIn, data: dataReset, value: 0n, kind: 'approve', fallbackGas: 80_000n })\n }\n const dataApprove = encodeFunctionData({\n abi: erc20ApproveAbi,\n functionName: 'approve',\n args: [routerAddr, amountWei],\n })\n steps.push({ to: tokenIn, data: dataApprove, value: 0n, kind: 'approve', fallbackGas: 80_000n })\n }\n }\n\n steps.push({\n ...swapBase,\n kind: 'exchange',\n routerSwap: true,\n fallbackGas: CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS,\n })\n\n const chainGasLimitRouter =\n args.chainDetail?.gasLimit != null &&\n Number.isFinite(Number(args.chainDetail.gasLimit)) &&\n Number(args.chainDetail.gasLimit) > 0\n ? Number(args.chainDetail.gasLimit)\n : undefined\n\n const gasLimitByIndex = new Map<number, bigint>()\n const n = steps.length\n const purposeSuffix =\n n === 1\n ? 'Curve (DAO): 1-tx — CurveRouterNG.exchange (native in or allowance already set).'\n : `Curve (DAO): ${n}-tx batch — ERC-20 approve Curve router, then CurveRouterNG.exchange.`\n\n const firstDataNo0x = steps[0]!.data.startsWith('0x') ? steps[0]!.data.slice(2) : steps[0]!.data\n const payableValueWei = steps.filter((s) => s.kind === 'exchange').reduce((a, s) => a + s.value, 0n)\n\n return buildEvmMultisignBatch({\n context: {\n chainCategory: 'evm',\n keyGen: args.keyGen,\n purposeText: args.purposeText,\n chainId: args.chainId,\n rpcUrl: args.rpcUrl,\n executorAddress: executor,\n chainDetail: args.chainDetail,\n useCustomGas: args.useCustomGas,\n customGasChainDetails: args.customGasChainDetails,\n },\n steps,\n purposeSuffix,\n firstMsgRawNo0x: firstDataNo0x,\n destinationAddress: steps[0]!.to,\n payableValueWei: payableValueWei > 0n ? payableValueWei : undefined,\n resolveGasLimit: async ({ step, index, estimatedGas }) => {\n const s = step as CurveStep\n let gasLimitI: bigint\n if (s.kind === 'exchange') {\n gasLimitI = routerSwapGasLimitFromEstimate(estimatedGas, chainGasLimitRouter)\n } else {\n gasLimitI = estimatedGas\n }\n gasLimitByIndex.set(index, gasLimitI)\n return gasLimitI\n },\n buildBatchMeta: ({ step, index, gasLimit }) => {\n const s = step as CurveStep\n const gl = gasLimitByIndex.get(index) ?? gasLimit\n if (s.kind === 'approve') {\n return {\n signatureText: JSON.stringify({\n kind: 'CurveDao',\n name: 'ERC20.approve',\n to: 'Curve router',\n function: 'approve(address spender, uint256 amount)',\n spender: routerAddr,\n amountHuman: args.amountHuman,\n note: 'Allowance approved for this swap amount only (not unlimited).',\n }),\n evm: { type: 'curve_dao_erc20_approve', version: 1, chainId: String(args.chainId) },\n }\n }\n return {\n signatureText: JSON.stringify({\n kind: 'CurveDao',\n name: 'CurveRouterNG.exchange',\n note: 'Calldata from @curvefi/api `router.populateSwap` (same on-chain as router `exchange`).',\n }),\n evm: { type: 'curve_dao_router_exchange', version: 1, chainId: String(args.chainId) },\n curveDao: {\n slippagePercent: slip,\n amountHuman: args.amountHuman,\n tokenIn: tokenInId,\n tokenOut: tokenOutId,\n isNativeIn,\n gasBuildExchange: { baseGasUnits: gl.toString() },\n },\n }\n },\n })\n}\n","import type { ProtocolModule } from '../../../core/types.js'\nimport { registerProtocolModule } from '../../../core/registry.js'\nimport { isCurveApiChainSupported } from './support.js'\n\nexport * from './support.js'\nexport * from './swapDestinations.js'\nexport * from './apiSession.js'\nexport * from './purpose.js'\nexport * from './executeHelpers.js'\nexport * from './multisign.js'\n\nexport const CURVE_DAO_PROTOCOL_ID = 'curve-dao'\n\nexport const curveDaoProtocolModule: ProtocolModule = {\n id: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n isChainSupported(ctx) {\n if (ctx.chainCategory !== 'evm') return false\n return isCurveApiChainSupported(ctx.chainId)\n },\n isTokenSupported(token) {\n if (token.category !== 'evm') return false\n return token.kind === 'native' || token.kind === 'erc20'\n },\n actions: [\n {\n id: 'curve-dao.swap',\n protocolId: CURVE_DAO_PROTOCOL_ID,\n chainCategory: 'evm',\n description: 'Swap via Curve Router NG (optional ERC-20 approve batch)',\n commonParams: ['keyGen', 'purposeText', 'useCustomGas'],\n params: {\n tokenIn: { type: 'address', required: true, description: 'ERC-20 token in (native uses WETH path in UI)' },\n tokenOut: { type: 'address', required: true, description: 'Output token or 0xeeee… native placeholder' },\n amountHuman: { type: 'string', required: true, description: 'Human-readable input amount' },\n slippagePercent: { type: 'number', required: true, description: 'Slippage percent (0–100 exclusive)' },\n },\n },\n ],\n}\n\nregisterProtocolModule(curveDaoProtocolModule)\n\nimport { buildEvmMultisignBodyCurveDaoBatch } from './multisign.js'\nimport { loadFullCurveSessionForRpc } from './apiSession.js'\n\nexport const curveDao = {\n buildSwapMultisignBody: buildEvmMultisignBodyCurveDaoBatch,\n isChainSupported: isCurveApiChainSupported,\n loadSession: loadFullCurveSessionForRpc,\n}\n"]}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { M as MultisignBuildResult, d as ProtocolModule } from '../../../types-Ce2qNHai.cjs';
|
|
2
|
+
import { K as KeyGenSubsetForPermit } from '../../../keygen-CfNp8yKJ.cjs';
|
|
3
|
+
import { E as EvmChainDetail } from '../../../types-B8idm_gu.cjs';
|
|
4
|
+
import { Address } from 'viem';
|
|
5
|
+
export { P as ProposalTxParams } from '../../../txParams-BC7ogvdR.cjs';
|
|
6
|
+
|
|
7
|
+
declare function isCurveApiChainSupported(chainId: string | number | bigint | null | undefined): boolean;
|
|
8
|
+
|
|
9
|
+
declare const CURVE_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
10
|
+
/** Map token in list to the address shape Curve uses in pool graphs (native → 0xeeee…). */
|
|
11
|
+
declare function toCurveTokenKey(tokenInAddress: string, wrappedNative: string | undefined): string;
|
|
12
|
+
/**
|
|
13
|
+
* Router / `getBestRouteAndOutput` expect the same coin id as the pool graph: wrapped native
|
|
14
|
+
* is represented as `0xeeee…`, not the WETH (etc.) contract. Without this, route discovery can
|
|
15
|
+
* return an empty route while BFS (which uses `toCurveTokenKey`) still finds a path.
|
|
16
|
+
*/
|
|
17
|
+
declare function toCurveRouterTokenId(tokenAddress: string, wrappedNative: string | undefined): string;
|
|
18
|
+
/**
|
|
19
|
+
* Turn the user’s decimal string into a canonical form using **this chain’s** token-in decimals
|
|
20
|
+
* (from the asset row). `@curvefi/api` uses the same for `parseUnits` when building routes; an
|
|
21
|
+
* over-long fraction (e.g. 1e-8 on USDC) can make internal calls fail and yield an empty route / 0.0.
|
|
22
|
+
*/
|
|
23
|
+
declare function normalizeCurveRouterAmountString(raw: string, tokenInDecimals: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Build graph from the same pool list the Curve router uses (`getPool` / `getPoolList` on the
|
|
26
|
+
* public `@curvefi/api` instance; `getPoolsData` is internal).
|
|
27
|
+
*/
|
|
28
|
+
declare function buildCurveLiquidityGraphFromApi(curve: {
|
|
29
|
+
getPoolList: () => string[];
|
|
30
|
+
getPool: (id: string) => {
|
|
31
|
+
underlyingCoinAddresses: string[] | undefined;
|
|
32
|
+
wrappedCoinAddresses: string[] | undefined;
|
|
33
|
+
};
|
|
34
|
+
}): Map<string, Set<string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Add bidirectional edge between the SDK's native placeholder coin and WETH, when the chain uses
|
|
37
|
+
* wrapped native in pools (mirrors the Curve dialog graph).
|
|
38
|
+
*/
|
|
39
|
+
declare function addNativeWethBridge(adj: Map<string, Set<string>>, wrappedNative: string | undefined): void;
|
|
40
|
+
/** True when the token key appears in the graph with at least one swap neighbor. */
|
|
41
|
+
declare function isCurveTokenKeySwappable(swappableNodeKeys: ReadonlySet<string>, graphTokenKey: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* All token keys in `adj` that have at least one pool neighbor (candidates to start a path from).
|
|
44
|
+
*/
|
|
45
|
+
declare function swappableCurveGraphNodeKeys(adj: Map<string, Set<string>>): Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* All tokens in the same connected component as `start` (excluding `start`), for router discovery.
|
|
48
|
+
*/
|
|
49
|
+
declare function bfsCurveSwapDestinations(adj: Map<string, Set<string>>, start: string): Set<string>;
|
|
50
|
+
type CurveDestToken = {
|
|
51
|
+
address: string;
|
|
52
|
+
symbol: string;
|
|
53
|
+
name: string;
|
|
54
|
+
/** From Curve `getCoinsData` (on-chain), when available. */
|
|
55
|
+
decimals: number | null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Live `@curvefi/api` instance with pools already fetched, plus the routing graph. */
|
|
59
|
+
type CurveFullSession = {
|
|
60
|
+
/** Same reference used for getCoinsData / router; pools already loaded. */
|
|
61
|
+
curve: any;
|
|
62
|
+
adj: Map<string, Set<string>>;
|
|
63
|
+
swappableNodeKeys: ReadonlySet<string>;
|
|
64
|
+
wrappedNative: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Fetches all factory pools in parallel (best-effort; failures are ignored per factory,
|
|
68
|
+
* same as the Curve dialog).
|
|
69
|
+
*/
|
|
70
|
+
declare function fetchAllCurvePools(curve: {
|
|
71
|
+
factory: {
|
|
72
|
+
fetchPools: () => Promise<unknown>;
|
|
73
|
+
};
|
|
74
|
+
crvUSDFactory: {
|
|
75
|
+
fetchPools: () => Promise<unknown>;
|
|
76
|
+
};
|
|
77
|
+
EYWAFactory: {
|
|
78
|
+
fetchPools: () => Promise<unknown>;
|
|
79
|
+
};
|
|
80
|
+
cryptoFactory: {
|
|
81
|
+
fetchPools: () => Promise<unknown>;
|
|
82
|
+
};
|
|
83
|
+
twocryptoFactory: {
|
|
84
|
+
fetchPools: () => Promise<unknown>;
|
|
85
|
+
};
|
|
86
|
+
tricryptoFactory: {
|
|
87
|
+
fetchPools: () => Promise<unknown>;
|
|
88
|
+
};
|
|
89
|
+
stableNgFactory: {
|
|
90
|
+
fetchPools: () => Promise<unknown>;
|
|
91
|
+
};
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* One init + `fetchAllCurvePools` + graph build. Reuse this session for the asset list and the
|
|
95
|
+
* Curve dialog to avoid duplicating the Curve API work.
|
|
96
|
+
*/
|
|
97
|
+
declare function loadFullCurveSessionForRpc(rpcUrl: string): Promise<CurveFullSession | null>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* One-line prefill for multi-sign "Purpose" on Curve (DAO) swap (user may add detail below).
|
|
101
|
+
* Matches the spirit of `buildUniswapV4PurposePrefill` for Uniswap.
|
|
102
|
+
*/
|
|
103
|
+
declare function buildCurveDaoPurposePrefill(args: {
|
|
104
|
+
tokenInSymbol: string;
|
|
105
|
+
tokenOutSymbol: string;
|
|
106
|
+
amountIn: string;
|
|
107
|
+
/** Quoted output from `getBestRouteAndOutput` (decimal string, no symbol). */
|
|
108
|
+
quoteOutAmount: string | null;
|
|
109
|
+
slippageInput: string;
|
|
110
|
+
chainName: string;
|
|
111
|
+
chainId: number;
|
|
112
|
+
}): string;
|
|
113
|
+
|
|
114
|
+
declare const CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS = 1200000n;
|
|
115
|
+
declare function isCurveDaoSwapEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
|
|
116
|
+
declare function isCurveDaoErc20ApproveEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
|
|
117
|
+
declare function resolveCurveDaoRouterGasUnitsFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): bigint | null;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Build `POST /multiSignRequest` body: optional ERC-20 approve(s) to the Curve router, then
|
|
121
|
+
* `CurveRouterNG.exchange` via `@curvefi/api` `router.populateSwap`.
|
|
122
|
+
*/
|
|
123
|
+
declare function buildEvmMultisignBodyCurveDaoBatch(args: {
|
|
124
|
+
keyGen: KeyGenSubsetForPermit;
|
|
125
|
+
chainId: number;
|
|
126
|
+
rpcUrl: string;
|
|
127
|
+
chainDetail: EvmChainDetail;
|
|
128
|
+
useCustomGas: boolean;
|
|
129
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
130
|
+
tokenIn: Address;
|
|
131
|
+
tokenOut: string;
|
|
132
|
+
amountHuman: string;
|
|
133
|
+
slippagePercent: number;
|
|
134
|
+
executorAddress: Address;
|
|
135
|
+
purposeText: string;
|
|
136
|
+
}): Promise<MultisignBuildResult>;
|
|
137
|
+
|
|
138
|
+
declare const CURVE_DAO_PROTOCOL_ID = "curve-dao";
|
|
139
|
+
declare const curveDaoProtocolModule: ProtocolModule;
|
|
140
|
+
|
|
141
|
+
declare const curveDao: {
|
|
142
|
+
buildSwapMultisignBody: typeof buildEvmMultisignBodyCurveDaoBatch;
|
|
143
|
+
isChainSupported: typeof isCurveApiChainSupported;
|
|
144
|
+
loadSession: typeof loadFullCurveSessionForRpc;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export { CURVE_DAO_PROTOCOL_ID, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, type CurveDestToken, type CurveFullSession, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveDaoBatch, curveDao, curveDaoProtocolModule, fetchAllCurvePools, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { M as MultisignBuildResult, d as ProtocolModule } from '../../../types-Ce2qNHai.js';
|
|
2
|
+
import { K as KeyGenSubsetForPermit } from '../../../keygen-DsINazx8.js';
|
|
3
|
+
import { E as EvmChainDetail } from '../../../types-5u863Fd9.js';
|
|
4
|
+
import { Address } from 'viem';
|
|
5
|
+
export { P as ProposalTxParams } from '../../../txParams-BC7ogvdR.js';
|
|
6
|
+
|
|
7
|
+
declare function isCurveApiChainSupported(chainId: string | number | bigint | null | undefined): boolean;
|
|
8
|
+
|
|
9
|
+
declare const CURVE_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
10
|
+
/** Map token in list to the address shape Curve uses in pool graphs (native → 0xeeee…). */
|
|
11
|
+
declare function toCurveTokenKey(tokenInAddress: string, wrappedNative: string | undefined): string;
|
|
12
|
+
/**
|
|
13
|
+
* Router / `getBestRouteAndOutput` expect the same coin id as the pool graph: wrapped native
|
|
14
|
+
* is represented as `0xeeee…`, not the WETH (etc.) contract. Without this, route discovery can
|
|
15
|
+
* return an empty route while BFS (which uses `toCurveTokenKey`) still finds a path.
|
|
16
|
+
*/
|
|
17
|
+
declare function toCurveRouterTokenId(tokenAddress: string, wrappedNative: string | undefined): string;
|
|
18
|
+
/**
|
|
19
|
+
* Turn the user’s decimal string into a canonical form using **this chain’s** token-in decimals
|
|
20
|
+
* (from the asset row). `@curvefi/api` uses the same for `parseUnits` when building routes; an
|
|
21
|
+
* over-long fraction (e.g. 1e-8 on USDC) can make internal calls fail and yield an empty route / 0.0.
|
|
22
|
+
*/
|
|
23
|
+
declare function normalizeCurveRouterAmountString(raw: string, tokenInDecimals: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* Build graph from the same pool list the Curve router uses (`getPool` / `getPoolList` on the
|
|
26
|
+
* public `@curvefi/api` instance; `getPoolsData` is internal).
|
|
27
|
+
*/
|
|
28
|
+
declare function buildCurveLiquidityGraphFromApi(curve: {
|
|
29
|
+
getPoolList: () => string[];
|
|
30
|
+
getPool: (id: string) => {
|
|
31
|
+
underlyingCoinAddresses: string[] | undefined;
|
|
32
|
+
wrappedCoinAddresses: string[] | undefined;
|
|
33
|
+
};
|
|
34
|
+
}): Map<string, Set<string>>;
|
|
35
|
+
/**
|
|
36
|
+
* Add bidirectional edge between the SDK's native placeholder coin and WETH, when the chain uses
|
|
37
|
+
* wrapped native in pools (mirrors the Curve dialog graph).
|
|
38
|
+
*/
|
|
39
|
+
declare function addNativeWethBridge(adj: Map<string, Set<string>>, wrappedNative: string | undefined): void;
|
|
40
|
+
/** True when the token key appears in the graph with at least one swap neighbor. */
|
|
41
|
+
declare function isCurveTokenKeySwappable(swappableNodeKeys: ReadonlySet<string>, graphTokenKey: string): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* All token keys in `adj` that have at least one pool neighbor (candidates to start a path from).
|
|
44
|
+
*/
|
|
45
|
+
declare function swappableCurveGraphNodeKeys(adj: Map<string, Set<string>>): Set<string>;
|
|
46
|
+
/**
|
|
47
|
+
* All tokens in the same connected component as `start` (excluding `start`), for router discovery.
|
|
48
|
+
*/
|
|
49
|
+
declare function bfsCurveSwapDestinations(adj: Map<string, Set<string>>, start: string): Set<string>;
|
|
50
|
+
type CurveDestToken = {
|
|
51
|
+
address: string;
|
|
52
|
+
symbol: string;
|
|
53
|
+
name: string;
|
|
54
|
+
/** From Curve `getCoinsData` (on-chain), when available. */
|
|
55
|
+
decimals: number | null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Live `@curvefi/api` instance with pools already fetched, plus the routing graph. */
|
|
59
|
+
type CurveFullSession = {
|
|
60
|
+
/** Same reference used for getCoinsData / router; pools already loaded. */
|
|
61
|
+
curve: any;
|
|
62
|
+
adj: Map<string, Set<string>>;
|
|
63
|
+
swappableNodeKeys: ReadonlySet<string>;
|
|
64
|
+
wrappedNative: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Fetches all factory pools in parallel (best-effort; failures are ignored per factory,
|
|
68
|
+
* same as the Curve dialog).
|
|
69
|
+
*/
|
|
70
|
+
declare function fetchAllCurvePools(curve: {
|
|
71
|
+
factory: {
|
|
72
|
+
fetchPools: () => Promise<unknown>;
|
|
73
|
+
};
|
|
74
|
+
crvUSDFactory: {
|
|
75
|
+
fetchPools: () => Promise<unknown>;
|
|
76
|
+
};
|
|
77
|
+
EYWAFactory: {
|
|
78
|
+
fetchPools: () => Promise<unknown>;
|
|
79
|
+
};
|
|
80
|
+
cryptoFactory: {
|
|
81
|
+
fetchPools: () => Promise<unknown>;
|
|
82
|
+
};
|
|
83
|
+
twocryptoFactory: {
|
|
84
|
+
fetchPools: () => Promise<unknown>;
|
|
85
|
+
};
|
|
86
|
+
tricryptoFactory: {
|
|
87
|
+
fetchPools: () => Promise<unknown>;
|
|
88
|
+
};
|
|
89
|
+
stableNgFactory: {
|
|
90
|
+
fetchPools: () => Promise<unknown>;
|
|
91
|
+
};
|
|
92
|
+
}): Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* One init + `fetchAllCurvePools` + graph build. Reuse this session for the asset list and the
|
|
95
|
+
* Curve dialog to avoid duplicating the Curve API work.
|
|
96
|
+
*/
|
|
97
|
+
declare function loadFullCurveSessionForRpc(rpcUrl: string): Promise<CurveFullSession | null>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* One-line prefill for multi-sign "Purpose" on Curve (DAO) swap (user may add detail below).
|
|
101
|
+
* Matches the spirit of `buildUniswapV4PurposePrefill` for Uniswap.
|
|
102
|
+
*/
|
|
103
|
+
declare function buildCurveDaoPurposePrefill(args: {
|
|
104
|
+
tokenInSymbol: string;
|
|
105
|
+
tokenOutSymbol: string;
|
|
106
|
+
amountIn: string;
|
|
107
|
+
/** Quoted output from `getBestRouteAndOutput` (decimal string, no symbol). */
|
|
108
|
+
quoteOutAmount: string | null;
|
|
109
|
+
slippageInput: string;
|
|
110
|
+
chainName: string;
|
|
111
|
+
chainId: number;
|
|
112
|
+
}): string;
|
|
113
|
+
|
|
114
|
+
declare const CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS = 1200000n;
|
|
115
|
+
declare function isCurveDaoSwapEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
|
|
116
|
+
declare function isCurveDaoErc20ApproveEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
|
|
117
|
+
declare function resolveCurveDaoRouterGasUnitsFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): bigint | null;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Build `POST /multiSignRequest` body: optional ERC-20 approve(s) to the Curve router, then
|
|
121
|
+
* `CurveRouterNG.exchange` via `@curvefi/api` `router.populateSwap`.
|
|
122
|
+
*/
|
|
123
|
+
declare function buildEvmMultisignBodyCurveDaoBatch(args: {
|
|
124
|
+
keyGen: KeyGenSubsetForPermit;
|
|
125
|
+
chainId: number;
|
|
126
|
+
rpcUrl: string;
|
|
127
|
+
chainDetail: EvmChainDetail;
|
|
128
|
+
useCustomGas: boolean;
|
|
129
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
130
|
+
tokenIn: Address;
|
|
131
|
+
tokenOut: string;
|
|
132
|
+
amountHuman: string;
|
|
133
|
+
slippagePercent: number;
|
|
134
|
+
executorAddress: Address;
|
|
135
|
+
purposeText: string;
|
|
136
|
+
}): Promise<MultisignBuildResult>;
|
|
137
|
+
|
|
138
|
+
declare const CURVE_DAO_PROTOCOL_ID = "curve-dao";
|
|
139
|
+
declare const curveDaoProtocolModule: ProtocolModule;
|
|
140
|
+
|
|
141
|
+
declare const curveDao: {
|
|
142
|
+
buildSwapMultisignBody: typeof buildEvmMultisignBodyCurveDaoBatch;
|
|
143
|
+
isChainSupported: typeof isCurveApiChainSupported;
|
|
144
|
+
loadSession: typeof loadFullCurveSessionForRpc;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export { CURVE_DAO_PROTOCOL_ID, CURVE_NATIVE_PLACEHOLDER, CURVE_ROUTER_EXCHANGE_DEFAULT_GAS_UNITS, type CurveDestToken, type CurveFullSession, addNativeWethBridge, bfsCurveSwapDestinations, buildCurveDaoPurposePrefill, buildCurveLiquidityGraphFromApi, buildEvmMultisignBodyCurveDaoBatch, curveDao, curveDaoProtocolModule, fetchAllCurvePools, isCurveApiChainSupported, isCurveApiChainSupported as isCurveDaoChainSupported, isCurveDaoErc20ApproveEvmSignRequest, isCurveDaoSwapEvmSignRequest, isCurveTokenKeySwappable, loadFullCurveSessionForRpc, normalizeCurveRouterAmountString, resolveCurveDaoRouterGasUnitsFromSignRequest, swappableCurveGraphNodeKeys, toCurveRouterTokenId, toCurveTokenKey };
|