How to use the bn.js.isBN function in bn

To help you get started, we’ve selected a few bn 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 warren-bank / ethereumjs-tx-sign / tests / 05_EIP_155 / js / compare_output.js View on Github external
const clean_input = function(str) {
  if ((typeof str === 'number') || (str.isBigNumber === true) || BN.isBN(str)) str = `${ str.toString(16) }`
  if ((!str) || (typeof str !== 'string') || (str === '0x')) str = '00'
  if (str.indexOf('0x') === 0) str = str.substr(2)
  if (str.length % 2 === 1) str = `0${str}`
  return `0x${str}`
}
github warren-bank / ethereumjs-tx-sign / tests / 02_deploy_and_validate / js / deploy_and_validate.js View on Github external
const clean_input = function(str) {
  if ((typeof str === 'number') || (str.isBigNumber === true) || BN.isBN(str)) str = `${ str.toString(16) }`
  if ((!str) || (typeof str !== 'string') || (str === '0x')) str = '00'
  if (str.indexOf('0x') === 0) str = str.substr(2)
  if (str.length % 2 === 1) str = `0${str}`
  return `0x${str}`
}
github gnosis / dex-contracts / test / resources / math.js View on Github external
function feeSubtracted(x, n = 1) {
  assert(BN.isBN(x), "x is not a bignum")
  assert(Number.isInteger(n) && n > 0, "n is not a valid integer")

  const result = x.mul(FEE_DENOMINATOR_MINUS_ONE).div(FEE_DENOMINATOR)
  return n === 1 ? result : feeSubtracted(result, n - 1)
}
github gnosis / dex-contracts / test / resources / auction_examples.js View on Github external
function feeAdded(x) {
  assert(BN.isBN(x))
  return x.mul(feeDenominator).div(feeDenominatorMinusOne)
}

bn

JS Bigint import

BSD-3-Clause
Latest version published 5 years ago

Package Health Score

50 / 100
Full package analysis

Popular bn functions