NETSoon

Docs SDK

Install the SDK

Add @acrux/sdk and @acrux/contract to a TypeScript project and connect to an Acrux Net gateway.

@acrux/sdk sends a transaction into a leaderless Acrux slot, in the clear or split t-of-n, and follows it to finality. It runs in the browser and on Node 22. It builds on @acrux/contract, which holds every type and the raw gateway client.

Add the packages

The SDK ships as two tarballs, the SDK and the contract it builds on. Put both in your project's vendor/ folder and install them together:

Terminal
npm install ./vendor/acrux-contract-0.1.8.tgz ./vendor/acrux-sdk-0.1.0.tgz
PackageVersionHolds
@acrux/sdk0.1.0connect, send, tx.follow, slots.subscribe, seal, open, AcruxError
@acrux/contract0.1.8every schema and type, createGatewayClient, createClient for the HTTP API

Building and signing Solana transactions uses @solana/web3.js; the SDK accepts its Transaction, its VersionedTransaction, or the serialized bytes of either.

Terminal
npm install @solana/web3.js

Connect

acrux.ts
import { connect } from '@acrux/sdk'

export const acrux = connect('http://127.0.0.1:4930')

connect takes the gateway's JSON-RPC URL. The event stream is read on the port one above it, ws://127.0.0.1:4931 here. To name another stream URL:

ts
const acrux = connect('http://127.0.0.1:4930', { wsUrl: 'ws://127.0.0.1:4931' })

What the client holds

MemberDoes
acrux.latestBlockhash()the blockhash a transaction for this net is signed over, with its slot
acrux.send(tx, options)submits a signed transaction for a slot four slots ahead; Send a transaction
acrux.tx.follow(id)the transaction's trail as an async iterator; Subscribing
acrux.slots.subscribe(callback)each slot as it starts and as it executes; Subscribing
acrux.gatewaythe contract's gateway client: call for any JSON-RPC method, subscribe for the raw event stream

The package also exports seal, open, deriveHeader and headerBytes, the threshold encoder the node decodes (Wire formats), and AcruxError (Errors).