Template Repository
A comprehensive walkthrough of the Okto Express Template App designed for Okto APIs. This Express app demonstrates how to interact with the Okto 3pBFF through API calls, including authentication, explorer, and intents.
Demo Only
Note that this app is for demonstration purposes only and is not meant for production application. Be sure to customize and secure it before using in production.
API Express Template Repository
Route Implementations
This template app demonstrates the implementation of the following route handlers:
- Auth Routes: authRoutes.ts
- Intent Routes: intentRoutes.ts
- Explorer Routes: explorerRoutes.ts
Okto API Express Template Postman Collection
Download and import the Okto API Express Postman Collection for easy access and testing of all endpoints and methods.
API Routes
Each of these route files demonstrates how to interact with the Okto backend for their respective API categories.
Auth Routes (/api/auth
)
Method | Path | Description |
---|---|---|
POST | /email/otp | Request OTP for email |
POST | /email/verify-otp | Verify OTP for email |
POST | /whatsapp/otp | Request OTP for WhatsApp |
POST | /whatsapp/verify-otp | Verify OTP for WhatsApp |
POST | /authenticate | Authenticate user |
Explorer Routes (/api/explorer
)
Method | Path | Description |
---|---|---|
GET | /account | Get account details |
GET | /chains | Get supported chains |
GET | /tokens | Get supported tokens |
GET | /portfolio | Get portfolio summary |
GET | /portfolio-activity | Get portfolio activity |
GET | /portfolio-nft | Get portfolio NFTs |
GET | /order-history | Get order history |
POST | /read-contract-data | Read data from a smart contract |
Intent Routes (/api/intent
)
Method | Path | Description |
---|---|---|
POST | /tokenTransfer | Initiate a token transfer intent |
POST | /rawTransaction | Initiate a raw transaction intent |
POST | /tokenTransfer/estimate | Estimate a token transfer intent |
POST | /rawTransaction/estimate | Estimate a raw transaction intent |
POST | /tokenTransfer/executeAfterEstimate | Execute token transfer after estimation |
POST | /rawTransaction/executeAfterEstimate | Execute raw transaction after estimation |
Getting Started
Find detailed instructions on how to set up the express template app locally:
- Clone the repository:
git clone https://github.com/okto-hq/okto-sdkv2-express-template-app.git
- Change into the project directory and install dependencies:
cd okto-sdkv2-express-template-app
npm install
- Set up environment variables:
cp .env.sample .env
Before you begin, set up your developer dashboard by making sure you have :
- Created your Okto Developer Dashboard account
- Get your Okto credits from the dashboard
- Obtained your API keys from the dashboard
- Enabled the specific Chains and Tokens you plan to use in your application
- Optional: Enabled Sponsorship for the desired chains
If you need help, reach out to us on our troubleshooting form and we will contact you.
- Okto API Keys: You need your
CLIENT_PRIVATE_KEY
andCLIENT_SWA
for testing out the API endpoints. Obtain these from the Okto Developer Dashboard. - Okto Account Setup: Ensure you have sufficient Okto Credits, enable the required Chains and Tokens , and optionally Activate Sponsorship.
- Run the application:
npm run dev