npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alphscan/normalized-events

v0.1.0

Published

Normalized event types, categories, and factory for **Alephium** blockchain events. Used by the indexer to produce a consistent schema for RDS storage and complex queries.

Readme

@alphscan/normalized-events

Normalized event types, categories, and factory for Alephium blockchain events. Used by the indexer to produce a consistent schema for RDS storage and complex queries.

Schema versioning

  • NORMALIZED_EVENT_SCHEMA_VERSION – Bump when breaking changes require reindexing.
  • Every event has schema_version and a unique id (chain:fromGroup:toGroup:block_number:tx_hash:log_index) for idempotency.

Base fields (every event)

| Field | Type | Description | |-------|------|-------------| | chain | string | Chain identifier (e.g. mainnet group) | | fromGroup | number | Alephium from-group index (0–3) | | toGroup | number | Alephium to-group index (0–3) | | block_number | number | Block number | | tx_hash | string | Transaction hash | | log_index | number | Event index within the tx | | token_address | string | null | Token/contract address when applicable | | from | string | null | Sender | | to | string | null | Recipient | | amount | string | null | Raw amount (smallest unit) | | amount_usd | string | null | USD value when available | | lock_until | number | null | Lock/vesting end timestamp | | dapp | string | null | Dapp/protocol id (e.g. "alephium-dex") | | authoring | string | null | Contract/address that emitted the event | | plugin | string | null | Plugin that generated this event | | normalizer | string | null | Normalizer that produced this event | | normalizer_version | number | null | Version of the normalizer | | creationDate | number | null | When this normalized event was first created (ms since epoch) | | lastUpdate | number | null | When this normalized event was last updated (ms since epoch) | | onChainDate | number | null | When the event occurred on chain (ms since epoch) | | dateIndexationMetrics | number | Date used for indexation metrics (ms since epoch); defaults to 1970-01-01 |

Categories and sub-kinds

  1. Transfernative_transfer, burn_native, token_transfer, send_to_bridge, received_from_bridge, send_to_cex, received_from_cex, genesis_release, treasury_mint, treasury_release
  2. Tokengenesis_mint, genesis_distribution, genesis_emission, token_emission, token_mint, token_burn, nft_transfer, nft_collection_mint, nft_collection_burn, nft_mint, nft_burn, wrap, unwrap
  3. Chaincoinbase, burn_network_fees, pay_storage_fees
  4. DEXpool_creation, pool_destruction, add_liquidity, remove_liquidity, swap, mint_nft_position, burn_nft_position, push_order, delete_order, execute_order, vote_for_pool, claim_vote_rewards, claim_trading_fees, collect_fees
  5. Lendingdeposit_collateral, remove_collateral, borrow, repay, liquidation, liquidation_auction, redeem, open_trove, close_trove, adjust_trove, claim_collateral, supply, withdraw
  6. Yieldstake, unstake, claim_staking, claim_fees, deposit, withdraw, compound, claim_rewards, vest, claim_vested
  7. Governancecreate_proposal, vote, vote_results, execute_proposal, cancel_proposal, queue_proposal, delegate
  8. Contract lifecontract_creation, contract_destruction, contract_update, contract_upgrade, contract_pause, contract_unpause
  9. Game / predictioncreate_game, create_market, bet, claim, add_to_pot, win, lose, resolve_market, cancel_market, refund
  10. Oracleoracle_update, oracle_get_random_seed, oracle_request_randomness, oracle_fulfill_randomness

Usage

import {
  createNormalizedEvent,
  EventCategory,
  TransferSubKind,
  buildEventId,
} from "@alphscan/normalized-events";

const event = createNormalizedEvent(
  {
    chain: "mainnet",
    fromGroup: 0,
    toGroup: 0,
    block_number: 12345,
    tx_hash: "0x…",
    log_index: 0,
    from: "addr1",
    to: "addr2",
    amount: "1000000000000000000",
    timestamp: Date.now(),
  },
  {
    category: "transfer",
    sub_kind: TransferSubKind.NATIVE_TRANSFER,
  }
);

Type guards

  • isTransferEvent(e), isTokenEvent(e), isChainEvent(e), isDexEvent(e), isLendingEvent(e), isYieldEvent(e), isGovernanceEvent(e), isContractLifeEvent(e), isGameEvent(e), isOracleEvent(e)

Storage and export

  • RDS: Use @alphscan/storagecreateNormalizedEventStore({ relational }), CREATE_NORMALIZED_EVENTS_TABLE_SQL, eventToRow / rowToEvent.
  • Export: eventsToJson, eventsToSqlLiteral, eventsToCsv, writeEventsToJsonFile, writeEventsToSqlFile, writeEventsToCsvFile from @alphscan/storage.