How to use the edge-core-js/types.errorNames.SwapBelowLimitError function in edge-core-js

To help you get started, we’ve selected a few edge-core-js 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 EdgeApp / edge-react-gui / src / actions / CryptoExchangeActions.js View on Github external
case errorNames.SwapAboveLimitError: {
      const settings = SETTINGS_SELECTORS.getSettings(state)
      const currentCurrencyDenomination = SETTINGS_SELECTORS.getDisplayDenominationFromSettings(settings, fromCurrencyCode)

      const nativeMax: string = error.nativeMax
      const displayDenomination = SETTINGS_SELECTORS.getDisplayDenomination(state, fromCurrencyCode)
      const nativeToDisplayRatio = displayDenomination.multiplier
      const displayMax = UTILS.convertNativeToDisplay(nativeToDisplayRatio)(nativeMax)

      return dispatch({
        type: 'GENERIC_SHAPE_SHIFT_ERROR',
        data: sprintf(s.strings.amount_above_limit, displayMax, currentCurrencyDenomination.name)
      })
    }

    case errorNames.SwapBelowLimitError: {
      const settings = SETTINGS_SELECTORS.getSettings(state)
      const currentCurrencyDenomination = SETTINGS_SELECTORS.getDisplayDenominationFromSettings(settings, fromCurrencyCode)

      const nativeMin: string = error.nativeMin
      const displayDenomination = SETTINGS_SELECTORS.getDisplayDenomination(state, fromCurrencyCode)
      const nativeToDisplayRatio = displayDenomination.multiplier
      const displayMin = UTILS.convertNativeToDisplay(nativeToDisplayRatio)(nativeMin)

      return dispatch({
        type: 'GENERIC_SHAPE_SHIFT_ERROR',
        data: sprintf(s.strings.amount_below_limit, displayMin, currentCurrencyDenomination.name)
      })
    }

    case errorNames.SwapCurrencyError: {
      return dispatch({