How to use @ethersproject/units - 5 common examples

To help you get started, we’ve selected a few @ethersproject/units examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethers-io / ethers.js / packages / ethers / utils.js View on Github external
exports.SigningKey = signing_key_1.SigningKey;
var strings_1 = require("@ethersproject/strings");
exports.formatBytes32String = strings_1.formatBytes32String;
exports.nameprep = strings_1.nameprep;
exports.parseBytes32String = strings_1.parseBytes32String;
exports._toEscapedUtf8String = strings_1._toEscapedUtf8String;
exports.toUtf8Bytes = strings_1.toUtf8Bytes;
exports.toUtf8CodePoints = strings_1.toUtf8CodePoints;
exports.toUtf8String = strings_1.toUtf8String;
var transactions_1 = require("@ethersproject/transactions");
exports.computeAddress = transactions_1.computeAddress;
exports.parseTransaction = transactions_1.parse;
exports.recoverAddress = transactions_1.recoverAddress;
exports.serializeTransaction = transactions_1.serialize;
var units_1 = require("@ethersproject/units");
exports.commify = units_1.commify;
exports.formatEther = units_1.formatEther;
exports.parseEther = units_1.parseEther;
exports.formatUnits = units_1.formatUnits;
exports.parseUnits = units_1.parseUnits;
var wallet_1 = require("@ethersproject/wallet");
exports.verifyMessage = wallet_1.verifyMessage;
var web_1 = require("@ethersproject/web");
exports.fetchJson = web_1.fetchJson;
exports.poll = web_1.poll;
////////////////////////
// Enums
var sha2_2 = require("@ethersproject/sha2");
exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
github ethers-io / ethers.js / packages / ethers / utils.js View on Github external
exports.formatBytes32String = strings_1.formatBytes32String;
exports.nameprep = strings_1.nameprep;
exports.parseBytes32String = strings_1.parseBytes32String;
exports._toEscapedUtf8String = strings_1._toEscapedUtf8String;
exports.toUtf8Bytes = strings_1.toUtf8Bytes;
exports.toUtf8CodePoints = strings_1.toUtf8CodePoints;
exports.toUtf8String = strings_1.toUtf8String;
var transactions_1 = require("@ethersproject/transactions");
exports.computeAddress = transactions_1.computeAddress;
exports.parseTransaction = transactions_1.parse;
exports.recoverAddress = transactions_1.recoverAddress;
exports.serializeTransaction = transactions_1.serialize;
var units_1 = require("@ethersproject/units");
exports.commify = units_1.commify;
exports.formatEther = units_1.formatEther;
exports.parseEther = units_1.parseEther;
exports.formatUnits = units_1.formatUnits;
exports.parseUnits = units_1.parseUnits;
var wallet_1 = require("@ethersproject/wallet");
exports.verifyMessage = wallet_1.verifyMessage;
var web_1 = require("@ethersproject/web");
exports.fetchJson = web_1.fetchJson;
exports.poll = web_1.poll;
////////////////////////
// Enums
var sha2_2 = require("@ethersproject/sha2");
exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
github ethers-io / ethers.js / packages / ethers / utils.js View on Github external
exports.parseBytes32String = strings_1.parseBytes32String;
exports._toEscapedUtf8String = strings_1._toEscapedUtf8String;
exports.toUtf8Bytes = strings_1.toUtf8Bytes;
exports.toUtf8CodePoints = strings_1.toUtf8CodePoints;
exports.toUtf8String = strings_1.toUtf8String;
var transactions_1 = require("@ethersproject/transactions");
exports.computeAddress = transactions_1.computeAddress;
exports.parseTransaction = transactions_1.parse;
exports.recoverAddress = transactions_1.recoverAddress;
exports.serializeTransaction = transactions_1.serialize;
var units_1 = require("@ethersproject/units");
exports.commify = units_1.commify;
exports.formatEther = units_1.formatEther;
exports.parseEther = units_1.parseEther;
exports.formatUnits = units_1.formatUnits;
exports.parseUnits = units_1.parseUnits;
var wallet_1 = require("@ethersproject/wallet");
exports.verifyMessage = wallet_1.verifyMessage;
var web_1 = require("@ethersproject/web");
exports.fetchJson = web_1.fetchJson;
exports.poll = web_1.poll;
////////////////////////
// Enums
var sha2_2 = require("@ethersproject/sha2");
exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
github Mrtenz / FindETH / src / utils / balance.ts View on Github external
export const formatDecimals = (balance: bigint, decimals: number = 18): string => {
  const newBalance = formatUnits(balance.toString(10), decimals);
  if (newBalance === '0.0') {
    return '0';
  }
  return newBalance;
};
github NoahZinsmeister / web3-react / example / index.tsx View on Github external
? '...'
            : account === null
            ? 'None'
            : `${account.substring(0, 6)}...${account.substring(account.length - 4)}`}
        

        <span>Balance</span>
        <span aria-label="gold" role="img">
          💰
        </span>
        <span>
          {ethBalance === undefined
            ? '...'
            : ethBalance === null
            ? 'Error'
            : `Ξ${parseFloat(formatEther(ethBalance)).toPrecision(4)}`}
        </span>
      
      <hr style="{{">
      <div style="{{">
        {Object.keys(connectorsByName).map(name =&gt; {
          const currentConnector = connectorsByName[name]
          const activating = currentConnector === activatingConnector
          const connected = currentConnector === connector</div>

@ethersproject/units

Unit conversion functions for Ethereum.

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis