conflux-address-js
The simple encoder and decoder for Conflux address.
Check CIP-37 for the protocols.
Usage
Encoding
const confluxAddr = require('conflux-address-js')
const hexBuffer = Buffer.from('106d49f8505410eb4e671d51f7d96d2c87807b09', 'hex')
const netId = 1029
console.log(confluxAddr.encode(hexBuffer, netId))
console.log(confluxAddr.encode(hexBuffer, netId, true))
Decoding
const confluxAddr = require('conflux-address-js')
console.log(confluxAddr.decode('cfx:0086ujfsa1a11uuecwen3xytdmp8f03v140ypk3mxc'))
console.log(confluxAddr.decode('cfx:type.user:0086ujfsa1a11uuecwen3xytdmp8f03v140ypk3mxc'))