lightnode-sdk 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,9 +5,10 @@
5
5
 
6
6
  **The community SDK for LightChain AI.** Encrypted on-chain inference, network
7
7
  analytics, multi-turn chat, an Ethereum bridge wrapper, an LCAI Governor
8
- client, an on-chain model registry reader, worker preflight + watch, and a
9
- bundled `lightnode` CLI. Non-custodial. Pure JS (works in Node 18+, browsers,
10
- StackBlitz, Cloudflare Workers, Bun). Single peer dep: `viem`.
8
+ client, an on-chain model registry reader, worker preflight + watch, a full
9
+ worker-operator surface (register, stake, settle, stuck-job recovery, exit),
10
+ and a bundled `lightnode` CLI. Non-custodial. Pure JS (works in Node 18+,
11
+ browsers, StackBlitz, Cloudflare Workers, Bun). Single peer dep: `viem`.
11
12
 
12
13
  ```bash
13
14
  npm install lightnode-sdk viem
@@ -255,6 +256,29 @@ await op.withdraw(); // pull earned balance into the worker wallet
255
256
  await op.unstickAndDeregister([974, 976, 978, 979]);
256
257
  ```
257
258
 
259
+ Full method reference (`jobIds` are the worker's IDs from
260
+ `LightNode.getWorkerJobs` or the subgraph):
261
+
262
+ | Method | Wallet | What it does |
263
+ |---|---|---|
264
+ | `status()` | no | registration, stake, claimable balance, below-floor flag |
265
+ | `config()` | no | live AIConfig: minStake, timeouts, slash bps, fee split |
266
+ | `getJob(id)` | no | one job as a typed `OnchainJob` struct |
267
+ | `stuckJobs(jobIds)` | no | the acked, past-deadline jobs (with seconds past deadline) |
268
+ | `canDeregister(jobIds)` | no | `{ ok, blockedBy, reason }` without sending a tx |
269
+ | `earnings({ ... })` | no | claimable now vs lifetime vs pending-release |
270
+ | `profitability({ ... })` | no | per-job worker fee net of gas, from the live fee split |
271
+ | `claimTimeout(id)` | yes | time out one stuck job (mainnet: realizes a slash) |
272
+ | `clearStuck(jobIds)` | yes | claimTimeout every past-deadline acked job; returns cleared + skipped |
273
+ | `releaseJob(id)` | yes | settle one completed job past its window |
274
+ | `releaseAll(jobIds)` | yes | settle all releasable completed jobs; skips not-ready ones |
275
+ | `withdraw()` | yes | pull the earned balance into the worker wallet |
276
+ | `topUpStake(lcai)` | yes | add stake |
277
+ | `withdrawStake(lcai)` | yes | remove stake above the floor |
278
+ | `reinstate()` | yes | reactivate a suspended worker |
279
+ | `deregister()` | yes | exit and release stake (reverts if in-flight jobs remain) |
280
+ | `unstickAndDeregister(jobIds)` | yes | clear stuck + release + withdraw + deregister, in one call |
281
+
258
282
  > **Mainnet slashing.** `claimTimeout` / `clearStuck` / `unstickAndDeregister`
259
283
  > finalize a stuck job as `TimedOut`, which **realizes the completion-timeout
