How to use the edge-core-js/types.errorNames.SwapPermissionError 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
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({
        type: 'GENERIC_SHAPE_SHIFT_ERROR',
        data: sprintf(s.strings.ss_unable, fromCurrencyCode, toCurrencyCode)
      })
    }

    case errorNames.SwapPermissionError: {
      switch (error.reason) {
        case 'geoRestriction': {
          return dispatch({
            type: 'GENERIC_SHAPE_SHIFT_ERROR',
            data: s.strings.ss_geolock
          })
        }

        case 'needsActivation': {
          if (error.pluginName === 'shapeshift') {
            Alert.alert(s.strings.kyc_title, s.strings.kyc_message, [
              { text: s.strings.string_cancel_cap, onPress: () => {} },
              { text: s.strings.string_ok, onPress: () => Actions[Constants.SWAP_ACTIVATE_SHAPESHIFT]() }
            ])
            return
          }