Files
boris/node_modules/applesauce-actions
Gigi 1b8c276529 chore: upgrade applesauce packages to v4.0.0
- Update all applesauce packages from 3.1.0 to 4.0.0
- Add applesauce-factory dependency
- Version 4.0.0 includes app-data helpers needed for NIP-78
2025-10-05 02:35:28 +01:00
..

Applesauce Actions

A collection of pre-built actions nostr clients can use. Built on top of applesauce-core and applesauce-factory.

Documentation

Installation

npm install applesauce-actions

Overview

Actions are common pre-built async operations that apps can perform. They use:

  • EventStore for access to known nostr events
  • EventFactory to build and sign new nostr events
  • A publish method to publish or save the resulting events

The package provides an ActionHub class that combines these components into a single manager for easier action execution.

Basic Usage

import { ActionHub } from "applesauce-actions";
import { FollowUser } from "applesauce-actions/actions";

async function publishEvent(event: NostrEvent) {
  await relayPool.publish(event, ["wss://relay.example.com"]);
}

// Create an action hub with your event store, factory and publish method
const hub = new ActionHub(eventStore, eventFactory, publishEvent);

// Example: Follow a user
await hub
  .exec(FollowUser, "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d")
  .forEach((event) => publishEvent(event));

For more detailed documentation and examples, visit the full documentation.