Installation & Setup
Installation
Install the ECCW SDK using your preferred package manager:
npm install @coincord/eccw-sdkBasic Setup
Quick Start
For most applications, you can get started quickly using the default environment configuration:
import EzrahECCW, { createEnvConf } from '@coincord/eccw-sdk';
// Initialize with environment configuration
const client = new EzrahECCW(createEnvConf());
// Start using the client
const result = await client.someMethod();Manual Configuration
For more control over the configuration, you can provide settings directly:
import EzrahECCW from '@coincord/eccw-sdk';
const client = new EzrahECCW({
api: 'your-api-endpoint.com',
partner_id: 'your-partner-id'
});Configuration with Overrides
You can also combine environment configuration with specific overrides:
import EzrahECCW, { createEnvConf } from '@coincord/eccw-sdk';
const client = new EzrahECCW(createEnvConf({
api: 'custom-endpoint.com',
partner_id: 'custom-partner-id'
}));Platform-Specific Setup
Node.js / Web Applications
For Node.js and web applications, create a .env file in your project root:
# Development and production API endpoints
DEV_EZRAH_ECCW_BASE_URL="dev-eccw.ezrah.co"
PROD_EZRAH_ECCW_BASE_URL="prod-eccw.ezrah.co"
# Your partner ID for authentication
EZRAH_ECCW_PARTNER_ID="your-partner-id"React Native
React Native applications have additional configuration options to ensure compatibility across different environments.
Option 1: Using react-native-config (Recommended)
- Install the configuration package:
npm install react-native-config- Create a
.envfile in your project root:
DEV_EZRAH_ECCW_BASE_URL=dev-eccw.ezrah.co
PROD_EZRAH_ECCW_BASE_URL=prod-eccw.ezrah.co
EZRAH_ECCW_PARTNER_ID=your-partner-id- Use the SDK as normal:
import EzrahECCW, { createEnvConf } from '@coincord/eccw-sdk';
const client = new EzrahECCW(createEnvConf());Option 2: React Native Environment Variables
Set platform-specific environment variables:
REACT_NATIVE_DEV_EZRAH_ECCW_BASE_URL=dev-eccw.ezrah.co
REACT_NATIVE_PROD_EZRAH_ECCW_BASE_URL=prod-eccw.ezrah.co
REACT_NATIVE_EZRAH_ECCW_PARTNER_ID=your-partner-idEnvironment Detection
The SDK automatically detects your environment and selects the appropriate configuration:
-
Development Mode: Uses development URLs when:
NODE_ENV !== 'production'(Node.js/Web)global.__DEV__ === true(React Native)
-
Production Mode: Uses production URLs when:
NODE_ENV === 'production'(Node.js/Web)global.__DEV__ === false(React Native)
-
Fallback: Defaults to
dev-eccw.ezrah.coif no environment variables are configured
Configuration Precedence
Configuration values are resolved in the following order (highest to lowest priority):
- Direct Parameters: Values passed directly to the
EzrahECCWconstructor - Override Parameters: Values passed to
createEnvConf(overrides) - Environment Variables: Platform-specific environment variables
- Default Fallbacks: Built-in default values
Verification
To verify your setup is working correctly, you can test the connection:
import EzrahECCW, { createEnvConf } from '@coincord/eccw-sdk';
async function testConnection() {
try {
const client = new EzrahECCW(createEnvConf());
// Test the connection (replace with actual method)
const status = await client.getStatus();
console.log('Connection successful:', status);
} catch (error) {
console.error('Connection failed:', error);
}
}
testConnection();Next Steps
Once you have the SDK installed and configured:
- Configuration Guide - Learn more about advanced configuration options
- API Reference - Explore the complete API documentation
- Examples - See practical implementation examples