@caatinga/core 2.4.5 → 3.0.1
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 +11 -11
- package/dist/{artifact.schema-DYPk6NgV.d.cts → artifact.schema-CGCFfl0g.d.cts} +1 -0
- package/dist/{artifact.schema-DYPk6NgV.d.ts → artifact.schema-CGCFfl0g.d.ts} +1 -0
- package/dist/artifact.schema-D4r8dyYK.d.cts +185 -0
- package/dist/artifact.schema-D4r8dyYK.d.ts +185 -0
- package/dist/browser.cjs +2 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -1
- package/dist/index.cjs +215 -155
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +215 -155
- package/dist/runtime/requirements.cjs +2 -1
- package/dist/runtime/requirements.js +2 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -48,7 +48,8 @@ var CaatingaErrorCode = {
|
|
|
48
48
|
TEMPLATE_MANIFEST_NOT_FOUND: "CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND",
|
|
49
49
|
TEMPLATE_INCOMPATIBLE: "CAATINGA_TEMPLATE_INCOMPATIBLE",
|
|
50
50
|
ZK_VERIFICATION_FAILED: "CAATINGA_ZK_VERIFICATION_FAILED",
|
|
51
|
-
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY"
|
|
51
|
+
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY",
|
|
52
|
+
MULTI_AUTH_REQUIRED: "CAATINGA_MULTI_AUTH_REQUIRED"
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
// src/errors/CaatingaError.ts
|
|
@@ -120,9 +121,7 @@ function formatCause(cause) {
|
|
|
120
121
|
|
|
121
122
|
// src/version.ts
|
|
122
123
|
import { createRequire } from "module";
|
|
123
|
-
var require2 = createRequire(
|
|
124
|
-
typeof __filename === "string" ? __filename : import.meta.url
|
|
125
|
-
);
|
|
124
|
+
var require2 = createRequire(typeof __filename === "string" ? __filename : import.meta.url);
|
|
126
125
|
var CAATINGA_CORE_VERSION = require2("../package.json").version;
|
|
127
126
|
|
|
128
127
|
// src/config/config.schema.ts
|
|
@@ -769,12 +768,7 @@ function matchesWellKnownNetwork(name, config) {
|
|
|
769
768
|
return known.rpcUrl === config.rpcUrl && known.networkPassphrase === config.networkPassphrase;
|
|
770
769
|
}
|
|
771
770
|
function buildRpcNetworkArgs(config) {
|
|
772
|
-
return [
|
|
773
|
-
"--rpc-url",
|
|
774
|
-
config.rpcUrl,
|
|
775
|
-
"--network-passphrase",
|
|
776
|
-
config.networkPassphrase
|
|
777
|
-
];
|
|
771
|
+
return ["--rpc-url", config.rpcUrl, "--network-passphrase", config.networkPassphrase];
|
|
778
772
|
}
|
|
779
773
|
function buildStellarNetworkArgsFromConfig(config) {
|
|
780
774
|
for (const [name, known] of Object.entries(WELL_KNOWN_NETWORKS)) {
|
|
@@ -828,19 +822,23 @@ async function fetchCreateContractSalt(horizonUrl, transactionHash, fetchImpl =
|
|
|
828
822
|
}
|
|
829
823
|
async function resolveContractIdFromDeploySalt(options) {
|
|
830
824
|
const saltHex = decimalSaltToHex(options.salt);
|
|
831
|
-
const result = await runCommand(
|
|
832
|
-
"
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
825
|
+
const result = await runCommand(
|
|
826
|
+
"stellar",
|
|
827
|
+
[
|
|
828
|
+
"contract",
|
|
829
|
+
"id",
|
|
830
|
+
"wasm",
|
|
831
|
+
"--salt",
|
|
832
|
+
saltHex,
|
|
833
|
+
"--source-account",
|
|
834
|
+
options.source,
|
|
835
|
+
...buildStellarNetworkArgsFromConfig(options.network)
|
|
836
|
+
],
|
|
837
|
+
{
|
|
838
|
+
cwd: options.cwd,
|
|
839
|
+
skipStellarVersionCheck: true
|
|
840
|
+
}
|
|
841
|
+
);
|
|
844
842
|
return parseContractId(result.all || `${result.stdout}
|
|
845
843
|
${result.stderr}`);
|
|
846
844
|
}
|
|
@@ -988,8 +986,12 @@ function buildAlternateWasmCandidates(configuredWasmPath, options) {
|
|
|
988
986
|
addCandidate(path8.join(cargoTargetDir, LEGACY_RUST_WASM_TARGET, "release", fileName));
|
|
989
987
|
}
|
|
990
988
|
if (options?.sourcePath) {
|
|
991
|
-
addCandidate(
|
|
992
|
-
|
|
989
|
+
addCandidate(
|
|
990
|
+
path8.join(options.sourcePath, "target", CURRENT_RUST_WASM_TARGET, "release", fileName)
|
|
991
|
+
);
|
|
992
|
+
addCandidate(
|
|
993
|
+
path8.join(options.sourcePath, "target", LEGACY_RUST_WASM_TARGET, "release", fileName)
|
|
994
|
+
);
|
|
993
995
|
}
|
|
994
996
|
return candidates;
|
|
995
997
|
}
|
|
@@ -1404,17 +1406,21 @@ function toSkippedContract(name, contractId, network) {
|
|
|
1404
1406
|
// src/contracts/verify-dependency-contract.ts
|
|
1405
1407
|
async function verifyDependencyContract(options) {
|
|
1406
1408
|
try {
|
|
1407
|
-
await runCommand(
|
|
1408
|
-
"
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1409
|
+
await runCommand(
|
|
1410
|
+
"stellar",
|
|
1411
|
+
[
|
|
1412
|
+
"contract",
|
|
1413
|
+
"info",
|
|
1414
|
+
"interface",
|
|
1415
|
+
"--contract-id",
|
|
1416
|
+
options.contractId,
|
|
1417
|
+
...buildStellarNetworkArgs(options.network)
|
|
1418
|
+
],
|
|
1419
|
+
{
|
|
1420
|
+
cwd: options.cwd,
|
|
1421
|
+
failureCode: CaatingaErrorCode.DEPENDENCY_CONTRACT_NOT_FOUND
|
|
1422
|
+
}
|
|
1423
|
+
);
|
|
1418
1424
|
} catch (error) {
|
|
1419
1425
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.DEPENDENCY_CONTRACT_NOT_FOUND) {
|
|
1420
1426
|
throw new CaatingaError(
|
|
@@ -1476,9 +1482,7 @@ async function deployContractGraph(options) {
|
|
|
1476
1482
|
network: network.name
|
|
1477
1483
|
});
|
|
1478
1484
|
if (existing?.contractId && !options.force) {
|
|
1479
|
-
skippedContracts.push(
|
|
1480
|
-
toSkippedContract(contractName, existing.contractId, network.name)
|
|
1481
|
-
);
|
|
1485
|
+
skippedContracts.push(toSkippedContract(contractName, existing.contractId, network.name));
|
|
1482
1486
|
continue;
|
|
1483
1487
|
}
|
|
1484
1488
|
const result = await deployContract({
|
|
@@ -1499,9 +1503,7 @@ async function deployContractGraph(options) {
|
|
|
1499
1503
|
});
|
|
1500
1504
|
}
|
|
1501
1505
|
if (result.skipped) {
|
|
1502
|
-
skippedContracts.push(
|
|
1503
|
-
toSkippedContract(contractName, result.contractId, network.name)
|
|
1504
|
-
);
|
|
1506
|
+
skippedContracts.push(toSkippedContract(contractName, result.contractId, network.name));
|
|
1505
1507
|
} else {
|
|
1506
1508
|
deployedContracts.push({ name: contractName, contractId: result.contractId });
|
|
1507
1509
|
}
|
|
@@ -1517,9 +1519,19 @@ async function deployContractGraph(options) {
|
|
|
1517
1519
|
// src/contracts/generate-bindings.ts
|
|
1518
1520
|
import { access as access3, mkdir as mkdir2, unlink } from "fs/promises";
|
|
1519
1521
|
import path10 from "path";
|
|
1522
|
+
|
|
1523
|
+
// src/contracts/build-generate-network-args.ts
|
|
1524
|
+
function buildGenerateNetworkArgs(network) {
|
|
1525
|
+
if (WELL_KNOWN_NETWORKS[network.name]) {
|
|
1526
|
+
return ["--network", network.name, "--rpc-url", network.config.rpcUrl];
|
|
1527
|
+
}
|
|
1528
|
+
return ["--rpc-url", network.config.rpcUrl];
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
// src/contracts/generate-bindings.ts
|
|
1520
1532
|
function toBindingImportPath(bindingsOutput, contractName) {
|
|
1521
1533
|
const normalized = bindingsOutput.replace(/^\.\//, "").split(path10.sep).join("/");
|
|
1522
|
-
return `./${path10.posix.join(normalized, contractName
|
|
1534
|
+
return `./${path10.posix.join(normalized, contractName)}`;
|
|
1523
1535
|
}
|
|
1524
1536
|
async function removeLegacyBindingStub(cwd, bindingsOutput, contractName) {
|
|
1525
1537
|
const legacyPath = path10.resolve(cwd, bindingsOutput, `${contractName}.ts`);
|
|
@@ -1550,23 +1562,28 @@ async function generateBindings(options) {
|
|
|
1550
1562
|
"Run caatinga deploy for this contract and network before generating bindings."
|
|
1551
1563
|
);
|
|
1552
1564
|
}
|
|
1553
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga generate.");
|
|
1554
1565
|
const outputDir = path10.resolve(cwd, options.config.frontend.bindingsOutput, options.contractName);
|
|
1555
1566
|
await mkdir2(outputDir, { recursive: true });
|
|
1556
|
-
const result = await runCommand(
|
|
1557
|
-
"
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1567
|
+
const result = await runCommand(
|
|
1568
|
+
"npx",
|
|
1569
|
+
[
|
|
1570
|
+
"--yes",
|
|
1571
|
+
"@stellar/stellar-sdk",
|
|
1572
|
+
"generate",
|
|
1573
|
+
"--contract-id",
|
|
1574
|
+
contractArtifact.contractId,
|
|
1575
|
+
"--output-dir",
|
|
1576
|
+
outputDir,
|
|
1577
|
+
"--contract-name",
|
|
1578
|
+
options.contractName,
|
|
1579
|
+
"--overwrite",
|
|
1580
|
+
...buildGenerateNetworkArgs(network)
|
|
1581
|
+
],
|
|
1582
|
+
{
|
|
1583
|
+
cwd,
|
|
1584
|
+
failureCode: CaatingaErrorCode.BINDINGS_FAILED
|
|
1585
|
+
}
|
|
1586
|
+
);
|
|
1570
1587
|
const legacyStubRemoved = await removeLegacyBindingStub(
|
|
1571
1588
|
cwd,
|
|
1572
1589
|
options.config.frontend.bindingsOutput,
|
|
@@ -1678,21 +1695,25 @@ async function invokeContract(options) {
|
|
|
1678
1695
|
await checkBinary("stellar", "Install Stellar CLI before running caatinga invoke.");
|
|
1679
1696
|
let result;
|
|
1680
1697
|
try {
|
|
1681
|
-
result = await runCommand(
|
|
1682
|
-
"
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1698
|
+
result = await runCommand(
|
|
1699
|
+
"stellar",
|
|
1700
|
+
[
|
|
1701
|
+
"contract",
|
|
1702
|
+
"invoke",
|
|
1703
|
+
"--id",
|
|
1704
|
+
contractArtifact.contractId,
|
|
1705
|
+
"--source-account",
|
|
1706
|
+
source,
|
|
1707
|
+
...buildStellarNetworkArgs(network),
|
|
1708
|
+
"--",
|
|
1709
|
+
target.method,
|
|
1710
|
+
...options.args ?? []
|
|
1711
|
+
],
|
|
1712
|
+
{
|
|
1713
|
+
cwd,
|
|
1714
|
+
failureCode: CaatingaErrorCode.INVOKE_FAILED
|
|
1715
|
+
}
|
|
1716
|
+
);
|
|
1696
1717
|
} catch (error) {
|
|
1697
1718
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.INVOKE_FAILED && isReadCallFailure(error)) {
|
|
1698
1719
|
throw new CaatingaError(
|
|
@@ -1837,12 +1858,7 @@ function formatTemplateCompatibilityHint(issue) {
|
|
|
1837
1858
|
}
|
|
1838
1859
|
|
|
1839
1860
|
// src/templates/create-project-from-template.ts
|
|
1840
|
-
var TEMPLATE_COPY_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
|
|
1841
|
-
"target",
|
|
1842
|
-
"test_snapshots",
|
|
1843
|
-
"node_modules",
|
|
1844
|
-
".git"
|
|
1845
|
-
]);
|
|
1861
|
+
var TEMPLATE_COPY_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["target", "test_snapshots", "node_modules", ".git"]);
|
|
1846
1862
|
async function createProjectFromTemplate(options) {
|
|
1847
1863
|
const targetDir = path11.resolve(options.targetDir);
|
|
1848
1864
|
const templateDir = path11.resolve(options.templateDir);
|
|
@@ -1876,7 +1892,10 @@ async function ensureArtifacts(targetDir, projectName) {
|
|
|
1876
1892
|
await writeArtifacts({ ...artifacts, project: projectName }, targetDir);
|
|
1877
1893
|
} catch (error) {
|
|
1878
1894
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.ARTIFACT_NOT_FOUND) {
|
|
1879
|
-
await writeArtifacts(
|
|
1895
|
+
await writeArtifacts(
|
|
1896
|
+
createInitialArtifacts(projectName, { networks: ["testnet"] }),
|
|
1897
|
+
targetDir
|
|
1898
|
+
);
|
|
1880
1899
|
return;
|
|
1881
1900
|
}
|
|
1882
1901
|
throw error;
|
|
@@ -1919,19 +1938,21 @@ async function readTemplateManifest(templateDir) {
|
|
|
1919
1938
|
}
|
|
1920
1939
|
async function replaceTemplateVariables(dir, projectName) {
|
|
1921
1940
|
const entries = await readdir3(dir);
|
|
1922
|
-
await Promise.all(
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1941
|
+
await Promise.all(
|
|
1942
|
+
entries.map(async (entry) => {
|
|
1943
|
+
const entryPath = path11.join(dir, entry);
|
|
1944
|
+
const entryStat = await stat2(entryPath);
|
|
1945
|
+
if (entryStat.isDirectory()) {
|
|
1946
|
+
await replaceTemplateVariables(entryPath, projectName);
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
if (!isTextTemplateFile(entryPath)) {
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1952
|
+
const content = await readFile4(entryPath, "utf8");
|
|
1953
|
+
await writeFile3(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
|
|
1954
|
+
})
|
|
1955
|
+
);
|
|
1935
1956
|
}
|
|
1936
1957
|
function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
1937
1958
|
const relativePath = path11.relative(templateDir, source);
|
|
@@ -1945,16 +1966,9 @@ function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
|
1945
1966
|
return !relativePath.split(path11.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
|
|
1946
1967
|
}
|
|
1947
1968
|
function isTextTemplateFile(filePath) {
|
|
1948
|
-
return [
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
".rs",
|
|
1952
|
-
".toml",
|
|
1953
|
-
".ts",
|
|
1954
|
-
".tsx",
|
|
1955
|
-
".css",
|
|
1956
|
-
".html"
|
|
1957
|
-
].includes(path11.extname(filePath));
|
|
1969
|
+
return [".json", ".md", ".rs", ".toml", ".ts", ".tsx", ".css", ".html"].includes(
|
|
1970
|
+
path11.extname(filePath)
|
|
1971
|
+
);
|
|
1958
1972
|
}
|
|
1959
1973
|
|
|
1960
1974
|
// src/scaffold/create-zk-project.ts
|
|
@@ -2003,23 +2017,27 @@ export default defineConfig({
|
|
|
2003
2017
|
`;
|
|
2004
2018
|
}
|
|
2005
2019
|
function packageJsonSource(projectName) {
|
|
2006
|
-
return `${JSON.stringify(
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2020
|
+
return `${JSON.stringify(
|
|
2021
|
+
{
|
|
2022
|
+
name: projectName,
|
|
2023
|
+
version: "0.1.0",
|
|
2024
|
+
private: true,
|
|
2025
|
+
type: "module",
|
|
2026
|
+
scripts: {
|
|
2027
|
+
"zk:build": "caatinga zk build main",
|
|
2028
|
+
"zk:prove": "caatinga zk prove main",
|
|
2029
|
+
build: "caatinga build verifier",
|
|
2030
|
+
deploy: "caatinga deploy verifier --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2031
|
+
doctor: "caatinga doctor --network testnet"
|
|
2032
|
+
},
|
|
2033
|
+
devDependencies: {
|
|
2034
|
+
"@caatinga/cli": `^${CAATINGA_CORE_VERSION}`,
|
|
2035
|
+
"@caatinga/core": `^${CAATINGA_CORE_VERSION}`
|
|
2036
|
+
}
|
|
2017
2037
|
},
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
}
|
|
2022
|
-
}, null, 2)}
|
|
2038
|
+
null,
|
|
2039
|
+
2
|
|
2040
|
+
)}
|
|
2023
2041
|
`;
|
|
2024
2042
|
}
|
|
2025
2043
|
function readmeSource(projectName) {
|
|
@@ -2047,10 +2065,22 @@ async function createZkProject(options) {
|
|
|
2047
2065
|
await mkdir4(targetDir, { recursive: true });
|
|
2048
2066
|
if (projectFiles) {
|
|
2049
2067
|
await Promise.all([
|
|
2050
|
-
writeFile4(path12.join(targetDir, "caatinga.config.ts"), configSource(options.projectName), {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2068
|
+
writeFile4(path12.join(targetDir, "caatinga.config.ts"), configSource(options.projectName), {
|
|
2069
|
+
encoding: "utf8",
|
|
2070
|
+
flag: force ? "w" : "wx"
|
|
2071
|
+
}),
|
|
2072
|
+
writeFile4(path12.join(targetDir, "package.json"), packageJsonSource(options.projectName), {
|
|
2073
|
+
encoding: "utf8",
|
|
2074
|
+
flag: force ? "w" : "wx"
|
|
2075
|
+
}),
|
|
2076
|
+
writeFile4(path12.join(targetDir, ".gitignore"), "node_modules\n.artifacts\ntarget\n", {
|
|
2077
|
+
encoding: "utf8",
|
|
2078
|
+
flag: force ? "w" : "wx"
|
|
2079
|
+
}),
|
|
2080
|
+
writeFile4(path12.join(targetDir, "README.md"), readmeSource(options.projectName), {
|
|
2081
|
+
encoding: "utf8",
|
|
2082
|
+
flag: force ? "w" : "wx"
|
|
2083
|
+
})
|
|
2054
2084
|
]);
|
|
2055
2085
|
}
|
|
2056
2086
|
await mkdir4(path12.join(targetDir, "contracts"), { recursive: true });
|
|
@@ -2059,13 +2089,20 @@ async function createZkProject(options) {
|
|
|
2059
2089
|
force,
|
|
2060
2090
|
errorOnExist: !force
|
|
2061
2091
|
});
|
|
2062
|
-
await cp2(
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2092
|
+
await cp2(
|
|
2093
|
+
path12.join(scaffoldRoot(), "zk-verifier"),
|
|
2094
|
+
path12.join(targetDir, "contracts", "verifier"),
|
|
2095
|
+
{
|
|
2096
|
+
recursive: true,
|
|
2097
|
+
force,
|
|
2098
|
+
errorOnExist: !force
|
|
2099
|
+
}
|
|
2100
|
+
);
|
|
2067
2101
|
if (projectFiles) {
|
|
2068
|
-
await writeArtifacts(
|
|
2102
|
+
await writeArtifacts(
|
|
2103
|
+
createInitialArtifacts(options.projectName, { networks: ["testnet"] }),
|
|
2104
|
+
targetDir
|
|
2105
|
+
);
|
|
2069
2106
|
}
|
|
2070
2107
|
return { targetDir };
|
|
2071
2108
|
}
|
|
@@ -2106,23 +2143,27 @@ export default defineConfig({
|
|
|
2106
2143
|
`;
|
|
2107
2144
|
}
|
|
2108
2145
|
function packageJsonSource2(projectName) {
|
|
2109
|
-
return `${JSON.stringify(
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2146
|
+
return `${JSON.stringify(
|
|
2147
|
+
{
|
|
2148
|
+
name: projectName,
|
|
2149
|
+
version: "0.1.0",
|
|
2150
|
+
private: true,
|
|
2151
|
+
type: "module",
|
|
2152
|
+
scripts: {
|
|
2153
|
+
build: "caatinga build app",
|
|
2154
|
+
deploy: "caatinga deploy app --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2155
|
+
doctor: "caatinga doctor --network testnet",
|
|
2156
|
+
"read:hello": "caatinga read app.hello --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2157
|
+
"read:version": "caatinga read app.version --network testnet --source ${CAATINGA_SOURCE:-alice}"
|
|
2158
|
+
},
|
|
2159
|
+
devDependencies: {
|
|
2160
|
+
"@caatinga/cli": `^${CAATINGA_CORE_VERSION}`,
|
|
2161
|
+
"@caatinga/core": `^${CAATINGA_CORE_VERSION}`
|
|
2162
|
+
}
|
|
2120
2163
|
},
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
}
|
|
2125
|
-
}, null, 2)}
|
|
2164
|
+
null,
|
|
2165
|
+
2
|
|
2166
|
+
)}
|
|
2126
2167
|
`;
|
|
2127
2168
|
}
|
|
2128
2169
|
function readmeSource2(projectName) {
|
|
@@ -2158,18 +2199,37 @@ async function createMinimalProject(options) {
|
|
|
2158
2199
|
const force = options.force ?? false;
|
|
2159
2200
|
await mkdir5(targetDir, { recursive: true });
|
|
2160
2201
|
await Promise.all([
|
|
2161
|
-
writeFile5(path13.join(targetDir, "caatinga.config.ts"), configSource2(options.projectName), {
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2202
|
+
writeFile5(path13.join(targetDir, "caatinga.config.ts"), configSource2(options.projectName), {
|
|
2203
|
+
encoding: "utf8",
|
|
2204
|
+
flag: force ? "w" : "wx"
|
|
2205
|
+
}),
|
|
2206
|
+
writeFile5(path13.join(targetDir, "package.json"), packageJsonSource2(options.projectName), {
|
|
2207
|
+
encoding: "utf8",
|
|
2208
|
+
flag: force ? "w" : "wx"
|
|
2209
|
+
}),
|
|
2210
|
+
writeFile5(path13.join(targetDir, ".gitignore"), "node_modules\n.artifacts\ntarget\n", {
|
|
2211
|
+
encoding: "utf8",
|
|
2212
|
+
flag: force ? "w" : "wx"
|
|
2213
|
+
}),
|
|
2214
|
+
writeFile5(path13.join(targetDir, "README.md"), readmeSource2(options.projectName), {
|
|
2215
|
+
encoding: "utf8",
|
|
2216
|
+
flag: force ? "w" : "wx"
|
|
2217
|
+
})
|
|
2165
2218
|
]);
|
|
2166
2219
|
await mkdir5(path13.join(targetDir, "contracts"), { recursive: true });
|
|
2167
|
-
await cp3(
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2220
|
+
await cp3(
|
|
2221
|
+
path13.join(scaffoldRoot2(), "soroban-contract-stub"),
|
|
2222
|
+
path13.join(targetDir, "contracts", "app"),
|
|
2223
|
+
{
|
|
2224
|
+
recursive: true,
|
|
2225
|
+
force,
|
|
2226
|
+
errorOnExist: !force
|
|
2227
|
+
}
|
|
2228
|
+
);
|
|
2229
|
+
await writeArtifacts(
|
|
2230
|
+
createInitialArtifacts(options.projectName, { networks: ["testnet"] }),
|
|
2231
|
+
targetDir
|
|
2232
|
+
);
|
|
2173
2233
|
return { targetDir };
|
|
2174
2234
|
}
|
|
2175
2235
|
|
|
@@ -90,7 +90,8 @@ var CaatingaErrorCode = {
|
|
|
90
90
|
TEMPLATE_MANIFEST_NOT_FOUND: "CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND",
|
|
91
91
|
TEMPLATE_INCOMPATIBLE: "CAATINGA_TEMPLATE_INCOMPATIBLE",
|
|
92
92
|
ZK_VERIFICATION_FAILED: "CAATINGA_ZK_VERIFICATION_FAILED",
|
|
93
|
-
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY"
|
|
93
|
+
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY",
|
|
94
|
+
MULTI_AUTH_REQUIRED: "CAATINGA_MULTI_AUTH_REQUIRED"
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
// src/errors/CaatingaError.ts
|
|
@@ -53,7 +53,8 @@ var CaatingaErrorCode = {
|
|
|
53
53
|
TEMPLATE_MANIFEST_NOT_FOUND: "CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND",
|
|
54
54
|
TEMPLATE_INCOMPATIBLE: "CAATINGA_TEMPLATE_INCOMPATIBLE",
|
|
55
55
|
ZK_VERIFICATION_FAILED: "CAATINGA_ZK_VERIFICATION_FAILED",
|
|
56
|
-
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY"
|
|
56
|
+
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY",
|
|
57
|
+
MULTI_AUTH_REQUIRED: "CAATINGA_MULTI_AUTH_REQUIRED"
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// src/errors/CaatingaError.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caatinga/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Core config, artifacts, command orchestration, and error primitives for Caatinga/Soroban toolkit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stellar",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Caatinga contributors",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=
|
|
23
|
+
"node": ">=22"
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|
|
26
26
|
"main": "./dist/index.cjs",
|