@glideco/chain-utils
v0.1.0
Published
Chain canonicalization, address truncation, and block-explorer URL helpers for the 5 EVM chains Glide supports plus Solana. Pure functions, zero deps.
Maintainers
Readme
@glideco/chain-utils
Chain canonicalization, address truncation, and block-explorer URL helpers for Glide.
Trivial pure utilities used everywhere in the Glide UI for showing addresses and explorer links across the 5 EVM chains Glide supports (ethereum, base, arbitrum, polygon) plus Solana. Zero dependencies.
import {
normalizeChain,
isEvmChain,
chainToChainId,
shortAddress,
shortHash,
explorerUrl,
explorerLabel,
type CanonicalChain,
} from '@glideco/chain-utils';
normalizeChain('eth-mainnet'); // → 'ethereum'
normalizeChain(8453); // → 'base'
shortAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
// → '0xC02a…6Cc2'
explorerUrl('base', '0x123…'); // → 'https://basescan.org/tx/0x123…'Why a package
The same explorerUrl switch and shortAddress truncation showed up inline in 12+
places in the Glide app prior to v0.7.0.0. Centralizing them prevents drift between
consumers and lets OSS users (e.g. anyone building a multi-chain wallet UI) skip
the boilerplate.
License
MIT
