mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 00:28:51 +00:00
fail on null amount on zaprequest creation.
This commit is contained in:
7
nip57.ts
7
nip57.ts
@@ -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]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user