SDK Getting Started
This guide takes you from installation to a signed + submitted protocol transaction.
Prerequisites
- Node.js
>=20 - ESM project setup (
"type": "module") - Solana RPC URL
- OmegaX protocol
programIdfor your target environment
Install
npm install @omegax/protocol-sdk
Create clients
import {
createConnection,
createProtocolClient,
createRpcClient,
PROTOCOL_PROGRAM_ID,
} from '@omegax/protocol-sdk';
const connection = createConnection(process.env.SOLANA_RPC_URL!, 'confirmed');
const programId = process.env.OMEGAX_PROGRAM_ID ?? PROTOCOL_PROGRAM_ID;
const protocol = createProtocolClient(connection, programId);
const rpc = createRpcClient(connection);
Build an unsigned transaction
const recentBlockhash = await rpc.getRecentBlockhash();
const tx = protocol.buildEnrollMemberOpenTx!({
member: '<member-pubkey>',
poolAddress: '<pool-pubkey>',
subjectCommitmentHex: '<32-byte-hex>',
recentBlockhash,
programId,
});
Sign and broadcast
const signedTx = await wallet.signTransaction(tx);
const signedTxBase64 = Buffer.from(signedTx.serialize()).toString('base64');
const result = await rpc.broadcastSignedTx({ signedTxBase64, commitment: 'confirmed' });
Optional simulation flow
const simulation = await rpc.simulateSignedTx({
signedTxBase64,
commitment: 'confirmed',
sigVerify: true,
});
if (!simulation.ok) {
console.error(simulation.failure, simulation.logs);
}
Verify resulting state
const membership = await protocol.fetchMembershipRecord!({
poolAddress: '<pool-pubkey>',
member: '<member-pubkey>',
});
Next steps
- Workflows for role-based integration order
- API Reference for full method coverage
- Troubleshooting for common error patterns