@swarm-tips/client 0.4.3 → 0.4.4

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
@@ -27,7 +27,7 @@ const inbox = await agent.inbox.list({ status: "pending" });
27
27
 
28
28
  All signers keep private key material strictly in closure scope (redacted from `JSON.stringify`, `String()`, and `util.inspect`) and work in both browser and Node runtimes without Node built-ins:
29
29
 
30
- - `fromSolanaKeypair(keypair)` / `fromSolanaSecretKey(secret)` (`Uint8Array`, base58, or JSON byte array) / `fromSolanaWalletAdapter(adapter)`
30
+ - `fromSolanaKeypair(keypairOrSecretBytes)` (`Keypair` or 64-byte `Uint8Array`) / `fromSolanaSecretKey(secret)` (`Uint8Array`, base58, or JSON byte array) / `fromSolanaWalletAdapter(adapter)`
31
31
  - `fromEvmPrivateKey(hex, { chainId, rpcUrl })` / `fromEvmWalletClient(walletClient)`
32
32
 
33
33
  ### Local Safety Guarantees (C1, C6, C9, C10)
@@ -44,9 +44,10 @@ The package installs `swarm` (plus `npx -y @swarm-tips/client`, `swarm-tx`, and
44
44
  # Inspect wallet identity (keypair file must be chmod 600 on POSIX; raw --private-key flags are rejected)
45
45
  swarm auth whoami --keypair-file ~/.config/solana/id.json
46
46
 
47
- # Discover listings, tasks, and inbox messages (JSON auto-enabled when piped)
47
+ # Discover listings, tasks, task details, and inbox messages (JSON auto-enabled when piped)
48
48
  swarm listings --limit 10
49
49
  swarm tasks list --limit 20
50
+ swarm tasks get <task_id> --json
50
51
  swarm inbox list --status pending
51
52
 
52
53
  # Verify an unsigned Shillbot base64 transaction locally before signing (exit 0 = safe, exit 1 = rejected)
package/SBOM.spdx.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "spdxVersion": "SPDX-2.3",
3
3
  "dataLicense": "CC0-1.0",
4
4
  "SPDXID": "SPDXRef-DOCUMENT",
5
- "name": "@swarm-tips/client-0.4.3",
6
- "documentNamespace": "https://swarm.tips/sbom/client/0.4.3",
5
+ "name": "@swarm-tips/client-0.4.4",
6
+ "documentNamespace": "https://swarm.tips/sbom/client/0.4.4",
7
7
  "creationInfo": {
8
- "created": "2026-11-13T03:56:51.595Z",
8
+ "created": "2026-11-14T20:49:11.555Z",
9
9
  "creators": [
10
10
  "Tool: sdk/client/scripts/generate-sbom.mjs",
11
11
  "Organization: Swarm Tips"
@@ -15,8 +15,8 @@
15
15
  {
16
16
  "name": "@swarm-tips/client",
17
17
  "SPDXID": "SPDXRef-Package",
18
- "versionInfo": "0.4.3",
19
- "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.4.3",
18
+ "versionInfo": "0.4.4",
19
+ "downloadLocation": "https://www.npmjs.com/package/@swarm-tips/client/v/0.4.4",
20
20
  "filesAnalyzed": false,
21
21
  "licenseConcluded": "MIT",
22
22
  "licenseDeclared": "MIT"
package/dist/agent.d.ts CHANGED
@@ -95,7 +95,7 @@ export declare class SwarmAgent {
95
95
  };
96
96
  readonly tasks: {
97
97
  listAvailable: <TTask = unknown>(limit?: number) => Promise<TaskListResponse<TTask>>;
98
- get: <TTask = unknown>(id: string) => Promise<TTask>;
98
+ get: <TTask = unknown>(id: string, network?: SwarmNetwork) => Promise<TTask>;
99
99
  mine: <TTask = unknown>() => Promise<TTask[]>;
100
100
  earnings: <TResponse = unknown>() => Promise<TResponse>;
101
101
  onboard: <TResponse = unknown>() => Promise<TResponse>;
package/dist/agent.js CHANGED
@@ -197,7 +197,7 @@ export class SwarmAgent {
197
197
  };
198
198
  this.tasks = {
199
199
  listAvailable: (limit = 50) => self.shillbotClient.listTasks(limit),
200
- get: (id) => self.shillbotClient.getTask(id),
200
+ get: (id, net) => self.shillbotClient.getTask(id, net),
201
201
  async mine() {
202
202
  const res = await self.shillbotClient.listAgentTasks();
203
203
  return Array.isArray(res) ? res : (res.tasks ?? []);
package/dist/cli/swarm.js CHANGED
@@ -101,7 +101,7 @@ Commands:
101
101
  auth whoami | token
102
102
  listings [--limit N] [--category CAT] [--chain CHAIN]
103
103
  reputation <wallet>
104
- tasks list [--limit N] | mine | earnings | next <task-json-or-id>
104
+ tasks list [--limit N] | get <id> | mine | earnings | next <task-json-or-id>
105
105
  tasks claim <id> [--payout-to <pubkey>] [--no-exec]
106
106
  tasks submit <id> --content <str> [--payout-to <pubkey>] [--no-exec]
107
107
  tasks verify <id> [--no-exec]
@@ -317,6 +317,15 @@ export async function runSwarmCli(argv, io = {}) {
317
317
  writeOutput(stdout, jsonMode, res);
318
318
  return 0;
319
319
  }
320
+ if (sub === "get") {
321
+ const id = rest[0]?.trim();
322
+ if (!id) {
323
+ throw new CliUsageError("Usage: swarm tasks get <task_id>");
324
+ }
325
+ const res = await agent.tasks.get(id);
326
+ writeOutput(stdout, jsonMode, res);
327
+ return 0;
328
+ }
320
329
  if (sub === "mine") {
321
330
  const tasks = await agent.tasks.mine();
322
331
  writeOutput(stdout, jsonMode, { tasks });
@@ -382,7 +391,7 @@ export async function runSwarmCli(argv, io = {}) {
382
391
  writeOutput(stdout, jsonMode, res);
383
392
  return 0;
384
393
  }
385
- throw new CliUsageError("Usage: swarm tasks <list|mine|earnings|next|claim|submit|verify|finalize> ...");
394
+ throw new CliUsageError("Usage: swarm tasks <list|get|mine|earnings|next|claim|submit|verify|finalize> ...");
386
395
  }
387
396
  if (cmd === "inbox") {
388
397
  if (sub === "list") {
@@ -1,4 +1,4 @@
1
- export declare const OPENAPI_VERSION: "0.4.2";
1
+ export declare const OPENAPI_VERSION: "0.4.4";
2
2
  export declare const OPENAPI_SERVERS: readonly ["https://mcp.swarm.tips", "https://api.shillbot.org", "https://api.coordination.game"];
3
3
  export type OpenApiServerUrl = (typeof OPENAPI_SERVERS)[number];
4
4
  export interface OpenApiSchemas {
@@ -1,6 +1,6 @@
1
1
  // AUTO-GENERATED by scripts/sync-generated.mjs from services/mcp-server/openapi.merged.json.
2
2
  // Do not edit by hand — run `pnpm --filter @swarm-tips/client sync:generated`.
3
- export const OPENAPI_VERSION = "0.4.2";
3
+ export const OPENAPI_VERSION = "0.4.4";
4
4
  export const OPENAPI_SERVERS = [
5
5
  "https://mcp.swarm.tips",
6
6
  "https://api.shillbot.org",
package/dist/http.js CHANGED
@@ -29,7 +29,7 @@ export class HttpClient {
29
29
  }
30
30
  async request(path, init = {}) {
31
31
  const operation = `${init.method ?? "GET"} ${path}`;
32
- const token = init.token ?? (await this.getToken?.());
32
+ const token = init.token !== undefined ? init.token : await this.getToken?.();
33
33
  const { token: _token, _retried, ...fetchInit } = init;
34
34
  const headers = {
35
35
  ...fetchInit.headers,
@@ -43,7 +43,7 @@ export declare class ShillbotApiClient {
43
43
  post<T>(path: string, body?: unknown): Promise<T>;
44
44
  patch<T>(path: string, body?: unknown): Promise<T>;
45
45
  listTasks<TTask = unknown>(limit?: number): Promise<TaskListResponse<TTask>>;
46
- getTask<TTask = unknown>(id: string): Promise<TTask>;
46
+ getTask<TTask = unknown>(id: string, network?: "mainnet" | "devnet"): Promise<TTask>;
47
47
  listAgentTasks<TTask = unknown>(): Promise<TTask[] | TaskListResponse<TTask>>;
48
48
  listPendingApproval<TTask = unknown>(): Promise<TTask[] | TaskListResponse<TTask>>;
49
49
  listCampaigns<TCampaign = unknown>(): Promise<TCampaign[] | CampaignListResponse<TCampaign>>;
@@ -38,10 +38,19 @@ export class ShillbotApiClient {
38
38
  return this.http.patch(path, body);
39
39
  }
40
40
  listTasks(limit = 50) {
41
- return this.get(`/tasks?limit=${encodeURIComponent(String(limit))}`);
41
+ return this.http.get(`/tasks?limit=${encodeURIComponent(String(limit))}`, null);
42
42
  }
43
- getTask(id) {
44
- return this.get(`/tasks/${encodeURIComponent(id)}`);
43
+ async getTask(id, network) {
44
+ const trimmed = id.trim();
45
+ if (!trimmed) {
46
+ throw new SwarmClientError({
47
+ code: "INVALID_ARGUMENT",
48
+ operation: "shillbot.getTask",
49
+ message: "Task id is required",
50
+ });
51
+ }
52
+ const suffix = network ? `?network=${encodeURIComponent(network)}` : "";
53
+ return this.http.get(`/tasks/${encodeURIComponent(trimmed)}${suffix}`, null);
45
54
  }
46
55
  listAgentTasks() {
47
56
  return this.get("/agent/tasks");
@@ -8,10 +8,11 @@ export interface SolanaWalletAdapterLike {
8
8
  signTransaction?: <T extends Transaction | VersionedTransaction>(tx: T) => Promise<T>;
9
9
  }
10
10
  /**
11
- * Create a browser-clean `SolanaSwarmSigner` from a `@solana/web3.js` `Keypair`.
11
+ * Create a browser-clean `SolanaSwarmSigner` from a `@solana/web3.js` `Keypair`
12
+ * or a raw 64-byte `Uint8Array` secret key (e.g. `Uint8Array.from(JSON.parse(...))`).
12
13
  * Secret key bytes stay trapped inside a private closure and are redacted from logs/JSON.
13
14
  */
14
- export declare function fromSolanaKeypair(keypair: Keypair): SolanaSwarmSigner;
15
+ export declare function fromSolanaKeypair(keypair: Keypair | Uint8Array): SolanaSwarmSigner;
15
16
  /**
16
17
  * Create a `SolanaSwarmSigner` from a 64-byte `Uint8Array`, base58-encoded secret key,
17
18
  * or JSON `[u8, ...]` array string (matching `solana-keygen` format).
@@ -31,19 +31,46 @@ async function signEd25519Detached(secretKey64, message) {
31
31
  return new Uint8Array(ix.data.subarray(sigOffset, sigOffset + 64));
32
32
  }
33
33
  /**
34
- * Create a browser-clean `SolanaSwarmSigner` from a `@solana/web3.js` `Keypair`.
34
+ * Create a browser-clean `SolanaSwarmSigner` from a `@solana/web3.js` `Keypair`
35
+ * or a raw 64-byte `Uint8Array` secret key (e.g. `Uint8Array.from(JSON.parse(...))`).
35
36
  * Secret key bytes stay trapped inside a private closure and are redacted from logs/JSON.
36
37
  */
37
38
  export function fromSolanaKeypair(keypair) {
38
- if (!keypair?.secretKey || keypair.secretKey.length !== 64) {
39
- throw new SwarmClientError({
40
- code: "INVALID_ARGUMENT",
41
- operation: "signer.fromSolanaKeypair",
42
- message: "Expected a valid 64-byte Solana Keypair",
43
- });
39
+ let resolved;
40
+ if (keypair instanceof Uint8Array) {
41
+ if (keypair.length !== 64) {
42
+ throw new SwarmClientError({
43
+ code: "INVALID_ARGUMENT",
44
+ operation: "signer.fromSolanaKeypair",
45
+ message: `Expected 64-byte Solana secret key, received ${keypair.length} bytes`,
46
+ });
47
+ }
48
+ try {
49
+ resolved = Keypair.fromSecretKey(new Uint8Array(keypair));
50
+ }
51
+ catch {
52
+ throw new SwarmClientError({
53
+ code: "INVALID_ARGUMENT",
54
+ operation: "signer.fromSolanaKeypair",
55
+ message: "Invalid Solana Ed25519 secret key bytes",
56
+ });
57
+ }
58
+ }
59
+ else {
60
+ if (!keypair?.secretKey ||
61
+ keypair.secretKey.length !== 64 ||
62
+ !keypair.publicKey ||
63
+ typeof keypair.publicKey.toBase58 !== "function") {
64
+ throw new SwarmClientError({
65
+ code: "INVALID_ARGUMENT",
66
+ operation: "signer.fromSolanaKeypair",
67
+ message: "Expected a valid 64-byte Solana Keypair or Uint8Array",
68
+ });
69
+ }
70
+ resolved = keypair;
44
71
  }
45
- const secretBytes = new Uint8Array(keypair.secretKey);
46
- const address = keypair.publicKey.toBase58();
72
+ const secretBytes = new Uint8Array(resolved.secretKey);
73
+ const address = resolved.publicKey.toBase58();
47
74
  return redactSigner({
48
75
  chain: "solana",
49
76
  address,
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CLIENT_VERSION = "0.4.3";
1
+ export declare const CLIENT_VERSION = "0.4.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLIENT_VERSION = "0.4.3";
1
+ export const CLIENT_VERSION = "0.4.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swarm-tips/client",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "Typed browser and Node.js clients for Swarm Tips, Shillbot, and Coordination Game",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",