Browse Source

Merge pull request #97 from meriadec/master

Use @ledgerhq/currencies package for formatting currencies
master
Loëck Vézien 7 years ago
committed by GitHub
parent
commit
baf530e9de
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      package.json
  2. 10
      src/helpers/format.js
  3. 6
      yarn.lock

1
package.json

@ -46,6 +46,7 @@
"@fortawesome/fontawesome-free-solid": "^5.0.6",
"@fortawesome/react-fontawesome": "^0.0.17",
"@ledgerhq/common": "2.3.0",
"@ledgerhq/currencies": "^2.3.0",
"@ledgerhq/hw-app-btc": "^2.2.0",
"@ledgerhq/hw-app-eth": "^2.2.0",
"@ledgerhq/hw-transport": "^2.2.0",

10
src/helpers/format.js

@ -1,8 +1,11 @@
// @flow
import { formatCurrencyUnit } from '@ledgerhq/common/lib/data/currency'
import { formatCurrencyUnit } from '@ledgerhq/currencies'
export function formatBTC(v: string | number, options: Object = { alwaysShowSign: true }) {
export function formatBTC(
v: string | number,
options: Object = { alwaysShowSign: true, showCode: true },
) {
return formatCurrencyUnit(
{
name: 'bitcoin',
@ -11,7 +14,6 @@ export function formatBTC(v: string | number, options: Object = { alwaysShowSign
magnitude: 8,
},
Number(v),
options.alwaysShowSign,
true,
options,
)
}

6
yarn.lock

@ -146,6 +146,12 @@
redux "^3.7.2"
redux-thunk "^2.2.0"
"@ledgerhq/currencies@^2.3.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/currencies/-/currencies-2.3.0.tgz#4f76a7a47890d23a754b34da4d615fa479e2edec"
dependencies:
querystring "^0.2.0"
"@ledgerhq/hw-app-btc@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/hw-app-btc/-/hw-app-btc-2.2.0.tgz#c5c99c8974ab8df378f773c5b03052304ce3812b"

Loading…
Cancel
Save