Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentWillMount() {
actions.user.getBalances()
// actions.analytics.dataEvent('open-page-balances')
this.checkImportKeyHash()
if (process.env.MAINNET) {
localStorage.setItem(constants.localStorage.testnetSkip, false)
} else {
localStorage.setItem(constants.localStorage.testnetSkip, true)
}
const testSkip = JSON.parse(localStorage.getItem(constants.localStorage.testnetSkip))
const saveKeys = JSON.parse(localStorage.getItem(constants.localStorage.privateKeysSaved))
this.setState(() => ({
testSkip,
saveKeys,
componentWillMount() {
actions.user.getBalances()
// actions.analytics.dataEvent('open-page-balances')
this.checkImportKeyHash()
if (process.env.MAINNET) {
localStorage.setItem(constants.localStorage.testnetSkip, false)
} else {
localStorage.setItem(constants.localStorage.testnetSkip, true)
}
const testSkip = JSON.parse(
localStorage.getItem(constants.localStorage.testnetSkip)
)
const saveKeys = JSON.parse(
localStorage.getItem(constants.localStorage.privateKeysSaved)
)
componentDidMount() {
// actions.analytics.dataEvent('open-page-history')
actions.user.setTransactions()
actions.core.getSwapHistory()
}
// actions.usdt.login(btcPrivateKey)
actions.ltc.login(ltcPrivateKey)
// actions.qtum.login(qtumPrivateKey)
// actions.xlm.login(xlmPrivateKey)
// if inside actions.token.login to call web3.eth.accounts.privateKeyToAccount passing public key instead of private key
// there will not be an error, but the address returned will be wrong
if (!isEthKeychainActivated) {
Object.keys(config.erc20)
.forEach(name => {
actions.token.login(_ethPrivateKey, config.erc20[name].address, name, config.erc20[name].decimals, config.erc20[name].fullName)
})
}
// await actions.nimiq.login(_ethPrivateKey)
const getReputation = actions.user.getReputation()
await getReputation()
}
componentWillMount() {
const { ethAddress, btcAddress } = this.props
console.log('ethAddress', ethAddress)
console.log('btcAddress', btcAddress)
actions.user.setTransactions(ethAddress, btcAddress)
}
handleClear = () => {
actions.user.getDemoMoney()
}
updateExchangeRate = async (sellCurrency, buyCurrency) => {
const exchangeRateSell = await actions.user.getExchangeRate(sellCurrency, 'usd')
const exchangeRateBuy = await actions.user.getExchangeRate(buyCurrency, 'usd')
const exchangeRate = sellCurrency === 'swap' || buyCurrency === 'swap'
? await actions.user.getExchangeRate(sellCurrency, buyCurrency)
: BigNumber(exchangeRateSell).div(exchangeRateBuy).dp(4, BigNumber.ROUND_CEIL)
return new Promise((resolve, reject) => {
this.setState({ exchangeRate }, () => resolve())
})
}
componentWillMount() {
const { ethAddress, btcAddress } = this.props
actions.user.getBalances(ethAddress, btcAddress)
}
currencies.forEach(item => {
actions.user.getExchangeRate(item.currency, 'usd')
.then(exRate => {
const amount = exRate * Number(item.amount)
if (Number(amount) >= 50) {
this.setState(() => ({ isAmountMore: 'enable' }))
} else {
this.setState(() => ({ isAmountMore: 'disable' }))
}
})
})
const getRate = async () => {
const exCurrencyRate = await actions.user.getExchangeRate('BTC', 'usd')
reducers.user.setCurrencyRate({ name: 'btcData', currencyRate: exCurrencyRate })
}