diff --git a/packages/adapters/bitcoin/src/utils/UnitsUtil.ts b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts index ef4b47aa5b..0aa4cd4a60 100644 --- a/packages/adapters/bitcoin/src/utils/UnitsUtil.ts +++ b/packages/adapters/bitcoin/src/utils/UnitsUtil.ts @@ -1,12 +1,12 @@ -import type { CaipNetwork } from '@reown/appkit-common' - -export const UnitsUtil = { - parseSatoshis(amount: string, network: CaipNetwork): string { - const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals - - // eslint-disable-next-line new-cap - return Intl.NumberFormat('en-US', { - maximumFractionDigits: network.nativeCurrency.decimals - }).format(value) - } -} +import type { CaipNetwork } from '@reown/appkit-common' + +export const UnitsUtil = { + parseSatoshis(amount: string, network: CaipNetwork): string { + const value = parseFloat(amount) / 10 ** network.nativeCurrency.decimals + + // eslint-disable-next-line new-cap + return Intl.NumberFormat('en-US', { + maximumFractionDigits: network.nativeCurrency.decimals + }).format(value) + } +} diff --git a/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts index e2609b4111..35164c0478 100644 --- a/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts +++ b/packages/adapters/bitcoin/tests/utils/UnitsUtils.test.ts @@ -1,21 +1,21 @@ -import { describe, expect, it } from 'vitest' -import { UnitsUtil } from '../../src/utils/UnitsUtil' -import { bitcoin } from '@reown/appkit/networks' - -describe('UnitsUtils', () => { - describe('parseSatoshis', () => { - it.each([ - ['100000000', '1'], - ['10000000', '0.1'], - ['1000000', '0.01'], - ['100000', '0.001'], - ['10000', '0.0001'], - ['1000', '0.00001'], - ['100', '0.000001'], - ['10', '0.0000001'], - ['1', '0.00000001'] - ])('should parse %s satoshis to %s btc', (satoshis, expected) => { - expect(UnitsUtil.parseSatoshis(satoshis, bitcoin)).toEqual(expected) - }) - }) -}) +import { describe, expect, it } from 'vitest' +import { UnitsUtil } from '../../src/utils/UnitsUtil' +import { bitcoin } from '@reown/appkit/networks' + +describe('UnitsUtils', () => { + describe('parseSatoshis', () => { + it.each([ + ['100000000', '1'], + ['10000000', '0.1'], + ['1000000', '0.01'], + ['100000', '0.001'], + ['10000', '0.0001'], + ['1000', '0.00001'], + ['100', '0.000001'], + ['10', '0.0000001'], + ['1', '0.00000001'] + ])('should parse %s satoshis to %s btc', (satoshis, expected) => { + expect(UnitsUtil.parseSatoshis(satoshis, bitcoin)).toEqual(expected) + }) + }) +})