@caatinga/core 0.2.3 → 2.0.0
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 +2 -2
- package/dist/{browser-CuET2GqM.d.cts → browser-djYObNl8.d.cts} +0 -1
- package/dist/{browser-CuET2GqM.d.ts → browser-djYObNl8.d.ts} +0 -1
- package/dist/browser.cjs +0 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +72 -5
- package/dist/index.cjs +142 -79
- package/dist/index.d.cts +37 -16
- package/dist/index.d.ts +37 -16
- package/dist/index.js +211 -81
- package/dist/runtime/requirements.cjs +50 -0
- package/dist/runtime/requirements.d.cts +5 -0
- package/dist/runtime/requirements.d.ts +5 -0
- package/dist/runtime/requirements.js +12 -0
- package/package.json +7 -2
- package/dist/browser-DUcSR5D3.d.cts +0 -173
- package/dist/browser-DUcSR5D3.d.ts +0 -173
- package/dist/chunk-EKHNKCJV.js +0 -79
- package/dist/chunk-GMABXVEY.js +0 -78
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ Most applications should install `@caatinga/cli` or `@caatinga/client` instead o
|
|
|
27
27
|
- `buildDependencyGraph`, `resolveDeployOrder`, `resolveDeployArgs`
|
|
28
28
|
- `generateBindings`, `invokeContract`, `parseInvokeTarget`
|
|
29
29
|
- `resolveContract`, `parseContractId`
|
|
30
|
-
- Stellar CLI
|
|
30
|
+
- Stellar CLI compatibility — `parseStellarCliVersion`, `checkStellarCliVersion`, `evaluateStellarCliCompatibility`, and the `STELLAR_CLI_MIN_VERSION` / `STELLAR_CLI_LAST_TESTED_VERSION` constants. The compatibility model is feature-aware: the hard floor (`23.0.0`) is the only hard failure, the last-tested version is advisory, and the optional `features` argument is a forward-compatible hook for capability checks. See the [Stellar CLI version contract](https://github.com/Dione-b/caatinga/blob/main/docs/stellar-cli-version-contract.md) for the full contract.
|
|
31
31
|
|
|
32
32
|
### Templates
|
|
33
33
|
|
|
@@ -87,7 +87,7 @@ Core owns the canonical `CAATINGA_*` enum used by CLI, client, and templates. Au
|
|
|
87
87
|
Common codes surfaced through core-backed commands:
|
|
88
88
|
|
|
89
89
|
- config and artifacts: `CAATINGA_CONFIG_NOT_FOUND`, `CAATINGA_INVALID_CONFIG`, `CAATINGA_ARTIFACT_NOT_FOUND`, `CAATINGA_ARTIFACT_INVALID`
|
|
90
|
-
- Stellar CLI: `CAATINGA_STELLAR_CLI_NOT_FOUND`, `CAATINGA_UNSUPPORTED_CLI_VERSION
|
|
90
|
+
- Stellar CLI: `CAATINGA_STELLAR_CLI_NOT_FOUND`, `CAATINGA_UNSUPPORTED_CLI_VERSION`
|
|
91
91
|
- contracts: `CAATINGA_BUILD_FAILED`, `CAATINGA_DEPLOY_FAILED`, `CAATINGA_BINDINGS_FAILED`, `CAATINGA_INVOKE_FAILED`
|
|
92
92
|
- dependencies: `CAATINGA_CONTRACT_DEPENDENCY_NOT_FOUND`, `CAATINGA_CONTRACT_DEPENDENCY_CYCLE`, `CAATINGA_DEPLOY_ARG_PLACEHOLDER_UNRESOLVED`
|
|
93
93
|
- templates: `CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND`, `CAATINGA_TEMPLATE_INCOMPATIBLE`
|
|
@@ -8,7 +8,6 @@ declare const CaatingaErrorCode: {
|
|
|
8
8
|
readonly STELLAR_CLI_NOT_FOUND: "CAATINGA_STELLAR_CLI_NOT_FOUND";
|
|
9
9
|
readonly STELLAR_CLI_VERSION_PARSE_FAILED: "CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED";
|
|
10
10
|
readonly UNSUPPORTED_CLI_VERSION: "CAATINGA_UNSUPPORTED_CLI_VERSION";
|
|
11
|
-
readonly UNTESTED_CLI_VERSION: "CAATINGA_UNTESTED_CLI_VERSION";
|
|
12
11
|
readonly RUST_NOT_FOUND: "CAATINGA_RUST_NOT_FOUND";
|
|
13
12
|
readonly RUST_TARGET_NOT_FOUND: "CAATINGA_RUST_TARGET_NOT_FOUND";
|
|
14
13
|
readonly DEPLOY_FAILED: "CAATINGA_DEPLOY_FAILED";
|
|
@@ -8,7 +8,6 @@ declare const CaatingaErrorCode: {
|
|
|
8
8
|
readonly STELLAR_CLI_NOT_FOUND: "CAATINGA_STELLAR_CLI_NOT_FOUND";
|
|
9
9
|
readonly STELLAR_CLI_VERSION_PARSE_FAILED: "CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED";
|
|
10
10
|
readonly UNSUPPORTED_CLI_VERSION: "CAATINGA_UNSUPPORTED_CLI_VERSION";
|
|
11
|
-
readonly UNTESTED_CLI_VERSION: "CAATINGA_UNTESTED_CLI_VERSION";
|
|
12
11
|
readonly RUST_NOT_FOUND: "CAATINGA_RUST_NOT_FOUND";
|
|
13
12
|
readonly RUST_TARGET_NOT_FOUND: "CAATINGA_RUST_TARGET_NOT_FOUND";
|
|
14
13
|
readonly DEPLOY_FAILED: "CAATINGA_DEPLOY_FAILED";
|
package/dist/browser.cjs
CHANGED
|
@@ -35,7 +35,6 @@ var CaatingaErrorCode = {
|
|
|
35
35
|
STELLAR_CLI_NOT_FOUND: "CAATINGA_STELLAR_CLI_NOT_FOUND",
|
|
36
36
|
STELLAR_CLI_VERSION_PARSE_FAILED: "CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED",
|
|
37
37
|
UNSUPPORTED_CLI_VERSION: "CAATINGA_UNSUPPORTED_CLI_VERSION",
|
|
38
|
-
UNTESTED_CLI_VERSION: "CAATINGA_UNTESTED_CLI_VERSION",
|
|
39
38
|
RUST_NOT_FOUND: "CAATINGA_RUST_NOT_FOUND",
|
|
40
39
|
RUST_TARGET_NOT_FOUND: "CAATINGA_RUST_TARGET_NOT_FOUND",
|
|
41
40
|
DEPLOY_FAILED: "CAATINGA_DEPLOY_FAILED",
|
package/dist/browser.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as CaatingaArtifacts, c as CaatingaError, e as CaatingaErrorCode, a as ContractArtifact, t as toCaatingaError } from './browser-
|
|
1
|
+
export { C as CaatingaArtifacts, c as CaatingaError, e as CaatingaErrorCode, a as ContractArtifact, t as toCaatingaError } from './browser-djYObNl8.cjs';
|
|
2
2
|
import 'zod';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { C as CaatingaArtifacts, c as CaatingaError, e as CaatingaErrorCode, a as ContractArtifact, t as toCaatingaError } from './browser-
|
|
1
|
+
export { C as CaatingaArtifacts, c as CaatingaError, e as CaatingaErrorCode, a as ContractArtifact, t as toCaatingaError } from './browser-djYObNl8.js';
|
|
2
2
|
import 'zod';
|
package/dist/browser.js
CHANGED
|
@@ -1,8 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
// src/errors/CaatingaErrorCode.ts
|
|
2
|
+
var CaatingaErrorCode = {
|
|
3
|
+
CONFIG_NOT_FOUND: "CAATINGA_CONFIG_NOT_FOUND",
|
|
4
|
+
INVALID_CONFIG: "CAATINGA_INVALID_CONFIG",
|
|
5
|
+
COMMAND_FAILED: "CAATINGA_COMMAND_FAILED",
|
|
6
|
+
UNEXPECTED_ERROR: "CAATINGA_UNEXPECTED_ERROR",
|
|
7
|
+
STELLAR_CLI_NOT_FOUND: "CAATINGA_STELLAR_CLI_NOT_FOUND",
|
|
8
|
+
STELLAR_CLI_VERSION_PARSE_FAILED: "CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED",
|
|
9
|
+
UNSUPPORTED_CLI_VERSION: "CAATINGA_UNSUPPORTED_CLI_VERSION",
|
|
10
|
+
RUST_NOT_FOUND: "CAATINGA_RUST_NOT_FOUND",
|
|
11
|
+
RUST_TARGET_NOT_FOUND: "CAATINGA_RUST_TARGET_NOT_FOUND",
|
|
12
|
+
DEPLOY_FAILED: "CAATINGA_DEPLOY_FAILED",
|
|
13
|
+
BUILD_FAILED: "CAATINGA_BUILD_FAILED",
|
|
14
|
+
BINDINGS_FAILED: "CAATINGA_BINDINGS_FAILED",
|
|
15
|
+
INVOKE_FAILED: "CAATINGA_INVOKE_FAILED",
|
|
16
|
+
CONTRACT_NOT_FOUND: "CAATINGA_CONTRACT_NOT_FOUND",
|
|
17
|
+
NETWORK_NOT_FOUND: "CAATINGA_NETWORK_NOT_FOUND",
|
|
18
|
+
ARTIFACT_NOT_FOUND: "CAATINGA_ARTIFACT_NOT_FOUND",
|
|
19
|
+
ARTIFACT_INVALID: "CAATINGA_ARTIFACT_INVALID",
|
|
20
|
+
CONTRACT_ID_NOT_FOUND: "CAATINGA_CONTRACT_ID_NOT_FOUND",
|
|
21
|
+
CONTRACT_ARTIFACT_NOT_FOUND: "CAATINGA_CONTRACT_ARTIFACT_NOT_FOUND",
|
|
22
|
+
CONTRACT_DEPENDENCY_NOT_FOUND: "CAATINGA_CONTRACT_DEPENDENCY_NOT_FOUND",
|
|
23
|
+
CONTRACT_DEPENDENCY_CYCLE: "CAATINGA_CONTRACT_DEPENDENCY_CYCLE",
|
|
24
|
+
CONTRACT_DEPENDENCY_ARTIFACT_NOT_FOUND: "CAATINGA_CONTRACT_DEPENDENCY_ARTIFACT_NOT_FOUND",
|
|
25
|
+
DEPENDENCY_CONTRACT_NOT_FOUND: "CAATINGA_DEPENDENCY_CONTRACT_NOT_FOUND",
|
|
26
|
+
DEPLOY_ARG_PLACEHOLDER_INVALID: "CAATINGA_DEPLOY_ARG_PLACEHOLDER_INVALID",
|
|
27
|
+
DEPLOY_ARG_PLACEHOLDER_UNRESOLVED: "CAATINGA_DEPLOY_ARG_PLACEHOLDER_UNRESOLVED",
|
|
28
|
+
BINDING_CLIENT_NOT_FOUND: "CAATINGA_BINDING_CLIENT_NOT_FOUND",
|
|
29
|
+
BINDING_METHOD_NOT_FOUND: "CAATINGA_BINDING_METHOD_NOT_FOUND",
|
|
30
|
+
XDR_BUILD_FAILED: "CAATINGA_XDR_BUILD_FAILED",
|
|
31
|
+
XDR_PREPARE_FAILED: "CAATINGA_XDR_PREPARE_FAILED",
|
|
32
|
+
XDR_SIGN_FAILED: "CAATINGA_XDR_SIGN_FAILED",
|
|
33
|
+
XDR_SUBMIT_FAILED: "CAATINGA_XDR_SUBMIT_FAILED",
|
|
34
|
+
XDR_RESULT_FAILED: "CAATINGA_XDR_RESULT_FAILED",
|
|
35
|
+
READ_RESULT_MISSING: "CAATINGA_READ_RESULT_MISSING",
|
|
36
|
+
WALLET_NOT_CONNECTED: "CAATINGA_WALLET_NOT_CONNECTED",
|
|
37
|
+
WALLET_TIMEOUT: "CAATINGA_WALLET_TIMEOUT",
|
|
38
|
+
SOURCE_ACCOUNT_REQUIRED: "CAATINGA_SOURCE_ACCOUNT_REQUIRED",
|
|
39
|
+
SOURCE_IS_SECRET_KEY: "CAATINGA_SOURCE_IS_SECRET_KEY",
|
|
40
|
+
SOURCE_IS_SEED_PHRASE: "CAATINGA_SOURCE_IS_SEED_PHRASE",
|
|
41
|
+
SOURCE_IS_PUBLIC_KEY: "CAATINGA_SOURCE_IS_PUBLIC_KEY",
|
|
42
|
+
UNSAFE_SOURCE_ACCOUNT: "CAATINGA_UNSAFE_SOURCE_ACCOUNT",
|
|
43
|
+
INVOKE_TARGET_INVALID: "CAATINGA_INVOKE_TARGET_INVALID",
|
|
44
|
+
TEMPLATE_NOT_FOUND: "CAATINGA_TEMPLATE_NOT_FOUND",
|
|
45
|
+
INVALID_TEMPLATE_MANIFEST: "CAATINGA_INVALID_TEMPLATE_MANIFEST",
|
|
46
|
+
TEMPLATE_MANIFEST_NOT_FOUND: "CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND",
|
|
47
|
+
TEMPLATE_INCOMPATIBLE: "CAATINGA_TEMPLATE_INCOMPATIBLE",
|
|
48
|
+
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY"
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/errors/CaatingaError.ts
|
|
52
|
+
var CaatingaError = class extends Error {
|
|
53
|
+
constructor(message, code, hint, cause) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.code = code;
|
|
56
|
+
this.hint = hint;
|
|
57
|
+
this.cause = cause;
|
|
58
|
+
this.name = "CaatingaError";
|
|
59
|
+
}
|
|
60
|
+
code;
|
|
61
|
+
hint;
|
|
62
|
+
cause;
|
|
63
|
+
};
|
|
64
|
+
function toCaatingaError(error) {
|
|
65
|
+
if (error instanceof CaatingaError) {
|
|
66
|
+
return error;
|
|
67
|
+
}
|
|
68
|
+
if (error instanceof Error) {
|
|
69
|
+
return new CaatingaError(error.message, CaatingaErrorCode.UNEXPECTED_ERROR, void 0, error);
|
|
70
|
+
}
|
|
71
|
+
return new CaatingaError("An unexpected error occurred.", CaatingaErrorCode.UNEXPECTED_ERROR);
|
|
72
|
+
}
|
|
6
73
|
export {
|
|
7
74
|
CaatingaError,
|
|
8
75
|
CaatingaErrorCode,
|
package/dist/index.cjs
CHANGED
|
@@ -35,19 +35,20 @@ __export(index_exports, {
|
|
|
35
35
|
CaatingaConfigSchema: () => CaatingaConfigSchema,
|
|
36
36
|
CaatingaError: () => CaatingaError,
|
|
37
37
|
CaatingaErrorCode: () => CaatingaErrorCode,
|
|
38
|
+
STELLAR_CLI_LAST_TESTED_VERSION: () => STELLAR_CLI_LAST_TESTED_VERSION,
|
|
38
39
|
STELLAR_CLI_MIN_VERSION: () => STELLAR_CLI_MIN_VERSION,
|
|
39
|
-
STELLAR_CLI_TESTED_MAX_VERSION: () => STELLAR_CLI_TESTED_MAX_VERSION,
|
|
40
40
|
TemplateManifestSchema: () => TemplateManifestSchema,
|
|
41
41
|
WELL_KNOWN_NETWORKS: () => WELL_KNOWN_NETWORKS,
|
|
42
|
-
assertSupportedStellarCliVersion: () => assertSupportedStellarCliVersion,
|
|
43
42
|
buildContract: () => buildContract,
|
|
44
43
|
buildDependencyGraph: () => buildDependencyGraph,
|
|
45
44
|
checkBinary: () => checkBinary,
|
|
45
|
+
checkStellarCliVersion: () => checkStellarCliVersion,
|
|
46
46
|
createInitialArtifacts: () => createInitialArtifacts,
|
|
47
47
|
createProjectFromTemplate: () => createProjectFromTemplate,
|
|
48
48
|
defineConfig: () => defineConfig,
|
|
49
49
|
deployContract: () => deployContract,
|
|
50
50
|
deployContractGraph: () => deployContractGraph,
|
|
51
|
+
evaluateStellarCliCompatibility: () => evaluateStellarCliCompatibility,
|
|
51
52
|
generateBindings: () => generateBindings,
|
|
52
53
|
invokeContract: () => invokeContract,
|
|
53
54
|
isTransientTestnetSmokeFailure: () => isTransientTestnetSmokeFailure,
|
|
@@ -77,7 +78,6 @@ var CaatingaErrorCode = {
|
|
|
77
78
|
STELLAR_CLI_NOT_FOUND: "CAATINGA_STELLAR_CLI_NOT_FOUND",
|
|
78
79
|
STELLAR_CLI_VERSION_PARSE_FAILED: "CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED",
|
|
79
80
|
UNSUPPORTED_CLI_VERSION: "CAATINGA_UNSUPPORTED_CLI_VERSION",
|
|
80
|
-
UNTESTED_CLI_VERSION: "CAATINGA_UNTESTED_CLI_VERSION",
|
|
81
81
|
RUST_NOT_FOUND: "CAATINGA_RUST_NOT_FOUND",
|
|
82
82
|
RUST_TARGET_NOT_FOUND: "CAATINGA_RUST_TARGET_NOT_FOUND",
|
|
83
83
|
DEPLOY_FAILED: "CAATINGA_DEPLOY_FAILED",
|
|
@@ -143,7 +143,7 @@ function toCaatingaError(error) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// src/version.ts
|
|
146
|
-
var CAATINGA_CORE_VERSION = "0.
|
|
146
|
+
var CAATINGA_CORE_VERSION = "2.0.0";
|
|
147
147
|
|
|
148
148
|
// src/config/config.schema.ts
|
|
149
149
|
var import_zod = require("zod");
|
|
@@ -273,11 +273,20 @@ async function writeArtifacts(artifacts, cwd = process.cwd()) {
|
|
|
273
273
|
`, "utf8");
|
|
274
274
|
return artifactsPath;
|
|
275
275
|
}
|
|
276
|
-
function createInitialArtifacts(project) {
|
|
276
|
+
function createInitialArtifacts(project, options = {}) {
|
|
277
|
+
const networks = Object.fromEntries(
|
|
278
|
+
Array.from(new Set(options.networks ?? [])).map((network) => [
|
|
279
|
+
network,
|
|
280
|
+
{
|
|
281
|
+
contracts: {},
|
|
282
|
+
dependencyGraph: {}
|
|
283
|
+
}
|
|
284
|
+
])
|
|
285
|
+
);
|
|
277
286
|
return {
|
|
278
287
|
project,
|
|
279
288
|
version: 1,
|
|
280
|
-
networks
|
|
289
|
+
networks
|
|
281
290
|
};
|
|
282
291
|
}
|
|
283
292
|
|
|
@@ -329,10 +338,12 @@ function resolveNetwork(config, networkName) {
|
|
|
329
338
|
// src/shell/run-command.ts
|
|
330
339
|
var import_execa = require("execa");
|
|
331
340
|
|
|
341
|
+
// src/stellar-cli/compat.ts
|
|
342
|
+
var import_semver2 = __toESM(require("semver"), 1);
|
|
343
|
+
|
|
332
344
|
// src/stellar-cli/version.ts
|
|
333
345
|
var import_semver = __toESM(require("semver"), 1);
|
|
334
346
|
var STELLAR_CLI_MIN_VERSION = "23.0.0";
|
|
335
|
-
var STELLAR_CLI_TESTED_MAX_VERSION = "25.2.0";
|
|
336
347
|
var STELLAR_CLI_SEMVER_REGEX = /\b(\d+\.\d+\.\d+(?:-[0-9A-Za-z-.]+)?(?:\+[0-9A-Za-z-.]+)?)\b/;
|
|
337
348
|
function parseStellarCliVersion(output) {
|
|
338
349
|
const match = output.match(STELLAR_CLI_SEMVER_REGEX);
|
|
@@ -346,43 +357,66 @@ function parseStellarCliVersion(output) {
|
|
|
346
357
|
}
|
|
347
358
|
return version;
|
|
348
359
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
360
|
+
|
|
361
|
+
// src/stellar-cli/compat.ts
|
|
362
|
+
var STELLAR_CLI_LAST_TESTED_VERSION = "25.2.0";
|
|
363
|
+
function evaluateStellarCliCompatibility(input) {
|
|
364
|
+
const parsed = import_semver2.default.parse(input.version);
|
|
365
|
+
if (!parsed || !import_semver2.default.valid(input.version)) {
|
|
352
366
|
throw new CaatingaError(
|
|
353
367
|
"Could not parse Stellar CLI version.",
|
|
354
368
|
CaatingaErrorCode.STELLAR_CLI_VERSION_PARSE_FAILED,
|
|
355
369
|
"Use a semantic version such as 22.0.1."
|
|
356
370
|
);
|
|
357
371
|
}
|
|
358
|
-
|
|
372
|
+
const lastTestedVersion = import_semver2.default.valid(input.lastTestedVersion ?? STELLAR_CLI_LAST_TESTED_VERSION) ?? STELLAR_CLI_LAST_TESTED_VERSION;
|
|
373
|
+
const warnings = [];
|
|
374
|
+
let status = "supported";
|
|
375
|
+
if (import_semver2.default.lt(parsed, STELLAR_CLI_MIN_VERSION)) {
|
|
359
376
|
throw new CaatingaError(
|
|
360
|
-
`Stellar CLI ${
|
|
377
|
+
`Stellar CLI ${input.version} is below the supported minimum ${STELLAR_CLI_MIN_VERSION}.`,
|
|
361
378
|
CaatingaErrorCode.UNSUPPORTED_CLI_VERSION,
|
|
362
379
|
`Install Stellar CLI ${STELLAR_CLI_MIN_VERSION} or newer.`
|
|
363
380
|
);
|
|
364
381
|
}
|
|
365
|
-
if (
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
382
|
+
if (import_semver2.default.gt(parsed, lastTestedVersion)) {
|
|
383
|
+
status = "untested";
|
|
384
|
+
warnings.push({
|
|
385
|
+
code: "STELLAR_CLI_UNTESTED_VERSION",
|
|
386
|
+
message: `Stellar CLI ${input.version} is newer than the last-tested ${lastTestedVersion}; proceeding without compatibility guarantees.`,
|
|
387
|
+
remediation: "Pin Stellar CLI to the last-tested version, or update Caatinga after re-running the parser fixtures."
|
|
388
|
+
});
|
|
371
389
|
}
|
|
372
|
-
|
|
390
|
+
if (input.features) {
|
|
391
|
+
for (const feature of input.features) {
|
|
392
|
+
if (!feature) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
status = "untested";
|
|
396
|
+
warnings.push({
|
|
397
|
+
code: "STELLAR_CLI_MISSING_FEATURE",
|
|
398
|
+
message: `Stellar CLI ${input.version} did not advertise the required feature "${feature}".`,
|
|
399
|
+
remediation: "Upgrade Stellar CLI or run `caatinga doctor` for diagnostics."
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
version: input.version,
|
|
405
|
+
status,
|
|
406
|
+
minVersion: STELLAR_CLI_MIN_VERSION,
|
|
407
|
+
lastTestedVersion,
|
|
408
|
+
warnings
|
|
409
|
+
};
|
|
373
410
|
}
|
|
374
411
|
|
|
375
412
|
// src/stellar-cli/check-stellar-cli-version.ts
|
|
376
|
-
async function checkStellarCliVersion(input) {
|
|
413
|
+
async function checkStellarCliVersion(input = {}) {
|
|
414
|
+
let rawOutput;
|
|
377
415
|
try {
|
|
378
416
|
const result = await runCommand("stellar", ["--version"], {
|
|
379
417
|
skipStellarVersionCheck: true
|
|
380
418
|
});
|
|
381
|
-
|
|
382
|
-
return assertSupportedStellarCliVersion({
|
|
383
|
-
version: parseStellarCliVersion(output),
|
|
384
|
-
allowUntested: input.allowUntested
|
|
385
|
-
});
|
|
419
|
+
rawOutput = result.all || result.stdout || result.stderr;
|
|
386
420
|
} catch (error) {
|
|
387
421
|
if (typeof error === "object" && error && "code" in error && error.code === "ENOENT") {
|
|
388
422
|
throw new CaatingaError(
|
|
@@ -394,15 +428,34 @@ async function checkStellarCliVersion(input) {
|
|
|
394
428
|
}
|
|
395
429
|
throw error;
|
|
396
430
|
}
|
|
431
|
+
const report = evaluateStellarCliCompatibility({
|
|
432
|
+
version: parseStellarCliVersion(rawOutput),
|
|
433
|
+
features: input.features,
|
|
434
|
+
lastTestedVersion: input.lastTestedVersion
|
|
435
|
+
});
|
|
436
|
+
for (const warning of report.warnings) {
|
|
437
|
+
if (input.onWarning) {
|
|
438
|
+
input.onWarning(warning);
|
|
439
|
+
} else {
|
|
440
|
+
defaultEmitWarning(warning);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return report;
|
|
444
|
+
}
|
|
445
|
+
function defaultEmitWarning(warning) {
|
|
446
|
+
const lines = [
|
|
447
|
+
`Warning: ${warning.message}`,
|
|
448
|
+
warning.remediation ? ` ${warning.remediation}` : void 0
|
|
449
|
+
].filter((line) => Boolean(line));
|
|
450
|
+
process.stderr.write(`${lines.join("\n")}
|
|
451
|
+
`);
|
|
397
452
|
}
|
|
398
453
|
|
|
399
454
|
// src/shell/run-command.ts
|
|
400
455
|
async function runCommand(command, args, options = {}) {
|
|
401
456
|
try {
|
|
402
457
|
if (command === "stellar" && !options.skipStellarVersionCheck) {
|
|
403
|
-
await checkStellarCliVersion(
|
|
404
|
-
allowUntested: options.allowUntestedStellarCli === true
|
|
405
|
-
});
|
|
458
|
+
await checkStellarCliVersion();
|
|
406
459
|
}
|
|
407
460
|
const result = await (0, import_execa.execa)(command, args, {
|
|
408
461
|
cwd: options.cwd,
|
|
@@ -543,7 +596,6 @@ async function resolveContractIdFromDeploySalt(options) {
|
|
|
543
596
|
...buildStellarNetworkArgsFromConfig(options.network)
|
|
544
597
|
], {
|
|
545
598
|
cwd: options.cwd,
|
|
546
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
547
599
|
skipStellarVersionCheck: true
|
|
548
600
|
});
|
|
549
601
|
return parseContractId(result.all || `${result.stdout}
|
|
@@ -566,8 +618,7 @@ async function tryRecoverContractIdFromDeployFailure(options) {
|
|
|
566
618
|
salt,
|
|
567
619
|
source: options.source,
|
|
568
620
|
network: options.network,
|
|
569
|
-
cwd: options.cwd
|
|
570
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
621
|
+
cwd: options.cwd
|
|
571
622
|
});
|
|
572
623
|
}
|
|
573
624
|
|
|
@@ -717,7 +768,6 @@ function formatStaleWasmWarning(contractName) {
|
|
|
717
768
|
}
|
|
718
769
|
|
|
719
770
|
// src/contracts/build-contract.ts
|
|
720
|
-
var RUST_WASM_TARGET = "wasm32v1-none";
|
|
721
771
|
var MISSING_WASM_TARGET_HINT_SUBSTRINGS = [
|
|
722
772
|
"not installed",
|
|
723
773
|
"not found",
|
|
@@ -735,7 +785,7 @@ function isMissingRustWasmTargetError(error) {
|
|
|
735
785
|
error.cause === void 0 ? "" : String(error.cause)
|
|
736
786
|
];
|
|
737
787
|
const haystack = parts.join("\n").toLowerCase();
|
|
738
|
-
if (!haystack.includes(
|
|
788
|
+
if (!haystack.includes(CURRENT_RUST_WASM_TARGET)) {
|
|
739
789
|
return false;
|
|
740
790
|
}
|
|
741
791
|
return MISSING_WASM_TARGET_HINT_SUBSTRINGS.some((needle) => haystack.includes(needle));
|
|
@@ -744,22 +794,19 @@ async function buildContract(options) {
|
|
|
744
794
|
const cwd = options.cwd ?? process.cwd();
|
|
745
795
|
const contract = resolveContract(options.config, options.contractName, cwd);
|
|
746
796
|
await checkBinary("rustc", "Install Rust before running caatinga build.");
|
|
747
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga build."
|
|
748
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
749
|
-
});
|
|
797
|
+
await checkBinary("stellar", "Install Stellar CLI before running caatinga build.");
|
|
750
798
|
let result;
|
|
751
799
|
try {
|
|
752
800
|
result = await runCommand("stellar", ["contract", "build"], {
|
|
753
801
|
cwd: contract.sourcePath,
|
|
754
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
755
802
|
failureCode: CaatingaErrorCode.BUILD_FAILED
|
|
756
803
|
});
|
|
757
804
|
} catch (error) {
|
|
758
805
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.BUILD_FAILED && isMissingRustWasmTargetError(error)) {
|
|
759
806
|
throw new CaatingaError(
|
|
760
|
-
`Required Rust wasm target "${
|
|
807
|
+
`Required Rust wasm target "${CURRENT_RUST_WASM_TARGET}" is missing.`,
|
|
761
808
|
CaatingaErrorCode.RUST_TARGET_NOT_FOUND,
|
|
762
|
-
`Run \`rustup target add ${
|
|
809
|
+
`Run \`rustup target add ${CURRENT_RUST_WASM_TARGET}\` and retry.`,
|
|
763
810
|
error
|
|
764
811
|
);
|
|
765
812
|
}
|
|
@@ -854,9 +901,7 @@ async function deployContract(options) {
|
|
|
854
901
|
const contract = resolveContract(options.config, options.contractName, cwd);
|
|
855
902
|
const network = resolveNetwork(options.config, options.networkName);
|
|
856
903
|
const source = assertSafeSourceAccount(options.source);
|
|
857
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga deploy."
|
|
858
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
859
|
-
});
|
|
904
|
+
await checkBinary("stellar", "Install Stellar CLI before running caatinga deploy.");
|
|
860
905
|
const wasmPath = await resolveWasmArtifactPath(contract.wasmPath);
|
|
861
906
|
const contractWithWasm = {
|
|
862
907
|
...contract,
|
|
@@ -924,7 +969,6 @@ async function deployContract(options) {
|
|
|
924
969
|
try {
|
|
925
970
|
const result = await runCommand("stellar", stellarArgs, {
|
|
926
971
|
cwd,
|
|
927
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
928
972
|
failureCode: CaatingaErrorCode.DEPLOY_FAILED
|
|
929
973
|
});
|
|
930
974
|
output = result.all || `${result.stdout}
|
|
@@ -939,8 +983,7 @@ ${result.stderr}`;
|
|
|
939
983
|
${error.hint ?? ""}`,
|
|
940
984
|
source,
|
|
941
985
|
network: network.config,
|
|
942
|
-
cwd
|
|
943
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
986
|
+
cwd
|
|
944
987
|
});
|
|
945
988
|
if (!recoveredContractId) {
|
|
946
989
|
throw error;
|
|
@@ -1033,6 +1076,16 @@ function resolveDeployOrder(input) {
|
|
|
1033
1076
|
}
|
|
1034
1077
|
}
|
|
1035
1078
|
|
|
1079
|
+
// src/contracts/deploy-skip.ts
|
|
1080
|
+
function toSkippedContract(name, contractId, network) {
|
|
1081
|
+
return {
|
|
1082
|
+
name,
|
|
1083
|
+
contractId,
|
|
1084
|
+
network,
|
|
1085
|
+
reason: "already-deployed"
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1036
1089
|
// src/contracts/verify-dependency-contract.ts
|
|
1037
1090
|
async function verifyDependencyContract(options) {
|
|
1038
1091
|
try {
|
|
@@ -1045,7 +1098,6 @@ async function verifyDependencyContract(options) {
|
|
|
1045
1098
|
...buildStellarNetworkArgs(options.network)
|
|
1046
1099
|
], {
|
|
1047
1100
|
cwd: options.cwd,
|
|
1048
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
1049
1101
|
failureCode: CaatingaErrorCode.DEPENDENCY_CONTRACT_NOT_FOUND
|
|
1050
1102
|
});
|
|
1051
1103
|
} catch (error) {
|
|
@@ -1074,8 +1126,7 @@ async function verifyDependencyContracts(options) {
|
|
|
1074
1126
|
dependencyName,
|
|
1075
1127
|
contractId: contractArtifact.contractId,
|
|
1076
1128
|
network: options.network,
|
|
1077
|
-
cwd: options.cwd
|
|
1078
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
1129
|
+
cwd: options.cwd
|
|
1079
1130
|
});
|
|
1080
1131
|
}
|
|
1081
1132
|
}
|
|
@@ -1101,8 +1152,7 @@ async function deployContractGraph(options) {
|
|
|
1101
1152
|
dependencies: contractConfig.dependsOn,
|
|
1102
1153
|
artifacts,
|
|
1103
1154
|
network,
|
|
1104
|
-
cwd
|
|
1105
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
1155
|
+
cwd
|
|
1106
1156
|
});
|
|
1107
1157
|
}
|
|
1108
1158
|
const resolvedDeployArgs = resolveDeployArgs({
|
|
@@ -1111,12 +1161,9 @@ async function deployContractGraph(options) {
|
|
|
1111
1161
|
network: network.name
|
|
1112
1162
|
});
|
|
1113
1163
|
if (existing?.contractId && !options.force) {
|
|
1114
|
-
skippedContracts.push(
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
network: network.name,
|
|
1118
|
-
reason: "already-deployed"
|
|
1119
|
-
});
|
|
1164
|
+
skippedContracts.push(
|
|
1165
|
+
toSkippedContract(contractName, existing.contractId, network.name)
|
|
1166
|
+
);
|
|
1120
1167
|
continue;
|
|
1121
1168
|
}
|
|
1122
1169
|
const result = await deployContract({
|
|
@@ -1125,7 +1172,6 @@ async function deployContractGraph(options) {
|
|
|
1125
1172
|
networkName: network.name,
|
|
1126
1173
|
source: options.source,
|
|
1127
1174
|
cwd,
|
|
1128
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
1129
1175
|
force: options.force,
|
|
1130
1176
|
checkStaleWasm: options.checkStaleWasm,
|
|
1131
1177
|
resolvedDeployArgs,
|
|
@@ -1138,12 +1184,9 @@ async function deployContractGraph(options) {
|
|
|
1138
1184
|
});
|
|
1139
1185
|
}
|
|
1140
1186
|
if (result.skipped) {
|
|
1141
|
-
skippedContracts.push(
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
network: network.name,
|
|
1145
|
-
reason: "already-deployed"
|
|
1146
|
-
});
|
|
1187
|
+
skippedContracts.push(
|
|
1188
|
+
toSkippedContract(contractName, result.contractId, network.name)
|
|
1189
|
+
);
|
|
1147
1190
|
} else {
|
|
1148
1191
|
deployedContracts.push({ name: contractName, contractId: result.contractId });
|
|
1149
1192
|
}
|
|
@@ -1171,9 +1214,7 @@ async function generateBindings(options) {
|
|
|
1171
1214
|
"Run caatinga deploy for this contract and network before generating bindings."
|
|
1172
1215
|
);
|
|
1173
1216
|
}
|
|
1174
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga generate."
|
|
1175
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
1176
|
-
});
|
|
1217
|
+
await checkBinary("stellar", "Install Stellar CLI before running caatinga generate.");
|
|
1177
1218
|
const outputDir = import_node_path7.default.resolve(cwd, options.config.frontend.bindingsOutput, options.contractName);
|
|
1178
1219
|
await (0, import_promises5.mkdir)(outputDir, { recursive: true });
|
|
1179
1220
|
const result = await runCommand("stellar", [
|
|
@@ -1188,7 +1229,6 @@ async function generateBindings(options) {
|
|
|
1188
1229
|
...buildStellarNetworkArgs(network)
|
|
1189
1230
|
], {
|
|
1190
1231
|
cwd,
|
|
1191
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
1192
1232
|
failureCode: CaatingaErrorCode.BINDINGS_FAILED
|
|
1193
1233
|
});
|
|
1194
1234
|
return {
|
|
@@ -1226,9 +1266,7 @@ async function invokeContract(options) {
|
|
|
1226
1266
|
"Run caatinga deploy for this contract and network before invoking it."
|
|
1227
1267
|
);
|
|
1228
1268
|
}
|
|
1229
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga invoke."
|
|
1230
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli
|
|
1231
|
-
});
|
|
1269
|
+
await checkBinary("stellar", "Install Stellar CLI before running caatinga invoke.");
|
|
1232
1270
|
let result;
|
|
1233
1271
|
try {
|
|
1234
1272
|
result = await runCommand("stellar", [
|
|
@@ -1244,7 +1282,6 @@ async function invokeContract(options) {
|
|
|
1244
1282
|
...options.args ?? []
|
|
1245
1283
|
], {
|
|
1246
1284
|
cwd,
|
|
1247
|
-
allowUntestedStellarCli: options.allowUntestedStellarCli,
|
|
1248
1285
|
failureCode: CaatingaErrorCode.INVOKE_FAILED
|
|
1249
1286
|
});
|
|
1250
1287
|
} catch (error) {
|
|
@@ -1280,7 +1317,7 @@ var import_zod6 = require("zod");
|
|
|
1280
1317
|
|
|
1281
1318
|
// src/templates/template-manifest.schema.ts
|
|
1282
1319
|
var import_zod5 = require("zod");
|
|
1283
|
-
var
|
|
1320
|
+
var import_semver3 = __toESM(require("semver"), 1);
|
|
1284
1321
|
var CURRENT_TEMPLATE_VERSION = 1;
|
|
1285
1322
|
var TemplateManifestSchema = import_zod5.z.object({
|
|
1286
1323
|
name: import_zod5.z.string().min(1),
|
|
@@ -1304,14 +1341,14 @@ var TemplateManifestSchema = import_zod5.z.object({
|
|
|
1304
1341
|
})
|
|
1305
1342
|
});
|
|
1306
1343
|
function defaultCompatibleCoreRange(coreVersion = CAATINGA_CORE_VERSION) {
|
|
1307
|
-
const version =
|
|
1344
|
+
const version = import_semver3.default.valid(import_semver3.default.coerce(coreVersion));
|
|
1308
1345
|
if (!version) {
|
|
1309
1346
|
throw new Error(`Invalid core version: ${coreVersion}`);
|
|
1310
1347
|
}
|
|
1311
1348
|
return `^${version}`;
|
|
1312
1349
|
}
|
|
1313
1350
|
function isCoreVersionCompatible(range, coreVersion = CAATINGA_CORE_VERSION) {
|
|
1314
|
-
return
|
|
1351
|
+
return import_semver3.default.satisfies(coreVersion, range);
|
|
1315
1352
|
}
|
|
1316
1353
|
function getTemplateCompatibilityIssue(manifest, coreVersion = CAATINGA_CORE_VERSION) {
|
|
1317
1354
|
if (manifest.caatinga.templateVersion !== CURRENT_TEMPLATE_VERSION) {
|
|
@@ -1344,6 +1381,12 @@ function formatTemplateCompatibilityHint(issue) {
|
|
|
1344
1381
|
}
|
|
1345
1382
|
|
|
1346
1383
|
// src/templates/create-project-from-template.ts
|
|
1384
|
+
var TEMPLATE_COPY_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
|
|
1385
|
+
"target",
|
|
1386
|
+
"test_snapshots",
|
|
1387
|
+
"node_modules",
|
|
1388
|
+
".git"
|
|
1389
|
+
]);
|
|
1347
1390
|
async function createProjectFromTemplate(options) {
|
|
1348
1391
|
const targetDir = import_node_path8.default.resolve(options.targetDir);
|
|
1349
1392
|
const templateDir = import_node_path8.default.resolve(options.templateDir);
|
|
@@ -1361,12 +1404,25 @@ async function createProjectFromTemplate(options) {
|
|
|
1361
1404
|
await (0, import_promises6.cp)(templateDir, targetDir, {
|
|
1362
1405
|
recursive: true,
|
|
1363
1406
|
force: false,
|
|
1364
|
-
errorOnExist: true
|
|
1407
|
+
errorOnExist: true,
|
|
1408
|
+
filter: (source) => shouldCopyTemplateEntry(templateDir, source)
|
|
1365
1409
|
});
|
|
1366
1410
|
await replaceTemplateVariables(targetDir, options.projectName);
|
|
1367
|
-
await
|
|
1411
|
+
await ensureArtifacts(targetDir, options.projectName);
|
|
1368
1412
|
return { targetDir, template: manifest };
|
|
1369
1413
|
}
|
|
1414
|
+
async function ensureArtifacts(targetDir, projectName) {
|
|
1415
|
+
try {
|
|
1416
|
+
const artifacts = await readArtifacts(targetDir);
|
|
1417
|
+
await writeArtifacts({ ...artifacts, project: projectName }, targetDir);
|
|
1418
|
+
} catch (error) {
|
|
1419
|
+
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.ARTIFACT_NOT_FOUND) {
|
|
1420
|
+
await writeArtifacts(createInitialArtifacts(projectName, { networks: ["testnet"] }), targetDir);
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
throw error;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1370
1426
|
async function readTemplateManifest(templateDir) {
|
|
1371
1427
|
const manifestPath = import_node_path8.default.join(templateDir, "caatinga.template.json");
|
|
1372
1428
|
try {
|
|
@@ -1418,6 +1474,13 @@ async function replaceTemplateVariables(dir, projectName) {
|
|
|
1418
1474
|
await (0, import_promises6.writeFile)(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
|
|
1419
1475
|
}));
|
|
1420
1476
|
}
|
|
1477
|
+
function shouldCopyTemplateEntry(templateDir, source) {
|
|
1478
|
+
const relativePath = import_node_path8.default.relative(templateDir, source);
|
|
1479
|
+
if (!relativePath || relativePath === ".") {
|
|
1480
|
+
return true;
|
|
1481
|
+
}
|
|
1482
|
+
return !relativePath.split(import_node_path8.default.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
|
|
1483
|
+
}
|
|
1421
1484
|
function isTextTemplateFile(filePath) {
|
|
1422
1485
|
return [
|
|
1423
1486
|
".json",
|
|
@@ -1434,7 +1497,6 @@ function isTextTemplateFile(filePath) {
|
|
|
1434
1497
|
// src/ci/is-transient-testnet-smoke-failure.ts
|
|
1435
1498
|
var NO_RETRY_CAATINGA_SUBSTRINGS = [
|
|
1436
1499
|
"CAATINGA_UNSUPPORTED_CLI_VERSION",
|
|
1437
|
-
"CAATINGA_UNTESTED_CLI_VERSION",
|
|
1438
1500
|
"CAATINGA_STELLAR_CLI_VERSION_PARSE_FAILED",
|
|
1439
1501
|
"CAATINGA_STELLAR_CLI_NOT_FOUND",
|
|
1440
1502
|
"CAATINGA_INVALID_CONFIG",
|
|
@@ -1459,19 +1521,20 @@ function isTransientTestnetSmokeFailure(logText) {
|
|
|
1459
1521
|
CaatingaConfigSchema,
|
|
1460
1522
|
CaatingaError,
|
|
1461
1523
|
CaatingaErrorCode,
|
|
1524
|
+
STELLAR_CLI_LAST_TESTED_VERSION,
|
|
1462
1525
|
STELLAR_CLI_MIN_VERSION,
|
|
1463
|
-
STELLAR_CLI_TESTED_MAX_VERSION,
|
|
1464
1526
|
TemplateManifestSchema,
|
|
1465
1527
|
WELL_KNOWN_NETWORKS,
|
|
1466
|
-
assertSupportedStellarCliVersion,
|
|
1467
1528
|
buildContract,
|
|
1468
1529
|
buildDependencyGraph,
|
|
1469
1530
|
checkBinary,
|
|
1531
|
+
checkStellarCliVersion,
|
|
1470
1532
|
createInitialArtifacts,
|
|
1471
1533
|
createProjectFromTemplate,
|
|
1472
1534
|
defineConfig,
|
|
1473
1535
|
deployContract,
|
|
1474
1536
|
deployContractGraph,
|
|
1537
|
+
evaluateStellarCliCompatibility,
|
|
1475
1538
|
generateBindings,
|
|
1476
1539
|
invokeContract,
|
|
1477
1540
|
isTransientTestnetSmokeFailure,
|