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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@webmobix/isin-lib-js

v1.0.0

Published

A JavaScript/TypeScript library for reversible conversion between International Securities Identification Numbers (ISINs) and uint256 (represented as BigInt) values using base36 encoding.

Readme

isin-lib-js

A JavaScript/TypeScript library for reversible conversion between International Securities Identification Numbers (ISINs) and uint256 (represented as BigInt) values using base36 encoding.

This library is essential for applications that need to bridge traditional financial identifiers (ISINs) with Ethereum Virtual Machine (EVM)-based smart contract identifiers (uint256), particularly in Node.js backend services or browser-based front-end applications.

Why This Library Matters

Financial instruments are globally identified by ISINs, which are 12-character alphanumeric codes. However, smart contracts on EVM blockchains often use uint256 integers as unique identifiers (e.g., for NFTs). This creates a data type mismatch. isin-lib-js solves this by providing a standardized, reversible way to convert ISINs to uint256 values (and back) using base36 encoding. This ensures a reliable one-to-one mapping, crucial for integrating traditional financial assets with blockchain applications.

For a deeper dive into the challenge and our comprehensive solution, please read our article: https://webmobix.com

Features

  • Converts ISIN strings to BigInt (representing uint256).
  • Converts BigInt (representing uint256) back to ISIN strings.
  • Uses base36 encoding for efficient and reversible conversion.
  • Validates ISIN format (length and alphanumeric characters).
  • Ensures correct padding for ISINs generated from BigInt.
  • Written in TypeScript for type safety, usable in both JavaScript and TypeScript projects.

Installation

npm install @webmobix/isin-lib-js

Usage

Importing

CommonJS (Node.js):

const { isinToUint256, uint256ToIsin } = require("@webmobix/isin-lib-js");

ES Modules / TypeScript:

import { isinToUint256, uint256ToIsin } from "@webmobix/isin-lib-js";

Converting ISIN to BigInt (uint256)

const isin = 'US0378331005'; // Example Apple Inc. ISIN
try {
 const uint256Value = isinToUint256(isin);
 console.log(`ISIN: ${isin}`);
 console.log(`uint256 (BigInt): ${uint256Value.toString()}`);
 // Example: For "US0378331005", this would output a specific BigInt value.
} catch (error) {
 console.error((error as Error).message);
}

Converting BigInt (uint256) to ISIN


// This BigInt value would typically come from a smart contract or a previous conversion.
// Replace with an actual BigInt value obtained from isinToUint256.
const exampleUint256Value = BigInt("33366803344263005"); // Placeholder for 'US0378331005'

try {
 const isin = uint256ToIsin(exampleUint256Value);
 console.log(`uint256 (BigInt): ${exampleUint256Value.toString()}`);
 console.log(`ISIN: ${isin}`);
 // This would output the ISIN corresponding to the exampleUint256Value,
 // correctly padded with leading zeros if necessary. e.g., 'US0378331005'
} catch (error) {
 console.error((error as Error).message);
}

API

isinToUint256(isin: string): BigInt

  • Takes a 12-character alphanumeric ISIN string.
  • Returns its BigInt representation.
  • Throws an error for invalid ISIN formats.

uint256ToIsin(value: BigInt): string

  • Takes a BigInt value.
  • Returns the corresponding 12-character ISIN string (padded with leading '0's if necessary).
  • Throws an error if the value is too large to be represented as a 12-character base36 string or if it's negative.

Sister Libraries

This library is part of a suite designed to provide consistent ISIN <=> uint256 conversion across different environments:

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.