@lightprotocol/zk-compression-cli 0.27.1-alpha.5 → 0.27.1-alpha.7

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.
Binary file
@@ -119,6 +119,7 @@ async function initTestEnv({ additionalPrograms, skipSystemAccounts, indexer = t
119
119
  });
120
120
  await (0, process_1.waitForServers)([{ port: rpcPort, path: "/health" }]);
121
121
  await (0, process_1.confirmServerStability)(`http://127.0.0.1:${rpcPort}/health`);
122
+ await (0, process_1.confirmRpcReadiness)(`http://127.0.0.1:${rpcPort}`);
122
123
  if (indexer) {
123
124
  const config = (0, utils_1.getConfig)();
124
125
  config.indexerUrl = `http://127.0.0.1:${indexerPort}`;
@@ -33,3 +33,13 @@ export declare function waitForServers(servers: {
33
33
  path: string;
34
34
  }[]): Promise<void>;
35
35
  export declare function confirmServerStability(url: string, attempts?: number): Promise<void>;
36
+ /**
37
+ * Confirms that the Solana RPC is fully ready to process requests.
38
+ * This goes beyond HTTP availability and verifies the RPC can handle actual Solana requests.
39
+ *
40
+ * @param rpcUrl - The RPC endpoint URL
41
+ * @param maxAttempts - Maximum number of attempts (default: 30)
42
+ * @param delayMs - Delay between attempts in milliseconds (default: 500ms)
43
+ * @throws Error if RPC doesn't become ready within maxAttempts
44
+ */
45
+ export declare function confirmRpcReadiness(rpcUrl: string, maxAttempts?: number, delayMs?: number): Promise<void>;
@@ -8,6 +8,7 @@ exports.execute = execute;
8
8
  exports.spawnBinary = spawnBinary;
9
9
  exports.waitForServers = waitForServers;
10
10
  exports.confirmServerStability = confirmServerStability;
11
+ exports.confirmRpcReadiness = confirmRpcReadiness;
11
12
  const tslib_1 = require("tslib");
12
13
  const child_process_1 = require("child_process");
13
14
  const path_1 = tslib_1.__importDefault(require("path"));
@@ -242,3 +243,50 @@ async function confirmServerStability(url, attempts = 20) {
242
243
  throw error;
243
244
  }
244
245
  }
246
+ /**
247
+ * Confirms that the Solana RPC is fully ready to process requests.
248
+ * This goes beyond HTTP availability and verifies the RPC can handle actual Solana requests.
249
+ *
250
+ * @param rpcUrl - The RPC endpoint URL
251
+ * @param maxAttempts - Maximum number of attempts (default: 30)
252
+ * @param delayMs - Delay between attempts in milliseconds (default: 500ms)
253
+ * @throws Error if RPC doesn't become ready within maxAttempts
254
+ */
255
+ async function confirmRpcReadiness(rpcUrl, maxAttempts = 30, delayMs = 500) {
256
+ let lastError;
257
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
258
+ try {
259
+ const response = await axios_1.default.post(rpcUrl, {
260
+ jsonrpc: "2.0",
261
+ id: 1,
262
+ method: "getHealth",
263
+ params: [],
264
+ }, {
265
+ headers: { "Content-Type": "application/json" },
266
+ timeout: 3000,
267
+ });
268
+ if (response.data?.result === "ok") {
269
+ console.log(`RPC is ready after ${attempt} attempt${attempt > 1 ? "s" : ""}.`);
270
+ return;
271
+ }
272
+ // Response received but not "ok"
273
+ lastError = new Error(`RPC returned unexpected result: ${JSON.stringify(response.data)}`);
274
+ }
275
+ catch (error) {
276
+ lastError = error;
277
+ // Log connection errors only on later attempts to reduce noise
278
+ if (attempt > 5 && attempt % 5 === 0) {
279
+ const errorMsg = error instanceof Error ? error.message : String(error);
280
+ console.log(`RPC not ready yet (attempt ${attempt}/${maxAttempts}): ${errorMsg}`);
281
+ }
282
+ }
283
+ // Don't sleep after the last attempt
284
+ if (attempt < maxAttempts) {
285
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
286
+ }
287
+ }
288
+ // If we get here, all attempts failed
289
+ const errorMsg = lastError instanceof Error ? lastError.message : String(lastError);
290
+ const totalTime = Math.round((maxAttempts * delayMs) / 1000);
291
+ throw new Error(`RPC failed to become ready after ${maxAttempts} attempts (~${totalTime}s). Last error: ${errorMsg}`);
292
+ }
@@ -584,45 +584,6 @@
584
584
  "index.js"
