import type { EventSigner } from "../signer"; import type { NostrEvent, TaggedNostrEvent } from "../nostr"; import type { SystemInterface } from "../system"; import EventEmitter from "eventemitter3"; export declare enum DVMJobState { /** * Job is new and never sent to any relays */ New = "new", /** * Job was sent to relays */ Init = "init", /** * DVM server requested payment */ PaymentRequired = "payment-required", /** * DVM server is processing the request */ Processing = "processing", /** * DVM server was unable to process the request */ Error = "error", /** * DVM job was successful */ Success = "success", /** * The job was partially completed */ Partial = "partial" } /** * Events emitted by the DVM job */ export interface DVMJobEvents { /** * Job state changed */ state(newState: DVMJobState): void; /** * DVM server requested payment */ paymentRequested(): void; /** * DVM server returned an error */ error(message?: string): void; /** * Job was successful */ result(ev: TaggedNostrEvent): void; } /** * Job input params */ export interface DVMJobInput { /** * The argument for the input */ data: string; /** * The way this argument should be interpreted */ inputType: "url" | "event" | "job" | "text"; /** * If event or job input-type, the relay where the event/job was published, otherwise optional or empty string */ relay?: string; /** * An optional field indicating how this input should be used within the context of the job */ marker?: string; } /** * Generic DVM job request class */ export declare class DVMJobRequest extends EventEmitter { #private; private log; /** * Job request kind number */ readonly kind: number; /** * The response kind used to reply to this job */ readonly responseKind: number; /** * Input data for the job (zero or more inputs) */ private input?; /** * Param tags K/V */ private params?; /** * Expected output format. Different job request kind defines this more precisely */ private output?; /** * Customer MAY specify a maximum amount (in millisats) they are willing to pay */ private bid?; /** * List of relays where Service Providers SHOULD publish responses to */ private relays?; /** * Service Providers the customer is interested in. Other SPs MIGHT still choose to process the job */ private serviceProvider?; /** * If encryption is enabled */ private encrypted; constructor(kind: number, response?: number); /** * Get the instance ID */ get id(): `${string}-${string}-${string}-${string}-${string}`; get state(): DVMJobState; private set state(value); /** * Add an input for the job request */ addInput(input: DVMJobInput): this; /** * Set a param for the request * @param k The param name * @param v The param value */ setParam(k: string, v: string): this; /** * Remove a param from the job request */ removeParam(k: string): this; /** * Set to use encryption for the inputs / params */ setEncrypted(encrypted: boolean): this; /** * Set the service provider pubkey */ setServiceProvider(p: string): this; /** * Set the desired output MIME */ setOutput(mime: string): this; /** * Set the bid amount in milli-sats */ setBid(amount: number): this; /** * Add a relay where the job feedback / results should be sent */ addRelay(relay: string): this; /** * Remove a relay */ removeRelay(relay: string): this; /** * Build the final job request Nostr event */ buildEvent(signer: EventSigner): Promise; /** * Start job request flow * @param signer Signer to sign job request events * @param system System to send / receive events * @param relays List of specific relays to send requests on */ request(signer: EventSigner, system: SystemInterface, relays?: Array): Promise; abort(system: SystemInterface): void; } //# sourceMappingURL=nip90.d.ts.map