@settlemint/sdk-js 2.4.0-prd61aaa2c → 2.4.0-pre30adc85
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 +5 -5
- package/dist/settlemint.cjs +31 -445
- package/dist/settlemint.cjs.map +1 -1
- package/dist/settlemint.d.cts +451 -40983
- package/dist/settlemint.d.ts +423 -40954
- package/dist/settlemint.js +31 -445
- package/dist/settlemint.js.map +1 -1
- package/package.json +2 -2
package/dist/settlemint.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* SettleMint SDK - Main Package */
|
|
2
1
|
import { fetchWithRetry } from "@settlemint/sdk-utils/http";
|
|
3
2
|
import { ensureServer } from "@settlemint/sdk-utils/runtime";
|
|
4
3
|
import { AccessTokenSchema, IdSchema, LOCAL_INSTANCE, STANDALONE_INSTANCE, UrlSchema, validate } from "@settlemint/sdk-utils/validation";
|
|
@@ -119,9 +118,7 @@ const workspaceList = (gqlClient) => {
|
|
|
119
118
|
const { workspaces } = await gqlClient.request(getWorkspacesAndApplications);
|
|
120
119
|
const allWorkspaces = workspaces.reduce((acc, workspace) => {
|
|
121
120
|
acc.push(workspace);
|
|
122
|
-
if (workspace.childWorkspaces)
|
|
123
|
-
acc.push(...workspace.childWorkspaces);
|
|
124
|
-
}
|
|
121
|
+
if (workspace.childWorkspaces) acc.push(...workspace.childWorkspaces);
|
|
125
122
|
return acc;
|
|
126
123
|
}, []);
|
|
127
124
|
return allWorkspaces.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -176,9 +173,7 @@ const workspaceDelete = (gqlClient) => {
|
|
|
176
173
|
const workspaceAddCredits = (gqlClient) => {
|
|
177
174
|
return async (workspaceId, amount) => {
|
|
178
175
|
const id = validate(IdSchema, workspaceId);
|
|
179
|
-
if (amount <= 0)
|
|
180
|
-
throw new Error("Credit amount must be a positive number");
|
|
181
|
-
}
|
|
176
|
+
if (amount <= 0) throw new Error("Credit amount must be a positive number");
|
|
182
177
|
const { addCredits: result } = await gqlClient.request(addCredits, {
|
|
183
178
|
workspaceId: id,
|
|
184
179
|
amount
|
|
@@ -355,9 +350,7 @@ const applicationAccessTokenCreate = (gqlClient) => {
|
|
|
355
350
|
...otherArgs,
|
|
356
351
|
applicationId: application.id
|
|
357
352
|
});
|
|
358
|
-
if (!applicationAccessToken.token)
|
|
359
|
-
throw new Error("Failed to create application access token");
|
|
360
|
-
}
|
|
353
|
+
if (!applicationAccessToken.token) throw new Error("Failed to create application access token");
|
|
361
354
|
return applicationAccessToken.token;
|
|
362
355
|
};
|
|
363
356
|
};
|
|
@@ -388,17 +381,15 @@ function setClusterServiceDefaults(args) {
|
|
|
388
381
|
*/
|
|
389
382
|
function setNetworkDefaults(args) {
|
|
390
383
|
const clusterServiceArgs = setClusterServiceDefaults(args);
|
|
391
|
-
if (args.consensusAlgorithm === "BESU_QBFT") {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
};
|
|
401
|
-
}
|
|
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
|
+
};
|
|
402
393
|
return clusterServiceArgs;
|
|
403
394
|
}
|
|
404
395
|
|
|
@@ -583,26 +574,6 @@ const restartBlockchainNetwork = graphql(`
|
|
|
583
574
|
}
|
|
584
575
|
`, [BlockchainNetworkFragment]);
|
|
585
576
|
/**
|
|
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
|
-
/**
|
|
606
577
|
* Creates a function to list blockchain networks for a given application.
|
|
607
578
|
*
|
|
608
579
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -671,28 +642,6 @@ const blockchainNetworkRestart = (gqlClient) => async (blockchainNetworkUniqueNa
|
|
|
671
642
|
const { restartBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(restartBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
|
|
672
643
|
return blockchainNetwork;
|
|
673
644
|
};
|
|
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
|
-
};
|
|
696
645
|
|
|
697
646
|
//#endregion
|
|
698
647
|
//#region src/graphql/blockchain-node.ts
|
|
@@ -845,26 +794,6 @@ const restartBlockchainNode = graphql(`
|
|
|
845
794
|
}
|
|
846
795
|
`, [BlockchainNodeFragment]);
|
|
847
796
|
/**
|
|
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
|
-
/**
|
|
868
797
|
* Creates a function to list blockchain nodes for an application.
|
|
869
798
|
*
|
|
870
799
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -920,28 +849,6 @@ const blockchainNodeRestart = (gqlClient) => async (blockchainNodeUniqueName) =>
|
|
|
920
849
|
const { restartBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(restartBlockchainNode, { uniqueName: blockchainNodeUniqueName });
|
|
921
850
|
return blockchainNode;
|
|
922
851
|
};
|
|
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
|
-
};
|
|
945
852
|
|
|
946
853
|
//#endregion
|
|
947
854
|
//#region src/graphql/custom-deployment.ts
|
|
@@ -1046,26 +953,6 @@ const restartCustomDeployment = graphql(`
|
|
|
1046
953
|
}
|
|
1047
954
|
`, [CustomDeploymentFragment]);
|
|
1048
955
|
/**
|
|
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
|
-
/**
|
|
1069
956
|
* Creates a function to list custom deployments for an application.
|
|
1070
957
|
*
|
|
1071
958
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1136,28 +1023,6 @@ const customDeploymentRestart = (gqlClient) => async (customDeploymentUniqueName
|
|
|
1136
1023
|
const { restartCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(restartCustomDeployment, { uniqueName: customDeploymentUniqueName });
|
|
1137
1024
|
return customDeployment;
|
|
1138
1025
|
};
|
|
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
|
-
};
|
|
1161
1026
|
|
|
1162
1027
|
//#endregion
|
|
1163
1028
|
//#region src/graphql/foundry.ts
|
|
@@ -1266,26 +1131,6 @@ const restartLoadBalancer = graphql(`
|
|
|
1266
1131
|
}
|
|
1267
1132
|
`, [LoadBalancerFragment]);
|
|
1268
1133
|
/**
|
|
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
|
-
/**
|
|
1289
1134
|
* Creates a function to fetch a specific load balancer.
|
|
1290
1135
|
*
|
|
1291
1136
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1346,28 +1191,6 @@ const loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
|
|
|
1346
1191
|
const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, { uniqueName: loadBalancerUniqueName });
|
|
1347
1192
|
return loadBalancer;
|
|
1348
1193
|
};
|
|
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
|
-
};
|
|
1371
1194
|
|
|
1372
1195
|
//#endregion
|
|
1373
1196
|
//#region src/graphql/insights.ts
|
|
@@ -1460,26 +1283,6 @@ const restartInsights = graphql(`
|
|
|
1460
1283
|
}
|
|
1461
1284
|
`, [InsightsFragment]);
|
|
1462
1285
|
/**
|
|
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
|
-
/**
|
|
1483
1286
|
* Creates a function to list insights for an application.
|
|
1484
1287
|
*
|
|
1485
1288
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1517,8 +1320,8 @@ const insightsCreate = (gqlClient) => {
|
|
|
1517
1320
|
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName,...otherArgs } = args;
|
|
1518
1321
|
const [application, blockchainNode, loadBalancer] = await Promise.all([
|
|
1519
1322
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
1520
|
-
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(
|
|
1521
|
-
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(
|
|
1323
|
+
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(void 0),
|
|
1324
|
+
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(void 0)
|
|
1522
1325
|
]);
|
|
1523
1326
|
const { createInsights: insights } = await gqlClient.request(createInsights, {
|
|
1524
1327
|
...otherArgs,
|
|
@@ -1540,28 +1343,6 @@ const insightsRestart = (gqlClient) => async (insightsUniqueName) => {
|
|
|
1540
1343
|
const { restartInsightsByUniqueName: insights } = await gqlClient.request(restartInsights, { uniqueName: insightsUniqueName });
|
|
1541
1344
|
return insights;
|
|
1542
1345
|
};
|
|
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
|
-
};
|
|
1565
1346
|
|
|
1566
1347
|
//#endregion
|
|
1567
1348
|
//#region src/graphql/integration-tool.ts
|
|
@@ -1650,26 +1431,6 @@ const restartIntegrationTool = graphql(`
|
|
|
1650
1431
|
}
|
|
1651
1432
|
`, [IntegrationFragment]);
|
|
1652
1433
|
/**
|
|
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
|
-
/**
|
|
1673
1434
|
* Creates a function to list integration tools for an application.
|
|
1674
1435
|
*
|
|
1675
1436
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1724,28 +1485,6 @@ const integrationToolRestart = (gqlClient) => async (integrationUniqueName) => {
|
|
|
1724
1485
|
const { restartIntegrationByUniqueName: integration } = await gqlClient.request(restartIntegrationTool, { uniqueName: integrationUniqueName });
|
|
1725
1486
|
return integration;
|
|
1726
1487
|
};
|
|
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
|
-
};
|
|
1749
1488
|
|
|
1750
1489
|
//#endregion
|
|
1751
1490
|
//#region src/graphql/storage.ts
|
|
@@ -1834,26 +1573,6 @@ const restartStorage = graphql(`
|
|
|
1834
1573
|
}
|
|
1835
1574
|
`, [StorageFragment]);
|
|
1836
1575
|
/**
|
|
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
|
-
/**
|
|
1857
1576
|
* Creates a function to list storages for an application.
|
|
1858
1577
|
*
|
|
1859
1578
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1908,28 +1627,6 @@ const storageRestart = (gqlClient) => async (storageUniqueName) => {
|
|
|
1908
1627
|
const { restartStorageByUniqueName: storage } = await gqlClient.request(restartStorage, { uniqueName: storageUniqueName });
|
|
1909
1628
|
return storage;
|
|
1910
1629
|
};
|
|
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
|
-
};
|
|
1933
1630
|
|
|
1934
1631
|
//#endregion
|
|
1935
1632
|
//#region src/graphql/middleware.ts
|
|
@@ -2052,26 +1749,6 @@ const restartMiddleware = graphql(`
|
|
|
2052
1749
|
}
|
|
2053
1750
|
`, [MiddlewareFragment]);
|
|
2054
1751
|
/**
|
|
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
|
-
/**
|
|
2075
1752
|
* Creates a function to list middlewares for an application.
|
|
2076
1753
|
*
|
|
2077
1754
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -2125,9 +1802,9 @@ const middlewareCreate = (gqlClient) => {
|
|
|
2125
1802
|
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName,...otherArgs } = args;
|
|
2126
1803
|
const [application, blockchainNode, loadBalancer, storage] = await Promise.all([
|
|
2127
1804
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
2128
|
-
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(
|
|
2129
|
-
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(
|
|
2130
|
-
storageUniqueName ? storageRead(gqlClient)(storageUniqueName) : Promise.resolve(
|
|
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)
|
|
2131
1808
|
]);
|
|
2132
1809
|
const { createMiddleware: middleware } = await gqlClient.request(createMiddleware, {
|
|
2133
1810
|
...otherArgs,
|
|
@@ -2150,28 +1827,6 @@ const middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
|
|
|
2150
1827
|
const { restartMiddlewareByUniqueName: middleware } = await gqlClient.request(restartMiddleware, { uniqueName: middlewareUniqueName });
|
|
2151
1828
|
return middleware;
|
|
2152
1829
|
};
|
|
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
|
-
};
|
|
2175
1830
|
|
|
2176
1831
|
//#endregion
|
|
2177
1832
|
//#region src/graphql/platform.ts
|
|
@@ -2336,26 +1991,6 @@ const restartPrivateKey = graphql(`
|
|
|
2336
1991
|
}
|
|
2337
1992
|
`, [PrivateKeyFragment]);
|
|
2338
1993
|
/**
|
|
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
|
-
/**
|
|
2359
1994
|
* Creates a function to list private keys for an application.
|
|
2360
1995
|
*
|
|
2361
1996
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -2393,7 +2028,7 @@ const privateKeyCreate = (gqlClient) => {
|
|
|
2393
2028
|
const { applicationUniqueName, blockchainNodeUniqueNames, relayerKeyUniqueName,...otherArgs } = args;
|
|
2394
2029
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
2395
2030
|
const blockchainNodes = blockchainNodeUniqueNames ? await Promise.all(blockchainNodeUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName))) : [];
|
|
2396
|
-
const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) :
|
|
2031
|
+
const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) : void 0;
|
|
2397
2032
|
const platformConfig = await getPlatformConfig(gqlClient)();
|
|
2398
2033
|
const defaultProvider = platformConfig.deploymentEngineTargets.find((target) => !target.disabled && target.clusters.some((cluster) => !cluster.disabled));
|
|
2399
2034
|
const defaultRegion = defaultProvider?.clusters.find((cluster) => !cluster.disabled);
|
|
@@ -2421,28 +2056,6 @@ const privateKeyRestart = (gqlClient) => async (privateKeyUniqueName) => {
|
|
|
2421
2056
|
const { restartPrivateKeyByUniqueName: privateKey } = await gqlClient.request(restartPrivateKey, { uniqueName: privateKeyUniqueName });
|
|
2422
2057
|
return privateKey;
|
|
2423
2058
|
};
|
|
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
|
-
};
|
|
2446
2059
|
|
|
2447
2060
|
//#endregion
|
|
2448
2061
|
//#region src/helpers/client-options.schema.ts
|
|
@@ -2480,9 +2093,7 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
|
|
|
2480
2093
|
}
|
|
2481
2094
|
});
|
|
2482
2095
|
if (!response.ok) {
|
|
2483
|
-
if (response.status === 404) {
|
|
2484
|
-
throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
|
|
2485
|
-
}
|
|
2096
|
+
if (response.status === 404) throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
|
|
2486
2097
|
throw new Error("Failed to get verification challenge");
|
|
2487
2098
|
}
|
|
2488
2099
|
const verificationChallenges = await response.json();
|
|
@@ -2495,9 +2106,7 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
|
|
|
2495
2106
|
* @returns The pincode verification challenge response.
|
|
2496
2107
|
*/
|
|
2497
2108
|
function getPincodeVerificationChallengeResponse({ verificationChallenge, pincode }) {
|
|
2498
|
-
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt)
|
|
2499
|
-
throw new Error("Could not authenticate pin code, invalid challenge format");
|
|
2500
|
-
}
|
|
2109
|
+
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) throw new Error("Could not authenticate pin code, invalid challenge format");
|
|
2501
2110
|
const { secret, salt } = verificationChallenge.challenge;
|
|
2502
2111
|
return generateResponse(pincode, salt, secret);
|
|
2503
2112
|
}
|
|
@@ -2530,13 +2139,8 @@ function getPincodeVerificationChallengeResponse({ verificationChallenge, pincod
|
|
|
2530
2139
|
*/
|
|
2531
2140
|
function createSettleMintClient(options) {
|
|
2532
2141
|
ensureServer();
|
|
2533
|
-
if (options.instance === STANDALONE_INSTANCE || options.instance === LOCAL_INSTANCE)
|
|
2534
|
-
|
|
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
|
-
}
|
|
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");
|
|
2540
2144
|
const validatedOptions = options.anonymous ? validate(z.object({
|
|
2541
2145
|
...ClientOptionsSchema.shape,
|
|
2542
2146
|
accessToken: z.literal("")
|
|
@@ -2576,75 +2180,57 @@ function createSettleMintClient(options) {
|
|
|
2576
2180
|
read: blockchainNetworkRead(gqlClient),
|
|
2577
2181
|
create: blockchainNetworkCreate(gqlClient),
|
|
2578
2182
|
delete: blockchainNetworkDelete(gqlClient),
|
|
2579
|
-
restart: blockchainNetworkRestart(gqlClient)
|
|
2580
|
-
pause: blockchainNetworkPause(gqlClient),
|
|
2581
|
-
resume: blockchainNetworkResume(gqlClient)
|
|
2183
|
+
restart: blockchainNetworkRestart(gqlClient)
|
|
2582
2184
|
},
|
|
2583
2185
|
blockchainNode: {
|
|
2584
2186
|
list: blockchainNodeList(gqlClient),
|
|
2585
2187
|
read: blockchainNodeRead(gqlClient),
|
|
2586
2188
|
create: blockchainNodeCreate(gqlClient),
|
|
2587
|
-
restart: blockchainNodeRestart(gqlClient)
|
|
2588
|
-
pause: blockchainNodePause(gqlClient),
|
|
2589
|
-
resume: blockchainNodeResume(gqlClient)
|
|
2189
|
+
restart: blockchainNodeRestart(gqlClient)
|
|
2590
2190
|
},
|
|
2591
2191
|
loadBalancer: {
|
|
2592
2192
|
list: loadBalancerList(gqlClient),
|
|
2593
2193
|
read: loadBalancerRead(gqlClient),
|
|
2594
2194
|
create: loadBalancerCreate(gqlClient),
|
|
2595
|
-
restart: loadBalancerRestart(gqlClient)
|
|
2596
|
-
pause: loadBalancerPause(gqlClient),
|
|
2597
|
-
resume: loadBalancerResume(gqlClient)
|
|
2195
|
+
restart: loadBalancerRestart(gqlClient)
|
|
2598
2196
|
},
|
|
2599
2197
|
middleware: {
|
|
2600
2198
|
list: middlewareList(gqlClient),
|
|
2601
2199
|
read: middlewareRead(gqlClient),
|
|
2602
2200
|
graphSubgraphs: graphMiddlewareSubgraphs(gqlClient),
|
|
2603
2201
|
create: middlewareCreate(gqlClient),
|
|
2604
|
-
restart: middlewareRestart(gqlClient)
|
|
2605
|
-
pause: middlewarePause(gqlClient),
|
|
2606
|
-
resume: middlewareResume(gqlClient)
|
|
2202
|
+
restart: middlewareRestart(gqlClient)
|
|
2607
2203
|
},
|
|
2608
2204
|
integrationTool: {
|
|
2609
2205
|
list: integrationToolList(gqlClient),
|
|
2610
2206
|
read: integrationToolRead(gqlClient),
|
|
2611
2207
|
create: integrationToolCreate(gqlClient),
|
|
2612
|
-
restart: integrationToolRestart(gqlClient)
|
|
2613
|
-
pause: integrationToolPause(gqlClient),
|
|
2614
|
-
resume: integrationToolResume(gqlClient)
|
|
2208
|
+
restart: integrationToolRestart(gqlClient)
|
|
2615
2209
|
},
|
|
2616
2210
|
storage: {
|
|
2617
2211
|
list: storageList(gqlClient),
|
|
2618
2212
|
read: storageRead(gqlClient),
|
|
2619
2213
|
create: storageCreate(gqlClient),
|
|
2620
|
-
restart: storageRestart(gqlClient)
|
|
2621
|
-
pause: storagePause(gqlClient),
|
|
2622
|
-
resume: storageResume(gqlClient)
|
|
2214
|
+
restart: storageRestart(gqlClient)
|
|
2623
2215
|
},
|
|
2624
2216
|
privateKey: {
|
|
2625
2217
|
list: privateKeyList(gqlClient),
|
|
2626
2218
|
read: privatekeyRead(gqlClient),
|
|
2627
2219
|
create: privateKeyCreate(gqlClient),
|
|
2628
|
-
restart: privateKeyRestart(gqlClient)
|
|
2629
|
-
pause: privateKeyPause(gqlClient),
|
|
2630
|
-
resume: privateKeyResume(gqlClient)
|
|
2220
|
+
restart: privateKeyRestart(gqlClient)
|
|
2631
2221
|
},
|
|
2632
2222
|
insights: {
|
|
2633
2223
|
list: insightsList(gqlClient),
|
|
2634
2224
|
read: insightsRead(gqlClient),
|
|
2635
2225
|
create: insightsCreate(gqlClient),
|
|
2636
|
-
restart: insightsRestart(gqlClient)
|
|
2637
|
-
pause: insightsPause(gqlClient),
|
|
2638
|
-
resume: insightsResume(gqlClient)
|
|
2226
|
+
restart: insightsRestart(gqlClient)
|
|
2639
2227
|
},
|
|
2640
2228
|
customDeployment: {
|
|
2641
2229
|
list: customdeploymentList(gqlClient),
|
|
2642
2230
|
read: customdeploymentRead(gqlClient),
|
|
2643
2231
|
create: customdeploymentCreate(gqlClient),
|
|
2644
2232
|
update: customdeploymentUpdate(gqlClient),
|
|
2645
|
-
restart: customDeploymentRestart(gqlClient)
|
|
2646
|
-
pause: customDeploymentPause(gqlClient),
|
|
2647
|
-
resume: customDeploymentResume(gqlClient)
|
|
2233
|
+
restart: customDeploymentRestart(gqlClient)
|
|
2648
2234
|
},
|
|
2649
2235
|
foundry: { env: getEnv(gqlClient) },
|
|
2650
2236
|
applicationAccessToken: { create: applicationAccessTokenCreate(gqlClient) },
|