Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into mmackz/sound/amount-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
mmackz committed Jul 10, 2024
2 parents e3dea9a + bb9c058 commit 325c6dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-horses-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rabbitholegg/questdk-plugin-utils": minor
---

update for token zero fix
16 changes: 11 additions & 5 deletions packages/utils/src/helpers/mint-amount.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { FilterOperator } from '../types'

export function formatAmount(amount: FilterOperator | undefined) {
if (amount === undefined) {
return undefined
export function formatAmount(
amount: FilterOperator | undefined,
): FilterOperator {
if (!amount || (typeof amount === 'string' && isNaN(Number(amount)))) {
return { $gte: 1n }
}
if (amount && ['string', 'number', 'bigint'].includes(typeof amount)) {
return { $gte: amount }
if (
typeof amount === 'string' ||
typeof amount === 'number' ||
typeof amount === 'bigint'
) {
return { $gte: BigInt(amount) }
}

return amount
Expand Down

0 comments on commit 325c6dc

Please sign in to comment.