ndk icon indicating copy to clipboard operation
ndk copied to clipboard

nostr-tools EventTemplate -> NDKEvent?

Open vcavallo opened this issue 8 months ago • 0 comments

For reasons, I would like to do something like the following:

          let zapRequest = await nip57.makeZapRequest({
            comment: "Some comment",
            profile: pubkey,
            event: eventID,
            amount: 100,
            relays: Array.from(ndk.pool.urls())
          })

          const zapRequestEvent = new NDKEvent(ndk, zapRequest);

          const signer = ndk.signer;
          if (!signer) {
            throw new Error("NDK signer is not initialized");
          }

          const signed = await signer.sign(zapRequestEvent)

There might be very many things wrong with this approach, but at least one is that it throws this error:

Error signing zap request: DataCloneError: Failed to execute 'postMessage' on 'Window': async (relay, challenge2) => {
      if (this.relayAuthDefaultPolicy) {
        await this.relayAuthDefaultPoli...<omitted>... } could not be cloned.
    at inpageScript.bundle.js:1:12719
    at new Promise (<anonymous>)
    at inpageScript.bundle.js:1:12645

vcavallo avatar Apr 24 '25 19:04 vcavallo