bn.rs
bn.js and ethers.js BigNumber bindings for Rust & WebAssembly with primitive-types support
Write Rust code that uses bn.js and ethers.js BigNumber numbers
use ;
use *;
use ;
Call it from JavaScript
import from './pkg'
import BN from 'bn.js'
import from "@ethersproject/bignumber"
// Initialize bn.js and ethers.js BigNumber numbers
const a =
const b =
const hash =
const dead =
// Call Rust code with both BN and BigNumber passed and returned
console.log // == BigNumber.from(4)
console.log // == true
Run example
$ cd example
$ yarn
$ yarn start