Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.
/ tools-js Public archive

Mailchain Tools - useful tools and functions for working with the Mailchain API

License

Notifications You must be signed in to change notification settings

mailchain/tools-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailchain Tools JS

This package is Mailchain Tools - useful tools and functions for working with the Mailchain API

Installing

npm install @mailchain/tools-js

Usage

In your app, import the module:

const mctools = require('@mailchain/tools-js')

Methods

parseAddressFromMailchain

Parses an address in Mailchain form and returns the public address @param address an address e.g. <0x0000000000000000000000000000000000000000@network.chainname>

Code Example:

const mctools = require('@mailchain/tools-js')

let parsedAddress = mctools.parseAddressFromMailchain('<0x0000000000000000000000000000000000000000@network.chainname>')
console.log(parsedAddress) // returns '0x0000000000000000000000000000000000000000'

validateEnsName

tests the value matches the ENS Name Regex @param value is the ens name value to test, e.g. alice.eth, alice.xyz Code Example:

const mctools = require('@mailchain/tools-js')

let validateEnsName = mctools.validateEnsName('alice.eth')
console.log(validateEnsName) // returns true

validateEthAddress

Tests the value matches the Eth Address Regex @param value the address value to test, e.g. 0x000... expects '0x' + 40 hex chars

Code Example:

const mctools = require('@mailchain/tools-js')

let validateEthAddress = mctools.validateEthAddress('0x0000000000000000000000000000000000000000')
console.log(validateEthAddress) // returns true

About

Mailchain Tools - useful tools and functions for working with the Mailchain API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published