Action Codes SDK

The official JavaScript/TypeScript SDK for integrating Action Codes into any app — frontend, backend, or edge.

📦 Installation

npm install @actioncodes/sdk

⚡️ Quick Start

import { ActionCodesClient } from '@actioncodes/sdk';

const client = new ActionCodesClient();

const observeStatus = await client.submitAction('12345678',
  action: {
    label: 'Test Action',
    logo: 'https://ota.codes/logo.png',
    memo: 'gm!',
    message: 'Transfer SOL',
    transactionBase64: '...', // your transaction in base64 format
  },
);

for await (const status of observeStatus) {
  console.log('Status updated:', status);
}

📚 SDK Reference

Below are the core methods and types exposed by the ActionCodesClient class.

Constructor

const client = new ActionCodesClient(baseUrl?: string);

Initializes a new ActionCodes client. The optional baseUrl can be used to override the default API endpoint.

client.getAction(code)

Resolves and decrypts the action metadata for a given code.

ParamTypeDescription
codestringThe 8-digit Action Code

client.getActionStatus(code)

Fetches the latest status of a submitted action.

client.submitAction(code, fields)

Submits an action with partial metadata. Returns an async generator to track the status in real time.

ParamTypeDescription
codestringThe Action Code
fieldsPartial<ActionPayload>Action metadata (label, message, transactionBase64, etc)

client.observeActionStatus(code)

Returns an async generator that emits status updates for the given code.

Types

  • ActionStatus: 'pending' | 'ready' | 'failed' | 'cancelled'
  • ActionFields: Full metadata about the action (label, memo, logo, etc.)
  • ActionPayload: Submit-safe subset of fields
  • SubmitResponse: { success: boolean; status: ActionStatus; expiresAt: string }
Logo

Action Codes

Fast, trusted transactions using human-readable codes.

      Resources