@settlemint/sdk-js 2.4.0 → 2.4.1-main1923abdd

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.
@@ -1,3 +1,4 @@
1
+ /* SettleMint SDK - Main Package */
1
2
  import { fetchWithRetry } from "@settlemint/sdk-utils/http";
2
3
  import { ensureServer } from "@settlemint/sdk-utils/runtime";
3
4
  import { AccessTokenSchema, IdSchema, LOCAL_INSTANCE, STANDALONE_INSTANCE, UrlSchema, validate } from "@settlemint/sdk-utils/validation";
@@ -118,7 +119,9 @@ const workspaceList = (gqlClient) => {
118
119
  const { workspaces } = await gqlClient.request(getWorkspacesAndApplications);
119
120
  const allWorkspaces = workspaces.reduce((acc, workspace) => {
120
121
  acc.push(workspace);
121
- if (workspace.childWorkspaces) acc.push(...workspace.childWorkspaces);
122
+ if (workspace.childWorkspaces) {
123
+ acc.push(...workspace.childWorkspaces);
124
+ }
122
125
  return acc;
123
126
  }, []);
124
127
  return allWorkspaces.sort((a, b) => a.name.localeCompare(b.name));
@@ -173,7 +176,9 @@ const workspaceDelete = (gqlClient) => {
173
176
  const workspaceAddCredits = (gqlClient) => {
174
177
  return async (workspaceId, amount) => {
175
178
  const id = validate(IdSchema, workspaceId);
176
- if (amount <= 0) throw new Error("Credit amount must be a positive number");
179
+ if (amount <= 0) {
180
+ throw new Error("Credit amount must be a positive number");
181
+ }
177
182
  const { addCredits: result } = await gqlClient.request(addCredits, {
178
183
  workspaceId: id,
179
184
  amount
@@ -350,7 +355,9 @@ const applicationAccessTokenCreate = (gqlClient) => {
350
355
  ...otherArgs,
351
356
  applicationId: application.id
352
357
  });
353
- if (!applicationAccessToken.token) throw new Error("Failed to create application access token");
358
+ if (!applicationAccessToken.token) {
359
+ throw new Error("Failed to create application access token");
360
+ }
354
361
  return applicationAccessToken.token;
355
362
  };
356
363
  };
@@ -381,15 +388,17 @@ function setClusterServiceDefaults(args) {
381
388
  */
382
389
  function setNetworkDefaults(args) {
383
390
  const clusterServiceArgs = setClusterServiceDefaults(args);
384
- if (args.consensusAlgorithm === "BESU_QBFT") return {
385
- ...clusterServiceArgs,
386
- chainId: args.chainId ?? 46040,
387
- contractSizeLimit: args.contractSizeLimit ?? 2147483647,
388
- evmStackSize: args.evmStackSize ?? 2048,
389
- gasLimit: args.gasLimit ?? "9007199254740991",
390
- gasPrice: args.gasPrice ?? 0,
391
- secondsPerBlock: args.secondsPerBlock ?? 2
392
- };
391
+ if (args.consensusAlgorithm === "BESU_QBFT") {
392
+ return {
393
+ ...clusterServiceArgs,
394
+ chainId: args.chainId ?? 46040,
395
+ contractSizeLimit: args.contractSizeLimit ?? 2147483647,
396
+ evmStackSize: args.evmStackSize ?? 2048,
397
+ gasLimit: args.gasLimit ?? "9007199254740991",
398
+ gasPrice: args.gasPrice ?? 0,
399
+ secondsPerBlock: args.secondsPerBlock ?? 2
400
+ };
401
+ }
393
402
  return clusterServiceArgs;
394
403
  }
395
404
 
@@ -574,6 +583,26 @@ const restartBlockchainNetwork = graphql(`
574
583
  }
575
584
  `, [BlockchainNetworkFragment]);
576
585
  /**
586
+ * Mutation to pause a blockchain network.
587
+ */
588
+ const pauseBlockchainNetwork = graphql(`
589
+ mutation PauseBlockchainNetwork($uniqueName: String!) {
590
+ pauseBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
591
+ ...BlockchainNetwork
592
+ }
593
+ }
594
+ `, [BlockchainNetworkFragment]);
595
+ /**
596
+ * Mutation to resume a blockchain network.
597
+ */
598
+ const resumeBlockchainNetwork = graphql(`
599
+ mutation ResumeBlockchainNetwork($uniqueName: String!) {
600
+ resumeBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
601
+ ...BlockchainNetwork
602
+ }
603
+ }
604
+ `, [BlockchainNetworkFragment]);
605
+ /**
577
606
  * Creates a function to list blockchain networks for a given application.
578
607
  *
579
608
  * @param gqlClient - The GraphQL client instance
@@ -642,6 +671,28 @@ const blockchainNetworkRestart = (gqlClient) => async (blockchainNetworkUniqueNa
642
671
  const { restartBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(restartBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
643
672
  return blockchainNetwork;
644
673
  };
674
+ /**
675
+ * Creates a function to pause a blockchain network.
676
+ *
677
+ * @param gqlClient - The GraphQL client instance
678
+ * @returns Function that pauses a network by unique name
679
+ * @throws If the network cannot be found or the pause fails
680
+ */
681
+ const blockchainNetworkPause = (gqlClient) => async (blockchainNetworkUniqueName) => {
682
+ const { pauseBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(pauseBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
683
+ return blockchainNetwork;
684
+ };
685
+ /**
686
+ * Creates a function to resume a blockchain network.
687
+ *
688
+ * @param gqlClient - The GraphQL client instance
689
+ * @returns Function that resumes a network by unique name
690
+ * @throws If the network cannot be found or the resume fails
691
+ */
692
+ const blockchainNetworkResume = (gqlClient) => async (blockchainNetworkUniqueName) => {
693
+ const { resumeBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(resumeBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
694
+ return blockchainNetwork;
695
+ };
645
696
 
646
697
  //#endregion
647
698
  //#region src/graphql/blockchain-node.ts
@@ -794,6 +845,26 @@ const restartBlockchainNode = graphql(`
794
845
  }
795
846
  `, [BlockchainNodeFragment]);
796
847
  /**
848
+ * Mutation to pause a blockchain node.
849
+ */
850
+ const pauseBlockchainNode = graphql(`
851
+ mutation PauseBlockchainNode($uniqueName: String!) {
852
+ pauseBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
853
+ ...BlockchainNode
854
+ }
855
+ }
856
+ `, [BlockchainNodeFragment]);
857
+ /**
858
+ * Mutation to resume a blockchain node.
859
+ */
860
+ const resumeBlockchainNode = graphql(`
861
+ mutation ResumeBlockchainNode($uniqueName: String!) {
862
+ resumeBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
863
+ ...BlockchainNode
864
+ }
865
+ }
866
+ `, [BlockchainNodeFragment]);
867
+ /**
797
868
  * Creates a function to list blockchain nodes for an application.
798
869
  *
799
870
  * @param gqlClient - The GraphQL client instance
@@ -849,6 +920,28 @@ const blockchainNodeRestart = (gqlClient) => async (blockchainNodeUniqueName) =>
849
920
  const { restartBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(restartBlockchainNode, { uniqueName: blockchainNodeUniqueName });
850
921
  return blockchainNode;
851
922
  };
923
+ /**
924
+ * Creates a function to pause a blockchain node.
925
+ *
926
+ * @param gqlClient - The GraphQL client instance
927
+ * @returns Function that pauses a blockchain node by unique name
928
+ * @throws If the blockchain node cannot be found or the pause fails
929
+ */
930
+ const blockchainNodePause = (gqlClient) => async (blockchainNodeUniqueName) => {
931
+ const { pauseBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(pauseBlockchainNode, { uniqueName: blockchainNodeUniqueName });
932
+ return blockchainNode;
933
+ };
934
+ /**
935
+ * Creates a function to resume a blockchain node.
936
+ *
937
+ * @param gqlClient - The GraphQL client instance
938
+ * @returns Function that resumes a blockchain node by unique name
939
+ * @throws If the blockchain node cannot be found or the resume fails
940
+ */
941
+ const blockchainNodeResume = (gqlClient) => async (blockchainNodeUniqueName) => {
942
+ const { resumeBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(resumeBlockchainNode, { uniqueName: blockchainNodeUniqueName });
943
+ return blockchainNode;
944
+ };
852
945
 
853
946
  //#endregion
854
947
  //#region src/graphql/custom-deployment.ts
@@ -953,6 +1046,26 @@ const restartCustomDeployment = graphql(`
953
1046
  }
954
1047
  `, [CustomDeploymentFragment]);
955
1048
  /**
1049
+ * Mutation to pause a custom deployment.
1050
+ */
1051
+ const pauseCustomDeployment = graphql(`
1052
+ mutation PauseCustomDeployment($uniqueName: String!) {
1053
+ pauseCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
1054
+ ...CustomDeployment
1055
+ }
1056
+ }
1057
+ `, [CustomDeploymentFragment]);
1058
+ /**
1059
+ * Mutation to resume a custom deployment.
1060
+ */
1061
+ const resumeCustomDeployment = graphql(`
1062
+ mutation ResumeCustomDeployment($uniqueName: String!) {
1063
+ resumeCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
1064
+ ...CustomDeployment
1065
+ }
1066
+ }
1067
+ `, [CustomDeploymentFragment]);
1068
+ /**
956
1069
  * Creates a function to list custom deployments for an application.
957
1070
  *
958
1071
  * @param gqlClient - The GraphQL client instance
@@ -1023,6 +1136,28 @@ const customDeploymentRestart = (gqlClient) => async (customDeploymentUniqueName
1023
1136
  const { restartCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(restartCustomDeployment, { uniqueName: customDeploymentUniqueName });
1024
1137
  return customDeployment;
1025
1138
  };
1139
+ /**
1140
+ * Creates a function to pause a custom deployment.
1141
+ *
1142
+ * @param gqlClient - The GraphQL client instance
1143
+ * @returns Function that pauses a custom deployment by unique name
1144
+ * @throws If the custom deployment cannot be found or the pause fails
1145
+ */
1146
+ const customDeploymentPause = (gqlClient) => async (customDeploymentUniqueName) => {
1147
+ const { pauseCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(pauseCustomDeployment, { uniqueName: customDeploymentUniqueName });
1148
+ return customDeployment;
1149
+ };
1150
+ /**
1151
+ * Creates a function to resume a custom deployment.
1152
+ *
1153
+ * @param gqlClient - The GraphQL client instance
1154
+ * @returns Function that resumes a custom deployment by unique name
1155
+ * @throws If the custom deployment cannot be found or the resume fails
1156
+ */
1157
+ const customDeploymentResume = (gqlClient) => async (customDeploymentUniqueName) => {
1158
+ const { resumeCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(resumeCustomDeployment, { uniqueName: customDeploymentUniqueName });
1159
+ return customDeployment;
1160
+ };
1026
1161
 
1027
1162
  //#endregion
1028
1163
  //#region src/graphql/foundry.ts
@@ -1131,6 +1266,26 @@ const restartLoadBalancer = graphql(`
1131
1266
  }
1132
1267
  `, [LoadBalancerFragment]);
1133
1268
  /**
1269
+ * Mutation to pause a load balancer.
1270
+ */
1271
+ const pauseLoadBalancer = graphql(`
1272
+ mutation PauseLoadBalancer($uniqueName: String!) {
1273
+ pauseLoadBalancerByUniqueName(uniqueName: $uniqueName) {
1274
+ ...LoadBalancer
1275
+ }
1276
+ }
1277
+ `, [LoadBalancerFragment]);
1278
+ /**
1279
+ * Mutation to resume a load balancer.
1280
+ */
1281
+ const resumeLoadBalancer = graphql(`
1282
+ mutation ResumeLoadBalancer($uniqueName: String!) {
1283
+ resumeLoadBalancerByUniqueName(uniqueName: $uniqueName) {
1284
+ ...LoadBalancer
1285
+ }
1286
+ }
1287
+ `, [LoadBalancerFragment]);
1288
+ /**
1134
1289
  * Creates a function to fetch a specific load balancer.
1135
1290
  *
1136
1291
  * @param gqlClient - The GraphQL client instance
@@ -1191,6 +1346,28 @@ const loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
1191
1346
  const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, { uniqueName: loadBalancerUniqueName });
1192
1347
  return loadBalancer;
1193
1348
  };
1349
+ /**
1350
+ * Creates a function to pause a load balancer.
1351
+ *
1352
+ * @param gqlClient - The GraphQL client instance
1353
+ * @returns Function that pauses a load balancer
1354
+ * @throws If the load balancer cannot be paused or the request fails
1355
+ */
1356
+ const loadBalancerPause = (gqlClient) => async (loadBalancerUniqueName) => {
1357
+ const { pauseLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(pauseLoadBalancer, { uniqueName: loadBalancerUniqueName });
1358
+ return loadBalancer;
1359
+ };
1360
+ /**
1361
+ * Creates a function to resume a load balancer.
1362
+ *
1363
+ * @param gqlClient - The GraphQL client instance
1364
+ * @returns Function that resumes a load balancer
1365
+ * @throws If the load balancer cannot be resumed or the request fails
1366
+ */
1367
+ const loadBalancerResume = (gqlClient) => async (loadBalancerUniqueName) => {
1368
+ const { resumeLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(resumeLoadBalancer, { uniqueName: loadBalancerUniqueName });
1369
+ return loadBalancer;
1370
+ };
1194
1371
 
1195
1372
  //#endregion
1196
1373
  //#region src/graphql/insights.ts
@@ -1283,6 +1460,26 @@ const restartInsights = graphql(`
1283
1460
  }
1284
1461
  `, [InsightsFragment]);
1285
1462
  /**
1463
+ * Mutation to pause insights.
1464
+ */
1465
+ const pauseInsights = graphql(`
1466
+ mutation PauseInsights($uniqueName: String!) {
1467
+ pauseInsightsByUniqueName(uniqueName: $uniqueName) {
1468
+ ...Insights
1469
+ }
1470
+ }
1471
+ `, [InsightsFragment]);
1472
+ /**
1473
+ * Mutation to resume insights.
1474
+ */
1475
+ const resumeInsights = graphql(`
1476
+ mutation ResumeInsights($uniqueName: String!) {
1477
+ resumeInsightsByUniqueName(uniqueName: $uniqueName) {
1478
+ ...Insights
1479
+ }
1480
+ }
1481
+ `, [InsightsFragment]);
1482
+ /**
1286
1483
  * Creates a function to list insights for an application.
1287
1484
  *
1288
1485
  * @param gqlClient - The GraphQL client instance
@@ -1320,8 +1517,8 @@ const insightsCreate = (gqlClient) => {
1320
1517
  const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName,...otherArgs } = args;
1321
1518
  const [application, blockchainNode, loadBalancer] = await Promise.all([
1322
1519
  applicationRead(gqlClient)(applicationUniqueName),
1323
- blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(void 0),
1324
- loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(void 0)
1520
+ blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
1521
+ loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(undefined)
1325
1522
  ]);
1326
1523
  const { createInsights: insights } = await gqlClient.request(createInsights, {
1327
1524
  ...otherArgs,
@@ -1343,6 +1540,28 @@ const insightsRestart = (gqlClient) => async (insightsUniqueName) => {
1343
1540
  const { restartInsightsByUniqueName: insights } = await gqlClient.request(restartInsights, { uniqueName: insightsUniqueName });
1344
1541
  return insights;
1345
1542
  };
1543
+ /**
1544
+ * Creates a function to pause insights.
1545
+ *
1546
+ * @param gqlClient - The GraphQL client instance
1547
+ * @returns Function that pauses insights by unique name
1548
+ * @throws If the insights cannot be found or the pause fails
1549
+ */
1550
+ const insightsPause = (gqlClient) => async (insightsUniqueName) => {
1551
+ const { pauseInsightsByUniqueName: insights } = await gqlClient.request(pauseInsights, { uniqueName: insightsUniqueName });
1552
+ return insights;
1553
+ };
1554
+ /**
1555
+ * Creates a function to resume insights.
1556
+ *
1557
+ * @param gqlClient - The GraphQL client instance
1558
+ * @returns Function that resumes insights by unique name
1559
+ * @throws If the insights cannot be found or the resume fails
1560
+ */
1561
+ const insightsResume = (gqlClient) => async (insightsUniqueName) => {
1562
+ const { resumeInsightsByUniqueName: insights } = await gqlClient.request(resumeInsights, { uniqueName: insightsUniqueName });
1563
+ return insights;
1564
+ };
1346
1565
 
1347
1566
  //#endregion
1348
1567
  //#region src/graphql/integration-tool.ts
@@ -1431,6 +1650,26 @@ const restartIntegrationTool = graphql(`
1431
1650
  }
1432
1651
  `, [IntegrationFragment]);
1433
1652
  /**
1653
+ * Mutation to pause an integration.
1654
+ */
1655
+ const pauseIntegrationTool = graphql(`
1656
+ mutation PauseIntegrationTool($uniqueName: String!) {
1657
+ pauseIntegrationByUniqueName(uniqueName: $uniqueName) {
1658
+ ...Integration
1659
+ }
1660
+ }
1661
+ `, [IntegrationFragment]);
1662
+ /**
1663
+ * Mutation to resume an integration.
1664
+ */
1665
+ const resumeIntegrationTool = graphql(`
1666
+ mutation ResumeIntegrationTool($uniqueName: String!) {
1667
+ resumeIntegrationByUniqueName(uniqueName: $uniqueName) {
1668
+ ...Integration
1669
+ }
1670
+ }
1671
+ `, [IntegrationFragment]);
1672
+ /**
1434
1673
  * Creates a function to list integration tools for an application.
1435
1674
  *
1436
1675
  * @param gqlClient - The GraphQL client instance
@@ -1485,6 +1724,28 @@ const integrationToolRestart = (gqlClient) => async (integrationUniqueName) => {
1485
1724
  const { restartIntegrationByUniqueName: integration } = await gqlClient.request(restartIntegrationTool, { uniqueName: integrationUniqueName });
1486
1725
  return integration;
1487
1726
  };
1727
+ /**
1728
+ * Creates a function to pause an integration tool.
1729
+ *
1730
+ * @param gqlClient - The GraphQL client instance
1731
+ * @returns Function that pauses integration tool by unique name
1732
+ * @throws If the integration tool cannot be found or the pause fails
1733
+ */
1734
+ const integrationToolPause = (gqlClient) => async (integrationUniqueName) => {
1735
+ const { pauseIntegrationByUniqueName: integration } = await gqlClient.request(pauseIntegrationTool, { uniqueName: integrationUniqueName });
1736
+ return integration;
1737
+ };
1738
+ /**
1739
+ * Creates a function to resume an integration tool.
1740
+ *
1741
+ * @param gqlClient - The GraphQL client instance
1742
+ * @returns Function that resumes integration tool by unique name
1743
+ * @throws If the integration tool cannot be found or the resume fails
1744
+ */
1745
+ const integrationToolResume = (gqlClient) => async (integrationUniqueName) => {
1746
+ const { resumeIntegrationByUniqueName: integration } = await gqlClient.request(resumeIntegrationTool, { uniqueName: integrationUniqueName });
1747
+ return integration;
1748
+ };
1488
1749
 
1489
1750
  //#endregion
1490
1751
  //#region src/graphql/storage.ts
@@ -1573,6 +1834,26 @@ const restartStorage = graphql(`
1573
1834
  }
1574
1835
  `, [StorageFragment]);
1575
1836
  /**
1837
+ * Mutation to pause a storage.
1838
+ */
1839
+ const pauseStorage = graphql(`
1840
+ mutation PauseStorage($uniqueName: String!) {
1841
+ pauseStorageByUniqueName(uniqueName: $uniqueName) {
1842
+ ...Storage
1843
+ }
1844
+ }
1845
+ `, [StorageFragment]);
1846
+ /**
1847
+ * Mutation to resume a storage.
1848
+ */
1849
+ const resumeStorage = graphql(`
1850
+ mutation ResumeStorage($uniqueName: String!) {
1851
+ resumeStorageByUniqueName(uniqueName: $uniqueName) {
1852
+ ...Storage
1853
+ }
1854
+ }
1855
+ `, [StorageFragment]);
1856
+ /**
1576
1857
  * Creates a function to list storages for an application.
1577
1858
  *
1578
1859
  * @param gqlClient - The GraphQL client instance
@@ -1627,6 +1908,28 @@ const storageRestart = (gqlClient) => async (storageUniqueName) => {
1627
1908
  const { restartStorageByUniqueName: storage } = await gqlClient.request(restartStorage, { uniqueName: storageUniqueName });
1628
1909
  return storage;
1629
1910
  };
1911
+ /**
1912
+ * Creates a function to pause a storage.
1913
+ *
1914
+ * @param gqlClient - The GraphQL client instance
1915
+ * @returns Function that pauses storage by unique name
1916
+ * @throws If the storage cannot be found or the pause fails
1917
+ */
1918
+ const storagePause = (gqlClient) => async (storageUniqueName) => {
1919
+ const { pauseStorageByUniqueName: storage } = await gqlClient.request(pauseStorage, { uniqueName: storageUniqueName });
1920
+ return storage;
1921
+ };
1922
+ /**
1923
+ * Creates a function to resume a storage.
1924
+ *
1925
+ * @param gqlClient - The GraphQL client instance
1926
+ * @returns Function that resumes storage by unique name
1927
+ * @throws If the storage cannot be found or the resume fails
1928
+ */
1929
+ const storageResume = (gqlClient) => async (storageUniqueName) => {
1930
+ const { resumeStorageByUniqueName: storage } = await gqlClient.request(resumeStorage, { uniqueName: storageUniqueName });
1931
+ return storage;
1932
+ };
1630
1933
 
1631
1934
  //#endregion
1632
1935
  //#region src/graphql/middleware.ts
@@ -1749,6 +2052,26 @@ const restartMiddleware = graphql(`
1749
2052
  }
1750
2053
  `, [MiddlewareFragment]);
1751
2054
  /**
2055
+ * Mutation to pause a middleware.
2056
+ */
2057
+ const pauseMiddleware = graphql(`
2058
+ mutation PauseMiddleware($uniqueName: String!) {
2059
+ pauseMiddlewareByUniqueName(uniqueName: $uniqueName) {
2060
+ ...Middleware
2061
+ }
2062
+ }
2063
+ `, [MiddlewareFragment]);
2064
+ /**
2065
+ * Mutation to resume a middleware.
2066
+ */
2067
+ const resumeMiddleware = graphql(`
2068
+ mutation ResumeMiddleware($uniqueName: String!) {
2069
+ resumeMiddlewareByUniqueName(uniqueName: $uniqueName) {
2070
+ ...Middleware
2071
+ }
2072
+ }
2073
+ `, [MiddlewareFragment]);
2074
+ /**
1752
2075
  * Creates a function to list middlewares for an application.
1753
2076
  *
1754
2077
  * @param gqlClient - The GraphQL client instance
@@ -1802,9 +2125,9 @@ const middlewareCreate = (gqlClient) => {
1802
2125
  const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName,...otherArgs } = args;
1803
2126
  const [application, blockchainNode, loadBalancer, storage] = await Promise.all([
1804
2127
  applicationRead(gqlClient)(applicationUniqueName),
1805
- blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(void 0),
1806
- loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(void 0),
1807
- storageUniqueName ? storageRead(gqlClient)(storageUniqueName) : Promise.resolve(void 0)
2128
+ blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
2129
+ loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(undefined),
2130
+ storageUniqueName ? storageRead(gqlClient)(storageUniqueName) : Promise.resolve(undefined)
1808
2131
  ]);
1809
2132
  const { createMiddleware: middleware } = await gqlClient.request(createMiddleware, {
1810
2133
  ...otherArgs,
@@ -1827,6 +2150,28 @@ const middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
1827
2150
  const { restartMiddlewareByUniqueName: middleware } = await gqlClient.request(restartMiddleware, { uniqueName: middlewareUniqueName });
1828
2151
  return middleware;
1829
2152
  };
2153
+ /**
2154
+ * Creates a function to pause a middleware.
2155
+ *
2156
+ * @param gqlClient - The GraphQL client instance
2157
+ * @returns Function that pauses middleware by unique name
2158
+ * @throws If the middleware cannot be found or the pause fails
2159
+ */
2160
+ const middlewarePause = (gqlClient) => async (middlewareUniqueName) => {
2161
+ const { pauseMiddlewareByUniqueName: middleware } = await gqlClient.request(pauseMiddleware, { uniqueName: middlewareUniqueName });
2162
+ return middleware;
2163
+ };
2164
+ /**
2165
+ * Creates a function to resume a middleware.
2166
+ *
2167
+ * @param gqlClient - The GraphQL client instance
2168
+ * @returns Function that resumes middleware by unique name
2169
+ * @throws If the middleware cannot be found or the resume fails
2170
+ */
2171
+ const middlewareResume = (gqlClient) => async (middlewareUniqueName) => {
2172
+ const { resumeMiddlewareByUniqueName: middleware } = await gqlClient.request(resumeMiddleware, { uniqueName: middlewareUniqueName });
2173
+ return middleware;
2174
+ };
1830
2175
 
1831
2176
  //#endregion
1832
2177
  //#region src/graphql/platform.ts
@@ -1991,6 +2336,26 @@ const restartPrivateKey = graphql(`
1991
2336
  }
1992
2337
  `, [PrivateKeyFragment]);
1993
2338
  /**
2339
+ * Mutation to pause a private key.
2340
+ */
2341
+ const pausePrivateKey = graphql(`
2342
+ mutation PausePrivateKey($uniqueName: String!) {
2343
+ pausePrivateKeyByUniqueName(uniqueName: $uniqueName) {
2344
+ ...PrivateKey
2345
+ }
2346
+ }
2347
+ `, [PrivateKeyFragment]);
2348
+ /**
2349
+ * Mutation to resume a private key.
2350
+ */
2351
+ const resumePrivateKey = graphql(`
2352
+ mutation ResumePrivateKey($uniqueName: String!) {
2353
+ resumePrivateKeyByUniqueName(uniqueName: $uniqueName) {
2354
+ ...PrivateKey
2355
+ }
2356
+ }
2357
+ `, [PrivateKeyFragment]);
2358
+ /**
1994
2359
  * Creates a function to list private keys for an application.
1995
2360
  *
1996
2361
  * @param gqlClient - The GraphQL client instance
@@ -2028,7 +2393,7 @@ const privateKeyCreate = (gqlClient) => {
2028
2393
  const { applicationUniqueName, blockchainNodeUniqueNames, relayerKeyUniqueName,...otherArgs } = args;
2029
2394
  const application = await applicationRead(gqlClient)(applicationUniqueName);
2030
2395
  const blockchainNodes = blockchainNodeUniqueNames ? await Promise.all(blockchainNodeUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName))) : [];
2031
- const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) : void 0;
2396
+ const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) : undefined;
2032
2397
  const platformConfig = await getPlatformConfig(gqlClient)();
2033
2398
  const defaultProvider = platformConfig.deploymentEngineTargets.find((target) => !target.disabled && target.clusters.some((cluster) => !cluster.disabled));
2034
2399
  const defaultRegion = defaultProvider?.clusters.find((cluster) => !cluster.disabled);
@@ -2056,6 +2421,28 @@ const privateKeyRestart = (gqlClient) => async (privateKeyUniqueName) => {
2056
2421
  const { restartPrivateKeyByUniqueName: privateKey } = await gqlClient.request(restartPrivateKey, { uniqueName: privateKeyUniqueName });
2057
2422
  return privateKey;
2058
2423
  };
2424
+ /**
2425
+ * Creates a function to pause a private key.
2426
+ *
2427
+ * @param gqlClient - The GraphQL client instance
2428
+ * @returns Function that pauses private key by unique name
2429
+ * @throws If the private key cannot be found or the pause fails
2430
+ */
2431
+ const privateKeyPause = (gqlClient) => async (privateKeyUniqueName) => {
2432
+ const { pausePrivateKeyByUniqueName: privateKey } = await gqlClient.request(pausePrivateKey, { uniqueName: privateKeyUniqueName });
2433
+ return privateKey;
2434
+ };
2435
+ /**
2436
+ * Creates a function to resume a private key.
2437
+ *
2438
+ * @param gqlClient - The GraphQL client instance
2439
+ * @returns Function that resumes private key by unique name
2440
+ * @throws If the private key cannot be found or the resume fails
2441
+ */
2442
+ const privateKeyResume = (gqlClient) => async (privateKeyUniqueName) => {
2443
+ const { resumePrivateKeyByUniqueName: privateKey } = await gqlClient.request(resumePrivateKey, { uniqueName: privateKeyUniqueName });
2444
+ return privateKey;
2445
+ };
2059
2446
 
2060
2447
  //#endregion
2061
2448
  //#region src/helpers/client-options.schema.ts
@@ -2093,7 +2480,9 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
2093
2480
  }
2094
2481
  });
2095
2482
  if (!response.ok) {
2096
- if (response.status === 404) throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
2483
+ if (response.status === 404) {
2484
+ throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
2485
+ }
2097
2486
  throw new Error("Failed to get verification challenge");
2098
2487
  }
2099
2488
  const verificationChallenges = await response.json();
@@ -2106,7 +2495,9 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
2106
2495
  * @returns The pincode verification challenge response.
2107
2496
  */
2108
2497
  function getPincodeVerificationChallengeResponse({ verificationChallenge, pincode }) {
2109
- if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) throw new Error("Could not authenticate pin code, invalid challenge format");
2498
+ if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
2499
+ throw new Error("Could not authenticate pin code, invalid challenge format");
2500
+ }
2110
2501
  const { secret, salt } = verificationChallenge.challenge;
2111
2502
  return generateResponse(pincode, salt, secret);
2112
2503
  }
@@ -2139,8 +2530,13 @@ function getPincodeVerificationChallengeResponse({ verificationChallenge, pincod
2139
2530
  */
2140
2531
  function createSettleMintClient(options) {
2141
2532
  ensureServer();
2142
- if (options.instance === STANDALONE_INSTANCE || options.instance === LOCAL_INSTANCE) if (options.anonymous) options.instance = "https://console.settlemint.com";
2143
- else throw new Error("Standalone and local instances cannot connect to the SettleMint platform");
2533
+ if (options.instance === STANDALONE_INSTANCE || options.instance === LOCAL_INSTANCE) {
2534
+ if (options.anonymous) {
2535
+ options.instance = "https://console.settlemint.com";
2536
+ } else {
2537
+ throw new Error("Standalone and local instances cannot connect to the SettleMint platform");
2538
+ }
2539
+ }
2144
2540
  const validatedOptions = options.anonymous ? validate(z.object({
2145
2541
  ...ClientOptionsSchema.shape,
2146
2542
  accessToken: z.literal("")
@@ -2180,57 +2576,75 @@ function createSettleMintClient(options) {
2180
2576
  read: blockchainNetworkRead(gqlClient),
2181
2577
  create: blockchainNetworkCreate(gqlClient),
2182
2578
  delete: blockchainNetworkDelete(gqlClient),
2183
- restart: blockchainNetworkRestart(gqlClient)
2579
+ restart: blockchainNetworkRestart(gqlClient),
2580
+ pause: blockchainNetworkPause(gqlClient),
2581
+ resume: blockchainNetworkResume(gqlClient)
2184
2582
  },
2185
2583
  blockchainNode: {
2186
2584
  list: blockchainNodeList(gqlClient),
2187
2585
  read: blockchainNodeRead(gqlClient),
2188
2586
  create: blockchainNodeCreate(gqlClient),
2189
- restart: blockchainNodeRestart(gqlClient)
2587
+ restart: blockchainNodeRestart(gqlClient),
2588
+ pause: blockchainNodePause(gqlClient),
2589
+ resume: blockchainNodeResume(gqlClient)
2190
2590
  },
2191
2591
  loadBalancer: {
2192
2592
  list: loadBalancerList(gqlClient),
2193
2593
  read: loadBalancerRead(gqlClient),
2194
2594
  create: loadBalancerCreate(gqlClient),
2195
- restart: loadBalancerRestart(gqlClient)
2595
+ restart: loadBalancerRestart(gqlClient),
2596
+ pause: loadBalancerPause(gqlClient),
2597
+ resume: loadBalancerResume(gqlClient)
2196
2598
  },
2197
2599
  middleware: {
2198
2600
  list: middlewareList(gqlClient),
2199
2601
  read: middlewareRead(gqlClient),
2200
2602
  graphSubgraphs: graphMiddlewareSubgraphs(gqlClient),
2201
2603
  create: middlewareCreate(gqlClient),
2202
- restart: middlewareRestart(gqlClient)
2604
+ restart: middlewareRestart(gqlClient),
2605
+ pause: middlewarePause(gqlClient),
2606
+ resume: middlewareResume(gqlClient)
2203
2607
  },
2204
2608
  integrationTool: {
2205
2609
  list: integrationToolList(gqlClient),
2206
2610
  read: integrationToolRead(gqlClient),
2207
2611
  create: integrationToolCreate(gqlClient),
2208
- restart: integrationToolRestart(gqlClient)
2612
+ restart: integrationToolRestart(gqlClient),
2613
+ pause: integrationToolPause(gqlClient),
2614
+ resume: integrationToolResume(gqlClient)
2209
2615
  },
2210
2616
  storage: {
2211
2617
  list: storageList(gqlClient),
2212
2618
  read: storageRead(gqlClient),
2213
2619
  create: storageCreate(gqlClient),
2214
- restart: storageRestart(gqlClient)
2620
+ restart: storageRestart(gqlClient),
2621
+ pause: storagePause(gqlClient),
2622
+ resume: storageResume(gqlClient)
2215
2623
  },
2216
2624
  privateKey: {
2217
2625
  list: privateKeyList(gqlClient),
2218
2626
  read: privatekeyRead(gqlClient),
2219
2627
  create: privateKeyCreate(gqlClient),
2220
- restart: privateKeyRestart(gqlClient)
2628
+ restart: privateKeyRestart(gqlClient),
2629
+ pause: privateKeyPause(gqlClient),
2630
+ resume: privateKeyResume(gqlClient)
2221
2631
  },
2222
2632
  insights: {
2223
2633
  list: insightsList(gqlClient),
2224
2634
  read: insightsRead(gqlClient),
2225
2635
  create: insightsCreate(gqlClient),
2226
- restart: insightsRestart(gqlClient)
2636
+ restart: insightsRestart(gqlClient),
2637
+ pause: insightsPause(gqlClient),
2638
+ resume: insightsResume(gqlClient)
2227
2639
  },
2228
2640
  customDeployment: {
2229
2641
  list: customdeploymentList(gqlClient),
2230
2642
  read: customdeploymentRead(gqlClient),
2231
2643
  create: customdeploymentCreate(gqlClient),
2232
2644
  update: customdeploymentUpdate(gqlClient),
2233
- restart: customDeploymentRestart(gqlClient)
2645
+ restart: customDeploymentRestart(gqlClient),
2646
+ pause: customDeploymentPause(gqlClient),
2647
+ resume: customDeploymentResume(gqlClient)
2234
2648
  },
2235
2649
  foundry: { env: getEnv(gqlClient) },
2236
2650
  applicationAccessToken: { create: applicationAccessTokenCreate(gqlClient) },