@leather.io/utils
Advanced tools
| > @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 @@ | ||
| [34mESM[39m Build start | ||
| [32mESM[39m [1mdist/index.js [22m[32m73.16 KB[39m | ||
| [32mESM[39m [1mdist/index.js.map [22m[32m138.63 KB[39m | ||
| [32mESM[39m ⚡️ Build success in 47ms | ||
| [32mESM[39m [1mdist/index.js [22m[32m73.26 KB[39m | ||
| [32mESM[39m [1mdist/index.js.map [22m[32m138.80 KB[39m | ||
| [32mESM[39m ⚡️ Build success in 31ms | ||
| [34mDTS[39m Build start | ||
| [32mDTS[39m ⚡️ Build success in 2307ms | ||
| [32mDTS[39m [1mdist/index.d.ts [22m[32m14.73 KB[39m | ||
| [32mDTS[39m ⚡️ Build success in 2135ms | ||
| [32mDTS[39m [1mdist/index.d.ts [22m[32m14.75 KB[39m |
+7
-0
@@ -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 @@ |
+1
-1
@@ -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; |
+1
-1
@@ -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
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
418986
0.16%9184
0.1%