Skip to content

Commit 2bd923f

Browse files
committed
Merge feat/exchange-info: public rake % endpoint
2 parents aca0cd6 + 0a2934d commit 2bd923f

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

aimeat/src/routes/exchange-market.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type { Storage } from '../storage/interface.js';
1919
import { requireAuth } from '../auth/middleware.js';
2020
import { success, error } from '../middleware/envelope.js';
2121
import { resolveIdentity } from '../utils/gaii.js';
22+
import { commerceFeePercent } from '../services/marketplace-fee.js';
2223
import { createEntitlement, readEntitlementForCall } from '../services/metered-entitlements.js';
2324
import {
2425
type Offering, type Need, type Bid, type ActionCommercial,
@@ -33,6 +34,17 @@ const posOrNull = (v: unknown): number | null => (typeof v === 'number' && Numbe
3334
export function exchangeMarketRouter(config: AimeatConfig, storage: Storage): Router {
3435
const router = Router();
3536

37+
// ── INFO — the marketplace's public economics (rake, currencies) ─────────────
38+
/** Public: what the platform takes on each metered call + the units in play. */
39+
router.get('/v1/exchange/info', (_req: Request, res: Response) => {
40+
return res.json(success(config.nodeId, {
41+
rake_percent: commerceFeePercent(config),
42+
rake_note: 'Platform fee applied to each metered call (provider keeps the rest). Set by the node operator.',
43+
units: ['morsels', 'EUR', 'USD'],
44+
morsel_note: 'Morsels are the node’s throttle unit (plain integers); real money settles in EUR/USD.',
45+
}));
46+
});
47+
3648
// ── OFFERINGS (supply) ─────────────────────────────────────────────────────
3749
/** List a supply offering for an action the caller's extension owns. Pricing is read from the action. */
3850
router.post('/v1/exchange/offerings', requireAuth(), async (req: Request, res: Response) => {

openapi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8080,6 +8080,18 @@ paths:
80808080
'404':
80818081
$ref: '#/components/responses/AimeatError'
80828082

8083+
/v1/exchange/info:
8084+
get:
8085+
operationId: exchangeInfo
8086+
summary: EXCHANGE marketplace economics — the platform rake + units (EXCHANGE / TARGET-045)
8087+
description: >
8088+
Public. Returns `{ rake_percent, rake_note, units, morsel_note }` — the platform fee applied to
8089+
each metered call (the provider keeps the rest), set by the node operator via
8090+
AIMEAT_COMMERCE_FEE_PERCENT / AIMEAT_MARKETPLACE_TX_FEE_PERCENT.
8091+
tags: [Commerce]
8092+
responses:
8093+
'200': { $ref: '#/components/responses/AimeatSuccess' }
8094+
80838095
/v1/exchange/offerings:
80848096
post:
80858097
operationId: exchangeListOffering

0 commit comments

Comments
 (0)