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

View File

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