Function dvmSchedule

  • Schedule a post for publishing at a later time using * a NIP-90 DVM.

    Parameters

    • events: NDKEvent | NDKEvent[]
    • dvm: NDKUser

      {NDKUser} The DVM to use for scheduling.

    • Optionalrelays: string[]

      {string[]} The relays the schedule event should be published to by the DVM. Defaults to all relays in the pool.

    • encrypted: boolean = true

      {boolean} Whether to encrypt the event. Defaults to true.

    • OptionalwaitForConfirmationForMs: number

      {number} How long to wait for the DVM to confirm the schedule event. If none is provided, the event will be scheduled but not confirmed.

    Returns Promise<string | void | NDKEvent>

    const event = new NDKEvent(ndk, { kind: 1, content: "hello world" });
    event.created_at = Date.now()/1000 + 60 // schedule for 60 seconds from now
    await event.sign();

    const dvm = ndk.getUser({ pubkey: "<a-kind-5905-dvm-pubkey>" });

    const result = await dvmSchedule(event, dvm);
    console.log(result.status); // "success"