Skip to content

Commit

Permalink
Add warning about missing msats support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekzyis committed Oct 31, 2024
1 parent f88c13b commit 6b2a906
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 13 additions & 3 deletions components/log-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import { timeSince } from '@/lib/time'
import styles from './log-message.module.css'

export default function LogMessage ({ showWallet, wallet, level, message, ts }) {
level = level.toLowerCase()
const levelClassName = ['ok', 'success'].includes(level) ? 'text-success' : level === 'error' ? 'text-danger' : level === 'info' ? 'text-info' : ''
let className
switch (level.toLowerCase()) {
case 'ok':
case 'success':
className = 'text-success'; break
case 'error':
className = 'text-danger'; break
case 'warn':
className = 'text-warning'; break
default:
className = 'text-info'
}
return (
<tr className={styles.line}>
<td className={styles.timestamp}>{timeSince(new Date(ts))}</td>
{showWallet ? <td className={styles.wallet}>[{wallet}]</td> : <td className='mx-1' />}
<td className={`${styles.level} ${levelClassName}`}>{level === 'success' ? 'ok' : level}</td>
<td className={`${styles.level} ${className}`}>{level === 'success' ? 'ok' : level}</td>
<td>{message}</td>
</tr>
)
Expand Down
2 changes: 2 additions & 0 deletions wallets/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export async function createInvoice (userId, { msats, description, descriptionHa
if (BigInt(msats) - BigInt(bolt11.mtokens) >= 1000n) {
throw new Error('invoice invalid: amount too small')
}

await logger.warn('wallet does not support msats')
}

return { invoice, wallet }
Expand Down

0 comments on commit 6b2a906

Please sign in to comment.