585
585
  ]
586
586
  },
587
- "start-prover": {
588
- "aliases": [],
589
- "args": {},
590
- "description": "Start gnark prover",
591
- "flags": {
592
- "prover-port": {
593
- "description": "Enable Light Prover server on this port.",
594
- "name": "prover-port",
595
- "required": false,
596
- "default": 3001,
597
- "hasDynamicHelp": false,
598
- "multiple": false,
599
- "type": "option"
600
- },
601
- "redisUrl": {
602
- "description": "Redis URL to use for the prover (e.g. redis://localhost:6379)",
603
- "name": "redisUrl",
604
- "required": false,
605
- "hasDynamicHelp": false,
606
- "multiple": false,
607
- "type": "option"
608
- }
609
- },
610
- "hasDynamicHelp": false,
611
- "hiddenAliases": [],
612
- "id": "start-prover",
613
- "pluginAlias": "@lightprotocol/zk-compression-cli",
614
- "pluginName": "@lightprotocol/zk-compression-cli",
615
- "pluginType": "core",
616
- "strict": true,
617
- "enableJsonFlag": false,
618
- "isESM": false,
619
- "relativePath": [
620
- "dist",
621
- "commands",
622
- "start-prover",
623
- "index.js"
624
- ]
625
- },
626
587
  "test-validator": {
627
588
  "aliases": [],
628
589
  "args": {},
@@ -809,82 +770,121 @@
809
770
  "index.js"
810
771
  ]
811
772
  },
