Utility Functions
The Bundlr SDK includes utility functions that assist in converting between atomic units standard denominations.
note
Atomic units refer to the smallest possible unit of a given cryptocurrency. In Ethereum, atomic units are called Wei, and they represent the smallest unit of Ether. Similar to how 1 dollar can be broken down into 100 cents, 1 Ether can be broken down into 10^18 Wei. In Solana, atomic units are called Lamports, 1 SOL can be broken down into 10^9 Lamports.
bundlr.utils.toAtomic()
Converts from standard to atomic units.
Example code:
const fundAmountAtomic = bundlr.utils.toAtomic(fundAmountStandard);
bundlr.utils.fromAtomic()
Converts from atomic to standard units.
Example code:
const atomicBalance = await bundlr.getLoadedBalance();
const convertedBalance = bundlr.utils.fromAtomic(atomicBalance).toString();