-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: openapi endpoint for all inscribed names
- Loading branch information
Showing
4 changed files
with
68 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { createContext } from '@routes/trpc/context'; | ||
import type { FastifyPlugin } from './api-types'; | ||
import { bridgeRouter, inscribedNamesResultsSchema } from './trpc/bridge-router'; | ||
|
||
export const bridgeRoutes: FastifyPlugin = (fastify, opts, done) => { | ||
fastify.get( | ||
'/inscribed-names', | ||
{ | ||
schema: { | ||
description: 'Fetch all BNS names inscribed and bridge to L1', | ||
summary: 'Fetch all inscribed names', | ||
tags: ['L1'], | ||
response: { | ||
200: inscribedNamesResultsSchema, | ||
}, | ||
}, | ||
}, | ||
async (req, res) => { | ||
const caller = bridgeRouter.createCaller(createContext({ req, res })); | ||
const inscribedNames = await caller.inscribedNames(); | ||
return res.status(200).send(inscribedNames); | ||
} | ||
); | ||
|
||
// fastify.get('/inscription-by-name/:name', async (req, res) => { | ||
// } | ||
|
||
done(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters