Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@rarible/action

rariblecom924MIT0.10.1TypeScript support: included

Action is almost like async function, but actions can be divided into steps. It gives more control over action execution.

rarible, common, action, protocol

readme

Action abstraction for @rarible/sdk

Action is almost like async function, but actions can be divided into steps. It gives more control over action execution.

This way frontend applications can allow users to see what step is currently executing. Also, it's possible to even control when next step should be started.

How-to create an Action

Action can be created using ActionBuilder:

import { ActionBuilder } from "@rarible/action"

const action = ActionBuilder
  .create({ id: "first-step" as const, run: (input: string) => firstStep(input) })
  .thenStep({ id: "second-step" as const, run: input => secondStep(input) })

This creates and action, which can be executed:

const result = await action("pass the input data here")

Here, result will be the result of secondStep async function.

You can run steps individually:

//First, start action, get Execution
const exec = action.start("pass the input data here")

//then run steps
await exec.run(0)
await exec.run(1)

//then get the result
const result = await exec.result

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.5.1 (2021-11-16)

Bug Fixes

Features

0.5.0 (2021-11-05)

Bug Fixes

Features

  • ActionBuilder (e900dd7)
  • ActionBuilder + Action (87e2d0d)
  • ActionBuilder.thenAction support (4063220)
  • ActionBuilder.thenAction support (2b540d5)
  • add new linting rules (edaf3a2)
  • added test-provider (c8e096c)
  • estimate tx eth middleware (eaf1f7f)
  • move Action, Execution to different files (fe5eb13)
  • update eslint dependencies, update typescript (fe4a657)