thaifi-wallet-cli 0.3.3 → 0.3.5

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.
@@ -19,7 +19,16 @@ export async function services(options = {}) {
19
19
  process.exitCode = 1;
20
20
  return;
21
21
  }
22
- const data = (await res.json());
22
+ let data;
23
+ try {
24
+ data = (await res.json());
25
+ }
26
+ catch (err) {
27
+ console.error("Registry returned a non-JSON response (" + (err instanceof Error ? err.message : err) + ").");
28
+ console.error("Set THAIFI_MPP_REGISTRY to your MPP/x402 registry URL.");
29
+ process.exitCode = 1;
30
+ return;
31
+ }
23
32
  const list = Array.isArray(data) ? data : (data.services ?? []);
24
33
  if (list.length === 0) {
25
34
  console.log("No services found.");
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /** ThaiFi Wallet CLI — agent wallet for the ThaiFi chain (chain 17). */
3
+ import { readFileSync } from "node:fs";
3
4
  import { Command } from "commander";
4
5
  import { login } from "./commands/login.js";
5
6
  import { logout } from "./commands/logout.js";
@@ -10,11 +11,13 @@ import { request } from "./commands/request.js";
10
11
  import { services } from "./commands/services.js";
11
12
  import { fund } from "./commands/fund.js";
12
13
  import { tokens } from "./commands/tokens.js";
14
+ // Resolve ../package.json at runtime (works from src/ via tsx and from dist/ when installed) — never hardcode the version here again.
15
+ const { version } = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
13
16
  const program = new Command();
14
17
  program
15
18
  .name("thaifi")
16
19
  .description("ThaiFi Wallet CLI — pair with wallet.thaifi.com and sign with on-chain access keys")
17
- .version("0.3.0");
20
+ .version(version);
18
21
  program
19
22
  .command("login")
20
23
  .description("Pair this CLI with your ThaiFi Wallet (opens the browser to approve)")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thaifi-wallet-cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "ThaiFi Wallet CLI for AI agents — pair with wallet.thaifi.com, sign with on-chain access keys (spending limits enforced on-chain), x402/MPP payments",
5
5
  "type": "module",
6
6
  "bin": {