@settlemint/sdk-cli 0.9.2 → 0.9.3-main0d722733
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 +676 -499
- package/dist/cli.js.map +56 -51
- 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.yXumBfN0lq:/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.yXumBfN0lq:/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.yXumBfN0lq:/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.yXumBfN0lq:/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-main0d722733",
|
|
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.yXumBfN0lq:/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-main0d722733",
|
|
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-main0d722733",
|
|
256845
|
+
"@settlemint/sdk-utils": "0.9.3-main0d722733",
|
|
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";
|
|
@@ -270060,9 +270066,12 @@ async function loadEnvironmentEnv2(validateEnv, prod, path5 = process.cwd()) {
|
|
|
270060
270066
|
return {};
|
|
270061
270067
|
}
|
|
270062
270068
|
}
|
|
270063
|
-
async function projectRoot2() {
|
|
270069
|
+
async function projectRoot2(fallbackToCwd = false) {
|
|
270064
270070
|
const packageJsonPath = await findUp("package.json");
|
|
270065
270071
|
if (!packageJsonPath) {
|
|
270072
|
+
if (fallbackToCwd) {
|
|
270073
|
+
return process.cwd();
|
|
270074
|
+
}
|
|
270066
270075
|
throw new Error("Unable to find project root (no package.json found)");
|
|
270067
270076
|
}
|
|
270068
270077
|
return dirname5(packageJsonPath);
|
|
@@ -270113,7 +270122,7 @@ async function findMonoRepoPackages(projectDir) {
|
|
|
270113
270122
|
}
|
|
270114
270123
|
}
|
|
270115
270124
|
async function writeEnv(prod, env2, secrets) {
|
|
270116
|
-
const projectDir = await projectRoot2();
|
|
270125
|
+
const projectDir = await projectRoot2(true);
|
|
270117
270126
|
if (prod) {
|
|
270118
270127
|
process.env.NODE_ENV = "production";
|
|
270119
270128
|
}
|
|
@@ -272346,6 +272355,42 @@ var middlewareRestart = (gqlClient) => async (middlewareUniqueName) => {
|
|
|
272346
272355
|
});
|
|
272347
272356
|
return middleware;
|
|
272348
272357
|
};
|
|
272358
|
+
var getPlatformConfigQuery = graphql(`
|
|
272359
|
+
query platformConfig {
|
|
272360
|
+
config {
|
|
272361
|
+
smartContractSets {
|
|
272362
|
+
id
|
|
272363
|
+
sets {
|
|
272364
|
+
id
|
|
272365
|
+
name
|
|
272366
|
+
featureflagged
|
|
272367
|
+
image {
|
|
272368
|
+
repository
|
|
272369
|
+
tag
|
|
272370
|
+
registry
|
|
272371
|
+
}
|
|
272372
|
+
}
|
|
272373
|
+
}
|
|
272374
|
+
deploymentEngineTargets {
|
|
272375
|
+
id
|
|
272376
|
+
name
|
|
272377
|
+
disabled
|
|
272378
|
+
clusters {
|
|
272379
|
+
id
|
|
272380
|
+
name
|
|
272381
|
+
disabled
|
|
272382
|
+
}
|
|
272383
|
+
}
|
|
272384
|
+
preDeployedContracts
|
|
272385
|
+
}
|
|
272386
|
+
}
|
|
272387
|
+
`, []);
|
|
272388
|
+
var getPlatformConfig = (gqlClient) => {
|
|
272389
|
+
return async () => {
|
|
272390
|
+
const { config: config4 } = await gqlClient.request(getPlatformConfigQuery);
|
|
272391
|
+
return config4;
|
|
272392
|
+
};
|
|
272393
|
+
};
|
|
272349
272394
|
var PrivateKeyFragment = graphql(`
|
|
272350
272395
|
fragment PrivateKey on PrivateKey {
|
|
272351
272396
|
__typename
|
|
@@ -272545,6 +272590,9 @@ function createSettleMintClient(options) {
|
|
|
272545
272590
|
},
|
|
272546
272591
|
applicationAccessToken: {
|
|
272547
272592
|
create: applicationAccessTokenCreate(gqlClient)
|
|
272593
|
+
},
|
|
272594
|
+
platform: {
|
|
272595
|
+
config: getPlatformConfig(gqlClient)
|
|
272548
272596
|
}
|
|
272549
272597
|
};
|
|
272550
272598
|
}
|
|
@@ -272711,8 +272759,9 @@ var esm_default5 = createPrompt((config4, done) => {
|
|
|
272711
272759
|
|
|
272712
272760
|
// src/commands/connect/aat.prompt.ts
|
|
272713
272761
|
async function applicationAccessTokenPrompt(env2, application, settlemint, accept) {
|
|
272762
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272714
272763
|
const defaultAccessToken = env2.SETTLEMINT_ACCESS_TOKEN;
|
|
272715
|
-
const defaultPossible =
|
|
272764
|
+
const defaultPossible = autoAccept && defaultAccessToken;
|
|
272716
272765
|
if (defaultPossible || is_in_ci_default) {
|
|
272717
272766
|
return defaultAccessToken;
|
|
272718
272767
|
}
|
|
@@ -272807,16 +272856,25 @@ async function applicationAccessTokenPrompt(env2, application, settlemint, accep
|
|
|
272807
272856
|
});
|
|
272808
272857
|
}
|
|
272809
272858
|
|
|
272859
|
+
// src/error/nothing-selected-error.ts
|
|
272860
|
+
function nothingSelectedError(type4) {
|
|
272861
|
+
return cancel2(`No ${type4} selected. Please select a ${type4} to continue.`);
|
|
272862
|
+
}
|
|
272863
|
+
|
|
272810
272864
|
// src/commands/connect/application.prompt.ts
|
|
272811
272865
|
async function applicationPrompt(env2, applications, accept) {
|
|
272866
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272812
272867
|
const defaultApplication = applications.find((application2) => application2.uniqueName === env2.SETTLEMINT_APPLICATION);
|
|
272813
|
-
const defaultPossible =
|
|
272868
|
+
const defaultPossible = autoAccept && defaultApplication;
|
|
272814
272869
|
if (defaultPossible) {
|
|
272815
272870
|
return defaultApplication;
|
|
272816
272871
|
}
|
|
272817
272872
|
if (applications.length === 0) {
|
|
272818
272873
|
cancel("No applications found");
|
|
272819
272874
|
}
|
|
272875
|
+
if (is_in_ci_default) {
|
|
272876
|
+
nothingSelectedError("application");
|
|
272877
|
+
}
|
|
272820
272878
|
const application = await esm_default2({
|
|
272821
272879
|
message: "Which application do you want to connect to?",
|
|
272822
272880
|
choices: applications.map((applications2) => ({
|
|
@@ -272831,146 +272889,170 @@ async function applicationPrompt(env2, applications, accept) {
|
|
|
272831
272889
|
return application;
|
|
272832
272890
|
}
|
|
272833
272891
|
|
|
272834
|
-
// src/commands/connect/
|
|
272835
|
-
async function
|
|
272836
|
-
|
|
272892
|
+
// src/commands/connect/service.prompt.ts
|
|
272893
|
+
async function servicePrompt({
|
|
272894
|
+
env: env2,
|
|
272895
|
+
services,
|
|
272896
|
+
accept,
|
|
272897
|
+
envKey,
|
|
272898
|
+
defaultHandler,
|
|
272899
|
+
isCi = is_in_ci_default
|
|
272900
|
+
}) {
|
|
272901
|
+
if (services.length === 0) {
|
|
272837
272902
|
return;
|
|
272838
272903
|
}
|
|
272839
|
-
const
|
|
272840
|
-
const
|
|
272841
|
-
if (
|
|
272842
|
-
return
|
|
272904
|
+
const selectedService = services.find((service) => service.uniqueName === env2[envKey]);
|
|
272905
|
+
const autoAccept = isCi || accept;
|
|
272906
|
+
if (autoAccept && selectedService) {
|
|
272907
|
+
return selectedService;
|
|
272843
272908
|
}
|
|
272844
|
-
|
|
272845
|
-
|
|
272846
|
-
|
|
272847
|
-
|
|
272848
|
-
|
|
272849
|
-
|
|
272850
|
-
|
|
272851
|
-
|
|
272852
|
-
|
|
272853
|
-
|
|
272854
|
-
|
|
272855
|
-
|
|
272856
|
-
|
|
272909
|
+
if (isCi) {
|
|
272910
|
+
return;
|
|
272911
|
+
}
|
|
272912
|
+
if (services.length === 1) {
|
|
272913
|
+
return services[0];
|
|
272914
|
+
}
|
|
272915
|
+
return defaultHandler({ defaultService: selectedService });
|
|
272916
|
+
}
|
|
272917
|
+
|
|
272918
|
+
// src/commands/connect/blockchain-node.prompt.ts
|
|
272919
|
+
async function blockchainNodePrompt(env2, nodes, accept) {
|
|
272920
|
+
return servicePrompt({
|
|
272921
|
+
env: env2,
|
|
272922
|
+
services: nodes,
|
|
272923
|
+
accept,
|
|
272924
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NODE",
|
|
272925
|
+
defaultHandler: async ({ defaultService: defaultNode }) => {
|
|
272926
|
+
return esm_default2({
|
|
272927
|
+
message: "Which blockchain node do you want to connect to?",
|
|
272928
|
+
choices: [
|
|
272929
|
+
...nodes.map((node) => ({
|
|
272930
|
+
name: node.name,
|
|
272931
|
+
value: node
|
|
272932
|
+
})),
|
|
272933
|
+
{
|
|
272934
|
+
name: "None",
|
|
272935
|
+
value: undefined
|
|
272936
|
+
}
|
|
272937
|
+
],
|
|
272938
|
+
default: defaultNode
|
|
272939
|
+
});
|
|
272940
|
+
}
|
|
272857
272941
|
});
|
|
272858
|
-
return node;
|
|
272859
272942
|
}
|
|
272860
272943
|
|
|
272861
272944
|
// src/commands/connect/blockscout.prompt.ts
|
|
272862
272945
|
async function blockscoutPrompt(env2, insights, accept) {
|
|
272863
272946
|
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
|
-
|
|
272947
|
+
return servicePrompt({
|
|
272948
|
+
env: env2,
|
|
272949
|
+
services: possible,
|
|
272950
|
+
accept,
|
|
272951
|
+
envKey: "SETTLEMINT_BLOCKSCOUT",
|
|
272952
|
+
defaultHandler: async ({ defaultService: defaultBlockscout }) => {
|
|
272953
|
+
return esm_default2({
|
|
272954
|
+
message: "Which blockscout instance do you want to connect to?",
|
|
272955
|
+
choices: [
|
|
272956
|
+
...possible.map((insight) => ({
|
|
272957
|
+
name: insight.name,
|
|
272958
|
+
value: insight
|
|
272959
|
+
})),
|
|
272960
|
+
{
|
|
272961
|
+
name: "None",
|
|
272962
|
+
value: undefined
|
|
272963
|
+
}
|
|
272964
|
+
],
|
|
272965
|
+
default: defaultBlockscout
|
|
272966
|
+
});
|
|
272967
|
+
}
|
|
272885
272968
|
});
|
|
272886
|
-
return blockscout;
|
|
272887
272969
|
}
|
|
272888
272970
|
|
|
272889
272971
|
// src/commands/connect/custom-deployment.prompt.ts
|
|
272890
272972
|
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
|
-
|
|
272973
|
+
return servicePrompt({
|
|
272974
|
+
env: env2,
|
|
272975
|
+
services: customDeployments,
|
|
272976
|
+
accept,
|
|
272977
|
+
envKey: "SETTLEMINT_CUSTOM_DEPLOYMENT",
|
|
272978
|
+
defaultHandler: async ({
|
|
272979
|
+
defaultService: defaultCustomDeployment
|
|
272980
|
+
}) => {
|
|
272981
|
+
return esm_default2({
|
|
272982
|
+
message: "Which Custom Deployment do you want to connect to?",
|
|
272983
|
+
choices: [
|
|
272984
|
+
...customDeployments.map((customDeployment) => ({
|
|
272985
|
+
name: customDeployment.name,
|
|
272986
|
+
value: customDeployment
|
|
272987
|
+
})),
|
|
272988
|
+
{
|
|
272989
|
+
name: "None",
|
|
272990
|
+
value: undefined
|
|
272991
|
+
}
|
|
272992
|
+
],
|
|
272993
|
+
default: defaultCustomDeployment
|
|
272994
|
+
});
|
|
272995
|
+
}
|
|
272912
272996
|
});
|
|
272913
|
-
return middleware;
|
|
272914
272997
|
}
|
|
272915
272998
|
|
|
272916
272999
|
// src/commands/connect/hasura.prompt.ts
|
|
272917
273000
|
async function hasuraPrompt(env2, integrations, accept) {
|
|
272918
273001
|
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
|
-
|
|
273002
|
+
return servicePrompt({
|
|
273003
|
+
env: env2,
|
|
273004
|
+
services: possible,
|
|
273005
|
+
accept,
|
|
273006
|
+
envKey: "SETTLEMINT_HASURA",
|
|
273007
|
+
defaultHandler: async ({ defaultService: defaultHasura }) => {
|
|
273008
|
+
return esm_default2({
|
|
273009
|
+
message: "Which Hasura instance do you want to connect to?",
|
|
273010
|
+
choices: [
|
|
273011
|
+
...possible.map((integration) => ({
|
|
273012
|
+
name: integration.name,
|
|
273013
|
+
value: integration
|
|
273014
|
+
})),
|
|
273015
|
+
{
|
|
273016
|
+
name: "None",
|
|
273017
|
+
value: undefined
|
|
273018
|
+
}
|
|
273019
|
+
],
|
|
273020
|
+
default: defaultHasura
|
|
273021
|
+
});
|
|
273022
|
+
}
|
|
272940
273023
|
});
|
|
272941
|
-
return hasura;
|
|
272942
273024
|
}
|
|
272943
273025
|
|
|
272944
273026
|
// src/commands/connect/hd-private-keys.prompt.ts
|
|
272945
273027
|
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
|
-
|
|
273028
|
+
const possible = privateKeys.filter((privateKey) => privateKey.privateKeyType === "HD_ECDSA_P256");
|
|
273029
|
+
return servicePrompt({
|
|
273030
|
+
env: env2,
|
|
273031
|
+
services: possible,
|
|
273032
|
+
accept,
|
|
273033
|
+
envKey: "SETTLEMINT_HD_PRIVATE_KEY",
|
|
273034
|
+
defaultHandler: async ({ defaultService: defaultPrivateKey }) => {
|
|
273035
|
+
return esm_default2({
|
|
273036
|
+
message: "Which HD Private Key do you want to use?",
|
|
273037
|
+
choices: [
|
|
273038
|
+
...possible.map((privateKey) => ({
|
|
273039
|
+
name: privateKey.name,
|
|
273040
|
+
value: privateKey
|
|
273041
|
+
})),
|
|
273042
|
+
{
|
|
273043
|
+
name: "None",
|
|
273044
|
+
value: undefined
|
|
273045
|
+
}
|
|
273046
|
+
],
|
|
273047
|
+
default: defaultPrivateKey
|
|
273048
|
+
});
|
|
273049
|
+
}
|
|
272968
273050
|
});
|
|
272969
|
-
return privateKey;
|
|
272970
273051
|
}
|
|
272971
273052
|
|
|
272972
273053
|
// src/commands/connect/instance.prompt.ts
|
|
272973
273054
|
async function instancePrompt(env2, accept) {
|
|
273055
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
272974
273056
|
const defaultInstance = env2.SETTLEMINT_INSTANCE ?? "https://console.settlemint.com";
|
|
272975
273057
|
const defaultPossible = accept && defaultInstance;
|
|
272976
273058
|
if (defaultPossible) {
|
|
@@ -272995,85 +273077,82 @@ async function instancePrompt(env2, accept) {
|
|
|
272995
273077
|
// src/commands/connect/ipfs.prompt.ts
|
|
272996
273078
|
async function ipfsPrompt(env2, storages, accept) {
|
|
272997
273079
|
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
|
-
|
|
273080
|
+
return servicePrompt({
|
|
273081
|
+
env: env2,
|
|
273082
|
+
services: possible,
|
|
273083
|
+
accept,
|
|
273084
|
+
envKey: "SETTLEMINT_IPFS",
|
|
273085
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273086
|
+
return esm_default2({
|
|
273087
|
+
message: "Which IPFS instance do you want to connect to?",
|
|
273088
|
+
choices: [
|
|
273089
|
+
...possible.map((storage) => ({
|
|
273090
|
+
name: storage.name,
|
|
273091
|
+
value: storage
|
|
273092
|
+
})),
|
|
273093
|
+
{
|
|
273094
|
+
name: "None",
|
|
273095
|
+
value: undefined
|
|
273096
|
+
}
|
|
273097
|
+
],
|
|
273098
|
+
default: defaultStorage
|
|
273099
|
+
});
|
|
273100
|
+
}
|
|
273019
273101
|
});
|
|
273020
|
-
return minio;
|
|
273021
273102
|
}
|
|
273022
273103
|
|
|
273023
273104
|
// src/commands/connect/minio.prompt.ts
|
|
273024
273105
|
async function minioPrompt(env2, storages, accept) {
|
|
273025
273106
|
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
|
-
|
|
273107
|
+
return servicePrompt({
|
|
273108
|
+
env: env2,
|
|
273109
|
+
services: possible,
|
|
273110
|
+
accept,
|
|
273111
|
+
envKey: "SETTLEMINT_MINIO",
|
|
273112
|
+
defaultHandler: async ({ defaultService: defaultStorage }) => {
|
|
273113
|
+
return esm_default2({
|
|
273114
|
+
message: "Which MinIO instance do you want to connect to?",
|
|
273115
|
+
choices: [
|
|
273116
|
+
...possible.map((storage) => ({
|
|
273117
|
+
name: storage.name,
|
|
273118
|
+
value: storage
|
|
273119
|
+
})),
|
|
273120
|
+
{
|
|
273121
|
+
name: "None",
|
|
273122
|
+
value: undefined
|
|
273123
|
+
}
|
|
273124
|
+
],
|
|
273125
|
+
default: defaultStorage
|
|
273126
|
+
});
|
|
273127
|
+
}
|
|
273047
273128
|
});
|
|
273048
|
-
return minio;
|
|
273049
273129
|
}
|
|
273050
273130
|
|
|
273051
273131
|
// src/commands/connect/portal.prompt.ts
|
|
273052
273132
|
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
|
-
|
|
273133
|
+
const possible = middlewares.filter((middleware) => middleware.interface === "SMART_CONTRACT_PORTAL");
|
|
273134
|
+
return servicePrompt({
|
|
273135
|
+
env: env2,
|
|
273136
|
+
services: possible,
|
|
273137
|
+
accept,
|
|
273138
|
+
envKey: "SETTLEMINT_PORTAL",
|
|
273139
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273140
|
+
return esm_default2({
|
|
273141
|
+
message: "Which Smart Contract Portal instance do you want to connect to?",
|
|
273142
|
+
choices: [
|
|
273143
|
+
...possible.map((middleware) => ({
|
|
273144
|
+
name: middleware.name,
|
|
273145
|
+
value: middleware
|
|
273146
|
+
})),
|
|
273147
|
+
{
|
|
273148
|
+
name: "None",
|
|
273149
|
+
value: undefined
|
|
273150
|
+
}
|
|
273151
|
+
],
|
|
273152
|
+
default: defaultMiddleware
|
|
273153
|
+
});
|
|
273154
|
+
}
|
|
273075
273155
|
});
|
|
273076
|
-
return middleware;
|
|
273077
273156
|
}
|
|
273078
273157
|
|
|
273079
273158
|
// src/commands/connect/services.spinner.ts
|
|
@@ -273117,42 +273196,45 @@ async function servicesSpinner(settlemint, application) {
|
|
|
273117
273196
|
|
|
273118
273197
|
// src/commands/connect/thegraph.prompt.ts
|
|
273119
273198
|
async function theGraphPrompt(env2, middlewares, accept) {
|
|
273120
|
-
const possible = middlewares.filter((
|
|
273121
|
-
|
|
273122
|
-
|
|
273123
|
-
|
|
273124
|
-
|
|
273125
|
-
|
|
273126
|
-
|
|
273127
|
-
|
|
273128
|
-
|
|
273129
|
-
|
|
273130
|
-
|
|
273131
|
-
|
|
273132
|
-
|
|
273133
|
-
|
|
273134
|
-
|
|
273135
|
-
|
|
273136
|
-
|
|
273137
|
-
|
|
273138
|
-
|
|
273139
|
-
|
|
273140
|
-
|
|
273141
|
-
|
|
273199
|
+
const possible = middlewares.filter((middleware) => middleware.__typename === "HAGraphMiddleware");
|
|
273200
|
+
return servicePrompt({
|
|
273201
|
+
env: env2,
|
|
273202
|
+
services: possible,
|
|
273203
|
+
accept,
|
|
273204
|
+
envKey: "SETTLEMINT_THEGRAPH",
|
|
273205
|
+
defaultHandler: async ({ defaultService: defaultMiddleware }) => {
|
|
273206
|
+
return esm_default2({
|
|
273207
|
+
message: "Which The Graph instance do you want to connect to?",
|
|
273208
|
+
choices: [
|
|
273209
|
+
...possible.map((middleware) => ({
|
|
273210
|
+
name: middleware.name,
|
|
273211
|
+
value: middleware
|
|
273212
|
+
})),
|
|
273213
|
+
{
|
|
273214
|
+
name: "None",
|
|
273215
|
+
value: undefined
|
|
273216
|
+
}
|
|
273217
|
+
],
|
|
273218
|
+
default: defaultMiddleware
|
|
273219
|
+
});
|
|
273220
|
+
}
|
|
273142
273221
|
});
|
|
273143
|
-
return middleware;
|
|
273144
273222
|
}
|
|
273145
273223
|
|
|
273146
273224
|
// src/commands/connect/workspace.prompt.ts
|
|
273147
273225
|
async function workspacePrompt(env2, workspaces, accept) {
|
|
273226
|
+
const autoAccept = !!accept || is_in_ci_default;
|
|
273148
273227
|
const defaultWorkspace = workspaces.find((workspace2) => workspace2.uniqueName === env2.SETTLEMINT_WORKSPACE);
|
|
273149
|
-
const defaultPossible =
|
|
273228
|
+
const defaultPossible = autoAccept && defaultWorkspace;
|
|
273150
273229
|
if (defaultPossible) {
|
|
273151
273230
|
return defaultWorkspace;
|
|
273152
273231
|
}
|
|
273153
273232
|
if (workspaces.length === 0) {
|
|
273154
273233
|
cancel2("No workspaces found");
|
|
273155
273234
|
}
|
|
273235
|
+
if (is_in_ci_default) {
|
|
273236
|
+
nothingSelectedError("workspace");
|
|
273237
|
+
}
|
|
273156
273238
|
const workspace = await esm_default2({
|
|
273157
273239
|
message: "Which workspace do you want to connect to?",
|
|
273158
273240
|
choices: workspaces.map((workspace2) => ({
|
|
@@ -273171,9 +273253,8 @@ async function workspacePrompt(env2, workspaces, accept) {
|
|
|
273171
273253
|
function connectCommand() {
|
|
273172
273254
|
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
273255
|
intro("Connecting your dApp to SettleMint");
|
|
273174
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
273175
273256
|
const env2 = await loadEnv2(false, !!prod);
|
|
273176
|
-
const instance = await instancePrompt(env2,
|
|
273257
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
273177
273258
|
const personalAccessToken = await getInstanceCredentials(instance);
|
|
273178
273259
|
if (!personalAccessToken) {
|
|
273179
273260
|
return missingPersonalAccessTokenError();
|
|
@@ -273184,20 +273265,20 @@ function connectCommand() {
|
|
|
273184
273265
|
instance
|
|
273185
273266
|
});
|
|
273186
273267
|
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,
|
|
273268
|
+
const workspace = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
273269
|
+
const application = await applicationPrompt(env2, workspace?.applications ?? [], acceptDefaults);
|
|
273270
|
+
const aatToken = await applicationAccessTokenPrompt(env2, application, settlemint, acceptDefaults);
|
|
273190
273271
|
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 (
|
|
273272
|
+
const blockchainNode = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
273273
|
+
const hasura = await hasuraPrompt(env2, integrationTool, acceptDefaults);
|
|
273274
|
+
const thegraph = await theGraphPrompt(env2, middleware, acceptDefaults);
|
|
273275
|
+
const portal = await portalPrompt(env2, middleware, acceptDefaults);
|
|
273276
|
+
const ipfs = await ipfsPrompt(env2, storage, acceptDefaults);
|
|
273277
|
+
const minio = await minioPrompt(env2, storage, acceptDefaults);
|
|
273278
|
+
const hdPrivateKey = await hdPrivateKeyPrompt(env2, privateKey, acceptDefaults);
|
|
273279
|
+
const cDeployment = await customDeploymentPrompt(env2, customDeployment, acceptDefaults);
|
|
273280
|
+
const blockscout = await blockscoutPrompt(env2, insights, acceptDefaults);
|
|
273281
|
+
if (acceptDefaults) {
|
|
273201
273282
|
const selectedServices = [
|
|
273202
273283
|
`Workspace: ${workspace.name}`,
|
|
273203
273284
|
`Application: ${application.name}`,
|
|
@@ -273301,9 +273382,12 @@ import { dirname as dirname6 } from "node:path";
|
|
|
273301
273382
|
import { stat as stat8 } from "node:fs/promises";
|
|
273302
273383
|
var import_package_json3 = __toESM(require_lib12(), 1);
|
|
273303
273384
|
var import_package_json4 = __toESM(require_lib12(), 1);
|
|
273304
|
-
async function projectRoot3() {
|
|
273385
|
+
async function projectRoot3(fallbackToCwd = false) {
|
|
273305
273386
|
const packageJsonPath = await findUp("package.json");
|
|
273306
273387
|
if (!packageJsonPath) {
|
|
273388
|
+
if (fallbackToCwd) {
|
|
273389
|
+
return process.cwd();
|
|
273390
|
+
}
|
|
273307
273391
|
throw new Error("Unable to find project root (no package.json found)");
|
|
273308
273392
|
}
|
|
273309
273393
|
return dirname6(packageJsonPath);
|
|
@@ -274064,7 +274148,7 @@ function createCommand2() {
|
|
|
274064
274148
|
}
|
|
274065
274149
|
const selectedTemplate = await templatePrompt(templates, template);
|
|
274066
274150
|
if (!selectedTemplate) {
|
|
274067
|
-
|
|
274151
|
+
return nothingSelectedError("template");
|
|
274068
274152
|
}
|
|
274069
274153
|
await spinner({
|
|
274070
274154
|
startMessage: "Scaffolding the project",
|
|
@@ -274212,7 +274296,7 @@ function logoutCommand() {
|
|
|
274212
274296
|
|
|
274213
274297
|
// src/commands/platform/common/cluster-service.args.ts
|
|
274214
274298
|
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"));
|
|
274299
|
+
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
274300
|
}
|
|
274217
274301
|
|
|
274218
274302
|
// src/utils/parse-number.ts
|
|
@@ -274245,7 +274329,7 @@ async function waitForCompletion({
|
|
|
274245
274329
|
restartIfTimeout = false
|
|
274246
274330
|
}) {
|
|
274247
274331
|
const serviceType = SETTLEMINT_CLIENT_MAP[type4];
|
|
274248
|
-
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken") {
|
|
274332
|
+
if (serviceType === "workspace" || serviceType === "application" || serviceType === "foundry" || serviceType === "applicationAccessToken" || serviceType === "platform") {
|
|
274249
274333
|
return true;
|
|
274250
274334
|
}
|
|
274251
274335
|
const service = settlemint[serviceType];
|
|
@@ -274307,6 +274391,63 @@ function sanitizeCommandName(name2) {
|
|
|
274307
274391
|
return name2.split(" ").join("-").toLowerCase();
|
|
274308
274392
|
}
|
|
274309
274393
|
|
|
274394
|
+
// src/commands/platform/prompts/provider.prompt.ts
|
|
274395
|
+
async function providerPrompt(platformConfig, argument) {
|
|
274396
|
+
const possibleProviders = platformConfig.deploymentEngineTargets.filter((target) => !target.disabled);
|
|
274397
|
+
if (possibleProviders.length === 0) {
|
|
274398
|
+
cancel2("No providers found");
|
|
274399
|
+
}
|
|
274400
|
+
if (argument) {
|
|
274401
|
+
const selectedProvider = possibleProviders.find((target) => target.id === argument);
|
|
274402
|
+
if (!selectedProvider) {
|
|
274403
|
+
cancel2(`No provider found with id '${argument}'. Possible providers: '${possibleProviders.map((target) => target.id).sort().join(", ")}'`);
|
|
274404
|
+
}
|
|
274405
|
+
return selectedProvider;
|
|
274406
|
+
}
|
|
274407
|
+
if (possibleProviders.length === 1) {
|
|
274408
|
+
return possibleProviders[0];
|
|
274409
|
+
}
|
|
274410
|
+
const provider = await esm_default2({
|
|
274411
|
+
message: "Which provider do you want to use?",
|
|
274412
|
+
choices: platformConfig.deploymentEngineTargets.map((target) => ({
|
|
274413
|
+
name: target.name,
|
|
274414
|
+
value: target.id
|
|
274415
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
274416
|
+
});
|
|
274417
|
+
return platformConfig.deploymentEngineTargets.find((target) => target.id === provider);
|
|
274418
|
+
}
|
|
274419
|
+
|
|
274420
|
+
// src/commands/platform/utils/cluster-region.ts
|
|
274421
|
+
function getRegionId(regionId) {
|
|
274422
|
+
return regionId.split("-")[1];
|
|
274423
|
+
}
|
|
274424
|
+
|
|
274425
|
+
// src/commands/platform/prompts/region.prompt.ts
|
|
274426
|
+
async function regionPrompt(provider, argument) {
|
|
274427
|
+
const possibleRegions = provider.clusters.filter((cluster) => !cluster.disabled).map((cluster) => ({ ...cluster, id: getRegionId(cluster.id) }));
|
|
274428
|
+
if (possibleRegions.length === 0) {
|
|
274429
|
+
cancel2("No regions found");
|
|
274430
|
+
}
|
|
274431
|
+
if (argument) {
|
|
274432
|
+
const selectedRegion = possibleRegions.find((cluster) => cluster.id === argument);
|
|
274433
|
+
if (!selectedRegion) {
|
|
274434
|
+
cancel2(`No region found with id '${argument}'. Possible regions: '${possibleRegions.map((cluster) => cluster.id).sort().join(", ")}'`);
|
|
274435
|
+
}
|
|
274436
|
+
return selectedRegion;
|
|
274437
|
+
}
|
|
274438
|
+
if (possibleRegions.length === 1) {
|
|
274439
|
+
return possibleRegions[0];
|
|
274440
|
+
}
|
|
274441
|
+
const region = await esm_default2({
|
|
274442
|
+
message: "Which region do you want to use?",
|
|
274443
|
+
choices: provider.clusters.map((cluster) => ({
|
|
274444
|
+
name: cluster.name,
|
|
274445
|
+
value: cluster.id
|
|
274446
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
274447
|
+
});
|
|
274448
|
+
return provider.clusters.find((cluster) => cluster.id === region);
|
|
274449
|
+
}
|
|
274450
|
+
|
|
274310
274451
|
// src/commands/platform/common/create-command.ts
|
|
274311
274452
|
function getCreateCommand({
|
|
274312
274453
|
name: name2,
|
|
@@ -274321,7 +274462,7 @@ function getCreateCommand({
|
|
|
274321
274462
|
if (requiresDeployment) {
|
|
274322
274463
|
cmd2.option("-w, --wait", "Wait until deployed").option("-r, --restart-if-timeout", "Restart if wait time is exceeded");
|
|
274323
274464
|
}
|
|
274324
|
-
execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout }, createFunction) => {
|
|
274465
|
+
execute2(cmd2, async ({ acceptDefaults, prod, default: isDefault, wait, restartIfTimeout, provider, region }, createFunction) => {
|
|
274325
274466
|
intro(`Creating ${type4} in the SettleMint platform`);
|
|
274326
274467
|
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
274327
274468
|
const env2 = await loadEnv2(false, !!prod);
|
|
@@ -274335,6 +274476,17 @@ function getCreateCommand({
|
|
|
274335
274476
|
accessToken,
|
|
274336
274477
|
instance
|
|
274337
274478
|
});
|
|
274479
|
+
const platformConfig = await settlemint.platform.config();
|
|
274480
|
+
if (requiresDeployment) {
|
|
274481
|
+
const selectedProvider = await providerPrompt(platformConfig, provider);
|
|
274482
|
+
if (!selectedProvider) {
|
|
274483
|
+
return nothingSelectedError("provider");
|
|
274484
|
+
}
|
|
274485
|
+
const selectedRegion = await regionPrompt(selectedProvider, region);
|
|
274486
|
+
if (!selectedRegion) {
|
|
274487
|
+
return nothingSelectedError("region");
|
|
274488
|
+
}
|
|
274489
|
+
}
|
|
274338
274490
|
const { result, waitFor, mapDefaultEnv } = await spinner({
|
|
274339
274491
|
startMessage: `Creating ${type4}`,
|
|
274340
274492
|
task: async () => {
|
|
@@ -274402,8 +274554,15 @@ function blockchainNetworkBesuCreateCommand() {
|
|
|
274402
274554
|
type: type4,
|
|
274403
274555
|
...defaultArgs
|
|
274404
274556
|
}) => {
|
|
274405
|
-
return baseAction(
|
|
274557
|
+
return baseAction({
|
|
274558
|
+
...defaultArgs,
|
|
274559
|
+
provider,
|
|
274560
|
+
region
|
|
274561
|
+
}, async (settlemint, env2) => {
|
|
274406
274562
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274563
|
+
if (!applicationUniqueName) {
|
|
274564
|
+
return missingApplication();
|
|
274565
|
+
}
|
|
274407
274566
|
const result = await settlemint.blockchainNetwork.create({
|
|
274408
274567
|
name: name2,
|
|
274409
274568
|
applicationUniqueName,
|
|
@@ -274611,6 +274770,9 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274611
274770
|
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
274771
|
return baseAction(defaultArgs, async (settlemint, env2) => {
|
|
274613
274772
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274773
|
+
if (!applicationUniqueName) {
|
|
274774
|
+
return missingApplication();
|
|
274775
|
+
}
|
|
274614
274776
|
const aatToken = await settlemint.applicationAccessToken.create({
|
|
274615
274777
|
applicationUniqueName,
|
|
274616
274778
|
name: name2,
|
|
@@ -274663,6 +274825,7 @@ function applicationAccessTokenCreateCommand() {
|
|
|
274663
274825
|
uniqueName: ""
|
|
274664
274826
|
},
|
|
274665
274827
|
mapDefaultEnv: () => ({
|
|
274828
|
+
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274666
274829
|
SETTLEMINT_ACCESS_TOKEN: aatToken
|
|
274667
274830
|
})
|
|
274668
274831
|
};
|
|
@@ -274694,11 +274857,23 @@ function applicationCreateCommand() {
|
|
|
274694
274857
|
type: "application",
|
|
274695
274858
|
alias: "a",
|
|
274696
274859
|
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(
|
|
274860
|
+
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 }) => {
|
|
274861
|
+
return baseAction({
|
|
274862
|
+
...defaultArgs,
|
|
274863
|
+
acceptDefaults
|
|
274864
|
+
}, async (settlemint, env2) => {
|
|
274865
|
+
let workspaceUniqueName = workspace;
|
|
274866
|
+
if (!workspaceUniqueName) {
|
|
274867
|
+
const workspaces = await settlemint.workspace.list();
|
|
274868
|
+
const workspace2 = await workspacePrompt(env2, workspaces, acceptDefaults);
|
|
274869
|
+
if (!workspace2) {
|
|
274870
|
+
return nothingSelectedError("workspace");
|
|
274871
|
+
}
|
|
274872
|
+
workspaceUniqueName = workspace2.uniqueName;
|
|
274873
|
+
}
|
|
274699
274874
|
const result = await settlemint.application.create({
|
|
274700
274875
|
name: name2,
|
|
274701
|
-
workspaceUniqueName
|
|
274876
|
+
workspaceUniqueName
|
|
274702
274877
|
});
|
|
274703
274878
|
return {
|
|
274704
274879
|
result,
|
|
@@ -274731,27 +274906,27 @@ function applicationCreateCommand() {
|
|
|
274731
274906
|
|
|
274732
274907
|
// src/commands/connect/blockchain-network.prompt.ts
|
|
274733
274908
|
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
|
-
|
|
274909
|
+
return servicePrompt({
|
|
274910
|
+
env: env2,
|
|
274911
|
+
services: networks,
|
|
274912
|
+
accept,
|
|
274913
|
+
envKey: "SETTLEMINT_BLOCKCHAIN_NETWORK",
|
|
274914
|
+
defaultHandler: async ({ defaultService: defaultNetwork }) => {
|
|
274915
|
+
return esm_default2({
|
|
274916
|
+
message: "Which blockchain network do you want to connect to?",
|
|
274917
|
+
choices: [
|
|
274918
|
+
...networks.map((network) => ({
|
|
274919
|
+
name: network.name,
|
|
274920
|
+
value: network
|
|
274921
|
+
})),
|
|
274922
|
+
{
|
|
274923
|
+
name: "None",
|
|
274924
|
+
value: undefined
|
|
274925
|
+
}
|
|
274926
|
+
],
|
|
274927
|
+
default: defaultNetwork
|
|
274928
|
+
});
|
|
274929
|
+
}
|
|
274755
274930
|
});
|
|
274756
274931
|
}
|
|
274757
274932
|
|
|
@@ -274774,20 +274949,24 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274774
274949
|
acceptDefaults,
|
|
274775
274950
|
...defaultArgs
|
|
274776
274951
|
}) => {
|
|
274777
|
-
return baseAction(
|
|
274778
|
-
|
|
274952
|
+
return baseAction({
|
|
274953
|
+
...defaultArgs,
|
|
274954
|
+
acceptDefaults,
|
|
274955
|
+
provider,
|
|
274956
|
+
region
|
|
274957
|
+
}, async (settlemint, env2) => {
|
|
274779
274958
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274780
274959
|
if (!applicationUniqueName) {
|
|
274781
|
-
|
|
274960
|
+
return missingApplication();
|
|
274782
274961
|
}
|
|
274783
|
-
let networkUniqueName = blockchainNetwork
|
|
274962
|
+
let networkUniqueName = blockchainNetwork;
|
|
274784
274963
|
if (!networkUniqueName) {
|
|
274785
274964
|
const networks = await settlemint.blockchainNetwork.list(applicationUniqueName);
|
|
274786
|
-
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults
|
|
274965
|
+
const network = await blockchainNetworkPrompt(env2, networks, acceptDefaults);
|
|
274787
274966
|
if (!network) {
|
|
274788
|
-
|
|
274967
|
+
return nothingSelectedError("blockchain network");
|
|
274789
274968
|
}
|
|
274790
|
-
networkUniqueName = network?.
|
|
274969
|
+
networkUniqueName = network?.uniqueName;
|
|
274791
274970
|
}
|
|
274792
274971
|
const result = await settlemint.blockchainNode.create({
|
|
274793
274972
|
applicationUniqueName,
|
|
@@ -274805,7 +274984,7 @@ function blockchainNodeBesuCreateCommand() {
|
|
|
274805
274984
|
mapDefaultEnv: () => {
|
|
274806
274985
|
return {
|
|
274807
274986
|
SETTLEMINT_APPLICATION: applicationUniqueName,
|
|
274808
|
-
SETTLEMINT_BLOCKCHAIN_NODE: result.
|
|
274987
|
+
SETTLEMINT_BLOCKCHAIN_NODE: result.uniqueName
|
|
274809
274988
|
};
|
|
274810
274989
|
}
|
|
274811
274990
|
};
|
|
@@ -274841,11 +275020,27 @@ function blockscoutInsightsCreateCommand() {
|
|
|
274841
275020
|
type: "insights",
|
|
274842
275021
|
alias: "bs",
|
|
274843
275022
|
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(
|
|
275023
|
+
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 }) => {
|
|
275024
|
+
return baseAction({
|
|
275025
|
+
...defaultArgs,
|
|
275026
|
+
acceptDefaults,
|
|
275027
|
+
provider,
|
|
275028
|
+
region
|
|
275029
|
+
}, async (settlemint, env2) => {
|
|
274846
275030
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274847
|
-
|
|
275031
|
+
if (!applicationUniqueName) {
|
|
275032
|
+
return missingApplication();
|
|
275033
|
+
}
|
|
275034
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
274848
275035
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275036
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275037
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275038
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275039
|
+
if (!node) {
|
|
275040
|
+
return nothingSelectedError("blockchain node");
|
|
275041
|
+
}
|
|
275042
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275043
|
+
}
|
|
274849
275044
|
const result = await settlemint.insights.create({
|
|
274850
275045
|
name: name2,
|
|
274851
275046
|
applicationUniqueName,
|
|
@@ -274898,8 +275093,15 @@ function hasuraIntegrationCreateCommand() {
|
|
|
274898
275093
|
alias: "ha",
|
|
274899
275094
|
execute: (cmd2, baseAction) => {
|
|
274900
275095
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
274901
|
-
return baseAction(
|
|
275096
|
+
return baseAction({
|
|
275097
|
+
...defaultArgs,
|
|
275098
|
+
provider,
|
|
275099
|
+
region
|
|
275100
|
+
}, async (settlemint, env2) => {
|
|
274902
275101
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275102
|
+
if (!applicationUniqueName) {
|
|
275103
|
+
return missingApplication();
|
|
275104
|
+
}
|
|
274903
275105
|
const result = await settlemint.integrationTool.create({
|
|
274904
275106
|
name: name2,
|
|
274905
275107
|
applicationUniqueName,
|
|
@@ -274949,10 +275151,26 @@ function graphMiddlewareCreateCommand() {
|
|
|
274949
275151
|
type: "middleware",
|
|
274950
275152
|
alias: "gr",
|
|
274951
275153
|
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(
|
|
275154
|
+
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 }) => {
|
|
275155
|
+
return baseAction({
|
|
275156
|
+
...defaultArgs,
|
|
275157
|
+
acceptDefaults,
|
|
275158
|
+
provider,
|
|
275159
|
+
region
|
|
275160
|
+
}, async (settlemint, env2) => {
|
|
274954
275161
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
274955
|
-
|
|
275162
|
+
if (!applicationUniqueName) {
|
|
275163
|
+
return missingApplication();
|
|
275164
|
+
}
|
|
275165
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275166
|
+
if (!blockchainNodeUniqueName) {
|
|
275167
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275168
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275169
|
+
if (!node) {
|
|
275170
|
+
return nothingSelectedError("blockchain node");
|
|
275171
|
+
}
|
|
275172
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275173
|
+
}
|
|
274956
275174
|
const result = await settlemint.middleware.create({
|
|
274957
275175
|
name: name2,
|
|
274958
275176
|
applicationUniqueName,
|
|
@@ -274998,16 +275216,7 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
274998
275216
|
type: "middleware",
|
|
274999
275217
|
alias: "scp",
|
|
275000
275218
|
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, {
|
|
275219
|
+
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
275220
|
application,
|
|
275012
275221
|
blockchainNode,
|
|
275013
275222
|
loadBalancer,
|
|
@@ -275017,12 +275226,29 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
275017
275226
|
type: type4,
|
|
275018
275227
|
includePredeployedAbis,
|
|
275019
275228
|
abis,
|
|
275229
|
+
acceptDefaults,
|
|
275020
275230
|
...defaultArgs
|
|
275021
275231
|
}) => {
|
|
275022
|
-
return baseAction(
|
|
275232
|
+
return baseAction({
|
|
275233
|
+
...defaultArgs,
|
|
275234
|
+
acceptDefaults,
|
|
275235
|
+
provider,
|
|
275236
|
+
region
|
|
275237
|
+
}, async (settlemint, env2) => {
|
|
275023
275238
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275024
|
-
|
|
275239
|
+
if (!applicationUniqueName) {
|
|
275240
|
+
return missingApplication();
|
|
275241
|
+
}
|
|
275242
|
+
let blockchainNodeUniqueName = loadBalancer ? undefined : blockchainNode ?? env2.SETTLEMINT_BLOCKCHAIN_NODE;
|
|
275025
275243
|
const loadBalancerUniqueName = blockchainNodeUniqueName ? undefined : loadBalancer ?? env2.SETTLEMINT_LOAD_BALANCER;
|
|
275244
|
+
if (!blockchainNodeUniqueName && !loadBalancerUniqueName) {
|
|
275245
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275246
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275247
|
+
if (!node) {
|
|
275248
|
+
return nothingSelectedError("blockchain node");
|
|
275249
|
+
}
|
|
275250
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275251
|
+
}
|
|
275026
275252
|
const parsedAbis = [];
|
|
275027
275253
|
if (abis && abis.length > 0) {
|
|
275028
275254
|
try {
|
|
@@ -275037,6 +275263,13 @@ function smartContractPortalMiddlewareCreateCommand() {
|
|
|
275037
275263
|
cancel2(`Failed to read or parse ABI file: ${error5.message}`);
|
|
275038
275264
|
}
|
|
275039
275265
|
}
|
|
275266
|
+
if (includePredeployedAbis && includePredeployedAbis.length > 0) {
|
|
275267
|
+
const platformConfig = await settlemint.platform.config();
|
|
275268
|
+
const invalidPredeployedAbis = includePredeployedAbis.filter((abi) => !platformConfig.preDeployedContracts.some((contract) => contract === abi));
|
|
275269
|
+
if (invalidPredeployedAbis.length > 0) {
|
|
275270
|
+
cancel2(`Invalid pre-deployed abis: '${invalidPredeployedAbis.join(", ")}'. Possible values: '${platformConfig.preDeployedContracts.sort().join(", ")}'`);
|
|
275271
|
+
}
|
|
275272
|
+
}
|
|
275040
275273
|
const result = await settlemint.middleware.create({
|
|
275041
275274
|
name: name2,
|
|
275042
275275
|
applicationUniqueName,
|
|
@@ -275088,10 +275321,26 @@ function privateKeyHdCreateCommand() {
|
|
|
275088
275321
|
type: "private key",
|
|
275089
275322
|
alias: "hd",
|
|
275090
275323
|
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(
|
|
275324
|
+
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 }) => {
|
|
275325
|
+
return baseAction({
|
|
275326
|
+
...defaultArgs,
|
|
275327
|
+
acceptDefaults,
|
|
275328
|
+
provider,
|
|
275329
|
+
region
|
|
275330
|
+
}, async (settlemint, env2) => {
|
|
275093
275331
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275094
|
-
|
|
275332
|
+
if (!applicationUniqueName) {
|
|
275333
|
+
return missingApplication();
|
|
275334
|
+
}
|
|
275335
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275336
|
+
if (!blockchainNodeUniqueName) {
|
|
275337
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275338
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275339
|
+
if (!node) {
|
|
275340
|
+
return nothingSelectedError("blockchain node");
|
|
275341
|
+
}
|
|
275342
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275343
|
+
}
|
|
275095
275344
|
const result = await settlemint.privateKey.create({
|
|
275096
275345
|
name: name2,
|
|
275097
275346
|
applicationUniqueName,
|
|
@@ -275138,10 +275387,26 @@ function privateKeyHsmCreateCommand() {
|
|
|
275138
275387
|
type: "private key",
|
|
275139
275388
|
alias: "hd",
|
|
275140
275389
|
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(
|
|
275390
|
+
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 }) => {
|
|
275391
|
+
return baseAction({
|
|
275392
|
+
...defaultArgs,
|
|
275393
|
+
acceptDefaults,
|
|
275394
|
+
provider,
|
|
275395
|
+
region
|
|
275396
|
+
}, async (settlemint, env2) => {
|
|
275143
275397
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275144
|
-
|
|
275398
|
+
if (!applicationUniqueName) {
|
|
275399
|
+
return missingApplication();
|
|
275400
|
+
}
|
|
275401
|
+
let blockchainNodeUniqueName = blockchainNode;
|
|
275402
|
+
if (!blockchainNodeUniqueName) {
|
|
275403
|
+
const blockchainNodes = await settlemint.blockchainNode.list(applicationUniqueName);
|
|
275404
|
+
const node = await blockchainNodePrompt(env2, blockchainNodes, acceptDefaults);
|
|
275405
|
+
if (!node) {
|
|
275406
|
+
return nothingSelectedError("blockchain node");
|
|
275407
|
+
}
|
|
275408
|
+
blockchainNodeUniqueName = node.uniqueName;
|
|
275409
|
+
}
|
|
275145
275410
|
const result = await settlemint.privateKey.create({
|
|
275146
275411
|
name: name2,
|
|
275147
275412
|
applicationUniqueName,
|
|
@@ -275188,8 +275453,15 @@ function ipfsStorageCreateCommand() {
|
|
|
275188
275453
|
alias: "ip",
|
|
275189
275454
|
execute: (cmd2, baseAction) => {
|
|
275190
275455
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275191
|
-
return baseAction(
|
|
275456
|
+
return baseAction({
|
|
275457
|
+
...defaultArgs,
|
|
275458
|
+
provider,
|
|
275459
|
+
region
|
|
275460
|
+
}, async (settlemint, env2) => {
|
|
275192
275461
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275462
|
+
if (!applicationUniqueName) {
|
|
275463
|
+
return missingApplication();
|
|
275464
|
+
}
|
|
275193
275465
|
const result = await settlemint.storage.create({
|
|
275194
275466
|
name: name2,
|
|
275195
275467
|
applicationUniqueName,
|
|
@@ -275233,8 +275505,15 @@ function minioStorageCreateCommand() {
|
|
|
275233
275505
|
alias: "m",
|
|
275234
275506
|
execute: (cmd2, baseAction) => {
|
|
275235
275507
|
addClusterServiceArgs(cmd2).option("--application <application>", "Application unique name").action(async (name2, { application, provider, region, size, type: type4, ...defaultArgs }) => {
|
|
275236
|
-
return baseAction(
|
|
275508
|
+
return baseAction({
|
|
275509
|
+
...defaultArgs,
|
|
275510
|
+
provider,
|
|
275511
|
+
region
|
|
275512
|
+
}, async (settlemint, env2) => {
|
|
275237
275513
|
const applicationUniqueName = application ?? env2.SETTLEMINT_APPLICATION;
|
|
275514
|
+
if (!applicationUniqueName) {
|
|
275515
|
+
return missingApplication();
|
|
275516
|
+
}
|
|
275238
275517
|
const result = await settlemint.storage.create({
|
|
275239
275518
|
name: name2,
|
|
275240
275519
|
applicationUniqueName,
|
|
@@ -275328,9 +275607,8 @@ function getDeleteCommand({
|
|
|
275328
275607
|
if (!force) {
|
|
275329
275608
|
await deleteConfirmationPrompt(`this ${type4}`);
|
|
275330
275609
|
}
|
|
275331
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275332
275610
|
const env2 = await loadEnv2(false, !!prod);
|
|
275333
|
-
const instance = await instancePrompt(env2,
|
|
275611
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275334
275612
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275335
275613
|
env: env2,
|
|
275336
275614
|
instance,
|
|
@@ -275423,9 +275701,8 @@ function getRestartCommand({
|
|
|
275423
275701
|
}
|
|
275424
275702
|
])).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
275703
|
intro(`Restarting ${type4} in the SettleMint platform`);
|
|
275426
|
-
const autoAccept = !!acceptDefaults || is_in_ci_default;
|
|
275427
275704
|
const env2 = await loadEnv2(false, !!prod);
|
|
275428
|
-
const instance = await instancePrompt(env2,
|
|
275705
|
+
const instance = await instancePrompt(env2, acceptDefaults);
|
|
275429
275706
|
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275430
275707
|
env: env2,
|
|
275431
275708
|
instance,
|
|
@@ -275651,211 +275928,96 @@ function updateCommand() {
|
|
|
275651
275928
|
return new Command("update").alias("u").description("Update a resource in the SettleMint platform").addCommand(customDeploymentsUpdateCommand());
|
|
275652
275929
|
}
|
|
275653
275930
|
|
|
275931
|
+
// src/commands/platform/config.ts
|
|
275932
|
+
function configCommand() {
|
|
275933
|
+
return new Command("config").alias("c").description("Get platform configuration").option("--prod", "Connect to your production environment").action(async ({ prod }) => {
|
|
275934
|
+
intro("Getting platform configuration");
|
|
275935
|
+
const env2 = await loadEnv2(false, !!prod);
|
|
275936
|
+
const instance = await instancePrompt(env2, true);
|
|
275937
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
275938
|
+
env: env2,
|
|
275939
|
+
instance,
|
|
275940
|
+
prefer: "personal"
|
|
275941
|
+
});
|
|
275942
|
+
const settlemint = createSettleMintClient({
|
|
275943
|
+
accessToken,
|
|
275944
|
+
instance
|
|
275945
|
+
});
|
|
275946
|
+
const platformConfig = await settlemint.platform.config();
|
|
275947
|
+
note2(`Providers and regions:
|
|
275948
|
+
${platformConfig.deploymentEngineTargets.filter((provider) => !provider.disabled).map((provider) => `• ${provider.id}
|
|
275949
|
+
${provider.clusters.filter((cluster) => !cluster.disabled).map((region) => `• ${getRegionId(region.id)}`).sort().join(`
|
|
275950
|
+
`)}`).sort().join(`
|
|
275951
|
+
`)}`);
|
|
275952
|
+
note2(`Use cases (Smart Contract Sets):
|
|
275953
|
+
• ${platformConfig.smartContractSets.sets.filter((useCase) => !useCase.featureflagged).map((useCase) => useCase.id).sort().join(`
|
|
275954
|
+
• `)}`);
|
|
275955
|
+
note2(`Pre-deployed abis (Smart Contract Portal):
|
|
275956
|
+
• ${platformConfig.preDeployedContracts.sort().join(`
|
|
275957
|
+
• `)}`);
|
|
275958
|
+
outro("Platform configuration retrieved");
|
|
275959
|
+
});
|
|
275960
|
+
}
|
|
275961
|
+
|
|
275654
275962
|
// src/commands/platform.ts
|
|
275655
275963
|
function platformCommand() {
|
|
275656
|
-
return new Command("platform").description("Manage SettleMint platform resources").addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand());
|
|
275964
|
+
return new Command("platform").description("Manage SettleMint platform resources").addCommand(configCommand()).addCommand(createCommand3()).addCommand(updateCommand()).addCommand(deleteCommand()).addCommand(restartCommand());
|
|
275657
275965
|
}
|
|
275658
275966
|
|
|
275659
275967
|
// src/commands/smart-contract-set/create.ts
|
|
275660
275968
|
import { rmdir } from "node:fs/promises";
|
|
275661
275969
|
import { join as join8 } from "node:path";
|
|
275662
275970
|
|
|
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
275971
|
// src/commands/smart-contract-set/prompts/use-case.prompt.ts
|
|
275833
|
-
async function useCasePrompt(argument) {
|
|
275834
|
-
if (
|
|
275972
|
+
async function useCasePrompt(platformConfig, argument) {
|
|
275973
|
+
if (platformConfig.smartContractSets.sets.length === 0) {
|
|
275835
275974
|
cancel2("No use cases found");
|
|
275836
275975
|
}
|
|
275976
|
+
const useCasesNotFeatureFlagged = platformConfig.smartContractSets.sets.filter((set) => !set.featureflagged);
|
|
275837
275977
|
if (argument) {
|
|
275838
|
-
|
|
275839
|
-
|
|
275978
|
+
const selectedUseCase = platformConfig.smartContractSets.sets.find((set) => set.id === argument);
|
|
275979
|
+
if (!selectedUseCase) {
|
|
275980
|
+
cancel2(`No use case found with id '${argument}'. Possible use cases: '${useCasesNotFeatureFlagged.map((set) => set.id).sort().join(", ")}'`);
|
|
275840
275981
|
}
|
|
275841
|
-
return
|
|
275982
|
+
return selectedUseCase;
|
|
275983
|
+
}
|
|
275984
|
+
if (useCasesNotFeatureFlagged.length === 0) {
|
|
275985
|
+
cancel2("No use cases found");
|
|
275986
|
+
}
|
|
275987
|
+
if (useCasesNotFeatureFlagged.length === 1) {
|
|
275988
|
+
return useCasesNotFeatureFlagged[0];
|
|
275842
275989
|
}
|
|
275843
275990
|
const useCase = await esm_default2({
|
|
275844
275991
|
message: "Which use case do you want to use?",
|
|
275845
|
-
choices:
|
|
275846
|
-
name: useCase2,
|
|
275847
|
-
value: useCase2
|
|
275848
|
-
}))
|
|
275992
|
+
choices: useCasesNotFeatureFlagged.map((useCase2) => ({
|
|
275993
|
+
name: useCase2.name,
|
|
275994
|
+
value: useCase2.id
|
|
275995
|
+
})).sort((a8, b4) => a8.name.localeCompare(b4.name))
|
|
275849
275996
|
});
|
|
275850
|
-
return useCase;
|
|
275997
|
+
return platformConfig.smartContractSets.sets.find((set) => set.id === useCase);
|
|
275851
275998
|
}
|
|
275852
275999
|
|
|
275853
276000
|
// src/commands/smart-contract-set/create.ts
|
|
275854
276001
|
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").
|
|
276002
|
+
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
276003
|
intro("Creating a new smart contract set");
|
|
275857
276004
|
const env2 = await loadEnv2(false, !!prod);
|
|
275858
276005
|
const name2 = await namePrompt(env2, projectName);
|
|
276006
|
+
const instance = await instancePrompt(env2, true);
|
|
276007
|
+
const accessToken = await getApplicationOrPersonalAccessToken({
|
|
276008
|
+
env: env2,
|
|
276009
|
+
instance,
|
|
276010
|
+
prefer: "personal"
|
|
276011
|
+
});
|
|
276012
|
+
const settlemint = createSettleMintClient({
|
|
276013
|
+
accessToken,
|
|
276014
|
+
instance
|
|
276015
|
+
});
|
|
276016
|
+
const platformConfig = await settlemint.platform.config();
|
|
276017
|
+
const selectedUseCase = await useCasePrompt(platformConfig, useCase);
|
|
276018
|
+
if (!selectedUseCase) {
|
|
276019
|
+
return nothingSelectedError("use case");
|
|
276020
|
+
}
|
|
275859
276021
|
const targetDir = formatTargetDir(name2);
|
|
275860
276022
|
const projectDir = join8(process.cwd(), targetDir);
|
|
275861
276023
|
if (await exists2(projectDir) && !await isEmpty(projectDir)) {
|
|
@@ -275868,24 +276030,16 @@ function createCommand4() {
|
|
|
275868
276030
|
}
|
|
275869
276031
|
await rmdir(projectDir, { recursive: true });
|
|
275870
276032
|
}
|
|
275871
|
-
const selectedUseCase = await useCasePrompt(useCase);
|
|
275872
|
-
if (!selectedUseCase) {
|
|
275873
|
-
cancel("No use case selected. Please select a use case to continue.");
|
|
275874
|
-
}
|
|
275875
276033
|
await spinner({
|
|
275876
276034
|
startMessage: "Scaffolding the smart contract set",
|
|
275877
276035
|
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
276036
|
await executeCommand("forge", [
|
|
275883
276037
|
"init",
|
|
275884
276038
|
name2,
|
|
275885
276039
|
"--template",
|
|
275886
|
-
|
|
276040
|
+
selectedUseCase.image.repository,
|
|
275887
276041
|
"--branch",
|
|
275888
|
-
`v${
|
|
276042
|
+
`v${selectedUseCase.image.tag}`
|
|
275889
276043
|
]);
|
|
275890
276044
|
await setName(name2, projectDir);
|
|
275891
276045
|
},
|
|
@@ -276164,6 +276318,9 @@ function hardhatDeployRemoteCommand() {
|
|
|
276164
276318
|
const nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
|
|
276165
276319
|
let node = undefined;
|
|
276166
276320
|
if (!nodeUniqueName) {
|
|
276321
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276322
|
+
return missingApplication();
|
|
276323
|
+
}
|
|
276167
276324
|
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276168
276325
|
const evmNodes = nodes.filter((node2) => node2.isEvm);
|
|
276169
276326
|
if (evmNodes.length === 0) {
|
|
@@ -276174,9 +276331,9 @@ function hardhatDeployRemoteCommand() {
|
|
|
276174
276331
|
if (nodesWithActivePrivateKey.length === 0) {
|
|
276175
276332
|
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276176
276333
|
}
|
|
276177
|
-
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey,
|
|
276334
|
+
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
|
|
276178
276335
|
if (!blockchainNode) {
|
|
276179
|
-
|
|
276336
|
+
return nothingSelectedError("EVM blockchain node");
|
|
276180
276337
|
}
|
|
276181
276338
|
node = blockchainNode;
|
|
276182
276339
|
} else {
|
|
@@ -276192,7 +276349,7 @@ function hardhatDeployRemoteCommand() {
|
|
|
276192
276349
|
}
|
|
276193
276350
|
const address = await addressPrompt({ env: env2, accept: autoAccept, prod, node, hardhatConfig });
|
|
276194
276351
|
if (!address) {
|
|
276195
|
-
|
|
276352
|
+
return nothingSelectedError("private key");
|
|
276196
276353
|
}
|
|
276197
276354
|
const { command, args } = await getPackageManagerExecutable();
|
|
276198
276355
|
await executeCommand(command, [
|
|
@@ -276276,14 +276433,31 @@ function hardhatScriptRemoteCommand() {
|
|
|
276276
276433
|
accessToken,
|
|
276277
276434
|
instance
|
|
276278
276435
|
});
|
|
276279
|
-
let nodeUniqueName = blockchainNodeUniqueName;
|
|
276436
|
+
let nodeUniqueName = blockchainNodeUniqueName ?? (autoAccept ? env2.SETTLEMINT_BLOCKCHAIN_NODE : undefined);
|
|
276280
276437
|
if (!nodeUniqueName) {
|
|
276281
|
-
|
|
276282
|
-
|
|
276438
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276439
|
+
return missingApplication();
|
|
276440
|
+
}
|
|
276441
|
+
const nodes = await settlemint.blockchainNode.list(env2.SETTLEMINT_APPLICATION);
|
|
276442
|
+
const evmNodes = nodes.filter((node) => node.isEvm);
|
|
276443
|
+
if (evmNodes.length === 0) {
|
|
276444
|
+
cancel("No EVM blockchain nodes found. Please create an EVM blockchain node and try again.");
|
|
276445
|
+
}
|
|
276446
|
+
const nodesWithPrivateKey = await Promise.all(nodes.map((node) => settlemint.blockchainNode.read(node.uniqueName)));
|
|
276447
|
+
const nodesWithActivePrivateKey = nodesWithPrivateKey.filter((node) => node.privateKeys && node.privateKeys.length > 0);
|
|
276448
|
+
if (nodesWithActivePrivateKey.length === 0) {
|
|
276449
|
+
cancel("No EVM blockchain nodes with private keys found. Please activate a private key on your EVM blockchain node and try again.");
|
|
276450
|
+
}
|
|
276451
|
+
const blockchainNode = await blockchainNodePrompt(env2, nodesWithActivePrivateKey, acceptDefaults);
|
|
276283
276452
|
if (!blockchainNode) {
|
|
276284
|
-
|
|
276453
|
+
return nothingSelectedError("EVM blockchain node");
|
|
276285
276454
|
}
|
|
276286
276455
|
nodeUniqueName = blockchainNode.uniqueName;
|
|
276456
|
+
} else {
|
|
276457
|
+
const node = await settlemint.blockchainNode.read(nodeUniqueName);
|
|
276458
|
+
if (!node.isEvm) {
|
|
276459
|
+
cancel("The specified blockchain node is not an EVM blockchain node. Please specify an EVM blockchain node to continue.");
|
|
276460
|
+
}
|
|
276287
276461
|
}
|
|
276288
276462
|
const envConfig = await settlemint.foundry.env(nodeUniqueName);
|
|
276289
276463
|
const { command, args } = await getPackageManagerExecutable();
|
|
@@ -276502,6 +276676,9 @@ async function getTheGraphMiddleware({
|
|
|
276502
276676
|
return defaultTheGraphMiddleware;
|
|
276503
276677
|
}
|
|
276504
276678
|
}
|
|
276679
|
+
if (!env2.SETTLEMINT_APPLICATION) {
|
|
276680
|
+
return missingApplication();
|
|
276681
|
+
}
|
|
276505
276682
|
const middlewares = await settlemintClient.middleware.list(env2.SETTLEMINT_APPLICATION);
|
|
276506
276683
|
return theGraphPrompt(env2, middlewares, autoAccept);
|
|
276507
276684
|
}
|
|
@@ -276611,7 +276788,7 @@ function subgraphDeployCommand() {
|
|
|
276611
276788
|
});
|
|
276612
276789
|
const theGraphMiddleware = await getTheGraphMiddleware({ env: env2, instance, accessToken, autoAccept });
|
|
276613
276790
|
if (!theGraphMiddleware) {
|
|
276614
|
-
|
|
276791
|
+
return nothingSelectedError("graph middleware");
|
|
276615
276792
|
}
|
|
276616
276793
|
const network = await getTheGraphNetwork({ theGraphMiddleware, env: env2, instance, accessToken });
|
|
276617
276794
|
await subgraphSetup({
|
|
@@ -276714,4 +276891,4 @@ function sdkCliCommand(exitOverride = undefined) {
|
|
|
276714
276891
|
ascii();
|
|
276715
276892
|
sdkCliCommand();
|
|
276716
276893
|
|
|
276717
|
-
//# debugId=
|
|
276894
|
+
//# debugId=2FB88CE1A66FD83164756E2164756E21
|