@provablehq/aleo-bridge-sdk 0.8.0-rc.0
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 +21 -0
- package/README.md +325 -0
- package/dist/agent/index.d.ts +22 -0
- package/dist/agent/index.js +7 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-KG3LFIU5.js +61 -0
- package/dist/chunk-KG3LFIU5.js.map +1 -0
- package/dist/createBridgeClient-CjHY-JvW.d.ts +779 -0
- package/dist/index.d.ts +421 -0
- package/dist/index.js +1627 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +26 -0
- package/dist/mcp/index.js +13 -0
- package/dist/mcp/index.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/clients/createBridgeClient.ts","../src/actions/protocolDiscovery.ts","../src/errors/bridgeErrors.ts","../src/utils/units.ts","../src/actions/prepareTransfer.ts","../src/actions/evmHyperlane.ts","../src/actions/evmXReserve.ts","../src/utils/xreserve.ts","../src/actions/xreservePrivateMint.ts","../src/actions/xreserveBurn.ts","../src/utils/hyperlane.ts","../src/actions/aleoHyperlane.ts","../src/clients/decorators/bridge.ts","../src/registry/default.ts","../src/registry/validate.ts"],"sourcesContent":["import { createClient, createTransport, type Client } from '@provablehq/veil-core'\nimport { bridgeActions, type BridgeActions } from './decorators/bridge.js'\nimport { DEFAULT_BRIDGE_REGISTRY } from '../registry/default.js'\nimport { validateBridgeRegistry } from '../registry/validate.js'\nimport type { BridgeExecutors } from '../types/evm.js'\nimport type { BridgeEnvironment, BridgeRegistry } from '../types/protocol.js'\nimport type { XReserveHttpTransport } from '../types/xreserve.js'\n\n/**\n * Configures a protocol bridge client.\n *\n * @property environment Routes and assets exposed by default. Defaults to `mainnet`.\n * @property registry Reviewed protocol deployment snapshot. Defaults to {@link DEFAULT_BRIDGE_REGISTRY}.\n * @property executors Optional wallet capabilities used by fund-moving protocol actions.\n * @property xReserveHttpTransport Optional fetch-compatible transport used for Circle attestation requests.\n * @property key Client identifier. Defaults to `bridge`.\n * @property name Human-readable client name. Defaults to `Bridge Client`.\n */\nexport type BridgeClientConfig = {\n environment?: BridgeEnvironment | undefined\n registry?: BridgeRegistry | undefined\n executors?: BridgeExecutors | undefined\n xReserveHttpTransport?: XReserveHttpTransport | undefined\n key?: string | undefined\n name?: string | undefined\n}\n\ntype BridgeClientState = {\n environment: BridgeEnvironment\n registry: BridgeRegistry\n}\n\n/**\n * Exposes protocol bridge discovery, planning, and configured execution actions.\n *\n * The client retains Veil's `extend()` composition model. Its base transport\n * is reserved for protocol executors. Discovery and planning remain pure and\n * local; execution actions require the corresponding injected capability.\n */\nexport type BridgeClient = Client<BridgeActions & BridgeClientState>\n\nfunction localBridgeTransport() {\n return createTransport({\n key: 'protocolBridge',\n name: 'Protocol Bridge Transport',\n type: 'protocolBridge',\n request: async ({ method }) => {\n throw new Error(`Protocol bridge method is not implemented: ${method}`)\n },\n })\n}\n\n/**\n * Creates a protocol-oriented bridge client for xReserve and Hyperlane.\n *\n * Discovery and transfer planning read the configured registry without network\n * access. An injected EVM executor enables Ethereum Hyperlane quote and execution\n * actions without exposing private keys to the client. An injected Aleo wallet\n * client enables user-authorized private USDCx mints and USDCx burns.\n *\n * @param config Optional environment, registry, executors, and client identity.\n * @returns A bridge client exposing discovery, planning, and configured protocol actions.\n * @throws BridgeError When the supplied registry has invalid references.\n *\n * @example\n * const bridge = createBridgeClient({ environment: 'testnet' })\n * const routes = bridge.getRoutes({ protocol: 'xreserve' })\n */\nexport function createBridgeClient(config: BridgeClientConfig = {}): BridgeClient {\n const {\n environment = 'mainnet',\n registry = DEFAULT_BRIDGE_REGISTRY,\n executors = {},\n xReserveHttpTransport,\n key = 'bridge',\n name = 'Bridge Client',\n } = config\n const validated = validateBridgeRegistry(registry)\n const client = createClient({ transport: localBridgeTransport(), key, name })\n return client.extend((inner) => ({\n environment,\n registry: validated,\n ...bridgeActions(inner, { environment, registry: validated, executors, xReserveHttpTransport }),\n })) as BridgeClient\n}\n","import type {\n BridgeEnvironment,\n BridgeProtocol,\n BridgeRegistry,\n ProtocolBridgeAsset,\n ProtocolBridgeRoute,\n} from '../types/protocol.js'\n\n/** Filters the protocol asset catalog. */\nexport type GetProtocolAssetsParameters = {\n environment?: BridgeEnvironment | undefined\n chainId?: string | undefined\n symbol?: string | undefined\n}\n\n/** Filters directional protocol routes. */\nexport type GetProtocolRoutesParameters = {\n environment?: BridgeEnvironment | undefined\n protocol?: BridgeProtocol | undefined\n sourceChainId?: string | undefined\n destinationChainId?: string | undefined\n symbol?: string | undefined\n includeUnavailable?: boolean | undefined\n}\n\n/**\n * Lists chain-specific assets from a protocol bridge registry.\n *\n * Pure and local. Filters match identifiers and symbols case-insensitively.\n *\n * @param registry Reviewed registry snapshot.\n * @param params Optional environment, chain, and symbol filters.\n * @returns Matching assets in registry order.\n *\n * @example\n * const usdcx = getProtocolAssets(registry, { symbol: 'USDCx' })\n */\nexport function getProtocolAssets(\n registry: BridgeRegistry,\n params: GetProtocolAssetsParameters = {},\n): ProtocolBridgeAsset[] {\n const chains = new Map(registry.chains.map((chain) => [chain.id, chain]))\n const chainId = params.chainId?.toLowerCase()\n const symbol = params.symbol?.toLowerCase()\n return registry.assets.filter((asset) => {\n const chain = chains.get(asset.chainId)\n return (\n (params.environment == null || chain?.environment === params.environment) &&\n (chainId == null || asset.chainId.toLowerCase() === chainId) &&\n (symbol == null || asset.symbol.toLowerCase() === symbol)\n )\n })\n}\n\n/**\n * Lists directional routes from a protocol bridge registry.\n *\n * Pure and local. Routes marked `disabled` are omitted unless\n * `includeUnavailable` is true; `metadata-required` routes remain visible so\n * applications can distinguish known protocol support from execution readiness.\n *\n * @param registry Reviewed registry snapshot.\n * @param params Optional protocol, environment, endpoint, and symbol filters.\n * @returns Matching directional routes in registry order.\n *\n * @example\n * const outbound = getProtocolRoutes(registry, { sourceChainId: 'aleo' })\n */\nexport function getProtocolRoutes(\n registry: BridgeRegistry,\n params: GetProtocolRoutesParameters = {},\n): ProtocolBridgeRoute[] {\n const assets = new Map(registry.assets.map((asset) => [asset.id, asset]))\n const sourceChainId = params.sourceChainId?.toLowerCase()\n const destinationChainId = params.destinationChainId?.toLowerCase()\n const symbol = params.symbol?.toLowerCase()\n return registry.routes.filter((route) => {\n const source = assets.get(route.sourceAssetId)!\n const destination = assets.get(route.destinationAssetId)!\n return (\n (params.includeUnavailable === true || route.availability !== 'disabled') &&\n (params.environment == null || route.environment === params.environment) &&\n (params.protocol == null || route.protocol === params.protocol) &&\n (sourceChainId == null || source.chainId.toLowerCase() === sourceChainId) &&\n (destinationChainId == null || destination.chainId.toLowerCase() === destinationChainId) &&\n (symbol == null || source.symbol.toLowerCase() === symbol || destination.symbol.toLowerCase() === symbol)\n )\n })\n}\n","/**\n * Represents protocol bridge configuration and planning failures.\n *\n * @example\n * try {\n * bridge.prepareTransfer(params)\n * } catch (error) {\n * if (error instanceof BridgeError) console.error(error.message)\n * }\n */\nexport class BridgeError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n this.name = 'BridgeError'\n }\n}\n","import { BridgeError } from '../errors/bridgeErrors.js'\n\n/**\n * Converts a decimal amount string into the asset's atomic units.\n *\n * Protocol inputs use display decimals (`\"0.5\"` ALEO), while onchain calls\n * use atomic integers (`500000n` microcredits). String arithmetic keeps the\n * conversion exact without floating-point rounding. Pure and local.\n *\n * @param amount Decimal amount as a string (e.g. `\"0.5\"`, `\"100\"`).\n * @param decimals The asset's display decimals (e.g. 6 for ALEO/USDC, 18 for ETH).\n * @returns The atomic amount as a bigint.\n * @throws BridgeError When the string is not a plain decimal number, or has\n * more fractional digits than the asset supports (that precision cannot be\n * represented on chain).\n *\n * @example\n * parseDecimalAmount('0.5', 6) // 500000n\n * parseDecimalAmount('100', 6) // 100000000n\n */\nexport function parseDecimalAmount(amount: string, decimals: number): bigint {\n const match = /^(\\d+)(?:\\.(\\d+))?$/.exec(amount.trim())\n if (!match) {\n throw new BridgeError(`Invalid decimal amount \"${amount}\"`)\n }\n const whole = match[1]!\n const frac = match[2] ?? ''\n if (frac.length > decimals) {\n throw new BridgeError(\n `Amount \"${amount}\" has ${frac.length} fractional digits but the asset supports ${decimals}`,\n )\n }\n return BigInt(whole + frac.padEnd(decimals, '0'))\n}\n","import { BridgeError } from '../errors/bridgeErrors.js'\nimport type {\n BridgeExecutionStep,\n BridgeRegistry,\n BridgeTransferPlan,\n PrepareTransferParameters,\n ProtocolBridgeAsset,\n ProtocolBridgeChain,\n ProtocolBridgeRoute,\n} from '../types/protocol.js'\nimport { parseDecimalAmount } from '../utils/units.js'\n\nfunction executor(chain: ProtocolBridgeChain): 'aleo-wallet' | 'evm-wallet' | 'solana-wallet' {\n if (chain.family === 'aleo') return 'aleo-wallet'\n if (chain.family === 'evm') return 'evm-wallet'\n return 'solana-wallet'\n}\n\nfunction xreserveSteps(\n route: ProtocolBridgeRoute,\n source: ProtocolBridgeAsset,\n destination: ProtocolBridgeAsset,\n sourceChain: ProtocolBridgeChain,\n destinationChain: ProtocolBridgeChain,\n mintMode: BridgeTransferPlan['mintMode'],\n): BridgeExecutionStep[] {\n if (sourceChain.family === 'evm' && destinationChain.family === 'aleo') {\n return [\n { key: 'source-approval', kind: 'approve', chainId: source.chainId, executor: 'evm-wallet', description: `Approve the Circle xReserve contract to spend ${source.symbol}.`, irreversible: false },\n { key: 'source-deposit', kind: 'deposit', chainId: source.chainId, executor: 'evm-wallet', description: `Deposit ${source.symbol} into Circle xReserve for Aleo.`, irreversible: true },\n { key: 'deposit-attestation', kind: 'wait-attestation', executor: 'protocol', description: 'Wait for Circle to attest the confirmed reserve deposit.', irreversible: false },\n { key: 'destination-mint', kind: 'mint', chainId: destination.chainId, executor: mintMode === 'private' ? 'aleo-wallet' : 'protocol', description: mintMode === 'private' ? `Submit private_mint to mint attested ${destination.symbol} through the shielded wrapper.` : `Wait for attested ${destination.symbol} to mint as an Aleo ${mintMode === 'record' ? 'record' : 'public balance'}.`, irreversible: false },\n ]\n }\n if (sourceChain.family === 'aleo' && destinationChain.family === 'evm') {\n return [\n { key: 'source-burn', kind: 'burn', chainId: source.chainId, executor: 'aleo-wallet', description: `Burn ${source.symbol} and create the xReserve withdrawal intent; private burn is the default.`, irreversible: true },\n { key: 'withdrawal-attestation', kind: 'wait-attestation', executor: 'protocol', description: 'Wait for the Aleo burn attestation service to forward the accepted burn to Circle.', irreversible: false },\n { key: 'destination-withdrawal', kind: 'withdraw', chainId: destination.chainId, executor: 'protocol', description: `Wait for Circle to release ${destination.symbol} to the native recipient.`, irreversible: false },\n { key: 'destination-confirmation', kind: 'confirm-delivery', chainId: destination.chainId, executor: 'protocol', description: 'Confirm the destination USDC balance change.', irreversible: false },\n ]\n }\n throw new BridgeError(`Unsupported xReserve route shape: ${route.id}`)\n}\n\nfunction hyperlaneSteps(\n source: ProtocolBridgeAsset,\n destination: ProtocolBridgeAsset,\n sourceChain: ProtocolBridgeChain,\n destinationChain: ProtocolBridgeChain,\n): BridgeExecutionStep[] {\n const steps: BridgeExecutionStep[] = []\n if (source.kind === 'token' && sourceChain.family !== 'aleo') {\n steps.push({\n key: 'source-approval',\n kind: 'approve',\n chainId: source.chainId,\n executor: executor(sourceChain),\n description: `Approve the Hyperlane Warp Route to spend ${source.symbol}.`,\n irreversible: false,\n })\n }\n steps.push(\n { key: 'source-dispatch', kind: 'dispatch', chainId: source.chainId, executor: executor(sourceChain), description: `Dispatch ${source.symbol} through its Hyperlane Warp Route.`, irreversible: true },\n { key: 'message-delivery', kind: 'wait-delivery', executor: 'protocol', description: 'Wait for the Hyperlane message to be relayed and processed.', irreversible: false },\n { key: 'destination-confirmation', kind: 'confirm-delivery', chainId: destination.chainId, executor: 'protocol', description: `Confirm relayer delivery of ${destination.symbol} on the destination chain.`, irreversible: false },\n )\n return steps\n}\n\n/**\n * Prepares the ordered operations for a protocol bridge transfer.\n *\n * Pure and local: validates the route, amount, and recipient, then returns a\n * serializable plan. It does not query fees, sign, submit, or move funds.\n * Routes marked `metadata-required` can be planned but cannot be executed until\n * a later protocol adapter validates their deployment metadata.\n *\n * @param registry Reviewed registry snapshot.\n * @param params Route, decimal amount, recipient, and optional sender/privacy mode.\n * @returns A resumable transfer plan with the irreversible step identified.\n * @throws BridgeError When the route is missing or disabled, the amount is zero\n * or malformed, its precision exceeds either asset, or the recipient fails validation.\n *\n * @example\n * const plan = prepareTransfer(registry, {\n * routeId: 'xreserve:ethereum/usdc->aleo/usdcx',\n * amount: '25',\n * recipient: 'aleo1...',\n * })\n */\nexport function prepareTransfer(\n registry: BridgeRegistry,\n params: PrepareTransferParameters,\n): BridgeTransferPlan {\n const route = registry.routes.find((entry) => entry.id === params.routeId)\n if (!route) throw new BridgeError(`Unknown bridge route: ${params.routeId}`)\n if (route.availability === 'disabled') throw new BridgeError(`Bridge route is disabled: ${params.routeId}`)\n\n const sourceAsset = registry.assets.find((asset) => asset.id === route.sourceAssetId)!\n const destinationAsset = registry.assets.find((asset) => asset.id === route.destinationAssetId)!\n const sourceChain = registry.chains.find((chain) => chain.id === sourceAsset.chainId)!\n const destinationChain = registry.chains.find((chain) => chain.id === destinationAsset.chainId)!\n\n if (params.privateRecipient === true && params.mintMode != null && params.mintMode !== 'private') {\n throw new BridgeError('privateRecipient conflicts with the selected mintMode')\n }\n const mintMode = params.mintMode ?? (params.privateRecipient === true ? 'private' : 'public')\n if (params.privateMintSecretNonce != null && mintMode !== 'private') {\n throw new BridgeError('privateMintSecretNonce is only valid with private mint mode')\n }\n const privateMintSecretNonce = params.privateMintSecretNonce ?? '0scalar'\n if (mintMode === 'private' && !/^(0|[1-9][0-9]*)scalar$/.test(privateMintSecretNonce)) {\n throw new BridgeError('privateMintSecretNonce must be a non-negative decimal Aleo scalar literal such as 0scalar')\n }\n\n if ((params.mintMode != null || params.privateRecipient === true) && destinationChain.family !== 'aleo') {\n throw new BridgeError('Aleo mint mode is only valid when the destination chain is Aleo')\n }\n if (route.protocol !== 'xreserve' && mintMode !== 'public') {\n throw new BridgeError('record and private mint modes are only supported by xReserve routes')\n }\n\n const atomic = parseDecimalAmount(params.amount, sourceAsset.decimals)\n if (atomic <= 0n) throw new BridgeError('Bridge transfer amount must be greater than zero')\n parseDecimalAmount(params.amount, destinationAsset.decimals)\n\n if (destinationAsset.addressValidationRegex) {\n const regex = new RegExp(destinationAsset.addressValidationRegex)\n if (!regex.test(params.recipient)) {\n throw new BridgeError(`Recipient does not match ${destinationAsset.chainId} address format`)\n }\n }\n\n const steps = route.protocol === 'xreserve'\n ? xreserveSteps(route, sourceAsset, destinationAsset, sourceChain, destinationChain, mintMode)\n : hyperlaneSteps(sourceAsset, destinationAsset, sourceChain, destinationChain)\n const fees: BridgeTransferPlan['fees'] = []\n\n return {\n registryVersion: registry.version,\n protocol: route.protocol,\n route,\n sourceAsset,\n destinationAsset,\n amountIn: params.amount,\n // Both current protocols preserve display units before live fee deduction.\n // Omit a promise about net output until fee quoting is implemented.\n recipient: params.recipient,\n ...(params.sender == null ? {} : { sender: params.sender }),\n mintMode,\n ...(mintMode === 'private' ? { privateMintSecretNonce } : {}),\n privateRecipient: mintMode === 'private',\n quote: {\n routeId: route.id,\n protocol: route.protocol,\n amountIn: params.amount,\n fees,\n status: 'not-queried',\n },\n fees,\n steps,\n }\n}\n","import {\n decodeEventLog,\n decodeFunctionResult,\n encodeFunctionData,\n getAddress,\n isAddress,\n isHash,\n parseAbi,\n zeroAddress,\n type Address,\n type Hash,\n type Hex,\n} from 'viem'\nimport { BridgeError } from '../errors/bridgeErrors.js'\nimport type {\n EvmBridgeExecutor,\n EvmHyperlaneRouteMetadata,\n EvmHyperlaneTransferExecution,\n EvmHyperlaneTransferQuote,\n ExecuteEvmHyperlaneTransferParameters,\n QuoteEvmHyperlaneTransferParameters,\n} from '../types/evm.js'\nimport type { BridgeRegistry, BridgeTransferPlan, BridgeTransferReceipt } from '../types/protocol.js'\nimport { parseDecimalAmount } from '../utils/units.js'\n\nconst WARP_ROUTE_ABI = parseAbi([\n 'function quoteTransferRemote(uint32 destination, bytes32 recipient, uint256 amount) view returns ((address token, uint256 amount)[] quotes)',\n 'function transferRemote(uint32 destination, bytes32 recipient, uint256 amount) payable returns (bytes32 messageId)',\n])\nconst ERC20_ABI = parseAbi([\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n])\nconst DISPATCH_ID_ABI = parseAbi(['event DispatchId(bytes32 indexed messageId)'])\n\ntype RpcTransactionReceipt = {\n status?: Hex | undefined\n logs?: readonly { data: Hex, topics: readonly Hex[] }[] | undefined\n}\n\nfunction isHexOfBytes(value: string, bytes: number): value is Hex {\n return new RegExp(`^0x[0-9a-fA-F]{${bytes * 2}}$`).test(value)\n}\n\nfunction routeMetadata(registry: BridgeRegistry, plan: BridgeTransferPlan): EvmHyperlaneRouteMetadata {\n if (plan.protocol !== 'hyperlane' || plan.route.protocol !== 'hyperlane') {\n throw new BridgeError('Ethereum Hyperlane actions require a Hyperlane transfer plan')\n }\n if (plan.registryVersion !== registry.version) {\n throw new BridgeError(`Transfer plan uses registry ${plan.registryVersion}; expected ${registry.version}`)\n }\n const route = registry.routes.find((entry) => entry.id === plan.route.id)\n if (!route || route.protocol !== 'hyperlane') {\n throw new BridgeError(`Hyperlane route is not present in the configured registry: ${plan.route.id}`)\n }\n if (route.sourceAssetId !== plan.sourceAsset.id || route.destinationAssetId !== plan.destinationAsset.id) {\n throw new BridgeError(`Transfer plan assets do not match configured route: ${route.id}`)\n }\n if (route.availability !== 'active') {\n throw new BridgeError(`Hyperlane route is not executable: ${route.id}`)\n }\n const metadata = route.metadata\n if (!metadata) throw new BridgeError(`Hyperlane route metadata is missing: ${plan.route.id}`)\n\n const routerAddress = metadata.routerAddress\n const sourceChainId = metadata.sourceChainId\n const destinationDomain = metadata.destinationDomain\n const routerType = metadata.routerType\n const tokenAddress = metadata.tokenAddress\n const destinationRouter = metadata.destinationRouter\n const mailboxAddress = metadata.mailboxAddress\n const interchainGasPaymaster = metadata.interchainGasPaymaster\n const interchainSecurityModule = metadata.interchainSecurityModule\n const registryCommit = metadata.registryCommit\n\n if (typeof routerAddress !== 'string' || !isAddress(routerAddress)) {\n throw new BridgeError(`Hyperlane route has an invalid routerAddress: ${plan.route.id}`)\n }\n if (!Number.isInteger(sourceChainId) || typeof sourceChainId !== 'number' || sourceChainId <= 0) {\n throw new BridgeError(`Hyperlane route has an invalid sourceChainId: ${plan.route.id}`)\n }\n if (!Number.isInteger(destinationDomain) || typeof destinationDomain !== 'number' || destinationDomain < 0 || destinationDomain > 0xffff_ffff) {\n throw new BridgeError(`Hyperlane route has an invalid destinationDomain: ${plan.route.id}`)\n }\n if (routerType !== 'native' && routerType !== 'collateral') {\n throw new BridgeError(`Hyperlane route has an invalid routerType: ${plan.route.id}`)\n }\n if (routerType === 'collateral' && (typeof tokenAddress !== 'string' || !isAddress(tokenAddress))) {\n throw new BridgeError(`Collateral Hyperlane route has an invalid tokenAddress: ${plan.route.id}`)\n }\n if (typeof destinationRouter !== 'string' || destinationRouter.length === 0) {\n throw new BridgeError(`Hyperlane route has an invalid destinationRouter: ${plan.route.id}`)\n }\n if (typeof mailboxAddress !== 'string' || !isAddress(mailboxAddress)) {\n throw new BridgeError(`Hyperlane route has an invalid mailboxAddress: ${plan.route.id}`)\n }\n if (typeof interchainGasPaymaster !== 'string' || !isAddress(interchainGasPaymaster)) {\n throw new BridgeError(`Hyperlane route has an invalid interchainGasPaymaster: ${plan.route.id}`)\n }\n if (typeof interchainSecurityModule !== 'string' || !isAddress(interchainSecurityModule)) {\n throw new BridgeError(`Hyperlane route has an invalid interchainSecurityModule: ${plan.route.id}`)\n }\n if (typeof registryCommit !== 'string' || !/^[0-9a-f]{40}$/i.test(registryCommit)) {\n throw new BridgeError(`Hyperlane route has an invalid registryCommit: ${plan.route.id}`)\n }\n\n return {\n routerAddress: getAddress(routerAddress),\n sourceChainId,\n destinationDomain,\n routerType,\n ...(typeof tokenAddress === 'string' && isAddress(tokenAddress) ? { tokenAddress: getAddress(tokenAddress) } : {}),\n destinationRouter,\n mailboxAddress: getAddress(mailboxAddress),\n interchainGasPaymaster: getAddress(interchainGasPaymaster),\n interchainSecurityModule: getAddress(interchainSecurityModule),\n registryCommit,\n requiresApprovalReset: metadata.requiresApprovalReset === true,\n }\n}\n\nfunction validateRecipient(recipientBytes32: Hex): void {\n if (!isHexOfBytes(recipientBytes32, 32)) {\n throw new BridgeError('Hyperlane recipientBytes32 must contain exactly 32 bytes')\n }\n}\n\nasync function rpcCall(executor: EvmBridgeExecutor, to: Address, data: Hex): Promise<Hex> {\n const result = await executor.request({\n method: 'eth_call',\n params: [{ to, data }, 'latest'],\n })\n if (typeof result !== 'string' || !result.startsWith('0x')) {\n throw new BridgeError('EVM executor returned an invalid eth_call result')\n }\n return result as Hex\n}\n\nasync function assertChain(executor: EvmBridgeExecutor, expectedChainId: number): Promise<void> {\n const result = await executor.request({ method: 'eth_chainId' })\n if (typeof result !== 'string' || !/^0x[0-9a-f]+$/i.test(result)) {\n throw new BridgeError('EVM executor returned an invalid eth_chainId result')\n }\n const actual = Number(BigInt(result))\n if (actual !== expectedChainId) {\n throw new BridgeError(`EVM wallet is connected to chain ${actual}; expected ${expectedChainId}`)\n }\n}\n\nasync function resolveAccount(executor: EvmBridgeExecutor, plan: BridgeTransferPlan): Promise<Address> {\n let account = executor.account\n if (!account) {\n const result = await executor.request({ method: 'eth_accounts' })\n if (!Array.isArray(result) || typeof result[0] !== 'string' || !isAddress(result[0])) {\n throw new BridgeError('EVM executor has no connected account')\n }\n account = getAddress(result[0])\n }\n if (!isAddress(account)) throw new BridgeError('EVM executor account is invalid')\n const normalized = getAddress(account)\n if (plan.sender && (!isAddress(plan.sender) || getAddress(plan.sender) !== normalized)) {\n throw new BridgeError(`Prepared sender ${plan.sender} does not match connected account ${normalized}`)\n }\n return normalized\n}\n\nasync function sendTransaction(\n executor: EvmBridgeExecutor,\n transaction: { from: Address, to: Address, data: Hex, value?: Hex | undefined },\n): Promise<Hash> {\n const result = await executor.request({ method: 'eth_sendTransaction', params: [transaction] })\n if (typeof result !== 'string' || !isHash(result)) {\n throw new BridgeError('EVM executor returned an invalid transaction hash')\n }\n return result\n}\n\nasync function waitForReceipt(\n executor: EvmBridgeExecutor,\n hash: Hash,\n timeoutMs: number,\n pollingIntervalMs: number,\n): Promise<RpcTransactionReceipt | undefined> {\n const deadline = Date.now() + timeoutMs\n do {\n const result = await executor.request({ method: 'eth_getTransactionReceipt', params: [hash] })\n if (result != null && typeof result === 'object') return result as RpcTransactionReceipt\n if (Date.now() >= deadline) return undefined\n await new Promise<void>((resolve) => setTimeout(resolve, pollingIntervalMs))\n } while (true)\n}\n\nfunction assertSuccessfulReceipt(receipt: RpcTransactionReceipt, hash: Hash): void {\n if (receipt.status === '0x0') throw new BridgeError(`EVM transaction reverted: ${hash}`)\n}\n\nfunction messageIdFromReceipt(receipt: RpcTransactionReceipt): Hash | undefined {\n for (const log of receipt.logs ?? []) {\n try {\n const signature = log.topics[0]\n if (!signature) continue\n const decoded = decodeEventLog({\n abi: DISPATCH_ID_ABI,\n data: log.data,\n topics: [signature, ...log.topics.slice(1)],\n strict: false,\n })\n const messageId = decoded.args.messageId\n if (decoded.eventName === 'DispatchId' && messageId && isHash(messageId)) return messageId\n } catch {\n // Other receipt logs are unrelated to the Hyperlane Mailbox dispatch.\n }\n }\n return undefined\n}\n\n/**\n * Quotes an Ethereum-to-Aleo Hyperlane Warp Route transfer.\n *\n * Calls the reviewed router's `quoteTransferRemote` through the supplied EIP-1193\n * executor. The call reads live state but does not request a signature or move funds.\n *\n * @param registry Reviewed deployment snapshot used to validate the prepared plan.\n * @param executor Connected EVM provider used for the read-only contract call.\n * @param params Prepared plan and exact 32-byte Aleo recipient encoding.\n * @returns Atomic native payment and ERC-20 allowance requirements.\n * @throws BridgeError When the route is not an active Ethereum source route, metadata is incomplete, the wallet is on the wrong chain, or the router returns an unusable quote.\n *\n * @example\n * const quote = await quoteEvmHyperlaneTransfer(registry, executor, {\n * plan,\n * recipientBytes32: '0x20e3629764d5338f74bee96675801b1fb29d1fc68b177668f9175708bef84311',\n * })\n */\nexport async function quoteEvmHyperlaneTransfer(\n registry: BridgeRegistry,\n executor: EvmBridgeExecutor,\n params: QuoteEvmHyperlaneTransferParameters,\n): Promise<EvmHyperlaneTransferQuote> {\n validateRecipient(params.recipientBytes32)\n const metadata = routeMetadata(registry, params.plan)\n await assertChain(executor, metadata.sourceChainId)\n const sourceAsset = registry.assets.find((asset) => asset.id === params.plan.sourceAsset.id)!\n const amountAtomic = parseDecimalAmount(params.plan.amountIn, sourceAsset.decimals)\n const data = encodeFunctionData({\n abi: WARP_ROUTE_ABI,\n functionName: 'quoteTransferRemote',\n args: [metadata.destinationDomain, params.recipientBytes32, amountAtomic],\n })\n const encoded = await rpcCall(executor, metadata.routerAddress, data)\n const quotes = decodeFunctionResult({\n abi: WARP_ROUTE_ABI,\n functionName: 'quoteTransferRemote',\n data: encoded,\n })\n const nativeValueAtomic = quotes\n .filter((quote) => getAddress(quote.token) === zeroAddress)\n .reduce((sum, quote) => sum + quote.amount, 0n)\n\n if (metadata.routerType === 'native') {\n if (nativeValueAtomic < amountAtomic) {\n throw new BridgeError('Native Hyperlane quote does not cover the transfer amount')\n }\n return {\n routeId: params.plan.route.id,\n routerAddress: metadata.routerAddress,\n sourceChainId: metadata.sourceChainId,\n destinationDomain: metadata.destinationDomain,\n recipientBytes32: params.recipientBytes32,\n amountAtomic,\n nativeValueAtomic,\n nativeFeeAtomic: nativeValueAtomic - amountAtomic,\n }\n }\n\n const tokenAddress = metadata.tokenAddress!\n const tokenAmountAtomic = quotes\n .filter((quote) => getAddress(quote.token) === tokenAddress)\n .reduce((sum, quote) => sum + quote.amount, 0n)\n if (tokenAmountAtomic < amountAtomic) {\n throw new BridgeError('Collateral Hyperlane quote does not cover the transfer amount')\n }\n return {\n routeId: params.plan.route.id,\n routerAddress: metadata.routerAddress,\n sourceChainId: metadata.sourceChainId,\n destinationDomain: metadata.destinationDomain,\n recipientBytes32: params.recipientBytes32,\n amountAtomic,\n nativeValueAtomic,\n nativeFeeAtomic: nativeValueAtomic,\n tokenAmountAtomic,\n tokenAddress,\n }\n}\n\nfunction executionReceipt(\n plan: BridgeTransferPlan,\n status: BridgeTransferReceipt['status'],\n id: string,\n quote: EvmHyperlaneTransferQuote,\n approvalTxIds: Hash[],\n sourceTxId?: Hash,\n messageId?: Hash,\n): BridgeTransferReceipt {\n return {\n id,\n protocol: 'hyperlane',\n status,\n ...(sourceTxId ? { sourceTxId } : {}),\n ...(messageId ? { messageId } : {}),\n protocolState: {\n routeId: plan.route.id,\n approvalTxIds,\n recipientBytes32: quote.recipientBytes32,\n destinationDomain: quote.destinationDomain,\n nativeValueAtomic: quote.nativeValueAtomic.toString(),\n amountAtomic: quote.amountAtomic.toString(),\n },\n }\n}\n\n/**\n * Approves collateral when needed and dispatches an Ethereum Hyperlane transfer.\n *\n * Requotes immediately before submission, checks the connected chain and account,\n * and waits for approval receipts before dispatch. USDT routes reset an existing\n * non-zero allowance before setting a new one. Calls can prompt the wallet and move funds.\n *\n * @param registry Reviewed deployment snapshot used to validate the prepared plan.\n * @param executor Connected EIP-1193 wallet used to read, sign, and submit transactions.\n * @param params Prepared plan, wire recipient, and optional receipt polling controls.\n * @returns Submitted transaction ids plus resumable transfer state. Receipt timeouts return a pending state and do not report failure.\n * @throws BridgeError When validation, quoting, wallet submission, or a confirmed transaction fails.\n *\n * @example\n * const execution = await executeEvmHyperlaneTransfer(registry, executor, {\n * plan,\n * recipientBytes32: '0x20e3629764d5338f74bee96675801b1fb29d1fc68b177668f9175708bef84311',\n * })\n */\nexport async function executeEvmHyperlaneTransfer(\n registry: BridgeRegistry,\n executor: EvmBridgeExecutor,\n params: ExecuteEvmHyperlaneTransferParameters,\n): Promise<EvmHyperlaneTransferExecution> {\n const pollingIntervalMs = params.pollingIntervalMs ?? 1_000\n const confirmationTimeoutMs = params.confirmationTimeoutMs ?? 120_000\n if (!Number.isFinite(pollingIntervalMs) || pollingIntervalMs < 0) {\n throw new BridgeError('pollingIntervalMs must be a non-negative finite number')\n }\n if (!Number.isFinite(confirmationTimeoutMs) || confirmationTimeoutMs < 0) {\n throw new BridgeError('confirmationTimeoutMs must be a non-negative finite number')\n }\n\n const metadata = routeMetadata(registry, params.plan)\n const quote = await quoteEvmHyperlaneTransfer(registry, executor, params)\n const account = await resolveAccount(executor, params.plan)\n const approvalTxIds: Hash[] = []\n\n if (metadata.routerType === 'collateral') {\n const allowanceData = encodeFunctionData({\n abi: ERC20_ABI,\n functionName: 'allowance',\n args: [account, metadata.routerAddress],\n })\n const allowanceResult = await rpcCall(executor, metadata.tokenAddress!, allowanceData)\n const allowance = decodeFunctionResult({\n abi: ERC20_ABI,\n functionName: 'allowance',\n data: allowanceResult,\n })\n const required = quote.tokenAmountAtomic!\n\n const approveAndConfirm = async (amount: bigint): Promise<boolean> => {\n const data = encodeFunctionData({\n abi: ERC20_ABI,\n functionName: 'approve',\n args: [metadata.routerAddress, amount],\n })\n const hash = await sendTransaction(executor, { from: account, to: metadata.tokenAddress!, data })\n approvalTxIds.push(hash)\n const receipt = await waitForReceipt(executor, hash, confirmationTimeoutMs, pollingIntervalMs)\n if (!receipt) return false\n assertSuccessfulReceipt(receipt, hash)\n return true\n }\n\n if (allowance < required) {\n if (allowance > 0n && metadata.requiresApprovalReset) {\n if (!await approveAndConfirm(0n)) {\n return {\n approvalTxIds,\n receipt: executionReceipt(params.plan, 'SOURCE_APPROVAL_PENDING', approvalTxIds.at(-1)!, quote, approvalTxIds),\n }\n }\n }\n if (!await approveAndConfirm(required)) {\n return {\n approvalTxIds,\n receipt: executionReceipt(params.plan, 'SOURCE_APPROVAL_PENDING', approvalTxIds.at(-1)!, quote, approvalTxIds),\n }\n }\n }\n }\n\n const transferData = encodeFunctionData({\n abi: WARP_ROUTE_ABI,\n functionName: 'transferRemote',\n args: [quote.destinationDomain, quote.recipientBytes32, quote.amountAtomic],\n })\n const sourceTxId = await sendTransaction(executor, {\n from: account,\n to: quote.routerAddress,\n data: transferData,\n value: `0x${quote.nativeValueAtomic.toString(16)}`,\n })\n const sourceReceipt = await waitForReceipt(\n executor,\n sourceTxId,\n confirmationTimeoutMs,\n pollingIntervalMs,\n )\n if (!sourceReceipt) {\n return {\n approvalTxIds,\n receipt: executionReceipt(params.plan, 'SOURCE_CONFIRMING', sourceTxId, quote, approvalTxIds, sourceTxId),\n }\n }\n assertSuccessfulReceipt(sourceReceipt, sourceTxId)\n const messageId = messageIdFromReceipt(sourceReceipt)\n return {\n approvalTxIds,\n receipt: executionReceipt(\n params.plan,\n 'DELIVERY_PENDING',\n messageId ?? sourceTxId,\n quote,\n approvalTxIds,\n sourceTxId,\n messageId,\n ),\n }\n}\n","import {\n decodeEventLog,\n decodeFunctionResult,\n encodeFunctionData,\n getAddress,\n isAddress,\n isHash,\n isHex,\n parseAbi,\n type Address,\n type Hash,\n type Hex,\n} from 'viem'\nimport { BridgeError } from '../errors/bridgeErrors.js'\nimport type { EvmBridgeExecutor } from '../types/evm.js'\nimport type { BridgeRegistry, BridgeTransferPlan, BridgeTransferReceipt } from '../types/protocol.js'\nimport type {\n EvmXReserveRouteMetadata,\n EvmXReserveTransferExecution,\n EvmXReserveTransferQuote,\n ExecuteEvmXReserveTransferParameters,\n GetXReserveAttestationParameters,\n QuoteEvmXReserveTransferParameters,\n XReserveAttestationResult,\n XReserveHttpTransport,\n} from '../types/xreserve.js'\nimport { parseDecimalAmount } from '../utils/units.js'\nimport {\n aleoAddressToBytes32,\n aleoProgramAddress,\n buildXReserveDepositPayload,\n buildXReserveHookData,\n calculateXReserveDepositNonce,\n calculateXReserveMessageHash,\n} from '../utils/xreserve.js'\n\nconst ERC20_ABI = parseAbi([\n 'function balanceOf(address owner) view returns (uint256)',\n 'function allowance(address owner, address spender) view returns (uint256)',\n 'function approve(address spender, uint256 amount) returns (bool)',\n])\nconst XRESERVE_ABI = parseAbi([\n 'function depositToRemote(uint256 value, uint32 remoteDomain, bytes32 remoteRecipient, address localToken, uint256 maxFee, bytes hookData)',\n 'event DepositedToRemote(address indexed localToken, uint256 value, address indexed localDepositor, bytes32 indexed remoteRecipient, uint32 remoteDomain, bytes32 remoteToken, uint256 maxFee, bytes hookData)',\n])\n\ntype RpcReceipt = {\n status?: Hex\n transactionHash?: Hash\n logs?: readonly { address?: Address, data: Hex, topics: readonly Hex[], logIndex?: Hex | number }[]\n}\n\nfunction metadata(registry: BridgeRegistry, plan: BridgeTransferPlan): EvmXReserveRouteMetadata {\n if (plan.protocol !== 'xreserve' || plan.route.protocol !== 'xreserve') throw new BridgeError('xReserve actions require an xReserve transfer plan')\n if (plan.registryVersion !== registry.version) throw new BridgeError(`Transfer plan uses registry ${plan.registryVersion}; expected ${registry.version}`)\n const route = registry.routes.find((entry) => entry.id === plan.route.id)\n if (!route || route.availability !== 'active') throw new BridgeError(`xReserve route is not executable: ${plan.route.id}`)\n if (route.sourceAssetId !== plan.sourceAsset.id || route.destinationAssetId !== plan.destinationAsset.id) throw new BridgeError(`Transfer plan assets do not match configured route: ${route.id}`)\n const sourceChain = registry.chains.find((chain) => chain.id === plan.sourceAsset.chainId)\n if (sourceChain?.family !== 'evm' || plan.destinationAsset.chainId !== (route.environment === 'mainnet' ? 'aleo' : 'aleo-testnet')) {\n throw new BridgeError('This action supports Ethereum-to-Aleo xReserve deposits only')\n }\n const raw = route.metadata ?? {}\n const xReserveContract = raw.xReserveContract\n const sourceChainId = raw.sourceChainId\n const sourceDomain = raw.sourceDomain\n const remoteDomain = raw.remoteDomain\n const remoteTokenBytes32 = raw.remoteTokenBytes32\n const minimumAmountAtomic = raw.minimumAmountAtomic\n const maxFeeAtomic = raw.maxFeeAtomic\n const bridgeProgram = raw.bridgeProgram\n const wrapperProgram = raw.wrapperProgram\n const attestationBaseUrl = raw.attestationBaseUrl\n if (typeof xReserveContract !== 'string' || !isAddress(xReserveContract)) throw new BridgeError(`xReserve contract is invalid: ${route.id}`)\n if (typeof sourceChainId !== 'number' || !Number.isSafeInteger(sourceChainId) || sourceChainId <= 0) throw new BridgeError(`xReserve sourceChainId is invalid: ${route.id}`)\n if (typeof sourceDomain !== 'number' || !Number.isInteger(sourceDomain) || sourceDomain < 0) throw new BridgeError(`xReserve sourceDomain is invalid: ${route.id}`)\n if (typeof remoteDomain !== 'number' || !Number.isInteger(remoteDomain) || remoteDomain < 0) throw new BridgeError(`xReserve remoteDomain is invalid: ${route.id}`)\n if (typeof remoteTokenBytes32 !== 'string' || !/^0x[0-9a-f]{64}$/i.test(remoteTokenBytes32)) throw new BridgeError(`xReserve remote token is invalid: ${route.id}`)\n if (typeof minimumAmountAtomic !== 'string' || !/^\\d+$/.test(minimumAmountAtomic)) throw new BridgeError(`xReserve minimum amount is invalid: ${route.id}`)\n if (typeof maxFeeAtomic !== 'string' || !/^\\d+$/.test(maxFeeAtomic)) throw new BridgeError(`xReserve max fee is invalid: ${route.id}`)\n if (typeof bridgeProgram !== 'string' || !bridgeProgram.endsWith('.aleo')) throw new BridgeError(`xReserve bridge program is invalid: ${route.id}`)\n if (typeof wrapperProgram !== 'string' || !wrapperProgram.endsWith('.aleo')) throw new BridgeError(`xReserve wrapper program is invalid: ${route.id}`)\n if (typeof attestationBaseUrl !== 'string' || !attestationBaseUrl.startsWith('https://')) throw new BridgeError(`xReserve attestation URL is invalid: ${route.id}`)\n return { xReserveContract: getAddress(xReserveContract), sourceChainId, sourceDomain, remoteDomain, remoteTokenBytes32: remoteTokenBytes32 as Hex, minimumAmountAtomic: BigInt(minimumAmountAtomic), maxFeeAtomic: BigInt(maxFeeAtomic), bridgeProgram, wrapperProgram, attestationBaseUrl }\n}\n\nasync function rpc(executor: EvmBridgeExecutor, method: string, params?: readonly unknown[]): Promise<unknown> {\n return executor.request({ method, ...(params ? { params } : {}) })\n}\n\nasync function assertChain(executor: EvmBridgeExecutor, expected: number): Promise<void> {\n const chain = await rpc(executor, 'eth_chainId')\n if (typeof chain !== 'string' || !/^0x[0-9a-f]+$/i.test(chain)) throw new BridgeError('EVM executor returned an invalid chain id')\n if (Number(BigInt(chain)) !== expected) throw new BridgeError(`EVM wallet is connected to chain ${Number(BigInt(chain))}; expected ${expected}`)\n}\n\nasync function account(executor: EvmBridgeExecutor, plan: BridgeTransferPlan): Promise<Address> {\n const value = executor.account ?? (await rpc(executor, 'eth_accounts') as unknown[] | undefined)?.[0]\n if (typeof value !== 'string' || !isAddress(value)) throw new BridgeError('EVM executor has no connected account')\n const resolved = getAddress(value)\n if (plan.sender && (!isAddress(plan.sender) || getAddress(plan.sender) !== resolved)) throw new BridgeError(`Prepared sender ${plan.sender} does not match connected account ${resolved}`)\n return resolved\n}\n\nasync function callUint(executor: EvmBridgeExecutor, to: Address, data: Hex, functionName: 'balanceOf' | 'allowance'): Promise<bigint> {\n const result = await rpc(executor, 'eth_call', [{ to, data }, 'latest'])\n if (typeof result !== 'string' || !isHex(result)) throw new BridgeError('EVM executor returned an invalid contract result')\n return decodeFunctionResult({ abi: ERC20_ABI, functionName, data: result })\n}\n\nasync function send(executor: EvmBridgeExecutor, transaction: { from: Address, to: Address, data: Hex }): Promise<Hash> {\n const hash = await rpc(executor, 'eth_sendTransaction', [transaction])\n if (typeof hash !== 'string' || !isHash(hash)) throw new BridgeError('EVM executor returned an invalid transaction hash')\n return hash\n}\n\nasync function wait(executor: EvmBridgeExecutor, hash: Hash, timeout: number, interval: number): Promise<RpcReceipt | undefined> {\n const deadline = Date.now() + timeout\n do {\n const result = await rpc(executor, 'eth_getTransactionReceipt', [hash])\n if (result && typeof result === 'object') return result as RpcReceipt\n if (Date.now() >= deadline) return undefined\n await new Promise<void>((resolve) => setTimeout(resolve, interval))\n } while (true)\n}\n\nfunction successful(receipt: RpcReceipt, hash: Hash): void {\n if (receipt.status === '0x0') throw new BridgeError(`EVM transaction reverted: ${hash}`)\n}\n\n/**\n * Reads live USDC balance and xReserve allowance for a prepared deposit.\n *\n * Derives the hook and wire recipient before performing read-only EVM calls. It\n * does not request a signature or move funds.\n *\n * @param registry Reviewed deployment snapshot used to validate the plan.\n * @param executor Connected EIP-1193 provider used for contract reads.\n * @param params Prepared Ethereum-to-Aleo xReserve plan.\n * @returns Atomic deposit values, account balance, allowance, and approval requirement.\n * @throws BridgeError When metadata, wallet state, amount, balance, or recipient is invalid.\n *\n * @example\n * const quote = await quoteEvmXReserveTransfer(registry, executor, { plan })\n */\nexport async function quoteEvmXReserveTransfer(\n registry: BridgeRegistry,\n executor: EvmBridgeExecutor,\n params: QuoteEvmXReserveTransferParameters,\n): Promise<EvmXReserveTransferQuote> {\n const route = metadata(registry, params.plan)\n await assertChain(executor, route.sourceChainId)\n const owner = await account(executor, params.plan)\n const token = params.plan.sourceAsset.locator?.value\n if (params.plan.sourceAsset.locator?.kind !== 'evm-contract' || !token || !isAddress(token)) throw new BridgeError('xReserve source token contract is missing')\n const amountAtomic = parseDecimalAmount(params.plan.amountIn, params.plan.sourceAsset.decimals)\n if (amountAtomic < route.minimumAmountAtomic) throw new BridgeError(`xReserve minimum deposit is ${route.minimumAmountAtomic} atomic units`)\n const environment = params.plan.route.environment\n const hookData = await buildXReserveHookData(\n params.plan.mintMode,\n params.plan.recipient,\n environment,\n params.plan.privateMintSecretNonce ?? '0scalar',\n )\n const recipient = params.plan.mintMode === 'private'\n ? await aleoProgramAddress(route.wrapperProgram, environment)\n : params.plan.recipient\n const remoteRecipientBytes32 = aleoAddressToBytes32(recipient)\n const balanceData = encodeFunctionData({ abi: ERC20_ABI, functionName: 'balanceOf', args: [owner] })\n const allowanceData = encodeFunctionData({ abi: ERC20_ABI, functionName: 'allowance', args: [owner, route.xReserveContract] })\n const [balanceAtomic, allowanceAtomic] = await Promise.all([\n callUint(executor, getAddress(token), balanceData, 'balanceOf'),\n callUint(executor, getAddress(token), allowanceData, 'allowance'),\n ])\n if (balanceAtomic < amountAtomic) throw new BridgeError(`Insufficient ${params.plan.sourceAsset.symbol} balance`)\n return { routeId: params.plan.route.id, xReserveContract: route.xReserveContract, tokenAddress: getAddress(token), sourceChainId: route.sourceChainId, remoteDomain: route.remoteDomain, remoteRecipientBytes32, amountAtomic, maxFeeAtomic: route.maxFeeAtomic, hookData, balanceAtomic, allowanceAtomic, approvalRequired: allowanceAtomic < amountAtomic }\n}\n\nfunction pendingReceipt(plan: BridgeTransferPlan, status: BridgeTransferReceipt['status'], id: string, approvalTxIds: Hash[], quote: EvmXReserveTransferQuote, sourceTxId?: Hash): BridgeTransferReceipt {\n return { id, protocol: 'xreserve', status, ...(sourceTxId ? { sourceTxId } : {}), protocolState: { routeId: plan.route.id, approvalTxIds, mintMode: plan.mintMode, intendedRecipient: plan.recipient, remoteRecipientBytes32: quote.remoteRecipientBytes32, hookData: quote.hookData, amountAtomic: quote.amountAtomic.toString(), maxFeeAtomic: quote.maxFeeAtomic.toString() } }\n}\n\n/**\n * Approves USDC when needed and submits a nonpayable Circle xReserve deposit.\n *\n * Calls the wallet for each required signature, confirms the approval before\n * depositing, and derives the Circle message hash from the confirmed event.\n *\n * @param registry Reviewed deployment snapshot used to validate the plan.\n * @param executor Connected EIP-1193 wallet used to read, sign, and submit.\n * @param params Prepared plan and optional receipt polling controls.\n * @returns Submitted approval ids and resumable xReserve transfer state.\n * @throws BridgeError When validation, submission, confirmation, or event verification fails.\n *\n * @example\n * const execution = await executeEvmXReserveTransfer(registry, executor, { plan })\n */\nexport async function executeEvmXReserveTransfer(\n registry: BridgeRegistry,\n executor: EvmBridgeExecutor,\n params: ExecuteEvmXReserveTransferParameters,\n): Promise<EvmXReserveTransferExecution> {\n const pollingIntervalMs = params.pollingIntervalMs ?? 1_000\n const confirmationTimeoutMs = params.confirmationTimeoutMs ?? 120_000\n if (!Number.isFinite(pollingIntervalMs) || pollingIntervalMs < 0 || !Number.isFinite(confirmationTimeoutMs) || confirmationTimeoutMs < 0) throw new BridgeError('Receipt polling controls must be non-negative finite numbers')\n const route = metadata(registry, params.plan)\n const quote = await quoteEvmXReserveTransfer(registry, executor, params)\n const owner = await account(executor, params.plan)\n const approvalTxIds: Hash[] = []\n if (quote.approvalRequired) {\n const data = encodeFunctionData({ abi: ERC20_ABI, functionName: 'approve', args: [route.xReserveContract, quote.amountAtomic] })\n const hash = await send(executor, { from: owner, to: quote.tokenAddress, data })\n approvalTxIds.push(hash)\n const receipt = await wait(executor, hash, confirmationTimeoutMs, pollingIntervalMs)\n if (!receipt) return { approvalTxIds, receipt: pendingReceipt(params.plan, 'SOURCE_APPROVAL_PENDING', hash, approvalTxIds, quote) }\n successful(receipt, hash)\n }\n const data = encodeFunctionData({ abi: XRESERVE_ABI, functionName: 'depositToRemote', args: [quote.amountAtomic, route.remoteDomain, quote.remoteRecipientBytes32, quote.tokenAddress, route.maxFeeAtomic, quote.hookData] })\n const sourceTxId = await send(executor, { from: owner, to: route.xReserveContract, data })\n const receipt = await wait(executor, sourceTxId, confirmationTimeoutMs, pollingIntervalMs)\n if (!receipt) return { approvalTxIds, receipt: pendingReceipt(params.plan, 'SOURCE_CONFIRMING', sourceTxId, approvalTxIds, quote, sourceTxId) }\n successful(receipt, sourceTxId)\n let matched: { log: NonNullable<RpcReceipt['logs']>[number], args: {\n localToken: Address\n value: bigint\n localDepositor: Address\n remoteRecipient: Hex\n remoteDomain: number\n remoteToken: Hex\n maxFee: bigint\n hookData: Hex\n } } | undefined\n for (const log of receipt.logs ?? []) {\n if (log.address && getAddress(log.address) !== route.xReserveContract) continue\n try {\n const decoded = decodeEventLog({ abi: XRESERVE_ABI, data: log.data, topics: log.topics as [Hex, ...Hex[]] })\n if (decoded.eventName === 'DepositedToRemote') matched = { log, args: decoded.args }\n } catch {\n // The receipt also contains ERC-20 and xReserve implementation logs.\n }\n }\n if (!matched) throw new BridgeError('Confirmed receipt does not contain a valid DepositedToRemote event')\n const { log: eventLog, args } = matched\n if (getAddress(args.localToken) !== quote.tokenAddress || getAddress(args.localDepositor) !== owner || args.value !== quote.amountAtomic || args.remoteDomain !== route.remoteDomain || args.remoteRecipient.toLowerCase() !== quote.remoteRecipientBytes32.toLowerCase() || args.remoteToken.toLowerCase() !== route.remoteTokenBytes32.toLowerCase() || args.maxFee !== route.maxFeeAtomic || args.hookData.toLowerCase() !== quote.hookData.toLowerCase()) throw new BridgeError('DepositedToRemote event does not match the prepared transfer')\n const rawIndex = eventLog.logIndex\n const logIndex = typeof rawIndex === 'string' ? Number(BigInt(rawIndex)) : rawIndex\n if (!Number.isSafeInteger(logIndex) || logIndex == null || logIndex < 0) throw new BridgeError('DepositedToRemote log index is missing or invalid')\n const nonce = calculateXReserveDepositNonce(route.sourceDomain, sourceTxId, logIndex)\n const payload = buildXReserveDepositPayload({ amount: args.value, remoteDomain: args.remoteDomain, remoteToken: args.remoteToken, remoteRecipient: args.remoteRecipient, localToken: args.localToken, depositor: args.localDepositor, maxFee: args.maxFee, nonce, hookData: args.hookData })\n const messageHash = calculateXReserveMessageHash(payload)\n return { approvalTxIds, receipt: { id: messageHash, protocol: 'xreserve', status: 'ATTESTATION_PENDING', sourceTxId, protocolState: { ...pendingReceipt(params.plan, 'ATTESTATION_PENDING', messageHash, approvalTxIds, quote, sourceTxId).protocolState, sourceDomain: route.sourceDomain, remoteDomain: route.remoteDomain, depositLogIndex: logIndex, nonce, payload, messageHash, bridgeProgram: route.bridgeProgram, wrapperProgram: route.wrapperProgram } } }\n}\n\n/**\n * Fetches and validates one Circle attestation, treating HTTP 404 as pending.\n *\n * Performs one request through the injected transport. Completed responses are\n * checked against the requested message hash before being returned.\n *\n * @param registry Reviewed snapshot supplying the Circle endpoint.\n * @param transport Fetch-compatible HTTP capability supplied by the application.\n * @param params Route, message hash, and optional cancellation signal.\n * @returns Pending state or the verified payload and Circle signature.\n * @throws BridgeError For invalid routes, HTTP failures other than 404, or malformed responses.\n *\n * @example\n * const result = await getXReserveAttestation(registry, fetchTransport, { routeId, messageHash })\n */\nexport async function getXReserveAttestation(\n registry: BridgeRegistry,\n transport: XReserveHttpTransport,\n params: GetXReserveAttestationParameters,\n): Promise<XReserveAttestationResult> {\n const route = registry.routes.find((entry) => entry.id === params.routeId)\n if (!route) throw new BridgeError(`Unknown bridge route: ${params.routeId}`)\n if (route.protocol !== 'xreserve' || route.availability !== 'active') throw new BridgeError(`xReserve route is not executable: ${params.routeId}`)\n const attestationBaseUrl = route.metadata?.attestationBaseUrl\n if (typeof attestationBaseUrl !== 'string' || !attestationBaseUrl.startsWith('https://')) throw new BridgeError(`xReserve attestation URL is invalid: ${params.routeId}`)\n const response = await transport(`${attestationBaseUrl}/${params.messageHash}`, params.signal ? { signal: params.signal } : undefined)\n if (response.status === 404) return { status: 'pending', messageHash: params.messageHash }\n if (!response.ok) throw new BridgeError(`Circle attester request failed with HTTP ${response.status}`)\n const body = await response.json() as { attestation?: { payload?: unknown, messageHash?: unknown, attestation?: unknown } }\n const value = body.attestation\n if (!value || typeof value.payload !== 'string' || !isHex(value.payload) || typeof value.attestation !== 'string' || !isHex(value.attestation) || typeof value.messageHash !== 'string' || !isHash(value.messageHash) || value.messageHash.toLowerCase() !== params.messageHash.toLowerCase()) throw new BridgeError('Circle attester returned an invalid response')\n if (calculateXReserveMessageHash(value.payload) !== params.messageHash) throw new BridgeError('Circle attestation payload does not match the requested message hash')\n return { status: 'complete', messageHash: params.messageHash, payload: value.payload, attestation: value.attestation }\n}\n","import {\n encodeAbiParameters,\n getAddress,\n hexToBytes,\n isAddress,\n isHex,\n keccak256,\n padHex,\n toHex,\n type Address,\n type Hash,\n type Hex,\n} from 'viem'\nimport { BridgeError } from '../errors/bridgeErrors.js'\nimport type { AleoMintMode, BridgeEnvironment } from '../types/protocol.js'\n\nconst HOOK_DATA_BYTES = 65\nconst BECH32_ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'\n\nfunction bech32Polymod(values: readonly number[]): number {\n const generators = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3]\n let checksum = 1\n for (const value of values) {\n const top = checksum >>> 25\n checksum = ((checksum & 0x1ffffff) << 5) ^ value\n for (let index = 0; index < 5; index++) if ((top >>> index) & 1) checksum ^= generators[index]!\n }\n return checksum >>> 0\n}\n\nfunction decodeAleoBech32m(address: string): Uint8Array {\n const separator = address.lastIndexOf('1')\n const prefix = address.slice(0, separator)\n const encoded = address.slice(separator + 1)\n const words = [...encoded].map((character) => BECH32_ALPHABET.indexOf(character))\n if (prefix !== 'aleo' || separator < 1 || words.some((word) => word < 0)) throw new Error('invalid encoding')\n const expanded = [...prefix].map((character) => character.charCodeAt(0) >>> 5)\n .concat([0], [...prefix].map((character) => character.charCodeAt(0) & 31), words)\n if (bech32Polymod(expanded) !== 0x2bc830a3) throw new Error('invalid checksum')\n const payload = words.slice(0, -6)\n const bytes: number[] = []\n let accumulator = 0\n let bits = 0\n for (const word of payload) {\n accumulator = (accumulator << 5) | word\n bits += 5\n while (bits >= 8) {\n bits -= 8\n bytes.push((accumulator >>> bits) & 0xff)\n }\n }\n if (bits >= 5 || ((accumulator << (8 - bits)) & 0xff) !== 0) throw new Error('invalid padding')\n return Uint8Array.from(bytes)\n}\n\n/**\n * Decodes a checksummed Aleo bech32m address into xReserve bytes32 form.\n *\n * Pure and local; validates the prefix, length, checksum, padding, and payload width.\n *\n * @param address Aleo account address to encode.\n * @returns Exactly 32 decoded bytes as prefixed hexadecimal.\n * @throws BridgeError When the address has invalid bech32m structure.\n *\n * @example\n * const recipient = aleoAddressToBytes32('aleo1…')\n */\nexport function aleoAddressToBytes32(address: string): Hex {\n try {\n if (!address.startsWith('aleo1') || address.length !== 63) throw new Error('invalid prefix or length')\n const bytes = decodeAleoBech32m(address)\n if (bytes.length !== 32) throw new Error('invalid payload')\n return toHex(bytes)\n } catch (cause) {\n throw new BridgeError(`Invalid Aleo recipient address: ${address}`, { cause })\n }\n}\n\nasync function loadAleoSdk(environment: BridgeEnvironment) {\n const moduleName = '@provablehq/sdk/dynamic.js'\n try {\n const sdk = await import(moduleName) as { loadNetwork: (network: BridgeEnvironment) => Promise<any> }\n return sdk.loadNetwork(environment)\n } catch (cause) {\n throw new BridgeError('Private xReserve mints require the optional @provablehq/sdk package', { cause })\n }\n}\n\n/**\n * Derives the Aleo account address owned by a deployed program id.\n *\n * Lazily loads the optional Aleo WASM SDK but performs no network access.\n *\n * @param programId Deployed Aleo program id whose account receives funds.\n * @param environment Consensus environment used for address derivation.\n * @returns The program-owned `aleo1…` account address.\n * @throws BridgeError When the optional SDK is unavailable or derivation fails.\n *\n * @example\n * const wrapper = await aleoProgramAddress('shielded_usdcx_wrapper.aleo', 'mainnet')\n */\nexport async function aleoProgramAddress(programId: string, environment: BridgeEnvironment): Promise<string> {\n const sdk = await loadAleoSdk(environment)\n return sdk.Address.fromProgramId(programId).to_string()\n}\n\n/**\n * Builds the fixed 65-byte xReserve hook for public, record, or wrapper-private minting.\n *\n * Public and record hooks are pure and local. Private hooks lazily load Aleo WASM\n * to commit the intended recipient with BHP256 and the selected secret nonce.\n *\n * @param mode Destination mint transition selected by the caller.\n * @param recipient Intended Aleo recipient committed by private mode.\n * @param environment Consensus environment used by private commitment derivation.\n * @param secretNonce Aleo scalar literal used by the private commitment. Defaults to `0scalar`.\n * @returns A 65-byte hook whose first byte is 0, 1, or 2.\n * @throws BridgeError When private derivation lacks the optional SDK or the secret nonce is not a valid Aleo scalar.\n *\n * @example\n * const hook = await buildXReserveHookData('record', recipient, 'testnet')\n */\nexport async function buildXReserveHookData(\n mode: AleoMintMode,\n recipient: string,\n environment: BridgeEnvironment,\n secretNonce = '0scalar',\n): Promise<Hex> {\n const bytes = new Uint8Array(HOOK_DATA_BYTES)\n bytes[0] = mode === 'public' ? 0 : mode === 'record' ? 1 : 2\n if (mode === 'private') {\n const sdk = await loadAleoSdk(environment)\n const bits = sdk.Plaintext.fromString(recipient).toBitsLe()\n let scalar\n try {\n scalar = sdk.Scalar.fromString(secretNonce)\n } catch (cause) {\n throw new BridgeError(`Invalid private mint secret nonce: ${secretNonce}`, { cause })\n }\n const commitment = new sdk.BHP256().commit(bits, scalar).toBytesLe()\n if (commitment.length !== 32) throw new BridgeError('Private mint commitment must contain 32 bytes')\n bytes.set(commitment, 1)\n }\n return toHex(bytes)\n}\n\n/**\n * Derives the Circle deposit nonce from source domain, transaction hash, and log index.\n *\n * Pure and local; follows Circle's ABI-padded nonce preimage exactly.\n *\n * @param sourceDomain Circle domain of the source xReserve contract.\n * @param transactionHash Confirmed deposit transaction hash.\n * @param logIndex Zero-based `DepositedToRemote` receipt log index.\n * @returns The Keccak-256 deposit nonce.\n *\n * @example\n * const nonce = calculateXReserveDepositNonce(0, txHash, 3)\n */\nexport function calculateXReserveDepositNonce(sourceDomain: number, transactionHash: Hash, logIndex: number): Hash {\n const domain = encodeAbiParameters([{ type: 'uint32' }], [sourceDomain])\n const index = encodeAbiParameters([{ type: 'uint256' }], [BigInt(logIndex)])\n return keccak256(`0x${domain.slice(2)}${transactionHash.slice(2)}${index.slice(2)}`)\n}\n\nfunction uintBytes(value: bigint, bytes: number): Uint8Array {\n if (value < 0n || value >= 1n << BigInt(bytes * 8)) throw new BridgeError(`Unsigned value does not fit in ${bytes} bytes`)\n return hexToBytes(toHex(value, { size: bytes }))\n}\n\n/**\n * Builds the canonical 305-byte Circle xReserve v2 deposit payload.\n *\n * Pure and local; rejects fields with invalid wire widths before constructing the payload.\n *\n * @param params Event-derived deposit values and reviewed route identifiers.\n * @returns The exact payload submitted to Circle's attester.\n * @throws BridgeError When a value is invalid or exceeds its wire width.\n *\n * @example\n * const payload = buildXReserveDepositPayload(fields)\n */\nexport function buildXReserveDepositPayload(params: {\n amount: bigint\n remoteDomain: number\n remoteToken: Hex\n remoteRecipient: Hex\n localToken: Address\n depositor: Address\n maxFee: bigint\n nonce: Hash\n hookData: Hex\n}): Hex {\n if (!isHex(params.remoteToken, { strict: true }) || hexToBytes(params.remoteToken).length !== 32) throw new BridgeError('remoteToken must contain 32 bytes')\n if (!isHex(params.remoteRecipient, { strict: true }) || hexToBytes(params.remoteRecipient).length !== 32) throw new BridgeError('remoteRecipient must contain 32 bytes')\n if (!isHex(params.hookData, { strict: true }) || hexToBytes(params.hookData).length !== HOOK_DATA_BYTES) throw new BridgeError('hookData must contain 65 bytes')\n if (!isAddress(params.localToken) || !isAddress(params.depositor)) throw new BridgeError('Payload EVM address is invalid')\n const payload = new Uint8Array(305)\n payload.set([0x5a, 0x2e, 0x0a, 0xcd, 0, 0, 0, 1], 0)\n payload.set(uintBytes(params.amount, 32), 8)\n payload.set(uintBytes(BigInt(params.remoteDomain), 4), 40)\n payload.set(hexToBytes(params.remoteToken), 44)\n payload.set(hexToBytes(params.remoteRecipient), 76)\n payload.set(hexToBytes(padHex(getAddress(params.localToken), { size: 32 })), 108)\n payload.set(hexToBytes(padHex(getAddress(params.depositor), { size: 32 })), 140)\n payload.set(uintBytes(params.maxFee, 32), 172)\n payload.set(hexToBytes(params.nonce), 204)\n payload.set(uintBytes(BigInt(HOOK_DATA_BYTES), 4), 236)\n payload.set(hexToBytes(params.hookData), 240)\n return toHex(payload)\n}\n\n/**\n * Hashes a canonical xReserve deposit payload for Circle attestation lookup.\n *\n * Pure and local; computes Keccak-256 without contacting Circle.\n *\n * @param payload Canonical xReserve deposit bytes.\n * @returns The 32-byte Circle message hash.\n *\n * @example\n * const messageHash = calculateXReserveMessageHash(payload)\n */\nexport function calculateXReserveMessageHash(payload: Hex): Hash {\n return keccak256(payload)\n}\n\n/**\n * Formats fixed-width hexadecimal bytes as an Aleo `[u8; N]` literal.\n *\n * Pure and local; validates the exact byte width before formatting inputs for a wallet.\n *\n * @param value Prefixed hexadecimal bytes to format.\n * @param expectedBytes Required array width from the target Aleo function.\n * @returns An Aleo array literal containing decimal `u8` values.\n * @throws BridgeError When the input is malformed or has the wrong width.\n *\n * @example\n * const hashInput = xReserveHexToAleoBytes(messageHash, 32)\n */\nexport function xReserveHexToAleoBytes(value: Hex, expectedBytes: number): string {\n if (!isHex(value, { strict: true })) throw new BridgeError('Aleo byte-array input must be prefixed hexadecimal')\n const bytes = hexToBytes(value)\n if (bytes.length !== expectedBytes) throw new BridgeError(`Aleo byte-array input must contain ${expectedBytes} bytes`)\n return `[${[...bytes].map((byte) => `${byte}u8`).join(',')}]`\n}\n\n/**\n * Encodes an Ethereum address as the 32-byte recipient required by xReserve burns.\n *\n * Pure and local; preserves the 20 address bytes and adds twelve leading zero bytes.\n *\n * @param address Checksummed or lowercase Ethereum address selected by the caller.\n * @returns The address left-padded to exactly 32 bytes.\n * @throws BridgeError When the address is malformed.\n *\n * @example\n * const recipient = evmAddressToXReserveBytes32('0x0000000000000000000000000000000000000001')\n */\nexport function evmAddressToXReserveBytes32(address: string): Hex {\n if (!isAddress(address)) throw new BridgeError(`Invalid Ethereum recipient address: ${address}`)\n return padHex(getAddress(address), { size: 32 })\n}\n","import { isHash, isHex, type Hash, type Hex } from 'viem'\nimport { BridgeError } from '../errors/bridgeErrors.js'\nimport type {\n AleoBridgeExecutor,\n ExecuteXReservePrivateMintParameters,\n XReservePrivateMintExecution,\n} from '../types/aleo.js'\nimport type { BridgeRegistry } from '../types/protocol.js'\nimport { buildXReserveHookData, calculateXReserveMessageHash, xReserveHexToAleoBytes } from '../utils/xreserve.js'\n\n/**\n * Submits the sole user-authorized Aleo mint in the inbound bridge flows.\n *\n * Requires a private xReserve plan and a completed Circle attestation. The\n * wallet calls the wrapper's `private_mint` with the canonical 305-byte payload,\n * 65-byte signature, 32-byte hash, the plan's secret nonce, and intended recipient. Hyperlane\n * and non-private xReserve destination mints remain relayer-driven.\n *\n * @param registry Reviewed deployment snapshot used to resolve the wrapper program.\n * @param executor Connected Aleo wallet client that proves, signs, and broadcasts.\n * @param params Original plan, confirmed deposit, Circle attestation, and fee privacy choice.\n * @returns The Aleo transaction id and destination-confirming transfer receipt.\n * @throws BridgeError When the plan is not private, identifiers disagree, inputs have invalid widths, or the wallet returns no transaction id.\n *\n * @example\n * const mint = await executeXReservePrivateMint(registry, aleoWalletClient, {\n * plan,\n * deposit: depositExecution.receipt,\n * attestation,\n * })\n */\nexport async function executeXReservePrivateMint(\n registry: BridgeRegistry,\n executor: AleoBridgeExecutor,\n params: ExecuteXReservePrivateMintParameters,\n): Promise<XReservePrivateMintExecution> {\n const { plan, deposit, attestation } = params\n if (plan.protocol !== 'xreserve' || plan.route.protocol !== 'xreserve' || plan.mintMode !== 'private') {\n throw new BridgeError('private_mint requires a private xReserve transfer plan')\n }\n if (plan.registryVersion !== registry.version) throw new BridgeError(`Transfer plan uses registry ${plan.registryVersion}; expected ${registry.version}`)\n const route = registry.routes.find((entry) => entry.id === plan.route.id)\n if (!route || route.protocol !== 'xreserve' || route.availability !== 'active') throw new BridgeError(`xReserve route is not executable: ${plan.route.id}`)\n const wrapperProgram = route.metadata?.wrapperProgram\n if (typeof wrapperProgram !== 'string' || !wrapperProgram.endsWith('.aleo')) throw new BridgeError(`xReserve wrapper program is invalid: ${plan.route.id}`)\n if (deposit.protocol !== 'xreserve' || deposit.status !== 'ATTESTATION_PENDING') throw new BridgeError('Private mint requires a confirmed xReserve deposit awaiting attestation')\n if (attestation.status !== 'complete') throw new BridgeError('Private mint requires a completed Circle attestation')\n\n const depositPayload = deposit.protocolState.payload\n const depositHash = deposit.protocolState.messageHash\n const intendedRecipient = deposit.protocolState.intendedRecipient\n const mintMode = deposit.protocolState.mintMode\n if (typeof depositPayload !== 'string' || !isHex(depositPayload, { strict: true })) throw new BridgeError('Deposit receipt is missing the canonical xReserve payload')\n if (typeof depositHash !== 'string' || !isHash(depositHash)) throw new BridgeError('Deposit receipt is missing the Circle message hash')\n if (typeof intendedRecipient !== 'string' || intendedRecipient !== plan.recipient || mintMode !== 'private') throw new BridgeError('Deposit receipt does not match the private mint plan')\n if (attestation.payload.toLowerCase() !== depositPayload.toLowerCase() || attestation.messageHash.toLowerCase() !== depositHash.toLowerCase()) throw new BridgeError('Circle attestation does not match the confirmed deposit')\n if (calculateXReserveMessageHash(attestation.payload) !== attestation.messageHash) throw new BridgeError('Circle attestation payload has an invalid message hash')\n const secretNonce = plan.privateMintSecretNonce ?? '0scalar'\n const expectedHookData = await buildXReserveHookData('private', plan.recipient, route.environment, secretNonce)\n const attestedHookData = `0x${attestation.payload.slice(-130)}`\n if (attestedHookData.toLowerCase() !== expectedHookData.toLowerCase()) {\n throw new BridgeError('Private mint secret nonce and recipient do not match the attested hook data')\n }\n\n const result = await executor.executeTransaction({\n program: wrapperProgram,\n function: 'private_mint',\n inputs: [\n xReserveHexToAleoBytes(attestation.payload, 305),\n xReserveHexToAleoBytes(attestation.attestation, 65),\n xReserveHexToAleoBytes(attestation.messageHash, 32),\n secretNonce,\n plan.recipient,\n ],\n privateFee: params.privateFee ?? false,\n })\n const transactionId = typeof result === 'string' ? result : result.transactionId\n if (!transactionId) throw new BridgeError('Aleo wallet returned an empty private mint transaction id')\n return {\n transactionId,\n receipt: {\n ...deposit,\n status: 'DESTINATION_CONFIRMING',\n destinationTxId: transactionId,\n protocolState: {\n ...deposit.protocolState,\n attestation: attestation.attestation,\n destinationProgram: wrapperProgram,\n destinationFunction: 'private_mint',\n secretNonce,\n },\n },\n }\n}\n","import type { TransactionInput } from '@provablehq/veil-core'\nimport { BridgeError } from '../errors/bridgeErrors.js'\nimport type {\n AleoBridgeExecutor,\n ExecuteXReserveBurnParameters,\n XReserveBurnCall,\n XReserveBurnExecution,\n} from '../types/aleo.js'\nimport type { BridgeRegistry } from '../types/protocol.js'\nimport { parseDecimalAmount } from '../utils/units.js'\nimport { evmAddressToXReserveBytes32, xReserveHexToAleoBytes } from '../utils/xreserve.js'\n\nconst ETHEREUM_DESTINATION_DOMAIN = 0\n\nfunction validatedRoute(registry: BridgeRegistry, params: ExecuteXReserveBurnParameters) {\n const { plan } = params\n if (plan.protocol !== 'xreserve' || plan.route.protocol !== 'xreserve') throw new BridgeError('USDCx burn requires an xReserve transfer plan')\n if (plan.registryVersion !== registry.version) throw new BridgeError(`Transfer plan uses registry ${plan.registryVersion}; expected ${registry.version}`)\n const route = registry.routes.find((entry) => entry.id === plan.route.id)\n if (!route || route.protocol !== 'xreserve' || route.availability !== 'active') throw new BridgeError(`xReserve route is not executable: ${plan.route.id}`)\n const sourceChain = registry.chains.find((chain) => chain.id === plan.sourceAsset.chainId)\n const destinationChain = registry.chains.find((chain) => chain.id === plan.destinationAsset.chainId)\n if (sourceChain?.family !== 'aleo' || destinationChain?.family !== 'evm') throw new BridgeError('USDCx burn action requires an Aleo-to-Ethereum route')\n if (route.sourceAssetId !== plan.sourceAsset.id || route.destinationAssetId !== plan.destinationAsset.id) throw new BridgeError(`Transfer plan assets do not match configured route: ${route.id}`)\n const bridgeProgram = route.metadata?.bridgeProgram\n const wrapperProgram = route.metadata?.wrapperProgram\n const tokenProgram = route.metadata?.remoteToken\n const nativeDomain = route.metadata?.ethereumDestinationDomain\n if (typeof bridgeProgram !== 'string' || !bridgeProgram.endsWith('.aleo')) throw new BridgeError(`xReserve bridge program is invalid: ${route.id}`)\n if (typeof wrapperProgram !== 'string' || !wrapperProgram.endsWith('.aleo')) throw new BridgeError(`xReserve wrapper program is invalid: ${route.id}`)\n if (typeof tokenProgram !== 'string' || !tokenProgram.endsWith('.aleo')) throw new BridgeError(`xReserve token program is invalid: ${route.id}`)\n if (nativeDomain !== ETHEREUM_DESTINATION_DOMAIN) throw new BridgeError(`xReserve Ethereum destination domain must be ${ETHEREUM_DESTINATION_DOMAIN}: ${route.id}`)\n return { route, bridgeProgram, wrapperProgram, tokenProgram, nativeDomain }\n}\n\nfunction assertPrivateInputs(userRecord: TransactionInput | undefined, merkleProof: string | undefined, tokenProgram: string): asserts userRecord is TransactionInput {\n if (userRecord == null) throw new BridgeError('private_burn requires a USDCx userRecord input')\n if (typeof userRecord === 'object') {\n if (userRecord.type !== 'record' || userRecord.program !== tokenProgram || userRecord.recordname !== 'Token') {\n throw new BridgeError(`private_burn record requests must select ${tokenProgram}/Token`)\n }\n }\n if (typeof merkleProof !== 'string' || !merkleProof.startsWith('[') || !merkleProof.endsWith(']')) {\n throw new BridgeError('private_burn requires an encoded [MerkleProof; 2] Aleo literal')\n }\n}\n\n/**\n * Builds one validated Aleo USDCx burn call without prompting a wallet.\n *\n * Pure and local: fixes Ethereum's Circle domain to `0u32`, encodes the EVM\n * recipient as `[u8; 32]`, and selects the bridge or wrapper transition. Dynamic\n * pause, freeze-list, and burn-limit checks remain atomic on-chain assertions.\n *\n * @param registry Reviewed route snapshot supplying the deployed Aleo programs and domain.\n * @param params Prepared reverse route, burn mode, and private inputs when applicable.\n * @returns Exact program, function, and ordered wallet inputs for the burn.\n * @throws BridgeError When the route, amount, recipient, mode-specific inputs, or metadata is invalid.\n *\n * @example\n * const call = buildXReserveBurnCall(registry, { plan, mode: 'public-as-signer' })\n */\nexport function buildXReserveBurnCall(\n registry: BridgeRegistry,\n params: ExecuteXReserveBurnParameters,\n): XReserveBurnCall {\n const deployment = validatedRoute(registry, params)\n const mode = params.mode ?? 'private'\n if (mode !== 'public-as-signer' && mode !== 'public' && mode !== 'private') throw new BridgeError(`Unsupported USDCx burn mode: ${String(mode)}`)\n const amountAtomic = parseDecimalAmount(params.plan.amountIn, params.plan.sourceAsset.decimals)\n if (amountAtomic <= 0n) throw new BridgeError('USDCx burn amount must be greater than zero')\n const nativeRecipientBytes32 = evmAddressToXReserveBytes32(params.plan.recipient)\n const amount = `${amountAtomic}u128`\n const nativeDomain = `${deployment.nativeDomain}u32`\n const nativeRecipient = xReserveHexToAleoBytes(nativeRecipientBytes32, 32)\n\n if (mode === 'private') {\n assertPrivateInputs(params.userRecord, params.merkleProof, deployment.tokenProgram)\n return {\n routeId: deployment.route.id,\n mode,\n program: deployment.wrapperProgram,\n function: 'private_burn',\n inputs: [params.userRecord, amount, nativeDomain, nativeRecipient, params.merkleProof!],\n amountAtomic,\n nativeDomain: deployment.nativeDomain,\n nativeRecipientBytes32,\n }\n }\n\n return {\n routeId: deployment.route.id,\n mode,\n program: deployment.bridgeProgram,\n function: mode === 'public' ? 'burn_public' : 'burn_public_as_signer',\n inputs: [amount, nativeDomain, nativeRecipient],\n amountAtomic,\n nativeDomain: deployment.nativeDomain,\n nativeRecipientBytes32,\n }\n}\n\n/**\n * Prompts an Aleo wallet to submit a public, signer-bound, or private USDCx burn.\n *\n * The action returns after broadcast. The Aleo-operated burn attestation service\n * observes accepted burns and forwards them to Circle without another client call.\n *\n * @param registry Reviewed route snapshot used to validate program and domain identifiers.\n * @param executor Connected Aleo wallet client that proves, signs, and broadcasts.\n * @param params Prepared reverse route, selected mode, optional record/proof, and fee privacy.\n * @returns The Aleo transaction id and resumable source-confirming receipt.\n * @throws BridgeError When call construction fails or the wallet returns no transaction id.\n *\n * @example\n * const burn = await executeXReserveBurn(registry, aleoWalletClient, {\n * plan,\n * userRecord,\n * merkleProof,\n * })\n */\nexport async function executeXReserveBurn(\n registry: BridgeRegistry,\n executor: AleoBridgeExecutor,\n params: ExecuteXReserveBurnParameters,\n): Promise<XReserveBurnExecution> {\n const call = buildXReserveBurnCall(registry, params)\n const result = await executor.executeTransaction({\n program: call.program,\n function: call.function,\n inputs: call.inputs,\n privateFee: params.privateFee ?? false,\n })\n const transactionId = typeof result === 'string' ? result : result.transactionId\n if (!transactionId) throw new BridgeError('Aleo wallet returned an empty burn transaction id')\n return {\n transactionId,\n receipt: {\n id: transactionId,\n protocol: 'xreserve',\n status: 'SOURCE_CONFIRMING',\n sourceTxId: transactionId,\n protocolState: {\n routeId: call.routeId,\n burnMode: call.mode,\n amountAtomic: call.amountAtomic.toString(),\n nativeDomain: call.nativeDomain,\n nativeRecipientBytes32: call.nativeRecipientBytes32,\n sourceProgram: call.program,\n sourceFunction: call.function,\n forwardingService: 'aleo-burn-attestation',\n },\n },\n }\n}\n","import bs58 from 'bs58'\nimport { getAddress, hexToBytes, isAddress, padHex } from 'viem'\nimport { BridgeError } from '../errors/bridgeErrors.js'\n\nfunction littleEndianU128(bytes: Uint8Array): bigint {\n let value = 0n\n for (let index = 0; index < bytes.length; index++) {\n value |= BigInt(bytes[index]!) << BigInt(index * 8)\n }\n return value\n}\n\n/**\n * Encodes an Ethereum account as the two little-endian limbs used by Aleo Warp Routes.\n *\n * Pure and local; validates a 20-byte EVM address, left-pads it to Hyperlane\n * bytes32 form, and interprets each 16-byte half as an Aleo `u128`.\n *\n * @param address Destination Ethereum account supplied by the transfer plan.\n * @returns Two unsigned 128-bit limbs in Hyperlane message order.\n * @throws BridgeError When the destination is not a valid 20-byte EVM address.\n *\n * @example\n * const recipient = evmAddressToAleoHyperlaneRecipient('0x1e196d0a7d8189054c4db744ab3340c3f1c68b19')\n */\nexport function evmAddressToAleoHyperlaneRecipient(address: string): readonly [bigint, bigint] {\n if (!isAddress(address)) throw new BridgeError(`Invalid Ethereum Hyperlane recipient: ${address}`)\n const recipient = hexToBytes(padHex(getAddress(address), { size: 32 }))\n return [\n littleEndianU128(recipient.slice(0, 16)),\n littleEndianU128(recipient.slice(16, 32)),\n ]\n}\n\n/**\n * Encodes a Solana account as the two little-endian limbs used by Aleo Warp Routes.\n *\n * Pure and local; decodes a base58 account to its 32-byte public key and\n * interprets each 16-byte half as an Aleo `u128`.\n *\n * @param address Destination Solana account supplied by the transfer plan.\n * @returns Two unsigned 128-bit limbs in Hyperlane message order.\n * @throws BridgeError When the destination is not a base58-encoded 32-byte account.\n *\n * @example\n * const recipient = solanaAddressToAleoHyperlaneRecipient('11111111111111111111111111111111')\n */\nexport function solanaAddressToAleoHyperlaneRecipient(address: string): readonly [bigint, bigint] {\n try {\n const recipient = bs58.decode(address)\n if (recipient.length !== 32) throw new Error('invalid public key width')\n return [\n littleEndianU128(recipient.slice(0, 16)),\n littleEndianU128(recipient.slice(16, 32)),\n ]\n } catch (cause) {\n throw new BridgeError(`Invalid Solana Hyperlane recipient: ${address}`, { cause })\n }\n}\n","import { BridgeError } from '../errors/bridgeErrors.js'\nimport type {\n AleoBridgeExecutor,\n AleoHyperlaneTransferRemoteCall,\n AleoHyperlaneTransferRemoteExecution,\n ExecuteAleoHyperlaneTransferRemoteParameters,\n} from '../types/aleo.js'\nimport type { BridgeRegistry, ProtocolBridgeRoute } from '../types/protocol.js'\nimport {\n evmAddressToAleoHyperlaneRecipient,\n solanaAddressToAleoHyperlaneRecipient,\n} from '../utils/hyperlane.js'\nimport { parseDecimalAmount } from '../utils/units.js'\n\nconst PLACEHOLDER_FIELDS = [\n 'aleoTokenType',\n 'aleoTokenOwner',\n 'aleoIsm',\n 'aleoHook',\n 'aleoTokenId',\n 'aleoMailboxDefaultHook',\n 'aleoMailboxRequiredHook',\n 'aleoRemoteRouterRecipient',\n 'aleoRemoteRouterGas',\n 'aleoRecipient',\n 'aleoAllowanceSpender0',\n 'aleoAllowanceAmount0',\n 'aleoAllowanceSpender1',\n 'aleoAllowanceAmount1',\n 'aleoAllowanceSpender2',\n 'aleoAllowanceAmount2',\n 'aleoAllowanceSpender3',\n 'aleoAllowanceAmount3',\n] as const\n\nconst APP_METADATA_FIELDS = new Set<string>([\n 'aleoTokenType',\n 'aleoTokenOwner',\n 'aleoIsm',\n 'aleoHook',\n 'aleoTokenId',\n])\n\nconst MAILBOX_STATE_FIELDS = new Set<string>([\n 'aleoMailboxDefaultHook',\n 'aleoMailboxRequiredHook',\n])\n\nconst REMOTE_ROUTER_FIELDS = new Set<string>([\n 'aleoRemoteRouterRecipient',\n 'aleoRemoteRouterGas',\n])\n\nconst ALLOWANCE_SPENDER_FIELDS = new Set<string>([\n 'aleoAllowanceSpender0',\n 'aleoAllowanceSpender1',\n 'aleoAllowanceSpender2',\n 'aleoAllowanceSpender3',\n])\n\nconst UNUSED_ALLOWANCE_AMOUNT_FIELDS = new Set<string>([\n 'aleoAllowanceAmount1',\n 'aleoAllowanceAmount2',\n 'aleoAllowanceAmount3',\n])\n\nfunction metadataString(route: ProtocolBridgeRoute, key: string): string {\n const value = route.metadata?.[key]\n if (typeof value !== 'string' || value.length === 0) throw new BridgeError(`Hyperlane route metadata ${key} is missing: ${route.id}`)\n return value\n}\n\nfunction metadataNumber(route: ProtocolBridgeRoute, key: string): number {\n const value = route.metadata?.[key]\n if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) throw new BridgeError(`Hyperlane route metadata ${key} is invalid: ${route.id}`)\n return value\n}\n\nfunction optionalMetadataNumber(route: ProtocolBridgeRoute, key: string, fallback: number): number {\n return route.metadata?.[key] == null ? fallback : metadataNumber(route, key)\n}\n\nfunction validatedRoute(registry: BridgeRegistry, params: ExecuteAleoHyperlaneTransferRemoteParameters) {\n const { plan } = params\n if (plan.protocol !== 'hyperlane' || plan.route.protocol !== 'hyperlane') throw new BridgeError('Aleo transfer_remote requires a Hyperlane transfer plan')\n if (plan.registryVersion !== registry.version) throw new BridgeError(`Transfer plan uses registry ${plan.registryVersion}; expected ${registry.version}`)\n const route = registry.routes.find((entry) => entry.id === plan.route.id)\n if (!route || route.protocol !== 'hyperlane') throw new BridgeError(`Hyperlane route is not configured: ${plan.route.id}`)\n if (route.sourceAssetId !== plan.sourceAsset.id || route.destinationAssetId !== plan.destinationAsset.id) throw new BridgeError(`Transfer plan assets do not match configured route: ${route.id}`)\n const sourceChain = registry.chains.find((chain) => chain.id === plan.sourceAsset.chainId)\n if (sourceChain?.family !== 'aleo') throw new BridgeError('transfer_remote requires an Aleo source asset')\n const destinationChain = registry.chains.find((chain) => chain.id === plan.destinationAsset.chainId)\n if (!destinationChain) throw new BridgeError(`Destination chain is not configured: ${plan.destinationAsset.chainId}`)\n const program = metadataString(route, 'aleoRouterProgram')\n if (!program.endsWith('.aleo')) throw new BridgeError(`Aleo Warp Route program is invalid: ${route.id}`)\n return { route, program, destinationChain }\n}\n\nfunction allowance(route: ProtocolBridgeRoute, index: number): string {\n return `{ spender: ${metadataString(route, `aleoAllowanceSpender${index}`)}, amount: ${metadataString(route, `aleoAllowanceAmount${index}`)}u64 }`\n}\n\n/**\n * Builds an Aleo Hyperlane `transfer_remote` call without prompting a wallet.\n *\n * The default registry deliberately produces non-executable calls containing\n * conspicuous placeholder deployment values. This makes the complete seven-input\n * ABI inspectable while preventing those values from being mistaken for live data.\n *\n * @param registry Reviewed route snapshot supplying the Aleo Warp Route configuration.\n * @param params Prepared Aleo-origin Hyperlane plan.\n * @returns Exact program, transition, and ordered Aleo inputs.\n * @throws BridgeError When the plan or route metadata is inconsistent.\n *\n * @example\n * const call = buildAleoHyperlaneTransferRemoteCall(registry, { plan })\n */\nexport function buildAleoHyperlaneTransferRemoteCall(\n registry: BridgeRegistry,\n params: ExecuteAleoHyperlaneTransferRemoteParameters,\n): AleoHyperlaneTransferRemoteCall {\n if (params.mode != null && params.mode !== 'caller' && params.mode !== 'signer') {\n throw new BridgeError(`Unsupported Aleo Hyperlane transfer mode: ${String(params.mode)}`)\n }\n const { route, program, destinationChain } = validatedRoute(registry, params)\n const amountAtomic = parseDecimalAmount(params.plan.amountIn, params.plan.sourceAsset.decimals)\n const destination = metadataNumber(route, 'aleoDestinationDomain')\n const localDecimals = optionalMetadataNumber(route, 'aleoLocalDecimals', params.plan.sourceAsset.decimals)\n const remoteDecimals = optionalMetadataNumber(route, 'aleoRemoteDecimals', params.plan.destinationAsset.decimals)\n const appMetadata = `{ token_type: ${metadataString(route, 'aleoTokenType')}u8, token_owner: ${metadataString(route, 'aleoTokenOwner')}, ism: ${metadataString(route, 'aleoIsm')}, hook: ${metadataString(route, 'aleoHook')}, token_id: ${metadataString(route, 'aleoTokenId')}, local_decimals: ${localDecimals}u8, remote_decimals: ${remoteDecimals}u8 }`\n const mailboxState = `{ default_hook: ${metadataString(route, 'aleoMailboxDefaultHook')}, required_hook: ${metadataString(route, 'aleoMailboxRequiredHook')} }`\n const remoteRouter = `{ domain: ${destination}u32, recipient: ${metadataString(route, 'aleoRemoteRouterRecipient')}, gas: ${metadataString(route, 'aleoRemoteRouterGas')}u128 }`\n const recipientLimbs = destinationChain.family === 'evm'\n ? evmAddressToAleoHyperlaneRecipient(params.plan.recipient)\n : destinationChain.family === 'solana'\n ? solanaAddressToAleoHyperlaneRecipient(params.plan.recipient)\n : undefined\n const recipient = recipientLimbs\n ? `[${recipientLimbs[0]}u128, ${recipientLimbs[1]}u128]`\n : metadataString(route, 'aleoRecipient')\n const allowances = `[${[0, 1, 2, 3].map((index) => allowance(route, index)).join(', ')}]`\n const usesPlaceholderConfiguration = route.metadata?.aleoPlaceholderConfiguration === true\n let placeholderFields = route.metadata?.aleoAppMetadataVerified === true\n ? PLACEHOLDER_FIELDS.filter((field) => !APP_METADATA_FIELDS.has(field))\n : PLACEHOLDER_FIELDS\n if (route.metadata?.aleoMailboxStateVerified === true) {\n placeholderFields = placeholderFields.filter((field) => !MAILBOX_STATE_FIELDS.has(field))\n }\n if (route.metadata?.aleoRemoteRouterVerified === true) {\n placeholderFields = placeholderFields.filter((field) => !REMOTE_ROUTER_FIELDS.has(field))\n }\n if (route.metadata?.aleoAllowanceSpendersVerified === true) {\n placeholderFields = placeholderFields.filter((field) => !ALLOWANCE_SPENDER_FIELDS.has(field))\n }\n if (route.metadata?.aleoUnusedAllowancesVerified === true) {\n placeholderFields = placeholderFields.filter((field) => !UNUSED_ALLOWANCE_AMOUNT_FIELDS.has(field))\n }\n if (recipientLimbs) {\n placeholderFields = placeholderFields.filter((field) => field !== 'aleoRecipient')\n }\n const functionName = params.mode === 'signer' ? 'transfer_remote_as_signer' : 'transfer_remote'\n\n return {\n routeId: route.id,\n program,\n function: functionName,\n inputs: [\n appMetadata,\n mailboxState,\n remoteRouter,\n `${destination}u32`,\n recipient,\n `${amountAtomic}u128`,\n allowances,\n ],\n amountAtomic,\n usesPlaceholderConfiguration,\n placeholderFields: usesPlaceholderConfiguration ? placeholderFields : [],\n }\n}\n\n/**\n * Submits a fully configured Aleo Hyperlane `transfer_remote` transaction.\n *\n * Default-registry calls fail before wallet access because their deployment\n * values are placeholders. Submission becomes available only after a reviewed\n * registry removes the placeholder flag and supplies every required value.\n *\n * @param registry Reviewed route snapshot supplying the Aleo Warp Route configuration.\n * @param executor Connected Aleo wallet client that proves, signs, and broadcasts.\n * @param params Prepared Aleo-origin Hyperlane plan and fee preference.\n * @returns The Aleo transaction id and resumable Hyperlane receipt.\n * @throws BridgeError When configuration is placeholder, invalid, or the wallet returns no id.\n */\nexport async function executeAleoHyperlaneTransferRemote(\n registry: BridgeRegistry,\n executor: AleoBridgeExecutor,\n params: ExecuteAleoHyperlaneTransferRemoteParameters,\n): Promise<AleoHyperlaneTransferRemoteExecution> {\n const call = buildAleoHyperlaneTransferRemoteCall(registry, params)\n if (call.usesPlaceholderConfiguration) {\n throw new BridgeError(`Aleo Hyperlane route contains non-executable placeholder configuration: ${call.routeId}`)\n }\n const route = registry.routes.find((entry) => entry.id === call.routeId)\n if (route?.availability !== 'active') {\n throw new BridgeError(`Aleo Hyperlane route is not active: ${call.routeId}`)\n }\n const result = await executor.executeTransaction({\n program: call.program,\n function: call.function,\n inputs: call.inputs,\n privateFee: params.privateFee ?? false,\n })\n const transactionId = typeof result === 'string' ? result : result.transactionId\n if (!transactionId) throw new BridgeError('Aleo wallet returned an empty Hyperlane transaction id')\n return {\n transactionId,\n receipt: {\n id: transactionId,\n protocol: 'hyperlane',\n status: 'SOURCE_CONFIRMING',\n sourceTxId: transactionId,\n protocolState: { routeId: call.routeId, sourceProgram: call.program, sourceFunction: call.function },\n },\n }\n}\n","import type { Client } from '@provablehq/veil-core'\nimport {\n getProtocolAssets,\n getProtocolRoutes,\n type GetProtocolAssetsParameters,\n type GetProtocolRoutesParameters,\n} from '../../actions/protocolDiscovery.js'\nimport { prepareTransfer } from '../../actions/prepareTransfer.js'\nimport {\n executeEvmHyperlaneTransfer,\n quoteEvmHyperlaneTransfer,\n} from '../../actions/evmHyperlane.js'\nimport {\n executeEvmXReserveTransfer,\n getXReserveAttestation,\n quoteEvmXReserveTransfer,\n} from '../../actions/evmXReserve.js'\nimport { executeXReservePrivateMint } from '../../actions/xreservePrivateMint.js'\nimport { executeXReserveBurn } from '../../actions/xreserveBurn.js'\nimport {\n buildAleoHyperlaneTransferRemoteCall,\n executeAleoHyperlaneTransferRemote,\n} from '../../actions/aleoHyperlane.js'\nimport { BridgeError } from '../../errors/bridgeErrors.js'\nimport type {\n BridgeExecutors,\n EvmHyperlaneTransferExecution,\n EvmHyperlaneTransferQuote,\n ExecuteEvmHyperlaneTransferParameters,\n QuoteEvmHyperlaneTransferParameters,\n} from '../../types/evm.js'\nimport type {\n EvmXReserveTransferExecution,\n EvmXReserveTransferQuote,\n ExecuteEvmXReserveTransferParameters,\n GetXReserveAttestationParameters,\n QuoteEvmXReserveTransferParameters,\n XReserveAttestationResult,\n XReserveHttpTransport,\n} from '../../types/xreserve.js'\nimport type {\n AleoHyperlaneTransferRemoteCall,\n AleoHyperlaneTransferRemoteExecution,\n ExecuteAleoHyperlaneTransferRemoteParameters,\n ExecuteXReservePrivateMintParameters,\n ExecuteXReserveBurnParameters,\n XReserveBurnExecution,\n XReservePrivateMintExecution,\n} from '../../types/aleo.js'\nimport type {\n BridgeEnvironment,\n BridgeRegistry,\n BridgeTransferPlan,\n PrepareTransferParameters,\n ProtocolBridgeAsset,\n ProtocolBridgeRoute,\n} from '../../types/protocol.js'\n\n/**\n * Carries registry defaults from client construction into bound actions.\n *\n * @property environment Environment applied when an action omits its filter.\n * @property registry Reviewed snapshot supplying chains, assets, and routes.\n * @property executors Optional wallet capabilities injected at construction.\n * @property xReserveHttpTransport Optional HTTP capability for Circle attestation lookups.\n */\nexport type BridgeActionsConfig = {\n environment: BridgeEnvironment\n registry: BridgeRegistry\n executors?: BridgeExecutors | undefined\n xReserveHttpTransport?: XReserveHttpTransport | undefined\n}\n\n/**\n * Lists the protocol-oriented actions bound to a bridge client.\n *\n * @property getAssets Lists chain-specific registry assets without network access.\n * @property getRoutes Lists directional registry routes without network access.\n * @property prepareTransfer Validates inputs and returns a non-fund-moving execution plan.\n * @property quoteEvmHyperlaneTransfer Reads live Ethereum Warp Route fees without signing.\n * @property executeEvmHyperlaneTransfer Approves collateral when needed, then signs and dispatches through the Ethereum wallet.\n * @property quoteEvmXReserveTransfer Reads USDC balance and allowance and derives Circle deposit inputs.\n * @property executeEvmXReserveTransfer Approves USDC when needed and submits the Circle deposit.\n * @property getXReserveAttestation Fetches one Circle attestation by message hash.\n * @property executeXReservePrivateMint Prompts the Aleo wallet for the wrapper private mint.\n * @property executeXReserveBurn Prompts the Aleo wallet for one of the reviewed USDCx burn transitions.\n * @property buildAleoHyperlaneTransferRemoteCall Constructs the seven-input Aleo Warp Route call without wallet access.\n * @property executeAleoHyperlaneTransferRemote Submits only fully reviewed, non-placeholder Aleo Warp Route calls.\n */\nexport type BridgeActions = {\n getAssets: (params?: GetProtocolAssetsParameters) => ProtocolBridgeAsset[]\n getRoutes: (params?: GetProtocolRoutesParameters) => ProtocolBridgeRoute[]\n prepareTransfer: (params: PrepareTransferParameters) => BridgeTransferPlan\n quoteEvmHyperlaneTransfer: (params: QuoteEvmHyperlaneTransferParameters) => Promise<EvmHyperlaneTransferQuote>\n executeEvmHyperlaneTransfer: (params: ExecuteEvmHyperlaneTransferParameters) => Promise<EvmHyperlaneTransferExecution>\n quoteEvmXReserveTransfer: (params: QuoteEvmXReserveTransferParameters) => Promise<EvmXReserveTransferQuote>\n executeEvmXReserveTransfer: (params: ExecuteEvmXReserveTransferParameters) => Promise<EvmXReserveTransferExecution>\n getXReserveAttestation: (params: GetXReserveAttestationParameters) => Promise<XReserveAttestationResult>\n executeXReservePrivateMint: (params: ExecuteXReservePrivateMintParameters) => Promise<XReservePrivateMintExecution>\n executeXReserveBurn: (params: ExecuteXReserveBurnParameters) => Promise<XReserveBurnExecution>\n buildAleoHyperlaneTransferRemoteCall: (params: ExecuteAleoHyperlaneTransferRemoteParameters) => AleoHyperlaneTransferRemoteCall\n executeAleoHyperlaneTransferRemote: (params: ExecuteAleoHyperlaneTransferRemoteParameters) => Promise<AleoHyperlaneTransferRemoteExecution>\n}\n\n/**\n * Binds registry discovery and transfer planning to a client.\n *\n * Discovery and planning are pure and local. EVM actions use the optional\n * executor injected through the configuration and fail before network access\n * when it is absent.\n *\n * @param client Client receiving the action layer.\n * @param config Registry and default environment selected at construction.\n * @returns Bound protocol bridge actions.\n *\n * @example\n * const actions = bridgeActions(client, { environment: 'mainnet', registry })\n */\nexport function bridgeActions(_client: Client, config: BridgeActionsConfig): BridgeActions {\n const evmExecutor = () => {\n if (!config.executors?.evm) {\n throw new BridgeError('An EVM executor is required for Ethereum bridge actions')\n }\n return config.executors.evm\n }\n const xReserveTransport = () => {\n if (!config.xReserveHttpTransport) throw new BridgeError('An xReserve HTTP transport is required for attestation requests')\n return config.xReserveHttpTransport\n }\n const aleoExecutor = () => {\n if (!config.executors?.aleo) throw new BridgeError('An Aleo executor is required for Aleo bridge transactions')\n return config.executors.aleo\n }\n return {\n getAssets: (params = {}) => getProtocolAssets(config.registry, {\n ...params,\n environment: params.environment ?? config.environment,\n }),\n getRoutes: (params = {}) => getProtocolRoutes(config.registry, {\n ...params,\n environment: params.environment ?? config.environment,\n }),\n prepareTransfer: (params) => prepareTransfer(config.registry, params),\n quoteEvmHyperlaneTransfer: async (params) => quoteEvmHyperlaneTransfer(config.registry, evmExecutor(), params),\n executeEvmHyperlaneTransfer: async (params) => executeEvmHyperlaneTransfer(config.registry, evmExecutor(), params),\n quoteEvmXReserveTransfer: async (params) => quoteEvmXReserveTransfer(config.registry, evmExecutor(), params),\n executeEvmXReserveTransfer: async (params) => executeEvmXReserveTransfer(config.registry, evmExecutor(), params),\n getXReserveAttestation: async (params) => getXReserveAttestation(config.registry, xReserveTransport(), params),\n executeXReservePrivateMint: async (params) => executeXReservePrivateMint(config.registry, aleoExecutor(), params),\n executeXReserveBurn: async (params) => executeXReserveBurn(config.registry, aleoExecutor(), params),\n buildAleoHyperlaneTransferRemoteCall: (params) => buildAleoHyperlaneTransferRemoteCall(config.registry, params),\n executeAleoHyperlaneTransferRemote: async (params) => executeAleoHyperlaneTransferRemote(config.registry, aleoExecutor(), params),\n }\n}\n","import type {\n BridgeEnvironment,\n BridgeRegistry,\n ProtocolBridgeAsset,\n ProtocolBridgeChain,\n ProtocolBridgeRoute,\n} from '../types/protocol.js'\n\nconst EVM_ADDRESS = '^0x[0-9a-fA-F]{40}$'\nconst SOLANA_ADDRESS = '^[1-9A-HJ-NP-Za-km-z]{32,44}$'\nconst ALEO_ADDRESS = '^aleo1[0-9a-z]{58}$'\n\nconst chains: ProtocolBridgeChain[] = [\n { id: 'aleo', displayName: 'Aleo', family: 'aleo', environment: 'mainnet', nativeCurrencySymbol: 'ALEO', protocolDomains: { xreserve: 10002, hyperlane: 1634493807 } },\n { id: 'ethereum', displayName: 'Ethereum', family: 'evm', environment: 'mainnet', nativeCurrencySymbol: 'ETH', protocolDomains: { xreserve: 0, hyperlane: 1 } },\n { id: 'solana', displayName: 'Solana', family: 'solana', environment: 'mainnet', nativeCurrencySymbol: 'SOL', protocolDomains: { hyperlane: 1399811149 } },\n { id: 'base', displayName: 'Base', family: 'evm', environment: 'mainnet', nativeCurrencySymbol: 'ETH' },\n { id: 'hyperevm', displayName: 'HyperEVM', family: 'evm', environment: 'mainnet', nativeCurrencySymbol: 'HYPE' },\n { id: 'aleo-testnet', displayName: 'Aleo Testnet', family: 'aleo', environment: 'testnet', nativeCurrencySymbol: 'ALEO', protocolDomains: { xreserve: 10002, hyperlane: 1617853565 } },\n { id: 'sepolia', displayName: 'Ethereum Sepolia', family: 'evm', environment: 'testnet', nativeCurrencySymbol: 'ETH', protocolDomains: { hyperlane: 11155111 } },\n]\n\nconst assets: ProtocolBridgeAsset[] = [\n { id: 'aleo/aleo', chainId: 'aleo', symbol: 'ALEO', name: 'Aleo', decimals: 6, kind: 'native', locator: { kind: 'aleo-program', value: 'credits.aleo' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/usdcx', chainId: 'aleo', symbol: 'USDCx', name: 'USDCx', decimals: 6, kind: 'token', locator: { kind: 'aleo-program', value: 'usdcx_stablecoin.aleo' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/eth', chainId: 'aleo', symbol: 'ETH', name: 'Hyperlane ETH', decimals: 18, kind: 'token', locator: { kind: 'aleo-program', value: 'hyp_warp_token_eth_v2.aleo', tokenId: 'aleo1t7f29tq9qng2lfvrkpcuvu59jn24hrmzqdyqfn6p0u5p80npfvqqecmkj8' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/wbtc', chainId: 'aleo', symbol: 'WBTC', name: 'Hyperlane WBTC', decimals: 8, kind: 'token', locator: { kind: 'aleo-program', value: 'hyp_warp_token_wbtc_v2.aleo', tokenId: 'aleo1240fsvz2dhmj0cdtt8mc0yc8um9fmu236rqcl2qnlj9703hd2vpsdwyrtf' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/usdt', chainId: 'aleo', symbol: 'USDT', name: 'Hyperlane USDT', decimals: 6, kind: 'token', locator: { kind: 'aleo-program', value: 'hyp_warp_token_usdt_v2.aleo', tokenId: 'aleo18yynfz0lrfx0tund540vy2z7gju7ekgqsueg5jgu28mpm2z42ufq7qua8y' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/sol', chainId: 'aleo', symbol: 'SOL', name: 'Hyperlane SOL', decimals: 9, kind: 'token', locator: { kind: 'aleo-program', value: 'hyp_warp_token_sol_v2.aleo', tokenId: 'aleo1aa0zt0vg9uwknekpqeefkvad55swp7833wc5crp2prv0lm4djuxs5r7k6v' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'aleo/usad', chainId: 'aleo', symbol: 'USAD', name: 'USAD', decimals: 6, kind: 'token', locator: { kind: 'aleo-program', value: 'usad_stablecoin.aleo' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'ethereum/usdc', chainId: 'ethereum', symbol: 'USDC', name: 'USD Coin', decimals: 6, kind: 'token', locator: { kind: 'evm-contract', value: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' }, addressValidationRegex: EVM_ADDRESS },\n { id: 'ethereum/eth', chainId: 'ethereum', symbol: 'ETH', name: 'Ether', decimals: 18, kind: 'native', locator: { kind: 'native', value: 'ETH' }, addressValidationRegex: EVM_ADDRESS },\n { id: 'ethereum/wbtc', chainId: 'ethereum', symbol: 'WBTC', name: 'Wrapped Bitcoin', decimals: 8, kind: 'token', locator: { kind: 'evm-contract', value: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' }, addressValidationRegex: EVM_ADDRESS },\n { id: 'ethereum/usdt', chainId: 'ethereum', symbol: 'USDT', name: 'Tether USD', decimals: 6, kind: 'token', locator: { kind: 'evm-contract', value: '0xdAC17F958D2ee523a2206206994597C13D831ec7' }, addressValidationRegex: EVM_ADDRESS },\n { id: 'ethereum/aleo', chainId: 'ethereum', symbol: 'ALEO', name: 'Hyperlane ALEO', decimals: 6, kind: 'token', addressValidationRegex: EVM_ADDRESS },\n { id: 'ethereum/usad', chainId: 'ethereum', symbol: 'USAD', name: 'USAD route collateral', decimals: 6, kind: 'token', addressValidationRegex: EVM_ADDRESS },\n { id: 'solana/sol', chainId: 'solana', symbol: 'SOL', name: 'Solana', decimals: 9, kind: 'native', locator: { kind: 'native', value: 'SOL' }, addressValidationRegex: SOLANA_ADDRESS },\n { id: 'solana/aleo', chainId: 'solana', symbol: 'ALEO', name: 'Hyperlane ALEO', decimals: 6, kind: 'token', addressValidationRegex: SOLANA_ADDRESS },\n { id: 'base/aleo', chainId: 'base', symbol: 'ALEO', name: 'Hyperlane ALEO', decimals: 6, kind: 'token', addressValidationRegex: EVM_ADDRESS },\n { id: 'hyperevm/aleo', chainId: 'hyperevm', symbol: 'ALEO', name: 'Hyperlane ALEO', decimals: 6, kind: 'token', addressValidationRegex: EVM_ADDRESS },\n { id: 'aleo-testnet/usdcx', chainId: 'aleo-testnet', symbol: 'USDCx', name: 'Testnet USDCx', decimals: 6, kind: 'token', locator: { kind: 'aleo-program', value: 'test_usdcx_stablecoin.aleo' }, addressValidationRegex: ALEO_ADDRESS },\n { id: 'sepolia/usdc', chainId: 'sepolia', symbol: 'USDC', name: 'Testnet USD Coin', decimals: 6, kind: 'token', locator: { kind: 'evm-contract', value: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238' }, addressValidationRegex: EVM_ADDRESS },\n]\n\nconst XRESERVE_SOURCE = 'https://developers.circle.com/xreserve/references/supported-blockchains-and-domains'\nconst HYPERLANE_REGISTRY_COMMIT = '2621c16f2db1ccb46643265c110dac5ca2c7c51a'\nconst HYPERLANE_SOURCE = `https://github.com/hyperlane-xyz/hyperlane-registry/tree/${HYPERLANE_REGISTRY_COMMIT}/deployments/warp_routes`\nconst ALEO_ETH_PROGRAM_SOURCE = 'https://explorer.provable.com/program/hyp_warp_token_eth_v2.aleo'\nconst ALEO_ETH_APP_METADATA_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_eth_v2.aleo/mapping/app_metadata/true'\nconst ALEO_ETH_REMOTE_ROUTER_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_eth_v2.aleo/mapping/remote_routers/1u32'\nconst ALEO_ETH_SAMPLE_TRANSFER_SOURCE = 'https://explorer.provable.com/transaction/at1vu0yckkms887zkl3qz7plnncd56jtf5zeal4uj2808upsjkusy8q7yp9v8'\nconst ALEO_WBTC_PROGRAM_SOURCE = 'https://explorer.provable.com/program/hyp_warp_token_wbtc_v2.aleo'\nconst ALEO_WBTC_APP_METADATA_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_wbtc_v2.aleo/mapping/app_metadata/true'\nconst ALEO_WBTC_REMOTE_ROUTER_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_wbtc_v2.aleo/mapping/remote_routers/1u32'\nconst ALEO_USDT_PROGRAM_SOURCE = 'https://explorer.provable.com/program/hyp_warp_token_usdt_v2.aleo'\nconst ALEO_USDT_APP_METADATA_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_usdt_v2.aleo/mapping/app_metadata/true'\nconst ALEO_USDT_ETHEREUM_REMOTE_ROUTER_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_usdt_v2.aleo/mapping/remote_routers/1u32'\nconst ALEO_USDT_SAMPLE_TRANSFER_SOURCE = 'https://explorer.provable.com/transaction/at19caeeee8v3xc4kfwen4tx89f0tnggrpjp0anrhq2ca3y82xr9q8qyz8a9r'\nconst ALEO_USDT_HYPERLANE_CONFIG_SOURCE = 'https://github.com/hyperlane-xyz/hyperlane-registry/blob/418056e21734d26a7d14692e0ec5e902cc9e86bf/deployments/warp_routes/USDT/aleo-config.yaml'\nconst ALEO_SOL_PROGRAM_SOURCE = 'https://explorer.provable.com/program/hyp_warp_token_sol_v2.aleo'\nconst ALEO_SOL_APP_METADATA_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_sol_v2.aleo/mapping/app_metadata/true'\nconst ALEO_SOL_REMOTE_ROUTER_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_warp_token_sol_v2.aleo/mapping/remote_routers/1399811149u32'\nconst ALEO_SOL_HYPERLANE_CONFIG_SOURCE = 'https://github.com/hyperlane-xyz/hyperlane-registry/blob/418056e21734d26a7d14692e0ec5e902cc9e86bf/deployments/warp_routes/SOL/aleo-config.yaml'\nconst ALEO_MAILBOX_PROGRAM_SOURCE = 'https://explorer.provable.com/program/hyp_mailbox.aleo'\nconst ALEO_MAILBOX_METADATA_SOURCE = 'https://api.explorer.provable.com/v2/mainnet/program/hyp_mailbox.aleo/mapping/mailbox/true'\n\nconst ETHEREUM_HYPERLANE_COMMON = {\n sourceChainId: 1,\n destinationDomain: 1634493807,\n mailboxAddress: '0xc005dc82818d67AF737725bD4bf75435d065D239',\n interchainGasPaymaster: '0x9e6B1022bE9BBF5aFd152483DAD9b88911bC8611',\n interchainSecurityModule: '0x0000000000000000000000000000000000000000',\n registryCommit: HYPERLANE_REGISTRY_COMMIT,\n} as const\n\nconst ETH_HYPERLANE_METADATA = {\n ...ETHEREUM_HYPERLANE_COMMON,\n routerAddress: '0x38D447694f5c1f773ae3132cf93bF30B7Ec1Fa5A',\n routerType: 'native',\n destinationRouter: 'hyp_warp_token_eth_v2.aleo/aleo1t7f29tq9qng2lfvrkpcuvu59jn24hrmzqdyqfn6p0u5p80npfvqqecmkj8',\n} as const\n\nconst WBTC_HYPERLANE_METADATA = {\n ...ETHEREUM_HYPERLANE_COMMON,\n routerAddress: '0x20CDC85778b732073F7EecEF3DF25c0d310f8772',\n routerType: 'collateral',\n tokenAddress: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',\n destinationRouter: 'hyp_warp_token_wbtc_v2.aleo/aleo1240fsvz2dhmj0cdtt8mc0yc8um9fmu236rqcl2qnlj9703hd2vpsdwyrtf',\n} as const\n\nconst USDT_HYPERLANE_METADATA = {\n ...ETHEREUM_HYPERLANE_COMMON,\n routerAddress: '0x3C2064D78e4578E8F936E3db42aEF044E33FBF31',\n routerType: 'collateral',\n tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7',\n destinationRouter: 'hyp_warp_token_usdt_v2.aleo/aleo18yynfz0lrfx0tund540vy2z7gju7ekgqsueg5jgu28mpm2z42ufq7qua8y',\n requiresApprovalReset: true,\n} as const\n\n// Intentionally non-live values used only to expose the Aleo transfer_remote ABI.\n// executeAleoHyperlaneTransferRemote refuses these routes while the flag is true.\nconst ALEO_PLACEHOLDER_ADDRESS = 'aleo1kypwp5m7qtk9mwazgcpg0tq8aal23mnrvwfvug65qgcg9xvsrqgspyjm6n'\nconst ALEO_PLACEHOLDER_BYTES32 = `[${Array.from({ length: 32 }, () => '0u8').join(', ')}]`\n\nconst ALEO_MAILBOX_METADATA = {\n aleoMailboxStateVerified: true,\n aleoMailboxProgram: 'hyp_mailbox.aleo',\n aleoMailboxProgramEdition: 0,\n aleoMailboxProgramSource: ALEO_MAILBOX_PROGRAM_SOURCE,\n aleoMailboxMetadataSource: ALEO_MAILBOX_METADATA_SOURCE,\n aleoMailboxMetadataReviewedAt: '2026-08-17',\n aleoMailboxLocalDomain: 1634493807,\n aleoMailboxObservedNonce: 170,\n aleoMailboxObservedProcessCount: 291,\n aleoMailboxDefaultIsm: 'aleo1yvf5kcsdgnescqq2lar83mms79yh3ugvc3y0mdnlgvx4lyh5zugqr9hptk',\n aleoMailboxDefaultHook: 'aleo194tz0jmyq8rd9htvnqppqw4jqerk2p2zd8plzn3sxl06wcgsm5pq9fka74',\n aleoMailboxRequiredHook: 'aleo1yxevh9qgxehej46j7vueplwjcpfdfml2dje3ey4ukzknx7wzasgqnxgq82',\n aleoMailboxDispatchProxy: 'aleo1sge9kmjzs3d8fqrscy4hwn7vf9vw4jcxe877lv0m2w8hay78lsxsqg975s',\n aleoMailboxOwner: 'aleo1ypf8xgvz560ukw25hufj3d77gx69pdcy70nssdfdxd97j80d7cqs98d7x8',\n} as const\n\nfunction aleoHyperlanePlaceholders(program: string, destinationDomain: number) {\n return {\n aleoRouterProgram: program,\n aleoDestinationDomain: destinationDomain,\n aleoPlaceholderConfiguration: true,\n aleoTokenType: '0',\n aleoTokenOwner: ALEO_PLACEHOLDER_ADDRESS,\n aleoIsm: ALEO_PLACEHOLDER_ADDRESS,\n aleoHook: ALEO_PLACEHOLDER_ADDRESS,\n aleoTokenId: '0field',\n aleoRemoteRouterRecipient: ALEO_PLACEHOLDER_BYTES32,\n aleoRemoteRouterGas: '0',\n aleoRecipient: '[0u128, 0u128]',\n aleoAllowanceSpender0: ALEO_PLACEHOLDER_ADDRESS,\n aleoAllowanceAmount0: '0',\n aleoAllowanceSpender1: ALEO_PLACEHOLDER_ADDRESS,\n aleoAllowanceAmount1: '0',\n aleoAllowanceSpender2: ALEO_PLACEHOLDER_ADDRESS,\n aleoAllowanceAmount2: '0',\n aleoAllowanceSpender3: ALEO_PLACEHOLDER_ADDRESS,\n aleoAllowanceAmount3: '0',\n ...ALEO_MAILBOX_METADATA,\n } as const\n}\n\nconst ALEO_WBTC_APP_METADATA = {\n aleoAppMetadataVerified: true,\n aleoProgramSource: ALEO_WBTC_PROGRAM_SOURCE,\n aleoAppMetadataSource: ALEO_WBTC_APP_METADATA_SOURCE,\n aleoAppMetadataReviewedAt: '2026-08-17',\n aleoProgramEdition: 0,\n aleoTokenType: '1',\n aleoTokenOwner: 'aleo14jauje2a5sncm9u5t3mt6qqv3eq2hatkddskccs0dvsy35a0x58q0d6f95',\n aleoIsm: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoHook: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoTokenId: '1505227928464760254508513036497943623956572091841806589002910775534260084309field',\n aleoLocalDecimals: 8,\n aleoRemoteDecimals: 8,\n} as const\n\nconst ALEO_ETH_APP_METADATA = {\n aleoAppMetadataVerified: true,\n aleoProgramSource: ALEO_ETH_PROGRAM_SOURCE,\n aleoAppMetadataSource: ALEO_ETH_APP_METADATA_SOURCE,\n aleoAppMetadataReviewedAt: '2026-08-17',\n aleoProgramEdition: 0,\n aleoTokenType: '1',\n aleoTokenOwner: 'aleo1wq6f6qdqya44avznygz5hae40u3mjg64w0r93a4qfu4utpf8cg9q566f4r',\n aleoIsm: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoHook: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoTokenId: '133188123661477349522757068766864658505569365361420630212878794317749195359field',\n aleoLocalDecimals: 18,\n aleoRemoteDecimals: 18,\n} as const\n\nconst ALEO_USDT_APP_METADATA = {\n aleoAppMetadataVerified: true,\n aleoProgramSource: ALEO_USDT_PROGRAM_SOURCE,\n aleoAppMetadataSource: ALEO_USDT_APP_METADATA_SOURCE,\n aleoAppMetadataReviewedAt: '2026-08-17',\n aleoProgramEdition: 1,\n aleoTokenType: '1',\n aleoTokenOwner: 'aleo1l3gwacmjruxryy9c7c4fn0acyzprf29hucrvthw7f63lpyhd5y9srydq8z',\n aleoIsm: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoHook: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoTokenId: '8295938150000417034830036849466229528602563851235385582732969109393809606969field',\n aleoLocalDecimals: 6,\n aleoRemoteDecimals: 18,\n aleoScale: '1000000000000',\n aleoHyperlaneConfigSource: ALEO_USDT_HYPERLANE_CONFIG_SOURCE,\n} as const\n\nconst ALEO_SOL_APP_METADATA = {\n aleoAppMetadataVerified: true,\n aleoProgramSource: ALEO_SOL_PROGRAM_SOURCE,\n aleoAppMetadataSource: ALEO_SOL_APP_METADATA_SOURCE,\n aleoAppMetadataReviewedAt: '2026-08-17',\n aleoProgramEdition: 0,\n aleoTokenType: '1',\n aleoTokenOwner: 'aleo1wr8rfr4ggedjxtg5e23s38zqkgy2j05uc9l8t4akjp5zcw3levpswkwk45',\n aleoIsm: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoHook: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoTokenId: '6148061383892805373029428966764338809222769879628268522058032128225601478383field',\n aleoLocalDecimals: 9,\n aleoRemoteDecimals: 9,\n aleoHyperlaneConfigSource: ALEO_SOL_HYPERLANE_CONFIG_SOURCE,\n} as const\n\nconst ALEO_ETH_REMOTE_ROUTER = {\n aleoRemoteRouterVerified: true,\n aleoRemoteRouterSource: ALEO_ETH_REMOTE_ROUTER_SOURCE,\n aleoRemoteRouterReviewedAt: '2026-08-17',\n aleoSampleTransferSource: ALEO_ETH_SAMPLE_TRANSFER_SOURCE,\n aleoDestinationDomain: 1,\n aleoRemoteRouterEvmAddress: '0x38D447694f5c1f773ae3132cf93bF30B7Ec1Fa5A',\n aleoRemoteRouterRecipient: '[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 56u8, 212u8, 71u8, 105u8, 79u8, 92u8, 31u8, 119u8, 58u8, 227u8, 19u8, 44u8, 249u8, 59u8, 243u8, 11u8, 126u8, 193u8, 250u8, 90u8]',\n aleoRemoteRouterGas: '44000',\n aleoAllowanceSpendersVerified: true,\n aleoUnusedAllowancesVerified: true,\n aleoAllowanceSpender0: 'aleo194tz0jmyq8rd9htvnqppqw4jqerk2p2zd8plzn3sxl06wcgsm5pq9fka74',\n aleoAllowanceSpender1: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender2: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender3: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceAmount1: '0',\n aleoAllowanceAmount2: '0',\n aleoAllowanceAmount3: '0',\n} as const\n\nconst ALEO_WBTC_REMOTE_ROUTER = {\n aleoRemoteRouterVerified: true,\n aleoRemoteRouterSource: ALEO_WBTC_REMOTE_ROUTER_SOURCE,\n aleoRemoteRouterReviewedAt: '2026-08-17',\n aleoDestinationDomain: 1,\n aleoRemoteRouterEvmAddress: '0x20CDC85778b732073F7EecEF3DF25c0d310f8772',\n aleoRemoteRouterRecipient: '[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 32u8, 205u8, 200u8, 87u8, 120u8, 183u8, 50u8, 7u8, 63u8, 126u8, 236u8, 239u8, 61u8, 242u8, 92u8, 13u8, 49u8, 15u8, 135u8, 114u8]',\n aleoRemoteRouterGas: '68000',\n aleoAllowanceSpendersVerified: true,\n aleoUnusedAllowancesVerified: true,\n aleoAllowanceSpender0: 'aleo194tz0jmyq8rd9htvnqppqw4jqerk2p2zd8plzn3sxl06wcgsm5pq9fka74',\n aleoAllowanceSpender1: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender2: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender3: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceAmount1: '0',\n aleoAllowanceAmount2: '0',\n aleoAllowanceAmount3: '0',\n} as const\n\nconst ALEO_USDT_ETHEREUM_REMOTE_ROUTER = {\n aleoRemoteRouterVerified: true,\n aleoRemoteRouterSource: ALEO_USDT_ETHEREUM_REMOTE_ROUTER_SOURCE,\n aleoRemoteRouterReviewedAt: '2026-08-17',\n aleoSampleTransferSource: ALEO_USDT_SAMPLE_TRANSFER_SOURCE,\n aleoSampleTransferDestinationDomain: 56,\n aleoDestinationDomain: 1,\n aleoRemoteRouterEvmAddress: '0x3C2064D78e4578E8F936E3db42aEF044E33FBF31',\n aleoRemoteRouterRecipient: '[0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 60u8, 32u8, 100u8, 215u8, 142u8, 69u8, 120u8, 232u8, 249u8, 54u8, 227u8, 219u8, 66u8, 174u8, 240u8, 68u8, 227u8, 63u8, 191u8, 49u8]',\n aleoRemoteRouterGas: '68000',\n aleoAllowanceSpendersVerified: true,\n aleoUnusedAllowancesVerified: true,\n aleoAllowanceSpender0: 'aleo194tz0jmyq8rd9htvnqppqw4jqerk2p2zd8plzn3sxl06wcgsm5pq9fka74',\n aleoAllowanceSpender1: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender2: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender3: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceAmount1: '0',\n aleoAllowanceAmount2: '0',\n aleoAllowanceAmount3: '0',\n} as const\n\nconst ALEO_SOL_REMOTE_ROUTER = {\n aleoRemoteRouterVerified: true,\n aleoRemoteRouterSource: ALEO_SOL_REMOTE_ROUTER_SOURCE,\n aleoRemoteRouterReviewedAt: '2026-08-17',\n aleoSampleTransitionId: 'au15fg39h53h55tkj0nexrme3k6pvgxngxapcyajdhf06jcg3cyeugq5kd7hg',\n aleoDestinationDomain: 1399811149,\n aleoRemoteRouterSolanaAddress: '8YGT2pZwyZe94qBpGzWfY2TMEVcwaQ1bXAE7YAgpUaM7',\n aleoRemoteRouterRecipient: '[112u8, 4u8, 72u8, 22u8, 219u8, 143u8, 68u8, 202u8, 21u8, 197u8, 236u8, 182u8, 198u8, 142u8, 52u8, 96u8, 142u8, 38u8, 51u8, 113u8, 116u8, 143u8, 96u8, 123u8, 104u8, 126u8, 97u8, 73u8, 7u8, 6u8, 211u8, 122u8]',\n aleoRemoteRouterGas: '300000',\n aleoAllowanceSpendersVerified: true,\n aleoUnusedAllowancesVerified: true,\n aleoAllowanceSpender0: 'aleo194tz0jmyq8rd9htvnqppqw4jqerk2p2zd8plzn3sxl06wcgsm5pq9fka74',\n aleoAllowanceSpender1: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender2: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceSpender3: 'aleo1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq3ljyzc',\n aleoAllowanceAmount1: '0',\n aleoAllowanceAmount2: '0',\n aleoAllowanceAmount3: '0',\n} as const\n\nfunction route(\n id: string,\n protocol: 'xreserve' | 'hyperlane',\n environment: BridgeEnvironment,\n sourceAssetId: string,\n destinationAssetId: string,\n availability: 'active' | 'metadata-required',\n deploymentId: string,\n metadata?: Readonly<Record<string, string | number | boolean>>,\n): ProtocolBridgeRoute {\n return {\n id,\n protocol,\n environment,\n sourceAssetId,\n destinationAssetId,\n availability,\n deploymentId,\n source: protocol === 'xreserve' ? XRESERVE_SOURCE : HYPERLANE_SOURCE,\n ...(metadata == null ? {} : { metadata }),\n }\n}\n\nfunction pair(\n protocol: 'xreserve' | 'hyperlane',\n environment: BridgeEnvironment,\n left: string,\n right: string,\n availability: 'active' | 'metadata-required',\n deploymentId: string,\n metadata?: Readonly<Record<string, string | number | boolean>>,\n reverseAvailability: 'active' | 'metadata-required' = availability,\n): ProtocolBridgeRoute[] {\n return [\n route(`${protocol}:${left}->${right}`, protocol, environment, left, right, availability, deploymentId, metadata),\n route(`${protocol}:${right}->${left}`, protocol, environment, right, left, reverseAvailability, deploymentId, metadata),\n ]\n}\n\nconst routes: ProtocolBridgeRoute[] = [\n ...pair('xreserve', 'mainnet', 'ethereum/usdc', 'aleo/usdcx', 'active', 'xreserve-usdcx-aleo', {\n xReserveContract: '0x8888888199b2Df864bf678259607d6D5EBb4e3Ce',\n sourceChainId: 1,\n sourceDomain: 0,\n ethereumDestinationDomain: 0,\n arcDestinationDomain: 26,\n remoteDomain: 10002,\n remoteToken: 'usdcx_stablecoin.aleo',\n remoteTokenBytes32: '0x11ea7dab1d29d5f61500582c63e98c42e1165f9ba050ea9d0c6af9f871987711',\n minimumAmountAtomic: '2000000',\n maxFeeAtomic: '100000',\n bridgeProgram: 'usdcx_bridge_v2.aleo',\n wrapperProgram: 'shielded_usdcx_wrapper.aleo',\n attestationBaseUrl: 'https://xreserve-api.circle.com/v1/attestations',\n }, 'active'),\n ...pair('xreserve', 'testnet', 'sepolia/usdc', 'aleo-testnet/usdcx', 'active', 'xreserve-usdcx-aleo-testnet', {\n xReserveContract: '0x008888878f94C0d87defdf0B07f46B93C1934442',\n sourceChainId: 11155111,\n sourceDomain: 0,\n ethereumDestinationDomain: 0,\n arcDestinationDomain: 26,\n remoteDomain: 10002,\n remoteToken: 'test_usdcx_stablecoin.aleo',\n remoteTokenBytes32: '0xb143ed52c774cd1d4a519d0e796f15916be5a9e1d45edcd9852dd23f68f53401',\n minimumAmountAtomic: '2000000',\n maxFeeAtomic: '100000',\n bridgeProgram: 'test_usdcx_bridge_v2.aleo',\n wrapperProgram: 'shielded_usdcx_wrapper.aleo',\n attestationBaseUrl: 'https://xreserve-api-testnet.circle.com/v1/attestations',\n }, 'active'),\n route('hyperlane:ethereum/eth->aleo/eth', 'hyperlane', 'mainnet', 'ethereum/eth', 'aleo/eth', 'active', 'ETH/aleo', { ...ETH_HYPERLANE_METADATA, ...ALEO_MAILBOX_METADATA }),\n route('hyperlane:aleo/eth->ethereum/eth', 'hyperlane', 'mainnet', 'aleo/eth', 'ethereum/eth', 'metadata-required', 'ETH/aleo', { ...ETH_HYPERLANE_METADATA, ...aleoHyperlanePlaceholders('hyp_warp_token_eth_v2.aleo', 1), ...ALEO_ETH_APP_METADATA, ...ALEO_ETH_REMOTE_ROUTER }),\n route('hyperlane:ethereum/wbtc->aleo/wbtc', 'hyperlane', 'mainnet', 'ethereum/wbtc', 'aleo/wbtc', 'active', 'WBTC/aleo', { ...WBTC_HYPERLANE_METADATA, ...ALEO_MAILBOX_METADATA }),\n route('hyperlane:aleo/wbtc->ethereum/wbtc', 'hyperlane', 'mainnet', 'aleo/wbtc', 'ethereum/wbtc', 'metadata-required', 'WBTC/aleo', { ...WBTC_HYPERLANE_METADATA, ...aleoHyperlanePlaceholders('hyp_warp_token_wbtc_v2.aleo', 1), ...ALEO_WBTC_APP_METADATA, ...ALEO_WBTC_REMOTE_ROUTER }),\n route('hyperlane:ethereum/usdt->aleo/usdt', 'hyperlane', 'mainnet', 'ethereum/usdt', 'aleo/usdt', 'active', 'USDT/aleo', { ...USDT_HYPERLANE_METADATA, ...ALEO_MAILBOX_METADATA }),\n route('hyperlane:aleo/usdt->ethereum/usdt', 'hyperlane', 'mainnet', 'aleo/usdt', 'ethereum/usdt', 'metadata-required', 'USDT/aleo', { ...USDT_HYPERLANE_METADATA, ...aleoHyperlanePlaceholders('hyp_warp_token_usdt_v2.aleo', 1), ...ALEO_USDT_APP_METADATA, ...ALEO_USDT_ETHEREUM_REMOTE_ROUTER }),\n route('hyperlane:solana/sol->aleo/sol', 'hyperlane', 'mainnet', 'solana/sol', 'aleo/sol', 'metadata-required', 'SOL/aleo', ALEO_MAILBOX_METADATA),\n route('hyperlane:aleo/sol->solana/sol', 'hyperlane', 'mainnet', 'aleo/sol', 'solana/sol', 'metadata-required', 'SOL/aleo', { ...aleoHyperlanePlaceholders('hyp_warp_token_sol_v2.aleo', 1399811149), ...ALEO_SOL_APP_METADATA, ...ALEO_SOL_REMOTE_ROUTER }),\n ...pair('hyperlane', 'mainnet', 'aleo/aleo', 'ethereum/aleo', 'metadata-required', 'ALEO/aleo', ALEO_MAILBOX_METADATA),\n ...pair('hyperlane', 'mainnet', 'aleo/aleo', 'solana/aleo', 'metadata-required', 'ALEO/aleo', ALEO_MAILBOX_METADATA),\n ...pair('hyperlane', 'mainnet', 'aleo/aleo', 'base/aleo', 'metadata-required', 'ALEO/aleo', ALEO_MAILBOX_METADATA),\n ...pair('hyperlane', 'mainnet', 'aleo/aleo', 'hyperevm/aleo', 'metadata-required', 'ALEO/aleo', ALEO_MAILBOX_METADATA),\n route('hyperlane:ethereum/usad->aleo/usad', 'hyperlane', 'mainnet', 'ethereum/usad', 'aleo/usad', 'metadata-required', 'USAD/aleo', ALEO_MAILBOX_METADATA),\n route('hyperlane:aleo/usad->ethereum/usad', 'hyperlane', 'mainnet', 'aleo/usad', 'ethereum/usad', 'metadata-required', 'USAD/aleo', aleoHyperlanePlaceholders('hyp_warp_token_usad_v2.aleo', 1)),\n]\n\n/**\n * Supplies the initial reviewed protocol-route snapshot.\n *\n * xReserve contract identifiers are populated from Circle's published\n * mainnet and testnet tables. Hyperlane routes intentionally remain\n * `metadata-required` until their router, domain, ISM, and token identifiers\n * are pinned from one reviewed registry commit. Pure and local.\n *\n * @example\n * const bridge = createBridgeClient({ registry: DEFAULT_BRIDGE_REGISTRY })\n */\nexport const DEFAULT_BRIDGE_REGISTRY: BridgeRegistry = Object.freeze({\n version: '2026-08-17.aleo-sol-router.1',\n chains: Object.freeze(chains),\n assets: Object.freeze(assets),\n routes: Object.freeze(routes),\n sources: Object.freeze([XRESERVE_SOURCE, HYPERLANE_SOURCE]),\n})\n","import { BridgeError } from '../errors/bridgeErrors.js'\nimport type { BridgeRegistry } from '../types/protocol.js'\n\n/**\n * Validates the referential integrity of a protocol bridge registry.\n *\n * Pure and local. Duplicate identifiers and dangling asset/chain references\n * throw before a client can prepare a misleading transfer plan.\n *\n * @param registry Registry supplied to `createBridgeClient`.\n * @returns The validated registry unchanged.\n * @throws BridgeError When identifiers are duplicated or references are missing.\n *\n * @example\n * const registry = validateBridgeRegistry(DEFAULT_BRIDGE_REGISTRY)\n */\nexport function validateBridgeRegistry(registry: BridgeRegistry): BridgeRegistry {\n if (!registry.version.trim()) throw new BridgeError('Bridge registry version must not be empty')\n\n const chainIds = new Set<string>()\n for (const chain of registry.chains) {\n if (chainIds.has(chain.id)) throw new BridgeError(`Duplicate bridge chain id: ${chain.id}`)\n chainIds.add(chain.id)\n }\n\n const assetIds = new Set<string>()\n for (const asset of registry.assets) {\n if (assetIds.has(asset.id)) throw new BridgeError(`Duplicate bridge asset id: ${asset.id}`)\n if (!chainIds.has(asset.chainId)) {\n throw new BridgeError(`Bridge asset ${asset.id} references unknown chain ${asset.chainId}`)\n }\n if (!Number.isInteger(asset.decimals) || asset.decimals < 0) {\n throw new BridgeError(`Bridge asset ${asset.id} has invalid decimals ${asset.decimals}`)\n }\n if (asset.addressValidationRegex) {\n try {\n new RegExp(asset.addressValidationRegex)\n } catch (cause) {\n throw new BridgeError(`Bridge asset ${asset.id} has an invalid address validation regex`, {\n cause,\n })\n }\n }\n assetIds.add(asset.id)\n }\n\n const routeIds = new Set<string>()\n for (const route of registry.routes) {\n if (routeIds.has(route.id)) throw new BridgeError(`Duplicate bridge route id: ${route.id}`)\n if (!assetIds.has(route.sourceAssetId)) {\n throw new BridgeError(`Bridge route ${route.id} references unknown source asset ${route.sourceAssetId}`)\n }\n if (!assetIds.has(route.destinationAssetId)) {\n throw new BridgeError(`Bridge route ${route.id} references unknown destination asset ${route.destinationAssetId}`)\n }\n const source = registry.assets.find((asset) => asset.id === route.sourceAssetId)!\n const destination = registry.assets.find((asset) => asset.id === route.destinationAssetId)!\n const sourceChain = registry.chains.find((chain) => chain.id === source.chainId)!\n const destinationChain = registry.chains.find((chain) => chain.id === destination.chainId)!\n if (sourceChain.environment !== route.environment || destinationChain.environment !== route.environment) {\n throw new BridgeError(`Bridge route ${route.id} crosses registry environments`)\n }\n routeIds.add(route.id)\n }\n\n return registry\n}\n"],"mappings":";AAAA,SAAS,cAAc,uBAAoC;;;ACqCpD,SAAS,kBACd,UACA,SAAsC,CAAC,GAChB;AACvB,QAAMA,UAAS,IAAI,IAAI,SAAS,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;AACxE,QAAM,UAAU,OAAO,SAAS,YAAY;AAC5C,QAAM,SAAS,OAAO,QAAQ,YAAY;AAC1C,SAAO,SAAS,OAAO,OAAO,CAAC,UAAU;AACvC,UAAM,QAAQA,QAAO,IAAI,MAAM,OAAO;AACtC,YACG,OAAO,eAAe,QAAQ,OAAO,gBAAgB,OAAO,iBAC5D,WAAW,QAAQ,MAAM,QAAQ,YAAY,MAAM,aACnD,UAAU,QAAQ,MAAM,OAAO,YAAY,MAAM;AAAA,EAEtD,CAAC;AACH;AAgBO,SAAS,kBACd,UACA,SAAsC,CAAC,GAChB;AACvB,QAAMC,UAAS,IAAI,IAAI,SAAS,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC;AACxE,QAAM,gBAAgB,OAAO,eAAe,YAAY;AACxD,QAAM,qBAAqB,OAAO,oBAAoB,YAAY;AAClE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AA,EACT,IAAI;AACJ,QAAM,YAAY,uBAAuB,QAAQ;AACjD,QAAM,SAAS,aAAa,EAAE,WAAW,qBAAqB,GAAG,KAAK,KAAK,CAAC;AAC5E,SAAO,OAAO,OAAO,CAAC,WAAW;AAAA,IAC/B;AAAA,IACA,UAAU;AAAA,IACV,GAAG,cAAc,OAAO,EAAE,aAAa,UAAU,WAAW,WAAW,sBAAsB,CAAC;AAAA,EAChG,EAAE;AACJ;","names":["chains","assets","route","route","route","metadata","executor","account","allowance","decodeEventLog","decodeFunctionResult","encodeFunctionData","getAddress","isAddress","isHash","isHex","parseAbi","getAddress","isAddress","isAddress","getAddress","ERC20_ABI","parseAbi","route","isAddress","getAddress","executor","assertChain","isHex","decodeFunctionResult","isHash","encodeFunctionData","data","receipt","decodeEventLog","isHash","isHex","executor","route","isHex","isHash","route","executor","getAddress","hexToBytes","isAddress","padHex","isAddress","hexToBytes","padHex","getAddress","route","validatedRoute","executor","metadata","route"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { McpServer } from '@provablehq/veil-core/mcp';
|
|
2
|
+
export { McpServer, McpToolDefinition } from '@provablehq/veil-core/mcp';
|
|
3
|
+
import { y as BridgeClient } from '../createBridgeClient-CjHY-JvW.js';
|
|
4
|
+
import '@provablehq/veil-core';
|
|
5
|
+
import 'viem';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates an MCP server exposing the bridge tools.
|
|
9
|
+
*
|
|
10
|
+
* Binds core's `toMcpServer` to the protocol bridge discovery and planning
|
|
11
|
+
* tools. The current server cannot sign transactions or move funds.
|
|
12
|
+
*
|
|
13
|
+
* Exposed via subpath export: `import { createBridgeMcpServer } from '@provablehq/aleo-bridge-sdk/mcp'`.
|
|
14
|
+
*
|
|
15
|
+
* @param client A bridge client from `createBridgeClient`.
|
|
16
|
+
* @returns An {@link McpServer} whose `handleToolCall` dispatches by tool name.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const server = createBridgeMcpServer(client)
|
|
20
|
+
* const routes = await server.handleToolCall('bridge_list_routes', {
|
|
21
|
+
* protocol: 'xreserve',
|
|
22
|
+
* })
|
|
23
|
+
*/
|
|
24
|
+
declare function createBridgeMcpServer(client: BridgeClient): McpServer;
|
|
25
|
+
|
|
26
|
+
export { createBridgeMcpServer };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createBridgeAgentTools
|
|
3
|
+
} from "../chunk-KG3LFIU5.js";
|
|
4
|
+
|
|
5
|
+
// src/mcp/index.ts
|
|
6
|
+
import { toMcpServer } from "@provablehq/veil-core/mcp";
|
|
7
|
+
function createBridgeMcpServer(client) {
|
|
8
|
+
return toMcpServer(createBridgeAgentTools(client));
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
createBridgeMcpServer
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/index.ts"],"sourcesContent":["import { toMcpServer, type McpServer } from '@provablehq/veil-core/mcp'\nimport { createBridgeAgentTools } from '../agent/tools.js'\nimport type { BridgeClient } from '../clients/createBridgeClient.js'\n\nexport type { McpServer, McpToolDefinition } from '@provablehq/veil-core/mcp'\n\n/**\n * Creates an MCP server exposing the bridge tools.\n *\n * Binds core's `toMcpServer` to the protocol bridge discovery and planning\n * tools. The current server cannot sign transactions or move funds.\n *\n * Exposed via subpath export: `import { createBridgeMcpServer } from '@provablehq/aleo-bridge-sdk/mcp'`.\n *\n * @param client A bridge client from `createBridgeClient`.\n * @returns An {@link McpServer} whose `handleToolCall` dispatches by tool name.\n *\n * @example\n * const server = createBridgeMcpServer(client)\n * const routes = await server.handleToolCall('bridge_list_routes', {\n * protocol: 'xreserve',\n * })\n */\nexport function createBridgeMcpServer(client: BridgeClient): McpServer {\n return toMcpServer(createBridgeAgentTools(client))\n}\n"],"mappings":";;;;;AAAA,SAAS,mBAAmC;AAuBrC,SAAS,sBAAsB,QAAiC;AACrE,SAAO,YAAY,uBAAuB,MAAM,CAAC;AACnD;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@provablehq/aleo-bridge-sdk",
|
|
3
|
+
"version": "0.8.0-rc.0",
|
|
4
|
+
"description": "Protocol bridge client for Circle xReserve and Hyperlane routes connected to Aleo.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ProvableHQ/veil.git",
|
|
9
|
+
"directory": "packages/bridge"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/ProvableHQ/veil#readme",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"main": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"import": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./agent": {
|
|
28
|
+
"import": "./dist/agent/index.js",
|
|
29
|
+
"types": "./dist/agent/index.d.ts"
|
|
30
|
+
},
|
|
31
|
+
"./mcp": {
|
|
32
|
+
"import": "./dist/mcp/index.js",
|
|
33
|
+
"types": "./dist/mcp/index.d.ts"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"bs58": "^6.0.0",
|
|
41
|
+
"viem": "^2.21.0",
|
|
42
|
+
"@provablehq/veil-core": "0.8.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@provablehq/sdk": "^0.11.6"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@provablehq/sdk": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@provablehq/sdk": "^0.11.6"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"typecheck": "tsc --noEmit"
|
|
59
|
+
}
|
|
60
|
+
}
|