@settlemint/sdk-cli 2.3.2-pr19c2c7d2 → 2.3.2-pr2ffa9747
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/dist/cli.js +434 -226
- package/dist/cli.js.map +37 -35
- package/package.json +3 -3
package/dist/cli.js
CHANGED
@@ -262458,7 +262458,7 @@ function pruneCurrentEnv(currentEnv, env2) {
|
|
262458
262458
|
var package_default = {
|
262459
262459
|
name: "@settlemint/sdk-cli",
|
262460
262460
|
description: "Command-line interface for SettleMint SDK, providing development tools and project management capabilities",
|
262461
|
-
version: "2.3.2-
|
262461
|
+
version: "2.3.2-pr2ffa9747",
|
262462
262462
|
type: "module",
|
262463
262463
|
private: false,
|
262464
262464
|
license: "FSL-1.1-MIT",
|
@@ -262507,8 +262507,8 @@ var package_default = {
|
|
262507
262507
|
"@inquirer/input": "4.1.10",
|
262508
262508
|
"@inquirer/password": "4.0.13",
|
262509
262509
|
"@inquirer/select": "4.2.1",
|
262510
|
-
"@settlemint/sdk-js": "2.3.2-
|
262511
|
-
"@settlemint/sdk-utils": "2.3.2-
|
262510
|
+
"@settlemint/sdk-js": "2.3.2-pr2ffa9747",
|
262511
|
+
"@settlemint/sdk-utils": "2.3.2-pr2ffa9747",
|
262512
262512
|
"@types/node": "22.15.21",
|
262513
262513
|
"@types/semver": "7.7.0",
|
262514
262514
|
"@types/which": "3.0.4",
|
@@ -266154,7 +266154,11 @@ function getPincodeVerificationChallengeResponse({
|
|
266154
266154
|
function createSettleMintClient(options) {
|
266155
266155
|
ensureServer();
|
266156
266156
|
if (options.instance === STANDALONE_INSTANCE2) {
|
266157
|
-
|
266157
|
+
if (options.anonymous) {
|
266158
|
+
options.instance = "https://console.settlemint.com";
|
266159
|
+
} else {
|
266160
|
+
throw new Error("Standalone instances cannot connect to the SettleMint platform");
|
266161
|
+
}
|
266158
266162
|
}
|
266159
266163
|
const validatedOptions = options.anonymous ? validate2(exports_external.object({
|
266160
266164
|
...ClientOptionsSchema.shape,
|
@@ -267152,6 +267156,11 @@ function camelCaseToWords2(s) {
|
|
267152
267156
|
function replaceUnderscoresAndHyphensWithSpaces(s) {
|
267153
267157
|
return s.replace(/[-_]/g, " ");
|
267154
267158
|
}
|
267159
|
+
function extractBaseUrlBeforeSegment(baseUrl, pathSegment) {
|
267160
|
+
const url2 = new URL(baseUrl);
|
267161
|
+
const segmentIndex = url2.pathname.indexOf(pathSegment);
|
267162
|
+
return url2.origin + (segmentIndex >= 0 ? url2.pathname.substring(0, segmentIndex) : url2.pathname);
|
267163
|
+
}
|
267155
267164
|
|
267156
267165
|
// ../utils/dist/filesystem.mjs
|
267157
267166
|
import { dirname as dirname5 } from "path";
|
@@ -267378,29 +267387,24 @@ init_index_chunk();
|
|
267378
267387
|
var PACKAGE_NAME = "@settlemint/sdk-hasura";
|
267379
267388
|
async function codegenHasura(env2) {
|
267380
267389
|
const gqlEndpoint = env2.SETTLEMINT_HASURA_ENDPOINT;
|
267381
|
-
const
|
267390
|
+
const instance = env2.SETTLEMINT_INSTANCE;
|
267391
|
+
const accessToken = instance === STANDALONE_INSTANCE2 ? undefined : await getApplicationOrPersonalAccessToken({
|
267382
267392
|
env: env2,
|
267383
267393
|
instance: env2.SETTLEMINT_INSTANCE,
|
267384
267394
|
prefer: "application"
|
267385
267395
|
});
|
267386
267396
|
const adminSecret = env2.SETTLEMINT_HASURA_ADMIN_SECRET;
|
267387
|
-
|
267388
|
-
if (!gqlEndpoint || !accessToken || !adminSecret) {
|
267389
|
-
note("[Codegen] Missing required Hasura environment variables", "warn");
|
267390
|
-
return;
|
267391
|
-
}
|
267392
|
-
if (gqlEndpoint && accessToken && adminSecret) {
|
267397
|
+
if (gqlEndpoint && adminSecret) {
|
267393
267398
|
await generateSchema({
|
267394
267399
|
input: gqlEndpoint,
|
267395
267400
|
output: "hasura-schema.graphql",
|
267396
267401
|
tsconfig: undefined,
|
267397
267402
|
headers: {
|
267398
267403
|
"x-hasura-admin-secret": adminSecret,
|
267399
|
-
"x-auth-token": accessToken
|
267404
|
+
...accessToken ? { "x-auth-token": accessToken } : {}
|
267400
267405
|
}
|
267401
267406
|
});
|
267402
|
-
|
267403
|
-
const hasuraTemplate = `import { createHasuraClient } from "${PACKAGE_NAME}";
|
267407
|
+
const hasuraTemplate = `import { createHasuraClient } from "${PACKAGE_NAME}";
|
267404
267408
|
import type { introspection } from "@schemas/hasura-env";
|
267405
267409
|
import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-utils/logging';
|
267406
267410
|
|
@@ -267423,22 +267427,27 @@ export const { client: hasuraClient, graphql: hasuraGraphql } = createHasuraClie
|
|
267423
267427
|
};
|
267424
267428
|
}>({
|
267425
267429
|
instance: process.env.SETTLEMINT_HASURA_ENDPOINT!,
|
267426
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
267430
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
267427
267431
|
adminSecret: process.env.SETTLEMINT_HASURA_ADMIN_SECRET!,
|
267428
267432
|
}, {
|
267429
267433
|
fetch: requestLogger(logger, "hasura", fetch) as typeof fetch,
|
267430
267434
|
});`;
|
267431
|
-
|
267432
|
-
|
267435
|
+
await writeTemplate(hasuraTemplate, "/lib/settlemint", "hasura.ts");
|
267436
|
+
} else {
|
267437
|
+
note("[Codegen] Missing required Hasura environment variables", "warn");
|
267438
|
+
}
|
267439
|
+
const databaseUrl = env2.SETTLEMINT_HASURA_DATABASE_URL;
|
267440
|
+
if (databaseUrl) {
|
267441
|
+
const drizzleTemplate = `import { createPostgresPool } from "${PACKAGE_NAME}/postgres";
|
267433
267442
|
|
267434
|
-
export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DATABASE_URL ??
|
267443
|
+
export const postgresPool = createPostgresPool(process.env.SETTLEMINT_HASURA_DATABASE_URL ?? "");
|
267435
267444
|
`;
|
267436
|
-
|
267437
|
-
|
267438
|
-
|
267439
|
-
|
267440
|
-
|
267441
|
-
|
267445
|
+
await writeTemplate(drizzleTemplate, "/lib/settlemint", "postgres.ts");
|
267446
|
+
const projectDir = await projectRoot3();
|
267447
|
+
if (!await isPackageInstalled(PACKAGE_NAME, projectDir)) {
|
267448
|
+
await installDependencies(PACKAGE_NAME, projectDir);
|
267449
|
+
}
|
267450
|
+
} else {
|
267442
267451
|
note("[Codegen] Missing database environment variables", "warn");
|
267443
267452
|
}
|
267444
267453
|
}
|
@@ -267450,21 +267459,19 @@ async function codegenPortal(env2) {
|
|
267450
267459
|
if (!gqlEndpoint) {
|
267451
267460
|
return;
|
267452
267461
|
}
|
267453
|
-
const
|
267462
|
+
const instance = env2.SETTLEMINT_INSTANCE;
|
267463
|
+
const accessToken = instance === STANDALONE_INSTANCE2 ? undefined : await getApplicationOrPersonalAccessToken({
|
267454
267464
|
env: env2,
|
267455
267465
|
instance: env2.SETTLEMINT_INSTANCE,
|
267456
267466
|
prefer: "application"
|
267457
267467
|
});
|
267458
|
-
if (!accessToken) {
|
267459
|
-
return;
|
267460
|
-
}
|
267461
267468
|
await generateSchema({
|
267462
267469
|
input: gqlEndpoint,
|
267463
267470
|
output: "portal-schema.graphql",
|
267464
267471
|
tsconfig: undefined,
|
267465
|
-
headers: {
|
267466
|
-
"x-auth-token": accessToken
|
267467
|
-
}
|
267472
|
+
headers: accessToken ? {
|
267473
|
+
"x-auth-token": accessToken
|
267474
|
+
} : {}
|
267468
267475
|
});
|
267469
267476
|
const template = `import { createPortalClient, getWebsocketClient } from "${PACKAGE_NAME2}";
|
267470
267477
|
import type { introspection } from "@schemas/portal-env";
|
@@ -267481,14 +267488,14 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
|
|
267481
267488
|
};
|
267482
267489
|
}>({
|
267483
267490
|
instance: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
|
267484
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
267491
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
267485
267492
|
}, {
|
267486
267493
|
fetch: requestLogger(logger, "portal", fetch) as typeof fetch,
|
267487
267494
|
});
|
267488
267495
|
|
267489
267496
|
export const getPortalWebsocketClient = getWebsocketClient({
|
267490
267497
|
portalGraphqlEndpoint: process.env.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT!,
|
267491
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
267498
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
267492
267499
|
});
|
267493
267500
|
`;
|
267494
267501
|
await writeTemplate(template, "/lib/settlemint", "portal.ts");
|
@@ -267515,14 +267522,12 @@ async function codegenTheGraph(env2, subgraphNames) {
|
|
267515
267522
|
if (!Array.isArray(gqlEndpoints) || gqlEndpoints.length === 0) {
|
267516
267523
|
return;
|
267517
267524
|
}
|
267518
|
-
const
|
267525
|
+
const instance = env2.SETTLEMINT_INSTANCE;
|
267526
|
+
const accessToken = instance === STANDALONE_INSTANCE2 ? undefined : await getApplicationOrPersonalAccessToken({
|
267519
267527
|
env: env2,
|
267520
267528
|
instance: env2.SETTLEMINT_INSTANCE,
|
267521
267529
|
prefer: "application"
|
267522
267530
|
});
|
267523
|
-
if (!accessToken) {
|
267524
|
-
return;
|
267525
|
-
}
|
267526
267531
|
const template = [
|
267527
267532
|
`import { createTheGraphClient } from "${PACKAGE_NAME3}";`,
|
267528
267533
|
"import { createLogger, requestLogger, type LogLevel } from '@settlemint/sdk-utils/logging';"
|
@@ -267549,9 +267554,9 @@ async function codegenTheGraph(env2, subgraphNames) {
|
|
267549
267554
|
input: gqlEndpoint,
|
267550
267555
|
output: `the-graph-schema-${name3}.graphql`,
|
267551
267556
|
tsconfig: undefined,
|
267552
|
-
headers: {
|
267557
|
+
headers: accessToken ? {
|
267553
267558
|
"x-auth-token": accessToken
|
267554
|
-
}
|
267559
|
+
} : {}
|
267555
267560
|
});
|
267556
267561
|
const nameSuffix = capitalizeFirstLetter2(name3);
|
267557
267562
|
const graphqlClientVariable = getVariableName(`theGraphClient${nameSuffix}`);
|
@@ -267571,7 +267576,7 @@ export const { client: ${graphqlClientVariable}, graphql: ${graphqlVariable} } =
|
|
267571
267576
|
};
|
267572
267577
|
}>({
|
267573
267578
|
instances: JSON.parse(process.env.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS || '[]'),
|
267574
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
267579
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
267575
267580
|
subgraphName: "${name3}",
|
267576
267581
|
cache: "force-cache",
|
267577
267582
|
}, {
|
@@ -267618,11 +267623,12 @@ async function testGqlEndpoint({
|
|
267618
267623
|
try {
|
267619
267624
|
await graphqlFetchWithRetry(gqlEndpoint, {
|
267620
267625
|
method: "POST",
|
267621
|
-
headers: {
|
267622
|
-
"
|
267623
|
-
...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {}
|
267624
|
-
|
267625
|
-
|
267626
|
+
headers: appendHeaders({
|
267627
|
+
"Content-Type": "application/json",
|
267628
|
+
...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {}
|
267629
|
+
}, {
|
267630
|
+
"x-auth-token": accessToken
|
267631
|
+
}),
|
267626
267632
|
body: JSON.stringify({
|
267627
267633
|
query: `
|
267628
267634
|
query {
|
@@ -268546,19 +268552,22 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
268546
268552
|
blockscout: false
|
268547
268553
|
};
|
268548
268554
|
}
|
268549
|
-
|
268550
|
-
|
268551
|
-
|
268552
|
-
|
268553
|
-
|
268554
|
-
|
268555
|
-
|
268556
|
-
|
268557
|
-
hasura
|
268558
|
-
|
268559
|
-
|
268560
|
-
|
268561
|
-
|
268555
|
+
let accessToken;
|
268556
|
+
if (env2.SETTLEMINT_INSTANCE !== STANDALONE_INSTANCE2) {
|
268557
|
+
accessToken = await getApplicationOrPersonalAccessToken({
|
268558
|
+
env: env2,
|
268559
|
+
instance: env2.SETTLEMINT_INSTANCE,
|
268560
|
+
prefer: "application"
|
268561
|
+
});
|
268562
|
+
if (!accessToken) {
|
268563
|
+
note("No access token found, skipping codegen for hasura, portal, thegraph and blockscout", "warn");
|
268564
|
+
return {
|
268565
|
+
hasura: false,
|
268566
|
+
portal: false,
|
268567
|
+
thegraph: false,
|
268568
|
+
blockscout: false
|
268569
|
+
};
|
268570
|
+
}
|
268562
268571
|
}
|
268563
268572
|
const theGraphEndpoints = (env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS ?? []).filter((gqlEndpoint) => {
|
268564
268573
|
const name3 = getSubgraphName(gqlEndpoint);
|
@@ -268995,22 +269004,21 @@ async function codegenBlockscout(env2) {
|
|
268995
269004
|
if (!endpoint) {
|
268996
269005
|
return;
|
268997
269006
|
}
|
268998
|
-
const
|
269007
|
+
const instance = env2.SETTLEMINT_INSTANCE;
|
269008
|
+
const accessToken = instance === STANDALONE_INSTANCE2 ? undefined : await getApplicationOrPersonalAccessToken({
|
268999
269009
|
env: env2,
|
269000
269010
|
instance: env2.SETTLEMINT_INSTANCE,
|
269001
269011
|
prefer: "application"
|
269002
269012
|
});
|
269003
|
-
if (!accessToken) {
|
269004
|
-
return;
|
269005
|
-
}
|
269006
269013
|
const introspectionJsonPath = resolve5(process.cwd(), "__blockscout-introspection__.json");
|
269007
269014
|
try {
|
269008
269015
|
const data = await graphqlFetchWithRetry(endpoint, {
|
269009
269016
|
method: "POST",
|
269010
|
-
headers: {
|
269011
|
-
"x-auth-token": accessToken,
|
269017
|
+
headers: appendHeaders({
|
269012
269018
|
"Content-Type": "application/json"
|
269013
|
-
},
|
269019
|
+
}, {
|
269020
|
+
"x-auth-token": accessToken
|
269021
|
+
}),
|
269014
269022
|
body: JSON.stringify({
|
269015
269023
|
query: `
|
269016
269024
|
query IntrospectionQuery {
|
@@ -269157,7 +269165,7 @@ export const { client: blockscoutClient, graphql: blockscoutGraphql } = createBl
|
|
269157
269165
|
};
|
269158
269166
|
}>({
|
269159
269167
|
instance: process.env.SETTLEMINT_BLOCKSCOUT_ENDPOINT!,
|
269160
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269168
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
269161
269169
|
}, {
|
269162
269170
|
fetch: requestLogger(logger, "blockscout", fetch) as typeof fetch,
|
269163
269171
|
});
|
@@ -269184,7 +269192,7 @@ async function codegenIpfs(env2) {
|
|
269184
269192
|
|
269185
269193
|
export const { client } = createServerIpfsClient({
|
269186
269194
|
instance: process.env.SETTLEMINT_IPFS_API_ENDPOINT!,
|
269187
|
-
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN,
|
269195
|
+
accessToken: process.env.SETTLEMINT_ACCESS_TOKEN ?? "",
|
269188
269196
|
});`;
|
269189
269197
|
await writeTemplate(clientTemplate, "/lib/settlemint", "ipfs.ts");
|
269190
269198
|
const projectDir = await projectRoot3();
|
@@ -274817,7 +274825,7 @@ async function codegenViem(env2) {
|
|
274817
274825
|
* The public client. Use this if you need to read from the blockchain.
|
274818
274826
|
*/
|
274819
274827
|
export const publicClient = getPublicClient({
|
274820
|
-
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN,
|
274828
|
+
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
274821
274829
|
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
|
274822
274830
|
chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
|
274823
274831
|
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT!,
|
@@ -274829,7 +274837,7 @@ export const publicClient = getPublicClient({
|
|
274829
274837
|
* The wallet client. Use this if you need to write to the blockchain.
|
274830
274838
|
*/
|
274831
274839
|
export const walletClient = getWalletClient({
|
274832
|
-
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN,
|
274840
|
+
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
274833
274841
|
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
|
274834
274842
|
chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
|
274835
274843
|
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
|
@@ -274840,7 +274848,7 @@ export const walletClient = getWalletClient({
|
|
274840
274848
|
* HD wallets require a challenge response to be sent with the request.
|
274841
274849
|
*/
|
274842
274850
|
export const hdWalletClient = getWalletClient({
|
274843
|
-
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN,
|
274851
|
+
accessToken: process.env.SETTLEMINT_BLOCKCHAIN_ACCESS_TOKEN ?? "",
|
274844
274852
|
chainId: ${env2.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID ? "process.env.SETTLEMINT_BLOCKCHAIN_NETWORK_CHAIN_ID!" : `"${chainId}"`},
|
274845
274853
|
chainName: process.env.SETTLEMINT_BLOCKCHAIN_NETWORK!,
|
274846
274854
|
rpcUrl: process.env.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT!,
|
@@ -275487,7 +275495,12 @@ async function theGraphPrompt({
|
|
275487
275495
|
}
|
275488
275496
|
|
275489
275497
|
// src/prompts/instance.prompt.ts
|
275490
|
-
async function instancePrompt(
|
275498
|
+
async function instancePrompt({
|
275499
|
+
env: env2,
|
275500
|
+
accept,
|
275501
|
+
freeTextInput = false,
|
275502
|
+
isCi = is_in_ci_default
|
275503
|
+
}) {
|
275491
275504
|
const autoAccept = !!accept || isCi;
|
275492
275505
|
const defaultInstance = env2.SETTLEMINT_INSTANCE;
|
275493
275506
|
const defaultPossible = autoAccept && defaultInstance;
|
@@ -275531,12 +275544,13 @@ async function instancePrompt(env2, accept, freeTextInput = false, isCi = is_in_
|
|
275531
275544
|
value: STANDALONE_INSTANCE2
|
275532
275545
|
}
|
275533
275546
|
],
|
275534
|
-
default: sanitizeInstanceUrl(defaultPromptInstance)
|
275547
|
+
default: sanitizeInstanceUrl(knownInstances.length > 0 ? defaultPromptInstance : STANDALONE_INSTANCE2)
|
275535
275548
|
});
|
275536
275549
|
}
|
275537
275550
|
|
275538
275551
|
// src/prompts/standalone/service-secret.prompt.ts
|
275539
275552
|
async function serviceSecretPrompt({
|
275553
|
+
name: name3,
|
275540
275554
|
defaultSecret,
|
275541
275555
|
message = "Enter service secret:",
|
275542
275556
|
accept = false,
|
@@ -275551,7 +275565,7 @@ async function serviceSecretPrompt({
|
|
275551
275565
|
}
|
275552
275566
|
if (defaultSecret) {
|
275553
275567
|
const keep = await esm_default4({
|
275554
|
-
message:
|
275568
|
+
message: `Do you want to use the existing ${name3} secret?`,
|
275555
275569
|
default: true
|
275556
275570
|
});
|
275557
275571
|
if (keep) {
|
@@ -275561,7 +275575,7 @@ async function serviceSecretPrompt({
|
|
275561
275575
|
const serviceSecret = await esm_default5({
|
275562
275576
|
message
|
275563
275577
|
});
|
275564
|
-
return serviceSecret
|
275578
|
+
return serviceSecret || undefined;
|
275565
275579
|
}
|
275566
275580
|
|
275567
275581
|
// src/prompts/standalone/service-url.prompt.ts
|
@@ -275593,7 +275607,7 @@ async function serviceUrlPrompt({
|
|
275593
275607
|
},
|
275594
275608
|
transformer: (value4) => value4.trim()
|
275595
275609
|
});
|
275596
|
-
return
|
275610
|
+
return serviceUrl || undefined;
|
275597
275611
|
}
|
275598
275612
|
|
275599
275613
|
// src/prompts/workspace.prompt.ts
|
@@ -275858,6 +275872,46 @@ function getHdPrivateKeyEnv(service) {
|
|
275858
275872
|
};
|
275859
275873
|
}
|
275860
275874
|
|
275875
|
+
// src/utils/subgraph/thegraph-url.ts
|
275876
|
+
function getUpdatedSubgraphEndpoints({
|
275877
|
+
existingEndpoints,
|
275878
|
+
newSubgraphName,
|
275879
|
+
middlewareAdminUrl,
|
275880
|
+
removedSubgraphName
|
275881
|
+
}) {
|
275882
|
+
const existingEndpointsWithoutRemoved = existingEndpoints.filter((endpoint) => {
|
275883
|
+
return getSubgraphName(endpoint) !== removedSubgraphName;
|
275884
|
+
});
|
275885
|
+
if (newSubgraphName) {
|
275886
|
+
if (!middlewareAdminUrl) {
|
275887
|
+
throw new Error("Middleware admin URL is required to add a new subgraph");
|
275888
|
+
}
|
275889
|
+
const baseUrl = extractBaseUrlBeforeSegment(middlewareAdminUrl, "/admin");
|
275890
|
+
if (baseUrl) {
|
275891
|
+
const endpoint = `${getTheGraphSubgraphUrl(baseUrl, newSubgraphName)}`;
|
275892
|
+
if (!existingEndpointsWithoutRemoved.includes(endpoint)) {
|
275893
|
+
existingEndpointsWithoutRemoved.push(endpoint);
|
275894
|
+
}
|
275895
|
+
}
|
275896
|
+
}
|
275897
|
+
return existingEndpointsWithoutRemoved;
|
275898
|
+
}
|
275899
|
+
function getTheGraphUrl(subgraphUrls) {
|
275900
|
+
if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
|
275901
|
+
return extractBaseUrlBeforeSegment(subgraphUrls[0], "/subgraphs");
|
275902
|
+
}
|
275903
|
+
return;
|
275904
|
+
}
|
275905
|
+
function getTheGraphSubgraphNames(subgraphUrls) {
|
275906
|
+
if (Array.isArray(subgraphUrls) && subgraphUrls.length > 0) {
|
275907
|
+
return subgraphUrls.map((url2) => getSubgraphName(url2));
|
275908
|
+
}
|
275909
|
+
return [];
|
275910
|
+
}
|
275911
|
+
function getTheGraphSubgraphUrl(theGraphUrl, subgraphName) {
|
275912
|
+
return `${theGraphUrl}/subgraphs/name/${subgraphName}`;
|
275913
|
+
}
|
275914
|
+
|
275861
275915
|
// ../utils/dist/logging.mjs
|
275862
275916
|
var maskTokens4 = (output) => {
|
275863
275917
|
return output.replace(/sm_(pat|aat|sat)_[0-9a-zA-Z]+/g, "***");
|
@@ -275917,6 +275971,28 @@ ${JSON.stringify(arg, null, 2)}`;
|
|
275917
275971
|
}
|
275918
275972
|
var logger = createLogger();
|
275919
275973
|
|
275974
|
+
// src/prompts/standalone/service-value.prompt.ts
|
275975
|
+
async function serviceValuePrompt({
|
275976
|
+
defaultValue,
|
275977
|
+
example,
|
275978
|
+
message = "Enter service value:",
|
275979
|
+
accept = false,
|
275980
|
+
isCi = is_in_ci_default
|
275981
|
+
}) {
|
275982
|
+
const autoAccept = !!accept || isCi;
|
275983
|
+
if (autoAccept && defaultValue) {
|
275984
|
+
return defaultValue;
|
275985
|
+
}
|
275986
|
+
if (isCi) {
|
275987
|
+
return defaultValue;
|
275988
|
+
}
|
275989
|
+
const serviceSecret = await esm_default2({
|
275990
|
+
message: example ? `${message} (eg ${example})` : message,
|
275991
|
+
default: defaultValue
|
275992
|
+
});
|
275993
|
+
return serviceSecret || undefined;
|
275994
|
+
}
|
275995
|
+
|
275920
275996
|
// src/commands/connect.ts
|
275921
275997
|
function connectCommand() {
|
275922
275998
|
return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").option("-i, --instance <instance>", "The instance to connect to (defaults to the instance in the .env file). Use 'standalone' if your resources are not deployed on the SettleMint platform").description("Connects your dApp to your application").usage(createExamples([
|
@@ -275939,7 +276015,10 @@ function connectCommand() {
|
|
275939
276015
|
])).action(async ({ acceptDefaults, prod, instance }) => {
|
275940
276016
|
intro("Connecting your dApp");
|
275941
276017
|
const env2 = await loadEnv(false, !!prod);
|
275942
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(
|
276018
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
276019
|
+
env: env2,
|
276020
|
+
accept: true
|
276021
|
+
});
|
275943
276022
|
if (selectedInstance === STANDALONE_INSTANCE2) {
|
275944
276023
|
await connectToStandalone(env2, acceptDefaults, prod);
|
275945
276024
|
} else {
|
@@ -276141,7 +276220,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276141
276220
|
message: "What is the JSON RPC endpoint for the blockchain node you want to use for sending transactions?",
|
276142
276221
|
example: "https://blockchain-node.mydomain.com",
|
276143
276222
|
defaultValue: env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT,
|
276144
|
-
|
276223
|
+
type: "url"
|
276145
276224
|
},
|
276146
276225
|
{
|
276147
276226
|
id: "loadBalancerJsonRpcEndpoint",
|
@@ -276149,7 +276228,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276149
276228
|
message: "What is the JSON RPC endpoint for the load balancer or blockchain node you want to use for read operations?",
|
276150
276229
|
example: "https://load-balancer.mydomain.com",
|
276151
276230
|
defaultValue: env2.SETTLEMINT_BLOCKCHAIN_NODE_OR_LOAD_BALANCER_JSON_RPC_ENDPOINT,
|
276152
|
-
|
276231
|
+
type: "url"
|
276153
276232
|
},
|
276154
276233
|
{
|
276155
276234
|
id: "hasuraEndpoint",
|
@@ -276157,7 +276236,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276157
276236
|
message: "What is the GraphQL endpoint for the Hasura instance you want to connect to?",
|
276158
276237
|
example: "https://hasura.mydomain.com/v1/graphql",
|
276159
276238
|
defaultValue: env2.SETTLEMINT_HASURA_ENDPOINT,
|
276160
|
-
|
276239
|
+
type: "url"
|
276161
276240
|
},
|
276162
276241
|
{
|
276163
276242
|
id: "hasuraAdminSecret",
|
@@ -276165,7 +276244,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276165
276244
|
message: "What is the admin secret for the Hasura instance you want to connect to?",
|
276166
276245
|
example: "",
|
276167
276246
|
defaultValue: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
|
276168
|
-
|
276247
|
+
type: "secret"
|
276169
276248
|
},
|
276170
276249
|
{
|
276171
276250
|
id: "hasuraDatabaseUrl",
|
@@ -276173,15 +276252,23 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276173
276252
|
message: "What is the database URL for the Hasura instance you want to connect to?",
|
276174
276253
|
example: "postgresql://username:password@host:port/database",
|
276175
276254
|
defaultValue: env2.SETTLEMINT_HASURA_DATABASE_URL,
|
276176
|
-
|
276255
|
+
type: "url"
|
276177
276256
|
},
|
276178
276257
|
{
|
276179
276258
|
id: "theGraphEndpoint",
|
276180
|
-
label: "The Graph
|
276181
|
-
message: "What is the
|
276182
|
-
example: "https://thegraph.mydomain.com
|
276183
|
-
defaultValue:
|
276184
|
-
|
276259
|
+
label: "The Graph Endpoint",
|
276260
|
+
message: "What is the endpoint for the The Graph instance you want to connect to?",
|
276261
|
+
example: "https://thegraph.mydomain.com",
|
276262
|
+
defaultValue: getTheGraphUrl(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS),
|
276263
|
+
type: "url"
|
276264
|
+
},
|
276265
|
+
{
|
276266
|
+
id: "theGraphSubgraphNames",
|
276267
|
+
label: "The Graph subgraph names",
|
276268
|
+
message: "What are the names of the subgraphs you want to connect to (separated by commas)?",
|
276269
|
+
example: "subgraph-1,subgraph-2",
|
276270
|
+
defaultValue: getTheGraphSubgraphNames(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS).join(","),
|
276271
|
+
type: "value"
|
276185
276272
|
},
|
276186
276273
|
{
|
276187
276274
|
id: "portalGraphqlEndpoint",
|
@@ -276189,7 +276276,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276189
276276
|
message: "What is the GraphQL endpoint for the Smart Contract Portal instance you want to connect to?",
|
276190
276277
|
example: "https://portal.mydomain.com/graphql",
|
276191
276278
|
defaultValue: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT,
|
276192
|
-
|
276279
|
+
type: "url"
|
276193
276280
|
},
|
276194
276281
|
{
|
276195
276282
|
id: "minioEndpoint",
|
@@ -276197,7 +276284,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276197
276284
|
message: "What is the endpoint for the MinIO instance you want to connect to?",
|
276198
276285
|
example: "s3://minio.mydomain.com",
|
276199
276286
|
defaultValue: env2.SETTLEMINT_MINIO_ENDPOINT,
|
276200
|
-
|
276287
|
+
type: "url"
|
276201
276288
|
},
|
276202
276289
|
{
|
276203
276290
|
id: "minioAccessKey",
|
@@ -276205,7 +276292,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276205
276292
|
message: "What is the access key for the MinIO instance you want to connect to?",
|
276206
276293
|
example: "",
|
276207
276294
|
defaultValue: env2.SETTLEMINT_MINIO_ACCESS_KEY,
|
276208
|
-
|
276295
|
+
type: "secret"
|
276209
276296
|
},
|
276210
276297
|
{
|
276211
276298
|
id: "minioSecretKey",
|
@@ -276213,7 +276300,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276213
276300
|
message: "What is the secret key for the MinIO instance you want to connect to?",
|
276214
276301
|
example: "",
|
276215
276302
|
defaultValue: env2.SETTLEMINT_MINIO_SECRET_KEY,
|
276216
|
-
|
276303
|
+
type: "secret"
|
276217
276304
|
},
|
276218
276305
|
{
|
276219
276306
|
id: "ipfsApiEndpoint",
|
@@ -276221,7 +276308,7 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276221
276308
|
message: "What is the endpoint for the IPFS instance you want to connect to?",
|
276222
276309
|
example: "https://ipfs.mydomain.com/api/v0",
|
276223
276310
|
defaultValue: env2.SETTLEMINT_IPFS_API_ENDPOINT,
|
276224
|
-
|
276311
|
+
type: "url"
|
276225
276312
|
},
|
276226
276313
|
{
|
276227
276314
|
id: "blockscoutGraphqlEndpoint",
|
@@ -276229,42 +276316,44 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276229
276316
|
message: "What is the GraphQL endpoint for the Blockscout instance you want to connect to?",
|
276230
276317
|
example: "https://blockscout.mydomain.com/api/v1/graphql",
|
276231
276318
|
defaultValue: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT,
|
276232
|
-
|
276319
|
+
type: "url"
|
276233
276320
|
}
|
276234
276321
|
];
|
276235
276322
|
const selectedServices = {};
|
276236
276323
|
for (const prompt of standalonePrompts) {
|
276237
|
-
const { id, message, example, defaultValue,
|
276238
|
-
const result =
|
276324
|
+
const { id, label, message, example, defaultValue, type: type4 } = prompt;
|
276325
|
+
const result = type4 === "secret" ? await serviceSecretPrompt({
|
276326
|
+
name: label,
|
276239
276327
|
message,
|
276240
276328
|
defaultSecret: defaultValue,
|
276241
276329
|
accept: acceptDefaults
|
276242
|
-
}) : await serviceUrlPrompt({
|
276330
|
+
}) : type4 === "url" ? await serviceUrlPrompt({
|
276243
276331
|
message,
|
276244
276332
|
example,
|
276245
276333
|
defaultUrl: defaultValue,
|
276246
276334
|
accept: acceptDefaults
|
276335
|
+
}) : await serviceValuePrompt({
|
276336
|
+
message,
|
276337
|
+
example,
|
276338
|
+
defaultValue,
|
276339
|
+
accept: acceptDefaults
|
276247
276340
|
});
|
276248
276341
|
selectedServices[id] = {
|
276249
276342
|
label: prompt.label,
|
276250
276343
|
result,
|
276251
|
-
isSecret
|
276344
|
+
isSecret: type4 === "secret"
|
276252
276345
|
};
|
276253
276346
|
}
|
276254
276347
|
if (acceptDefaults) {
|
276255
|
-
table("
|
276256
|
-
if (item.isSecret) {
|
276257
|
-
return {
|
276258
|
-
...item,
|
276259
|
-
result: "********"
|
276260
|
-
};
|
276261
|
-
}
|
276348
|
+
table("Configuration", Object.values(selectedServices).filter((item) => !item.isSecret).map((item) => {
|
276262
276349
|
return {
|
276263
|
-
|
276264
|
-
|
276350
|
+
name: item.label,
|
276351
|
+
value: item.result ? maskTokens4(item.result) : undefined
|
276265
276352
|
};
|
276266
276353
|
}).filter(Boolean));
|
276267
276354
|
}
|
276355
|
+
const theGraphUrl = selectedServices.theGraphEndpoint?.result;
|
276356
|
+
const theGraphSubgraphNames = selectedServices.theGraphSubgraphNames?.result;
|
276268
276357
|
await writeEnvSpinner(!!prod, {
|
276269
276358
|
SETTLEMINT_INSTANCE: STANDALONE_INSTANCE2,
|
276270
276359
|
SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT: selectedServices.blockchainNodeJsonRpcEndpoint?.result,
|
@@ -276272,8 +276361,8 @@ async function connectToStandalone(env2, acceptDefaults, prod) {
|
|
276272
276361
|
SETTLEMINT_HASURA_ENDPOINT: selectedServices.hasuraEndpoint?.result,
|
276273
276362
|
SETTLEMINT_HASURA_ADMIN_SECRET: selectedServices.hasuraAdminSecret?.result,
|
276274
276363
|
SETTLEMINT_HASURA_DATABASE_URL: selectedServices.hasuraDatabaseUrl?.result,
|
276275
|
-
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS:
|
276276
|
-
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH:
|
276364
|
+
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: theGraphUrl && theGraphSubgraphNames ? theGraphSubgraphNames.split(",").map((name3) => getTheGraphSubgraphUrl(theGraphUrl, name3)) : [],
|
276365
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: theGraphSubgraphNames ? theGraphSubgraphNames.split(",")[0] : undefined,
|
276277
276366
|
SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT: selectedServices.portalGraphqlEndpoint?.result,
|
276278
276367
|
SETTLEMINT_MINIO_ENDPOINT: selectedServices.minioEndpoint?.result,
|
276279
276368
|
SETTLEMINT_MINIO_ACCESS_KEY: selectedServices.minioAccessKey?.result,
|
@@ -280074,7 +280163,10 @@ function createCommand2() {
|
|
280074
280163
|
if (version5 && !template) {
|
280075
280164
|
cancel2("The --version option requires the --template option to be set");
|
280076
280165
|
}
|
280077
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(
|
280166
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
280167
|
+
env: env2,
|
280168
|
+
accept: true
|
280169
|
+
});
|
280078
280170
|
const settlemint = createSettleMintClient({
|
280079
280171
|
instance: selectedInstance,
|
280080
280172
|
accessToken: "",
|
@@ -280179,38 +280271,49 @@ function hasuraTrackCommand() {
|
|
280179
280271
|
])).option("-a, --accept-defaults", "Accept the default and previously set values").option("-d, --database <database>", "Database name", "default").action(async ({ acceptDefaults, database }) => {
|
280180
280272
|
intro("Tracking all tables in Hasura");
|
280181
280273
|
const env2 = await loadEnv(false, false);
|
280182
|
-
const
|
280183
|
-
if (!applicationUniqueName) {
|
280184
|
-
return missingApplication();
|
280185
|
-
}
|
280186
|
-
const selectedInstance = await instancePrompt(env2, true);
|
280187
|
-
const accessToken = await getApplicationOrPersonalAccessToken({
|
280188
|
-
env: env2,
|
280189
|
-
instance: selectedInstance,
|
280190
|
-
prefer: "application"
|
280191
|
-
});
|
280192
|
-
const settlemint = createSettleMintClient({
|
280193
|
-
accessToken,
|
280194
|
-
instance: selectedInstance
|
280195
|
-
});
|
280196
|
-
const integrationTools = await serviceSpinner("integration tool", () => settlemint.integrationTool.list(applicationUniqueName));
|
280197
|
-
const hasura = await hasuraPrompt({
|
280274
|
+
const selectedInstance = await instancePrompt({
|
280198
280275
|
env: env2,
|
280199
|
-
|
280200
|
-
accept: acceptDefaults,
|
280201
|
-
isRequired: true
|
280276
|
+
accept: true
|
280202
280277
|
});
|
280203
|
-
|
280204
|
-
|
280278
|
+
let hasuraGraphqlEndpoint;
|
280279
|
+
let hasuraAdminSecret;
|
280280
|
+
let accessToken;
|
280281
|
+
if (selectedInstance === STANDALONE_INSTANCE2) {
|
280282
|
+
hasuraGraphqlEndpoint = env2.SETTLEMINT_HASURA_ENDPOINT;
|
280283
|
+
hasuraAdminSecret = env2.SETTLEMINT_HASURA_ADMIN_SECRET;
|
280284
|
+
} else {
|
280285
|
+
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
280286
|
+
if (!applicationUniqueName) {
|
280287
|
+
return missingApplication();
|
280288
|
+
}
|
280289
|
+
accessToken = await getApplicationOrPersonalAccessToken({
|
280290
|
+
env: env2,
|
280291
|
+
instance: selectedInstance,
|
280292
|
+
prefer: "application"
|
280293
|
+
});
|
280294
|
+
const settlemint = createSettleMintClient({
|
280295
|
+
accessToken,
|
280296
|
+
instance: selectedInstance
|
280297
|
+
});
|
280298
|
+
const integrationTools = await serviceSpinner("integration tool", () => settlemint.integrationTool.list(applicationUniqueName));
|
280299
|
+
const hasura = await hasuraPrompt({
|
280300
|
+
env: env2,
|
280301
|
+
integrations: integrationTools,
|
280302
|
+
accept: acceptDefaults,
|
280303
|
+
isRequired: true
|
280304
|
+
});
|
280305
|
+
if (!hasura) {
|
280306
|
+
return nothingSelectedError("Hasura instance");
|
280307
|
+
}
|
280308
|
+
const hasuraEnv = getHasuraEnv(hasura);
|
280309
|
+
hasuraGraphqlEndpoint = hasuraEnv.SETTLEMINT_HASURA_ENDPOINT;
|
280310
|
+
hasuraAdminSecret = hasuraEnv.SETTLEMINT_HASURA_ADMIN_SECRET;
|
280205
280311
|
}
|
280206
|
-
const hasuraEnv = getHasuraEnv(hasura);
|
280207
|
-
const hasuraGraphqlEndpoint = hasuraEnv.SETTLEMINT_HASURA_ENDPOINT;
|
280208
|
-
const hasuraAdminSecret = hasuraEnv.SETTLEMINT_HASURA_ADMIN_SECRET;
|
280209
280312
|
if (!hasuraGraphqlEndpoint || !hasuraAdminSecret) {
|
280210
280313
|
return note("Could not retrieve Hasura endpoint or admin secret. Please check your configuration.");
|
280211
280314
|
}
|
280212
|
-
const baseUrl =
|
280213
|
-
const queryEndpoint = new URL(
|
280315
|
+
const baseUrl = extractBaseUrlBeforeSegment(hasuraGraphqlEndpoint, "/v1/graphql");
|
280316
|
+
const queryEndpoint = new URL(`${baseUrl}/v1/metadata`).toString();
|
280214
280317
|
const messages = [];
|
280215
280318
|
const { result } = await spinner({
|
280216
280319
|
startMessage: `Tracking all tables in Hasura from database "${database}"`,
|
@@ -280219,11 +280322,12 @@ function hasuraTrackCommand() {
|
|
280219
280322
|
const executeHasuraQuery = async (query) => {
|
280220
280323
|
const response = await fetch(queryEndpoint, {
|
280221
280324
|
method: "POST",
|
280222
|
-
headers: {
|
280325
|
+
headers: appendHeaders({
|
280223
280326
|
"Content-Type": "application/json",
|
280224
|
-
"X-Hasura-Admin-Secret": hasuraAdminSecret
|
280327
|
+
"X-Hasura-Admin-Secret": hasuraAdminSecret
|
280328
|
+
}, {
|
280225
280329
|
"x-auth-token": accessToken
|
280226
|
-
},
|
280330
|
+
}),
|
280227
280331
|
body: JSON.stringify(query)
|
280228
280332
|
});
|
280229
280333
|
if (!response.ok) {
|
@@ -280342,7 +280446,11 @@ function loginCommand() {
|
|
280342
280446
|
intro("Login to your SettleMint account");
|
280343
280447
|
const autoAccept = !!acceptDefaults || !!tokenStdin;
|
280344
280448
|
const env2 = await loadEnv(false, false);
|
280345
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(
|
280449
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
280450
|
+
env: env2,
|
280451
|
+
accept: autoAccept,
|
280452
|
+
freeTextInput: true
|
280453
|
+
});
|
280346
280454
|
let personalAccessToken = "";
|
280347
280455
|
if (tokenStdin) {
|
280348
280456
|
if (cmd2.args.length > 0) {
|
@@ -280459,11 +280567,17 @@ function pincodeVerificationResponseCommand() {
|
|
280459
280567
|
])).action(async ({ instance, blockchainNode, walletAddress }) => {
|
280460
280568
|
intro("Generating pincode verification response for wallet address");
|
280461
280569
|
const env2 = await loadEnv(false, false);
|
280570
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
280571
|
+
env: env2,
|
280572
|
+
accept: true
|
280573
|
+
});
|
280574
|
+
if (selectedInstance === STANDALONE_INSTANCE2) {
|
280575
|
+
return cancel2("This command does not support standalone instances");
|
280576
|
+
}
|
280462
280577
|
const applicationUniqueName = env2.SETTLEMINT_APPLICATION;
|
280463
280578
|
if (!applicationUniqueName) {
|
280464
280579
|
return missingApplication();
|
280465
280580
|
}
|
280466
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(env2, true);
|
280467
280581
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
280468
280582
|
if (!personalAccessToken) {
|
280469
280583
|
return missingPersonalAccessTokenError();
|
@@ -280682,7 +280796,7 @@ function getCreateCommand({
|
|
280682
280796
|
execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait: wait2, restartIfTimeout, provider, region }, createFunction) => {
|
280683
280797
|
intro(`Creating ${type4} in the SettleMint platform`);
|
280684
280798
|
const env2 = await loadEnv(false, !!prod);
|
280685
|
-
const instance = await instancePrompt(env2, acceptDefaults);
|
280799
|
+
const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
|
280686
280800
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
280687
280801
|
env: env2,
|
280688
280802
|
instance,
|
@@ -282107,7 +282221,7 @@ function getDeleteCommand({
|
|
282107
282221
|
await deleteConfirmationPrompt(`this ${type4}`);
|
282108
282222
|
}
|
282109
282223
|
const env2 = await loadEnv(false, !!prod);
|
282110
|
-
const instance = await instancePrompt(env2, acceptDefaults);
|
282224
|
+
const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
|
282111
282225
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
282112
282226
|
env: env2,
|
282113
282227
|
instance,
|
@@ -282201,7 +282315,7 @@ function getRestartCommand({
|
|
282201
282315
|
])).argument("<unique-name>", `The unique name of the ${type4}, use 'default' to restart the default one from your .env file`).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").option("-w, --wait", "Wait until restarted").action(async (uniqueName, { acceptDefaults, prod, wait: wait2 }) => {
|
282202
282316
|
intro(`Restarting ${type4} in the SettleMint platform`);
|
282203
282317
|
const env2 = await loadEnv(false, !!prod);
|
282204
|
-
const instance = await instancePrompt(env2, acceptDefaults);
|
282318
|
+
const instance = await instancePrompt({ env: env2, accept: acceptDefaults });
|
282205
282319
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
282206
282320
|
env: env2,
|
282207
282321
|
instance,
|
@@ -282417,7 +282531,10 @@ function customDeploymentsUpdateCommand() {
|
|
282417
282531
|
if (!customDeploymentUniqueName) {
|
282418
282532
|
cancel2("No custom deployment unique name specified. Please provide it either via the --unique-name flag or by setting the SETTLEMINT_CUSTOM_DEPLOYMENT environment variable");
|
282419
282533
|
}
|
282420
|
-
const instance = await instancePrompt(
|
282534
|
+
const instance = await instancePrompt({
|
282535
|
+
env: env2,
|
282536
|
+
accept: true
|
282537
|
+
});
|
282421
282538
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
282422
282539
|
env: env2,
|
282423
282540
|
instance,
|
@@ -282525,7 +282642,10 @@ function configCommand() {
|
|
282525
282642
|
])).action(async ({ prod, instance, output }) => {
|
282526
282643
|
intro("Getting platform configuration");
|
282527
282644
|
const env2 = await loadEnv(false, !!prod);
|
282528
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(
|
282645
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
282646
|
+
env: env2,
|
282647
|
+
accept: true
|
282648
|
+
});
|
282529
282649
|
const settlemint = createSettleMintClient({
|
282530
282650
|
accessToken: "",
|
282531
282651
|
instance: selectedInstance,
|
@@ -282644,7 +282764,10 @@ function applicationsListCommand() {
|
|
282644
282764
|
])).option("-w, --workspace <workspace>", "The workspace unique name to list applications for (defaults to workspace from env)").addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).action(async ({ workspace, output }) => {
|
282645
282765
|
intro("Listing applications");
|
282646
282766
|
const env2 = await loadEnv(false, false);
|
282647
|
-
const selectedInstance = await instancePrompt(
|
282767
|
+
const selectedInstance = await instancePrompt({
|
282768
|
+
env: env2,
|
282769
|
+
accept: true
|
282770
|
+
});
|
282648
282771
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
282649
282772
|
if (!personalAccessToken) {
|
282650
282773
|
return missingPersonalAccessTokenError();
|
@@ -282762,7 +282885,10 @@ function servicesCommand() {
|
|
282762
282885
|
])).option("--app, --application <application>", "The application unique name to list the services in (defaults to application from env)").addOption(new Option("-t, --type <type...>", "The type(s) of service to list").choices(SERVICE_TYPES)).addOption(new Option("-o, --output <output>", "The output format").choices(["wide", "json", "yaml"])).arguments("[typeOperands...]").action(async (typeOperands, options) => {
|
282763
282886
|
intro("Listing application services");
|
282764
282887
|
const env2 = await loadEnv(false, false);
|
282765
|
-
const selectedInstance = await instancePrompt(
|
282888
|
+
const selectedInstance = await instancePrompt({
|
282889
|
+
env: env2,
|
282890
|
+
accept: true
|
282891
|
+
});
|
282766
282892
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
282767
282893
|
if (!personalAccessToken) {
|
282768
282894
|
return missingPersonalAccessTokenError();
|
@@ -282915,7 +283041,10 @@ function workspacesListCommand() {
|
|
282915
283041
|
intro("Listing workspaces");
|
282916
283042
|
}
|
282917
283043
|
const env2 = await loadEnv(false, false);
|
282918
|
-
const selectedInstance = await instancePrompt(
|
283044
|
+
const selectedInstance = await instancePrompt({
|
283045
|
+
env: env2,
|
283046
|
+
accept: true
|
283047
|
+
});
|
282919
283048
|
const personalAccessToken = await getInstanceCredentials(selectedInstance);
|
282920
283049
|
if (!personalAccessToken) {
|
282921
283050
|
return missingPersonalAccessTokenError();
|
@@ -283026,7 +283155,10 @@ function createCommand4() {
|
|
283026
283155
|
intro("Creating a new smart contract set");
|
283027
283156
|
const env2 = await loadEnv(false, false);
|
283028
283157
|
const name3 = await projectNamePrompt(env2, projectName);
|
283029
|
-
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt(
|
283158
|
+
const selectedInstance = instance ? sanitizeAndValidateInstanceUrl(instance) : await instancePrompt({
|
283159
|
+
env: env2,
|
283160
|
+
accept: true
|
283161
|
+
});
|
283030
283162
|
const settlemint = createSettleMintClient({
|
283031
283163
|
instance: selectedInstance,
|
283032
283164
|
accessToken: "",
|
@@ -283440,7 +283572,10 @@ function hardhatDeployRemoteCommand() {
|
|
283440
283572
|
const env2 = await loadEnv(false, !!prod);
|
283441
283573
|
let node;
|
283442
283574
|
let envHardhatConfig = {};
|
283443
|
-
const instance = await instancePrompt(
|
283575
|
+
const instance = await instancePrompt({
|
283576
|
+
env: env2,
|
283577
|
+
accept: true
|
283578
|
+
});
|
283444
283579
|
if (instance === STANDALONE_INSTANCE2) {
|
283445
283580
|
envHardhatConfig.BTP_RPC_URL = env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT ?? "";
|
283446
283581
|
} else {
|
@@ -283453,8 +283588,8 @@ function hardhatDeployRemoteCommand() {
|
|
283453
283588
|
accessToken,
|
283454
283589
|
instance
|
283455
283590
|
});
|
283456
|
-
|
283457
|
-
envHardhatConfig = await settlemint.foundry.env(
|
283591
|
+
node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
283592
|
+
envHardhatConfig = await settlemint.foundry.env(node.uniqueName);
|
283458
283593
|
}
|
283459
283594
|
const hardhatConfig = await getHardhatConfigData(envHardhatConfig);
|
283460
283595
|
if (verify && !hardhatConfig?.etherscan?.apiKey) {
|
@@ -283577,20 +283712,28 @@ function hardhatScriptRemoteCommand() {
|
|
283577
283712
|
await validateIfRequiredPackagesAreInstalled(["hardhat"]);
|
283578
283713
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
283579
283714
|
const env2 = await loadEnv(false, !!prod);
|
283580
|
-
|
283581
|
-
const
|
283715
|
+
let envHardhatConfig = {};
|
283716
|
+
const instance = await instancePrompt({
|
283582
283717
|
env: env2,
|
283583
|
-
|
283584
|
-
prefer: "application"
|
283718
|
+
accept: true
|
283585
283719
|
});
|
283586
|
-
|
283587
|
-
|
283588
|
-
|
283589
|
-
|
283590
|
-
|
283591
|
-
|
283720
|
+
if (instance === STANDALONE_INSTANCE2) {
|
283721
|
+
envHardhatConfig.BTP_RPC_URL = env2.SETTLEMINT_BLOCKCHAIN_NODE_JSON_RPC_ENDPOINT ?? "";
|
283722
|
+
} else {
|
283723
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
283724
|
+
env: env2,
|
283725
|
+
instance,
|
283726
|
+
prefer: "application"
|
283727
|
+
});
|
283728
|
+
const settlemint = createSettleMintClient({
|
283729
|
+
accessToken,
|
283730
|
+
instance
|
283731
|
+
});
|
283732
|
+
const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
283733
|
+
envHardhatConfig = await settlemint.foundry.env(node.uniqueName);
|
283734
|
+
}
|
283592
283735
|
const { command, args } = await getPackageManagerExecutable();
|
283593
|
-
await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env:
|
283736
|
+
await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envHardhatConfig });
|
283594
283737
|
outro("Script execution completed successfully");
|
283595
283738
|
});
|
283596
283739
|
return cmd2;
|
@@ -283760,8 +283903,11 @@ async function getTheGraphNetwork({
|
|
283760
283903
|
theGraphMiddleware,
|
283761
283904
|
env: env2,
|
283762
283905
|
instance,
|
283763
|
-
accessToken
|
283906
|
+
accessToken = ""
|
283764
283907
|
}) {
|
283908
|
+
if (instance === STANDALONE_INSTANCE2) {
|
283909
|
+
return SETTLEMINT_NETWORK;
|
283910
|
+
}
|
283765
283911
|
const isFixedNetwork = (theGraphMiddleware?.entityVersion ?? 4) >= 4;
|
283766
283912
|
return isFixedNetwork ? SETTLEMINT_NETWORK : sanitizeName(await getNodeName({ env: env2, instance, accessToken }), 30);
|
283767
283913
|
}
|
@@ -283833,30 +283979,37 @@ function subgraphDeployCommand() {
|
|
283833
283979
|
description: "Deploy the subgraph with a specific name",
|
283834
283980
|
command: "scs subgraph deploy my-subgraph"
|
283835
283981
|
}
|
283836
|
-
])).option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").argument("[subgraph-name]", "The name of the subgraph to deploy (defaults to value in .env if not provided)").action(async (subgraphName, { prod, acceptDefaults }) => {
|
283982
|
+
])).option("--ipfs <ipfs-url>", "The IPFS URL to use for the subgraph deployment (defaults to https://ipfs.console.settlemint.com)").option("-a, --accept-defaults", "Accept the default and previously set values").option("--prod", "Connect to your production environment").argument("[subgraph-name]", "The name of the subgraph to deploy (defaults to value in .env if not provided)").action(async (subgraphName, { prod, acceptDefaults, ipfs }) => {
|
283837
283983
|
intro("Deploying subgraph");
|
283838
283984
|
await validateIfRequiredPackagesAreInstalled(["@graphprotocol/graph-cli"]);
|
283839
283985
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
283840
283986
|
const env2 = await loadEnv(false, !!prod);
|
283841
|
-
const instance = await instancePrompt(
|
283842
|
-
const accessToken = await getApplicationOrPersonalAccessToken({
|
283987
|
+
const instance = await instancePrompt({
|
283843
283988
|
env: env2,
|
283844
|
-
|
283845
|
-
prefer: "application"
|
283989
|
+
accept: true
|
283846
283990
|
});
|
283847
|
-
|
283848
|
-
|
283849
|
-
|
283850
|
-
|
283851
|
-
|
283852
|
-
|
283991
|
+
let theGraphMiddleware;
|
283992
|
+
let accessToken;
|
283993
|
+
if (instance !== STANDALONE_INSTANCE2) {
|
283994
|
+
accessToken = await getApplicationOrPersonalAccessToken({
|
283995
|
+
env: env2,
|
283996
|
+
instance,
|
283997
|
+
prefer: "application"
|
283998
|
+
});
|
283999
|
+
theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
284000
|
+
if (!theGraphMiddleware) {
|
284001
|
+
return nothingSelectedError("graph middleware");
|
284002
|
+
}
|
284003
|
+
if (theGraphMiddleware.status !== "COMPLETED") {
|
284004
|
+
serviceNotRunningError("graph middleware", theGraphMiddleware.status);
|
284005
|
+
}
|
284006
|
+
await updateSpecVersion(theGraphMiddleware.specVersion);
|
283853
284007
|
}
|
283854
284008
|
const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
|
283855
284009
|
await subgraphSetup({
|
283856
284010
|
network
|
283857
284011
|
});
|
283858
284012
|
const subgraphYamlFile = await getSubgraphYamlFile();
|
283859
|
-
await updateSpecVersion(theGraphMiddleware.specVersion);
|
283860
284013
|
const { command, args } = await getPackageManagerExecutable();
|
283861
284014
|
await executeCommand(command, [...args, "graph", "codegen", subgraphYamlFile]);
|
283862
284015
|
const generated = await isGenerated();
|
@@ -283885,7 +284038,21 @@ function subgraphDeployCommand() {
|
|
283885
284038
|
if (!graphName) {
|
283886
284039
|
cancel2("No subgraph name provided. Please provide a subgraph name to continue.");
|
283887
284040
|
}
|
283888
|
-
|
284041
|
+
let middlewareAdminUrl;
|
284042
|
+
if (accessToken && theGraphMiddleware) {
|
284043
|
+
middlewareAdminUrl = new URL(`/${encodeURIComponent(accessToken)}/admin`, theGraphMiddleware.serviceUrl).toString();
|
284044
|
+
} else {
|
284045
|
+
const serviceUrl = await serviceUrlPrompt({
|
284046
|
+
defaultUrl: `${getTheGraphUrl(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS)}/admin`,
|
284047
|
+
accept: autoAccept,
|
284048
|
+
message: "What is the admin endpoint for the The Graph instance you want to connect to?",
|
284049
|
+
example: "https://thegraph.mydomain.com/admin"
|
284050
|
+
});
|
284051
|
+
if (!serviceUrl) {
|
284052
|
+
cancel2("No The Graph admin URL provided. Please provide a The Graph admin URL to continue.");
|
284053
|
+
}
|
284054
|
+
middlewareAdminUrl = serviceUrl.includes("/admin") ? serviceUrl : new URL(`${serviceUrl}/admin`).toString();
|
284055
|
+
}
|
283889
284056
|
await executeCommand(command, [...args, "graph", "create", "--node", middlewareAdminUrl, graphName]);
|
283890
284057
|
await executeCommand(command, [
|
283891
284058
|
...args,
|
@@ -283896,22 +284063,34 @@ function subgraphDeployCommand() {
|
|
283896
284063
|
"--node",
|
283897
284064
|
middlewareAdminUrl,
|
283898
284065
|
"--ipfs",
|
283899
|
-
"https://ipfs.console.settlemint.com",
|
284066
|
+
ipfs ?? "https://ipfs.console.settlemint.com",
|
283900
284067
|
graphName,
|
283901
284068
|
subgraphYamlFile
|
283902
284069
|
]);
|
283903
|
-
|
283904
|
-
|
283905
|
-
|
283906
|
-
|
283907
|
-
|
283908
|
-
|
283909
|
-
|
283910
|
-
|
283911
|
-
|
283912
|
-
|
283913
|
-
|
283914
|
-
|
284070
|
+
if (accessToken && theGraphMiddleware) {
|
284071
|
+
const settlemintClient = createSettleMintClient({
|
284072
|
+
accessToken,
|
284073
|
+
instance
|
284074
|
+
});
|
284075
|
+
const middleware = await settlemintClient.middleware.read(theGraphMiddleware.uniqueName);
|
284076
|
+
const graphEnv = await getGraphEnv(settlemintClient, middleware, graphName);
|
284077
|
+
await writeEnvSpinner(!!prod, {
|
284078
|
+
...env2,
|
284079
|
+
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
284080
|
+
...graphEnv,
|
284081
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH ?? graphName
|
284082
|
+
});
|
284083
|
+
} else {
|
284084
|
+
await writeEnvSpinner(!!prod, {
|
284085
|
+
...env2,
|
284086
|
+
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: getUpdatedSubgraphEndpoints({
|
284087
|
+
existingEndpoints: env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS ?? [],
|
284088
|
+
middlewareAdminUrl,
|
284089
|
+
newSubgraphName: graphName
|
284090
|
+
}),
|
284091
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH ?? graphName
|
284092
|
+
});
|
284093
|
+
}
|
283915
284094
|
outro(`Subgraph ${graphName} deployed successfully`);
|
283916
284095
|
});
|
283917
284096
|
}
|
@@ -283922,7 +284101,6 @@ async function updateSpecVersion(specVersion) {
|
|
283922
284101
|
}
|
283923
284102
|
|
283924
284103
|
// src/commands/smart-contract-set/subgraph/remove.ts
|
283925
|
-
import { dirname as dirname10 } from "node:path";
|
283926
284104
|
function subgraphRemoveCommand() {
|
283927
284105
|
return new Command("remove").description("Remove a subgraph").usage(createExamples([
|
283928
284106
|
{
|
@@ -283943,46 +284121,76 @@ function subgraphRemoveCommand() {
|
|
283943
284121
|
if (!force) {
|
283944
284122
|
await deleteConfirmationPrompt(`the subgraph ${graphName}`);
|
283945
284123
|
}
|
283946
|
-
const instance = await instancePrompt(
|
283947
|
-
const accessToken = await getApplicationOrPersonalAccessToken({
|
284124
|
+
const instance = await instancePrompt({
|
283948
284125
|
env: env2,
|
283949
|
-
|
283950
|
-
prefer: "application"
|
284126
|
+
accept: true
|
283951
284127
|
});
|
283952
|
-
|
283953
|
-
|
283954
|
-
|
283955
|
-
|
283956
|
-
|
283957
|
-
|
284128
|
+
let theGraphMiddleware;
|
284129
|
+
let accessToken;
|
284130
|
+
if (instance !== STANDALONE_INSTANCE2) {
|
284131
|
+
accessToken = await getApplicationOrPersonalAccessToken({
|
284132
|
+
env: env2,
|
284133
|
+
instance,
|
284134
|
+
prefer: "application"
|
284135
|
+
});
|
284136
|
+
theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
284137
|
+
if (!theGraphMiddleware) {
|
284138
|
+
return nothingSelectedError("graph middleware");
|
284139
|
+
}
|
284140
|
+
if (theGraphMiddleware.status !== "COMPLETED") {
|
284141
|
+
serviceNotRunningError("graph middleware", theGraphMiddleware.status);
|
284142
|
+
}
|
283958
284143
|
}
|
283959
|
-
const subgraphYamlFile = await getSubgraphYamlFile();
|
283960
|
-
const cwd2 = dirname10(subgraphYamlFile);
|
283961
284144
|
const { command, args } = await getPackageManagerExecutable();
|
283962
|
-
|
284145
|
+
let middlewareAdminUrl;
|
284146
|
+
if (accessToken && theGraphMiddleware) {
|
284147
|
+
middlewareAdminUrl = new URL(`/${encodeURIComponent(accessToken)}/admin`, theGraphMiddleware.serviceUrl).toString();
|
284148
|
+
} else {
|
284149
|
+
const serviceUrl = await serviceUrlPrompt({
|
284150
|
+
defaultUrl: `${getTheGraphUrl(env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS)}/admin`,
|
284151
|
+
accept: autoAccept,
|
284152
|
+
message: "What is the admin endpoint for the The Graph instance you want to connect to?",
|
284153
|
+
example: "https://thegraph.mydomain.com/admin"
|
284154
|
+
});
|
284155
|
+
if (!serviceUrl) {
|
284156
|
+
cancel2("No The Graph admin URL provided. Please provide a The Graph admin URL to continue.");
|
284157
|
+
}
|
284158
|
+
middlewareAdminUrl = serviceUrl.includes("/admin") ? serviceUrl : new URL(`${serviceUrl}/admin`).toString();
|
284159
|
+
}
|
283963
284160
|
await executeCommand(command, [...args, "graph", "remove", "--node", middlewareAdminUrl, graphName]);
|
283964
|
-
|
283965
|
-
|
283966
|
-
|
283967
|
-
|
283968
|
-
|
283969
|
-
|
283970
|
-
|
283971
|
-
|
283972
|
-
|
283973
|
-
|
283974
|
-
|
283975
|
-
|
283976
|
-
|
283977
|
-
|
283978
|
-
|
283979
|
-
|
283980
|
-
|
283981
|
-
|
283982
|
-
|
283983
|
-
|
283984
|
-
|
283985
|
-
|
284161
|
+
if (accessToken && theGraphMiddleware) {
|
284162
|
+
const settlemintClient = createSettleMintClient({
|
284163
|
+
accessToken,
|
284164
|
+
instance
|
284165
|
+
});
|
284166
|
+
const graphEndpoints = await spinner({
|
284167
|
+
startMessage: "Waiting for subgraph to be removed",
|
284168
|
+
task: () => retryWhenFailed2(async () => {
|
284169
|
+
const middleware = await settlemintClient.middleware.read(theGraphMiddleware.uniqueName);
|
284170
|
+
const endpoints = await getGraphEnv(settlemintClient, middleware);
|
284171
|
+
if (endpoints.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS?.some((endpoint) => endpoint.endsWith(graphName))) {
|
284172
|
+
throw new Error(`Subgraph '${graphName}' not removed from middleware '${theGraphMiddleware.uniqueName}'`);
|
284173
|
+
}
|
284174
|
+
return endpoints;
|
284175
|
+
}, 5, 5000),
|
284176
|
+
stopMessage: "Waiting finished"
|
284177
|
+
});
|
284178
|
+
await writeEnvSpinner(!!prod, {
|
284179
|
+
...env2,
|
284180
|
+
SETTLEMINT_THEGRAPH: theGraphMiddleware.uniqueName,
|
284181
|
+
...graphEndpoints,
|
284182
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH === graphName ? undefined : env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH
|
284183
|
+
});
|
284184
|
+
} else {
|
284185
|
+
await writeEnvSpinner(!!prod, {
|
284186
|
+
...env2,
|
284187
|
+
SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS: getUpdatedSubgraphEndpoints({
|
284188
|
+
existingEndpoints: env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS ?? [],
|
284189
|
+
removedSubgraphName: graphName
|
284190
|
+
}),
|
284191
|
+
SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH: env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH === graphName ? undefined : env2.SETTLEMINT_THEGRAPH_DEFAULT_SUBGRAPH
|
284192
|
+
});
|
284193
|
+
}
|
283986
284194
|
outro(`Subgraph ${graphName} removed successfully`);
|
283987
284195
|
});
|
283988
284196
|
}
|
@@ -284130,4 +284338,4 @@ async function sdkCliCommand(argv = process.argv) {
|
|
284130
284338
|
// src/cli.ts
|
284131
284339
|
sdkCliCommand();
|
284132
284340
|
|
284133
|
-
//# debugId=
|
284341
|
+
//# debugId=20010C3E369919A864756E2164756E21
|