Complete API documentation for developers building applications on HP Swarm infrastructure.
All API requests require an API key in the header:
/wallet/balanceGet wallet balance for HP tokens
address (string, required) - Wallet address/wallet/transferTransfer HP tokens between wallets
/transactions/{hash}Get transaction details by hash
/transactions/historyGet transaction history for an address
address (string, required) - Wallet addresslimit (integer, optional) - Number of transactions (default: 50)offset (integer, optional) - Pagination offset/presale/statusGet current presale status and stage information
/presale/purchasePurchase tokens during presale
400Bad Request - Invalid parameters401Unauthorized - Invalid API key403Forbidden - Insufficient permissions404Not Found - Resource not found429Rate Limited - Too many requests500Internal 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);