260
284
  > slash** on mainnet (`config().slashBps.completionTimeout`, 5% of stake per job
@@ -408,6 +432,22 @@ PRIVATE_KEY=0x... npx lightnode wallet balance --net testnet
408
432
  PRIVATE_KEY=0x... npx lightnode worker preflight --net testnet
409
433
  ```
410
434
 
435
+ ### Worker operator (signs as the worker key)
436
+
437
+ Run a worker's on-chain lifecycle from the terminal. `status` and `can-deregister`
438
+ are read-only; the rest sign with `PRIVATE_KEY` and act on the worker that key
439
+ controls. Mainnet `clearstuck` and `deregister` realize a slash, so they require
440
+ `--yes`.
441
+
442
+ ```bash
443
+ npx lightnode worker status 0x... # registration, stake, claimable, live config
444
+ PRIVATE_KEY=0x... npx lightnode worker can-deregister # what blocks the exit, before spending gas
445
+ PRIVATE_KEY=0x... npx lightnode worker settle # release completed jobs past their window + withdraw
446
+ PRIVATE_KEY=0x... npx lightnode worker withdraw # pull the earned balance into the worker wallet
447
+ PRIVATE_KEY=0x... npx lightnode worker clearstuck --yes # claimTimeout acked, past-deadline jobs that block exit
448
+ PRIVATE_KEY=0x... npx lightnode worker deregister --yes # clear stuck + settle + withdraw + deregister
449
+ ```
450
+
411
451
  ### Scaffolders (write files into your project)
412
452
 
413
453
  ```bash
package/dist/index.d.ts CHANGED
@@ -91,7 +91,7 @@ export declare class LightNode {
91
91
  * (especially in registry-proxy environments like StackBlitz where lockfiles
92
92
  * may pin an older minor than the local install command suggests).
93
93
  */
94
- export declare const SDK_VERSION = "0.7.0";
94
+ export declare const SDK_VERSION = "0.7.1";
95
95
  export { NETWORKS, WORKER_REGISTRY, REGISTRY_TOPICS, aggregateModelStats, aggregateWorkerStats, networkAnalytics, modelStatsCsv, workerStatsCsv, workerJobsCsv, fromWei, computeModelId as modelId, estimateJobFee, JOB_REGISTRY_CONSUMER_ABI, consumerGatewayUrl, consumerGatewayHost, GatewayClient, GatewayHttpError, prepareSession, submitPrompt, decryptResponse, generateEcdhKeyPair, crypto, runInference, runInferenceWithKey, runInferenceStream, Conversation, chat, runInferenceBatch, Agent, parseAgentOutput, workerPreflight, workerWatch, Bridge, BRIDGE_ROUTE, HYPERLANE_ROUTER_ABI, ERC20_ABI, addressToBytes32, quoteBridgeFee, bridgeableBalance, bridgeAllowance, approveBridge, bridgeTransfer, DAO, DAO_ADDRESSES, ProposalState, PROPOSAL_STATE_LABEL, VoteSupport, GOVERNOR_ABI, VOTES_ABI, OnchainModelRegistry, AIVM_MODEL_REGISTRY_ABI, BENCHMARK_REGISTRY_ABI, ModelStatus, MODEL_STATUS_LABEL, StalledWorkerError, OnChainRevertError, RelayTokenTimeoutError, GatewayAuthError, isStalledWorker, WorkerOperator, WORKER_REGISTRY_ABI, JOB_REGISTRY_OPERATOR_ABI, AI_CONFIG_ABI, JOB_STATE, decodeWorkerError, WorkerOpError, isWorkerOpError, };
96
96
  export type { BearerSource, GatewayClientOptions, SelectSessionResult, PrepareSessionResult, UploadBlobResult, SessionTokenResult } from "./gateway.js";
97
97
  export type { SessionPreparation, RunInferenceArgs, RunInferenceResult, RunInferenceWithKeyArgs, RunInferenceStreamResult } from "./inference.js";
package/dist/index.js CHANGED
@@ -146,7 +146,7 @@ export class LightNode {
146
146
  * (especially in registry-proxy environments like StackBlitz where lockfiles
147
147
  * may pin an older minor than the local install command suggests).
148
148
  */
149
- export const SDK_VERSION = "0.7.0";
149
+ export const SDK_VERSION = "0.7.1";
150
150
  export { NETWORKS, WORKER_REGISTRY, REGISTRY_TOPICS, aggregateModelStats, aggregateWorkerStats, networkAnalytics, modelStatsCsv, workerStatsCsv, workerJobsCsv, fromWei, computeModelId as modelId, estimateJobFee, JOB_REGISTRY_CONSUMER_ABI, consumerGatewayUrl, consumerGatewayHost,
151
151
  // v0.3 inference-submit surface (BETA - see README "Submitting inference").
152
152
  GatewayClient, GatewayHttpError, prepareSession, submitPrompt, decryptResponse, generateEcdhKeyPair, crypto,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightnode-sdk",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Read-only TypeScript client for LightChain AI: workers, jobs, models, on-chain registration, and per-model network analytics. Independent, community-built (not an official LightChain package).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",