Installation & Setup
Core Classes
BondkitTokenFactory
The factory class handles deploying new bond tokens and querying deployed tokens.Constructor
Parameter | Type | Required | Description |
---|---|---|---|
chainId | number | Yes | Chain ID (currently only Base: 8453) |
walletKey | string | No | Private key for write operations |
Methods
deployBondkitToken
deployBondkitToken
Deploy a new bond tokenParameters:Example:
getDeployedBondkitTokens
getDeployedBondkitTokens
Get all deployed tokensReturns: Array of token addressesExample:
getBondkitTokenConfig
getBondkitTokenConfig
Get token configurationExample:
getImplementationAddress
getImplementationAddress
Get implementation contractExample:
connect
connect
Connect wallet providerExample:
BondkitToken
The token class handles all operations for a specific bond token.Constructor
Parameter | Type | Required | Description |
---|---|---|---|
contractAddress | string | Yes | Token contract address |
walletKey | string | No | Private key for write operations |
Read Methods
ERC20 Standard Methods
ERC20 Standard Methods
Bonding Curve Methods
Bonding Curve Methods
State & Configuration
State & Configuration
Analytics Methods
Analytics Methods
Write Methods
buy
buy
Buy tokens with ETHParameters:
minTokensOut
: Minimum tokens to receive (slippage protection)ethAmount
: ETH to spend (as string or bigint)
sell
sell
Sell tokens for ETHParameters:
tokenAmount
: Amount of tokens to sellminEthOut
: Minimum ETH to receive (slippage protection)
migrateToDex
migrateToDex
Migrate to Uniswap v4Requirements:
- Caller must be migration admin
- Target must be reached
ERC20 Write Methods
ERC20 Write Methods
Event Listeners
Type Definitions
Core Types
Event Types
Transaction Types
Configuration
Network Support
Supported Chains
Chain | Chain ID | Status |
---|---|---|
Base Mainnet | 8453 | ✅ Supported |
Base Sepolia | 84532 | 🚧 Coming Soon |
Error Handling
Complete Examples
Deploy and Trade
Portfolio Tracker
Best Practices
Security Considerations
- Never expose private keys in client-side code
- Always use slippage protection in trades
- Validate addresses before transactions
- Handle errors gracefully with try-catch
- Monitor gas prices before large operations
Performance Tips
- Batch read operations with Promise.all()
- Cache token instances to avoid recreating
- Use event listeners instead of polling
- Implement exponential backoff for retries
- Consider pagination for large datasets