NETSoon

Docs SDK

SDK errors

Every SDK failure is one AcruxError with a stable code, whether the gateway refused the call or the SDK refused the input.

Every failure the SDK raises is an AcruxError, the contract's ApiClientError. A refusal from the gateway and a refusal of the input by the SDK itself have the same shape.

errors.ts
import { AcruxError } from '@acrux/sdk'

try {
  await acrux.send(tx, { n: 3, t: 2, signer: payer })
} catch (error) {
  if (error instanceof AcruxError && error.code === 'TRANSACTION_EXPIRED') {
    // the target slot started before the gateway admitted the send: sign over a fresh blockhash and send again
  }
}
MemberTypeMeaning
codeErrorCodethe stable code to branch on
statusintegerthe HTTP status the code carries
messagestringa sentence that can be shown as it is
body.errorApiErrorthe whole envelope: code, message, retryable, stage, and fieldErrors for invalid params

Raised by the SDK

CodeWhen
INVALID_INPUTn or t outside 1 to 3, or t greater than n
INVALID_INPUTt of 2 or 3 without a signer
INVALID_INPUTsigner is not the transaction's fee payer
INVALID_INPUTthe bytes are not a signed Solana transaction
INVALID_INPUTopen was given fewer than t distinct fragments, or fragments that do not decrypt
NET_UNAVAILABLEthe event stream closed while tx.follow was reading it

Raised by the gateway on a send

CodeCauseWhat to do
INVALID_INPUTa field failed validation, or the target slot is more than 64 slots aheadfix the input
TRANSACTION_EXPIREDthe target slot had started when the gateway admitted the sendsign over a fresh blockhash and send again
CHAIN_REFUSEDthe node refused the transaction or fragmentfix the transaction; message says why
IDEMPOTENCY_CONFLICTthe ID was sent before with a different header, n or t, or this fragment index with a different fragmentsend a new transaction
NET_UNAVAILABLEthe gateway cannot reach the netretry; retryable is true

The JSON-RPC error codes behind these are on JSON-RPC; every code is in ErrorCode.

Retrying

body.error.retryable says whether the same call can succeed later. A send refused with TRANSACTION_EXPIRED is not retried as it is: its target slot has passed, so send the transaction again, signed over the blockhash from latestBlockhash().