@settlemint/sdk-cli 0.9.3-pr85e672fd → 0.9.3-pra0f7c804
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 +546 -368
- package/dist/cli.js.map +52 -48
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -19613,7 +19613,7 @@ var require_lib4 = __commonJS((exports, module) => {
|
|
|
19613
19613
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
19614
19614
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
19615
19615
|
var getPathInfo = (cmd, {
|
|
19616
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
19616
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Y6OrQrWq4k:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
19617
19617
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
19618
19618
|
delimiter: optDelimiter = delimiter
|
|
19619
19619
|
}) => {
|
|
@@ -19817,7 +19817,7 @@ var require_lib5 = __commonJS((exports, module) => {
|
|
|
19817
19817
|
let pathToInitial;
|
|
19818
19818
|
try {
|
|
19819
19819
|
pathToInitial = which.sync(initialCmd, {
|
|
19820
|
-
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
19820
|
+
path: options.env && findInObject(options.env, "PATH") || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Y6OrQrWq4k:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
19821
19821
|
pathext: options.env && findInObject(options.env, "PATHEXT") || process.env.PATHEXT
|
|
19822
19822
|
}).toLowerCase();
|
|
19823
19823
|
} catch (err) {
|
|
@@ -20534,7 +20534,7 @@ var require_lib6 = __commonJS((exports, module) => {
|
|
|
20534
20534
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
20535
20535
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
20536
20536
|
var getPathInfo = (cmd, {
|
|
20537
|
-
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
20537
|
+
path: optPath = "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Y6OrQrWq4k:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin",
|
|
20538
20538
|
pathExt: optPathExt = process.env.PATHEXT,
|
|
20539
20539
|
delimiter: optDelimiter = delimiter
|
|
20540
20540
|
}) => {
|
|
@@ -223327,7 +223327,7 @@ ${Bt.cyan(Yt)}
|
|
|
223327
223327
|
code: "ENOENT"
|
|
223328
223328
|
}), getPathInfo = (e9, t7) => {
|
|
223329
223329
|
var r6 = t7.colon || or;
|
|
223330
|
-
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
223330
|
+
var i6 = e9.match(/\//) || nr && e9.match(/\\/) ? [""] : [...nr ? [process.cwd()] : [], ...(t7.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Y6OrQrWq4k:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(r6)];
|
|
223331
223331
|
var n6 = nr ? t7.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
223332
223332
|
var a5 = nr ? n6.split(r6) : [""];
|
|
223333
223333
|
if (nr) {
|
|
@@ -226464,7 +226464,7 @@ ${whileRunning(e9)}`;
|
|
|
226464
226464
|
};
|
|
226465
226465
|
ni = Object.assign(async function _main() {
|
|
226466
226466
|
var e9 = new Cli({
|
|
226467
|
-
binaryVersion: "0.9.3-
|
|
226467
|
+
binaryVersion: "0.9.3-pra0f7c804",
|
|
226468
226468
|
binaryLabel: "gql.tada CLI",
|
|
226469
226469
|
binaryName: "gql.tada"
|
|
226470
226470
|
});
|
|
@@ -234964,7 +234964,7 @@ var require_which2 = __commonJS((exports, module) => {
|
|
|
234964
234964
|
const colon = opt2.colon || COLON;
|
|
234965
234965
|
const pathEnv = cmd2.match(/\//) || isWindows2 && cmd2.match(/\\/) ? [""] : [
|
|
234966
234966
|
...isWindows2 ? [process.cwd()] : [],
|
|
234967
|
-
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.
|
|
234967
|
+
...(opt2.path || "/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/cli/node_modules/.bin:/home/runner/work/sdk/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/tmp/bunx-1001-turbo@latest/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/sdk/node_modules/.bin:/home/runner/work/sdk/node_modules/.bin:/home/runner/work/node_modules/.bin:/home/runner/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/opt/hostedtoolcache/node/22.12.0/x64/bin:/home/runner/.bun/bin:/tmp/tmp.Y6OrQrWq4k:/nsc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/snap/bin/:/usr/games:/usr/local/games:/home/linuxbrew/.linuxbrew/bin:/home/runner/.config/composer/vendor/bin:/home/runner/.dotnet/tools:/home/runner/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin").split(colon)
|
|
234968
234968
|
];
|
|
234969
234969
|
const pathExtExe = isWindows2 ? opt2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
234970
234970
|
const pathExt = isWindows2 ? pathExtExe.split(colon) : [""];
|
|
@@ -256788,7 +256788,7 @@ ${error.stack}`));
|
|
|
256788
256788
|
var package_default = {
|
|
256789
256789
|
name: "@settlemint/sdk-cli",
|
|
256790
256790
|
description: "SettleMint SDK, integrate SettleMint into your application with ease.",
|
|
256791
|
-
version: "0.9.3-
|
|
256791
|
+
version: "0.9.3-pra0f7c804",
|
|
256792
256792
|
type: "module",
|
|
256793
256793
|
private: false,
|
|
256794
256794
|
license: "FSL-1.1-MIT",
|
|
@@ -256841,8 +256841,8 @@ var package_default = {
|
|
|
256841
256841
|
"@inquirer/input": "4.1.1",
|
|
256842
256842
|
"@inquirer/password": "4.0.4",
|
|
256843
256843
|
"@inquirer/select": "4.0.4",
|
|
256844
|
-
"@settlemint/sdk-js": "0.9.3-
|
|
256845
|
-
"@settlemint/sdk-utils": "0.9.3-
|
|
256844
|
+
"@settlemint/sdk-js": "0.9.3-pra0f7c804",
|
|
256845
|
+
"@settlemint/sdk-utils": "0.9.3-pra0f7c804",
|
|
256846
256846
|
"get-tsconfig": "4.8.1",
|
|
256847
256847
|
giget: "1.2.3"
|
|
256848
256848
|
},
|
|
@@ -257103,9 +257103,12 @@ async function findUp(name, options = {}) {
|
|
|
257103
257103
|
|
|
257104
257104
|
// ../utils/dist/filesystem.mjs
|
|
257105
257105
|
import { stat } from "node:fs/promises";
|
|
257106
|
-
async function projectRoot() {
|
|
257106
|
+
async function projectRoot(fallbackToCwd = false) {
|
|
257107
257107
|
const packageJsonPath = await findUp("package.json");
|
|
257108
257108
|
if (!packageJsonPath) {
|
|
257109
|
+
if (fallbackToCwd) {
|
|
257110
|
+
return process.cwd();
|
|
257111
|
+
}
|
|
257109
257112
|
throw new Error("Unable to find project root (no package.json found)");
|
|
257110
257113
|
}
|
|
257111
257114
|
return dirname(packageJsonPath);
|
|
@@ -257140,6 +257143,9 @@ function missingAccessTokenError(personalAccessTokenExists) {
|
|
|
257140
257143
|
function missingPersonalAccessTokenError() {
|
|
257141
257144
|
return cancel("No personal access token found for instance, please run `settlemint login` to login to your instance");
|
|
257142
257145
|
}
|
|
257146
|
+
function missingApplication() {
|
|
257147
|
+
return cancel("No application configured, please run `settlemint connect` to connect to your application");
|
|
257148
|
+
}
|
|
257143
257149
|
|
|
257144
257150
|
// src/utils/config.ts
|
|
257145
257151
|
import { mkdir as mkdir2, readFile, writeFile as writeFile2 } from "node:fs/promises";
|
|
@@ -267832,6 +267838,57 @@ export const { client: portalClient, graphql: portalGraphql } = createPortalClie
|
|
|
267832
267838
|
await writeTemplate(template, "/lib/settlemint", "portal.ts");
|
|
267833
267839
|
}
|
|
267834
267840
|
|
|
267841
|
+
// src/commands/codegen/test-gql-endpoint.ts
|
|
267842
|
+
async function testGqlEndpoint({
|
|
267843
|
+
accessToken,
|
|
267844
|
+
hasuraAdminSecret,
|
|
267845
|
+
gqlEndpoint,
|
|
267846
|
+
isHasura = false,
|
|
267847
|
+
maxRetries = 3
|
|
267848
|
+
}) {
|
|
267849
|
+
if (!gqlEndpoint) {
|
|
267850
|
+
return false;
|
|
267851
|
+
}
|
|
267852
|
+
for (let attempt = 0;attempt < maxRetries; attempt++) {
|
|
267853
|
+
try {
|
|
267854
|
+
const response = await fetch(gqlEndpoint, {
|
|
267855
|
+
method: "POST",
|
|
267856
|
+
headers: {
|
|
267857
|
+
"x-auth-token": accessToken,
|
|
267858
|
+
...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {},
|
|
267859
|
+
"Content-Type": "application/json"
|
|
267860
|
+
},
|
|
267861
|
+
body: JSON.stringify({
|
|
267862
|
+
query: `
|
|
267863
|
+
query {
|
|
267864
|
+
__schema {
|
|
267865
|
+
types {
|
|
267866
|
+
name
|
|
267867
|
+
}
|
|
267868
|
+
}
|
|
267869
|
+
}
|
|
267870
|
+
`
|
|
267871
|
+
})
|
|
267872
|
+
});
|
|
267873
|
+
if (!response.ok) {
|
|
267874
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
267875
|
+
}
|
|
267876
|
+
const data = await response.json();
|
|
267877
|
+
if (data.errors) {
|
|
267878
|
+
throw new Error("GraphQL errors in response");
|
|
267879
|
+
}
|
|
267880
|
+
return true;
|
|
267881
|
+
} catch (error5) {
|
|
267882
|
+
if (attempt === maxRetries - 1) {
|
|
267883
|
+
return false;
|
|
267884
|
+
}
|
|
267885
|
+
const delay2 = 2 ** attempt * 1000;
|
|
267886
|
+
await new Promise((resolve3) => setTimeout(resolve3, delay2));
|
|
267887
|
+
}
|
|
267888
|
+
}
|
|
267889
|
+
return false;
|
|
267890
|
+
}
|
|
267891
|
+
|
|
267835
267892
|
// src/commands/codegen/codegen-the-graph.ts
|
|
267836
267893
|
async function codegenTheGraph(env2, subgraphNames) {
|
|
267837
267894
|
const gqlEndpoints = env2.SETTLEMINT_THEGRAPH_SUBGRAPHS_ENDPOINTS;
|
|
@@ -267862,6 +267919,10 @@ async function codegenTheGraph(env2, subgraphNames) {
|
|
|
267862
267919
|
for (const gqlEndpoint of toGenerate) {
|
|
267863
267920
|
const name2 = gqlEndpoint.split("/").pop();
|
|
267864
267921
|
note(`Generating TheGraph subgraph ${name2}`);
|
|
267922
|
+
await testGqlEndpoint({
|
|
267923
|
+
accessToken,
|
|
267924
|
+
gqlEndpoint
|
|
267925
|
+
});
|
|
267865
267926
|
await generateSchema({
|
|
267866
267927
|
input: gqlEndpoint,
|
|
267867
267928
|
output: `the-graph-schema-${name2}.graphql`,
|
|
@@ -267899,51 +267960,6 @@ export const { client: theGraphClient${nameSuffix}, graphql: theGraphGraphql${na
|
|
|
267899
267960
|
// src/commands/codegen/codegen-tsconfig.ts
|
|
267900
267961
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
267901
267962
|
|
|
267902
|
-
// src/commands/codegen/test-gql-endpoint.ts
|
|
267903
|
-
async function testGqlEndpoint(accessToken, hasuraAdminSecret, gqlEndpoint, isHasura = false, maxRetries = 3) {
|
|
267904
|
-
if (!gqlEndpoint) {
|
|
267905
|
-
return false;
|
|
267906
|
-
}
|
|
267907
|
-
for (let attempt = 0;attempt < maxRetries; attempt++) {
|
|
267908
|
-
try {
|
|
267909
|
-
const response = await fetch(gqlEndpoint, {
|
|
267910
|
-
method: "POST",
|
|
267911
|
-
headers: {
|
|
267912
|
-
"x-auth-token": accessToken,
|
|
267913
|
-
...isHasura ? { "x-hasura-admin-secret": hasuraAdminSecret ?? "" } : {},
|
|
267914
|
-
"Content-Type": "application/json"
|
|
267915
|
-
},
|
|
267916
|
-
body: JSON.stringify({
|
|
267917
|
-
query: `
|
|
267918
|
-
query {
|
|
267919
|
-
__schema {
|
|
267920
|
-
types {
|
|
267921
|
-
name
|
|
267922
|
-
}
|
|
267923
|
-
}
|
|
267924
|
-
}
|
|
267925
|
-
`
|
|
267926
|
-
})
|
|
267927
|
-
});
|
|
267928
|
-
if (!response.ok) {
|
|
267929
|
-
throw new Error(`HTTP error! status: ${response.status}`);
|
|
267930
|
-
}
|
|
267931
|
-
const data = await response.json();
|
|
267932
|
-
if (data.errors) {
|
|
267933
|
-
throw new Error("GraphQL errors in response");
|
|
267934
|
-
}
|
|
267935
|
-
return true;
|
|
267936
|
-
} catch (error5) {
|
|
267937
|
-
if (attempt === maxRetries - 1) {
|
|
267938
|
-
return false;
|
|
267939
|
-
}
|
|
267940
|
-
const delay2 = 2 ** attempt * 1000;
|
|
267941
|
-
await new Promise((resolve3) => setTimeout(resolve3, delay2));
|
|
267942
|
-
}
|
|
267943
|
-
}
|
|
267944
|
-
return false;
|
|
267945
|
-
}
|
|
267946
|
-
|
|
267947
267963
|
// ../../node_modules/get-tsconfig/dist/index.mjs
|
|
267948
267964
|
import a6 from "node:path";
|
|
267949
267965
|
import ee2 from "node:fs";
|
|
@@ -268842,12 +268858,29 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
|
268842
268858
|
const name2 = gqlEndpoint.split("/").pop();
|
|
268843
268859
|
return name2 && (!thegraphSubgraphNames || thegraphSubgraphNames.includes(name2));
|
|
268844
268860
|
});
|
|
268845
|
-
const [hasura, portal,
|
|
268846
|
-
testGqlEndpoint(
|
|
268847
|
-
|
|
268848
|
-
|
|
268849
|
-
|
|
268861
|
+
const [hasura, portal, blockscout] = await Promise.all([
|
|
268862
|
+
testGqlEndpoint({
|
|
268863
|
+
accessToken,
|
|
268864
|
+
hasuraAdminSecret: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
268865
|
+
gqlEndpoint: env2.SETTLEMINT_HASURA_ENDPOINT,
|
|
268866
|
+
isHasura: true
|
|
268867
|
+
}),
|
|
268868
|
+
testGqlEndpoint({
|
|
268869
|
+
accessToken,
|
|
268870
|
+
gqlEndpoint: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT
|
|
268871
|
+
}),
|
|
268872
|
+
testGqlEndpoint({
|
|
268873
|
+
accessToken,
|
|
268874
|
+
gqlEndpoint: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT
|
|
268875
|
+
})
|
|
268850
268876
|
]);
|
|
268877
|
+
const thegraph = await Promise.all(theGraphEndpoints.map((endpoint) => {
|
|
268878
|
+
const success = testGqlEndpoint({
|
|
268879
|
+
accessToken,
|
|
268880
|
+
gqlEndpoint: endpoint
|
|
268881
|
+
});
|
|
268882
|
+
return { success, endpoint };
|
|
268883
|
+
}));
|
|
268851
268884
|
if (!tsconfig.config.compilerOptions) {
|
|
268852
268885
|
tsconfig.config.compilerOptions = {};
|
|
268853
268886
|
}
|
|
@@ -268866,7 +268899,7 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
|
268866
268899
|
tadaTurboLocation: "hasura-cache.d.ts"
|
|
268867
268900
|
}
|
|
268868
268901
|
] : [],
|
|
268869
|
-
...thegraph ?
|
|
268902
|
+
...thegraph ? thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
|
|
268870
268903
|
const name2 = endpoint.split("/").pop();
|
|
268871
268904
|
return {
|
|
268872
268905
|
name: `thegraph-${name2}`,
|
|
@@ -270060,9 +270093,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
|
|
|
270060
270093
|
return {};
|
|
270061
270094
|
}
|
|
270062
270095
|
}
|
|
270063
|
-
async function projectRoot2() {
|
|
270096
|
+
async function projectRoot2(fallbackToCwd = false) {
|
|
270064
270097
|
const packageJsonPath = await findUp("package.json");
|
|
270065
270098
|
if (!packageJsonPath) {
|
|
270099
|
+
if (fallbackToCwd) {
|
|
270100
|
+
return process.cwd();
|
|
270101
|
+
}
|
|
270066
270102
|
throw new Error("Unable to find project root (no package.json found)");
|
|
270067
270103
|
}
|
|
270068
270104
|
return dirname5(packageJsonPath);
|
|
@@ -270113,7 +270149,7 @@ async function findMonoRepoPackages(projectDir) {
|
|
|
270113
270149
|
}
|
|
270114
270150
|
}
|
|
270115
270151
|
async function writeEnv(prod, env2, secrets) {
|
|
270116
|
-
const projectDir = await projectRoot2();
|
|
270152
|
+
const projectDir = await projectRoot2(true);
|
|
270117
270153
|
if (prod) {
|
|
270118
270154
|
process.env.NODE_ENV = "production";
|
|
270119
270155
|
}
|
|
@@ -270502,7 +270538,7 @@ async function getGraphEndpoint(service, env2) {
|
|
|
270502
270538
|
const isStarterKit = (id) => id.endsWith("-starterkits");
|
|
270503
270539
|
const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
|
|
270504
270540
|
const starterKitEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
|
|
270505
|
-
const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint(env2.SETTLEMINT_ACCESS_TOKEN,
|
|
270541
|
+
const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint({ accessToken: env2.SETTLEMINT_ACCESS_TOKEN, gqlEndpoint: testEndpoint }) : false;
|
|
270506
270542
|
const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
|
|
270507
270543
|
if (endpoints.length === 0) {
|
|
270508
270544
|
return {};
|
|
@@ -272750,8 +272786,9 @@ var esm_default5 = createPrompt((config4, done) => {
|
|
|
272750
272786
|
|
|
272751
272787
|
// src/commands/connect/aat.prompt.ts
|
|
272752
272788
|
async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
|
|
272789
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272753
272790
|
const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
|
|
272754
|
-
const defaultPossible =
|
|
272791
|
+
const defaultPossible = autoAccept && defaultAccessToken;
|
|
272755
272792
|
if (defaultPossible || is_in_ci_default) {
|
|
272756
272793
|
return defaultAccessToken;
|
|
272757
272794
|
}
|
|
@@ -272846,16 +272883,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
|
|
|
272846
272883
|
});
|
|
272847
272884
|
}
|
|
272848
272885
|
|
|
272886
|
+
// src/error/nothing-selected-error.ts
|
|
272887
|
+
function nothingSelectedError(type4) {
|
|
272888
|
+
return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
|
|
272889
|
+
}
|
|
272890
|
+
|
|
272849
272891
|
// src/commands/connect/application.prompt.ts
|
|
272850
272892
|
async function applicationPrompt(env2, applications, accept) {
|
|
272893
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272851
272894
|
const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
|
|
272852
|
-
const defaultPossible =
|
|
272895
|
+
const defaultPossible = autoAccept && defaultApplication;
|
|
272853
272896
|
if (defaultPossible) {
|
|
272854
272897
|
return defaultApplication;
|
|
272855
272898
|
}
|
|
272856
272899
|
if (applications.length === 0) {
|
|
272857
272900
|
cancel("No applications found");
|
|
272858
272901
|
}
|
|
272902
|
+
if (is_in_ci_default) {
|
|
272903
|
+
nothingSelectedError("application");
|
|
272904
|
+
}
|
|
272859
272905
|
const application = await esm_default2({
|
|
272860
272906
|
message: "Which application do you want to connect to?",
|
|
272861
272907
|
choices: applications.map((applications2) => ({
|
|
@@ -272870,146 +272916,170 @@ async function applicationPrompt(env2, applications, accept) {
|
|
|
272870
272916
|
return application;
|
|
272871
272917
|
}
|
|
272872
272918
|
|
|
272873
|
-
// src/commands/connect/
|
|
272874
|
-
async function
|
|
272875
|
-
|
|
272919
|
+
// src/commands/connect/service.prompt.ts
|
|
272920
|
+
async function servicePrompt({
|
|
272921
|
+
env: env2,
|
|
272922
|
+
services,
|
|
272923
|
+
accept,
|
|
272924
|
+
envKey,
|
|
272925
|
+
defaultHandler,
|
|
272926
|
+
isCi = is_in_ci_default
|
|
272927
|
+
}) {
|
|
272928
|
+
if (services.length === 0) {
|
|
272876
272929
|
return;
|
|
272877
272930
|
}
|
|
272878
|
-
const
|
|
272879
|
-
const
|
|
272880
|
-
if (
|
|
272881
|
-
return
|
|
272931
|
+
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
|
272932
|
+
const autoAccept = isCi || accept;
|
|
272933
|
+
if (autoAccept && selectedService) {
|
|
272934
|
+
return selectedService;
|
|
272882
272935
|
}
|
|
272883
|
-
|
|
272884
|
-
|
|
272885
|
-
|
|
272886
|
-
|
|
272887
|
-
|
|
272888
|
-
|
|
272889
|
-
|
|
272890
|
-
|
|
272891
|
-
|
|
272892
|
-
|
|
272893
|
-
|
|
272894
|
-
|
|
272895
|
-
|
|
272936
|
+
if (isCi) {
|
|
272937
|
+
return;
|
|
272938
|
+
}
|
|
272939
|
+
if (services.length === 1) {
|
|
272940
|
+
return services[0];
|
|
272941
|
+
}
|
|
272942
|
+
return defaultHandler({ defaultService: selectedService });
|
|
272943
|
+
}
|
|
272944
|
+
|
|
272945
|
+
// src/commands/connect/blockchain-node.prompt.ts
|
|
272946
|
+
async function blockchainNodePrompt(env2, nodes, accept) {
|
|
272947
|
+
return servicePrompt({
|
|
272948
|
+
env: env2,
|
|
272949
|
+
services: nodes,
|
|
272950
|
+
accept,
|
|
272951
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
|
272952
|
+
defaultHandler: async ({ defaultService: defaultNode }) => {
|
|
272953
|
+
return esm_default2({
|
|
272954
|
+
message: "Which blockchain node do you want to connect to?",
|
|
272955
|
+
choices: [
|
|
272956
|
+
...nodes.map((node) => ({
|
|
272957
|
+
name: node.name,
|
|
272958
|
+
value: node
|
|
272959
|
+
})),
|
|
272960
|
+
{
|
|
272961
|
+
name: "None",
|
|
272962
|
+
value: undefined
|
|
272963
|
+
}
|
|
272964
|
+
],
|
|
272965
|
+
default: defaultNode
|
|
272966
|
+
});
|
|
272967
|
+
}
|
|
272896
272968
|
});
|
|
272897
|
-
return node;
|
|
272898
272969
|
}
|
|
272899
272970
|
|
|
272900
272971
|
// src/commands/connect/blockscout.prompt.ts
|
|
272901
272972
|
async function blockscoutPrompt(env2, insights, accept) {
|
|
272902
272973
|
const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
|
|
272903
|
-
|
|
272904
|
-
|
|
272905
|
-
|
|
272906
|
-
|
|
272907
|
-
|
|
272908
|
-
|
|
272909
|
-
|
|
272910
|
-
|
|
272911
|
-
|
|
272912
|
-
|
|
272913
|
-
|
|
272914
|
-
|
|
272915
|
-
|
|
272916
|
-
|
|
272917
|
-
|
|
272918
|
-
|
|
272919
|
-
|
|
272920
|
-
|
|
272921
|
-
|
|
272922
|
-
|
|
272923
|
-
|
|
272974
|
+
return servicePrompt({
|
|
272975
|
+
env: env2,
|
|
272976
|
+
services: possible,
|
|
272977
|
+
accept,
|
|
272978
|
+
envKey: "SETTLEMINT_BLOCKSCOUT",
|
|
272979
|
+
defaultHandler: async ({ defaultService: defaultBlockscout }) => {
|
|
272980
|
+
return esm_default2({
|
|
272981
|
+
message: "Which blockscout instance do you want to connect to?",
|
|
272982
|
+
choices: [
|
|
272983
|
+
...possible.map((insight) => ({
|
|
272984
|
+
name: insight.name,
|
|
272985
|
+
value: insight
|
|
272986
|
+
})),
|
|
272987
|
+
{
|
|
272988
|
+
name: "None",
|
|
272989
|
+
value: undefined
|
|
272990
|
+
}
|
|
272991
|
+
],
|
|
272992
|
+
default: defaultBlockscout
|
|
272993
|
+
});
|
|
272994
|
+
}
|
|
272924
272995
|
});
|
|
272925
|
-
return blockscout;
|
|
272926
272996
|
}
|
|
272927
272997
|
|
|
272928
272998
|
// src/commands/connect/custom-deployment.prompt.ts
|
|
272929
272999
|
async function customDeploymentPrompt(env2, customDeployments, accept) {
|
|
272930
|
-
|
|
272931
|
-
|
|
272932
|
-
|
|
272933
|
-
|
|
272934
|
-
|
|
272935
|
-
|
|
272936
|
-
|
|
272937
|
-
|
|
272938
|
-
|
|
272939
|
-
|
|
272940
|
-
|
|
272941
|
-
|
|
272942
|
-
|
|
272943
|
-
|
|
272944
|
-
|
|
272945
|
-
|
|
272946
|
-
|
|
272947
|
-
|
|
272948
|
-
|
|
272949
|
-
|
|
272950
|
-
|
|
273000
|
+
return servicePrompt({
|
|
273001
|
+
env: env2,
|
|
273002
|
+
services: customDeployments,
|
|
273003
|
+
accept,
|
|
273004
|
+
envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
|
|
273005
|
+
defaultHandler: async ({
|
|
273006
|
+
defaultService: defaultCustomDeployment
|
|
273007
|
+
}) => {
|
|
273008
|
+
return esm_default2({
|
|
273009
|
+
message: "Which Custom Deployment do you want to connect to?",
|
|
273010
|
+
choices: [
|
|
273011
|
+
...customDeployments.map((customDeployment) => ({
|
|
273012
|
+
name: customDeployment.name,
|
|
273013
|
+
value: customDeployment
|
|
273014
|
+
})),
|
|
273015
|
+
{
|
|
273016
|
+
name: "None",
|
|
273017
|
+
value: undefined
|
|
273018
|
+
}
|
|
273019
|
+
],
|
|
273020
|
+
default: defaultCustomDeployment
|
|
273021
|
+
});
|
|
273022
|
+
}
|
|
272951
273023
|
});
|
|
272952
|
-
return middleware;
|
|
272953
273024
|
}
|
|
272954
273025
|
|
|
272955
273026
|
// src/commands/connect/hasura.prompt.ts
|
|
272956
273027
|
async function hasuraPrompt(env2, integrations, accept) {
|
|
272957
273028
|
const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
|
|
272958
|
-
|
|
272959
|
-
|
|
272960
|
-
|
|
272961
|
-
|
|
272962
|
-
|
|
272963
|
-
|
|
272964
|
-
|
|
272965
|
-
|
|
272966
|
-
|
|
272967
|
-
|
|
272968
|
-
|
|
272969
|
-
|
|
272970
|
-
|
|
272971
|
-
|
|
272972
|
-
|
|
272973
|
-
|
|
272974
|
-
|
|
272975
|
-
|
|
272976
|
-
|
|
272977
|
-
|
|
272978
|
-
|
|
273029
|
+
return servicePrompt({
|
|
273030
|
+
env: env2,
|
|
273031
|
+
services: possible,
|
|
273032
|
+
accept,
|
|
273033
|
+
envKey: "SETTLEMINT_HASURA",
|
|
273034
|
+
defaultHandler: async ({ defaultService: defaultHasura }) => {
|
|
273035
|
+
return esm_default2({
|
|
273036
|
+
message: "Which Hasura instance do you want to connect to?",
|
|
273037
|
+
choices: [
|
|
273038
|
+
...possible.map((integration) => ({
|
|
273039
|
+
name: integration.name,
|
|
273040
|
+
value: integration
|
|
273041
|
+
})),
|
|
273042
|
+
{
|
|
273043
|
+
name: "None",
|
|
273044
|
+
value: undefined
|
|
273045
|
+
}
|
|
273046
|
+
],
|
|
273047
|
+
default: defaultHasura
|
|
273048
|
+
});
|
|
273049
|
+
}
|
|
272979
273050
|
});
|
|
272980
|
-
return hasura;
|
|
272981
273051
|
}
|
|
272982
273052
|
|
|
272983
273053
|
// src/commands/connect/hd-private-keys.prompt.ts
|
|
272984
273054
|
async function hdPrivateKeyPrompt(env2, privateKeys, accept) {
|
|
272985
|
-
const possible = privateKeys.filter((
|
|
272986
|
-
|
|
272987
|
-
|
|
272988
|
-
|
|
272989
|
-
|
|
272990
|
-
|
|
272991
|
-
|
|
272992
|
-
|
|
272993
|
-
|
|
272994
|
-
|
|
272995
|
-
|
|
272996
|
-
|
|
272997
|
-
|
|
272998
|
-
|
|
272999
|
-
|
|
273000
|
-
|
|
273001
|
-
|
|
273002
|
-
|
|
273003
|
-
|
|
273004
|
-
|
|
273005
|
-
|
|
273006
|
-
|
|
273055
|
+
const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
|
|
273056
|
+
return servicePrompt({
|
|
273057
|
+
env: env2,
|
|
273058
|
+
services: possible,
|
|
273059
|
+
accept,
|
|
273060
|
+
envKey: "SETTLEMINT_HD_PRIVATE_KEY",
|
|
273061
|
+
defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
|
|
273062
|
+
return esm_default2({
|
|
273063
|
+
message: "Which HD Private Key do you want to use?",
|
|
273064
|
+
choices: [
|
|
273065
|
+
...possible.map((privateKey) => ({
|
|
273066
|
+
name: privateKey.name,
|
|
273067
|
+
value: privateKey
|
|
273068
|
+
})),
|
|
273069
|
+
{
|
|
273070
|
+
name: "None",
|
|
273071
|
+
value: undefined
|
|
273072
|
+
}
|
|
273073
|
+
],
|
|
273074
|
+
default: defaultPrivateKey
|
|
273075
|
+
});
|
|
273076
|
+
}
|
|
273007
273077
|
});
|
|
273008
|
-
return privateKey;
|
|
273009
273078
|
}
|
|
273010
273079
|
|
|
273011
273080
|
// src/commands/connect/instance.prompt.ts
|
|
273012
273081
|
async function instancePrompt(env2, accept) {
|
|
273082
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
273013
273083
|
const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
|
|
273014
273084
|
const defaultPossible = accept && defaultInstance;
|
|
273015
273085
|
if (defaultPossible) {
|
|
@@ -273034,85 +273104,82 @@ async function instancePrompt(env2, accept) {
|
|
|
273034
273104
|
// src/commands/connect/ipfs.prompt.ts
|
|
273035
273105
|
async function ipfsPrompt(env2, storages, accept) {
|
|
273036
273106
|
const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
|
|
273037
|
-
|
|
273038
|
-
|
|
273039
|
-
|
|
273040
|
-
|
|
273041
|
-
|
|
273042
|
-
|
|
273043
|
-
|
|
273044
|
-
|
|
273045
|
-
|
|
273046
|
-
|
|
273047
|
-
|
|
273048
|
-
|
|
273049
|
-
|
|
273050
|
-
|
|
273051
|
-
|
|
273052
|
-
|
|
273053
|
-
|
|
273054
|
-
|
|
273055
|
-
|
|
273056
|
-
|
|
273057
|
-
|
|
273107
|
+
return servicePrompt({
|
|
273108
|
+
env: env2,
|
|
273109
|
+
services: possible,
|
|
273110
|
+
accept,
|
|
273111
|
+
envKey: "SETTLEMINT_IPFS",
|
|
273112
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273113
|
+
return esm_default2({
|
|
273114
|
+
message: "Which IPFS instance do you want to connect to?",
|
|
273115
|
+
choices: [
|
|
273116
|
+
...possible.map((storage) => ({
|
|
273117
|
+
name: storage.name,
|
|
273118
|
+
value: storage
|
|
273119
|
+
})),
|
|
273120
|
+
{
|
|
273121
|
+
name: "None",
|
|
273122
|
+
value: undefined
|
|
273123
|
+
}
|
|
273124
|
+
],
|
|
273125
|
+
default: defaultStorage
|
|
273126
|
+
});
|
|
273127
|
+
}
|
|
273058
273128
|
});
|
|
273059
|
-
return minio;
|
|
273060
273129
|
}
|
|
273061
273130
|
|
|
273062
273131
|
// src/commands/connect/minio.prompt.ts
|
|
273063
273132
|
async function minioPrompt(env2, storages, accept) {
|
|
273064
273133
|
const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
|
|
273065
|
-
|
|
273066
|
-
|
|
273067
|
-
|
|
273068
|
-
|
|
273069
|
-
|
|
273070
|
-
|
|
273071
|
-
|
|
273072
|
-
|
|
273073
|
-
|
|
273074
|
-
|
|
273075
|
-
|
|
273076
|
-
|
|
273077
|
-
|
|
273078
|
-
|
|
273079
|
-
|
|
273080
|
-
|
|
273081
|
-
|
|
273082
|
-
|
|
273083
|
-
|
|
273084
|
-
|
|
273085
|
-
|
|
273134
|
+
return servicePrompt({
|
|
273135
|
+
env: env2,
|
|
273136
|
+
services: possible,
|
|
273137
|
+
accept,
|
|
273138
|
+
envKey: "SETTLEMINT_MINIO",
|
|
273139
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273140
|
+
return esm_default2({
|
|
273141
|
+
message: "Which MinIO instance do you want to connect to?",
|
|
273142
|
+
choices: [
|
|
273143
|
+
...possible.map((storage) => ({
|
|
273144
|
+
name: storage.name,
|
|
273145
|
+
value: storage
|
|
273146
|
+
})),
|
|
273147
|
+
{
|
|
273148
|
+
name: "None",
|
|
273149
|
+
value: undefined
|
|
273150
|
+
}
|
|
273151
|
+
],
|
|
273152
|
+
default: defaultStorage
|
|
273153
|
+
});
|
|
273154
|
+
}
|
|
273086
273155
|
});
|
|
273087
|
-
return minio;
|
|
273088
273156
|
}
|
|
273089
273157
|
|
|
273090
273158
|
// src/commands/connect/portal.prompt.ts
|
|
273091
273159
|
async function portalPrompt(env2, middlewares, accept) {
|
|
273092
|
-
const possible = middlewares.filter((
|
|
273093
|
-
|
|
273094
|
-
|
|
273095
|
-
|
|
273096
|
-
|
|
273097
|
-
|
|
273098
|
-
|
|
273099
|
-
|
|
273100
|
-
|
|
273101
|
-
|
|
273102
|
-
|
|
273103
|
-
|
|
273104
|
-
|
|
273105
|
-
|
|
273106
|
-
|
|
273107
|
-
|
|
273108
|
-
|
|
273109
|
-
|
|
273110
|
-
|
|
273111
|
-
|
|
273112
|
-
|
|
273113
|
-
|
|
273160
|
+
const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
|
|
273161
|
+
return servicePrompt({
|
|
273162
|
+
env: env2,
|
|
273163
|
+
services: possible,
|
|
273164
|
+
accept,
|
|
273165
|
+
envKey: "SETTLEMINT_PORTAL",
|
|
273166
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273167
|
+
return esm_default2({
|
|
273168
|
+
message: "Which Smart Contract Portal instance do you want to connect to?",
|
|
273169
|
+
choices: [
|
|
273170
|
+
...possible.map((middleware) => ({
|
|
273171
|
+
name: middleware.name,
|
|
273172
|
+
value: middleware
|
|
273173
|
+
})),
|
|
273174
|
+
{
|
|
273175
|
+
name: "None",
|
|
273176
|
+
value: undefined
|
|
273177
|
+
}
|
|
273178
|
+
],
|
|
273179
|
+
default: defaultMiddleware
|
|
273180
|
+
});
|
|
273181
|
+
}
|
|
273114
273182
|
});
|
|
273115
|
-
return middleware;
|
|
273116
273183
|
}
|
|
273117
273184
|
|
|
273118
273185
|
// src/commands/connect/services.spinner.ts
|
|
@@ -273156,42 +273223,45 @@ async function servicesSpinner(settlemint, application) {
|
|
|
273156
273223
|
|
|
273157
273224
|
// src/commands/connect/thegraph.prompt.ts
|
|
273158
273225
|
async function theGraphPrompt(env2, middlewares, accept) {
|
|
273159
|
-
const possible = middlewares.filter((
|
|
273160
|
-
|
|
273161
|
-
|
|
273162
|
-
|
|
273163
|
-
|
|
273164
|
-
|
|
273165
|
-
|
|
273166
|
-
|
|
273167
|
-
|
|
273168
|
-
|
|
273169
|
-
|
|
273170
|
-
|
|
273171
|
-
|
|
273172
|
-
|
|
273173
|
-
|
|
273174
|
-
|
|
273175
|
-
|
|
273176
|
-
|
|
273177
|
-
|
|
273178
|
-
|
|
273179
|
-
|
|
273180
|
-
|
|
273226
|
+
const possible = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
|
|
273227
|
+
return servicePrompt({
|
|
273228
|
+
env: env2,
|
|
273229
|
+
services: possible,
|
|
273230
|
+
accept,
|
|
273231
|
+
envKey: "SETTLEMINT_THEGRAPH",
|
|
273232
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273233
|
+
return esm_default2({
|
|
273234
|
+
message: "Which The Graph instance do you want to connect to?",
|
|
273235
|
+
choices: [
|
|
273236
|
+
...possible.map((middleware) => ({
|
|
273237
|
+
name: middleware.name,
|
|
273238
|
+
value: middleware
|
|
273239
|
+
})),
|
|
273240
|
+
{
|
|
273241
|
+
name: "None",
|
|
273242
|
+
value: undefined
|
|
273243
|
+
}
|
|
273244
|
+
],
|
|
273245
|
+
default: defaultMiddleware
|
|
273246
|
+
});
|
|
273247
|
+
}
|
|
273181
273248
|
});
|
|
273182
|
-
return middleware;
|
|
273183
273249
|
}
|
|
273184
273250
|
|
|
273185
273251
|
// src/commands/connect/workspace.prompt.ts
|
|
273186
273252
|
async function workspacePrompt(env2, workspaces, accept) {
|
|
273253
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
273187
273254
|
const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
|
|
273188
|
-
const defaultPossible =
|
|
273255
|
+
const defaultPossible = autoAccept && defaultWorkspace;
|
|
273189
273256
|
if (defaultPossible) {
|
|
273190
273257
|
return defaultWorkspace;
|
|
273191
273258
|
}
|
|
273192
273259
|
if (workspaces.length === 0) {
|
|
273193
273260
|
cancel2("No workspaces found");
|
|
273194
273261
|
}
|
|
273262
|
+
if (is_in_ci_default) {
|
|
273263
|
+
nothingSelectedError("workspace");
|
|
273264
|
+
}
|
|
273195
273265
|
const workspace = await esm_default2({
|
|
273196
273266
|
message: "Which workspace do you want to connect to?",
|
|
273197
273267
|
choices: workspaces.map((workspace2) => ({
|
|
@@ -273210,9 +273280,8 @@ async function workspacePrompt(env2, workspaces, accept) {
|
|
|
273210
273280
|
function connectCommand() {
|
|
273211
273281
|
return new Command("connect").option("--prod", "Connect to your production environment").option("-a, --accept-defaults", "Accept the default and previously set values").description("Connects your project to your application on SettleMint").action(async ({ acceptDefaults, prod }) => {
|
|
273212
273282
|
intro("Connecting your dApp to SettleMint");
|
|
273213
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
273214
273283
|
const env2 = await loadEnv2(false, !!prod);
|
|
273215
|
-
const instance = await instancePrompt(env2,
|
|
273284
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
273216
273285
|
const personalAccessToken = await getInstanceCredentials(instance);
|
|
273217
273286
|
if (!personalAccessToken) {
|
|
273218
273287
|
return missingPersonalAccessTokenError();
|
|
@@ -273223,20 +273292,20 @@ function connectCommand() {
|
|
|
273223
273292
|
instance
|
|
273224
273293
|
});
|
|
273225
273294
|
const workspaces = await workspaceSpinner(settlemint);
|
|
273226
|
-
const workspace = await workspacePrompt(env2, workspaces,
|
|
273227
|
-
const application = await applicationPrompt(env2, workspace?.applications ?? [],
|
|
273228
|
-
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint,
|
|
273295
|
+
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
273296
|
+
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
|
273297
|
+
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
|
273229
273298
|
const { middleware, integrationTool, storage, privateKey, insights, customDeployment, blockchainNodes } = await servicesSpinner(settlemint, application);
|
|
273230
|
-
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes,
|
|
273231
|
-
const hasura = await hasuraPrompt(env2, integrationTool,
|
|
273232
|
-
const thegraph = await theGraphPrompt(env2, middleware,
|
|
273233
|
-
const portal = await portalPrompt(env2, middleware,
|
|
273234
|
-
const ipfs = await ipfsPrompt(env2, storage,
|
|
273235
|
-
const minio = await minioPrompt(env2, storage,
|
|
273236
|
-
const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey,
|
|
273237
|
-
const cDeployment = await customDeploymentPrompt(env2, customDeployment,
|
|
273238
|
-
const blockscout = await blockscoutPrompt(env2, insights,
|
|
273239
|
-
if (
|
|
273299
|
+
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
273300
|
+
const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
|
|
273301
|
+
const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
|
|
273302
|
+
const portal = await portalPrompt(env2, middleware, acceptDefaults);
|
|
273303
|
+
const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
|
|
273304
|
+
const minio = await minioPrompt(env2, storage, acceptDefaults);
|
|
273305
|
+
const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
|
|
273306
|
+
const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
|
|
273307
|
+
const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
|
|
273308
|
+
if (acceptDefaults) {
|
|
273240
273309
|
const selectedServices = [
|
|
273241
273310
|
`Workspace: ${workspace.name}`,
|
|
273242
273311
|
`Application: ${application.name}`,
|
|
@@ -273340,9 +273409,12 @@ import { dirname as dirname6 } from "node:path";
|
|
|
273340
273409
|
import { stat as stat8 } from "node:fs/promises";
|
|
273341
273410
|
var import_package_json3 = __toESM(require_lib12(), 1);
|
|
273342
273411
|
var import_package_json4 = __toESM(require_lib12(), 1);
|
|
273343
|
-
async function projectRoot3() {
|
|
273412
|
+
async function projectRoot3(fallbackToCwd = false) {
|
|
273344
273413
|
const packageJsonPath = await findUp("package.json");
|
|
273345
273414
|
if (!packageJsonPath) {
|
|
273415
|
+
if (fallbackToCwd) {
|
|
273416
|
+
return process.cwd();
|
|
273417
|
+
}
|
|
273346
273418
|
throw new Error("Unable to find project root (no package.json found)");
|
|
273347
273419
|
}
|
|
273348
273420
|
return dirname6(packageJsonPath);
|
|
@@ -274103,7 +274175,7 @@ function createCommand2() {
|
|
|
274103
274175
|
}
|
|
274104
274176
|
const selectedTemplate = await templatePrompt(templates, template);
|
|
274105
274177
|
if (!selectedTemplate) {
|
|
274106
|
-
|
|
274178
|
+
return nothingSelectedError("template");
|
|
274107
274179
|
}
|
|
274108
274180
|
await spinner({
|
|
274109
274181
|
startMessage: "Scaffolding the project",
|
|
@@ -274435,11 +274507,11 @@ function getCreateCommand({
|
|
|
274435
274507
|
if (requiresDeployment) {
|
|
274436
274508
|
const selectedProvider = await providerPrompt(platformConfig, provider);
|
|
274437
274509
|
if (!selectedProvider) {
|
|
274438
|
-
|
|
274510
|
+
return nothingSelectedError("provider");
|
|
274439
274511
|
}
|
|
274440
274512
|
const selectedRegion = await regionPrompt(selectedProvider, region);
|
|
274441
274513
|
if (!selectedRegion) {
|
|
274442
|
-
|
|
274514
|
+
return nothingSelectedError("region");
|
|
274443
274515
|
}
|
|
274444
274516
|
}
|
|
274445
274517
|
const { result, waitFor, mapDefaultEnv } = await spinner({
|
|
@@ -274515,6 +274587,9 @@ function blockchainNetworkBesuCreateCommand() {
|
|
|
274515
274587
|
region
|
|
274516
274588
|
}, async (settlemint, env2) => {
|
|
274517
274589
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274590
|
+
if (!applicationUniqueName) {
|
|
274591
|
+
return missingApplication();
|
|
274592
|
+
}
|
|
274518
274593
|
const result = await settlemint.blockchainNetwork.create({
|
|
274519
274594
|
name: name2,
|
|
274520
274595
|
applicationUniqueName,
|
|
@@ -274722,6 +274797,9 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274722
274797
|
cmd2.option("-a, --application <application>", "The application unique name to create the application access token for (defaults to application from env)").addOption(new Option("-v, --validity-period <period>", "The validity period for the token").choices(["DAYS_7", "DAYS_30", "DAYS_60", "DAYS_90", "NONE"]).default("DAYS_7")).action(async (name2, { application, validityPeriod, ...defaultArgs }) => {
|
|
274723
274798
|
return baseAction(defaultArgs, async (settlemint, env2) => {
|
|
274724
274799
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274800
|
+
if (!applicationUniqueName) {
|
|
274801
|
+
return missingApplication();
|
|
274802
|
+
}
|
|
274725
274803
|
const aatToken = await settlemint.applicationAccessToken.create({
|
|
274726
274804
|
applicationUniqueName,
|
|
274727
274805
|
name: name2,
|
|
@@ -274774,6 +274852,7 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274774
274852
|
uniqueName: ""
|
|
274775
274853
|
},
|
|
274776
274854
|
mapDefaultEnv: () => ({
|
|
274855
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274777
274856
|
SETTLEMINT_ACCESS_TOKEN: aatToken
|
|
274778
274857
|
})
|
|
274779
274858
|
};
|
|
@@ -274805,11 +274884,23 @@ function applicationCreateCommand() {
|
|
|
274805
274884
|
type: "application",
|
|
274806
274885
|
alias: "a",
|
|
274807
274886
|
execute: (cmd2, baseAction) => {
|
|
274808
|
-
cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, ...defaultArgs }) => {
|
|
274809
|
-
return baseAction(
|
|
274887
|
+
cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, acceptDefaults, ...defaultArgs }) => {
|
|
274888
|
+
return baseAction({
|
|
274889
|
+
...defaultArgs,
|
|
274890
|
+
acceptDefaults
|
|
274891
|
+
}, async (settlemint, env2) => {
|
|
274892
|
+
let workspaceUniqueName = workspace;
|
|
274893
|
+
if (!workspaceUniqueName) {
|
|
274894
|
+
const workspaces = await settlemint.workspace.list();
|
|
274895
|
+
const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
274896
|
+
if (!workspace2) {
|
|
274897
|
+
return nothingSelectedError("workspace");
|
|
274898
|
+
}
|
|
274899
|
+
workspaceUniqueName = workspace2.uniqueName;
|
|
274900
|
+
}
|
|
274810
274901
|
const result = await settlemint.application.create({
|
|
274811
274902
|
name: name2,
|
|
274812
|
-
workspaceUniqueName
|
|
274903
|
+
workspaceUniqueName
|
|
274813
274904
|
});
|
|
274814
274905
|
return {
|
|
274815
274906
|
result,
|
|
@@ -274842,27 +274933,27 @@ function applicationCreateCommand() {
|
|
|
274842
274933
|
|
|
274843
274934
|
// src/commands/connect/blockchain-network.prompt.ts
|
|
274844
274935
|
async function blockchainNetworkPrompt(env2, networks, accept) {
|
|
274845
|
-
|
|
274846
|
-
|
|
274847
|
-
|
|
274848
|
-
|
|
274849
|
-
|
|
274850
|
-
|
|
274851
|
-
|
|
274852
|
-
|
|
274853
|
-
|
|
274854
|
-
|
|
274855
|
-
|
|
274856
|
-
|
|
274857
|
-
|
|
274858
|
-
|
|
274859
|
-
|
|
274860
|
-
|
|
274861
|
-
|
|
274862
|
-
|
|
274863
|
-
|
|
274864
|
-
|
|
274865
|
-
|
|
274936
|
+
return servicePrompt({
|
|
274937
|
+
env: env2,
|
|
274938
|
+
services: networks,
|
|
274939
|
+
accept,
|
|
274940
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
|
|
274941
|
+
defaultHandler: async ({ defaultService: defaultNetwork }) => {
|
|
274942
|
+
return esm_default2({
|
|
274943
|
+
message: "Which blockchain network do you want to connect to?",
|
|
274944
|
+
choices: [
|
|
274945
|
+
...networks.map((network) => ({
|
|
274946
|
+
name: network.name,
|
|
274947
|
+
value: network
|
|
274948
|
+
})),
|
|
274949
|
+
{
|
|
274950
|
+
name: "None",
|
|
274951
|
+
value: undefined
|
|
274952
|
+
}
|
|
274953
|
+
],
|
|
274954
|
+
default: defaultNetwork
|
|
274955
|
+
});
|
|
274956
|
+
}
|
|
274866
274957
|
});
|
|
274867
274958
|
}
|
|
274868
274959
|
|
|
@@ -274891,19 +274982,18 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274891
274982
|
provider,
|
|
274892
274983
|
region
|
|
274893
274984
|
}, async (settlemint, env2) => {
|
|
274894
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
274895
274985
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274896
274986
|
if (!applicationUniqueName) {
|
|
274897
|
-
|
|
274987
|
+
return missingApplication();
|
|
274898
274988
|
}
|
|
274899
|
-
let networkUniqueName = blockchainNetwork
|
|
274989
|
+
let networkUniqueName = blockchainNetwork;
|
|
274900
274990
|
if (!networkUniqueName) {
|
|
274901
274991
|
const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
|
|
274902
|
-
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults
|
|
274992
|
+
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
|
|
274903
274993
|
if (!network) {
|
|
274904
|
-
|
|
274994
|
+
return nothingSelectedError("blockchain network");
|
|
274905
274995
|
}
|
|
274906
|
-
networkUniqueName = network?.
|
|
274996
|
+
networkUniqueName = network?.uniqueName;
|
|
274907
274997
|
}
|
|
274908
274998
|
const result = await settlemint.blockchainNode.create({
|
|
274909
274999
|
applicationUniqueName,
|
|
@@ -274921,7 +275011,7 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274921
275011
|
mapDefaultEnv: () => {
|
|
274922
275012
|
return {
|
|
274923
275013
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274924
|
-
SETTLEMINT_BLOCKCHAIN_NODE: result.
|
|
275014
|
+
SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
|
|
274925
275015
|
};
|
|
274926
275016
|
}
|
|
274927
275017
|
};
|
|
@@ -274957,15 +275047,27 @@ function blockscoutInsightsCreateCommand() {
|
|
|
274957
275047
|
type: "insights",
|
|
274958
275048
|
alias: "bs",
|
|
274959
275049
|
execute: (cmd2, baseAction) => {
|
|
274960
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, ...defaultArgs }) => {
|
|
275050
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--load-balancer <loadBalancer>", "Load Balancer unique name (mutually exclusive with blockchain-node)").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name (mutually exclusive with load-balancer)").action(async (name2, { application, provider, region, size, type: type4, blockchainNode, loadBalancer, acceptDefaults, ...defaultArgs }) => {
|
|
274961
275051
|
return baseAction({
|
|
274962
275052
|
...defaultArgs,
|
|
275053
|
+
acceptDefaults,
|
|
274963
275054
|
provider,
|
|
274964
275055
|
region
|
|
274965
275056
|
}, async (settlemint, env2) => {
|
|
274966
275057
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274967
|
-
|
|
275058
|
+
if (!applicationUniqueName) {
|
|
275059
|
+
return missingApplication();
|
|
275060
|
+
}
|
|
275061
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
274968
275062
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275063
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275064
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275065
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275066
|
+
if (!node) {
|
|
275067
|
+
return nothingSelectedError("blockchain node");
|
|
275068
|
+
}
|
|
275069
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275070
|
+
}
|
|
274969
275071
|
const result = await settlemint.insights.create({
|
|
274970
275072
|
name: name2,
|
|
274971
275073
|
applicationUniqueName,
|
|
@@ -275024,6 +275126,9 @@ function hasuraIntegrationCreateCommand() {
|
|
|
275024
275126
|
region
|
|
275025
275127
|
}, async (settlemint, env2) => {
|
|
275026
275128
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275129
|
+
if (!applicationUniqueName) {
|
|
275130
|
+
return missingApplication();
|
|
275131
|
+
}
|
|
275027
275132
|
const result = await settlemint.integrationTool.create({
|
|
275028
275133
|
name: name2,
|
|
275029
275134
|
applicationUniqueName,
|
|
@@ -275073,14 +275178,26 @@ function graphMiddlewareCreateCommand() {
|
|
|
275073
275178
|
type: "middleware",
|
|
275074
275179
|
alias: "gr",
|
|
275075
275180
|
execute: (cmd2, baseAction) => {
|
|
275076
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275181
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
|
275077
275182
|
return baseAction({
|
|
275078
275183
|
...defaultArgs,
|
|
275184
|
+
acceptDefaults,
|
|
275079
275185
|
provider,
|
|
275080
275186
|
region
|
|
275081
275187
|
}, async (settlemint, env2) => {
|
|
275082
275188
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275083
|
-
|
|
275189
|
+
if (!applicationUniqueName) {
|
|
275190
|
+
return missingApplication();
|
|
275191
|
+
}
|
|
275192
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275193
|
+
if (!blockchainNodeUniqueName) {
|
|
275194
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275195
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275196
|
+
if (!node) {
|
|
275197
|
+
return nothingSelectedError("blockchain node");
|
|
275198
|
+
}
|
|
275199
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275200
|
+
}
|
|
275084
275201
|
const result = await settlemint.middleware.create({
|
|
275085
275202
|
name: name2,
|
|
275086
275203
|
applicationUniqueName,
|
|
@@ -275136,16 +275253,29 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
275136
275253
|
type: type4,
|
|
275137
275254
|
includePredeployedAbis,
|
|
275138
275255
|
abis,
|
|
275256
|
+
acceptDefaults,
|
|
275139
275257
|
...defaultArgs
|
|
275140
275258
|
}) => {
|
|
275141
275259
|
return baseAction({
|
|
275142
275260
|
...defaultArgs,
|
|
275261
|
+
acceptDefaults,
|
|
275143
275262
|
provider,
|
|
275144
275263
|
region
|
|
275145
275264
|
}, async (settlemint, env2) => {
|
|
275146
275265
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275147
|
-
|
|
275266
|
+
if (!applicationUniqueName) {
|
|
275267
|
+
return missingApplication();
|
|
275268
|
+
}
|
|
275269
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
275148
275270
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275271
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275272
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275273
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275274
|
+
if (!node) {
|
|
275275
|
+
return nothingSelectedError("blockchain node");
|
|
275276
|
+
}
|
|
275277
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275278
|
+
}
|
|
275149
275279
|
const parsedAbis = [];
|
|
275150
275280
|
if (abis && abis.length > 0) {
|
|
275151
275281
|
try {
|
|
@@ -275218,14 +275348,26 @@ function privateKeyHdCreateCommand() {
|
|
|
275218
275348
|
type: "private key",
|
|
275219
275349
|
alias: "hd",
|
|
275220
275350
|
execute: (cmd2, baseAction) => {
|
|
275221
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275351
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
|
275222
275352
|
return baseAction({
|
|
275223
275353
|
...defaultArgs,
|
|
275354
|
+
acceptDefaults,
|
|
275224
275355
|
provider,
|
|
275225
275356
|
region
|
|
275226
275357
|
}, async (settlemint, env2) => {
|
|
275227
275358
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275228
|
-
|
|
275359
|
+
if (!applicationUniqueName) {
|
|
275360
|
+
return missingApplication();
|
|
275361
|
+
}
|
|
275362
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275363
|
+
if (!blockchainNodeUniqueName) {
|
|
275364
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275365
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275366
|
+
if (!node) {
|
|
275367
|
+
return nothingSelectedError("blockchain node");
|
|
275368
|
+
}
|
|
275369
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275370
|
+
}
|
|
275229
275371
|
const result = await settlemint.privateKey.create({
|
|
275230
275372
|
name: name2,
|
|
275231
275373
|
applicationUniqueName,
|
|
@@ -275272,14 +275414,26 @@ function privateKeyHsmCreateCommand() {
|
|
|
275272
275414
|
type: "private key",
|
|
275273
275415
|
alias: "hd",
|
|
275274
275416
|
execute: (cmd2, baseAction) => {
|
|
275275
|
-
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275417
|
+
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").option("--blockchain-node <blockchainNode>", "Blockchain Node unique name").action(async (name2, { application, blockchainNode, provider, region, size, type: type4, acceptDefaults, ...defaultArgs }) => {
|
|
275276
275418
|
return baseAction({
|
|
275277
275419
|
...defaultArgs,
|
|
275420
|
+
acceptDefaults,
|
|
275278
275421
|
provider,
|
|
275279
275422
|
region
|
|
275280
275423
|
}, async (settlemint, env2) => {
|
|
275281
275424
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275282
|
-
|
|
275425
|
+
if (!applicationUniqueName) {
|
|
275426
|
+
return missingApplication();
|
|
275427
|
+
}
|
|
275428
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275429
|
+
if (!blockchainNodeUniqueName) {
|
|
275430
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275431
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275432
|
+
if (!node) {
|
|
275433
|
+
return nothingSelectedError("blockchain node");
|
|
275434
|
+
}
|
|
275435
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275436
|
+
}
|
|
275283
275437
|
const result = await settlemint.privateKey.create({
|
|
275284
275438
|
name: name2,
|
|
275285
275439
|
applicationUniqueName,
|
|
@@ -275332,6 +275486,9 @@ function ipfsStorageCreateCommand() {
|
|
|
275332
275486
|
region
|
|
275333
275487
|
}, async (settlemint, env2) => {
|
|
275334
275488
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275489
|
+
if (!applicationUniqueName) {
|
|
275490
|
+
return missingApplication();
|
|
275491
|
+
}
|
|
275335
275492
|
const result = await settlemint.storage.create({
|
|
275336
275493
|
name: name2,
|
|
275337
275494
|
applicationUniqueName,
|
|
@@ -275381,6 +275538,9 @@ function minioStorageCreateCommand() {
|
|
|
275381
275538
|
region
|
|
275382
275539
|
}, async (settlemint, env2) => {
|
|
275383
275540
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275541
|
+
if (!applicationUniqueName) {
|
|
275542
|
+
return missingApplication();
|
|
275543
|
+
}
|
|
275384
275544
|
const result = await settlemint.storage.create({
|
|
275385
275545
|
name: name2,
|
|
275386
275546
|
applicationUniqueName,
|
|
@@ -275474,9 +275634,8 @@ function getDeleteCommand({
|
|
|
275474
275634
|
if (!force) {
|
|
275475
275635
|
await deleteConfirmationPrompt(`this ${type4}`);
|
|
275476
275636
|
}
|
|
275477
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275478
275637
|
const env2 = await loadEnv2(false, !!prod);
|
|
275479
|
-
const instance = await instancePrompt(env2,
|
|
275638
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275480
275639
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275481
275640
|
env: env2,
|
|
275482
275641
|
instance,
|
|
@@ -275569,9 +275728,8 @@ function getRestartCommand({
|
|
|
275569
275728
|
}
|
|
275570
275729
|
])).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 }) => {
|
|
275571
275730
|
intro(`Restarting ${type4} in the SettleMint platform`);
|
|
275572
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275573
275731
|
const env2 = await loadEnv2(false, !!prod);
|
|
275574
|
-
const instance = await instancePrompt(env2,
|
|
275732
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275575
275733
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275576
275734
|
env: env2,
|
|
275577
275735
|
instance,
|
|
@@ -275885,7 +276043,7 @@ function createCommand4() {
|
|
|
275885
276043
|
const platformConfig = await settlemint.platform.config();
|
|
275886
276044
|
const selectedUseCase = await useCasePrompt(platformConfig, useCase);
|
|
275887
276045
|
if (!selectedUseCase) {
|
|
275888
|
-
|
|
276046
|
+
return nothingSelectedError("use case");
|
|
275889
276047
|
}
|
|
275890
276048
|
const targetDir = formatTargetDir(name2);
|
|
275891
276049
|
const projectDir = join8(process.cwd(), targetDir);
|
|
@@ -276071,6 +276229,51 @@ function hardhatDeployLocalCommand() {
|
|
|
276071
276229
|
});
|
|
276072
276230
|
}
|
|
276073
276231
|
|
|
276232
|
+
// src/error/service-not-running-error.ts
|
|
276233
|
+
function serviceNotRunningError(service, status) {
|
|
276234
|
+
return cancel2(`The ${service} service is not in a Running state (status: ${status}).`);
|
|
276235
|
+
}
|
|
276236
|
+
|
|
276237
|
+
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
|
276238
|
+
async function selectTargetNode({
|
|
276239
|
+
env: env2,
|
|
276240
|
+
blockchainNodeUniqueName,
|
|
276241
|
+
autoAccept,
|
|
276242
|
+
settlemint
|
|
276243
|
+
}) {
|
|
276244
|
+
const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
|
|
276245
|
+
let node = undefined;
|
|
276246
|
+
if (!nodeUniqueName) {
|
|
276247
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276248
|
+
return missingApplication();
|
|
276249
|
+
}
|
|
276250
|
+
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276251
|
+
const evmNodes = nodes.filter((node2) => node2.isEvm);
|
|
276252
|
+
if (evmNodes.length === 0) {
|
|
276253
|
+
cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
|
|
276254
|
+
}
|
|
276255
|
+
const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
|
|
276256
|
+
const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
|
|
276257
|
+
if (nodesWithActivePrivateKey.length === 0) {
|
|
276258
|
+
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276259
|
+
}
|
|
276260
|
+
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
|
|
276261
|
+
if (!blockchainNode) {
|
|
276262
|
+
return nothingSelectedError("EVM blockchain node");
|
|
276263
|
+
}
|
|
276264
|
+
node = blockchainNode;
|
|
276265
|
+
} else {
|
|
276266
|
+
node = await settlemint.blockchainNode.read(nodeUniqueName);
|
|
276267
|
+
if (!node.isEvm) {
|
|
276268
|
+
cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
|
|
276269
|
+
}
|
|
276270
|
+
}
|
|
276271
|
+
if (node.status !== "COMPLETED") {
|
|
276272
|
+
serviceNotRunningError("blockchain node", node.status);
|
|
276273
|
+
}
|
|
276274
|
+
return node;
|
|
276275
|
+
}
|
|
276276
|
+
|
|
276074
276277
|
// src/commands/smart-contract-set/prompts/address.prompt.ts
|
|
276075
276278
|
async function addressPrompt({
|
|
276076
276279
|
env: env2,
|
|
@@ -276184,30 +276387,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
276184
276387
|
accessToken,
|
|
276185
276388
|
instance
|
|
276186
276389
|
});
|
|
276187
|
-
const
|
|
276188
|
-
let node = undefined;
|
|
276189
|
-
if (!nodeUniqueName) {
|
|
276190
|
-
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276191
|
-
const evmNodes = nodes.filter((node2) => node2.isEvm);
|
|
276192
|
-
if (evmNodes.length === 0) {
|
|
276193
|
-
cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
|
|
276194
|
-
}
|
|
276195
|
-
const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
|
|
276196
|
-
const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
|
|
276197
|
-
if (nodesWithActivePrivateKey.length === 0) {
|
|
276198
|
-
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276199
|
-
}
|
|
276200
|
-
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
|
|
276201
|
-
if (!blockchainNode) {
|
|
276202
|
-
cancel("No EVM blockchain node selected. Please select one to continue.");
|
|
276203
|
-
}
|
|
276204
|
-
node = blockchainNode;
|
|
276205
|
-
} else {
|
|
276206
|
-
node = await settlemint.blockchainNode.read(nodeUniqueName);
|
|
276207
|
-
if (!node.isEvm) {
|
|
276208
|
-
cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
|
|
276209
|
-
}
|
|
276210
|
-
}
|
|
276390
|
+
const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
|
276211
276391
|
const envConfig = await settlemint.foundry.env(node.uniqueName);
|
|
276212
276392
|
const hardhatConfig = await getHardhatConfigData(envConfig);
|
|
276213
276393
|
if (verify && !hardhatConfig?.etherscan?.apiKey) {
|
|
@@ -276215,7 +276395,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
276215
276395
|
}
|
|
276216
276396
|
const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
|
|
276217
276397
|
if (!address) {
|
|
276218
|
-
|
|
276398
|
+
return nothingSelectedError("private key");
|
|
276219
276399
|
}
|
|
276220
276400
|
const { command, args } = await getPackageManagerExecutable();
|
|
276221
276401
|
await executeCommand(command, [
|
|
@@ -276299,16 +276479,8 @@ function hardhatScriptRemoteCommand() {
|
|
|
276299
276479
|
accessToken,
|
|
276300
276480
|
instance
|
|
276301
276481
|
});
|
|
276302
|
-
|
|
276303
|
-
|
|
276304
|
-
const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276305
|
-
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
|
|
276306
|
-
if (!blockchainNode) {
|
|
276307
|
-
cancel("No Blockchain Node selected. Please select one to continue.");
|
|
276308
|
-
}
|
|
276309
|
-
nodeUniqueName = blockchainNode.uniqueName;
|
|
276310
|
-
}
|
|
276311
|
-
const envConfig = await settlemint.foundry.env(nodeUniqueName);
|
|
276482
|
+
const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
|
276483
|
+
const envConfig = await settlemint.foundry.env(node.uniqueName);
|
|
276312
276484
|
const { command, args } = await getPackageManagerExecutable();
|
|
276313
276485
|
await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
|
|
276314
276486
|
});
|
|
@@ -276525,6 +276697,9 @@ async function getTheGraphMiddleware({
|
|
|
276525
276697
|
return defaultTheGraphMiddleware;
|
|
276526
276698
|
}
|
|
276527
276699
|
}
|
|
276700
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276701
|
+
return missingApplication();
|
|
276702
|
+
}
|
|
276528
276703
|
const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
|
|
276529
276704
|
return theGraphPrompt(env2, middlewares, autoAccept);
|
|
276530
276705
|
}
|
|
@@ -276634,7 +276809,10 @@ function subgraphDeployCommand() {
|
|
|
276634
276809
|
});
|
|
276635
276810
|
const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
|
276636
276811
|
if (!theGraphMiddleware) {
|
|
276637
|
-
|
|
276812
|
+
return nothingSelectedError("graph middleware");
|
|
276813
|
+
}
|
|
276814
|
+
if (theGraphMiddleware.status !== "COMPLETED") {
|
|
276815
|
+
serviceNotRunningError("graph middleware", theGraphMiddleware.status);
|
|
276638
276816
|
}
|
|
276639
276817
|
const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
|
|
276640
276818
|
await subgraphSetup({
|
|
@@ -276737,4 +276915,4 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
276737
276915
|
ascii();
|
|
276738
276916
|
sdkCliCommand();
|
|
276739
276917
|
|
|
276740
|
-
//# debugId=
|
|
276918
|
+
//# debugId=008BD711F17DEA0564756E2164756E21
|