Class: ccUtil

ccUtil


new ccUtil()

Source:
api/ccUtil.js

Methods


<static> getHashKey(key)

Build hashKey,in sdk it is named hashX
Parameters:
Name Type Description
key string result of ccUtil#generatePrivateKey
Source:
api/ccUtil.js
Returns:
- in sdk ,it is named hashX
Type
string

<static> createEthAddr(keyPassword)

Create Eth address
Parameters:
Name Type Description
keyPassword string key password
Source:
api/ccUtil.js
Returns:
- eth address
Type
string

<static> createWanAddr(keyPassword)

Create Wan address
Parameters:
Name Type Description
keyPassword string key password
Source:
api/ccUtil.js
Returns:
- eth address
Type
string

<static> isEthAddress(address)

isEthAddress
Parameters:
Name Type Description
address string Eth address
Source:
api/ccUtil.js
Returns:
true: Eth address false: Non Eth address
Type
boolean

<static> isWanAddress(address)

isWanAddress
Parameters:
Name Type Description
address string Eth address
Source:
api/ccUtil.js
Returns:
true: Wan address false: Non Wan address
Type
boolean

<static> getCrossdbCollection()

getCrossdbCollection
Source:
api/ccUtil.js
Returns:
- Collects got for crosschain transactions.
Type
Object

<static> getTxHistory(option)

Parameters:
Name Type Description
option
Deprecated:
  • Yes
Source:
api/ccUtil.js
Returns:
Type
Array

<static> updateStatus(key, Status)

Parameters:
Name Type Description
key
Status
Deprecated:
  • Yes
Source:
api/ccUtil.js

<static> getEthAccounts()

get all Eth accounts on local host
Source:
api/ccUtil.js
Returns:
Type
Array.<string>

<static> getWanAccounts()

get all Wan accounts on local host
Source:
api/ccUtil.js
Returns:
Type
Array.<string>

<async, static> getEthAccountsInfo()

get all Eth accounts on local host
Source:
api/ccUtil.js
Returns:
Type
Promise.<Array>

<async, static> getWanAccountsInfo()

get all Wan accounts on local host
Source:
api/ccUtil.js
Returns:
Type
Promise.<Array>

<static> toGweiString(cwei)

Parameters:
Name Type Description
cwei
Deprecated:
  • Yes
Source:
api/ccUtil.js
Returns:
Type
string

<static> getWei(amount, exp)

Parameters:
Name Type Description
amount
exp
Deprecated:
  • Yes
Source:
api/ccUtil.js
Returns:
Type
string

<static> getGWeiToWei(amount, exp)

Get GWei to Wei , used for gas price.
Parameters:
Name Type Description
amount
exp
Source:
api/ccUtil.js
Returns:
Type
number

<static> weiToToken(tokenWei, decimals)

weiToToken
Parameters:
Name Type Description
tokenWei number
decimals number Must change 18 to the decimals for the actual decimal of token.
Source:
api/ccUtil.js
Returns:
Type
string

<static> tokenToWei(token, decimals)

tokenToWei
Parameters:
Name Type Description
token number
decimals number
Source:
api/ccUtil.js
Returns:
Type
string

<static> generatePrivateKey()

generate private key, in sdk , it is named x
Source:
api/ccUtil.js
Returns:
Type
string