ZKUtility
class ZKUtility
Module containing utility methods. Import ZKUtility
module from react-native-zumo-kit package:
import { ZKUtility } from 'react-native-zumo-kit';
Utilities provided by ZKUtility
module:
- mnemonic phrase generation utility,
- conversion utils between different Bitcoin and Ethereum units,
- utils for Bitcoin and Ethereum address validation
Only once ZumoKit module is configured, ZKUtility module methods can be used. See ZumoKit for details.
Methods
ethToWei
ethToWei(number: String): String
Convert ETH to Wei.
ethToGwei
ethToGwei(number: String): String
Convert ETH to Gwei.
generateMnemonic
generateMnemonic(wordCount: Number): String
Generate mnemonic phrase. Accepted word counts are 12, 15, 18, 21 and 24.
Generated according to BIP39 standard.
getExchangeRates
getExchangeRates(): Promise<Object>
Returns the latest exchange rates between EUR/USD and BTC/ETH in the following JSON format:
{
"ETH":{
"USD":{
"timestamp":1554470495,
"value":"166.30"
},
"EUR":{
"timestamp":1554470493,
"value":"148.51"
}
},
"BTC":{
"USD":{
"timestamp":1554470493,
"value":"5029.44"
},
"EUR":{
"timestamp":1554470493,
"value":"4491.68"
}
}
}
getFiat
getFiat(eth: Number): Promise<number>
Converts the given ETH value into Fiat.
gweiToEth
gweiToEth(number: String): String
Convert Gwei to ETH.
gweiToWei
gweiToEth(number: String): String
Convert Wei To Gwei.
isValidBtcAddress
isValidBtcAddress(address: String): Bool
Validates BTC blockchain address.
isValidEthAddress
isValidEthAddress(address: String): Bool
Validates ETH blockchain address.
weiToEth
gweiToEth(number: String): String
Convert Wei To ETH.
weiToGwei
gweiToEth(number: String): String
Convert Wei to Gwei.