fail on null amount on zaprequest creation.

This commit is contained in:
fiatjaf 2023-02-16 13:55:40 -03:00
parent f9748d9cc3
commit 2324f9548e
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1
1 changed files with 5 additions and 2 deletions

View File

@ -50,17 +50,20 @@ export function makeZapRequest({
}: {
profile: string
event: string | null
amount: string
amount: number
comment: string
relays: string[]
}): EventTemplate {
if (!amount) throw new Error('amount not given')
if (!profile) throw new Error('profile not given')
let zr = {
kind: 9734,
created_at: Math.round(Date.now() / 1000),
content: comment,
tags: [
['p', profile],
['amount', amount],
['amount', amount.toString()],
['relays', ...relays]
]
}