Skip to content

Commit dd453d8

Browse files
build(deps): bump bignumber.js from 9.1.2 to 9.3.0 (#2988)
1 parent 91e6410 commit dd453d8

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

package-lock.json

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/xrpl/src/Wallet/utils.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,25 @@ import { Transaction } from '../models'
1313
*
1414
* @param left - A Signer to compare with.
1515
* @param right - A second Signer to compare with.
16-
* @returns 1 if left \> right, 0 if left = right, -1 if left \< right, and null if left or right are NaN.
16+
* @returns 1 if left \> right, 0 if left = right, -1 if left \< right.
17+
* @throws Error if either Account is null, undefined, or invalid.
1718
*/
1819
export function compareSigners<T extends { Account: string }>(
1920
left: T,
2021
right: T,
2122
): number {
22-
return addressToBigNumber(left.Account).comparedTo(
23+
if (!left.Account || !right.Account) {
24+
throw new Error('compareSigners: Account cannot be null or undefined')
25+
}
26+
const result = addressToBigNumber(left.Account).comparedTo(
2327
addressToBigNumber(right.Account),
2428
)
29+
if (result === null) {
30+
throw new Error(
31+
'compareSigners: Invalid account address comparison resulted in NaN',
32+
)
33+
}
34+
return result
2535
}
2636

2737
export const NUM_BITS_IN_HEX = 16

packages/xrpl/src/sugar/getOrderbook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function sortOffers(offers: BookOffer[]): BookOffer[] {
1717
const qualityA = offerA.quality ?? 0
1818
const qualityB = offerB.quality ?? 0
1919

20-
return new BigNumber(qualityA).comparedTo(qualityB)
20+
return new BigNumber(qualityA).comparedTo(qualityB) ?? 0
2121
})
2222
}
2323

0 commit comments

Comments
 (0)