812
- "token-balance": {
773
+ "transfer": {
813
774
  "aliases": [],
814
775
  "args": {},
815
776
  "examples": [
816
- "$ light token-balance --mint=<ADDRESS> --owner=<ADDRESS>"
777
+ "$ light transfer --mint PublicKey --to PublicKey --amount 1000"
817
778
  ],
818
779
  "flags": {
819
- "owner": {
820
- "description": "Address of the compressed token owner.",
821
- "name": "owner",
780
+ "mint": {
781
+ "description": "Mint to transfer",
782
+ "name": "mint",
822
783
  "required": true,
823
784
  "hasDynamicHelp": false,
824
785
  "multiple": false,
825
786
  "type": "option"
826
787
  },
827
- "mint": {
828
- "description": "Mint address of the compressed token account.",
829
- "name": "mint",
788
+ "to": {
789
+ "description": "Recipient address",
790
+ "name": "to",
830
791
  "required": true,
831
792
  "hasDynamicHelp": false,
832
793
  "multiple": false,
833
794
  "type": "option"
795
+ },
796
+ "amount": {
797
+ "description": "Amount to send, in tokens",
798
+ "name": "amount",
799
+ "required": true,
800
+ "hasDynamicHelp": false,
801
+ "multiple": false,
802
+ "type": "option"
803
+ },
804
+ "fee-payer": {
805
+ "description": "Specify the fee-payer account. Defaults to the client keypair.",
806
+ "name": "fee-payer",
807
+ "required": false,
808
+ "hasDynamicHelp": false,
809
+ "multiple": false,
810
+ "type": "option"
834
811
  }
835
812
  },
836
813
  "hasDynamicHelp": false,
837
814
  "hiddenAliases": [],
838
- "id": "token-balance",
815
+ "id": "transfer",
839
816
  "pluginAlias": "@lightprotocol/zk-compression-cli",
840
817
  "pluginName": "@lightprotocol/zk-compression-cli",
841
818
  "pluginType": "core",
842
819
  "strict": true,
843
- "summary": "Get balance",
820
+ "summary": "Transfer tokens from one account to another.",
844
821
  "enableJsonFlag": false,
845
822
  "isESM": false,
846
823
  "relativePath": [
847
824
  "dist",
848
825
  "commands",
849
- "token-balance",
826
+ "transfer",
850
827
  "index.js"
851
828
  ]
852
829
  },
853
- "transfer": {
830
+ "start-prover": {
854
831
  "aliases": [],
855
832
  "args": {},
856
- "examples": [
857
- "$ light transfer --mint PublicKey --to PublicKey --amount 1000"
858
- ],
833
+ "description": "Start gnark prover",
859
834
  "flags": {
860
- "mint": {
861
- "description": "Mint to transfer",
862
- "name": "mint",
863
- "required": true,
835
+ "prover-port": {
836
+ "description": "Enable Light Prover server on this port.",
837
+ "name": "prover-port",
838
+ "required": false,
839
+ "default": 3001,
864
840
  "hasDynamicHelp": false,
865
841
  "multiple": false,
866
842
  "type": "option"
867
843
  },
868
- "to": {
869
- "description": "Recipient address",
870
- "name": "to",
871
- "required": true,
844
+ "redisUrl": {
845
+ "description": "Redis URL to use for the prover (e.g. redis://localhost:6379)",
846
+ "name": "redisUrl",
847
+ "required": false,
872
848
  "hasDynamicHelp": false,
873
849
  "multiple": false,
874
850
  "type": "option"
875
- },
876
- "amount": {
877
- "description": "Amount to send, in tokens",
878
- "name": "amount",
851
+ }
852
+ },
853
+ "hasDynamicHelp": false,
854
+ "hiddenAliases": [],
855
+ "id": "start-prover",
856
+ "pluginAlias": "@lightprotocol/zk-compression-cli",
857
+ "pluginName": "@lightprotocol/zk-compression-cli",
858
+ "pluginType": "core",
859
+ "strict": true,
860
+ "enableJsonFlag": false,
861
+ "isESM": false,
862
+ "relativePath": [
863
+ "dist",
864
+ "commands",
865
+ "start-prover",
866
+ "index.js"
867
+ ]
868
+ },
869
+ "token-balance": {
870
+ "aliases": [],
871
+ "args": {},
872
+ "examples": [
873
+ "$ light token-balance --mint=<ADDRESS> --owner=<ADDRESS>"
874
+ ],
875
+ "flags": {
876
+ "owner": {
877
+ "description": "Address of the compressed token owner.",
878
+ "name": "owner",
879
879
  "required": true,
880
880
  "hasDynamicHelp": false,
881
881
  "multiple": false,
882
882
  "type": "option"
883
883
  },
884
- "fee-payer": {
885
- "description": "Specify the fee-payer account. Defaults to the client keypair.",
886
- "name": "fee-payer",
887
- "required": false,
884
+ "mint": {
885
+ "description": "Mint address of the compressed token account.",
886
+ "name": "mint",
887
+ "required": true,
888
888
  "hasDynamicHelp": false,
889
889
  "multiple": false,
890
890
  "type": "option"
@@ -892,21 +892,21 @@
892
892
  },
893
893
  "hasDynamicHelp": false,
894
894
  "hiddenAliases": [],
895
- "id": "transfer",
895
+ "id": "token-balance",
896
896
  "pluginAlias": "@lightprotocol/zk-compression-cli",
897
897
  "pluginName": "@lightprotocol/zk-compression-cli",
898
898
  "pluginType": "core",
899
899
  "strict": true,
900
- "summary": "Transfer tokens from one account to another.",
900
+ "summary": "Get balance",
901
901
  "enableJsonFlag": false,
902
902
  "isESM": false,
903
903
  "relativePath": [
904
904
  "dist",
905
905
  "commands",
906
- "transfer",
906
+ "token-balance",
907
907
  "index.js"
908
908
  ]
909
909
  }
910
910
  },
911
- "version": "0.27.1-alpha.5"
911
+ "version": "0.27.1-alpha.7"
912
912
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightprotocol/zk-compression-cli",
3
- "version": "0.27.1-alpha.5",
3
+ "version": "0.27.1-alpha.7",
4
4
  "description": "ZK Compression: Secure Scaling on Solana",
5
5
  "maintainers": [
6
6
  {
@@ -49,8 +49,8 @@
49
49
  "tweetnacl": "^1.0.3",
50
50
  "wait-on": "^7.2.0",
51
51
  "which": "^5.0.0",
52
- "@lightprotocol/compressed-token": "0.22.1-alpha.3",
53
- "@lightprotocol/stateless.js": "0.22.1-alpha.2"
52
+ "@lightprotocol/stateless.js": "0.22.1-alpha.4",
53
+ "@lightprotocol/compressed-token": "0.22.1-alpha.5"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@eslint/js": "9.36.0",