UNPKG

blub-sdk

Version:

A modular SDK for interacting with the BLUB ecosystem on the Sui blockchain.

21 lines (20 loc) 762 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBlubMarketCap = getBlubMarketCap; const prices_1 = require("./prices"); const stats_1 = require("./stats"); /** * Returns the current market capitalization of BLUB in USD. * * Market cap = circulating supply × current price. */ async function getBlubMarketCap() { const price = await (0, prices_1.getBlubPrice)(); // USD per BLUB const circulatingSupply = (0, stats_1.getBlubCirculatingSupply)(); // bigint // Convert bigint to number for calculation const marketCap = Number(circulatingSupply) * price; if (!isFinite(marketCap) || marketCap <= 0) { throw new Error("❌ Failed to calculate BLUB market cap."); } return marketCap; }