Skip to content

Latest commit

 

History

History
76 lines (58 loc) · 1.51 KB

README.md

File metadata and controls

76 lines (58 loc) · 1.51 KB

Flowbit

A TypeScript library for analyzing Ethereum transaction flows, tracking token and ETH transfers.

Features

  • Track ETH transfers from transaction traces
  • Track ERC20 token transfers from logs
  • Consolidate multiple transfers for the same token/account
  • Support for both CommonJS and ESM imports
  • Full TypeScript support

Installation

npm install flowbit
# or
yarn add flowbit

Usage

import { Flowbit } from 'flowbit';

// Initialize with an Ethereum node URL
const flowbit = new Flowbit('https://eth-mainnet.g.alchemy.com/v2/your-api-key');

// Analyze a transaction
const transfers = await flowbit.analyze('0xtx_hash_here');

// Example output:
// [
//   {
//     token: '0xb705268213d593b8fd88d3fdeff93aff5cbdcfae',
//     value: '44549462000000000000000',
//     direction: 'out',
//     account: '0x5f939de0e81a199a34e50615f34cbab82412459a'
//   },
//   {
//     token: '0xffffffffffffffffffffffffffffffffffffffff', // ETH
//     value: '839388510945838955',
//     direction: 'in',
//     account: '0x5f939de0e81a199a34e50615f34cbab82412459a'
//   }
// ]

API

Flowbit

Constructor

new Flowbit(nodeUrl?: string)

Methods

analyze(txid: string): Promise<TransferEvent[]>

Types

interface TransferEvent {
  token: string;    // Token address (ETH is 0xfff...)
  value: string;    // Amount in smallest unit (wei for ETH)
  direction: 'in' | 'out';
  account: string;  // Ethereum address
}

License

MIT