Skip to content

Commit

Permalink
feat: throw error if SATS is used and default currency is not BTC
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhart1o1 committed Jan 6, 2024
1 parent 8223b86 commit df8470f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 8 additions & 2 deletions apps/dashboard/app/batch-payments/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ export function validateCSV({
record.amount = amount
}

if (!record.wallet && record.currency === AmountCurrency.SATS) {
record.wallet = WalletCurrency.Btc
if (
!record.wallet &&
record.currency === AmountCurrency.SATS &&
defaultWallet === WalletCurrency.Usd
) {
return new Error(
"Your default wallet currency is USD, which doesn't support SATS currency. Please specify BTC Wallet to use SATS currency.",
)
}

if (!record.wallet) {
Expand Down
3 changes: 1 addition & 2 deletions apps/dashboard/components/batch-payments/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ export default function BatchPayments() {
<Typography component="div" sx={{ mb: 1 }}>
<strong>Wallet (optional):</strong> The wallet that will be used to
send the payment in USD or BTC. If not provided, the default wallet
will be used. If the currency is SATS and no wallet is provided, BTC
wallet will be used.
will be used.
</Typography>
</li>
<li>
Expand Down

0 comments on commit df8470f

Please sign in to comment.