Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@leather.io/utils

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leather.io/utils - npm Package Compare versions

Comparing version
0.48.0
to
0.48.1
+6
-6
.turbo/turbo-build.log
> @leather.io/utils@0.48.0 build /home/runner/work/mono/mono/packages/utils
> @leather.io/utils@0.48.1 build /home/runner/work/mono/mono/packages/utils
> tsup

@@ -11,7 +11,7 @@

ESM Build start
ESM dist/index.js 73.16 KB
ESM dist/index.js.map 138.63 KB
ESM ⚡️ Build success in 47ms
ESM dist/index.js 73.26 KB
ESM dist/index.js.map 138.80 KB
ESM ⚡️ Build success in 31ms
DTS Build start
DTS ⚡️ Build success in 2307ms
DTS dist/index.d.ts 14.73 KB
DTS ⚡️ Build success in 2135ms
DTS dist/index.d.ts 14.75 KB

@@ -371,2 +371,9 @@ # Changelog

## [0.48.1](https://github.com/leather-io/mono/compare/@leather.io/utils-v0.48.0...@leather.io/utils-v0.48.1) (2025-11-10)
### Bug Fixes
* **utils:** fix quote to base calculation helper ([381f287](https://github.com/leather-io/mono/commit/381f287635419a9501ecd2da12558dde6a270aa9))
## [0.48.0](https://github.com/leather-io/mono/compare/@leather.io/utils-v0.47.0...@leather.io/utils-v0.48.0) (2025-10-31)

@@ -373,0 +380,0 @@

@@ -24,3 +24,3 @@ import BigNumber, { BigNumber as BigNumber$1 } from 'bignumber.js';

declare function baseCurrencyAmountInQuote(quantity: Money, { pair, price }: MarketData): Money;
declare function quoteCurrencyAmountToBase(quantity: Money, { pair, price }: MarketData): Money;
declare function quoteCurrencyAmountToBase(quantity: Money, { pair, price }: MarketData, decimals: number): Money;
declare function convertAmountToFractionalUnit(num: Money | BigNumber$1, decimals?: number): BigNumber$1;

@@ -27,0 +27,0 @@ declare function convertToMoneyTypeWithDefaultOfZero(symbol: string, num?: NumType, decimals?: number): Money;

@@ -5,3 +5,3 @@ {

"description": "Shared bitcoin utilities",
"version": "0.48.0",
"version": "0.48.1",
"license": "MIT",

@@ -8,0 +8,0 @@ "homepage": "https://github.com/leather-io/mono/tree/dev/packages/utils",

@@ -7,3 +7,3 @@ import { BigNumber } from 'bignumber.js';

import { initBigNumber } from '../math/helpers';
import { createMoney, createMoneyFromDecimal } from './create-money';
import { createMoney } from './create-money';
import { isMoney } from './is-money';

@@ -32,3 +32,7 @@

export function quoteCurrencyAmountToBase(quantity: Money, { pair, price }: MarketData) {
export function quoteCurrencyAmountToBase(
quantity: Money,
{ pair, price }: MarketData,
decimals: number
) {
if (quantity.symbol !== pair.quote)

@@ -41,3 +45,8 @@ throw new Error(

return createMoneyFromDecimal(quantity.amount.dividedBy(price.amount), pair.base);
const baseAmount = quantity.amount
.dividedBy(price.amount)
.shiftedBy(decimals)
.integerValue(BigNumber.ROUND_FLOOR);
return createMoney(baseAmount, pair.base, decimals);
}

@@ -44,0 +53,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display