@settlemint/sdk-js 2.6.4 → 2.6.6-prc6016dbc
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 +26 -52
- package/dist/settlemint.cjs.map +1 -1
- package/dist/settlemint.d.cts +2 -2
- package/dist/settlemint.d.ts +2 -2
- package/dist/settlemint.js +15 -11
- package/dist/settlemint.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ The SettleMint JavaScript SDK provides a type-safe wrapper around the SettleMint
|
|
|
62
62
|
|
|
63
63
|
> **createSettleMintClient**(`options`): [`SettlemintClient`](#settlemintclient)
|
|
64
64
|
|
|
65
|
-
Defined in: [sdk/js/src/settlemint.ts:275](https://github.com/settlemint/sdk/blob/v2.6.
|
|
65
|
+
Defined in: [sdk/js/src/settlemint.ts:275](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/settlemint.ts#L275)
|
|
66
66
|
|
|
67
67
|
Creates a SettleMint client with the provided options. The client provides methods to interact with
|
|
68
68
|
various SettleMint resources like workspaces, applications, blockchain networks, blockchain nodes, middleware,
|
|
@@ -109,7 +109,7 @@ const workspace = await client.workspace.read('workspace-unique-name');
|
|
|
109
109
|
|
|
110
110
|
#### SettlemintClient
|
|
111
111
|
|
|
112
|
-
Defined in: [sdk/js/src/settlemint.ts:145](https://github.com/settlemint/sdk/blob/v2.6.
|
|
112
|
+
Defined in: [sdk/js/src/settlemint.ts:145](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/settlemint.ts#L145)
|
|
113
113
|
|
|
114
114
|
Client interface for interacting with the SettleMint platform.
|
|
115
115
|
|
|
@@ -117,7 +117,7 @@ Client interface for interacting with the SettleMint platform.
|
|
|
117
117
|
|
|
118
118
|
#### SettlemintClientOptions
|
|
119
119
|
|
|
120
|
-
Defined in: [sdk/js/src/settlemint.ts:135](https://github.com/settlemint/sdk/blob/v2.6.
|
|
120
|
+
Defined in: [sdk/js/src/settlemint.ts:135](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/settlemint.ts#L135)
|
|
121
121
|
|
|
122
122
|
Options for the Settlemint client.
|
|
123
123
|
|
|
@@ -129,9 +129,9 @@ Options for the Settlemint client.
|
|
|
129
129
|
|
|
130
130
|
| Property | Type | Default value | Description | Inherited from | Defined in |
|
|
131
131
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
132
|
-
| <a id="accesstoken"></a> `accessToken?` | `string` | `undefined` | The access token used to authenticate with the SettleMint platform | - | [sdk/js/src/settlemint.ts:137](https://github.com/settlemint/sdk/blob/v2.6.
|
|
133
|
-
| <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [sdk/js/src/settlemint.ts:139](https://github.com/settlemint/sdk/blob/v2.6.
|
|
134
|
-
| <a id="instance"></a> `instance` | `string` | `UrlSchema` | The URL of the SettleMint instance to connect to | `Omit.instance` | [sdk/js/src/helpers/client-options.schema.ts:11](https://github.com/settlemint/sdk/blob/v2.6.
|
|
132
|
+
| <a id="accesstoken"></a> `accessToken?` | `string` | `undefined` | The access token used to authenticate with the SettleMint platform | - | [sdk/js/src/settlemint.ts:137](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/settlemint.ts#L137) |
|
|
133
|
+
| <a id="anonymous"></a> `anonymous?` | `boolean` | `undefined` | Whether to allow anonymous access (no access token required) | - | [sdk/js/src/settlemint.ts:139](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/settlemint.ts#L139) |
|
|
134
|
+
| <a id="instance"></a> `instance` | `string` | `UrlSchema` | The URL of the SettleMint instance to connect to | `Omit.instance` | [sdk/js/src/helpers/client-options.schema.ts:11](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/helpers/client-options.schema.ts#L11) |
|
|
135
135
|
|
|
136
136
|
### Type Aliases
|
|
137
137
|
|
|
@@ -139,7 +139,7 @@ Options for the Settlemint client.
|
|
|
139
139
|
|
|
140
140
|
> **Application** = `ResultOf`\<*typeof* `ApplicationFragment`\>
|
|
141
141
|
|
|
142
|
-
Defined in: [sdk/js/src/graphql/application.ts:24](https://github.com/settlemint/sdk/blob/v2.6.
|
|
142
|
+
Defined in: [sdk/js/src/graphql/application.ts:24](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/application.ts#L24)
|
|
143
143
|
|
|
144
144
|
Type representing an application entity.
|
|
145
145
|
|
|
@@ -149,7 +149,7 @@ Type representing an application entity.
|
|
|
149
149
|
|
|
150
150
|
> **BlockchainNetwork** = `ResultOf`\<*typeof* `BlockchainNetworkFragment`\>
|
|
151
151
|
|
|
152
|
-
Defined in: [sdk/js/src/graphql/blockchain-network.ts:55](https://github.com/settlemint/sdk/blob/v2.6.
|
|
152
|
+
Defined in: [sdk/js/src/graphql/blockchain-network.ts:55](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/blockchain-network.ts#L55)
|
|
153
153
|
|
|
154
154
|
Type representing a blockchain network entity.
|
|
155
155
|
|
|
@@ -159,7 +159,7 @@ Type representing a blockchain network entity.
|
|
|
159
159
|
|
|
160
160
|
> **BlockchainNode** = `ResultOf`\<*typeof* `BlockchainNodeFragment`\>
|
|
161
161
|
|
|
162
|
-
Defined in: [sdk/js/src/graphql/blockchain-node.ts:69](https://github.com/settlemint/sdk/blob/v2.6.
|
|
162
|
+
Defined in: [sdk/js/src/graphql/blockchain-node.ts:69](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/blockchain-node.ts#L69)
|
|
163
163
|
|
|
164
164
|
Type representing a blockchain node entity.
|
|
165
165
|
|
|
@@ -169,7 +169,7 @@ Type representing a blockchain node entity.
|
|
|
169
169
|
|
|
170
170
|
> **CustomDeployment** = `ResultOf`\<*typeof* `CustomDeploymentFragment`\>
|
|
171
171
|
|
|
172
|
-
Defined in: [sdk/js/src/graphql/custom-deployment.ts:33](https://github.com/settlemint/sdk/blob/v2.6.
|
|
172
|
+
Defined in: [sdk/js/src/graphql/custom-deployment.ts:33](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/custom-deployment.ts#L33)
|
|
173
173
|
|
|
174
174
|
Type representing a custom deployment entity.
|
|
175
175
|
|
|
@@ -179,7 +179,7 @@ Type representing a custom deployment entity.
|
|
|
179
179
|
|
|
180
180
|
> **Insights** = `ResultOf`\<*typeof* `InsightsFragment`\>
|
|
181
181
|
|
|
182
|
-
Defined in: [sdk/js/src/graphql/insights.ts:37](https://github.com/settlemint/sdk/blob/v2.6.
|
|
182
|
+
Defined in: [sdk/js/src/graphql/insights.ts:37](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/insights.ts#L37)
|
|
183
183
|
|
|
184
184
|
Type representing an insights entity.
|
|
185
185
|
|
|
@@ -189,7 +189,7 @@ Type representing an insights entity.
|
|
|
189
189
|
|
|
190
190
|
> **IntegrationTool** = `ResultOf`\<*typeof* `IntegrationFragment`\>
|
|
191
191
|
|
|
192
|
-
Defined in: [sdk/js/src/graphql/integration-tool.ts:35](https://github.com/settlemint/sdk/blob/v2.6.
|
|
192
|
+
Defined in: [sdk/js/src/graphql/integration-tool.ts:35](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/integration-tool.ts#L35)
|
|
193
193
|
|
|
194
194
|
Type representing an integration tool entity.
|
|
195
195
|
|
|
@@ -199,7 +199,7 @@ Type representing an integration tool entity.
|
|
|
199
199
|
|
|
200
200
|
> **LoadBalancer** = `ResultOf`\<*typeof* `LoadBalancerFragment`\>
|
|
201
201
|
|
|
202
|
-
Defined in: [sdk/js/src/graphql/load-balancer.ts:31](https://github.com/settlemint/sdk/blob/v2.6.
|
|
202
|
+
Defined in: [sdk/js/src/graphql/load-balancer.ts:31](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/load-balancer.ts#L31)
|
|
203
203
|
|
|
204
204
|
Type representing a load balancer entity.
|
|
205
205
|
|
|
@@ -209,7 +209,7 @@ Type representing a load balancer entity.
|
|
|
209
209
|
|
|
210
210
|
> **Middleware** = `ResultOf`\<*typeof* `MiddlewareFragment`\>
|
|
211
211
|
|
|
212
|
-
Defined in: [sdk/js/src/graphql/middleware.ts:56](https://github.com/settlemint/sdk/blob/v2.6.
|
|
212
|
+
Defined in: [sdk/js/src/graphql/middleware.ts:56](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/middleware.ts#L56)
|
|
213
213
|
|
|
214
214
|
Type representing a middleware entity.
|
|
215
215
|
|
|
@@ -219,7 +219,7 @@ Type representing a middleware entity.
|
|
|
219
219
|
|
|
220
220
|
> **MiddlewareWithSubgraphs** = `ResultOf`\<*typeof* `getGraphMiddlewareSubgraphs`\>\[`"middlewareByUniqueName"`\]
|
|
221
221
|
|
|
222
|
-
Defined in: [sdk/js/src/graphql/middleware.ts:115](https://github.com/settlemint/sdk/blob/v2.6.
|
|
222
|
+
Defined in: [sdk/js/src/graphql/middleware.ts:115](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/middleware.ts#L115)
|
|
223
223
|
|
|
224
224
|
Type representing a middleware entity with subgraphs.
|
|
225
225
|
|
|
@@ -229,7 +229,7 @@ Type representing a middleware entity with subgraphs.
|
|
|
229
229
|
|
|
230
230
|
> **PlatformConfig** = `ResultOf`\<*typeof* `getPlatformConfigQuery`\>\[`"config"`\]
|
|
231
231
|
|
|
232
|
-
Defined in: [sdk/js/src/graphql/platform.ts:56](https://github.com/settlemint/sdk/blob/v2.6.
|
|
232
|
+
Defined in: [sdk/js/src/graphql/platform.ts:56](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/platform.ts#L56)
|
|
233
233
|
|
|
234
234
|
Type representing the platform configuration.
|
|
235
235
|
|
|
@@ -239,7 +239,7 @@ Type representing the platform configuration.
|
|
|
239
239
|
|
|
240
240
|
> **PrivateKey** = `ResultOf`\<*typeof* `PrivateKeyFragment`\>
|
|
241
241
|
|
|
242
|
-
Defined in: [sdk/js/src/graphql/private-key.ts:44](https://github.com/settlemint/sdk/blob/v2.6.
|
|
242
|
+
Defined in: [sdk/js/src/graphql/private-key.ts:44](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/private-key.ts#L44)
|
|
243
243
|
|
|
244
244
|
Type representing a private key entity.
|
|
245
245
|
|
|
@@ -249,7 +249,7 @@ Type representing a private key entity.
|
|
|
249
249
|
|
|
250
250
|
> **Storage** = `ResultOf`\<*typeof* `StorageFragment`\>
|
|
251
251
|
|
|
252
|
-
Defined in: [sdk/js/src/graphql/storage.ts:35](https://github.com/settlemint/sdk/blob/v2.6.
|
|
252
|
+
Defined in: [sdk/js/src/graphql/storage.ts:35](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/storage.ts#L35)
|
|
253
253
|
|
|
254
254
|
Type representing a storage entity.
|
|
255
255
|
|
|
@@ -259,7 +259,7 @@ Type representing a storage entity.
|
|
|
259
259
|
|
|
260
260
|
> **Workspace** = `ResultOf`\<*typeof* `WorkspaceFragment`\>
|
|
261
261
|
|
|
262
|
-
Defined in: [sdk/js/src/graphql/workspace.ts:26](https://github.com/settlemint/sdk/blob/v2.6.
|
|
262
|
+
Defined in: [sdk/js/src/graphql/workspace.ts:26](https://github.com/settlemint/sdk/blob/v2.6.6/sdk/js/src/graphql/workspace.ts#L26)
|
|
263
263
|
|
|
264
264
|
Type representing a workspace entity.
|
|
265
265
|
|
package/dist/settlemint.cjs
CHANGED
|
@@ -1,44 +1,18 @@
|
|
|
1
1
|
/* SettleMint SDK - Main Package */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
let __settlemint_sdk_utils_http = require("@settlemint/sdk-utils/http");
|
|
26
|
-
__settlemint_sdk_utils_http = __toESM(__settlemint_sdk_utils_http);
|
|
27
|
-
let __settlemint_sdk_utils_runtime = require("@settlemint/sdk-utils/runtime");
|
|
28
|
-
__settlemint_sdk_utils_runtime = __toESM(__settlemint_sdk_utils_runtime);
|
|
29
|
-
let __settlemint_sdk_utils_validation = require("@settlemint/sdk-utils/validation");
|
|
30
|
-
__settlemint_sdk_utils_validation = __toESM(__settlemint_sdk_utils_validation);
|
|
2
|
+
let _settlemint_sdk_utils_http = require("@settlemint/sdk-utils/http");
|
|
3
|
+
let _settlemint_sdk_utils_runtime = require("@settlemint/sdk-utils/runtime");
|
|
4
|
+
let _settlemint_sdk_utils_validation = require("@settlemint/sdk-utils/validation");
|
|
31
5
|
let graphql_request = require("graphql-request");
|
|
32
|
-
graphql_request = __toESM(graphql_request);
|
|
33
6
|
let zod = require("zod");
|
|
34
|
-
zod = __toESM(zod);
|
|
35
7
|
let gql_tada = require("gql.tada");
|
|
36
|
-
gql_tada = __toESM(gql_tada);
|
|
37
8
|
let node_crypto = require("node:crypto");
|
|
38
|
-
node_crypto = __toESM(node_crypto);
|
|
39
9
|
|
|
40
10
|
//#region src/helpers/graphql.ts
|
|
41
11
|
/**
|
|
12
|
+
* This module initializes and exports GraphQL-related utilities using gql.tada.
|
|
13
|
+
* It sets up the GraphQL client with specific configurations and exports necessary types and functions.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
42
16
|
* Initializes the GraphQL client with specific configurations.
|
|
43
17
|
*
|
|
44
18
|
* @returns A configured GraphQL client instance.
|
|
@@ -205,7 +179,7 @@ const workspaceDelete = (gqlClient) => {
|
|
|
205
179
|
*/
|
|
206
180
|
const workspaceAddCredits = (gqlClient) => {
|
|
207
181
|
return async (workspaceId, amount) => {
|
|
208
|
-
const id = (0,
|
|
182
|
+
const id = (0, _settlemint_sdk_utils_validation.validate)(_settlemint_sdk_utils_validation.IdSchema, workspaceId);
|
|
209
183
|
if (amount <= 0) {
|
|
210
184
|
throw new Error("Credit amount must be a positive number");
|
|
211
185
|
}
|
|
@@ -311,7 +285,7 @@ const applicationRead = (gqlClient) => {
|
|
|
311
285
|
*/
|
|
312
286
|
const applicationCreate = (gqlClient) => {
|
|
313
287
|
return async (args) => {
|
|
314
|
-
const { workspaceUniqueName
|
|
288
|
+
const { workspaceUniqueName, ...otherArgs } = args;
|
|
315
289
|
const workspace = await workspaceRead(gqlClient)(workspaceUniqueName);
|
|
316
290
|
const { createApplication: application } = await gqlClient.request(createApplication, {
|
|
317
291
|
...otherArgs,
|
|
@@ -379,7 +353,7 @@ const createApplicationAccessToken = graphql(`
|
|
|
379
353
|
*/
|
|
380
354
|
const applicationAccessTokenCreate = (gqlClient) => {
|
|
381
355
|
return async (args) => {
|
|
382
|
-
const { applicationUniqueName
|
|
356
|
+
const { applicationUniqueName, ...otherArgs } = args;
|
|
383
357
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
384
358
|
const { createApplicationAccessToken: applicationAccessToken } = await gqlClient.request(createApplicationAccessToken, {
|
|
385
359
|
...otherArgs,
|
|
@@ -642,7 +616,7 @@ const blockchainNetworkRead = (gqlClient) => {
|
|
|
642
616
|
*/
|
|
643
617
|
const blockchainNetworkCreate = (gqlClient) => {
|
|
644
618
|
return async (args) => {
|
|
645
|
-
const { applicationUniqueName
|
|
619
|
+
const { applicationUniqueName, ...otherArgs } = args;
|
|
646
620
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
647
621
|
const blockchainNetworkArgs = setNetworkDefaults(otherArgs);
|
|
648
622
|
const { createBlockchainNetwork: blockchainNetwork } = await gqlClient.request(createBlockchainNetwork, {
|
|
@@ -877,7 +851,7 @@ const blockchainNodeRead = (gqlClient) => {
|
|
|
877
851
|
*/
|
|
878
852
|
const blockchainNodeCreate = (gqlClient) => {
|
|
879
853
|
return async (args) => {
|
|
880
|
-
const { applicationUniqueName, blockchainNetworkUniqueName
|
|
854
|
+
const { applicationUniqueName, blockchainNetworkUniqueName, ...otherArgs } = args;
|
|
881
855
|
const [application, blockchainNetwork] = await Promise.all([applicationRead(gqlClient)(applicationUniqueName), blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName)]);
|
|
882
856
|
const { createBlockchainNode: blockchainNode } = await gqlClient.request(createBlockchainNode, {
|
|
883
857
|
...otherArgs,
|
|
@@ -1094,7 +1068,7 @@ const customdeploymentUpdate = (gqlClient) => {
|
|
|
1094
1068
|
*/
|
|
1095
1069
|
const customdeploymentCreate = (gqlClient) => {
|
|
1096
1070
|
return async (args) => {
|
|
1097
|
-
const { applicationUniqueName
|
|
1071
|
+
const { applicationUniqueName, ...otherArgs } = args;
|
|
1098
1072
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
1099
1073
|
const { createCustomDeployment: customDeployment } = await gqlClient.request(createCustomDeployment, {
|
|
1100
1074
|
...otherArgs,
|
|
@@ -1298,7 +1272,7 @@ const loadBalancerList = (gqlClient) => {
|
|
|
1298
1272
|
*/
|
|
1299
1273
|
const loadBalancerCreate = (gqlClient) => {
|
|
1300
1274
|
return async (args) => {
|
|
1301
|
-
const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames
|
|
1275
|
+
const { applicationUniqueName, blockchainNetworkUniqueName, connectedNodesUniqueNames, ...otherArgs } = args;
|
|
1302
1276
|
const [application, blockchainNetwork, connectedNodes] = await Promise.all([
|
|
1303
1277
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
1304
1278
|
blockchainNetworkRead(gqlClient)(blockchainNetworkUniqueName),
|
|
@@ -1492,7 +1466,7 @@ const insightsRead = (gqlClient) => {
|
|
|
1492
1466
|
*/
|
|
1493
1467
|
const insightsCreate = (gqlClient) => {
|
|
1494
1468
|
return async (args) => {
|
|
1495
|
-
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName
|
|
1469
|
+
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, ...otherArgs } = args;
|
|
1496
1470
|
const [application, blockchainNode, loadBalancer] = await Promise.all([
|
|
1497
1471
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
1498
1472
|
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
|
|
@@ -1682,7 +1656,7 @@ const integrationToolRead = (gqlClient) => {
|
|
|
1682
1656
|
*/
|
|
1683
1657
|
const integrationToolCreate = (gqlClient) => {
|
|
1684
1658
|
return async (args) => {
|
|
1685
|
-
const { applicationUniqueName
|
|
1659
|
+
const { applicationUniqueName, ...otherArgs } = args;
|
|
1686
1660
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
1687
1661
|
const { createIntegration: integration } = await gqlClient.request(createIntegration, {
|
|
1688
1662
|
...otherArgs,
|
|
@@ -1866,7 +1840,7 @@ const storageRead = (gqlClient) => {
|
|
|
1866
1840
|
*/
|
|
1867
1841
|
const storageCreate = (gqlClient) => {
|
|
1868
1842
|
return async (args) => {
|
|
1869
|
-
const { applicationUniqueName
|
|
1843
|
+
const { applicationUniqueName, ...otherArgs } = args;
|
|
1870
1844
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
1871
1845
|
const { createStorage: storage } = await gqlClient.request(createStorage, {
|
|
1872
1846
|
...otherArgs,
|
|
@@ -2113,7 +2087,7 @@ const graphMiddlewareSubgraphs = (gqlClient) => {
|
|
|
2113
2087
|
*/
|
|
2114
2088
|
const middlewareCreate = (gqlClient) => {
|
|
2115
2089
|
return async (args) => {
|
|
2116
|
-
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName
|
|
2090
|
+
const { applicationUniqueName, blockchainNodeUniqueName, loadBalancerUniqueName, storageUniqueName, ...otherArgs } = args;
|
|
2117
2091
|
const [application, blockchainNode, loadBalancer, storage] = await Promise.all([
|
|
2118
2092
|
applicationRead(gqlClient)(applicationUniqueName),
|
|
2119
2093
|
blockchainNodeUniqueName ? blockchainNodeRead(gqlClient)(blockchainNodeUniqueName) : Promise.resolve(undefined),
|
|
@@ -2381,7 +2355,7 @@ const privatekeyRead = (gqlClient) => {
|
|
|
2381
2355
|
*/
|
|
2382
2356
|
const privateKeyCreate = (gqlClient) => {
|
|
2383
2357
|
return async (args) => {
|
|
2384
|
-
const { applicationUniqueName, blockchainNodeUniqueNames, relayerKeyUniqueName
|
|
2358
|
+
const { applicationUniqueName, blockchainNodeUniqueNames, relayerKeyUniqueName, ...otherArgs } = args;
|
|
2385
2359
|
const application = await applicationRead(gqlClient)(applicationUniqueName);
|
|
2386
2360
|
const blockchainNodes = blockchainNodeUniqueNames ? await Promise.all(blockchainNodeUniqueNames.map((uniqueName) => blockchainNodeRead(gqlClient)(uniqueName))) : [];
|
|
2387
2361
|
const relayerKey = relayerKeyUniqueName ? await privatekeyRead(gqlClient)(relayerKeyUniqueName) : undefined;
|
|
@@ -2441,8 +2415,8 @@ const privateKeyResume = (gqlClient) => async (privateKeyUniqueName) => {
|
|
|
2441
2415
|
* Schema for validating SettleMint client options.
|
|
2442
2416
|
*/
|
|
2443
2417
|
const ClientOptionsSchema = zod.z.object({
|
|
2444
|
-
accessToken:
|
|
2445
|
-
instance:
|
|
2418
|
+
accessToken: _settlemint_sdk_utils_validation.AccessTokenSchema,
|
|
2419
|
+
instance: _settlemint_sdk_utils_validation.UrlSchema
|
|
2446
2420
|
});
|
|
2447
2421
|
|
|
2448
2422
|
//#endregion
|
|
@@ -2520,23 +2494,23 @@ function getPincodeVerificationChallengeResponse({ verificationChallenge, pincod
|
|
|
2520
2494
|
* const workspace = await client.workspace.read('workspace-unique-name');
|
|
2521
2495
|
*/
|
|
2522
2496
|
function createSettleMintClient(options) {
|
|
2523
|
-
(0,
|
|
2524
|
-
if (options.instance ===
|
|
2497
|
+
(0, _settlemint_sdk_utils_runtime.ensureServer)();
|
|
2498
|
+
if (options.instance === _settlemint_sdk_utils_validation.STANDALONE_INSTANCE || options.instance === _settlemint_sdk_utils_validation.LOCAL_INSTANCE) {
|
|
2525
2499
|
if (options.anonymous) {
|
|
2526
2500
|
options.instance = "https://console.settlemint.com";
|
|
2527
2501
|
} else {
|
|
2528
2502
|
throw new Error("Standalone and local instances cannot connect to the SettleMint platform");
|
|
2529
2503
|
}
|
|
2530
2504
|
}
|
|
2531
|
-
const validatedOptions = options.anonymous ? (0,
|
|
2505
|
+
const validatedOptions = options.anonymous ? (0, _settlemint_sdk_utils_validation.validate)(zod.z.object({
|
|
2532
2506
|
...ClientOptionsSchema.shape,
|
|
2533
2507
|
accessToken: zod.z.literal("")
|
|
2534
|
-
}), options) : (0,
|
|
2508
|
+
}), options) : (0, _settlemint_sdk_utils_validation.validate)(ClientOptionsSchema, options);
|
|
2535
2509
|
const baseUrl = new URL(validatedOptions.instance).toString().replace(/\/$/, "");
|
|
2536
2510
|
const gqlClient = new graphql_request.GraphQLClient(`${baseUrl}/api/graphql`, {
|
|
2537
2511
|
headers: { "x-auth-token": validatedOptions.accessToken ?? "" },
|
|
2538
2512
|
fetch: (async (input, init) => {
|
|
2539
|
-
const response = await (0,
|
|
2513
|
+
const response = await (0, _settlemint_sdk_utils_http.fetchWithRetry)(input, init);
|
|
2540
2514
|
const contentType = response.headers.get("content-type");
|
|
2541
2515
|
if (contentType?.includes("application/json") || contentType?.includes("application/graphql-response+json")) {
|
|
2542
2516
|
const data = await response.clone().json();
|