@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.cjs
CHANGED
|
@@ -137,7 +137,8 @@ var CaatingaErrorCode = {
|
|
|
137
137
|
TEMPLATE_MANIFEST_NOT_FOUND: "CAATINGA_TEMPLATE_MANIFEST_NOT_FOUND",
|
|
138
138
|
TEMPLATE_INCOMPATIBLE: "CAATINGA_TEMPLATE_INCOMPATIBLE",
|
|
139
139
|
ZK_VERIFICATION_FAILED: "CAATINGA_ZK_VERIFICATION_FAILED",
|
|
140
|
-
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY"
|
|
140
|
+
DOCTOR_PARTIAL_DEPLOY: "CAATINGA_DOCTOR_PARTIAL_DEPLOY",
|
|
141
|
+
MULTI_AUTH_REQUIRED: "CAATINGA_MULTI_AUTH_REQUIRED"
|
|
141
142
|
};
|
|
142
143
|
|
|
143
144
|
// src/errors/CaatingaError.ts
|
|
@@ -210,9 +211,7 @@ function formatCause(cause) {
|
|
|
210
211
|
// src/version.ts
|
|
211
212
|
var import_node_module = require("module");
|
|
212
213
|
var import_meta = {};
|
|
213
|
-
var require2 = (0, import_node_module.createRequire)(
|
|
214
|
-
typeof __filename === "string" ? __filename : import_meta.url
|
|
215
|
-
);
|
|
214
|
+
var require2 = (0, import_node_module.createRequire)(typeof __filename === "string" ? __filename : import_meta.url);
|
|
216
215
|
var CAATINGA_CORE_VERSION = require2("../package.json").version;
|
|
217
216
|
|
|
218
217
|
// src/config/config.schema.ts
|
|
@@ -860,12 +859,7 @@ function matchesWellKnownNetwork(name, config) {
|
|
|
860
859
|
return known.rpcUrl === config.rpcUrl && known.networkPassphrase === config.networkPassphrase;
|
|
861
860
|
}
|
|
862
861
|
function buildRpcNetworkArgs(config) {
|
|
863
|
-
return [
|
|
864
|
-
"--rpc-url",
|
|
865
|
-
config.rpcUrl,
|
|
866
|
-
"--network-passphrase",
|
|
867
|
-
config.networkPassphrase
|
|
868
|
-
];
|
|
862
|
+
return ["--rpc-url", config.rpcUrl, "--network-passphrase", config.networkPassphrase];
|
|
869
863
|
}
|
|
870
864
|
function buildStellarNetworkArgsFromConfig(config) {
|
|
871
865
|
for (const [name, known] of Object.entries(WELL_KNOWN_NETWORKS)) {
|
|
@@ -919,19 +913,23 @@ async function fetchCreateContractSalt(horizonUrl, transactionHash, fetchImpl =
|
|
|
919
913
|
}
|
|
920
914
|
async function resolveContractIdFromDeploySalt(options) {
|
|
921
915
|
const saltHex = decimalSaltToHex(options.salt);
|
|
922
|
-
const result = await runCommand(
|
|
923
|
-
"
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
916
|
+
const result = await runCommand(
|
|
917
|
+
"stellar",
|
|
918
|
+
[
|
|
919
|
+
"contract",
|
|
920
|
+
"id",
|
|
921
|
+
"wasm",
|
|
922
|
+
"--salt",
|
|
923
|
+
saltHex,
|
|
924
|
+
"--source-account",
|
|
925
|
+
options.source,
|
|
926
|
+
...buildStellarNetworkArgsFromConfig(options.network)
|
|
927
|
+
],
|
|
928
|
+
{
|
|
929
|
+
cwd: options.cwd,
|
|
930
|
+
skipStellarVersionCheck: true
|
|
931
|
+
}
|
|
932
|
+
);
|
|
935
933
|
return parseContractId(result.all || `${result.stdout}
|
|
936
934
|
${result.stderr}`);
|
|
937
935
|
}
|
|
@@ -1079,8 +1077,12 @@ function buildAlternateWasmCandidates(configuredWasmPath, options) {
|
|
|
1079
1077
|
addCandidate(import_node_path8.default.join(cargoTargetDir, LEGACY_RUST_WASM_TARGET, "release", fileName));
|
|
1080
1078
|
}
|
|
1081
1079
|
if (options?.sourcePath) {
|
|
1082
|
-
addCandidate(
|
|
1083
|
-
|
|
1080
|
+
addCandidate(
|
|
1081
|
+
import_node_path8.default.join(options.sourcePath, "target", CURRENT_RUST_WASM_TARGET, "release", fileName)
|
|
1082
|
+
);
|
|
1083
|
+
addCandidate(
|
|
1084
|
+
import_node_path8.default.join(options.sourcePath, "target", LEGACY_RUST_WASM_TARGET, "release", fileName)
|
|
1085
|
+
);
|
|
1084
1086
|
}
|
|
1085
1087
|
return candidates;
|
|
1086
1088
|
}
|
|
@@ -1495,17 +1497,21 @@ function toSkippedContract(name, contractId, network) {
|
|
|
1495
1497
|
// src/contracts/verify-dependency-contract.ts
|
|
1496
1498
|
async function verifyDependencyContract(options) {
|
|
1497
1499
|
try {
|
|
1498
|
-
await runCommand(
|
|
1499
|
-
"
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1500
|
+
await runCommand(
|
|
1501
|
+
"stellar",
|
|
1502
|
+
[
|
|
1503
|
+
"contract",
|
|
1504
|
+
"info",
|
|
1505
|
+
"interface",
|
|
1506
|
+
"--contract-id",
|
|
1507
|
+
options.contractId,
|
|
1508
|
+
...buildStellarNetworkArgs(options.network)
|
|
1509
|
+
],
|
|
1510
|
+
{
|
|
1511
|
+
cwd: options.cwd,
|
|
1512
|
+
failureCode: CaatingaErrorCode.DEPENDENCY_CONTRACT_NOT_FOUND
|
|
1513
|
+
}
|
|
1514
|
+
);
|
|
1509
1515
|
} catch (error) {
|
|
1510
1516
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.DEPENDENCY_CONTRACT_NOT_FOUND) {
|
|
1511
1517
|
throw new CaatingaError(
|
|
@@ -1567,9 +1573,7 @@ async function deployContractGraph(options) {
|
|
|
1567
1573
|
network: network.name
|
|
1568
1574
|
});
|
|
1569
1575
|
if (existing?.contractId && !options.force) {
|
|
1570
|
-
skippedContracts.push(
|
|
1571
|
-
toSkippedContract(contractName, existing.contractId, network.name)
|
|
1572
|
-
);
|
|
1576
|
+
skippedContracts.push(toSkippedContract(contractName, existing.contractId, network.name));
|
|
1573
1577
|
continue;
|
|
1574
1578
|
}
|
|
1575
1579
|
const result = await deployContract({
|
|
@@ -1590,9 +1594,7 @@ async function deployContractGraph(options) {
|
|
|
1590
1594
|
});
|
|
1591
1595
|
}
|
|
1592
1596
|
if (result.skipped) {
|
|
1593
|
-
skippedContracts.push(
|
|
1594
|
-
toSkippedContract(contractName, result.contractId, network.name)
|
|
1595
|
-
);
|
|
1597
|
+
skippedContracts.push(toSkippedContract(contractName, result.contractId, network.name));
|
|
1596
1598
|
} else {
|
|
1597
1599
|
deployedContracts.push({ name: contractName, contractId: result.contractId });
|
|
1598
1600
|
}
|
|
@@ -1608,9 +1610,19 @@ async function deployContractGraph(options) {
|
|
|
1608
1610
|
// src/contracts/generate-bindings.ts
|
|
1609
1611
|
var import_promises7 = require("fs/promises");
|
|
1610
1612
|
var import_node_path10 = __toESM(require("path"), 1);
|
|
1613
|
+
|
|
1614
|
+
// src/contracts/build-generate-network-args.ts
|
|
1615
|
+
function buildGenerateNetworkArgs(network) {
|
|
1616
|
+
if (WELL_KNOWN_NETWORKS[network.name]) {
|
|
1617
|
+
return ["--network", network.name, "--rpc-url", network.config.rpcUrl];
|
|
1618
|
+
}
|
|
1619
|
+
return ["--rpc-url", network.config.rpcUrl];
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
// src/contracts/generate-bindings.ts
|
|
1611
1623
|
function toBindingImportPath(bindingsOutput, contractName) {
|
|
1612
1624
|
const normalized = bindingsOutput.replace(/^\.\//, "").split(import_node_path10.default.sep).join("/");
|
|
1613
|
-
return `./${import_node_path10.default.posix.join(normalized, contractName
|
|
1625
|
+
return `./${import_node_path10.default.posix.join(normalized, contractName)}`;
|
|
1614
1626
|
}
|
|
1615
1627
|
async function removeLegacyBindingStub(cwd, bindingsOutput, contractName) {
|
|
1616
1628
|
const legacyPath = import_node_path10.default.resolve(cwd, bindingsOutput, `${contractName}.ts`);
|
|
@@ -1641,23 +1653,28 @@ async function generateBindings(options) {
|
|
|
1641
1653
|
"Run caatinga deploy for this contract and network before generating bindings."
|
|
1642
1654
|
);
|
|
1643
1655
|
}
|
|
1644
|
-
await checkBinary("stellar", "Install Stellar CLI before running caatinga generate.");
|
|
1645
1656
|
const outputDir = import_node_path10.default.resolve(cwd, options.config.frontend.bindingsOutput, options.contractName);
|
|
1646
1657
|
await (0, import_promises7.mkdir)(outputDir, { recursive: true });
|
|
1647
|
-
const result = await runCommand(
|
|
1648
|
-
"
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1658
|
+
const result = await runCommand(
|
|
1659
|
+
"npx",
|
|
1660
|
+
[
|
|
1661
|
+
"--yes",
|
|
1662
|
+
"@stellar/stellar-sdk",
|
|
1663
|
+
"generate",
|
|
1664
|
+
"--contract-id",
|
|
1665
|
+
contractArtifact.contractId,
|
|
1666
|
+
"--output-dir",
|
|
1667
|
+
outputDir,
|
|
1668
|
+
"--contract-name",
|
|
1669
|
+
options.contractName,
|
|
1670
|
+
"--overwrite",
|
|
1671
|
+
...buildGenerateNetworkArgs(network)
|
|
1672
|
+
],
|
|
1673
|
+
{
|
|
1674
|
+
cwd,
|
|
1675
|
+
failureCode: CaatingaErrorCode.BINDINGS_FAILED
|
|
1676
|
+
}
|
|
1677
|
+
);
|
|
1661
1678
|
const legacyStubRemoved = await removeLegacyBindingStub(
|
|
1662
1679
|
cwd,
|
|
1663
1680
|
options.config.frontend.bindingsOutput,
|
|
@@ -1769,21 +1786,25 @@ async function invokeContract(options) {
|
|
|
1769
1786
|
await checkBinary("stellar", "Install Stellar CLI before running caatinga invoke.");
|
|
1770
1787
|
let result;
|
|
1771
1788
|
try {
|
|
1772
|
-
result = await runCommand(
|
|
1773
|
-
"
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1789
|
+
result = await runCommand(
|
|
1790
|
+
"stellar",
|
|
1791
|
+
[
|
|
1792
|
+
"contract",
|
|
1793
|
+
"invoke",
|
|
1794
|
+
"--id",
|
|
1795
|
+
contractArtifact.contractId,
|
|
1796
|
+
"--source-account",
|
|
1797
|
+
source,
|
|
1798
|
+
...buildStellarNetworkArgs(network),
|
|
1799
|
+
"--",
|
|
1800
|
+
target.method,
|
|
1801
|
+
...options.args ?? []
|
|
1802
|
+
],
|
|
1803
|
+
{
|
|
1804
|
+
cwd,
|
|
1805
|
+
failureCode: CaatingaErrorCode.INVOKE_FAILED
|
|
1806
|
+
}
|
|
1807
|
+
);
|
|
1787
1808
|
} catch (error) {
|
|
1788
1809
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.INVOKE_FAILED && isReadCallFailure(error)) {
|
|
1789
1810
|
throw new CaatingaError(
|
|
@@ -1928,12 +1949,7 @@ function formatTemplateCompatibilityHint(issue) {
|
|
|
1928
1949
|
}
|
|
1929
1950
|
|
|
1930
1951
|
// src/templates/create-project-from-template.ts
|
|
1931
|
-
var TEMPLATE_COPY_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
|
|
1932
|
-
"target",
|
|
1933
|
-
"test_snapshots",
|
|
1934
|
-
"node_modules",
|
|
1935
|
-
".git"
|
|
1936
|
-
]);
|
|
1952
|
+
var TEMPLATE_COPY_EXCLUDED_DIRS = /* @__PURE__ */ new Set(["target", "test_snapshots", "node_modules", ".git"]);
|
|
1937
1953
|
async function createProjectFromTemplate(options) {
|
|
1938
1954
|
const targetDir = import_node_path11.default.resolve(options.targetDir);
|
|
1939
1955
|
const templateDir = import_node_path11.default.resolve(options.templateDir);
|
|
@@ -1967,7 +1983,10 @@ async function ensureArtifacts(targetDir, projectName) {
|
|
|
1967
1983
|
await writeArtifacts({ ...artifacts, project: projectName }, targetDir);
|
|
1968
1984
|
} catch (error) {
|
|
1969
1985
|
if (error instanceof CaatingaError && error.code === CaatingaErrorCode.ARTIFACT_NOT_FOUND) {
|
|
1970
|
-
await writeArtifacts(
|
|
1986
|
+
await writeArtifacts(
|
|
1987
|
+
createInitialArtifacts(projectName, { networks: ["testnet"] }),
|
|
1988
|
+
targetDir
|
|
1989
|
+
);
|
|
1971
1990
|
return;
|
|
1972
1991
|
}
|
|
1973
1992
|
throw error;
|
|
@@ -2010,19 +2029,21 @@ async function readTemplateManifest(templateDir) {
|
|
|
2010
2029
|
}
|
|
2011
2030
|
async function replaceTemplateVariables(dir, projectName) {
|
|
2012
2031
|
const entries = await (0, import_promises8.readdir)(dir);
|
|
2013
|
-
await Promise.all(
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2032
|
+
await Promise.all(
|
|
2033
|
+
entries.map(async (entry) => {
|
|
2034
|
+
const entryPath = import_node_path11.default.join(dir, entry);
|
|
2035
|
+
const entryStat = await (0, import_promises8.stat)(entryPath);
|
|
2036
|
+
if (entryStat.isDirectory()) {
|
|
2037
|
+
await replaceTemplateVariables(entryPath, projectName);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (!isTextTemplateFile(entryPath)) {
|
|
2041
|
+
return;
|
|
2042
|
+
}
|
|
2043
|
+
const content = await (0, import_promises8.readFile)(entryPath, "utf8");
|
|
2044
|
+
await (0, import_promises8.writeFile)(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
|
|
2045
|
+
})
|
|
2046
|
+
);
|
|
2026
2047
|
}
|
|
2027
2048
|
function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
2028
2049
|
const relativePath = import_node_path11.default.relative(templateDir, source);
|
|
@@ -2036,16 +2057,9 @@ function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
|
2036
2057
|
return !relativePath.split(import_node_path11.default.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
|
|
2037
2058
|
}
|
|
2038
2059
|
function isTextTemplateFile(filePath) {
|
|
2039
|
-
return [
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
".rs",
|
|
2043
|
-
".toml",
|
|
2044
|
-
".ts",
|
|
2045
|
-
".tsx",
|
|
2046
|
-
".css",
|
|
2047
|
-
".html"
|
|
2048
|
-
].includes(import_node_path11.default.extname(filePath));
|
|
2060
|
+
return [".json", ".md", ".rs", ".toml", ".ts", ".tsx", ".css", ".html"].includes(
|
|
2061
|
+
import_node_path11.default.extname(filePath)
|
|
2062
|
+
);
|
|
2049
2063
|
}
|
|
2050
2064
|
|
|
2051
2065
|
// src/scaffold/create-zk-project.ts
|
|
@@ -2095,23 +2109,27 @@ export default defineConfig({
|
|
|
2095
2109
|
`;
|
|
2096
2110
|
}
|
|
2097
2111
|
function packageJsonSource(projectName) {
|
|
2098
|
-
return `${JSON.stringify(
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2112
|
+
return `${JSON.stringify(
|
|
2113
|
+
{
|
|
2114
|
+
name: projectName,
|
|
2115
|
+
version: "0.1.0",
|
|
2116
|
+
private: true,
|
|
2117
|
+
type: "module",
|
|
2118
|
+
scripts: {
|
|
2119
|
+
"zk:build": "caatinga zk build main",
|
|
2120
|
+
"zk:prove": "caatinga zk prove main",
|
|
2121
|
+
build: "caatinga build verifier",
|
|
2122
|
+
deploy: "caatinga deploy verifier --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2123
|
+
doctor: "caatinga doctor --network testnet"
|
|
2124
|
+
},
|
|
2125
|
+
devDependencies: {
|
|
2126
|
+
"@caatinga/cli": `^${CAATINGA_CORE_VERSION}`,
|
|
2127
|
+
"@caatinga/core": `^${CAATINGA_CORE_VERSION}`
|
|
2128
|
+
}
|
|
2109
2129
|
},
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
}
|
|
2114
|
-
}, null, 2)}
|
|
2130
|
+
null,
|
|
2131
|
+
2
|
|
2132
|
+
)}
|
|
2115
2133
|
`;
|
|
2116
2134
|
}
|
|
2117
2135
|
function readmeSource(projectName) {
|
|
@@ -2139,10 +2157,22 @@ async function createZkProject(options) {
|
|
|
2139
2157
|
await (0, import_promises9.mkdir)(targetDir, { recursive: true });
|
|
2140
2158
|
if (projectFiles) {
|
|
2141
2159
|
await Promise.all([
|
|
2142
|
-
(0, import_promises9.writeFile)(import_node_path12.default.join(targetDir, "caatinga.config.ts"), configSource(options.projectName), {
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2160
|
+
(0, import_promises9.writeFile)(import_node_path12.default.join(targetDir, "caatinga.config.ts"), configSource(options.projectName), {
|
|
2161
|
+
encoding: "utf8",
|
|
2162
|
+
flag: force ? "w" : "wx"
|
|
2163
|
+
}),
|
|
2164
|
+
(0, import_promises9.writeFile)(import_node_path12.default.join(targetDir, "package.json"), packageJsonSource(options.projectName), {
|
|
2165
|
+
encoding: "utf8",
|
|
2166
|
+
flag: force ? "w" : "wx"
|
|
2167
|
+
}),
|
|
2168
|
+
(0, import_promises9.writeFile)(import_node_path12.default.join(targetDir, ".gitignore"), "node_modules\n.artifacts\ntarget\n", {
|
|
2169
|
+
encoding: "utf8",
|
|
2170
|
+
flag: force ? "w" : "wx"
|
|
2171
|
+
}),
|
|
2172
|
+
(0, import_promises9.writeFile)(import_node_path12.default.join(targetDir, "README.md"), readmeSource(options.projectName), {
|
|
2173
|
+
encoding: "utf8",
|
|
2174
|
+
flag: force ? "w" : "wx"
|
|
2175
|
+
})
|
|
2146
2176
|
]);
|
|
2147
2177
|
}
|
|
2148
2178
|
await (0, import_promises9.mkdir)(import_node_path12.default.join(targetDir, "contracts"), { recursive: true });
|
|
@@ -2151,13 +2181,20 @@ async function createZkProject(options) {
|
|
|
2151
2181
|
force,
|
|
2152
2182
|
errorOnExist: !force
|
|
2153
2183
|
});
|
|
2154
|
-
await (0, import_promises9.cp)(
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2184
|
+
await (0, import_promises9.cp)(
|
|
2185
|
+
import_node_path12.default.join(scaffoldRoot(), "zk-verifier"),
|
|
2186
|
+
import_node_path12.default.join(targetDir, "contracts", "verifier"),
|
|
2187
|
+
{
|
|
2188
|
+
recursive: true,
|
|
2189
|
+
force,
|
|
2190
|
+
errorOnExist: !force
|
|
2191
|
+
}
|
|
2192
|
+
);
|
|
2159
2193
|
if (projectFiles) {
|
|
2160
|
-
await writeArtifacts(
|
|
2194
|
+
await writeArtifacts(
|
|
2195
|
+
createInitialArtifacts(options.projectName, { networks: ["testnet"] }),
|
|
2196
|
+
targetDir
|
|
2197
|
+
);
|
|
2161
2198
|
}
|
|
2162
2199
|
return { targetDir };
|
|
2163
2200
|
}
|
|
@@ -2199,23 +2236,27 @@ export default defineConfig({
|
|
|
2199
2236
|
`;
|
|
2200
2237
|
}
|
|
2201
2238
|
function packageJsonSource2(projectName) {
|
|
2202
|
-
return `${JSON.stringify(
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2239
|
+
return `${JSON.stringify(
|
|
2240
|
+
{
|
|
2241
|
+
name: projectName,
|
|
2242
|
+
version: "0.1.0",
|
|
2243
|
+
private: true,
|
|
2244
|
+
type: "module",
|
|
2245
|
+
scripts: {
|
|
2246
|
+
build: "caatinga build app",
|
|
2247
|
+
deploy: "caatinga deploy app --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2248
|
+
doctor: "caatinga doctor --network testnet",
|
|
2249
|
+
"read:hello": "caatinga read app.hello --network testnet --source ${CAATINGA_SOURCE:-alice}",
|
|
2250
|
+
"read:version": "caatinga read app.version --network testnet --source ${CAATINGA_SOURCE:-alice}"
|
|
2251
|
+
},
|
|
2252
|
+
devDependencies: {
|
|
2253
|
+
"@caatinga/cli": `^${CAATINGA_CORE_VERSION}`,
|
|
2254
|
+
"@caatinga/core": `^${CAATINGA_CORE_VERSION}`
|
|
2255
|
+
}
|
|
2213
2256
|
},
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
}
|
|
2218
|
-
}, null, 2)}
|
|
2257
|
+
null,
|
|
2258
|
+
2
|
|
2259
|
+
)}
|
|
2219
2260
|
`;
|
|
2220
2261
|
}
|
|
2221
2262
|
function readmeSource2(projectName) {
|
|
@@ -2251,18 +2292,37 @@ async function createMinimalProject(options) {
|
|
|
2251
2292
|
const force = options.force ?? false;
|
|
2252
2293
|
await (0, import_promises10.mkdir)(targetDir, { recursive: true });
|
|
2253
2294
|
await Promise.all([
|
|
2254
|
-
(0, import_promises10.writeFile)(import_node_path13.default.join(targetDir, "caatinga.config.ts"), configSource2(options.projectName), {
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2295
|
+
(0, import_promises10.writeFile)(import_node_path13.default.join(targetDir, "caatinga.config.ts"), configSource2(options.projectName), {
|
|
2296
|
+
encoding: "utf8",
|
|
2297
|
+
flag: force ? "w" : "wx"
|
|
2298
|
+
}),
|
|
2299
|
+
(0, import_promises10.writeFile)(import_node_path13.default.join(targetDir, "package.json"), packageJsonSource2(options.projectName), {
|
|
2300
|
+
encoding: "utf8",
|
|
2301
|
+
flag: force ? "w" : "wx"
|
|
2302
|
+
}),
|
|
2303
|
+
(0, import_promises10.writeFile)(import_node_path13.default.join(targetDir, ".gitignore"), "node_modules\n.artifacts\ntarget\n", {
|
|
2304
|
+
encoding: "utf8",
|
|
2305
|
+
flag: force ? "w" : "wx"
|
|
2306
|
+
}),
|
|
2307
|
+
(0, import_promises10.writeFile)(import_node_path13.default.join(targetDir, "README.md"), readmeSource2(options.projectName), {
|
|
2308
|
+
encoding: "utf8",
|
|
2309
|
+
flag: force ? "w" : "wx"
|
|
2310
|
+
})
|
|
2258
2311
|
]);
|
|
2259
2312
|
await (0, import_promises10.mkdir)(import_node_path13.default.join(targetDir, "contracts"), { recursive: true });
|
|
2260
|
-
await (0, import_promises10.cp)(
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2313
|
+
await (0, import_promises10.cp)(
|
|
2314
|
+
import_node_path13.default.join(scaffoldRoot2(), "soroban-contract-stub"),
|
|
2315
|
+
import_node_path13.default.join(targetDir, "contracts", "app"),
|
|
2316
|
+
{
|
|
2317
|
+
recursive: true,
|
|
2318
|
+
force,
|
|
2319
|
+
errorOnExist: !force
|
|
2320
|
+
}
|
|
2321
|
+
);
|
|
2322
|
+
await writeArtifacts(
|
|
2323
|
+
createInitialArtifacts(options.projectName, { networks: ["testnet"] }),
|
|
2324
|
+
targetDir
|
|
2325
|
+
);
|
|
2266
2326
|
return { targetDir };
|
|
2267
2327
|
}
|
|
2268
2328
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CaatingaArtifacts, c as ContractArtifact, d as CaatingaErrorCodeValue, a as CaatingaError } from './artifact.schema-
|
|
2
|
-
export { e as CaatingaArtifactsSchema, b as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './artifact.schema-
|
|
1
|
+
import { C as CaatingaArtifacts, c as ContractArtifact, d as CaatingaErrorCodeValue, a as CaatingaError } from './artifact.schema-D4r8dyYK.cjs';
|
|
2
|
+
export { e as CaatingaArtifactsSchema, b as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './artifact.schema-D4r8dyYK.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const CAATINGA_CORE_VERSION: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CaatingaArtifacts, c as ContractArtifact, d as CaatingaErrorCodeValue, a as CaatingaError } from './artifact.schema-
|
|
2
|
-
export { e as CaatingaArtifactsSchema, b as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './artifact.schema-
|
|
1
|
+
import { C as CaatingaArtifacts, c as ContractArtifact, d as CaatingaErrorCodeValue, a as CaatingaError } from './artifact.schema-D4r8dyYK.js';
|
|
2
|
+
export { e as CaatingaArtifactsSchema, b as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './artifact.schema-D4r8dyYK.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const CAATINGA_CORE_VERSION: string;
|