SDK Reference
Complete TypeScript API for @solarium-labs/sdk.
SolariumClient
The main class for interacting with the Solarium protocol. Accepts an AnchorProvider in its constructor.
typescript
import { SolariumClient } from '@solarium-labs/sdk';
import { AnchorProvider } from '@project-serum/anchor';
const client = new SolariumClient(provider, {
commitment: "confirmed",
rpcUrl: "https://api.mainnet-beta.solana.com"
});Methods
createTask(config: TaskConfig): Promise<string>
Submits a new inference task to the Solarium smart contract. Funds are transferred to the escrow PDA automatically.
registerNode(role: NodeRole, stakeAmount: number): Promise<string>
Registers the provider's wallet as a Worker or Validator node. Requires a minimum stake in SOL based on the role.
claimTask(taskId: string): Promise<string>
(Workers Only) Claims an open task in the queue, locking it from other workers for the duration of the timeout window.
Helper Functions
Standalone functions exported from the SDK for PDA derivation and cryptographic operations.
typescript
import { deriveTaskPDA, computeCommitmentHash } from '@solarium-labs/sdk';
// Derive the PDA for a Task
const [taskPda, bump] = deriveTaskPDA(taskId, programId);
const hash = computeCommitmentHash(verdict, confidence, secretSalt);