@avaprotocol/sdk-js#

Namespaces#

NamespaceDescription
v4-

Classes#

ClassDescription
Clientv4 SDK entry point. Resource-grouped sub-clients (Stripe / OpenAI convention). Construct one Client per aggregator endpoint; all requests share the same transport (and therefore the same Bearer token + timeout + fetch impl).
APIErrorThrown when the server returns a 4xx/5xx response. The aggregator speaks RFC 7807 problem+json (application/problem+json); this class surfaces every field plus the underlying HTTP status so SDK callers can pattern-match without re-parsing the body.
NetworkErrorThrown when the SDK can't reach the server (DNS failure, fetch threw).
AuthRequiredErrorThrown when the auth credential is missing or expired before a call.
AuthResourceclient.auth.* — JWT exchange for the REST API.
ExecutionsResourceclient.executions.* — read-only access to past workflow runs and a live SSE stream for in-flight ones. Workflow executions are created by the operator when a trigger fires (or by workflows.trigger for manual runs); this resource never creates them, only reads.
HealthResourceclient.health.* — gateway liveness + version probes.
NodesResourceclient.nodes.* — execute a single node definition in isolation, without persisting a workflow. Used by the Studio UI's per-node "Run once" affordance and by SDK test suites that exercise a node shape against a live gateway.
OperatorsResourceclient.operators.* — read-only view of the operator pool the gateway is currently dispatching to. Used by dashboards and the Studio sidebar's network-health widget; not part of the workflow lifecycle.
SecretsResourceclient.secrets.* — write-only secret store, scoped to the authenticated user. Values are referenced from workflow nodes via {{secrets.NAME}} template variables and are decrypted server-side at execution time; the SDK never receives the plaintext value back.
TokensResourceclient.tokens.* — ERC-20 metadata resolution backed by the aggregator's curated whitelist plus an on-chain name/symbol/decimals fallback. Used by the Studio token-picker, transfer-preview UI, and the notification cost-line renderer.
TriggersResourceclient.triggers.* — evaluate a trigger config in isolation, mirroring the per-node nodes.run shape. Use when designing or debugging a trigger before wiring it into a full workflow — e.g. confirming that an eventTrigger topic filter matches a known historical event, or that a cron expression parses.
WalletsResourceclient.wallets.* — smart-wallet CRUD plus the UserOp-driven withdraw action. A "wallet" here is an ERC-6900 / ERC-4337 smart account derived deterministically from (owner, factory, salt) — the SDK never creates an EOA, it ensures-and-registers smart accounts owned by the authenticated user's EOA.
WorkflowsResourceclient.workflows.* — the primary surface for creating and controlling automations. A "workflow" is one trigger + a DAG of nodes that fires when the trigger condition matches. This resource covers the full lifecycle: create, list, retrieve, pause / resume, cancel, manual trigger, dry-run simulation, and fee estimation.

Interfaces#

InterfaceDescription
BuildAuthMessageInput-
BuiltAuthMessage-
ClientOptions-

Type Aliases#

Type AliasDescription
ChainId-

Variables#

VariableDescription
AUTH_TEMPLATECanonical EIP-191 message template the aggregator's auth handler verifies. Must match the format documented in the API spec.
NodesTyped builders for the Node discriminated union. Same convention as Triggers: each builder returns a plain JSON object shaped like v4.Node (no class instances).
TriggersTyped builders for the Trigger discriminated union. Output is a plain JSON object shaped like v4.Trigger (no class instances) so it round-trips cleanly across the REST boundary.
Chains-

Functions#

FunctionDescription
buildAuthMessageBuild the canonical auth message a wallet must sign. Pure — does no signing — so it can run in the browser before opening the wallet popup.
signAuthMessageOne-shot helper: build the message, sign it with the supplied private key, and return the payload ready for client.auth.exchange(). Only useful in tests / Node tooling where the private key is in hand; browser flows use buildAuthMessage + a wallet's personal_sign.