Skip to content

Build post operation

Use this recipe when you want to construct a post operation locally before deciding how it will be signed or broadcast.

Operation builders are useful for previews, tests, external signing and confirmation flows.

Safety

Safety level: static.

This recipe does not require a private key, does not call RPC and does not broadcast. It only builds an operation payload.

Example

ts
import { buildPostOperation } from '@beblurt/dblurt';

const operation = buildPostOperation({
  author: 'alice',
  title: 'Hello Blurt',
  body: 'Draft body',
  tags: ['blurt', 'sdk']
});

console.log(operation);

The returned operation can be reviewed, tested, included in a transaction later or passed to a separate signing flow.

Why build separately?

Separating construction from broadcast lets applications:

  • preview the exact operation;
  • validate fields before asking for a key;
  • show a user confirmation screen;
  • unit test generated operations;
  • delegate signing to another component.

API symbols

Validated source

Executable static source: examples/node/build-post-operation.cjs.

Run locally from the repository:

bash
node examples/node/build-post-operation.cjs

This example is included in npm run docs:check.

Before broadcasting

Before this operation is signed and broadcast, the application must confirm:

  • author account;
  • generated permlink;
  • title/body/metadata;
  • required authority;
  • user intent;
  • endpoint strategy.

Related: Read-only vs broadcast, Publish content, API reference.