π This guide covers everything you need to integrate OKX OS Fractal Bitcoin APIs into your applications
π Essential Links
- Repl: https://replit.com/@Juliandev28/ordinals-react-app-ts
- GitHub Repo: https://github.com/Julian-dev28/ordinals-react-app-ts
- Developer Portal: https://www.okx.com/web3/build/dev-portal
π API Documentation
API | Purpose | Link |
---|---|---|
Collections | Get Ordinals collection list | Docs |
Activities | Get trade history | Docs |
Inscriptions | Get valid inscriptions | Docs |
π οΈ API Endpoints
Implementation Note: These endpoints are implemented in
ordinals-server.cjs
, which handles request signing and authentication with the OKX API. The server acts as a proxy, adding necessary headers and signatures before forwarding requests to OKX's endpoints.
1. Get Ordinals Collections
Endpoint:
GET /api/ordinals
Properties:
{
"limit": "20", // default: 20
"slug": "string", // optional
"isBrc20": false // default: false
}
OKX Endpoint: /api/v5/mktplace/nft/fractal-ordinals/collections
2. Get Valid Inscriptions
Endpoint:
POST /api/inscriptions
Request Body:
{
"slug": "string",
"walletAddress": "string",
"limit": "10", // default: 10
"isBrc20": false, // optional
"cursor": "string", // optional
"sort": "string" // optional
}
OKX Endpoint: /api/v5/mktplace/nft/fractal-ordinals/get-valid-inscriptions
3. Get Trade History
Endpoint:
POST /api/trade-history
Request Body:
{
"slug": "string",
"limit": "10", // default: 10
"sort": "desc", // default: desc
"isBrc20": true, // default: true
"cursor": "string", // optional
"tradeWalletAddress": "string", // optional
"type": "string", // optional
"orderSource": "string" // optional
}
OKX Endpoint: /api/v5/mktplace/nft/fractal-ordinals/trade-history
π» Technical Stack
- Frontend: React + TypeScript
- Backend: Express.js
- Security Features:
- CORS enabled
- CryptoJS for signing
- Environment variables
- API: Axios
- Error Handling: Full logging
π Getting Started
Prerequisites
- Node.js v20+
- npm
- OKX OS API credentials
Setup Steps
1.Clone repository
git clone https://github.com/Julian-dev28/ordinals-react-app-ts.git
2.Configure environment
OKX_API_KEY=
OKX_API_SECRET=
OKX_API_PASSPHRASE=
3.Install dependencies
npm install
4.Start the proxy server
node ordinals-server.cjs
5.Run the app
npm run dev
π Project Structure
./
βββ ordinals-server.cjs # Proxy API service
βββ src/
β βββ components/
β β βββ OrdinalsFetcher.tsx
β β βββ RetrieveInscriptions.tsx
β β βββ TradeHistory.ts
β βββ services/
β βββ okxServices.ts
π€ Support & Community
- GitHub Issues: Open for bug reports & features
- Discord: https://discord.gg/k6Z7VYsF
- Documentation: See API docs links above
π Contributing Guidelines
- Fork repository
- Create feature branch
- Submit pull request
β‘ Quick Tips
- Use environment variables for security
- Check API response codes
- Monitor console messages
Top comments (0)