How to use the redux/actions.user function in redux

To help you get started, we’ve selected a few redux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github swaponline / swap.react / shared / pages / Wallet / Wallet.js View on Github external
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,
github swaponline / swap.react / shared / pages / Wallet / Wallet.js View on Github external
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)
    )
github swaponline / swap.react / shared / pages / History / History.js View on Github external
componentDidMount() {
    // actions.analytics.dataEvent('open-page-history')
    actions.user.setTransactions()
    actions.core.getSwapHistory()
  }
github swaponline / swap.react / shared / redux / actions / user.js View on Github external
// 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()
}
github swaponline / swap.react / shared / components / History / History.jsx View on Github external
componentWillMount() {
    const { ethAddress, btcAddress } = this.props
    console.log('ethAddress', ethAddress)
    console.log('btcAddress', btcAddress)
    actions.user.setTransactions(ethAddress, btcAddress)
  }
github swaponline / swap.react / shared / components / modals / OfferModal / AddOffer / AddOffer.js View on Github external
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())
    })
  }
github swaponline / swap.react / shared / components / Balances / Balance.jsx View on Github external
componentWillMount() {
    const { ethAddress, btcAddress } = this.props
    actions.user.getBalances(ethAddress, btcAddress)
  }
github swaponline / swap.react / shared / pages / Swap / Swap.js View on Github external
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' }))
            }
          })
      })
github swaponline / swap.react / shared / redux / actions / btcmultisig.js View on Github external
const getRate = async () => {
  const exCurrencyRate = await actions.user.getExchangeRate('BTC', 'usd')
  reducers.user.setCurrencyRate({ name: 'btcData', currencyRate: exCurrencyRate })
}