Fix negative maxWithdrawable (#438)

Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
ekzyis 2023-08-23 22:32:42 +02:00 committed by GitHub
parent 0ea4f9bc27
commit 07e065d4be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -32,8 +32,8 @@ export default async ({ query }, res) => {
callback: process.env.LNWITH_URL, // The URL which LN SERVICE would accept a withdrawal Lightning invoice as query parameter
k1: query.k1, // Random or non-random string to identify the user's LN WALLET when using the callback URL
defaultDescription: `Withdrawal for @${user.name} on SN`, // A default withdrawal invoice description
minWithdrawable: 1000, // Min amount (in millisatoshis) the user can withdraw from LN SERVICE, or 0
maxWithdrawable: Number(user.msats - 10000n) // Max amount (in millisatoshis) the user can withdraw from LN SERVICE, or equal to minWithdrawable if the user has no choice over the amounts
minWithdrawable: user.msats >= 1000n ? 1000 : 0, // Min amount (in millisatoshis) the user can withdraw from LN SERVICE
maxWithdrawable: Math.max(Number(user.msats - 10000n), 0) // Max amount (in millisatoshis) the user can withdraw from LN SERVICE
})
} else {
reason = 'user not found'