@settlemint/sdk-cli 0.9.2 → 0.9.3-main028f304e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +745 -537
- package/dist/cli.js.map +61 -54
- 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.pzDdwuA2Cm:/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.pzDdwuA2Cm:/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.pzDdwuA2Cm:/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.pzDdwuA2Cm:/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.
|
|
226467
|
+
binaryVersion: "0.9.3-main028f304e",
|
|
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.pzDdwuA2Cm:/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.
|
|
256791
|
+
version: "0.9.3-main028f304e",
|
|
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.
|
|
256845
|
-
"@settlemint/sdk-utils": "0.9.
|
|
256844
|
+
"@settlemint/sdk-js": "0.9.3-main028f304e",
|
|
256845
|
+
"@settlemint/sdk-utils": "0.9.3-main028f304e",
|
|
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";
|
|
@@ -267900,7 +267906,13 @@ export const { client: theGraphClient${nameSuffix}, graphql: theGraphGraphql${na
|
|
|
267900
267906
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
267901
267907
|
|
|
267902
267908
|
// src/commands/codegen/test-gql-endpoint.ts
|
|
267903
|
-
async function testGqlEndpoint(
|
|
267909
|
+
async function testGqlEndpoint({
|
|
267910
|
+
accessToken,
|
|
267911
|
+
hasuraAdminSecret,
|
|
267912
|
+
gqlEndpoint,
|
|
267913
|
+
isHasura = false,
|
|
267914
|
+
maxRetries = 3
|
|
267915
|
+
}) {
|
|
267904
267916
|
if (!gqlEndpoint) {
|
|
267905
267917
|
return false;
|
|
267906
267918
|
}
|
|
@@ -268842,12 +268854,29 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
|
268842
268854
|
const name2 = gqlEndpoint.split("/").pop();
|
|
268843
268855
|
return name2 && (!thegraphSubgraphNames || thegraphSubgraphNames.includes(name2));
|
|
268844
268856
|
});
|
|
268845
|
-
const [hasura, portal,
|
|
268846
|
-
testGqlEndpoint(
|
|
268847
|
-
|
|
268848
|
-
|
|
268849
|
-
|
|
268857
|
+
const [hasura, portal, blockscout] = await Promise.all([
|
|
268858
|
+
testGqlEndpoint({
|
|
268859
|
+
accessToken,
|
|
268860
|
+
hasuraAdminSecret: env2.SETTLEMINT_HASURA_ADMIN_SECRET,
|
|
268861
|
+
gqlEndpoint: env2.SETTLEMINT_HASURA_ENDPOINT,
|
|
268862
|
+
isHasura: true
|
|
268863
|
+
}),
|
|
268864
|
+
testGqlEndpoint({
|
|
268865
|
+
accessToken,
|
|
268866
|
+
gqlEndpoint: env2.SETTLEMINT_PORTAL_GRAPHQL_ENDPOINT
|
|
268867
|
+
}),
|
|
268868
|
+
testGqlEndpoint({
|
|
268869
|
+
accessToken,
|
|
268870
|
+
gqlEndpoint: env2.SETTLEMINT_BLOCKSCOUT_GRAPHQL_ENDPOINT
|
|
268871
|
+
})
|
|
268850
268872
|
]);
|
|
268873
|
+
const thegraph = await Promise.all(theGraphEndpoints.map((endpoint) => {
|
|
268874
|
+
const success = testGqlEndpoint({
|
|
268875
|
+
accessToken,
|
|
268876
|
+
gqlEndpoint: endpoint
|
|
268877
|
+
});
|
|
268878
|
+
return { success, endpoint };
|
|
268879
|
+
}));
|
|
268851
268880
|
if (!tsconfig.config.compilerOptions) {
|
|
268852
268881
|
tsconfig.config.compilerOptions = {};
|
|
268853
268882
|
}
|
|
@@ -268866,7 +268895,7 @@ async function codegenTsconfig(env2, thegraphSubgraphNames) {
|
|
|
268866
268895
|
tadaTurboLocation: "hasura-cache.d.ts"
|
|
268867
268896
|
}
|
|
268868
268897
|
] : [],
|
|
268869
|
-
...thegraph ?
|
|
268898
|
+
...thegraph ? thegraph.filter((endpoint) => endpoint.success).map(({ endpoint }) => {
|
|
268870
268899
|
const name2 = endpoint.split("/").pop();
|
|
268871
268900
|
return {
|
|
268872
268901
|
name: `thegraph-${name2}`,
|
|
@@ -270060,9 +270089,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
|
|
|
270060
270089
|
return {};
|
|
270061
270090
|
}
|
|
270062
270091
|
}
|
|
270063
|
-
async function projectRoot2() {
|
|
270092
|
+
async function projectRoot2(fallbackToCwd = false) {
|
|
270064
270093
|
const packageJsonPath = await findUp("package.json");
|
|
270065
270094
|
if (!packageJsonPath) {
|
|
270095
|
+
if (fallbackToCwd) {
|
|
270096
|
+
return process.cwd();
|
|
270097
|
+
}
|
|
270066
270098
|
throw new Error("Unable to find project root (no package.json found)");
|
|
270067
270099
|
}
|
|
270068
270100
|
return dirname5(packageJsonPath);
|
|
@@ -270113,7 +270145,7 @@ async function findMonoRepoPackages(projectDir) {
|
|
|
270113
270145
|
}
|
|
270114
270146
|
}
|
|
270115
270147
|
async function writeEnv(prod, env2, secrets) {
|
|
270116
|
-
const projectDir = await projectRoot2();
|
|
270148
|
+
const projectDir = await projectRoot2(true);
|
|
270117
270149
|
if (prod) {
|
|
270118
270150
|
process.env.NODE_ENV = "production";
|
|
270119
270151
|
}
|
|
@@ -270502,7 +270534,7 @@ async function getGraphEndpoint(service, env2) {
|
|
|
270502
270534
|
const isStarterKit = (id) => id.endsWith("-starterkits");
|
|
270503
270535
|
const testEndpoint = service.subgraphs.find(({ graphqlQueryEndpoint }) => !isStarterKit(graphqlQueryEndpoint?.id))?.graphqlQueryEndpoint?.displayValue;
|
|
270504
270536
|
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,
|
|
270537
|
+
const hasEndpoint = testEndpoint && env2.SETTLEMINT_ACCESS_TOKEN ? await testGqlEndpoint({ accessToken: env2.SETTLEMINT_ACCESS_TOKEN, gqlEndpoint: testEndpoint }) : false;
|
|
270506
270538
|
const endpoints = hasEndpoint ? service.subgraphs.map(({ graphqlQueryEndpoint }) => graphqlQueryEndpoint?.displayValue) : starterKitEndpoint ? [starterKitEndpoint] : [];
|
|
270507
270539
|
if (endpoints.length === 0) {
|
|
270508
270540
|
return {};
|
|
@@ -272346,6 +272378,42 @@ var middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
|
|
|
272346
272378
|
});
|
|
272347
272379
|
return middleware;
|
|
272348
272380
|
};
|
|
272381
|
+
var getPlatformConfigQuery = graphql(`
|
|
272382
|
+
query platformConfig {
|
|
272383
|
+
config {
|
|
272384
|
+
smartContractSets {
|
|
272385
|
+
id
|
|
272386
|
+
sets {
|
|
272387
|
+
id
|
|
272388
|
+
name
|
|
272389
|
+
featureflagged
|
|
272390
|
+
image {
|
|
272391
|
+
repository
|
|
272392
|
+
tag
|
|
272393
|
+
registry
|
|
272394
|
+
}
|
|
272395
|
+
}
|
|
272396
|
+
}
|
|
272397
|
+
deploymentEngineTargets {
|
|
272398
|
+
id
|
|
272399
|
+
name
|
|
272400
|
+
disabled
|
|
272401
|
+
clusters {
|
|
272402
|
+
id
|
|
272403
|
+
name
|
|
272404
|
+
disabled
|
|
272405
|
+
}
|
|
272406
|
+
}
|
|
272407
|
+
preDeployedContracts
|
|
272408
|
+
}
|
|
272409
|
+
}
|
|
272410
|
+
`, []);
|
|
272411
|
+
var getPlatformConfig = (gqlClient) => {
|
|
272412
|
+
return async () => {
|
|
272413
|
+
const { config: config4 } = await gqlClient.request(getPlatformConfigQuery);
|
|
272414
|
+
return config4;
|
|
272415
|
+
};
|
|
272416
|
+
};
|
|
272349
272417
|
var PrivateKeyFragment = graphql(`
|
|
272350
272418
|
fragment PrivateKey on PrivateKey {
|
|
272351
272419
|
__typename
|
|
@@ -272545,6 +272613,9 @@ function createSettleMintClient(options) {
|
|
|
272545
272613
|
},
|
|
272546
272614
|
applicationAccessToken: {
|
|
272547
272615
|
create: applicationAccessTokenCreate(gqlClient)
|
|
272616
|
+
},
|
|
272617
|
+
platform: {
|
|
272618
|
+
config: getPlatformConfig(gqlClient)
|
|
272548
272619
|
}
|
|
272549
272620
|
};
|
|
272550
272621
|
}
|
|
@@ -272711,8 +272782,9 @@ var esm_default5 = createPrompt((config4, done) => {
|
|
|
272711
272782
|
|
|
272712
272783
|
// src/commands/connect/aat.prompt.ts
|
|
272713
272784
|
async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
|
|
272785
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272714
272786
|
const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
|
|
272715
|
-
const defaultPossible =
|
|
272787
|
+
const defaultPossible = autoAccept && defaultAccessToken;
|
|
272716
272788
|
if (defaultPossible || is_in_ci_default) {
|
|
272717
272789
|
return defaultAccessToken;
|
|
272718
272790
|
}
|
|
@@ -272807,16 +272879,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
|
|
|
272807
272879
|
});
|
|
272808
272880
|
}
|
|
272809
272881
|
|
|
272882
|
+
// src/error/nothing-selected-error.ts
|
|
272883
|
+
function nothingSelectedError(type4) {
|
|
272884
|
+
return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
|
|
272885
|
+
}
|
|
272886
|
+
|
|
272810
272887
|
// src/commands/connect/application.prompt.ts
|
|
272811
272888
|
async function applicationPrompt(env2, applications, accept) {
|
|
272889
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272812
272890
|
const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
|
|
272813
|
-
const defaultPossible =
|
|
272891
|
+
const defaultPossible = autoAccept && defaultApplication;
|
|
272814
272892
|
if (defaultPossible) {
|
|
272815
272893
|
return defaultApplication;
|
|
272816
272894
|
}
|
|
272817
272895
|
if (applications.length === 0) {
|
|
272818
272896
|
cancel("No applications found");
|
|
272819
272897
|
}
|
|
272898
|
+
if (is_in_ci_default) {
|
|
272899
|
+
nothingSelectedError("application");
|
|
272900
|
+
}
|
|
272820
272901
|
const application = await esm_default2({
|
|
272821
272902
|
message: "Which application do you want to connect to?",
|
|
272822
272903
|
choices: applications.map((applications2) => ({
|
|
@@ -272831,146 +272912,171 @@ async function applicationPrompt(env2, applications, accept) {
|
|
|
272831
272912
|
return application;
|
|
272832
272913
|
}
|
|
272833
272914
|
|
|
272834
|
-
// src/commands/connect/
|
|
272835
|
-
async function
|
|
272836
|
-
|
|
272915
|
+
// src/commands/connect/service.prompt.ts
|
|
272916
|
+
async function servicePrompt({
|
|
272917
|
+
env: env2,
|
|
272918
|
+
services,
|
|
272919
|
+
accept,
|
|
272920
|
+
envKey,
|
|
272921
|
+
defaultHandler,
|
|
272922
|
+
isCi = is_in_ci_default
|
|
272923
|
+
}) {
|
|
272924
|
+
if (services.length === 0) {
|
|
272837
272925
|
return;
|
|
272838
272926
|
}
|
|
272839
|
-
const
|
|
272840
|
-
const
|
|
272841
|
-
if (
|
|
272842
|
-
return
|
|
272927
|
+
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
|
272928
|
+
const autoAccept = isCi || accept;
|
|
272929
|
+
if (autoAccept && selectedService) {
|
|
272930
|
+
return selectedService;
|
|
272843
272931
|
}
|
|
272844
|
-
|
|
272845
|
-
|
|
272846
|
-
|
|
272847
|
-
|
|
272848
|
-
|
|
272849
|
-
|
|
272850
|
-
|
|
272851
|
-
|
|
272852
|
-
|
|
272853
|
-
|
|
272854
|
-
|
|
272855
|
-
|
|
272856
|
-
|
|
272932
|
+
if (isCi) {
|
|
272933
|
+
return;
|
|
272934
|
+
}
|
|
272935
|
+
if (services.length === 1) {
|
|
272936
|
+
return services[0];
|
|
272937
|
+
}
|
|
272938
|
+
return defaultHandler({ defaultService: selectedService });
|
|
272939
|
+
}
|
|
272940
|
+
|
|
272941
|
+
// src/commands/connect/blockchain-node.prompt.ts
|
|
272942
|
+
async function blockchainNodePrompt(env2, nodes, accept, filterRunningOnly = false) {
|
|
272943
|
+
const choices = filterRunningOnly ? nodes.filter((node) => node.status === "COMPLETED") : nodes;
|
|
272944
|
+
return servicePrompt({
|
|
272945
|
+
env: env2,
|
|
272946
|
+
services: nodes,
|
|
272947
|
+
accept,
|
|
272948
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
|
272949
|
+
defaultHandler: async ({ defaultService: defaultNode }) => {
|
|
272950
|
+
return esm_default2({
|
|
272951
|
+
message: "Which blockchain node do you want to connect to?",
|
|
272952
|
+
choices: [
|
|
272953
|
+
...choices.map((node) => ({
|
|
272954
|
+
name: node.name,
|
|
272955
|
+
value: node
|
|
272956
|
+
})),
|
|
272957
|
+
{
|
|
272958
|
+
name: "None",
|
|
272959
|
+
value: undefined
|
|
272960
|
+
}
|
|
272961
|
+
],
|
|
272962
|
+
default: defaultNode
|
|
272963
|
+
});
|
|
272964
|
+
}
|
|
272857
272965
|
});
|
|
272858
|
-
return node;
|
|
272859
272966
|
}
|
|
272860
272967
|
|
|
272861
272968
|
// src/commands/connect/blockscout.prompt.ts
|
|
272862
272969
|
async function blockscoutPrompt(env2, insights, accept) {
|
|
272863
272970
|
const possible = insights.filter((insight) => insight.insightsCategory === "BLOCKCHAIN_EXPLORER");
|
|
272864
|
-
|
|
272865
|
-
|
|
272866
|
-
|
|
272867
|
-
|
|
272868
|
-
|
|
272869
|
-
|
|
272870
|
-
|
|
272871
|
-
|
|
272872
|
-
|
|
272873
|
-
|
|
272874
|
-
|
|
272875
|
-
|
|
272876
|
-
|
|
272877
|
-
|
|
272878
|
-
|
|
272879
|
-
|
|
272880
|
-
|
|
272881
|
-
|
|
272882
|
-
|
|
272883
|
-
|
|
272884
|
-
|
|
272971
|
+
return servicePrompt({
|
|
272972
|
+
env: env2,
|
|
272973
|
+
services: possible,
|
|
272974
|
+
accept,
|
|
272975
|
+
envKey: "SETTLEMINT_BLOCKSCOUT",
|
|
272976
|
+
defaultHandler: async ({ defaultService: defaultBlockscout }) => {
|
|
272977
|
+
return esm_default2({
|
|
272978
|
+
message: "Which blockscout instance do you want to connect to?",
|
|
272979
|
+
choices: [
|
|
272980
|
+
...possible.map((insight) => ({
|
|
272981
|
+
name: insight.name,
|
|
272982
|
+
value: insight
|
|
272983
|
+
})),
|
|
272984
|
+
{
|
|
272985
|
+
name: "None",
|
|
272986
|
+
value: undefined
|
|
272987
|
+
}
|
|
272988
|
+
],
|
|
272989
|
+
default: defaultBlockscout
|
|
272990
|
+
});
|
|
272991
|
+
}
|
|
272885
272992
|
});
|
|
272886
|
-
return blockscout;
|
|
272887
272993
|
}
|
|
272888
272994
|
|
|
272889
272995
|
// src/commands/connect/custom-deployment.prompt.ts
|
|
272890
272996
|
async function customDeploymentPrompt(env2, customDeployments, accept) {
|
|
272891
|
-
|
|
272892
|
-
|
|
272893
|
-
|
|
272894
|
-
|
|
272895
|
-
|
|
272896
|
-
|
|
272897
|
-
|
|
272898
|
-
|
|
272899
|
-
|
|
272900
|
-
|
|
272901
|
-
|
|
272902
|
-
|
|
272903
|
-
|
|
272904
|
-
|
|
272905
|
-
|
|
272906
|
-
|
|
272907
|
-
|
|
272908
|
-
|
|
272909
|
-
|
|
272910
|
-
|
|
272911
|
-
|
|
272997
|
+
return servicePrompt({
|
|
272998
|
+
env: env2,
|
|
272999
|
+
services: customDeployments,
|
|
273000
|
+
accept,
|
|
273001
|
+
envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
|
|
273002
|
+
defaultHandler: async ({
|
|
273003
|
+
defaultService: defaultCustomDeployment
|
|
273004
|
+
}) => {
|
|
273005
|
+
return esm_default2({
|
|
273006
|
+
message: "Which Custom Deployment do you want to connect to?",
|
|
273007
|
+
choices: [
|
|
273008
|
+
...customDeployments.map((customDeployment) => ({
|
|
273009
|
+
name: customDeployment.name,
|
|
273010
|
+
value: customDeployment
|
|
273011
|
+
})),
|
|
273012
|
+
{
|
|
273013
|
+
name: "None",
|
|
273014
|
+
value: undefined
|
|
273015
|
+
}
|
|
273016
|
+
],
|
|
273017
|
+
default: defaultCustomDeployment
|
|
273018
|
+
});
|
|
273019
|
+
}
|
|
272912
273020
|
});
|
|
272913
|
-
return middleware;
|
|
272914
273021
|
}
|
|
272915
273022
|
|
|
272916
273023
|
// src/commands/connect/hasura.prompt.ts
|
|
272917
273024
|
async function hasuraPrompt(env2, integrations, accept) {
|
|
272918
273025
|
const possible = integrations.filter((integration) => integration.integrationType === "HASURA");
|
|
272919
|
-
|
|
272920
|
-
|
|
272921
|
-
|
|
272922
|
-
|
|
272923
|
-
|
|
272924
|
-
|
|
272925
|
-
|
|
272926
|
-
|
|
272927
|
-
|
|
272928
|
-
|
|
272929
|
-
|
|
272930
|
-
|
|
272931
|
-
|
|
272932
|
-
|
|
272933
|
-
|
|
272934
|
-
|
|
272935
|
-
|
|
272936
|
-
|
|
272937
|
-
|
|
272938
|
-
|
|
272939
|
-
|
|
273026
|
+
return servicePrompt({
|
|
273027
|
+
env: env2,
|
|
273028
|
+
services: possible,
|
|
273029
|
+
accept,
|
|
273030
|
+
envKey: "SETTLEMINT_HASURA",
|
|
273031
|
+
defaultHandler: async ({ defaultService: defaultHasura }) => {
|
|
273032
|
+
return esm_default2({
|
|
273033
|
+
message: "Which Hasura instance do you want to connect to?",
|
|
273034
|
+
choices: [
|
|
273035
|
+
...possible.map((integration) => ({
|
|
273036
|
+
name: integration.name,
|
|
273037
|
+
value: integration
|
|
273038
|
+
})),
|
|
273039
|
+
{
|
|
273040
|
+
name: "None",
|
|
273041
|
+
value: undefined
|
|
273042
|
+
}
|
|
273043
|
+
],
|
|
273044
|
+
default: defaultHasura
|
|
273045
|
+
});
|
|
273046
|
+
}
|
|
272940
273047
|
});
|
|
272941
|
-
return hasura;
|
|
272942
273048
|
}
|
|
272943
273049
|
|
|
272944
273050
|
// src/commands/connect/hd-private-keys.prompt.ts
|
|
272945
273051
|
async function hdPrivateKeyPrompt(env2, privateKeys, accept) {
|
|
272946
|
-
const possible = privateKeys.filter((
|
|
272947
|
-
|
|
272948
|
-
|
|
272949
|
-
|
|
272950
|
-
|
|
272951
|
-
|
|
272952
|
-
|
|
272953
|
-
|
|
272954
|
-
|
|
272955
|
-
|
|
272956
|
-
|
|
272957
|
-
|
|
272958
|
-
|
|
272959
|
-
|
|
272960
|
-
|
|
272961
|
-
|
|
272962
|
-
|
|
272963
|
-
|
|
272964
|
-
|
|
272965
|
-
|
|
272966
|
-
|
|
272967
|
-
|
|
273052
|
+
const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
|
|
273053
|
+
return servicePrompt({
|
|
273054
|
+
env: env2,
|
|
273055
|
+
services: possible,
|
|
273056
|
+
accept,
|
|
273057
|
+
envKey: "SETTLEMINT_HD_PRIVATE_KEY",
|
|
273058
|
+
defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
|
|
273059
|
+
return esm_default2({
|
|
273060
|
+
message: "Which HD Private Key do you want to use?",
|
|
273061
|
+
choices: [
|
|
273062
|
+
...possible.map((privateKey) => ({
|
|
273063
|
+
name: privateKey.name,
|
|
273064
|
+
value: privateKey
|
|
273065
|
+
})),
|
|
273066
|
+
{
|
|
273067
|
+
name: "None",
|
|
273068
|
+
value: undefined
|
|
273069
|
+
}
|
|
273070
|
+
],
|
|
273071
|
+
default: defaultPrivateKey
|
|
273072
|
+
});
|
|
273073
|
+
}
|
|
272968
273074
|
});
|
|
272969
|
-
return privateKey;
|
|
272970
273075
|
}
|
|
272971
273076
|
|
|
272972
273077
|
// src/commands/connect/instance.prompt.ts
|
|
272973
273078
|
async function instancePrompt(env2, accept) {
|
|
273079
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272974
273080
|
const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
|
|
272975
273081
|
const defaultPossible = accept && defaultInstance;
|
|
272976
273082
|
if (defaultPossible) {
|
|
@@ -272995,85 +273101,82 @@ async function instancePrompt(env2, accept) {
|
|
|
272995
273101
|
// src/commands/connect/ipfs.prompt.ts
|
|
272996
273102
|
async function ipfsPrompt(env2, storages, accept) {
|
|
272997
273103
|
const possible = storages.filter((storage) => storage.storageProtocol === "IPFS");
|
|
272998
|
-
|
|
272999
|
-
|
|
273000
|
-
|
|
273001
|
-
|
|
273002
|
-
|
|
273003
|
-
|
|
273004
|
-
|
|
273005
|
-
|
|
273006
|
-
|
|
273007
|
-
|
|
273008
|
-
|
|
273009
|
-
|
|
273010
|
-
|
|
273011
|
-
|
|
273012
|
-
|
|
273013
|
-
|
|
273014
|
-
|
|
273015
|
-
|
|
273016
|
-
|
|
273017
|
-
|
|
273018
|
-
|
|
273104
|
+
return servicePrompt({
|
|
273105
|
+
env: env2,
|
|
273106
|
+
services: possible,
|
|
273107
|
+
accept,
|
|
273108
|
+
envKey: "SETTLEMINT_IPFS",
|
|
273109
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273110
|
+
return esm_default2({
|
|
273111
|
+
message: "Which IPFS instance do you want to connect to?",
|
|
273112
|
+
choices: [
|
|
273113
|
+
...possible.map((storage) => ({
|
|
273114
|
+
name: storage.name,
|
|
273115
|
+
value: storage
|
|
273116
|
+
})),
|
|
273117
|
+
{
|
|
273118
|
+
name: "None",
|
|
273119
|
+
value: undefined
|
|
273120
|
+
}
|
|
273121
|
+
],
|
|
273122
|
+
default: defaultStorage
|
|
273123
|
+
});
|
|
273124
|
+
}
|
|
273019
273125
|
});
|
|
273020
|
-
return minio;
|
|
273021
273126
|
}
|
|
273022
273127
|
|
|
273023
273128
|
// src/commands/connect/minio.prompt.ts
|
|
273024
273129
|
async function minioPrompt(env2, storages, accept) {
|
|
273025
273130
|
const possible = storages.filter((storage) => storage.storageProtocol === "MINIO");
|
|
273026
|
-
|
|
273027
|
-
|
|
273028
|
-
|
|
273029
|
-
|
|
273030
|
-
|
|
273031
|
-
|
|
273032
|
-
|
|
273033
|
-
|
|
273034
|
-
|
|
273035
|
-
|
|
273036
|
-
|
|
273037
|
-
|
|
273038
|
-
|
|
273039
|
-
|
|
273040
|
-
|
|
273041
|
-
|
|
273042
|
-
|
|
273043
|
-
|
|
273044
|
-
|
|
273045
|
-
|
|
273046
|
-
|
|
273131
|
+
return servicePrompt({
|
|
273132
|
+
env: env2,
|
|
273133
|
+
services: possible,
|
|
273134
|
+
accept,
|
|
273135
|
+
envKey: "SETTLEMINT_MINIO",
|
|
273136
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273137
|
+
return esm_default2({
|
|
273138
|
+
message: "Which MinIO instance do you want to connect to?",
|
|
273139
|
+
choices: [
|
|
273140
|
+
...possible.map((storage) => ({
|
|
273141
|
+
name: storage.name,
|
|
273142
|
+
value: storage
|
|
273143
|
+
})),
|
|
273144
|
+
{
|
|
273145
|
+
name: "None",
|
|
273146
|
+
value: undefined
|
|
273147
|
+
}
|
|
273148
|
+
],
|
|
273149
|
+
default: defaultStorage
|
|
273150
|
+
});
|
|
273151
|
+
}
|
|
273047
273152
|
});
|
|
273048
|
-
return minio;
|
|
273049
273153
|
}
|
|
273050
273154
|
|
|
273051
273155
|
// src/commands/connect/portal.prompt.ts
|
|
273052
273156
|
async function portalPrompt(env2, middlewares, accept) {
|
|
273053
|
-
const possible = middlewares.filter((
|
|
273054
|
-
|
|
273055
|
-
|
|
273056
|
-
|
|
273057
|
-
|
|
273058
|
-
|
|
273059
|
-
|
|
273060
|
-
|
|
273061
|
-
|
|
273062
|
-
|
|
273063
|
-
|
|
273064
|
-
|
|
273065
|
-
|
|
273066
|
-
|
|
273067
|
-
|
|
273068
|
-
|
|
273069
|
-
|
|
273070
|
-
|
|
273071
|
-
|
|
273072
|
-
|
|
273073
|
-
|
|
273074
|
-
|
|
273157
|
+
const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
|
|
273158
|
+
return servicePrompt({
|
|
273159
|
+
env: env2,
|
|
273160
|
+
services: possible,
|
|
273161
|
+
accept,
|
|
273162
|
+
envKey: "SETTLEMINT_PORTAL",
|
|
273163
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273164
|
+
return esm_default2({
|
|
273165
|
+
message: "Which Smart Contract Portal instance do you want to connect to?",
|
|
273166
|
+
choices: [
|
|
273167
|
+
...possible.map((middleware) => ({
|
|
273168
|
+
name: middleware.name,
|
|
273169
|
+
value: middleware
|
|
273170
|
+
})),
|
|
273171
|
+
{
|
|
273172
|
+
name: "None",
|
|
273173
|
+
value: undefined
|
|
273174
|
+
}
|
|
273175
|
+
],
|
|
273176
|
+
default: defaultMiddleware
|
|
273177
|
+
});
|
|
273178
|
+
}
|
|
273075
273179
|
});
|
|
273076
|
-
return middleware;
|
|
273077
273180
|
}
|
|
273078
273181
|
|
|
273079
273182
|
// src/commands/connect/services.spinner.ts
|
|
@@ -273116,43 +273219,47 @@ async function servicesSpinner(settlemint, application) {
|
|
|
273116
273219
|
}
|
|
273117
273220
|
|
|
273118
273221
|
// src/commands/connect/thegraph.prompt.ts
|
|
273119
|
-
async function theGraphPrompt(env2, middlewares, accept) {
|
|
273120
|
-
const
|
|
273121
|
-
|
|
273122
|
-
|
|
273123
|
-
|
|
273124
|
-
|
|
273125
|
-
|
|
273126
|
-
|
|
273127
|
-
|
|
273128
|
-
|
|
273129
|
-
|
|
273130
|
-
|
|
273131
|
-
|
|
273132
|
-
|
|
273133
|
-
|
|
273134
|
-
|
|
273135
|
-
|
|
273136
|
-
|
|
273137
|
-
|
|
273138
|
-
|
|
273139
|
-
|
|
273140
|
-
|
|
273141
|
-
|
|
273222
|
+
async function theGraphPrompt(env2, middlewares, accept, filterRunningOnly = false) {
|
|
273223
|
+
const graphMiddlewares = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
|
|
273224
|
+
const choices = filterRunningOnly ? graphMiddlewares.filter((middleware) => middleware.status === "COMPLETED") : graphMiddlewares;
|
|
273225
|
+
return servicePrompt({
|
|
273226
|
+
env: env2,
|
|
273227
|
+
services: graphMiddlewares,
|
|
273228
|
+
accept,
|
|
273229
|
+
envKey: "SETTLEMINT_THEGRAPH",
|
|
273230
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273231
|
+
return esm_default2({
|
|
273232
|
+
message: "Which The Graph instance do you want to connect to?",
|
|
273233
|
+
choices: [
|
|
273234
|
+
...choices.map((middleware) => ({
|
|
273235
|
+
name: middleware.name,
|
|
273236
|
+
value: middleware
|
|
273237
|
+
})),
|
|
273238
|
+
{
|
|
273239
|
+
name: "None",
|
|
273240
|
+
value: undefined
|
|
273241
|
+
}
|
|
273242
|
+
],
|
|
273243
|
+
default: defaultMiddleware
|
|
273244
|
+
});
|
|
273245
|
+
}
|
|
273142
273246
|
});
|
|
273143
|
-
return middleware;
|
|
273144
273247
|
}
|
|
273145
273248
|
|
|
273146
273249
|
// src/commands/connect/workspace.prompt.ts
|
|
273147
273250
|
async function workspacePrompt(env2, workspaces, accept) {
|
|
273251
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
273148
273252
|
const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
|
|
273149
|
-
const defaultPossible =
|
|
273253
|
+
const defaultPossible = autoAccept && defaultWorkspace;
|
|
273150
273254
|
if (defaultPossible) {
|
|
273151
273255
|
return defaultWorkspace;
|
|
273152
273256
|
}
|
|
273153
273257
|
if (workspaces.length === 0) {
|
|
273154
273258
|
cancel2("No workspaces found");
|
|
273155
273259
|
}
|
|
273260
|
+
if (is_in_ci_default) {
|
|
273261
|
+
nothingSelectedError("workspace");
|
|
273262
|
+
}
|
|
273156
273263
|
const workspace = await esm_default2({
|
|
273157
273264
|
message: "Which workspace do you want to connect to?",
|
|
273158
273265
|
choices: workspaces.map((workspace2) => ({
|
|
@@ -273171,9 +273278,8 @@ async function workspacePrompt(env2, workspaces, accept) {
|
|
|
273171
273278
|
function connectCommand() {
|
|
273172
273279
|
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 }) => {
|
|
273173
273280
|
intro("Connecting your dApp to SettleMint");
|
|
273174
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
273175
273281
|
const env2 = await loadEnv2(false, !!prod);
|
|
273176
|
-
const instance = await instancePrompt(env2,
|
|
273282
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
273177
273283
|
const personalAccessToken = await getInstanceCredentials(instance);
|
|
273178
273284
|
if (!personalAccessToken) {
|
|
273179
273285
|
return missingPersonalAccessTokenError();
|
|
@@ -273184,20 +273290,20 @@ function connectCommand() {
|
|
|
273184
273290
|
instance
|
|
273185
273291
|
});
|
|
273186
273292
|
const workspaces = await workspaceSpinner(settlemint);
|
|
273187
|
-
const workspace = await workspacePrompt(env2, workspaces,
|
|
273188
|
-
const application = await applicationPrompt(env2, workspace?.applications ?? [],
|
|
273189
|
-
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint,
|
|
273293
|
+
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
273294
|
+
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
|
273295
|
+
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
|
273190
273296
|
const { middleware, integrationTool, storage, privateKey, insights, customDeployment, blockchainNodes } = await servicesSpinner(settlemint, application);
|
|
273191
|
-
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes,
|
|
273192
|
-
const hasura = await hasuraPrompt(env2, integrationTool,
|
|
273193
|
-
const thegraph = await theGraphPrompt(env2, middleware,
|
|
273194
|
-
const portal = await portalPrompt(env2, middleware,
|
|
273195
|
-
const ipfs = await ipfsPrompt(env2, storage,
|
|
273196
|
-
const minio = await minioPrompt(env2, storage,
|
|
273197
|
-
const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey,
|
|
273198
|
-
const cDeployment = await customDeploymentPrompt(env2, customDeployment,
|
|
273199
|
-
const blockscout = await blockscoutPrompt(env2, insights,
|
|
273200
|
-
if (
|
|
273297
|
+
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
273298
|
+
const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
|
|
273299
|
+
const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
|
|
273300
|
+
const portal = await portalPrompt(env2, middleware, acceptDefaults);
|
|
273301
|
+
const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
|
|
273302
|
+
const minio = await minioPrompt(env2, storage, acceptDefaults);
|
|
273303
|
+
const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
|
|
273304
|
+
const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
|
|
273305
|
+
const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
|
|
273306
|
+
if (acceptDefaults) {
|
|
273201
273307
|
const selectedServices = [
|
|
273202
273308
|
`Workspace: ${workspace.name}`,
|
|
273203
273309
|
`Application: ${application.name}`,
|
|
@@ -273301,9 +273407,12 @@ import { dirname as dirname6 } from "node:path";
|
|
|
273301
273407
|
import { stat as stat8 } from "node:fs/promises";
|
|
273302
273408
|
var import_package_json3 = __toESM(require_lib12(), 1);
|
|
273303
273409
|
var import_package_json4 = __toESM(require_lib12(), 1);
|
|
273304
|
-
async function projectRoot3() {
|
|
273410
|
+
async function projectRoot3(fallbackToCwd = false) {
|
|
273305
273411
|
const packageJsonPath = await findUp("package.json");
|
|
273306
273412
|
if (!packageJsonPath) {
|
|
273413
|
+
if (fallbackToCwd) {
|
|
273414
|
+
return process.cwd();
|
|
273415
|
+
}
|
|
273307
273416
|
throw new Error("Unable to find project root (no package.json found)");
|
|
273308
273417
|
}
|
|
273309
273418
|
return dirname6(packageJsonPath);
|
|
@@ -274064,7 +274173,7 @@ function createCommand2() {
|
|
|
274064
274173
|
}
|
|
274065
274174
|
const selectedTemplate = await templatePrompt(templates, template);
|
|
274066
274175
|
if (!selectedTemplate) {
|
|
274067
|
-
|
|
274176
|
+
return nothingSelectedError("template");
|
|
274068
274177
|
}
|
|
274069
274178
|
await spinner({
|
|
274070
274179
|
startMessage: "Scaffolding the project",
|
|
@@ -274212,7 +274321,7 @@ function logoutCommand() {
|
|
|
274212
274321
|
|
|
274213
274322
|
// src/commands/platform/common/cluster-service.args.ts
|
|
274214
274323
|
function addClusterServiceArgs(cmd2) {
|
|
274215
|
-
return cmd2.requiredOption("--provider <provider>", "Network provider").requiredOption("--region <region>", "Deployment region").addOption(new Option("--size <size>", "Network size").choices(["CUSTOM", "LARGE", "MEDIUM", "SMALL"]).argParser((value4) => value4).default("SMALL")).addOption(new Option("--type <type>", "Network type").choices(["DEDICATED", "SHARED"]).argParser((value4) => value4).default("SHARED"));
|
|
274324
|
+
return cmd2.requiredOption("--provider <provider>", "Network provider (run `settlemint platform config` to see available providers)").requiredOption("--region <region>", "Deployment region (run `settlemint platform config` to see available regions)").addOption(new Option("--size <size>", "Network size").choices(["CUSTOM", "LARGE", "MEDIUM", "SMALL"]).argParser((value4) => value4).default("SMALL")).addOption(new Option("--type <type>", "Network type").choices(["DEDICATED", "SHARED"]).argParser((value4) => value4).default("SHARED"));
|
|
274216
274325
|
}
|
|
274217
274326
|
|
|
274218
274327
|
// src/utils/parse-number.ts
|
|
@@ -274245,7 +274354,7 @@ async function waitForCompletion({
|
|
|
274245
274354
|
restartIfTimeout = false
|
|
274246
274355
|
}) {
|
|
274247
274356
|
const serviceType = SETTLEMINT_CLIENT_MAP[type4];
|
|
274248
|
-
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken") {
|
|
274357
|
+
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform") {
|
|
274249
274358
|
return true;
|
|
274250
274359
|
}
|
|
274251
274360
|
const service = settlemint[serviceType];
|
|
@@ -274307,6 +274416,63 @@ function sanitizeCommandName(name2) {
|
|
|
274307
274416
|
return name2.split(" ").join("-").toLowerCase();
|
|
274308
274417
|
}
|
|
274309
274418
|
|
|
274419
|
+
// src/commands/platform/prompts/provider.prompt.ts
|
|
274420
|
+
async function providerPrompt(platformConfig, argument) {
|
|
274421
|
+
const possibleProviders = platformConfig.deploymentEngineTargets.filter((target) => !target.disabled);
|
|
274422
|
+
if (possibleProviders.length === 0) {
|
|
274423
|
+
cancel2("No providers found");
|
|
274424
|
+
}
|
|
274425
|
+
if (argument) {
|
|
274426
|
+
const selectedProvider = possibleProviders.find((target) => target.id === argument);
|
|
274427
|
+
if (!selectedProvider) {
|
|
274428
|
+
cancel2(`No provider found with id '${argument}'. Possible providers: '${possibleProviders.map((target) => target.id).sort().join(", ")}'`);
|
|
274429
|
+
}
|
|
274430
|
+
return selectedProvider;
|
|
274431
|
+
}
|
|
274432
|
+
if (possibleProviders.length === 1) {
|
|
274433
|
+
return possibleProviders[0];
|
|
274434
|
+
}
|
|
274435
|
+
const provider = await esm_default2({
|
|
274436
|
+
message: "Which provider do you want to use?",
|
|
274437
|
+
choices: platformConfig.deploymentEngineTargets.map((target) => ({
|
|
274438
|
+
name: target.name,
|
|
274439
|
+
value: target.id
|
|
274440
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
274441
|
+
});
|
|
274442
|
+
return platformConfig.deploymentEngineTargets.find((target) => target.id === provider);
|
|
274443
|
+
}
|
|
274444
|
+
|
|
274445
|
+
// src/commands/platform/utils/cluster-region.ts
|
|
274446
|
+
function getRegionId(regionId) {
|
|
274447
|
+
return regionId.split("-")[1];
|
|
274448
|
+
}
|
|
274449
|
+
|
|
274450
|
+
// src/commands/platform/prompts/region.prompt.ts
|
|
274451
|
+
async function regionPrompt(provider, argument) {
|
|
274452
|
+
const possibleRegions = provider.clusters.filter((cluster) => !cluster.disabled).map((cluster) => ({ ...cluster, id: getRegionId(cluster.id) }));
|
|
274453
|
+
if (possibleRegions.length === 0) {
|
|
274454
|
+
cancel2("No regions found");
|
|
274455
|
+
}
|
|
274456
|
+
if (argument) {
|
|
274457
|
+
const selectedRegion = possibleRegions.find((cluster) => cluster.id === argument);
|
|
274458
|
+
if (!selectedRegion) {
|
|
274459
|
+
cancel2(`No region found with id '${argument}'. Possible regions: '${possibleRegions.map((cluster) => cluster.id).sort().join(", ")}'`);
|
|
274460
|
+
}
|
|
274461
|
+
return selectedRegion;
|
|
274462
|
+
}
|
|
274463
|
+
if (possibleRegions.length === 1) {
|
|
274464
|
+
return possibleRegions[0];
|
|
274465
|
+
}
|
|
274466
|
+
const region = await esm_default2({
|
|
274467
|
+
message: "Which region do you want to use?",
|
|
274468
|
+
choices: provider.clusters.map((cluster) => ({
|
|
274469
|
+
name: cluster.name,
|
|
274470
|
+
value: cluster.id
|
|
274471
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
274472
|
+
});
|
|
274473
|
+
return provider.clusters.find((cluster) => cluster.id === region);
|
|
274474
|
+
}
|
|
274475
|
+
|
|
274310
274476
|
// src/commands/platform/common/create-command.ts
|
|
274311
274477
|
function getCreateCommand({
|
|
274312
274478
|
name: name2,
|
|
@@ -274321,7 +274487,7 @@ function getCreateCommand({
|
|
|
274321
274487
|
if (requiresDeployment) {
|
|
274322
274488
|
cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
|
|
274323
274489
|
}
|
|
274324
|
-
execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout }, createFunction) => {
|
|
274490
|
+
execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
|
|
274325
274491
|
intro(`Creating ${type4} in the SettleMint platform`);
|
|
274326
274492
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
274327
274493
|
const env2 = await loadEnv2(false, !!prod);
|
|
@@ -274335,6 +274501,17 @@ function getCreateCommand({
|
|
|
274335
274501
|
accessToken,
|
|
274336
274502
|
instance
|
|
274337
274503
|
});
|
|
274504
|
+
const platformConfig = await settlemint.platform.config();
|
|
274505
|
+
if (requiresDeployment) {
|
|
274506
|
+
const selectedProvider = await providerPrompt(platformConfig, provider);
|
|
274507
|
+
if (!selectedProvider) {
|
|
274508
|
+
return nothingSelectedError("provider");
|
|
274509
|
+
}
|
|
274510
|
+
const selectedRegion = await regionPrompt(selectedProvider, region);
|
|
274511
|
+
if (!selectedRegion) {
|
|
274512
|
+
return nothingSelectedError("region");
|
|
274513
|
+
}
|
|
274514
|
+
}
|
|
274338
274515
|
const { result, waitFor, mapDefaultEnv } = await spinner({
|
|
274339
274516
|
startMessage: `Creating ${type4}`,
|
|
274340
274517
|
task: async () => {
|
|
@@ -274402,8 +274579,15 @@ function blockchainNetworkBesuCreateCommand() {
|
|
|
274402
274579
|
type: type4,
|
|
274403
274580
|
...defaultArgs
|
|
274404
274581
|
}) => {
|
|
274405
|
-
return baseAction(
|
|
274582
|
+
return baseAction({
|
|
274583
|
+
...defaultArgs,
|
|
274584
|
+
provider,
|
|
274585
|
+
region
|
|
274586
|
+
}, async (settlemint, env2) => {
|
|
274406
274587
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274588
|
+
if (!applicationUniqueName) {
|
|
274589
|
+
return missingApplication();
|
|
274590
|
+
}
|
|
274407
274591
|
const result = await settlemint.blockchainNetwork.create({
|
|
274408
274592
|
name: name2,
|
|
274409
274593
|
applicationUniqueName,
|
|
@@ -274611,6 +274795,9 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274611
274795
|
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 }) => {
|
|
274612
274796
|
return baseAction(defaultArgs, async (settlemint, env2) => {
|
|
274613
274797
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274798
|
+
if (!applicationUniqueName) {
|
|
274799
|
+
return missingApplication();
|
|
274800
|
+
}
|
|
274614
274801
|
const aatToken = await settlemint.applicationAccessToken.create({
|
|
274615
274802
|
applicationUniqueName,
|
|
274616
274803
|
name: name2,
|
|
@@ -274663,6 +274850,7 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274663
274850
|
uniqueName: ""
|
|
274664
274851
|
},
|
|
274665
274852
|
mapDefaultEnv: () => ({
|
|
274853
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274666
274854
|
SETTLEMINT_ACCESS_TOKEN: aatToken
|
|
274667
274855
|
})
|
|
274668
274856
|
};
|
|
@@ -274694,11 +274882,23 @@ function applicationCreateCommand() {
|
|
|
274694
274882
|
type: "application",
|
|
274695
274883
|
alias: "a",
|
|
274696
274884
|
execute: (cmd2, baseAction) => {
|
|
274697
|
-
cmd2.option("-w, --workspace <workspace>", "The workspace unique name to create the application in (defaults to workspace from env)").action(async (name2, { workspace, ...defaultArgs }) => {
|
|
274698
|
-
return baseAction(
|
|
274885
|
+
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 }) => {
|
|
274886
|
+
return baseAction({
|
|
274887
|
+
...defaultArgs,
|
|
274888
|
+
acceptDefaults
|
|
274889
|
+
}, async (settlemint, env2) => {
|
|
274890
|
+
let workspaceUniqueName = workspace;
|
|
274891
|
+
if (!workspaceUniqueName) {
|
|
274892
|
+
const workspaces = await settlemint.workspace.list();
|
|
274893
|
+
const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
274894
|
+
if (!workspace2) {
|
|
274895
|
+
return nothingSelectedError("workspace");
|
|
274896
|
+
}
|
|
274897
|
+
workspaceUniqueName = workspace2.uniqueName;
|
|
274898
|
+
}
|
|
274699
274899
|
const result = await settlemint.application.create({
|
|
274700
274900
|
name: name2,
|
|
274701
|
-
workspaceUniqueName
|
|
274901
|
+
workspaceUniqueName
|
|
274702
274902
|
});
|
|
274703
274903
|
return {
|
|
274704
274904
|
result,
|
|
@@ -274731,27 +274931,27 @@ function applicationCreateCommand() {
|
|
|
274731
274931
|
|
|
274732
274932
|
// src/commands/connect/blockchain-network.prompt.ts
|
|
274733
274933
|
async function blockchainNetworkPrompt(env2, networks, accept) {
|
|
274734
|
-
|
|
274735
|
-
|
|
274736
|
-
|
|
274737
|
-
|
|
274738
|
-
|
|
274739
|
-
|
|
274740
|
-
|
|
274741
|
-
|
|
274742
|
-
|
|
274743
|
-
|
|
274744
|
-
|
|
274745
|
-
|
|
274746
|
-
|
|
274747
|
-
|
|
274748
|
-
|
|
274749
|
-
|
|
274750
|
-
|
|
274751
|
-
|
|
274752
|
-
|
|
274753
|
-
|
|
274754
|
-
|
|
274934
|
+
return servicePrompt({
|
|
274935
|
+
env: env2,
|
|
274936
|
+
services: networks,
|
|
274937
|
+
accept,
|
|
274938
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
|
|
274939
|
+
defaultHandler: async ({ defaultService: defaultNetwork }) => {
|
|
274940
|
+
return esm_default2({
|
|
274941
|
+
message: "Which blockchain network do you want to connect to?",
|
|
274942
|
+
choices: [
|
|
274943
|
+
...networks.map((network) => ({
|
|
274944
|
+
name: network.name,
|
|
274945
|
+
value: network
|
|
274946
|
+
})),
|
|
274947
|
+
{
|
|
274948
|
+
name: "None",
|
|
274949
|
+
value: undefined
|
|
274950
|
+
}
|
|
274951
|
+
],
|
|
274952
|
+
default: defaultNetwork
|
|
274953
|
+
});
|
|
274954
|
+
}
|
|
274755
274955
|
});
|
|
274756
274956
|
}
|
|
274757
274957
|
|
|
@@ -274774,20 +274974,24 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274774
274974
|
acceptDefaults,
|
|
274775
274975
|
...defaultArgs
|
|
274776
274976
|
}) => {
|
|
274777
|
-
return baseAction(
|
|
274778
|
-
|
|
274977
|
+
return baseAction({
|
|
274978
|
+
...defaultArgs,
|
|
274979
|
+
acceptDefaults,
|
|
274980
|
+
provider,
|
|
274981
|
+
region
|
|
274982
|
+
}, async (settlemint, env2) => {
|
|
274779
274983
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274780
274984
|
if (!applicationUniqueName) {
|
|
274781
|
-
|
|
274985
|
+
return missingApplication();
|
|
274782
274986
|
}
|
|
274783
|
-
let networkUniqueName = blockchainNetwork
|
|
274987
|
+
let networkUniqueName = blockchainNetwork;
|
|
274784
274988
|
if (!networkUniqueName) {
|
|
274785
274989
|
const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
|
|
274786
|
-
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults
|
|
274990
|
+
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
|
|
274787
274991
|
if (!network) {
|
|
274788
|
-
|
|
274992
|
+
return nothingSelectedError("blockchain network");
|
|
274789
274993
|
}
|
|
274790
|
-
networkUniqueName = network?.
|
|
274994
|
+
networkUniqueName = network?.uniqueName;
|
|
274791
274995
|
}
|
|
274792
274996
|
const result = await settlemint.blockchainNode.create({
|
|
274793
274997
|
applicationUniqueName,
|
|
@@ -274805,7 +275009,7 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274805
275009
|
mapDefaultEnv: () => {
|
|
274806
275010
|
return {
|
|
274807
275011
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274808
|
-
SETTLEMINT_BLOCKCHAIN_NODE: result.
|
|
275012
|
+
SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
|
|
274809
275013
|
};
|
|
274810
275014
|
}
|
|
274811
275015
|
};
|
|
@@ -274841,11 +275045,27 @@ function blockscoutInsightsCreateCommand() {
|
|
|
274841
275045
|
type: "insights",
|
|
274842
275046
|
alias: "bs",
|
|
274843
275047
|
execute: (cmd2, baseAction) => {
|
|
274844
|
-
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 }) => {
|
|
274845
|
-
return baseAction(
|
|
275048
|
+
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 }) => {
|
|
275049
|
+
return baseAction({
|
|
275050
|
+
...defaultArgs,
|
|
275051
|
+
acceptDefaults,
|
|
275052
|
+
provider,
|
|
275053
|
+
region
|
|
275054
|
+
}, async (settlemint, env2) => {
|
|
274846
275055
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274847
|
-
|
|
275056
|
+
if (!applicationUniqueName) {
|
|
275057
|
+
return missingApplication();
|
|
275058
|
+
}
|
|
275059
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
274848
275060
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275061
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275062
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275063
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275064
|
+
if (!node) {
|
|
275065
|
+
return nothingSelectedError("blockchain node");
|
|
275066
|
+
}
|
|
275067
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275068
|
+
}
|
|
274849
275069
|
const result = await settlemint.insights.create({
|
|
274850
275070
|
name: name2,
|
|
274851
275071
|
applicationUniqueName,
|
|
@@ -274898,8 +275118,15 @@ function hasuraIntegrationCreateCommand() {
|
|
|
274898
275118
|
alias: "ha",
|
|
274899
275119
|
execute: (cmd2, baseAction) => {
|
|
274900
275120
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
274901
|
-
return baseAction(
|
|
275121
|
+
return baseAction({
|
|
275122
|
+
...defaultArgs,
|
|
275123
|
+
provider,
|
|
275124
|
+
region
|
|
275125
|
+
}, async (settlemint, env2) => {
|
|
274902
275126
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275127
|
+
if (!applicationUniqueName) {
|
|
275128
|
+
return missingApplication();
|
|
275129
|
+
}
|
|
274903
275130
|
const result = await settlemint.integrationTool.create({
|
|
274904
275131
|
name: name2,
|
|
274905
275132
|
applicationUniqueName,
|
|
@@ -274949,10 +275176,26 @@ function graphMiddlewareCreateCommand() {
|
|
|
274949
275176
|
type: "middleware",
|
|
274950
275177
|
alias: "gr",
|
|
274951
275178
|
execute: (cmd2, baseAction) => {
|
|
274952
|
-
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 }) => {
|
|
274953
|
-
return baseAction(
|
|
275179
|
+
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 }) => {
|
|
275180
|
+
return baseAction({
|
|
275181
|
+
...defaultArgs,
|
|
275182
|
+
acceptDefaults,
|
|
275183
|
+
provider,
|
|
275184
|
+
region
|
|
275185
|
+
}, async (settlemint, env2) => {
|
|
274954
275186
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274955
|
-
|
|
275187
|
+
if (!applicationUniqueName) {
|
|
275188
|
+
return missingApplication();
|
|
275189
|
+
}
|
|
275190
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275191
|
+
if (!blockchainNodeUniqueName) {
|
|
275192
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275193
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275194
|
+
if (!node) {
|
|
275195
|
+
return nothingSelectedError("blockchain node");
|
|
275196
|
+
}
|
|
275197
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275198
|
+
}
|
|
274956
275199
|
const result = await settlemint.middleware.create({
|
|
274957
275200
|
name: name2,
|
|
274958
275201
|
applicationUniqueName,
|
|
@@ -274998,16 +275241,7 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
274998
275241
|
type: "middleware",
|
|
274999
275242
|
alias: "scp",
|
|
275000
275243
|
execute: (cmd2, baseAction) => {
|
|
275001
|
-
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)").option("--abis <abis...>", "Path to abi file(s)").
|
|
275002
|
-
"Bond",
|
|
275003
|
-
"BondFactory",
|
|
275004
|
-
"CryptoCurrency",
|
|
275005
|
-
"CryptoCurrencyFactory",
|
|
275006
|
-
"Equity",
|
|
275007
|
-
"EquityFactory",
|
|
275008
|
-
"StableCoin",
|
|
275009
|
-
"StableCoinFactory"
|
|
275010
|
-
])).action(async (name2, {
|
|
275244
|
+
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)").option("--abis <abis...>", "Path to abi file(s)").option("--include-predeployed-abis <includePredeployedAbis...>", "Include pre-deployed abis (run `settlemint platform config` to see available pre-deployed abis)").action(async (name2, {
|
|
275011
275245
|
application,
|
|
275012
275246
|
blockchainNode,
|
|
275013
275247
|
loadBalancer,
|
|
@@ -275017,12 +275251,29 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
275017
275251
|
type: type4,
|
|
275018
275252
|
includePredeployedAbis,
|
|
275019
275253
|
abis,
|
|
275254
|
+
acceptDefaults,
|
|
275020
275255
|
...defaultArgs
|
|
275021
275256
|
}) => {
|
|
275022
|
-
return baseAction(
|
|
275257
|
+
return baseAction({
|
|
275258
|
+
...defaultArgs,
|
|
275259
|
+
acceptDefaults,
|
|
275260
|
+
provider,
|
|
275261
|
+
region
|
|
275262
|
+
}, async (settlemint, env2) => {
|
|
275023
275263
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275024
|
-
|
|
275264
|
+
if (!applicationUniqueName) {
|
|
275265
|
+
return missingApplication();
|
|
275266
|
+
}
|
|
275267
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
275025
275268
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275269
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275270
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275271
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275272
|
+
if (!node) {
|
|
275273
|
+
return nothingSelectedError("blockchain node");
|
|
275274
|
+
}
|
|
275275
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275276
|
+
}
|
|
275026
275277
|
const parsedAbis = [];
|
|
275027
275278
|
if (abis && abis.length > 0) {
|
|
275028
275279
|
try {
|
|
@@ -275037,6 +275288,13 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
275037
275288
|
cancel2(`Failed to read or parse ABI file: ${error5.message}`);
|
|
275038
275289
|
}
|
|
275039
275290
|
}
|
|
275291
|
+
if (includePredeployedAbis && includePredeployedAbis.length > 0) {
|
|
275292
|
+
const platformConfig = await settlemint.platform.config();
|
|
275293
|
+
const invalidPredeployedAbis = includePredeployedAbis.filter((abi) => !platformConfig.preDeployedContracts.some((contract) => contract === abi));
|
|
275294
|
+
if (invalidPredeployedAbis.length > 0) {
|
|
275295
|
+
cancel2(`Invalid pre-deployed abis: '${invalidPredeployedAbis.join(", ")}'. Possible values: '${platformConfig.preDeployedContracts.sort().join(", ")}'`);
|
|
275296
|
+
}
|
|
275297
|
+
}
|
|
275040
275298
|
const result = await settlemint.middleware.create({
|
|
275041
275299
|
name: name2,
|
|
275042
275300
|
applicationUniqueName,
|
|
@@ -275088,10 +275346,26 @@ function privateKeyHdCreateCommand() {
|
|
|
275088
275346
|
type: "private key",
|
|
275089
275347
|
alias: "hd",
|
|
275090
275348
|
execute: (cmd2, baseAction) => {
|
|
275091
|
-
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 }) => {
|
|
275092
|
-
return baseAction(
|
|
275349
|
+
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 }) => {
|
|
275350
|
+
return baseAction({
|
|
275351
|
+
...defaultArgs,
|
|
275352
|
+
acceptDefaults,
|
|
275353
|
+
provider,
|
|
275354
|
+
region
|
|
275355
|
+
}, async (settlemint, env2) => {
|
|
275093
275356
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275094
|
-
|
|
275357
|
+
if (!applicationUniqueName) {
|
|
275358
|
+
return missingApplication();
|
|
275359
|
+
}
|
|
275360
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275361
|
+
if (!blockchainNodeUniqueName) {
|
|
275362
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275363
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275364
|
+
if (!node) {
|
|
275365
|
+
return nothingSelectedError("blockchain node");
|
|
275366
|
+
}
|
|
275367
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275368
|
+
}
|
|
275095
275369
|
const result = await settlemint.privateKey.create({
|
|
275096
275370
|
name: name2,
|
|
275097
275371
|
applicationUniqueName,
|
|
@@ -275138,10 +275412,26 @@ function privateKeyHsmCreateCommand() {
|
|
|
275138
275412
|
type: "private key",
|
|
275139
275413
|
alias: "hd",
|
|
275140
275414
|
execute: (cmd2, baseAction) => {
|
|
275141
|
-
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 }) => {
|
|
275142
|
-
return baseAction(
|
|
275415
|
+
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 }) => {
|
|
275416
|
+
return baseAction({
|
|
275417
|
+
...defaultArgs,
|
|
275418
|
+
acceptDefaults,
|
|
275419
|
+
provider,
|
|
275420
|
+
region
|
|
275421
|
+
}, async (settlemint, env2) => {
|
|
275143
275422
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275144
|
-
|
|
275423
|
+
if (!applicationUniqueName) {
|
|
275424
|
+
return missingApplication();
|
|
275425
|
+
}
|
|
275426
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275427
|
+
if (!blockchainNodeUniqueName) {
|
|
275428
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275429
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275430
|
+
if (!node) {
|
|
275431
|
+
return nothingSelectedError("blockchain node");
|
|
275432
|
+
}
|
|
275433
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275434
|
+
}
|
|
275145
275435
|
const result = await settlemint.privateKey.create({
|
|
275146
275436
|
name: name2,
|
|
275147
275437
|
applicationUniqueName,
|
|
@@ -275188,8 +275478,15 @@ function ipfsStorageCreateCommand() {
|
|
|
275188
275478
|
alias: "ip",
|
|
275189
275479
|
execute: (cmd2, baseAction) => {
|
|
275190
275480
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275191
|
-
return baseAction(
|
|
275481
|
+
return baseAction({
|
|
275482
|
+
...defaultArgs,
|
|
275483
|
+
provider,
|
|
275484
|
+
region
|
|
275485
|
+
}, async (settlemint, env2) => {
|
|
275192
275486
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275487
|
+
if (!applicationUniqueName) {
|
|
275488
|
+
return missingApplication();
|
|
275489
|
+
}
|
|
275193
275490
|
const result = await settlemint.storage.create({
|
|
275194
275491
|
name: name2,
|
|
275195
275492
|
applicationUniqueName,
|
|
@@ -275233,8 +275530,15 @@ function minioStorageCreateCommand() {
|
|
|
275233
275530
|
alias: "m",
|
|
275234
275531
|
execute: (cmd2, baseAction) => {
|
|
275235
275532
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275236
|
-
return baseAction(
|
|
275533
|
+
return baseAction({
|
|
275534
|
+
...defaultArgs,
|
|
275535
|
+
provider,
|
|
275536
|
+
region
|
|
275537
|
+
}, async (settlemint, env2) => {
|
|
275237
275538
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275539
|
+
if (!applicationUniqueName) {
|
|
275540
|
+
return missingApplication();
|
|
275541
|
+
}
|
|
275238
275542
|
const result = await settlemint.storage.create({
|
|
275239
275543
|
name: name2,
|
|
275240
275544
|
applicationUniqueName,
|
|
@@ -275328,9 +275632,8 @@ function getDeleteCommand({
|
|
|
275328
275632
|
if (!force) {
|
|
275329
275633
|
await deleteConfirmationPrompt(`this ${type4}`);
|
|
275330
275634
|
}
|
|
275331
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275332
275635
|
const env2 = await loadEnv2(false, !!prod);
|
|
275333
|
-
const instance = await instancePrompt(env2,
|
|
275636
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275334
275637
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275335
275638
|
env: env2,
|
|
275336
275639
|
instance,
|
|
@@ -275423,9 +275726,8 @@ function getRestartCommand({
|
|
|
275423
275726
|
}
|
|
275424
275727
|
])).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 }) => {
|
|
275425
275728
|
intro(`Restarting ${type4} in the SettleMint platform`);
|
|
275426
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275427
275729
|
const env2 = await loadEnv2(false, !!prod);
|
|
275428
|
-
const instance = await instancePrompt(env2,
|
|
275730
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275429
275731
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275430
275732
|
env: env2,
|
|
275431
275733
|
instance,
|
|
@@ -275651,211 +275953,96 @@ function updateCommand() {
|
|
|
275651
275953
|
return new Command("update").alias("u").description("Update a resource in the SettleMint platform").addCommand(customDeploymentsUpdateCommand());
|
|
275652
275954
|
}
|
|
275653
275955
|
|
|
275956
|
+
// src/commands/platform/config.ts
|
|
275957
|
+
function configCommand() {
|
|
275958
|
+
return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").action(async ({ prod }) => {
|
|
275959
|
+
intro("Getting platform configuration");
|
|
275960
|
+
const env2 = await loadEnv2(false, !!prod);
|
|
275961
|
+
const instance = await instancePrompt(env2, true);
|
|
275962
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275963
|
+
env: env2,
|
|
275964
|
+
instance,
|
|
275965
|
+
prefer: "personal"
|
|
275966
|
+
});
|
|
275967
|
+
const settlemint = createSettleMintClient({
|
|
275968
|
+
accessToken,
|
|
275969
|
+
instance
|
|
275970
|
+
});
|
|
275971
|
+
const platformConfig = await settlemint.platform.config();
|
|
275972
|
+
note2(`Providers and regions:
|
|
275973
|
+
${platformConfig.deploymentEngineTargets.filter((provider) => !provider.disabled).map((provider) => `• ${provider.id}
|
|
275974
|
+
${provider.clusters.filter((cluster) => !cluster.disabled).map((region) => `• ${getRegionId(region.id)}`).sort().join(`
|
|
275975
|
+
`)}`).sort().join(`
|
|
275976
|
+
`)}`);
|
|
275977
|
+
note2(`Use cases (Smart Contract Sets):
|
|
275978
|
+
• ${platformConfig.smartContractSets.sets.filter((useCase) => !useCase.featureflagged).map((useCase) => useCase.id).sort().join(`
|
|
275979
|
+
• `)}`);
|
|
275980
|
+
note2(`Pre-deployed abis (Smart Contract Portal):
|
|
275981
|
+
• ${platformConfig.preDeployedContracts.sort().join(`
|
|
275982
|
+
• `)}`);
|
|
275983
|
+
outro("Platform configuration retrieved");
|
|
275984
|
+
});
|
|
275985
|
+
}
|
|
275986
|
+
|
|
275654
275987
|
// src/commands/platform.ts
|
|
275655
275988
|
function platformCommand() {
|
|
275656
|
-
return new Command("platform").description("Manage SettleMint platform resources").addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand());
|
|
275989
|
+
return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand());
|
|
275657
275990
|
}
|
|
275658
275991
|
|
|
275659
275992
|
// src/commands/smart-contract-set/create.ts
|
|
275660
275993
|
import { rmdir } from "node:fs/promises";
|
|
275661
275994
|
import { join as join8 } from "node:path";
|
|
275662
275995
|
|
|
275663
|
-
// src/constants/smart-contract-sets.ts
|
|
275664
|
-
var SMART_CONTRACT_SET_DETAILS = [
|
|
275665
|
-
{
|
|
275666
|
-
id: "solidity-empty",
|
|
275667
|
-
name: "Empty",
|
|
275668
|
-
image: {
|
|
275669
|
-
registry: "ghcr.io",
|
|
275670
|
-
repository: "settlemint/solidity-empty",
|
|
275671
|
-
tag: "7.7.7"
|
|
275672
|
-
}
|
|
275673
|
-
},
|
|
275674
|
-
{
|
|
275675
|
-
id: "solidity-token-erc20",
|
|
275676
|
-
name: "ERC20 token",
|
|
275677
|
-
image: {
|
|
275678
|
-
registry: "ghcr.io",
|
|
275679
|
-
repository: "settlemint/solidity-token-erc20",
|
|
275680
|
-
tag: "7.7.7"
|
|
275681
|
-
}
|
|
275682
|
-
},
|
|
275683
|
-
{
|
|
275684
|
-
id: "solidity-token-erc1155",
|
|
275685
|
-
name: "ERC1155 token",
|
|
275686
|
-
image: {
|
|
275687
|
-
registry: "ghcr.io",
|
|
275688
|
-
repository: "settlemint/solidity-token-erc1155",
|
|
275689
|
-
tag: "7.7.7"
|
|
275690
|
-
}
|
|
275691
|
-
},
|
|
275692
|
-
{
|
|
275693
|
-
id: "solidity-token-erc20-metatx",
|
|
275694
|
-
name: "ERC20 token with MetaTx",
|
|
275695
|
-
image: {
|
|
275696
|
-
registry: "ghcr.io",
|
|
275697
|
-
repository: "settlemint/solidity-token-erc20-metatx",
|
|
275698
|
-
tag: "7.7.7"
|
|
275699
|
-
}
|
|
275700
|
-
},
|
|
275701
|
-
{
|
|
275702
|
-
id: "solidity-supplychain",
|
|
275703
|
-
name: "Supplychain",
|
|
275704
|
-
image: {
|
|
275705
|
-
registry: "ghcr.io",
|
|
275706
|
-
repository: "settlemint/solidity-supplychain",
|
|
275707
|
-
tag: "7.7.7"
|
|
275708
|
-
}
|
|
275709
|
-
},
|
|
275710
|
-
{
|
|
275711
|
-
id: "chaincode-ts-empty",
|
|
275712
|
-
name: "Empty typescript",
|
|
275713
|
-
image: {
|
|
275714
|
-
registry: "ghcr.io",
|
|
275715
|
-
repository: "settlemint/chaincode-typescript-empty",
|
|
275716
|
-
tag: "7.0.13"
|
|
275717
|
-
}
|
|
275718
|
-
},
|
|
275719
|
-
{
|
|
275720
|
-
id: "chaincode-ts-empty-pdc",
|
|
275721
|
-
name: "Empty typescript with PDC",
|
|
275722
|
-
image: {
|
|
275723
|
-
registry: "ghcr.io",
|
|
275724
|
-
repository: "settlemint/chaincode-typescript-empty-pdc",
|
|
275725
|
-
tag: "7.0.1"
|
|
275726
|
-
}
|
|
275727
|
-
},
|
|
275728
|
-
{
|
|
275729
|
-
id: "chaincode-go-empty",
|
|
275730
|
-
name: "Empty go",
|
|
275731
|
-
image: {
|
|
275732
|
-
registry: "ghcr.io",
|
|
275733
|
-
repository: "settlemint/chaincode-go-empty",
|
|
275734
|
-
tag: "7.0.5"
|
|
275735
|
-
}
|
|
275736
|
-
},
|
|
275737
|
-
{
|
|
275738
|
-
id: "solidity-statemachine",
|
|
275739
|
-
name: "State Machine",
|
|
275740
|
-
image: {
|
|
275741
|
-
registry: "ghcr.io",
|
|
275742
|
-
repository: "settlemint/solidity-statemachine",
|
|
275743
|
-
tag: "7.7.7"
|
|
275744
|
-
}
|
|
275745
|
-
},
|
|
275746
|
-
{
|
|
275747
|
-
id: "solidity-token-erc20-crowdsale",
|
|
275748
|
-
name: "ERC20 token with crowdsale mechanism",
|
|
275749
|
-
image: {
|
|
275750
|
-
registry: "ghcr.io",
|
|
275751
|
-
repository: "settlemint/solidity-token-erc20-crowdsale",
|
|
275752
|
-
tag: "7.7.7"
|
|
275753
|
-
}
|
|
275754
|
-
},
|
|
275755
|
-
{
|
|
275756
|
-
id: "solidity-token-erc721",
|
|
275757
|
-
name: "ERC721",
|
|
275758
|
-
image: {
|
|
275759
|
-
registry: "ghcr.io",
|
|
275760
|
-
repository: "settlemint/solidity-token-erc721",
|
|
275761
|
-
tag: "7.7.7"
|
|
275762
|
-
}
|
|
275763
|
-
},
|
|
275764
|
-
{
|
|
275765
|
-
id: "solidity-token-erc721a",
|
|
275766
|
-
name: "ERC721a",
|
|
275767
|
-
image: {
|
|
275768
|
-
registry: "ghcr.io",
|
|
275769
|
-
repository: "settlemint/solidity-token-erc721a",
|
|
275770
|
-
tag: "7.7.7"
|
|
275771
|
-
}
|
|
275772
|
-
},
|
|
275773
|
-
{
|
|
275774
|
-
id: "solidity-token-erc721-generative-art",
|
|
275775
|
-
name: "ERC721 Generative Art",
|
|
275776
|
-
image: {
|
|
275777
|
-
registry: "ghcr.io",
|
|
275778
|
-
repository: "settlemint/solidity-token-erc721-generative-art",
|
|
275779
|
-
tag: "7.7.7"
|
|
275780
|
-
}
|
|
275781
|
-
},
|
|
275782
|
-
{
|
|
275783
|
-
id: "solidity-token-soulbound",
|
|
275784
|
-
name: "Soulbound Token",
|
|
275785
|
-
image: {
|
|
275786
|
-
registry: "ghcr.io",
|
|
275787
|
-
repository: "settlemint/solidity-token-soulbound",
|
|
275788
|
-
tag: "7.7.7"
|
|
275789
|
-
}
|
|
275790
|
-
},
|
|
275791
|
-
{
|
|
275792
|
-
id: "solidity-diamond-bond",
|
|
275793
|
-
name: "Diamond bond",
|
|
275794
|
-
image: {
|
|
275795
|
-
registry: "ghcr.io",
|
|
275796
|
-
repository: "settlemint/solidity-diamond-bond",
|
|
275797
|
-
tag: "7.7.7"
|
|
275798
|
-
}
|
|
275799
|
-
},
|
|
275800
|
-
{
|
|
275801
|
-
id: "solidity-attestation-service",
|
|
275802
|
-
name: "Attestation Service",
|
|
275803
|
-
image: {
|
|
275804
|
-
registry: "ghcr.io",
|
|
275805
|
-
repository: "settlemint/solidity-attestation-service",
|
|
275806
|
-
tag: "7.7.7"
|
|
275807
|
-
}
|
|
275808
|
-
},
|
|
275809
|
-
{
|
|
275810
|
-
id: "solidity-zeto",
|
|
275811
|
-
name: "Zeto",
|
|
275812
|
-
featureflagged: true,
|
|
275813
|
-
image: {
|
|
275814
|
-
registry: "ghcr.io",
|
|
275815
|
-
repository: "settlemint/solidity-zeto",
|
|
275816
|
-
tag: "7.7.7"
|
|
275817
|
-
}
|
|
275818
|
-
},
|
|
275819
|
-
{
|
|
275820
|
-
id: "solidity-starterkit",
|
|
275821
|
-
name: "Starterkit",
|
|
275822
|
-
featureflagged: true,
|
|
275823
|
-
image: {
|
|
275824
|
-
registry: "ghcr.io",
|
|
275825
|
-
repository: "settlemint/solidity-predeployed",
|
|
275826
|
-
tag: "7.7.7"
|
|
275827
|
-
}
|
|
275828
|
-
}
|
|
275829
|
-
];
|
|
275830
|
-
var SMART_CONTRACT_SETS = SMART_CONTRACT_SET_DETAILS.map((set) => set.id);
|
|
275831
|
-
|
|
275832
275996
|
// src/commands/smart-contract-set/prompts/use-case.prompt.ts
|
|
275833
|
-
async function useCasePrompt(argument) {
|
|
275834
|
-
if (
|
|
275997
|
+
async function useCasePrompt(platformConfig, argument) {
|
|
275998
|
+
if (platformConfig.smartContractSets.sets.length === 0) {
|
|
275835
275999
|
cancel2("No use cases found");
|
|
275836
276000
|
}
|
|
276001
|
+
const useCasesNotFeatureFlagged = platformConfig.smartContractSets.sets.filter((set) => !set.featureflagged);
|
|
275837
276002
|
if (argument) {
|
|
275838
|
-
|
|
275839
|
-
|
|
276003
|
+
const selectedUseCase = platformConfig.smartContractSets.sets.find((set) => set.id === argument);
|
|
276004
|
+
if (!selectedUseCase) {
|
|
276005
|
+
cancel2(`No use case found with id '${argument}'. Possible use cases: '${useCasesNotFeatureFlagged.map((set) => set.id).sort().join(", ")}'`);
|
|
275840
276006
|
}
|
|
275841
|
-
return
|
|
276007
|
+
return selectedUseCase;
|
|
276008
|
+
}
|
|
276009
|
+
if (useCasesNotFeatureFlagged.length === 0) {
|
|
276010
|
+
cancel2("No use cases found");
|
|
276011
|
+
}
|
|
276012
|
+
if (useCasesNotFeatureFlagged.length === 1) {
|
|
276013
|
+
return useCasesNotFeatureFlagged[0];
|
|
275842
276014
|
}
|
|
275843
276015
|
const useCase = await esm_default2({
|
|
275844
276016
|
message: "Which use case do you want to use?",
|
|
275845
|
-
choices:
|
|
275846
|
-
name: useCase2,
|
|
275847
|
-
value: useCase2
|
|
275848
|
-
}))
|
|
276017
|
+
choices: useCasesNotFeatureFlagged.map((useCase2) => ({
|
|
276018
|
+
name: useCase2.name,
|
|
276019
|
+
value: useCase2.id
|
|
276020
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
275849
276021
|
});
|
|
275850
|
-
return useCase;
|
|
276022
|
+
return platformConfig.smartContractSets.sets.find((set) => set.id === useCase);
|
|
275851
276023
|
}
|
|
275852
276024
|
|
|
275853
276025
|
// src/commands/smart-contract-set/create.ts
|
|
275854
276026
|
function createCommand4() {
|
|
275855
|
-
return new Command("create").description("Bootstrap your smart contract set").option("-n, --project-name <name>", "The name for your smart contract set project").
|
|
276027
|
+
return new Command("create").description("Bootstrap your smart contract set").option("-n, --project-name <name>", "The name for your smart contract set project").option("--use-case <useCase>", "Use case for the smart contract set (run `settlemint platform config` to see available use cases)").option("--prod", "Connect to your production environment").action(async ({ projectName, useCase, prod }) => {
|
|
275856
276028
|
intro("Creating a new smart contract set");
|
|
275857
276029
|
const env2 = await loadEnv2(false, !!prod);
|
|
275858
276030
|
const name2 = await namePrompt(env2, projectName);
|
|
276031
|
+
const instance = await instancePrompt(env2, true);
|
|
276032
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
276033
|
+
env: env2,
|
|
276034
|
+
instance,
|
|
276035
|
+
prefer: "personal"
|
|
276036
|
+
});
|
|
276037
|
+
const settlemint = createSettleMintClient({
|
|
276038
|
+
accessToken,
|
|
276039
|
+
instance
|
|
276040
|
+
});
|
|
276041
|
+
const platformConfig = await settlemint.platform.config();
|
|
276042
|
+
const selectedUseCase = await useCasePrompt(platformConfig, useCase);
|
|
276043
|
+
if (!selectedUseCase) {
|
|
276044
|
+
return nothingSelectedError("use case");
|
|
276045
|
+
}
|
|
275859
276046
|
const targetDir = formatTargetDir(name2);
|
|
275860
276047
|
const projectDir = join8(process.cwd(), targetDir);
|
|
275861
276048
|
if (await exists2(projectDir) && !await isEmpty(projectDir)) {
|
|
@@ -275868,24 +276055,16 @@ function createCommand4() {
|
|
|
275868
276055
|
}
|
|
275869
276056
|
await rmdir(projectDir, { recursive: true });
|
|
275870
276057
|
}
|
|
275871
|
-
const selectedUseCase = await useCasePrompt(useCase);
|
|
275872
|
-
if (!selectedUseCase) {
|
|
275873
|
-
cancel("No use case selected. Please select a use case to continue.");
|
|
275874
|
-
}
|
|
275875
276058
|
await spinner({
|
|
275876
276059
|
startMessage: "Scaffolding the smart contract set",
|
|
275877
276060
|
task: async () => {
|
|
275878
|
-
const smartContractSet = SMART_CONTRACT_SET_DETAILS.find((set) => set.id === selectedUseCase);
|
|
275879
|
-
if (!smartContractSet) {
|
|
275880
|
-
throw new Error(`No smart contract set found for use case ${selectedUseCase}`);
|
|
275881
|
-
}
|
|
275882
276061
|
await executeCommand("forge", [
|
|
275883
276062
|
"init",
|
|
275884
276063
|
name2,
|
|
275885
276064
|
"--template",
|
|
275886
|
-
|
|
276065
|
+
selectedUseCase.image.repository,
|
|
275887
276066
|
"--branch",
|
|
275888
|
-
`v${
|
|
276067
|
+
`v${selectedUseCase.image.tag}`
|
|
275889
276068
|
]);
|
|
275890
276069
|
await setName(name2, projectDir);
|
|
275891
276070
|
},
|
|
@@ -276048,6 +276227,60 @@ function hardhatDeployLocalCommand() {
|
|
|
276048
276227
|
});
|
|
276049
276228
|
}
|
|
276050
276229
|
|
|
276230
|
+
// src/error/service-not-running-error.ts
|
|
276231
|
+
function serviceNotRunningError(service, status) {
|
|
276232
|
+
return cancel2(`The ${service} service is not in a Running state (status: ${status}). ${getStatusAction(status)}`);
|
|
276233
|
+
}
|
|
276234
|
+
function getStatusAction(status) {
|
|
276235
|
+
if (status === "PAUSED" || status === "AUTO_PAUSED") {
|
|
276236
|
+
return "Please resume the service.";
|
|
276237
|
+
}
|
|
276238
|
+
if (status === "FAILED") {
|
|
276239
|
+
return "Please try restarting the service or contact support.";
|
|
276240
|
+
}
|
|
276241
|
+
return "Please try again later.";
|
|
276242
|
+
}
|
|
276243
|
+
|
|
276244
|
+
// src/commands/smart-contract-set/hardhat/utils/select-target-node.ts
|
|
276245
|
+
async function selectTargetNode({
|
|
276246
|
+
env: env2,
|
|
276247
|
+
blockchainNodeUniqueName,
|
|
276248
|
+
autoAccept,
|
|
276249
|
+
settlemint
|
|
276250
|
+
}) {
|
|
276251
|
+
const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
|
|
276252
|
+
let node = undefined;
|
|
276253
|
+
if (!nodeUniqueName) {
|
|
276254
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276255
|
+
return missingApplication();
|
|
276256
|
+
}
|
|
276257
|
+
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276258
|
+
const evmNodes = nodes.filter((node2) => node2.isEvm);
|
|
276259
|
+
if (evmNodes.length === 0) {
|
|
276260
|
+
cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
|
|
276261
|
+
}
|
|
276262
|
+
const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
|
|
276263
|
+
const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
|
|
276264
|
+
if (nodesWithActivePrivateKey.length === 0) {
|
|
276265
|
+
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276266
|
+
}
|
|
276267
|
+
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept, true);
|
|
276268
|
+
if (!blockchainNode) {
|
|
276269
|
+
return nothingSelectedError("EVM blockchain node");
|
|
276270
|
+
}
|
|
276271
|
+
node = blockchainNode;
|
|
276272
|
+
} else {
|
|
276273
|
+
node = await settlemint.blockchainNode.read(nodeUniqueName);
|
|
276274
|
+
if (!node.isEvm) {
|
|
276275
|
+
cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
|
|
276276
|
+
}
|
|
276277
|
+
}
|
|
276278
|
+
if (node.status !== "COMPLETED") {
|
|
276279
|
+
serviceNotRunningError("blockchain node", node.status);
|
|
276280
|
+
}
|
|
276281
|
+
return node;
|
|
276282
|
+
}
|
|
276283
|
+
|
|
276051
276284
|
// src/commands/smart-contract-set/prompts/address.prompt.ts
|
|
276052
276285
|
async function addressPrompt({
|
|
276053
276286
|
env: env2,
|
|
@@ -276161,30 +276394,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
276161
276394
|
accessToken,
|
|
276162
276395
|
instance
|
|
276163
276396
|
});
|
|
276164
|
-
const
|
|
276165
|
-
let node = undefined;
|
|
276166
|
-
if (!nodeUniqueName) {
|
|
276167
|
-
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276168
|
-
const evmNodes = nodes.filter((node2) => node2.isEvm);
|
|
276169
|
-
if (evmNodes.length === 0) {
|
|
276170
|
-
cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
|
|
276171
|
-
}
|
|
276172
|
-
const nodesWithPrivateKey = await Promise.all(nodes.map((node2) => settlemint.blockchainNode.read(node2.uniqueName)));
|
|
276173
|
-
const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node2) => node2.privateKeys && node2.privateKeys.length > 0);
|
|
276174
|
-
if (nodesWithActivePrivateKey.length === 0) {
|
|
276175
|
-
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276176
|
-
}
|
|
276177
|
-
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, autoAccept);
|
|
276178
|
-
if (!blockchainNode) {
|
|
276179
|
-
cancel("No EVM blockchain node selected. Please select one to continue.");
|
|
276180
|
-
}
|
|
276181
|
-
node = blockchainNode;
|
|
276182
|
-
} else {
|
|
276183
|
-
node = await settlemint.blockchainNode.read(nodeUniqueName);
|
|
276184
|
-
if (!node.isEvm) {
|
|
276185
|
-
cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
|
|
276186
|
-
}
|
|
276187
|
-
}
|
|
276397
|
+
const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
|
276188
276398
|
const envConfig = await settlemint.foundry.env(node.uniqueName);
|
|
276189
276399
|
const hardhatConfig = await getHardhatConfigData(envConfig);
|
|
276190
276400
|
if (verify && !hardhatConfig?.etherscan?.apiKey) {
|
|
@@ -276192,7 +276402,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
276192
276402
|
}
|
|
276193
276403
|
const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
|
|
276194
276404
|
if (!address) {
|
|
276195
|
-
|
|
276405
|
+
return nothingSelectedError("private key");
|
|
276196
276406
|
}
|
|
276197
276407
|
const { command, args } = await getPackageManagerExecutable();
|
|
276198
276408
|
await executeCommand(command, [
|
|
@@ -276276,16 +276486,8 @@ function hardhatScriptRemoteCommand() {
|
|
|
276276
276486
|
accessToken,
|
|
276277
276487
|
instance
|
|
276278
276488
|
});
|
|
276279
|
-
|
|
276280
|
-
|
|
276281
|
-
const blockchainNodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276282
|
-
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, autoAccept);
|
|
276283
|
-
if (!blockchainNode) {
|
|
276284
|
-
cancel("No Blockchain Node selected. Please select one to continue.");
|
|
276285
|
-
}
|
|
276286
|
-
nodeUniqueName = blockchainNode.uniqueName;
|
|
276287
|
-
}
|
|
276288
|
-
const envConfig = await settlemint.foundry.env(nodeUniqueName);
|
|
276489
|
+
const node = await selectTargetNode({ env: env2, blockchainNodeUniqueName, autoAccept, settlemint });
|
|
276490
|
+
const envConfig = await settlemint.foundry.env(node.uniqueName);
|
|
276289
276491
|
const { command, args } = await getPackageManagerExecutable();
|
|
276290
276492
|
await executeCommand(command, [...args, "hardhat", "run", script, "--network", "btp", ...compile ? ["--no-compile"] : []], { env: envConfig });
|
|
276291
276493
|
});
|
|
@@ -276502,8 +276704,11 @@ async function getTheGraphMiddleware({
|
|
|
276502
276704
|
return defaultTheGraphMiddleware;
|
|
276503
276705
|
}
|
|
276504
276706
|
}
|
|
276707
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276708
|
+
return missingApplication();
|
|
276709
|
+
}
|
|
276505
276710
|
const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
|
|
276506
|
-
return theGraphPrompt(env2, middlewares, autoAccept);
|
|
276711
|
+
return theGraphPrompt(env2, middlewares, autoAccept, true);
|
|
276507
276712
|
}
|
|
276508
276713
|
async function getTheGraphNetwork({
|
|
276509
276714
|
theGraphMiddleware,
|
|
@@ -276611,7 +276816,10 @@ function subgraphDeployCommand() {
|
|
|
276611
276816
|
});
|
|
276612
276817
|
const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
|
276613
276818
|
if (!theGraphMiddleware) {
|
|
276614
|
-
|
|
276819
|
+
return nothingSelectedError("graph middleware");
|
|
276820
|
+
}
|
|
276821
|
+
if (theGraphMiddleware.status !== "COMPLETED") {
|
|
276822
|
+
serviceNotRunningError("graph middleware", theGraphMiddleware.status);
|
|
276615
276823
|
}
|
|
276616
276824
|
const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
|
|
276617
276825
|
await subgraphSetup({
|
|
@@ -276714,4 +276922,4 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
276714
276922
|
ascii();
|
|
276715
276923
|
sdkCliCommand();
|
|
276716
276924
|
|
|
276717
|
-
//# debugId=
|
|
276925
|
+
//# debugId=524BD2AAFA21791264756E2164756E21
|