Action Codes SDK
The official JavaScript/TypeScript SDK for integrating Action Codes into any app — frontend, backend, or edge.
📦 Installation
npm install @useactio/sdk
⚡️ Quick Start
import { ActionCodesClient } from '@useactio/sdk';
const client = new ActionCodesClient();
const result = await client.submitAndWait('12345678',
action: {
label: 'Test Action',
logo: 'https://ota.codes/logo.png',
memo: 'gm!',
message: 'Transfer SOL',
transactionBase64: '...', // your transaction in base64 format
},
);
if (result.status === 'completed') {
console.log('Transaction submitted:', result.transactionBase64);
} else if (result.status === 'cancelled') {
console.log('Action cancelled');
}
📚 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.
Param | Type | Description |
---|---|---|
code | string | The 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.
Param | Type | Description |
---|---|---|
code | string | The Action Code |
fields | Partial<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 fieldsSubmitResponse
: { success: boolean; status: ActionStatus; expiresAt: string }