Complete API documentation for developers building applications on HP Swarm infrastructure.
All API requests require an API key in the header:
/wallet/balance
Get wallet balance for HP tokens
address
(string, required) - Wallet address/wallet/transfer
Transfer HP tokens between wallets
/transactions/{hash}
Get transaction details by hash
/transactions/history
Get transaction history for an address
address
(string, required) - Wallet addresslimit
(integer, optional) - Number of transactions (default: 50)offset
(integer, optional) - Pagination offset/presale/status
Get current presale status and stage information
/presale/purchase
Purchase tokens during presale
400
Bad Request - Invalid parameters401
Unauthorized - Invalid API key403
Forbidden - Insufficient permissions404
Not Found - Resource not found429
Rate Limited - Too many requests500
Internal Server Error// JavaScript/Node.js const hpswarm = require('@hpswarm/sdk'); const client = new hpswarm.Client('YOUR_API_KEY'); const balance = await client.wallet.getBalance({ address: '0x742d35Cc6634C0532925a3b8D0F3e3e1a0e1e8C8' }); console.log(balance);
// JavaScript/Node.js const transaction = await client.presale.purchase({ amount: '0.1', // ETH amount wallet: '0x742d35Cc6634C0532925a3b8D0F3e3e1a0e1e8C8' }); console.log('Transaction hash:', transaction.hash);