A Node.js client for the Glassnode API.
npm install glassnode-apiimport { GlassnodeAPI } from 'glassnode-api';
// Create an instance with your API key
const api = new GlassnodeAPI({
apiKey: 'YOUR_API_KEY',
// Optional: Override the API URL
// apiUrl: 'https://api.glassnode.com'
});
// Fetch asset metadata
async function getAssets() {
try {
const response = await api.getAssetMetadata();
console.log(response.data);
} catch (error) {
console.error('Error fetching asset metadata:', error);
}
}
// Fetch metric metadata
async function getMetrics() {
try {
const response = await api.getMetricMetadata();
console.log(response.data);
} catch (error) {
console.error('Error fetching metric metadata:', error);
}
}Explore our detailed examples to learn how to use the Glassnode API client effectively. The examples demonstrate:
- Fetching and validating asset metadata
- Working with metric lists and metadata
- Calling metrics with parameters
To run the examples:
- Navigate to the examples directory
- Create a
.envfile with your API key:GLASSNODE_API_KEY=your_key_here - Install dependencies with
npm install - Run an example with
npx ts-node metadata.validation.ts
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Lint code
npm run lint
# Format code
npm run formatMIT