JSPM

@restless/ethereum

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q72536F
  • License Unlicense

Ethereum utilities for restless

Package Exports

  • @restless/ethereum

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@restless/ethereum) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


NPM CircleCI License

Restless - Ethereum

Ethereum module for restless. Uses ethers.js. Provides utilities such as:

  1. asEthAddress
  2. asBigNumber

Installation

npm install @restless/ethereum
yarn add @restless/ethereum

Sanitizers

asEthAddress

Accepts any string that represents a valid ethereum address. Checks the checksum if present. Returns a normalized representation.

asEthAddress('0xA5fE...f213') // RIGHT 0xA5fE...f213
asEthAddress('0xa5fe...f213') // RIGHT 0xA5fE...f213
asEthAddress('bla bla bla') // LEFT 'expected: ethereum address'
asBigNumber(123) // LEFT 'expected: ethereum address'

asBigNumber

Accepts any string or number that represents an integer. Converts the integer to a BigNumber.

asBigNumber('123') // RIGHT BigNumber(123)
asBigNumber(456) // RIGHT BigNumber(456)
asBigNumber(1.5) // LEFT 'expected: big number'
asBigNumber(true) // LEFT 'expected: big number'