Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import {Platform} from 'react-native'
import borderColors from '../theme/variables/css3Colors'
import {div, mul, gte, eq, toFixed} from 'biggystring'
import getSymbolFromCurrency from 'currency-symbol-map'
import type {AbcDenomination, AbcCurrencyInfo, AbcCurrencyPlugin, AbcTransaction, AbcMetaToken} from 'airbitz-core-types'
import type {GuiDenomination, ExchangeData, GuiWallet} from '../types'
const DIVIDE_PRECISION = 18
const currencySymbolMap = require('currency-symbol-map').currencySymbolMap
export const cutOffText = (str: string, lng: number) => {
if (str.length >= lng) {
return str.slice(0, lng) + '...'
} else {
return str
}
}
export const findDenominationSymbol = (denoms: Array, value: string) => {
// console.log('in findDenominationSymbol, denoms is: ', denoms, ' , and value is : ', value)
for (const v of denoms) {
if (v.name === value) {
return v.symbol
}
}
'use strict'
const _ = require('lodash')
const WebFinger = require('webfinger.js')
const currencySymbolMap = require('currency-symbol-map').currencySymbolMap
const superagent = require('superagent-promise')(require('superagent'), Promise)
const Config = require('./config')
const Ledger = require('./ledger')
const NotFoundError = require('../errors/not-found-error')
// TODO implement caching
module.exports = class Utils {
static constitute () { return [ Config, Ledger ] }
constructor (config, ledger) {
this.ledger = ledger
this.ledgerUriPublic = config.data.getIn(['ledger', 'public_uri'])
this.ledgerPrefix = config.data.getIn(['ledger', 'prefix'])
this.localUri = config.data.getIn(['server', 'base_uri'])
this.localHost = config.data.getIn(['server', 'base_host'])
'use strict'
module.exports = MiscControllerFactory
const Config = require('../lib/config')
const Ledger = require('../lib/ledger')
const Utils = require('../lib/utils')
const currencySymbolMap = require('currency-symbol-map').currencySymbolMap
const Connector = require('../lib/connector')
const InvalidBodyError = require('../errors/invalid-body-error')
function MiscControllerFactory (deps) {
const config = deps(Config)
const ledger = deps(Ledger)
const utils = deps(Utils)
const connector = deps(Connector)
return class MiscController {
static init (router) {
router.get('/parse/destination', this.destination)
router.get('/config', this.config)
}
/**