Requirements
Install the Package
npm install @webacy-xyz/sdk
Module Support
The SDK supports both ESM and CommonJS:
ESM (Recommended)
CommonJS
import { ThreatClient , TradingClient , Chain } from '@webacy-xyz/sdk' ;
Initialize a Client
ThreatClient
For security analysis (addresses, contracts, sanctions, URLs):
import { ThreatClient , Chain } from '@webacy-xyz/sdk' ;
const client = new ThreatClient ({
apiKey: process . env . WEBACY_API_KEY ,
});
TradingClient
For trading analysis (holder analysis, sniper detection):
import { TradingClient , Chain } from '@webacy-xyz/sdk' ;
const client = new TradingClient ({
apiKey: process . env . WEBACY_API_KEY ,
});
Configuration Options
Both clients accept the same configuration options:
const client = new ThreatClient ({
// Required
apiKey: 'your-api-key' ,
// Optional: Set a default chain for all requests
defaultChain: Chain . ETH ,
// Optional: Enable debug logging
debug: true , // or 'requests' | 'responses' | 'errors'
// Optional: Custom base URL (for development)
baseUrl: 'https://api-development.webacy.com' ,
// Optional: Request timeout in milliseconds
timeout: 30000 ,
});
Default Chain
Set a default chain to avoid specifying it on every request:
const client = new ThreatClient ({
apiKey: process . env . WEBACY_API_KEY ,
defaultChain: Chain . ETH ,
});
// No need to specify chain - uses ETH
const result = await client . addresses . analyze ( '0x...' );
// Override for specific requests
const solResult = await client . addresses . analyze ( 'So1...' , {
chain: Chain . SOL ,
});
Debug Mode
Enable logging to troubleshoot issues:
const client = new ThreatClient ({
apiKey: process . env . WEBACY_API_KEY ,
debug: true , // Log everything
});
// Or be more specific:
const client = new ThreatClient ({
apiKey: process . env . WEBACY_API_KEY ,
debug: 'requests' , // Only log outgoing requests
// debug: 'responses', // Only log responses
// debug: 'errors', // Only log errors
});
Never commit your API key to version control. Use environment variables or a secrets manager.
Individual Packages
If you only need specific functionality, install individual packages to reduce bundle size:
Package Install Description @webacy-xyz/sdk-corenpm install @webacy-xyz/sdk-coreCore utilities only @webacy-xyz/sdk-threatnpm install @webacy-xyz/sdk-threatThreat analysis @webacy-xyz/sdk-tradingnpm install @webacy-xyz/sdk-tradingTrading analysis
// Import from specific packages
import { ThreatClient } from '@webacy-xyz/sdk-threat' ;
import { TradingClient } from '@webacy-xyz/sdk-trading' ;
import { Chain , ValidationError } from '@webacy-xyz/sdk-core' ;
TypeScript Configuration
The SDK is written in TypeScript and includes type definitions. For the best experience, ensure your tsconfig.json includes:
{
"compilerOptions" : {
"moduleResolution" : "bundler" , // or "node16" / "nodenext"
"esModuleInterop" : true ,
"strict" : true
}
}
Next Steps