@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.
- package/README.md +19 -19
- package/dist/settlemint.cjs +445 -31
- package/dist/settlemint.cjs.map +1 -1
- package/dist/settlemint.d.cts +48806 -6433
- package/dist/settlemint.d.ts +48781 -6409
- package/dist/settlemint.js +445 -31
- package/dist/settlemint.js.map +1 -1
- package/package.json +5 -3
package/dist/settlemint.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* SettleMint SDK - Main Package */
|
|
1
2
|
//#region rolldown:runtime
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -141,7 +142,9 @@ const workspaceList = (gqlClient) => {
|
|
|
141
142
|
const { workspaces } = await gqlClient.request(getWorkspacesAndApplications);
|
|
142
143
|
const allWorkspaces = workspaces.reduce((acc, workspace) => {
|
|
143
144
|
acc.push(workspace);
|
|
144
|
-
if (workspace.childWorkspaces)
|
|
145
|
+
if (workspace.childWorkspaces) {
|
|
146
|
+
acc.push(...workspace.childWorkspaces);
|
|
147
|
+
}
|
|
145
148
|
return acc;
|
|
146
149
|
}, []);
|
|
147
150
|
return allWorkspaces.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -196,7 +199,9 @@ const workspaceDelete = (gqlClient) => {
|
|
|
196
199
|
const workspaceAddCredits = (gqlClient) => {
|
|
197
200
|
return async (workspaceId, amount) => {
|
|
198
201
|
const id = (0, __settlemint_sdk_utils_validation.validate)(__settlemint_sdk_utils_validation.IdSchema, workspaceId);
|
|
199
|
-
if (amount <= 0)
|
|
202
|
+
if (amount <= 0) {
|
|
203
|
+
throw new Error("Credit amount must be a positive number");
|
|
204
|
+
}
|
|
200
205
|
const { addCredits: result } = await gqlClient.request(addCredits, {
|
|
201
206
|
workspaceId: id,
|
|
202
207
|
amount
|
|
@@ -373,7 +378,9 @@ const applicationAccessTokenCreate = (gqlClient) => {
|
|
|
373
378
|
...otherArgs,
|
|
374
379
|
applicationId: application.id
|
|
375
380
|
});
|
|
376
|
-
if (!applicationAccessToken.token)
|
|
381
|
+
if (!applicationAccessToken.token) {
|
|
382
|
+
throw new Error("Failed to create application access token");
|
|
383
|
+
}
|
|
377
384
|
return applicationAccessToken.token;
|
|
378
385
|
};
|
|
379
386
|
};
|
|
@@ -404,15 +411,17 @@ function setClusterServiceDefaults(args) {
|
|
|
404
411
|
*/
|
|
405
412
|
function setNetworkDefaults(args) {
|
|
406
413
|
const clusterServiceArgs = setClusterServiceDefaults(args);
|
|
407
|
-
if (args.consensusAlgorithm === "BESU_QBFT")
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
if (args.consensusAlgorithm === "BESU_QBFT") {
|
|
415
|
+
return {
|
|
416
|
+
...clusterServiceArgs,
|
|
417
|
+
chainId: args.chainId ?? 46040,
|
|
418
|
+
contractSizeLimit: args.contractSizeLimit ?? 2147483647,
|
|
419
|
+
evmStackSize: args.evmStackSize ?? 2048,
|
|
420
|
+
gasLimit: args.gasLimit ?? "9007199254740991",
|
|
421
|
+
gasPrice: args.gasPrice ?? 0,
|
|
422
|
+
secondsPerBlock: args.secondsPerBlock ?? 2
|
|
423
|
+
};
|
|
424
|
+
}
|
|
416
425
|
return clusterServiceArgs;
|
|
417
426
|
}
|
|
418
427
|
|
|
@@ -597,6 +606,26 @@ const restartBlockchainNetwork = graphql(`
|
|
|
597
606
|
}
|
|
598
607
|
`, [BlockchainNetworkFragment]);
|
|
599
608
|
/**
|
|
609
|
+
* Mutation to pause a blockchain network.
|
|
610
|
+
*/
|
|
611
|
+
const pauseBlockchainNetwork = graphql(`
|
|
612
|
+
mutation PauseBlockchainNetwork($uniqueName: String!) {
|
|
613
|
+
pauseBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
|
|
614
|
+
...BlockchainNetwork
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
`, [BlockchainNetworkFragment]);
|
|
618
|
+
/**
|
|
619
|
+
* Mutation to resume a blockchain network.
|
|
620
|
+
*/
|
|
621
|
+
const resumeBlockchainNetwork = graphql(`
|
|
622
|
+
mutation ResumeBlockchainNetwork($uniqueName: String!) {
|
|
623
|
+
resumeBlockchainNetworkByUniqueName(uniqueName: $uniqueName) {
|
|
624
|
+
...BlockchainNetwork
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
`, [BlockchainNetworkFragment]);
|
|
628
|
+
/**
|
|
600
629
|
* Creates a function to list blockchain networks for a given application.
|
|
601
630
|
*
|
|
602
631
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -665,6 +694,28 @@ const blockchainNetworkRestart = (gqlClient) => async (blockchainNetworkUniqueNa
|
|
|
665
694
|
const { restartBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(restartBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
|
|
666
695
|
return blockchainNetwork;
|
|
667
696
|
};
|
|
697
|
+
/**
|
|
698
|
+
* Creates a function to pause a blockchain network.
|
|
699
|
+
*
|
|
700
|
+
* @param gqlClient - The GraphQL client instance
|
|
701
|
+
* @returns Function that pauses a network by unique name
|
|
702
|
+
* @throws If the network cannot be found or the pause fails
|
|
703
|
+
*/
|
|
704
|
+
const blockchainNetworkPause = (gqlClient) => async (blockchainNetworkUniqueName) => {
|
|
705
|
+
const { pauseBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(pauseBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
|
|
706
|
+
return blockchainNetwork;
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Creates a function to resume a blockchain network.
|
|
710
|
+
*
|
|
711
|
+
* @param gqlClient - The GraphQL client instance
|
|
712
|
+
* @returns Function that resumes a network by unique name
|
|
713
|
+
* @throws If the network cannot be found or the resume fails
|
|
714
|
+
*/
|
|
715
|
+
const blockchainNetworkResume = (gqlClient) => async (blockchainNetworkUniqueName) => {
|
|
716
|
+
const { resumeBlockchainNetworkByUniqueName: blockchainNetwork } = await gqlClient.request(resumeBlockchainNetwork, { uniqueName: blockchainNetworkUniqueName });
|
|
717
|
+
return blockchainNetwork;
|
|
718
|
+
};
|
|
668
719
|
|
|
669
720
|
//#endregion
|
|
670
721
|
//#region src/graphql/blockchain-node.ts
|
|
@@ -817,6 +868,26 @@ const restartBlockchainNode = graphql(`
|
|
|
817
868
|
}
|
|
818
869
|
`, [BlockchainNodeFragment]);
|
|
819
870
|
/**
|
|
871
|
+
* Mutation to pause a blockchain node.
|
|
872
|
+
*/
|
|
873
|
+
const pauseBlockchainNode = graphql(`
|
|
874
|
+
mutation PauseBlockchainNode($uniqueName: String!) {
|
|
875
|
+
pauseBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
|
|
876
|
+
...BlockchainNode
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
`, [BlockchainNodeFragment]);
|
|
880
|
+
/**
|
|
881
|
+
* Mutation to resume a blockchain node.
|
|
882
|
+
*/
|
|
883
|
+
const resumeBlockchainNode = graphql(`
|
|
884
|
+
mutation ResumeBlockchainNode($uniqueName: String!) {
|
|
885
|
+
resumeBlockchainNodeByUniqueName(uniqueName: $uniqueName) {
|
|
886
|
+
...BlockchainNode
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
`, [BlockchainNodeFragment]);
|
|
890
|
+
/**
|
|
820
891
|
* Creates a function to list blockchain nodes for an application.
|
|
821
892
|
*
|
|
822
893
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -872,6 +943,28 @@ const blockchainNodeRestart = (gqlClient) => async (blockchainNodeUniqueName) =>
|
|
|
872
943
|
const { restartBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(restartBlockchainNode, { uniqueName: blockchainNodeUniqueName });
|
|
873
944
|
return blockchainNode;
|
|
874
945
|
};
|
|
946
|
+
/**
|
|
947
|
+
* Creates a function to pause a blockchain node.
|
|
948
|
+
*
|
|
949
|
+
* @param gqlClient - The GraphQL client instance
|
|
950
|
+
* @returns Function that pauses a blockchain node by unique name
|
|
951
|
+
* @throws If the blockchain node cannot be found or the pause fails
|
|
952
|
+
*/
|
|
953
|
+
const blockchainNodePause = (gqlClient) => async (blockchainNodeUniqueName) => {
|
|
954
|
+
const { pauseBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(pauseBlockchainNode, { uniqueName: blockchainNodeUniqueName });
|
|
955
|
+
return blockchainNode;
|
|
956
|
+
};
|
|
957
|
+
/**
|
|
958
|
+
* Creates a function to resume a blockchain node.
|
|
959
|
+
*
|
|
960
|
+
* @param gqlClient - The GraphQL client instance
|
|
961
|
+
* @returns Function that resumes a blockchain node by unique name
|
|
962
|
+
* @throws If the blockchain node cannot be found or the resume fails
|
|
963
|
+
*/
|
|
964
|
+
const blockchainNodeResume = (gqlClient) => async (blockchainNodeUniqueName) => {
|
|
965
|
+
const { resumeBlockchainNodeByUniqueName: blockchainNode } = await gqlClient.request(resumeBlockchainNode, { uniqueName: blockchainNodeUniqueName });
|
|
966
|
+
return blockchainNode;
|
|
967
|
+
};
|
|
875
968
|
|
|
876
969
|
//#endregion
|
|
877
970
|
//#region src/graphql/custom-deployment.ts
|
|
@@ -976,6 +1069,26 @@ const restartCustomDeployment = graphql(`
|
|
|
976
1069
|
}
|
|
977
1070
|
`, [CustomDeploymentFragment]);
|
|
978
1071
|
/**
|
|
1072
|
+
* Mutation to pause a custom deployment.
|
|
1073
|
+
*/
|
|
1074
|
+
const pauseCustomDeployment = graphql(`
|
|
1075
|
+
mutation PauseCustomDeployment($uniqueName: String!) {
|
|
1076
|
+
pauseCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
|
|
1077
|
+
...CustomDeployment
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
`, [CustomDeploymentFragment]);
|
|
1081
|
+
/**
|
|
1082
|
+
* Mutation to resume a custom deployment.
|
|
1083
|
+
*/
|
|
1084
|
+
const resumeCustomDeployment = graphql(`
|
|
1085
|
+
mutation ResumeCustomDeployment($uniqueName: String!) {
|
|
1086
|
+
resumeCustomDeploymentByUniqueName(uniqueName: $uniqueName) {
|
|
1087
|
+
...CustomDeployment
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
`, [CustomDeploymentFragment]);
|
|
1091
|
+
/**
|
|
979
1092
|
* Creates a function to list custom deployments for an application.
|
|
980
1093
|
*
|
|
981
1094
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1046,6 +1159,28 @@ const customDeploymentRestart = (gqlClient) => async (customDeploymentUniqueName
|
|
|
1046
1159
|
const { restartCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(restartCustomDeployment, { uniqueName: customDeploymentUniqueName });
|
|
1047
1160
|
return customDeployment;
|
|
1048
1161
|
};
|
|
1162
|
+
/**
|
|
1163
|
+
* Creates a function to pause a custom deployment.
|
|
1164
|
+
*
|
|
1165
|
+
* @param gqlClient - The GraphQL client instance
|
|
1166
|
+
* @returns Function that pauses a custom deployment by unique name
|
|
1167
|
+
* @throws If the custom deployment cannot be found or the pause fails
|
|
1168
|
+
*/
|
|
1169
|
+
const customDeploymentPause = (gqlClient) => async (customDeploymentUniqueName) => {
|
|
1170
|
+
const { pauseCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(pauseCustomDeployment, { uniqueName: customDeploymentUniqueName });
|
|
1171
|
+
return customDeployment;
|
|
1172
|
+
};
|
|
1173
|
+
/**
|
|
1174
|
+
* Creates a function to resume a custom deployment.
|
|
1175
|
+
*
|
|
1176
|
+
* @param gqlClient - The GraphQL client instance
|
|
1177
|
+
* @returns Function that resumes a custom deployment by unique name
|
|
1178
|
+
* @throws If the custom deployment cannot be found or the resume fails
|
|
1179
|
+
*/
|
|
1180
|
+
const customDeploymentResume = (gqlClient) => async (customDeploymentUniqueName) => {
|
|
1181
|
+
const { resumeCustomDeploymentByUniqueName: customDeployment } = await gqlClient.request(resumeCustomDeployment, { uniqueName: customDeploymentUniqueName });
|
|
1182
|
+
return customDeployment;
|
|
1183
|
+
};
|
|
1049
1184
|
|
|
1050
1185
|
//#endregion
|
|
1051
1186
|
//#region src/graphql/foundry.ts
|
|
@@ -1154,6 +1289,26 @@ const restartLoadBalancer = graphql(`
|
|
|
1154
1289
|
}
|
|
1155
1290
|
`, [LoadBalancerFragment]);
|
|
1156
1291
|
/**
|
|
1292
|
+
* Mutation to pause a load balancer.
|
|
1293
|
+
*/
|
|
1294
|
+
const pauseLoadBalancer = graphql(`
|
|
1295
|
+
mutation PauseLoadBalancer($uniqueName: String!) {
|
|
1296
|
+
pauseLoadBalancerByUniqueName(uniqueName: $uniqueName) {
|
|
1297
|
+
...LoadBalancer
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
`, [LoadBalancerFragment]);
|
|
1301
|
+
/**
|
|
1302
|
+
* Mutation to resume a load balancer.
|
|
1303
|
+
*/
|
|
1304
|
+
const resumeLoadBalancer = graphql(`
|
|
1305
|
+
mutation ResumeLoadBalancer($uniqueName: String!) {
|
|
1306
|
+
resumeLoadBalancerByUniqueName(uniqueName: $uniqueName) {
|
|
1307
|
+
...LoadBalancer
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
`, [LoadBalancerFragment]);
|
|
1311
|
+
/**
|
|
1157
1312
|
* Creates a function to fetch a specific load balancer.
|
|
1158
1313
|
*
|
|
1159
1314
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1214,6 +1369,28 @@ const loadBalancerRestart = (gqlClient) => async (loadBalancerUniqueName) => {
|
|
|
1214
1369
|
const { restartLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(restartLoadBalancer, { uniqueName: loadBalancerUniqueName });
|
|
1215
1370
|
return loadBalancer;
|
|
1216
1371
|
};
|
|
1372
|
+
/**
|
|
1373
|
+
* Creates a function to pause a load balancer.
|
|
1374
|
+
*
|
|
1375
|
+
* @param gqlClient - The GraphQL client instance
|
|
1376
|
+
* @returns Function that pauses a load balancer
|
|
1377
|
+
* @throws If the load balancer cannot be paused or the request fails
|
|
1378
|
+
*/
|
|
1379
|
+
const loadBalancerPause = (gqlClient) => async (loadBalancerUniqueName) => {
|
|
1380
|
+
const { pauseLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(pauseLoadBalancer, { uniqueName: loadBalancerUniqueName });
|
|
1381
|
+
return loadBalancer;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* Creates a function to resume a load balancer.
|
|
1385
|
+
*
|
|
1386
|
+
* @param gqlClient - The GraphQL client instance
|
|
1387
|
+
* @returns Function that resumes a load balancer
|
|
1388
|
+
* @throws If the load balancer cannot be resumed or the request fails
|
|
1389
|
+
*/
|
|
1390
|
+
const loadBalancerResume = (gqlClient) => async (loadBalancerUniqueName) => {
|
|
1391
|
+
const { resumeLoadBalancerByUniqueName: loadBalancer } = await gqlClient.request(resumeLoadBalancer, { uniqueName: loadBalancerUniqueName });
|
|
1392
|
+
return loadBalancer;
|
|
1393
|
+
};
|
|
1217
1394
|
|
|
1218
1395
|
//#endregion
|
|
1219
1396
|
//#region src/graphql/insights.ts
|
|
@@ -1306,6 +1483,26 @@ const restartInsights = graphql(`
|
|
|
1306
1483
|
}
|
|
1307
1484
|
`, [InsightsFragment]);
|
|
1308
1485
|
/**
|
|
1486
|
+
* Mutation to pause insights.
|
|
1487
|
+
*/
|
|
1488
|
+
const pauseInsights = graphql(`
|
|
1489
|
+
mutation PauseInsights($uniqueName: String!) {
|
|
1490
|
+
pauseInsightsByUniqueName(uniqueName: $uniqueName) {
|
|
1491
|
+
...Insights
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
`, [InsightsFragment]);
|
|
1495
|
+
/**
|
|
1496
|
+
* Mutation to resume insights.
|
|
1497
|
+
*/
|
|
1498
|
+
const resumeInsights = graphql(`
|
|
1499
|
+
mutation ResumeInsights($uniqueName: String!) {
|
|
1500
|
+
resumeInsightsByUniqueName(uniqueName: $uniqueName) {
|
|
1501
|
+
...Insights
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
`, [InsightsFragment]);
|
|
1505
|
+
/**
|
|
1309
1506
|
* Creates a function to list insights for an application.
|
|
1310
1507
|
*
|
|
1311
1508
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1343,8 +1540,8 @@ const insightsCreate = (gqlClient) => {
|
|
|
1343
1540
|
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName,...otherArgs } = args;
|
|
1344
1541
|
const [application, blockchainNode, loadBalancer] = await Promise.all([
|
|
1345
1542
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
1346
|
-
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(
|
|
1347
|
-
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(
|
|
1543
|
+
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
|
|
1544
|
+
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(undefined)
|
|
1348
1545
|
]);
|
|
1349
1546
|
const { createInsights: insights } = await gqlClient.request(createInsights, {
|
|
1350
1547
|
...otherArgs,
|
|
@@ -1366,6 +1563,28 @@ const insightsRestart = (gqlClient) => async (insightsUniqueName) => {
|
|
|
1366
1563
|
const { restartInsightsByUniqueName: insights } = await gqlClient.request(restartInsights, { uniqueName: insightsUniqueName });
|
|
1367
1564
|
return insights;
|
|
1368
1565
|
};
|
|
1566
|
+
/**
|
|
1567
|
+
* Creates a function to pause insights.
|
|
1568
|
+
*
|
|
1569
|
+
* @param gqlClient - The GraphQL client instance
|
|
1570
|
+
* @returns Function that pauses insights by unique name
|
|
1571
|
+
* @throws If the insights cannot be found or the pause fails
|
|
1572
|
+
*/
|
|
1573
|
+
const insightsPause = (gqlClient) => async (insightsUniqueName) => {
|
|
1574
|
+
const { pauseInsightsByUniqueName: insights } = await gqlClient.request(pauseInsights, { uniqueName: insightsUniqueName });
|
|
1575
|
+
return insights;
|
|
1576
|
+
};
|
|
1577
|
+
/**
|
|
1578
|
+
* Creates a function to resume insights.
|
|
1579
|
+
*
|
|
1580
|
+
* @param gqlClient - The GraphQL client instance
|
|
1581
|
+
* @returns Function that resumes insights by unique name
|
|
1582
|
+
* @throws If the insights cannot be found or the resume fails
|
|
1583
|
+
*/
|
|
1584
|
+
const insightsResume = (gqlClient) => async (insightsUniqueName) => {
|
|
1585
|
+
const { resumeInsightsByUniqueName: insights } = await gqlClient.request(resumeInsights, { uniqueName: insightsUniqueName });
|
|
1586
|
+
return insights;
|
|
1587
|
+
};
|
|
1369
1588
|
|
|
1370
1589
|
//#endregion
|
|
1371
1590
|
//#region src/graphql/integration-tool.ts
|
|
@@ -1454,6 +1673,26 @@ const restartIntegrationTool = graphql(`
|
|
|
1454
1673
|
}
|
|
1455
1674
|
`, [IntegrationFragment]);
|
|
1456
1675
|
/**
|
|
1676
|
+
* Mutation to pause an integration.
|
|
1677
|
+
*/
|
|
1678
|
+
const pauseIntegrationTool = graphql(`
|
|
1679
|
+
mutation PauseIntegrationTool($uniqueName: String!) {
|
|
1680
|
+
pauseIntegrationByUniqueName(uniqueName: $uniqueName) {
|
|
1681
|
+
...Integration
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
`, [IntegrationFragment]);
|
|
1685
|
+
/**
|
|
1686
|
+
* Mutation to resume an integration.
|
|
1687
|
+
*/
|
|
1688
|
+
const resumeIntegrationTool = graphql(`
|
|
1689
|
+
mutation ResumeIntegrationTool($uniqueName: String!) {
|
|
1690
|
+
resumeIntegrationByUniqueName(uniqueName: $uniqueName) {
|
|
1691
|
+
...Integration
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
`, [IntegrationFragment]);
|
|
1695
|
+
/**
|
|
1457
1696
|
* Creates a function to list integration tools for an application.
|
|
1458
1697
|
*
|
|
1459
1698
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1508,6 +1747,28 @@ const integrationToolRestart = (gqlClient) => async (integrationUniqueName) => {
|
|
|
1508
1747
|
const { restartIntegrationByUniqueName: integration } = await gqlClient.request(restartIntegrationTool, { uniqueName: integrationUniqueName });
|
|
1509
1748
|
return integration;
|
|
1510
1749
|
};
|
|
1750
|
+
/**
|
|
1751
|
+
* Creates a function to pause an integration tool.
|
|
1752
|
+
*
|
|
1753
|
+
* @param gqlClient - The GraphQL client instance
|
|
1754
|
+
* @returns Function that pauses integration tool by unique name
|
|
1755
|
+
* @throws If the integration tool cannot be found or the pause fails
|
|
1756
|
+
*/
|
|
1757
|
+
const integrationToolPause = (gqlClient) => async (integrationUniqueName) => {
|
|
1758
|
+
const { pauseIntegrationByUniqueName: integration } = await gqlClient.request(pauseIntegrationTool, { uniqueName: integrationUniqueName });
|
|
1759
|
+
return integration;
|
|
1760
|
+
};
|
|
1761
|
+
/**
|
|
1762
|
+
* Creates a function to resume an integration tool.
|
|
1763
|
+
*
|
|
1764
|
+
* @param gqlClient - The GraphQL client instance
|
|
1765
|
+
* @returns Function that resumes integration tool by unique name
|
|
1766
|
+
* @throws If the integration tool cannot be found or the resume fails
|
|
1767
|
+
*/
|
|
1768
|
+
const integrationToolResume = (gqlClient) => async (integrationUniqueName) => {
|
|
1769
|
+
const { resumeIntegrationByUniqueName: integration } = await gqlClient.request(resumeIntegrationTool, { uniqueName: integrationUniqueName });
|
|
1770
|
+
return integration;
|
|
1771
|
+
};
|
|
1511
1772
|
|
|
1512
1773
|
//#endregion
|
|
1513
1774
|
//#region src/graphql/storage.ts
|
|
@@ -1596,6 +1857,26 @@ const restartStorage = graphql(`
|
|
|
1596
1857
|
}
|
|
1597
1858
|
`, [StorageFragment]);
|
|
1598
1859
|
/**
|
|
1860
|
+
* Mutation to pause a storage.
|
|
1861
|
+
*/
|
|
1862
|
+
const pauseStorage = graphql(`
|
|
1863
|
+
mutation PauseStorage($uniqueName: String!) {
|
|
1864
|
+
pauseStorageByUniqueName(uniqueName: $uniqueName) {
|
|
1865
|
+
...Storage
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
`, [StorageFragment]);
|
|
1869
|
+
/**
|
|
1870
|
+
* Mutation to resume a storage.
|
|
1871
|
+
*/
|
|
1872
|
+
const resumeStorage = graphql(`
|
|
1873
|
+
mutation ResumeStorage($uniqueName: String!) {
|
|
1874
|
+
resumeStorageByUniqueName(uniqueName: $uniqueName) {
|
|
1875
|
+
...Storage
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
`, [StorageFragment]);
|
|
1879
|
+
/**
|
|
1599
1880
|
* Creates a function to list storages for an application.
|
|
1600
1881
|
*
|
|
1601
1882
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1650,6 +1931,28 @@ const storageRestart = (gqlClient) => async (storageUniqueName) => {
|
|
|
1650
1931
|
const { restartStorageByUniqueName: storage } = await gqlClient.request(restartStorage, { uniqueName: storageUniqueName });
|
|
1651
1932
|
return storage;
|
|
1652
1933
|
};
|
|
1934
|
+
/**
|
|
1935
|
+
* Creates a function to pause a storage.
|
|
1936
|
+
*
|
|
1937
|
+
* @param gqlClient - The GraphQL client instance
|
|
1938
|
+
* @returns Function that pauses storage by unique name
|
|
1939
|
+
* @throws If the storage cannot be found or the pause fails
|
|
1940
|
+
*/
|
|
1941
|
+
const storagePause = (gqlClient) => async (storageUniqueName) => {
|
|
1942
|
+
const { pauseStorageByUniqueName: storage } = await gqlClient.request(pauseStorage, { uniqueName: storageUniqueName });
|
|
1943
|
+
return storage;
|
|
1944
|
+
};
|
|
1945
|
+
/**
|
|
1946
|
+
* Creates a function to resume a storage.
|
|
1947
|
+
*
|
|
1948
|
+
* @param gqlClient - The GraphQL client instance
|
|
1949
|
+
* @returns Function that resumes storage by unique name
|
|
1950
|
+
* @throws If the storage cannot be found or the resume fails
|
|
1951
|
+
*/
|
|
1952
|
+
const storageResume = (gqlClient) => async (storageUniqueName) => {
|
|
1953
|
+
const { resumeStorageByUniqueName: storage } = await gqlClient.request(resumeStorage, { uniqueName: storageUniqueName });
|
|
1954
|
+
return storage;
|
|
1955
|
+
};
|
|
1653
1956
|
|
|
1654
1957
|
//#endregion
|
|
1655
1958
|
//#region src/graphql/middleware.ts
|
|
@@ -1772,6 +2075,26 @@ const restartMiddleware = graphql(`
|
|
|
1772
2075
|
}
|
|
1773
2076
|
`, [MiddlewareFragment]);
|
|
1774
2077
|
/**
|
|
2078
|
+
* Mutation to pause a middleware.
|
|
2079
|
+
*/
|
|
2080
|
+
const pauseMiddleware = graphql(`
|
|
2081
|
+
mutation PauseMiddleware($uniqueName: String!) {
|
|
2082
|
+
pauseMiddlewareByUniqueName(uniqueName: $uniqueName) {
|
|
2083
|
+
...Middleware
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
`, [MiddlewareFragment]);
|
|
2087
|
+
/**
|
|
2088
|
+
* Mutation to resume a middleware.
|
|
2089
|
+
*/
|
|
2090
|
+
const resumeMiddleware = graphql(`
|
|
2091
|
+
mutation ResumeMiddleware($uniqueName: String!) {
|
|
2092
|
+
resumeMiddlewareByUniqueName(uniqueName: $uniqueName) {
|
|
2093
|
+
...Middleware
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
`, [MiddlewareFragment]);
|
|
2097
|
+
/**
|
|
1775
2098
|
* Creates a function to list middlewares for an application.
|
|
1776
2099
|
*
|
|
1777
2100
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -1825,9 +2148,9 @@ const middlewareCreate = (gqlClient) => {
|
|
|
1825
2148
|
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName,...otherArgs } = args;
|
|
1826
2149
|
const [application, blockchainNode, loadBalancer, storage] = await Promise.all([
|
|
1827
2150
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
1828
|
-
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(
|
|
1829
|
-
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(
|
|
1830
|
-
storageUniqueName ? storageRead(gqlClient)(storageUniqueName) : Promise.resolve(
|
|
2151
|
+
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
|
|
2152
|
+
loadBalancerUniqueName ? loadBalancerRead(gqlClient)(loadBalancerUniqueName) : Promise.resolve(undefined),
|
|
2153
|
+
storageUniqueName ? storageRead(gqlClient)(storageUniqueName) : Promise.resolve(undefined)
|
|
1831
2154
|
]);
|
|
1832
2155
|
const { createMiddleware: middleware } = await gqlClient.request(createMiddleware, {
|
|
1833
2156
|
...otherArgs,
|
|
@@ -1850,6 +2173,28 @@ const middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
|
|
|
1850
2173
|
const { restartMiddlewareByUniqueName: middleware } = await gqlClient.request(restartMiddleware, { uniqueName: middlewareUniqueName });
|
|
1851
2174
|
return middleware;
|
|
1852
2175
|
};
|
|
2176
|
+
/**
|
|
2177
|
+
* Creates a function to pause a middleware.
|
|
2178
|
+
*
|
|
2179
|
+
* @param gqlClient - The GraphQL client instance
|
|
2180
|
+
* @returns Function that pauses middleware by unique name
|
|
2181
|
+
* @throws If the middleware cannot be found or the pause fails
|
|
2182
|
+
*/
|
|
2183
|
+
const middlewarePause = (gqlClient) => async (middlewareUniqueName) => {
|
|
2184
|
+
const { pauseMiddlewareByUniqueName: middleware } = await gqlClient.request(pauseMiddleware, { uniqueName: middlewareUniqueName });
|
|
2185
|
+
return middleware;
|
|
2186
|
+
};
|
|
2187
|
+
/**
|
|
2188
|
+
* Creates a function to resume a middleware.
|
|
2189
|
+
*
|
|
2190
|
+
* @param gqlClient - The GraphQL client instance
|
|
2191
|
+
* @returns Function that resumes middleware by unique name
|
|
2192
|
+
* @throws If the middleware cannot be found or the resume fails
|
|
2193
|
+
*/
|
|
2194
|
+
const middlewareResume = (gqlClient) => async (middlewareUniqueName) => {
|
|
2195
|
+
const { resumeMiddlewareByUniqueName: middleware } = await gqlClient.request(resumeMiddleware, { uniqueName: middlewareUniqueName });
|
|
2196
|
+
return middleware;
|
|
2197
|
+
};
|
|
1853
2198
|
|
|
1854
2199
|
//#endregion
|
|
1855
2200
|
//#region src/graphql/platform.ts
|
|
@@ -2014,6 +2359,26 @@ const restartPrivateKey = graphql(`
|
|
|
2014
2359
|
}
|
|
2015
2360
|
`, [PrivateKeyFragment]);
|
|
2016
2361
|
/**
|
|
2362
|
+
* Mutation to pause a private key.
|
|
2363
|
+
*/
|
|
2364
|
+
const pausePrivateKey = graphql(`
|
|
2365
|
+
mutation PausePrivateKey($uniqueName: String!) {
|
|
2366
|
+
pausePrivateKeyByUniqueName(uniqueName: $uniqueName) {
|
|
2367
|
+
...PrivateKey
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
`, [PrivateKeyFragment]);
|
|
2371
|
+
/**
|
|
2372
|
+
* Mutation to resume a private key.
|
|
2373
|
+
*/
|
|
2374
|
+
const resumePrivateKey = graphql(`
|
|
2375
|
+
mutation ResumePrivateKey($uniqueName: String!) {
|
|
2376
|
+
resumePrivateKeyByUniqueName(uniqueName: $uniqueName) {
|
|
2377
|
+
...PrivateKey
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
`, [PrivateKeyFragment]);
|
|
2381
|
+
/**
|
|
2017
2382
|
* Creates a function to list private keys for an application.
|
|
2018
2383
|
*
|
|
2019
2384
|
* @param gqlClient - The GraphQL client instance
|
|
@@ -2051,7 +2416,7 @@ const privateKeyCreate = (gqlClient) => {
|
|
|
2051
2416
|
const { applicationUniqueName, blockchainNodeUniqueNames, relayerKeyUniqueName,...otherArgs } = args;
|
|
2052
2417
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
2053
2418
|
const blockchainNodes = blockchainNodeUniqueNames ? await Promise.all(blockchainNodeUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName))) : [];
|
|
2054
|
-
const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) :
|
|
2419
|
+
const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) : undefined;
|
|
2055
2420
|
const platformConfig = await getPlatformConfig(gqlClient)();
|
|
2056
2421
|
const defaultProvider = platformConfig.deploymentEngineTargets.find((target) => !target.disabled && target.clusters.some((cluster) => !cluster.disabled));
|
|
2057
2422
|
const defaultRegion = defaultProvider?.clusters.find((cluster) => !cluster.disabled);
|
|
@@ -2079,6 +2444,28 @@ const privateKeyRestart = (gqlClient) => async (privateKeyUniqueName) => {
|
|
|
2079
2444
|
const { restartPrivateKeyByUniqueName: privateKey } = await gqlClient.request(restartPrivateKey, { uniqueName: privateKeyUniqueName });
|
|
2080
2445
|
return privateKey;
|
|
2081
2446
|
};
|
|
2447
|
+
/**
|
|
2448
|
+
* Creates a function to pause a private key.
|
|
2449
|
+
*
|
|
2450
|
+
* @param gqlClient - The GraphQL client instance
|
|
2451
|
+
* @returns Function that pauses private key by unique name
|
|
2452
|
+
* @throws If the private key cannot be found or the pause fails
|
|
2453
|
+
*/
|
|
2454
|
+
const privateKeyPause = (gqlClient) => async (privateKeyUniqueName) => {
|
|
2455
|
+
const { pausePrivateKeyByUniqueName: privateKey } = await gqlClient.request(pausePrivateKey, { uniqueName: privateKeyUniqueName });
|
|
2456
|
+
return privateKey;
|
|
2457
|
+
};
|
|
2458
|
+
/**
|
|
2459
|
+
* Creates a function to resume a private key.
|
|
2460
|
+
*
|
|
2461
|
+
* @param gqlClient - The GraphQL client instance
|
|
2462
|
+
* @returns Function that resumes private key by unique name
|
|
2463
|
+
* @throws If the private key cannot be found or the resume fails
|
|
2464
|
+
*/
|
|
2465
|
+
const privateKeyResume = (gqlClient) => async (privateKeyUniqueName) => {
|
|
2466
|
+
const { resumePrivateKeyByUniqueName: privateKey } = await gqlClient.request(resumePrivateKey, { uniqueName: privateKeyUniqueName });
|
|
2467
|
+
return privateKey;
|
|
2468
|
+
};
|
|
2082
2469
|
|
|
2083
2470
|
//#endregion
|
|
2084
2471
|
//#region src/helpers/client-options.schema.ts
|
|
@@ -2116,7 +2503,9 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
|
|
|
2116
2503
|
}
|
|
2117
2504
|
});
|
|
2118
2505
|
if (!response.ok) {
|
|
2119
|
-
if (response.status === 404)
|
|
2506
|
+
if (response.status === 404) {
|
|
2507
|
+
throw new Error(`No user wallet found with address '${userWalletAddress}' for node '${nodeId}'`);
|
|
2508
|
+
}
|
|
2120
2509
|
throw new Error("Failed to get verification challenge");
|
|
2121
2510
|
}
|
|
2122
2511
|
const verificationChallenges = await response.json();
|
|
@@ -2129,7 +2518,9 @@ async function getPincodeVerificationChallenges({ userWalletAddress, accessToken
|
|
|
2129
2518
|
* @returns The pincode verification challenge response.
|
|
2130
2519
|
*/
|
|
2131
2520
|
function getPincodeVerificationChallengeResponse({ verificationChallenge, pincode }) {
|
|
2132
|
-
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt)
|
|
2521
|
+
if (!verificationChallenge?.challenge?.secret || !verificationChallenge?.challenge?.salt) {
|
|
2522
|
+
throw new Error("Could not authenticate pin code, invalid challenge format");
|
|
2523
|
+
}
|
|
2133
2524
|
const { secret, salt } = verificationChallenge.challenge;
|
|
2134
2525
|
return generateResponse(pincode, salt, secret);
|
|
2135
2526
|
}
|
|
@@ -2162,8 +2553,13 @@ function getPincodeVerificationChallengeResponse({ verificationChallenge, pincod
|
|
|
2162
2553
|
*/
|
|
2163
2554
|
function createSettleMintClient(options) {
|
|
2164
2555
|
(0, __settlemint_sdk_utils_runtime.ensureServer)();
|
|
2165
|
-
if (options.instance === __settlemint_sdk_utils_validation.STANDALONE_INSTANCE || options.instance === __settlemint_sdk_utils_validation.LOCAL_INSTANCE)
|
|
2166
|
-
|
|
2556
|
+
if (options.instance === __settlemint_sdk_utils_validation.STANDALONE_INSTANCE || options.instance === __settlemint_sdk_utils_validation.LOCAL_INSTANCE) {
|
|
2557
|
+
if (options.anonymous) {
|
|
2558
|
+
options.instance = "https://console.settlemint.com";
|
|
2559
|
+
} else {
|
|
2560
|
+
throw new Error("Standalone and local instances cannot connect to the SettleMint platform");
|
|
2561
|
+
}
|
|
2562
|
+
}
|
|
2167
2563
|
const validatedOptions = options.anonymous ? (0, __settlemint_sdk_utils_validation.validate)(zod_v4.z.object({
|
|
2168
2564
|
...ClientOptionsSchema.shape,
|
|
2169
2565
|
accessToken: zod_v4.z.literal("")
|
|
@@ -2203,57 +2599,75 @@ function createSettleMintClient(options) {
|
|
|
2203
2599
|
read: blockchainNetworkRead(gqlClient),
|
|
2204
2600
|
create: blockchainNetworkCreate(gqlClient),
|
|
2205
2601
|
delete: blockchainNetworkDelete(gqlClient),
|
|
2206
|
-
restart: blockchainNetworkRestart(gqlClient)
|
|
2602
|
+
restart: blockchainNetworkRestart(gqlClient),
|
|
2603
|
+
pause: blockchainNetworkPause(gqlClient),
|
|
2604
|
+
resume: blockchainNetworkResume(gqlClient)
|
|
2207
2605
|
},
|
|
2208
2606
|
blockchainNode: {
|
|
2209
2607
|
list: blockchainNodeList(gqlClient),
|
|
2210
2608
|
read: blockchainNodeRead(gqlClient),
|
|
2211
2609
|
create: blockchainNodeCreate(gqlClient),
|
|
2212
|
-
restart: blockchainNodeRestart(gqlClient)
|
|
2610
|
+
restart: blockchainNodeRestart(gqlClient),
|
|
2611
|
+
pause: blockchainNodePause(gqlClient),
|
|
2612
|
+
resume: blockchainNodeResume(gqlClient)
|
|
2213
2613
|
},
|
|
2214
2614
|
loadBalancer: {
|
|
2215
2615
|
list: loadBalancerList(gqlClient),
|
|
2216
2616
|
read: loadBalancerRead(gqlClient),
|
|
2217
2617
|
create: loadBalancerCreate(gqlClient),
|
|
2218
|
-
restart: loadBalancerRestart(gqlClient)
|
|
2618
|
+
restart: loadBalancerRestart(gqlClient),
|
|
2619
|
+
pause: loadBalancerPause(gqlClient),
|
|
2620
|
+
resume: loadBalancerResume(gqlClient)
|
|
2219
2621
|
},
|
|
2220
2622
|
middleware: {
|
|
2221
2623
|
list: middlewareList(gqlClient),
|
|
2222
2624
|
read: middlewareRead(gqlClient),
|
|
2223
2625
|
graphSubgraphs: graphMiddlewareSubgraphs(gqlClient),
|
|
2224
2626
|
create: middlewareCreate(gqlClient),
|
|
2225
|
-
restart: middlewareRestart(gqlClient)
|
|
2627
|
+
restart: middlewareRestart(gqlClient),
|
|
2628
|
+
pause: middlewarePause(gqlClient),
|
|
2629
|
+
resume: middlewareResume(gqlClient)
|
|
2226
2630
|
},
|
|
2227
2631
|
integrationTool: {
|
|
2228
2632
|
list: integrationToolList(gqlClient),
|
|
2229
2633
|
read: integrationToolRead(gqlClient),
|
|
2230
2634
|
create: integrationToolCreate(gqlClient),
|
|
2231
|
-
restart: integrationToolRestart(gqlClient)
|
|
2635
|
+
restart: integrationToolRestart(gqlClient),
|
|
2636
|
+
pause: integrationToolPause(gqlClient),
|
|
2637
|
+
resume: integrationToolResume(gqlClient)
|
|
2232
2638
|
},
|
|
2233
2639
|
storage: {
|
|
2234
2640
|
list: storageList(gqlClient),
|
|
2235
2641
|
read: storageRead(gqlClient),
|
|
2236
2642
|
create: storageCreate(gqlClient),
|
|
2237
|
-
restart: storageRestart(gqlClient)
|
|
2643
|
+
restart: storageRestart(gqlClient),
|
|
2644
|
+
pause: storagePause(gqlClient),
|
|
2645
|
+
resume: storageResume(gqlClient)
|
|
2238
2646
|
},
|
|
2239
2647
|
privateKey: {
|
|
2240
2648
|
list: privateKeyList(gqlClient),
|
|
2241
2649
|
read: privatekeyRead(gqlClient),
|
|
2242
2650
|
create: privateKeyCreate(gqlClient),
|
|
2243
|
-
restart: privateKeyRestart(gqlClient)
|
|
2651
|
+
restart: privateKeyRestart(gqlClient),
|
|
2652
|
+
pause: privateKeyPause(gqlClient),
|
|
2653
|
+
resume: privateKeyResume(gqlClient)
|
|
2244
2654
|
},
|
|
2245
2655
|
insights: {
|
|
2246
2656
|
list: insightsList(gqlClient),
|
|
2247
2657
|
read: insightsRead(gqlClient),
|
|
2248
2658
|
create: insightsCreate(gqlClient),
|
|
2249
|
-
restart: insightsRestart(gqlClient)
|
|
2659
|
+
restart: insightsRestart(gqlClient),
|
|
2660
|
+
pause: insightsPause(gqlClient),
|
|
2661
|
+
resume: insightsResume(gqlClient)
|
|
2250
2662
|
},
|
|
2251
2663
|
customDeployment: {
|
|
2252
2664
|
list: customdeploymentList(gqlClient),
|
|
2253
2665
|
read: customdeploymentRead(gqlClient),
|
|
2254
2666
|
create: customdeploymentCreate(gqlClient),
|
|
2255
2667
|
update: customdeploymentUpdate(gqlClient),
|
|
2256
|
-
restart: customDeploymentRestart(gqlClient)
|
|
2668
|
+
restart: customDeploymentRestart(gqlClient),
|
|
2669
|
+
pause: customDeploymentPause(gqlClient),
|
|
2670
|
+
resume: customDeploymentResume(gqlClient)
|
|
2257
2671
|
},
|
|
2258
2672
|
foundry: { env: getEnv(gqlClient) },
|
|
2259
2673
|
applicationAccessToken: { create: applicationAccessTokenCreate(gqlClient) },
|