diff options
| author | Adam Soltys <[email protected]> | 2024-11-21 10:47:25 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-21 10:47:25 -0800 |
| commit | 3b15d16339c9209f307f8453af91fba15f3d340c (patch) | |
| tree | d9f4ca8879c6a0b29ca8f6ad795c2154387626fd /lib/ecash.ts | |
| parent | 5642b90b54084061cdbbf6f1dc70c38245b05d5f (diff) | |
| download | coinos-server-3b15d16339c9209f307f8453af91fba15f3d340c.tar.gz coinos-server-3b15d16339c9209f307f8453af91fba15f3d340c.zip | |
wip
Diffstat (limited to 'lib/ecash.ts')
| -rw-r--r-- | lib/ecash.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/ecash.ts b/lib/ecash.ts index 9ea4ec38..05326718 100644 --- a/lib/ecash.ts +++ b/lib/ecash.ts @@ -91,3 +91,23 @@ export async function init(amount = 10000) { } } +export async function payNostr(token) { + const decodedToken = getDecodedToken(token); + if (!decodedToken) { + console.error("could not decode token"); + return; + } + const proofs = token.getProofs(decodedToken); + const mint = token.getMint(decodedToken); + const paymentPayload: PaymentRequestPayload = { + id: request.id, + mint: mint, + unit: request.unit || "", + proofs: proofs, + }; + const paymentPayloadString = JSON.stringify(paymentPayload); + await nostrStore.sendNip17DirectMessageToNprofile( + transport.target, + paymentPayloadString, + ); +} |
