Skip to content

Titan-Pathfinder/titan-sdk-ts-example-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Titan SDK TypeScript Example - Node.js

This is a Node.js example demonstrating how to use the Titan SDK TypeScript library to connect to the Titan exchange WebSocket API and receive real-time swap quotes.

Prerequisites

  • Node.js (v18.19 or higher)
  • npm or yarn
  • A Titan API authentication token

Installation

  1. Clone this repository:
git clone <repository-url>
cd titan-sdk-ts-example-node
  1. Install dependencies:
npm install

Configuration

Create a .env file in the project root with the following environment variables:

# Required: WebSocket URL for the Titan API
WS_URL=wss://api.titan.exchange/api/v1/ws

# Required: Authentication token for the API
AUTH_TOKEN=your_auth_token_here

# Required: Base58-encoded public key for user swapping tokens
USER_PUBLIC_KEY=your_public_key_here

INPUT_MINT=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

OUTPUT_MINT=So11111111111111111111111111111111111111112

# Amount in atoms
AMOUNT=1000000

# Slippage in basis points (defaults to 50 = 0.5%)
SLIPPAGE_BPS=50

# Maximum number of quotes per stream event (defaults to 3)
NUM_QUOTES=3

Start the example script:

npm run start

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published