SDK Reference

The DI Network SDK provides a comprehensive JavaScript/TypeScript interface for integrating with all protocol features.

Overview

The SDK is designed for ease of use while providing access to all protocol functionality:

Installation & Setup

Installation

Install the SDK via npm, yarn, or pnpm.

https://github.com/DINetworks/DI-Docs/blob/main/developers/sdk/installation.md

Core Methods

Basic SDK functionality and token operations.

https://github.com/DINetworks/DI-Docs/blob/main/developers/sdk/core.md

Trading Methods

Spot and perpetual trading functionality.

https://github.com/DINetworks/DI-Docs/blob/main/developers/sdk/trading.md

Bridge Methods

Cross-chain operations and gasless transactions.

https://github.com/DINetworks/DI-Docs/blob/main/developers/sdk/bridge.md

Quick Start

Basic Setup

Configuration Options

Core Features

Token Operations

DUSD Operations

Trading Operations

Cross-Chain Operations

Error Handling

SDK Errors

Common Error Types

  • InsufficientBalance: Not enough tokens

  • InsufficientAllowance: Need to approve tokens

  • SlippageExceeded: Price moved beyond tolerance

  • PositionNotFound: Position doesn't exist

  • LiquidationRisk: Position at risk of liquidation

Event Monitoring

Subscribe to Events

Event Filtering

Utilities

Price Feeds

Gas Estimation

Batch Operations

TypeScript Support

Type Definitions

Generic Types

Testing

Mock Provider

Test Utilities

Last updated