Skip to content

Latest commit

 

History

History
211 lines (156 loc) · 6.52 KB

address.md

File metadata and controls

211 lines (156 loc) · 6.52 KB

Functions

encodeCfxAddress(address, numberId, [verbose])string

encode hex40 address to base32 address

decodeCfxAddress(address)object

decode base32 address to hex40 address

isValidCfxAddress(address)boolean

check if the address is valid

verifyCfxAddress(address)boolean

verify base32 address if pass return true if not throw error

hasNetworkPrefix(address)boolean

check if the address has network prefix

simplifyCfxAddress(address)string

simplify base32 address to non verbose address

shortenCfxAddress(address)string
isZeroAddress(address)boolean
isInternalContractAddress(address)boolean
isValidHexAddress(address)boolean
isValidCfxHexAddress(address)boolean

check if the address is valid conflux hex address

ethChecksumAddress(address)string

Makes a ethereum checksum address

Note: support EIP-55 Note: not support RSKIP60 yet

ethAddressToCfxAddress(address)string

Convert an ethereum address to conflux hex address by replace it's first letter to 1

cfxMappedEVMSpaceAddress(address)string

Calculate CFX space address's mapped EVM address

encodeCfxAddress(address, numberId, [verbose]) ⇒ string

encode hex40 address to base32 address

Kind: global function
Returns: string - base32 string address

Param Type Description
address string | Buffer hex40 address
numberId number networkId
[verbose] boolean if true, return verbose address

decodeCfxAddress(address) ⇒ object

decode base32 address to hex40 address

Kind: global function

Param Type Description
address string base32 string

isValidCfxAddress(address) ⇒ boolean

check if the address is valid

Kind: global function

Param Type Description
address string base32 string

verifyCfxAddress(address) ⇒ boolean

verify base32 address if pass return true if not throw error

Kind: global function

Param Type Description
address string base32 string

hasNetworkPrefix(address) ⇒ boolean

check if the address has network prefix

Kind: global function

Param Type Description
address string base32 string

simplifyCfxAddress(address) ⇒ string

simplify base32 address to non verbose address

Kind: global function
Returns: string - return a non verbose address

Param Type Description
address string base32 string

shortenCfxAddress(address) ⇒ string

Kind: global function
Returns: string - Return a short address

Param Type Description
address string base32 string

isZeroAddress(address) ⇒ boolean

Kind: global function

Param Type Description
address string base32 string

isInternalContractAddress(address) ⇒ boolean

Kind: global function

Param Type Description
address string base32 string

isValidHexAddress(address) ⇒ boolean

Kind: global function

Param Type Description
address string hex string

isValidCfxHexAddress(address) ⇒ boolean

check if the address is valid conflux hex address

Kind: global function

Param Type Description
address string hex string

ethChecksumAddress(address) ⇒ string

Makes a ethereum checksum address

Note: support EIP-55 Note: not support RSKIP60 yet

Kind: global function

Param Type Description
address string Hex string

Example

> ethChecksumAddress('0x1b716c51381e76900ebaa7999a488511a4e1fd0a')
 "0x1B716c51381e76900EBAA7999A488511A4E1fD0a"

ethAddressToCfxAddress(address) ⇒ string

Convert an ethereum address to conflux hex address by replace it's first letter to 1

Kind: global function

Param Type
address string

cfxMappedEVMSpaceAddress(address) ⇒ string

Calculate CFX space address's mapped EVM address

Kind: global function

Param Type Description
address string base32 string

Example

> cfxMappedEVMSpaceAddress(cfx:aak2rra2njvd77ezwjvx04kkds9fzagfe6ku8scz91)
"0x12Bf6283CcF8Ad6ffA63f7Da63EDc217228d839A"