import { Hono } from 'hono' import type * as App from '../../App.js' import type * as FundingDepositAddress from '../../internal/funding/DepositAddress.js' import type * as FundingProvider from '../../internal/funding/Provider.js' import type * as FundingTransferReconciliation from '../../internal/funding/TransferReconciliation.js' import type * as Webhooks from '../../internal/Webhooks.js' import * as Metadata from '../metadata.js' import { chains } from './routes/chains.js' import { depositAddresses } from './routes/deposit-addresses.js' import { providers } from './routes/providers.js' import { quotes } from './routes/quotes.js' import { transfers } from './routes/transfers.js' /** * Mounts the Funding & Bridge API, including quotes, inventory, reusable * deposit addresses, detected deposits, and transfers. * * ```ts * App.create(options).route('/', data()).route('/', funding()) * ``` */ export function funding(options: funding.Options = {}) { const app = new Hono() .route('/', quotes()) .route('/', chains()) .route('/', providers()) .route('/', depositAddresses(options)) .route('/', transfers(options)) return Metadata.defaultChain(Metadata.attach(app, openapi)) } export declare namespace funding { /** Inbound funding route configuration. */ type Options = { /** Enqueues one deposit address for asynchronous reconciliation. */ dispatchDepositReconciliation?: | ((message: FundingProvider.Webhook.receive.Dispatchable) => Promise) | undefined /** Enqueues one registered transfer for destination reconciliation. */ dispatchTransferReconciliation?: | ((message: FundingTransferReconciliation.Message) => Promise) | undefined /** Enqueues webhook updates staged with transfer mutations. */ dispatchTransferUpdates?: | ((references: readonly Webhooks.QueueReference[]) => Promise) | undefined /** Registers a created address with a source-chain observer. */ registerDepositAddress?: ((address: FundingDepositAddress.Public) => Promise) | undefined } } const openapi = { tags: [ { name: 'Chains', description: 'Source chains and stablecoins supported for funding.', 'x-pagePath': 'funding/chains', }, { name: 'Deposit Addresses', description: 'Reusable funding addresses and deposits detected at those addresses.', 'x-pagePath': 'funding/deposit-addresses', }, { name: 'Providers', description: 'Providers available for inbound funding.', 'x-pagePath': 'funding/providers', }, { name: 'Quotes', description: 'Live quotes for funding Tempo from other chains.', 'x-pagePath': 'funding/quotes', }, { name: 'Funding Transfers', description: 'Inbound funding transfers.', 'x-displayName': 'Transfers', 'x-pagePath': 'funding/transfers', }, ], 'x-tagGroups': [ { name: 'Funding & Bridge API', tags: ['Chains', 'Deposit Addresses', 'Providers', 'Quotes', 'Funding Transfers'], }, ], } satisfies App.create.Metadata