@hermes-core/api-client
v0.1.1
Published
API client for Hermes
Readme
hermes-api-client
NodeJS API client for Hermes
Installation
Production
npm install @hermes-core/api-clientDevelopment
Clone or download this repository.
Install dependencies:
npm install- Create a
.envfile in the root directory with the required environment variables:
API_URL=your_api_url_here
SOCKET_URL=your_socket_url_here
API_KEY=your_api_key_hereUsage
Import and initialize the client in your Node.js application:
Production
import { createHermesClient } from '@hermes-core/api-client';
const client = createHermesClient({
apiUrl: 'https://placeholder.com',
socketUrl: 'https://placeholder.com',
apiKey: 'YOUR_API_KEY',
});
// Example: Fetch private wallets
const wallets = await client.private.getWallets();
console.log(wallets);
// Example: Send a tip
const tipResult = await client.private.tip({
ticker: 'RUNES',
recipientIds: ['user_id_1', 'user_id_2'],
amountPerRecipient: '0.001',
notifyChannelId: 'channel_id' // Optional
});
console.log(tipResult);Development
import { createHermesClient } from './index.mjs'; // Adjust path as needed
const client = createHermesClient(); // Automatically uses process.env for config
// Example: Fetch private wallets
const wallets = await client.private.getWallets();
console.log(wallets);
// Example: Send a tip
const tipResult = await client.private.tip({
ticker: 'RUNES',
recipientIds: ['user_id_1', 'user_id_2'],
amountPerRecipient: '0.001',
notifyChannelId: 'channel_id' // Optional
});
console.log(tipResult);Refer to the source code (index.mjs) for full API methods, including public endpoints, guild operations, reactdrops, and socket events.
Guild Security Sessions
Privileged guild operations (guild tips, guild airdrops, schedules, rewards, faucet config) require a guild security session.
import { createHermesClient } from '@hermes-core/api-client';
const client = createHermesClient({
apiUrl: 'https://placeholder.com',
socketUrl: 'https://placeholder.com',
apiKey: 'YOUR_API_KEY',
guildSecurity: {
autoRefresh: true,
onSessionUpdate: (guildId, session) => {
console.log('Session updated:', guildId, session);
},
},
});
// Login to guild security
const session = await client.private.guildSecurityLogin('GUILD_ID', {
password: 'YOUR_PASSWORD',
ttlMinutes: 30,
});
// Privileged guild call (auto injects X-Guild-Authorization)
await client.private.guildTip('GUILD_ID', {
ticker: 'RUNES',
recipientIds: ['user_id_1'],
amountPerRecipient: '0.01',
});Integration Tests
# Run all tests
node src/test-integration.mjs
# Run specific tests (comma-separated flags)
node src/test-integration.mjs --wallets --tip --sockets
# Run a single test
node src/test-integration.mjs --guild-tip