import { Hono } from 'hono';
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { mplCore } from '@metaplex-foundation/mpl-core';
import { createSeller } from '@leash/seller-kit';
const umi = createUmi(process.env.SOLANA_RPC ?? 'https://api.devnet.solana.com').use(mplCore());
const app = new Hono();
createSeller(app, {
umi,
sellerAgent: { asset: process.env.AGENT_ASSET! },
routes: {
'POST /tag': {
price: '$0.001',
description: 'Tag a payload',
currency: 'USDC',
acceptsCurrencies: [], // optional: e.g. ['USDG'] to also accept USDG
},
},
onReceipt: (r) =>
fetch(`http://localhost:8787/a/${r.agent}/receipts`, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(r),
}),
});
app.post('/tag', (c) => c.json({ tagged: true }));