Gathering detailed insights and metrics for @first-ledger/kit-adapter
Gathering detailed insights and metrics for @first-ledger/kit-adapter
Gathering detailed insights and metrics for @first-ledger/kit-adapter
Gathering detailed insights and metrics for @first-ledger/kit-adapter
npm install @first-ledger/kit-adapter
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
29
The Data Kit is a modular, lightweight package designed to fetch, aggregate, and parse data from various blockchain networks. It provides developers with a unified interface to access blockchain data in a structured and usable format, enabling seamless integration into applications such as wallets, analytics tools, decentralized finance (DeFi) platforms, and more.
Install the package via npm:
1npm install @first-ledger/kit
Or with Yarn:
1yarn add @first-ledger/kit
Fetch and parse the latest block data from Ethereum:
1const { BlockchainDataKit } = require('@first-ledger/kit'); 2 3// Initialize the kit with a blockchain adapter 4const kit = new BlockchainDataKit({ 5 chain: 'ethereum', 6 rpcUrl: 'https://mainnet.infura.io/v3/YOUR_INFURA_KEY', 7}); 8 9// Fetch the latest block 10kit 11 .getLatestBlock() 12 .then((block) => { 13 console.log('Latest Ethereum Block:', block); 14 }) 15 .catch((err) => { 16 console.error('Error fetching block:', err); 17 });
Aggregating Transaction Data
Aggregate transaction data for a specific address:
1const { BlockchainDataKit } = require('blockchain-data-kit'); 2 3const kit = new BlockchainDataKit({ 4 chain: 'bitcoin', 5 rpcUrl: 'http://your-bitcoin-node:8332', 6}); 7 8kit 9 .getAddressTransactions('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') 10 .then((transactions) => { 11 console.log('Bitcoin Transactions:', transactions); 12 }) 13 .catch((err) => { 14 console.error('Error:', err); 15 });
Supported Blockchains
Blockchain | Adapter Name | Status |
---|---|---|
XRP Ledger | xrpl | Stable |
Ethereum | ethereum | TBD |
Bitcoin | bitcoin | TBD |
Binance Smart Chain | bsc | TBD |
Solana | solana | TBD |
Polygon | polygon | TBD |
To request support for additional chains, see Contributing (#contributing).
Configuration
The kit accepts a configuration object to customize its behavior:
javascript
1const kit = new BlockchainDataKit({
2 chain: 'ethereum', // Blockchain adapter name
3 rpcUrl: 'YOUR_RPC_URL', // RPC endpoint
4 apiKey: 'YOUR_API_KEY', // Optional: API key if required
5 timeout: 5000, // Request timeout in ms
6 maxRetries: 3, // Retry failed requests
7 parser: customParserFunction, // Optional: Custom parsing logic
8});
Custom Parsers
You can define custom parsers to format data according to your needs:
javascript
1function customParserFunction(rawData) {
2 return {
3 blockNumber: rawData.number,
4 timestamp: new Date(rawData.timestamp * 1000),
5 transactionCount: rawData.transactions.length,
6 };
7}
8
9const kit = new BlockchainDataKit({
10 chain: 'ethereum',
11 rpcUrl: 'YOUR_RPC_URL',
12 parser: customParserFunction,
13});
14
15kit.getLatestBlock().then((parsedBlock) => {
16 console.log('Custom Parsed Block:', parsedBlock);
17});
API Reference
BlockchainDataKit(config)
Methods
For detailed method documentation, see the API Docs (docs/api.md).
Contributing
We welcome contributions! To add a new blockchain adapter or improve the kit:
See CONTRIBUTING.md for more details.
License
This project is licensed under the MIT License. See LICENSE for details.
Support
For issues or questions, open a ticket on our GitHub Issues page or reach out via email at support@first-ledger.com.
No vulnerabilities found.
No security vulnerabilities found.