polkadot-cli 1.1.0 → 1.1.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
@@ -559,6 +559,10 @@ Config and metadata caches live in `~/.polkadot/`:
559
559
 
560
560
  > **Warning:** `accounts.json` stores secrets (mnemonics and seeds) in **plain text**. Encrypted-at-rest storage is planned but not yet implemented. Keep appropriate file permissions (`chmod 600 ~/.polkadot/accounts.json`) and do not use this for high-value mainnet accounts.
561
561
 
562
+ ## Environment compatibility
563
+
564
+ The CLI works in Node.js, Bun, and sandboxed runtimes (e.g. LLM tool-use / MCP environments) that lack a native `globalThis.WebSocket`. WebSocket connections use the [`ws`](https://github.com/websockets/ws) package explicitly, so no global polyfill is required.
565
+
562
566
  ## Development
563
567
 
564
568
  Requires [Bun](https://bun.sh).
package/dist/cli.mjs CHANGED
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
5
  // src/cli.ts
6
6
  import cac from "cac";
7
7
  // package.json
8
- var version = "1.1.0";
8
+ var version = "1.1.1";
9
9
 
10
10
  // src/config/accounts-store.ts
11
11
  import { access as access2, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "node:fs/promises";
@@ -830,6 +830,7 @@ async function accountInspect(input, opts) {
830
830
  import { createClient } from "polkadot-api";
831
831
  import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat";
832
832
  import { getWsProvider } from "polkadot-api/ws-provider";
833
+ import { WebSocket } from "ws";
833
834
 
834
835
  // src/utils/errors.ts
835
836
  class CliError extends Error {
@@ -891,7 +892,10 @@ async function createChainClient(chainName, chainConfig, rpcOverride) {
891
892
  restoreConsole();
892
893
  throw new ConnectionError(`No RPC endpoint configured for chain "${chainName}". Use --rpc or configure one with: dot chain add ${chainName} --rpc <url>`);
893
894
  }
894
- provider = withPolkadotSdkCompat(getWsProvider(rpc, { timeout: 1e4 }));
895
+ provider = withPolkadotSdkCompat(getWsProvider(rpc, {
896
+ timeout: 1e4,
897
+ websocketClass: WebSocket
898
+ }));
895
899
  }
896
900
  const client = createClient(provider, {
897
901
  getMetadata: async () => loadMetadata(chainName),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polkadot-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI tool for querying Polkadot-ecosystem on-chain state",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,12 +44,14 @@
44
44
  "@polkadot-labs/hdkd": "^0.0.26",
45
45
  "@polkadot-labs/hdkd-helpers": "^0.0.27",
46
46
  "cac": "^6.7.14",
47
- "polkadot-api": "^1.23.3"
47
+ "polkadot-api": "^1.23.3",
48
+ "ws": "^8.19.0"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@biomejs/biome": "^2.4.5",
51
52
  "@changesets/cli": "^2.29.4",
52
53
  "@types/bun": "latest",
54
+ "@types/ws": "^8.18.1",
53
55
  "husky": "^9.1.7"
54
56
  }
55
57
  }