Skip to content

Welshman Docs / @welshman/app / Command

Class: Command

Defined in: app/src/command.ts:15

An event paired with the relays it's meant for, without committing to how it gets published. Plugin mutation methods (create/update/etc.) build the event and return a Command instead of publishing it directly, so the caller decides: publish() sends it through the normal Thunks pipeline, publishToRelays(urls) targets a specific set of relays, and publishAsRelay(url) has the relay sign the event with its own key (NIP-86 signevent) before publishing it back to that relay.

Constructors

Constructor

new Command(app, event, relays): Command

Defined in: app/src/command.ts:16

Parameters

app

IApp

event

EventTemplate

relays

string[]

Returns

Command

Properties

app

readonly app: IApp

Defined in: app/src/command.ts:17


event

readonly event: EventTemplate

Defined in: app/src/command.ts:18


relays

readonly relays: string[]

Defined in: app/src/command.ts:19

Methods

publish()

publish(): Thunk

Defined in: app/src/command.ts:22

Returns

Thunk


publishAsRelay()

publishAsRelay(url): Promise<Thunk>

Defined in: app/src/command.ts:29

Parameters

url

string

Returns

Promise<Thunk>


publishToRelays()

publishToRelays(urls): Thunk

Defined in: app/src/command.ts:24

Parameters

urls

string[]

Returns

Thunk


signAsRelay()

signAsRelay(url): Promise<ManagementResponse>

Defined in: app/src/command.ts:39

Parameters

url

string

Returns

Promise<ManagementResponse>