Client Package
@ckboost/client SDK
Overview
The @ckboost/client SDK provides a simple, type-safe way to integrate CKBoost acceleration services into your dApp. CKBoost reduces ckBTC conversion times from 1 hour (6 confirmations) to 7-10 minutes (1-2 confirmations) through a network of liquidity providers. We are planning to expend ckBoost and support other chain-key tokens (ckETH, in the future ckSOL, etc)
Key Features
π Fast Integration: Simple API with just two main functions
π TypeScript First: Full type safety and excellent developer experience
β‘ Real-time Monitoring: Track boost request status changes
π Secure: Built on Internet Computer Protocol (ICP)
π― dApp Ready: Designed specifically for frontend integration
Installation
npm install @ckboost/clientyarn add @ckboost/clientpnpm add @ckboost/clientQuick Start
API Reference
Client Initialization
ckTESTBTCClient
Creates a new client instance for ckTESTBTC (Bitcoin testnet).
Parameters:
config
ClientConfig
{}
Optional client configuration
ClientConfig:
Core Methods
generateDepositAddress()
Creates a new boost request and returns deposit information.
Parameters:
Returns:
getBoostRequest()
Retrieves detailed information about a specific boost request.
Parameters:
requestId
string
The unique request identifier
Returns:
getPendingBoostRequests()
Retrieves all pending boost requests.
Utility Methods
getTokenConfig()
Returns the current token configuration.
Returns:
rawToTokenAmount()
Converts raw amount (satoshis) to token amount (ckTESTBTC).
tokenToRawAmount()
Converts token amount (ckTESTBTC) to raw amount (satoshis).
Types Reference
Enums
BoostStatus
SupportedToken
CKBoostErrorType
Response Types
ApiResponse<T>
All API methods return this discriminated union type:
Examples
Basic Integration
React Hook Integration
Complete dApp Integration
Error Handling
Error Types
The SDK provides specific error types to help you handle different scenarios:
Best Practices
Always check the
successproperty before accessingdataProvide user-friendly error messages based on error types
Implement retry logic for network errors
Validate amounts before making requests
Monitor request status until completion
Configuration
Canister IDs
The SDK includes the required canister IDs:
Network Configuration
For production applications, use the default configuration:
For development, you might want to use a local replica:
Monitoring and Real-time Updates
Polling Strategy
For production applications, implement efficient polling:
WebSocket Alternative
For real-time updates, consider implementing WebSocket connections to the backend canister (when available) instead of polling.
Troubleshooting
Common Issues
Import Errors
Type Errors
Make sure you have TypeScript configured properly:
Network Errors
If you're getting network errors:
Check your internet connection
Verify the ICP host URL is correct
Ensure the canister IDs are valid
Try increasing the timeout value
Support
Documentation: docs.ckboost.com
Issues: Report bugs and feature requests on GitHub
Last updated