TypeScript
ExergyNet SDK
The lnes-agent-sdk-core package. Official TypeScript interface to the LNES-01 Solana Mainnet-Beta program.
Package
lnes-agent-sdk-core
Version
0.1.1+
Registry
npm
Language
TypeScript
Install
Installation
npm install lnes-agent-sdk-core
Import
Importing the client
import { LnesM2MClient, LNES_PROGRAM_ID } from "lnes-agent-sdk-core";
VERIFY PROGRAM ID AT IMPORT TIME
console.log(LNES_PROGRAM_ID.toBase58());
// Expected: Fe8KhdiFWhKcPWH2N2Svqc3VSpK9EzN8nMh9pQ3cPCeD
Methods
API reference
Full example
Complete integration
import { LnesM2MClient, LNES_PROGRAM_ID } from "lnes-agent-sdk-core";
import { Connection, Keypair } from "@solana/web3.js";
const connection = new Connection("https://api.mainnet-beta.solana.com");
const agentWallet = Keypair.fromSecretKey(/* ... */);
const client = new LnesM2MClient(connection, agentWallet);
// 1. Verify program ID
console.assert(
LNES_PROGRAM_ID.toBase58() === "Fe8KhdiFWhKcPWH2N2Svqc3VSpK9EzN8nMh9pQ3cPCeD",
"Program ID mismatch — abort"
);
// 2. Estimate gate
const gateResult = await client.estimateExergyGate({ jobParams });
if (!gateResult.clears) {
console.log("Job does not clear economic gate. Skip.");
process.exit(0);
}
// 3. Open job
const { jobId, escrowPda } = await client.openJob({ jobParams });
// 4. (Execute compute work)
const { axiomHash, output } = await runComputeWork();
// 5. Settle
const settleTx = await client.settleExergy({
jobId,
axiomHash,
tollUsdcMicroUnits: gateResult.toll,
escrowPda,
usdcMint,
agentUsdcAccount,
escrowUsdcAccount,
vaultAccounts,
});
console.log("Settled:", settleTx.signature);