Development Setup

Welcome to DI Network development! This guide will help you set up your development environment and start building applications that integrate with the DI Network protocol.

Prerequisites

Before you begin, ensure you have:

Quick Start

1. Install the DI Network SDK

npm install @dinetwork/sdk

2. Basic Setup

import { DINetwork } from '@dinetwork/sdk';

// Initialize the SDK
const di = new DINetwork({
  chainId: 1, // Ethereum mainnet
  provider: window.ethereum, // or your preferred provider
  apiKey: 'your-api-key' // Optional for enhanced features
});

// Check connection
const isConnected = await di.isConnected();
console.log('Connected to DI Network:', isConnected);

3. Your First Integration

Development Environment Setup

1. Clone the Starter Template

2. Environment Configuration

Create a .env.local file:

3. Development Server

Your app will be available at http://localhost:3000.

SDK Reference

Core Modules

The DI Network SDK is organized into several modules:

Configuration Options

Smart Contract Integration

Direct Contract Interaction

If you prefer to interact with contracts directly:

Contract ABIs and Addresses

Install the contracts package for ABIs and addresses:

API Integration

GraphQL API

Query protocol data using our GraphQL API:

REST API

For simpler integrations, use our REST API:

WebSocket API

Real-time data streaming:

Testing

Unit Testing

Set up Jest for testing your integration:

Integration Testing

Test against a local fork:

Example Applications

1. Simple Trading Interface

2. Portfolio Dashboard

Best Practices

1. Error Handling

2. Gas Optimization

3. State Management

Deployment

Environment Variables

Set up environment variables for different environments:

Build and Deploy

Resources

Documentation

Tools

Community

Next Steps

https://github.com/DINetworks/DI-Docs/blob/main/core-concepts/di-token.mdhttps://github.com/DINetworks/DI-Docs/blob/main/subsystems/Tokens-Subsystem.md

Need Help? Join our Discord developer channel for real-time support and community discussions.

Last updated