SDK
SDK
Installation
npm install risk-contracts
# or
yarn add risk-contracts
## Note that it's not published yet, the above is a placeholderQuick Start
Server-Side (Node.js)
import { RiskContracts, RiskSdkConfig } from 'risk-contracts';
const config: RiskSdkConfig = {
serverProvider: {
rpcUrl: "https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY",
privateKey: "YOUR_PRIVATE_KEY"
},
network: {
name: "sepolia",
chainId: 11155111
},
tokenFactory: {
address: "0x8888cF3da8E6Fb30bEEcD9dC1dd220060c2969DC"
},
smartToken: {
one: "0x...", // RiskON token address
two: "0x..." // RiskOFF token address
},
orchestrator: {
address: "0x..."
},
apiUrl: "https://api.riskprotocol.com"
};
const sdk = new RiskContracts(config);Client-Side (Browser with Wallet)
Configuration
Core Concepts
SDK Structure
Working with Amounts
Smart Tokens
Common Workflows
1. Deposit Tokens
2. Withdraw Tokens
3. Check Balances and Fees
4. Estimate Swap Outputs
Error Handling
Best Practices
1. Always Preview Before Executing
2. Check Maximum Limits
TypeScript Support
Next Steps
Last updated
