Typescript SDK
Welcome to the DeFindex TypeScript SDK documentation! This SDK provides server-side access to DeFindex's vault management system through a comprehensive TypeScript interface. With this SDK, you can:
Create and manage decentralized vaults
Perform vault operations (deposit, withdraw, balance queries)
Access real-time APY data
Execute administrative operations
Integrate secure API key authentication
Prerequisites
Before integrating the SDK, ensure you have:
Node.js environment (version 16 or higher)
TypeScript knowledge for optimal development experience
API key from DeFindex
Understanding of Stellar/Soroban blockchain concepts
Integration Guide
1. Install the SDK
Add the SDK to your project using your preferred package manager:
2. Import and Initialize
Import the SDK and configure it with your API key:
Quick Start
Here's a minimal example to get you started with vault operations:
Implementation Example
Complete Vault Operations Flow
Here's a comprehensive example demonstrating vault creation, deposits, and withdrawals:
Core Functions
System Operations
Health Check
Monitor API availability and system status:
Factory Operations
Get Factory Address
Retrieve the factory contract address for vault creation:
Create Vault
Deploy a new vault with custom configuration:
Vault Operations
Get Vault Information
Query comprehensive vault details:
Get User Balance
Check user's vault position:
Deposit to Vault
Add funds to a vault:
Withdraw from Vault
Remove funds by specifying amounts:
Withdraw by Shares
Remove funds by burning vault shares:
Get Vault APY
Query current Annual Percentage Yield:
Administrative Operations
Emergency Rescue
Execute emergency asset recovery and pauses strategy (requires Emergency Manager role):
Pause/Unpause Strategy
Control strategy operations (requires appropriate role):
Transaction Management
Submit Signed Transactions
Send signed XDR to the Stellar network:
Error Handling
The SDK provides comprehensive error handling with specific error types:
Security Best Practices
Environment Variables: Always store API keys in environment variables
Error Handling: Always wrap API calls in try-catch blocks
Server-Side Only: This SDK is designed for server-side use only
Role Management: Understand vault roles and permissions before administrative operations
Running Examples
The SDK includes a comprehensive functional example demonstrating all features:
The example demonstrates:
SDK initialization and authentication
API health checking
Factory operations and vault creation
Vault deposits and withdrawals
Administrative vault management
Error handling patterns
TypeScript Support
The SDK provides full TypeScript support with comprehensive type definitions:
Support and Resources
API Documentation: https://api.defindex.io/docs
GitHub Repository / SDK documentation: https://github.com/paltalabs/defindex-sdk
Developer Support / Discord Community: Join our Discord
For additional questions or integration support, please reach out to our developer support team.
Last updated
