OMPX server class with Hono-specific middleware generation.
import { Hono } from 'hono'import { Ompx } from '@ompx/hono'import { tempo } from '@ompx/tempo'type Env = { Variables: OmpxVariables }const app = new Hono<Env>()const ompx = Ompx.create({ methods: [tempo({ recipient: '0x...', currency: '0x20c0...' })],})app.get('/api/search', ompx.charge({ amount: '0.01' }), (c) => { const settlement = c.get('ompxSettlement') return c.json({ results: [], payer: settlement.payer }) }) Copy
import { Hono } from 'hono'import { Ompx } from '@ompx/hono'import { tempo } from '@ompx/tempo'type Env = { Variables: OmpxVariables }const app = new Hono<Env>()const ompx = Ompx.create({ methods: [tempo({ recipient: '0x...', currency: '0x20c0...' })],})app.get('/api/search', ompx.charge({ amount: '0.01' }), (c) => { const settlement = c.get('ompxSettlement') return c.json({ results: [], payer: settlement.payer }) })
Returns a Hono middleware that enforces payment for the route.
The middleware:
ompxSettlement
ompxProtocol
Static
Create an Ompx instance configured for Hono.
OMPX server class with Hono-specific middleware generation.
Example