GithubHelp home page GithubHelp logo

eip55's Introduction

eip55

build status Version

An EIP55 compatible address encoding library.

Example

let eip55 = require('eip55')

eip55.encode('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359')
// => 0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359

eip55.verify('0xAcA128edBD274F2aBa534d67DD55Ebf67767B9A5')
// => true

eip55.verify('0xaca128edbd274f2aba534d67dd55ebf67767b9a5')
// => false

// The second argument of verify allows for single case addresses
// In this case it will only verify the leading 0x and length
// therefore the above example returns true instead of false

// lower case
eip55.verify('0xaca128edbd274f2aba534d67dd55ebf67767b9a5', true)
// => true

// upper case
eip55.verify('0xACA128EDBD274F2ABA534D67DD55EBF67767B9A5', true)
// => true

// EIP-1191 chainId support has been added
// pass the optional chainId to get the casing for that network

// Encode for RSK Mainnet (chainId 30) (notice the difference from above)
eip55.encode('0xfb6916095ca1df60bb79ce92ce3ea74c37c5d359', 30)
// => 0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359

eip55.verify('0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359')
// => false (we need to pass the chainId)

// Note: the second argument is allowOneCase (default: false)
eip55.verify('0xFb6916095cA1Df60bb79ce92cE3EA74c37c5d359', false, 30)
// => true

License MIT

eip55's People

Contributors

basixkor avatar dcousens avatar junderw avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.