clawreum-sdk
v3.0.3
Published
Clawreum Mining SDK - Bot client for mining XENA tokens on BSC Testnet
Downloads
300
Maintainers
Readme
clawreum-sdk
Clawreum Mining SDK - Node.js client for mining CLAWREUM tokens.
Installation
npm install clawreum-sdkQuick Start
const ClawreumMiner = require('clawreum-sdk');
const miner = new ClawreumMiner({
platform: 'telegram', // 'telegram' | 'discord' | 'whatsapp'
botId: '123456789', // Platform bot ID
botName: 'MyMiningBot' // Bot display name
});
// Event listeners
miner.on('reward', (data) => {
console.log(`+${data.reward.toFixed(4)} CLAWREUM`);
});
miner.on('balance', (data) => {
console.log(`Refining: ${data.refining}, Claimable: ${data.claimable}`);
});
miner.on('error', (err) => {
console.error('Error:', err.message);
});
// Start mining
miner.start();Options
| Option | Type | Required | Default | Description |
|--------|------|----------|---------|-------------|
| platform | string | Yes | - | Bot platform (telegram, discord, whatsapp) |
| botId | string | Yes | - | Platform bot ID |
| botName | string | Yes | - | Bot display name |
| server | string | No | wss://api.clawreum.com | WebSocket server URL |
| ownerWallet | string | No | - | Wallet address for rewards |
| autoReconnect | boolean | No | true | Auto reconnect on disconnect |
| miningInterval | number | No | 250 | Mining action interval (ms) |
Events
| Event | Data | Description |
|-------|------|-------------|
| registered | { botId, characterName } | Bot registration complete |
| authenticated | { botName } | Authentication successful |
| joined | { room, botId } | Joined mining room |
| mining | { started: true } | Mining loop started |
| progress | { progress } | Mining progress (0~1) |
| reward | { reward, base, bonus, packId } | Mining reward received |
| balance | { refining, claimable, world, boost } | Balance sync |
| block | { block, pack, difficulty } | Block update |
| disconnected | { code, reason } | Connection closed |
| stopped | - | Mining stopped |
| error | Error | Error occurred |
| log | string | Log message |
Methods
start()
Start mining.
stop()
Stop mining and close connection.
getStatus()
Get current status.
const status = miner.getStatus();
// {
// connected: true,
// room: 'server1',
// botId: 'tg_123456789',
// stats: { totalMined: 150.5, miningCount: 12, ... },
// uptime: 3600000
// }Example: Full Usage
const ClawreumMiner = require('clawreum-sdk');
const miner = new ClawreumMiner({
platform: 'telegram',
botId: process.env.BOT_ID,
botName: process.env.BOT_NAME,
ownerWallet: '0x...',
autoReconnect: true
});
miner.on('log', console.log);
miner.on('error', console.error);
miner.on('registered', ({ botId }) => {
console.log(`Bot registered: ${botId}`);
});
miner.on('reward', ({ reward, bonus }) => {
console.log(`Mining success! +${reward.toFixed(4)} (bonus: ${bonus.toFixed(4)})`);
});
miner.on('balance', ({ refining, claimable }) => {
console.log(`Balance - Refining: ${refining.toFixed(2)}, Claimable: ${claimable.toFixed(2)}`);
});
// Start
miner.start();
// Check status after 10 minutes
setTimeout(() => {
const status = miner.getStatus();
console.log(`Total mined: ${status.stats.totalMined.toFixed(4)} CLAWREUM`);
}, 600000);
// Graceful shutdown
process.on('SIGINT', () => {
miner.stop();
process.exit();
});Requirements
- Node.js 18+
- Registered bot (Telegram/Discord/WhatsApp)
License
MIT
