@caatinga/core 2.2.1 → 2.3.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/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  collectProjectStatus: () => collectProjectStatus,
49
49
  createInitialArtifacts: () => createInitialArtifacts,
50
50
  createProjectFromTemplate: () => createProjectFromTemplate,
51
+ createZkProject: () => createZkProject,
51
52
  defineConfig: () => defineConfig,
52
53
  deployContract: () => deployContract,
53
54
  deployContractGraph: () => deployContractGraph,
@@ -66,6 +67,7 @@ __export(index_exports, {
66
67
  readArtifacts: () => readArtifacts,
67
68
  readBindingMarker: () => readBindingMarker,
68
69
  resolveContract: () => resolveContract,
70
+ resolveDefaultContractName: () => resolveDefaultContractName,
69
71
  resolveDeployArgs: () => resolveDeployArgs,
70
72
  resolveDeployOrder: () => resolveDeployOrder,
71
73
  resolveNetwork: () => resolveNetwork,
@@ -185,7 +187,7 @@ function formatCause(cause) {
185
187
  }
186
188
 
187
189
  // src/version.ts
188
- var CAATINGA_CORE_VERSION = "2.2.1";
190
+ var CAATINGA_CORE_VERSION = "2.3.1";
189
191
 
190
192
  // src/config/config.schema.ts
191
193
  var import_zod = require("zod");
@@ -200,6 +202,15 @@ var NetworkConfigSchema = import_zod.z.object({
200
202
  rpcUrl: import_zod.z.string().url(),
201
203
  networkPassphrase: import_zod.z.string().min(1)
202
204
  });
205
+ var ZkCircuitSchema = import_zod.z.object({
206
+ path: import_zod.z.string().min(1),
207
+ protocol: import_zod.z.literal("groth16"),
208
+ curve: import_zod.z.literal("bls12381"),
209
+ verifierContract: import_zod.z.string().optional()
210
+ });
211
+ var ZkConfigSchema = import_zod.z.object({
212
+ circuits: import_zod.z.record(import_zod.z.string().min(1), ZkCircuitSchema)
213
+ }).optional();
203
214
  var CaatingaConfigSchema = import_zod.z.object({
204
215
  project: import_zod.z.string().min(1),
205
216
  defaultNetwork: import_zod.z.string().min(1).default("testnet"),
@@ -214,7 +225,8 @@ var CaatingaConfigSchema = import_zod.z.object({
214
225
  frontend: import_zod.z.object({
215
226
  framework: import_zod.z.enum(["vite-react", "next", "astro"]).default("vite-react"),
216
227
  bindingsOutput: import_zod.z.string().min(1)
217
- })
228
+ }).optional(),
229
+ zk: ZkConfigSchema
218
230
  });
219
231
 
220
232
  // src/config/define-config.ts
@@ -412,6 +424,15 @@ async function listGeneratedEntries(outputDir) {
412
424
  }
413
425
  async function evaluateBindingFreshness(options) {
414
426
  const cwd = options.cwd ?? process.cwd();
427
+ if (!options.config.frontend) {
428
+ return {
429
+ contractName: options.contractName,
430
+ status: "unknown",
431
+ outputDir: "",
432
+ marker: null,
433
+ reason: "frontend bindings are not configured"
434
+ };
435
+ }
415
436
  const outputDir = import_node_path5.default.resolve(cwd, options.config.frontend.bindingsOutput, options.contractName);
416
437
  const contractArtifact = options.artifacts.networks[options.networkName]?.contracts[options.contractName];
417
438
  if (!contractArtifact) {
@@ -658,6 +679,7 @@ async function runCommand(command, args, options = {}) {
658
679
  const result = await (0, import_execa.execa)(command, args, {
659
680
  cwd: options.cwd,
660
681
  env: options.env,
682
+ input: options.input,
661
683
  all: true,
662
684
  reject: true
663
685
  });
@@ -872,6 +894,19 @@ function resolveContract(config, contractName, cwd = process.cwd()) {
872
894
  };
873
895
  }
874
896
 
897
+ // src/contracts/resolve-default-contract.ts
898
+ function resolveDefaultContractName(config) {
899
+ const names = Object.keys(config.contracts);
900
+ if (names.length === 1) {
901
+ return names[0];
902
+ }
903
+ throw new CaatingaError(
904
+ "Pass a contract name to build.",
905
+ CaatingaErrorCode.CONTRACT_NOT_FOUND,
906
+ `Configured contracts: ${names.join(", ")}. Example: caatinga build ${names[0]}`
907
+ );
908
+ }
909
+
875
910
  // src/contracts/wasm.ts
876
911
  var import_node_crypto = require("crypto");
877
912
  var import_promises6 = require("fs/promises");
@@ -1416,6 +1451,13 @@ async function removeLegacyBindingStub(cwd, bindingsOutput, contractName) {
1416
1451
  }
1417
1452
  async function generateBindings(options) {
1418
1453
  const cwd = options.cwd ?? process.cwd();
1454
+ if (!options.config.frontend) {
1455
+ throw new CaatingaError(
1456
+ "Frontend bindings are not configured.",
1457
+ CaatingaErrorCode.INVALID_CONFIG,
1458
+ "Add a frontend.bindingsOutput entry to caatinga.config.ts before running caatinga generate."
1459
+ );
1460
+ }
1419
1461
  const network = resolveNetwork(options.config, options.networkName);
1420
1462
  const artifacts = await readArtifacts(cwd);
1421
1463
  const contractArtifact = artifacts.networks[network.name]?.contracts[options.contractName];
@@ -1662,15 +1704,18 @@ async function createProjectFromTemplate(options) {
1662
1704
  );
1663
1705
  }
1664
1706
  const manifest = await readTemplateManifest(templateDir);
1707
+ const mergeIntoExisting = Boolean(options.filter);
1665
1708
  await (0, import_promises8.mkdir)(targetDir, { recursive: true });
1666
1709
  await (0, import_promises8.cp)(templateDir, targetDir, {
1667
1710
  recursive: true,
1668
- force: false,
1669
- errorOnExist: true,
1670
- filter: (source) => shouldCopyTemplateEntry(templateDir, source)
1711
+ force: mergeIntoExisting,
1712
+ errorOnExist: !mergeIntoExisting,
1713
+ filter: (source) => shouldCopyTemplateEntry(templateDir, source, options.filter)
1671
1714
  });
1672
1715
  await replaceTemplateVariables(targetDir, options.projectName);
1673
- await ensureArtifacts(targetDir, options.projectName);
1716
+ if (!mergeIntoExisting) {
1717
+ await ensureArtifacts(targetDir, options.projectName);
1718
+ }
1674
1719
  return { targetDir, template: manifest };
1675
1720
  }
1676
1721
  async function ensureArtifacts(targetDir, projectName) {
@@ -1736,11 +1781,15 @@ async function replaceTemplateVariables(dir, projectName) {
1736
1781
  await (0, import_promises8.writeFile)(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
1737
1782
  }));
1738
1783
  }
1739
- function shouldCopyTemplateEntry(templateDir, source) {
1784
+ function shouldCopyTemplateEntry(templateDir, source, userFilter) {
1740
1785
  const relativePath = import_node_path10.default.relative(templateDir, source);
1741
1786
  if (!relativePath || relativePath === ".") {
1742
1787
  return true;
1743
1788
  }
1789
+ const normalizedPath = relativePath.split(import_node_path10.default.sep).join("/");
1790
+ if (userFilter && !userFilter(normalizedPath)) {
1791
+ return false;
1792
+ }
1744
1793
  return !relativePath.split(import_node_path10.default.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
1745
1794
  }
1746
1795
  function isTextTemplateFile(filePath) {
@@ -1756,6 +1805,119 @@ function isTextTemplateFile(filePath) {
1756
1805
  ].includes(import_node_path10.default.extname(filePath));
1757
1806
  }
1758
1807
 
1808
+ // src/scaffold/create-zk-project.ts
1809
+ var import_promises9 = require("fs/promises");
1810
+ var import_node_fs = require("fs");
1811
+ var import_node_path11 = __toESM(require("path"), 1);
1812
+ var import_node_url = require("url");
1813
+ var import_meta2 = {};
1814
+ var moduleDir = typeof __dirname === "string" ? __dirname : import_node_path11.default.dirname((0, import_node_url.fileURLToPath)(import_meta2.url));
1815
+ function scaffoldRoot() {
1816
+ const candidates = [
1817
+ import_node_path11.default.resolve(moduleDir, "../../scaffolds"),
1818
+ import_node_path11.default.resolve(moduleDir, "../scaffolds")
1819
+ ];
1820
+ const found = candidates.find((candidate) => (0, import_node_fs.existsSync)(candidate));
1821
+ return found ?? candidates[0];
1822
+ }
1823
+ function configSource(projectName) {
1824
+ return `import { defineConfig } from "@caatinga/core";
1825
+
1826
+ export default defineConfig({
1827
+ project: "${projectName}",
1828
+ defaultNetwork: "testnet",
1829
+ contracts: {
1830
+ verifier: {
1831
+ path: "./contracts/verifier",
1832
+ wasm: "./contracts/verifier/target/wasm32v1-none/release/verifier.wasm"
1833
+ }
1834
+ },
1835
+ networks: {
1836
+ testnet: {
1837
+ rpcUrl: "https://soroban-testnet.stellar.org",
1838
+ networkPassphrase: "Test SDF Network ; September 2015"
1839
+ }
1840
+ },
1841
+ zk: {
1842
+ circuits: {
1843
+ main: {
1844
+ path: "./circuits",
1845
+ protocol: "groth16",
1846
+ curve: "bls12381",
1847
+ verifierContract: "verifier"
1848
+ }
1849
+ }
1850
+ }
1851
+ });
1852
+ `;
1853
+ }
1854
+ function packageJsonSource(projectName) {
1855
+ return `${JSON.stringify({
1856
+ name: projectName,
1857
+ version: "0.1.0",
1858
+ private: true,
1859
+ type: "module",
1860
+ scripts: {
1861
+ "zk:build": "caatinga zk build main",
1862
+ "zk:prove": "caatinga zk prove main",
1863
+ build: "caatinga build verifier",
1864
+ deploy: "caatinga deploy verifier"
1865
+ },
1866
+ devDependencies: {
1867
+ "@caatinga/cli": `^${CAATINGA_CORE_VERSION}`,
1868
+ "@caatinga/core": `^${CAATINGA_CORE_VERSION}`
1869
+ }
1870
+ }, null, 2)}
1871
+ `;
1872
+ }
1873
+ function readmeSource(projectName) {
1874
+ return `# ${projectName}
1875
+
1876
+ Minimal Caatinga ZK project.
1877
+
1878
+ ## Workflow
1879
+
1880
+ \`\`\`bash
1881
+ npm install
1882
+ npx caatinga zk build main
1883
+ npx caatinga build verifier
1884
+ npx caatinga deploy verifier --network testnet
1885
+ npx caatinga zk prove main
1886
+ \`\`\`
1887
+
1888
+ Replace \`circuits/main.circom\` with your circuit. Keep the entry point named \`main\`.
1889
+ `;
1890
+ }
1891
+ async function createZkProject(options) {
1892
+ const targetDir = import_node_path11.default.resolve(options.targetDir);
1893
+ const force = options.force ?? false;
1894
+ const projectFiles = options.projectFiles ?? true;
1895
+ await (0, import_promises9.mkdir)(targetDir, { recursive: true });
1896
+ if (projectFiles) {
1897
+ await Promise.all([
1898
+ (0, import_promises9.writeFile)(import_node_path11.default.join(targetDir, "caatinga.config.ts"), configSource(options.projectName), { encoding: "utf8", flag: force ? "w" : "wx" }),
1899
+ (0, import_promises9.writeFile)(import_node_path11.default.join(targetDir, "package.json"), packageJsonSource(options.projectName), { encoding: "utf8", flag: force ? "w" : "wx" }),
1900
+ (0, import_promises9.writeFile)(import_node_path11.default.join(targetDir, ".gitignore"), "node_modules\n.artifacts\ntarget\n", { encoding: "utf8", flag: force ? "w" : "wx" }),
1901
+ (0, import_promises9.writeFile)(import_node_path11.default.join(targetDir, "README.md"), readmeSource(options.projectName), { encoding: "utf8", flag: force ? "w" : "wx" })
1902
+ ]);
1903
+ }
1904
+ await (0, import_promises9.mkdir)(import_node_path11.default.join(targetDir, "contracts"), { recursive: true });
1905
+ await (0, import_promises9.cp)(import_node_path11.default.join(scaffoldRoot(), "zk-circuit-stub"), import_node_path11.default.join(targetDir, "circuits"), {
1906
+ recursive: true,
1907
+ force,
1908
+ errorOnExist: !force
1909
+ });
1910
+ await (0, import_promises9.cp)(import_node_path11.default.join(scaffoldRoot(), "zk-verifier"), import_node_path11.default.join(targetDir, "contracts", "verifier"), {
1911
+ recursive: true,
1912
+ force,
1913
+ errorOnExist: !force
1914
+ });
1915
+ if (projectFiles) {
1916
+ await writeArtifacts(createInitialArtifacts(options.projectName, { networks: ["testnet"] }), targetDir);
1917
+ }
1918
+ return { targetDir };
1919
+ }
1920
+
1759
1921
  // src/ci/is-transient-testnet-smoke-failure.ts
1760
1922
  var NO_RETRY_CAATINGA_SUBSTRINGS = [
1761
1923
  "CAATINGA_UNSUPPORTED_CLI_VERSION",
@@ -1796,6 +1958,7 @@ function isTransientTestnetSmokeFailure(logText) {
1796
1958
  collectProjectStatus,
1797
1959
  createInitialArtifacts,
1798
1960
  createProjectFromTemplate,
1961
+ createZkProject,
1799
1962
  defineConfig,
1800
1963
  deployContract,
1801
1964
  deployContractGraph,
@@ -1814,6 +1977,7 @@ function isTransientTestnetSmokeFailure(logText) {
1814
1977
  readArtifacts,
1815
1978
  readBindingMarker,
1816
1979
  resolveContract,
1980
+ resolveDefaultContractName,
1817
1981
  resolveDeployArgs,
1818
1982
  resolveDeployOrder,
1819
1983
  resolveNetwork,
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { C as CaatingaArtifacts, a as ContractArtifact, b as CaatingaErrorCodeVa
2
2
  export { d as CaatingaArtifactsSchema, e as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './browser-Cq4ZofIq.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
- declare const CAATINGA_CORE_VERSION = "2.2.1";
5
+ declare const CAATINGA_CORE_VERSION = "2.3.1";
6
6
 
7
7
  declare const ContractConfigSchema: z.ZodObject<{
8
8
  path: z.ZodString;
@@ -75,7 +75,7 @@ declare const CaatingaConfigSchema: z.ZodObject<{
75
75
  rpcUrl: string;
76
76
  networkPassphrase: string;
77
77
  }>>;
78
- frontend: z.ZodObject<{
78
+ frontend: z.ZodOptional<z.ZodObject<{
79
79
  framework: z.ZodDefault<z.ZodEnum<["vite-react", "next", "astro"]>>;
80
80
  bindingsOutput: z.ZodString;
81
81
  }, "strip", z.ZodTypeAny, {
@@ -84,7 +84,39 @@ declare const CaatingaConfigSchema: z.ZodObject<{
84
84
  }, {
85
85
  bindingsOutput: string;
86
86
  framework?: "vite-react" | "next" | "astro" | undefined;
87
- }>;
87
+ }>>;
88
+ zk: z.ZodOptional<z.ZodObject<{
89
+ circuits: z.ZodRecord<z.ZodString, z.ZodObject<{
90
+ path: z.ZodString;
91
+ protocol: z.ZodLiteral<"groth16">;
92
+ curve: z.ZodLiteral<"bls12381">;
93
+ verifierContract: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ path: string;
96
+ protocol: "groth16";
97
+ curve: "bls12381";
98
+ verifierContract?: string | undefined;
99
+ }, {
100
+ path: string;
101
+ protocol: "groth16";
102
+ curve: "bls12381";
103
+ verifierContract?: string | undefined;
104
+ }>>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ circuits: Record<string, {
107
+ path: string;
108
+ protocol: "groth16";
109
+ curve: "bls12381";
110
+ verifierContract?: string | undefined;
111
+ }>;
112
+ }, {
113
+ circuits: Record<string, {
114
+ path: string;
115
+ protocol: "groth16";
116
+ curve: "bls12381";
117
+ verifierContract?: string | undefined;
118
+ }>;
119
+ }>>;
88
120
  }, "strip", z.ZodTypeAny, {
89
121
  project: string;
90
122
  defaultNetwork: string;
@@ -98,10 +130,18 @@ declare const CaatingaConfigSchema: z.ZodObject<{
98
130
  rpcUrl: string;
99
131
  networkPassphrase: string;
100
132
  }>;
101
- frontend: {
133
+ frontend?: {
102
134
  framework: "vite-react" | "next" | "astro";
103
135
  bindingsOutput: string;
104
- };
136
+ } | undefined;
137
+ zk?: {
138
+ circuits: Record<string, {
139
+ path: string;
140
+ protocol: "groth16";
141
+ curve: "bls12381";
142
+ verifierContract?: string | undefined;
143
+ }>;
144
+ } | undefined;
105
145
  }, {
106
146
  project: string;
107
147
  contracts: Record<string, {
@@ -114,11 +154,19 @@ declare const CaatingaConfigSchema: z.ZodObject<{
114
154
  rpcUrl: string;
115
155
  networkPassphrase: string;
116
156
  }>;
117
- frontend: {
157
+ defaultNetwork?: string | undefined;
158
+ frontend?: {
118
159
  bindingsOutput: string;
119
160
  framework?: "vite-react" | "next" | "astro" | undefined;
120
- };
121
- defaultNetwork?: string | undefined;
161
+ } | undefined;
162
+ zk?: {
163
+ circuits: Record<string, {
164
+ path: string;
165
+ protocol: "groth16";
166
+ curve: "bls12381";
167
+ verifierContract?: string | undefined;
168
+ }>;
169
+ } | undefined;
122
170
  }>;
123
171
  type CaatingaConfig = z.infer<typeof CaatingaConfigSchema>;
124
172
  type ContractConfig = z.infer<typeof ContractConfigSchema>;
@@ -232,6 +280,7 @@ type RunCommandResult = {
232
280
  type RunCommandOptions = {
233
281
  cwd?: string;
234
282
  env?: NodeJS.ProcessEnv;
283
+ input?: string;
235
284
  skipStellarVersionCheck?: boolean;
236
285
  failureCode?: CaatingaErrorCodeValue;
237
286
  };
@@ -286,6 +335,8 @@ type ResolvedContract = {
286
335
  };
287
336
  declare function resolveContract(config: CaatingaConfig, contractName: string, cwd?: string): ResolvedContract;
288
337
 
338
+ declare function resolveDefaultContractName(config: CaatingaConfig): string;
339
+
289
340
  type BuildContractOptions = {
290
341
  config: CaatingaConfig;
291
342
  contractName: string;
@@ -444,6 +495,7 @@ type CreateProjectFromTemplateOptions = {
444
495
  projectName: string;
445
496
  targetDir: string;
446
497
  templateDir: string;
498
+ filter?: (relativePath: string) => boolean;
447
499
  };
448
500
  declare function createProjectFromTemplate(options: CreateProjectFromTemplateOptions): Promise<{
449
501
  targetDir: string;
@@ -470,6 +522,16 @@ declare function createProjectFromTemplate(options: CreateProjectFromTemplateOpt
470
522
  };
471
523
  }>;
472
524
 
525
+ type CreateZkProjectOptions = {
526
+ projectName: string;
527
+ targetDir: string;
528
+ force?: boolean;
529
+ projectFiles?: boolean;
530
+ };
531
+ declare function createZkProject(options: CreateZkProjectOptions): Promise<{
532
+ targetDir: string;
533
+ }>;
534
+
473
535
  declare const TemplateManifestSchema: z.ZodObject<{
474
536
  name: z.ZodString;
475
537
  version: z.ZodString;
@@ -559,4 +621,4 @@ type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
559
621
 
560
622
  declare function isTransientTestnetSmokeFailure(logText: string): boolean;
561
623
 
562
- export { BINDING_MARKER_FILENAME, type BindingFreshness, type BindingFreshnessStatus, type BindingMarker, BindingMarkerSchema, type BuildContractOptions, CAATINGA_CORE_VERSION, CaatingaArtifacts, type CaatingaConfig, CaatingaConfigSchema, CaatingaError, type CheckStellarCliVersionOptions, type CollectProjectStatusOptions, type CompatibilityReport, type CompatibilityStatus, type CompatibilityWarning, type CompatibilityWarningCode, ContractArtifact, type ContractConfig, type ContractStatusEntry, type CreateInitialArtifactsOptions, type CreateProjectFromTemplateOptions, type DeployArgValue, type DeployContractGraphResult, type DeployContractOptions, type EvaluateBindingFreshnessOptions, type EvaluateStellarCliCompatibilityInput, type GenerateBindingsGraphResult, type GenerateBindingsOptions, type InvokeContractOptions, type InvokeTarget, type LoadConfigOptions, type NetworkConfig, type NetworkStatus, type ProjectStatus, type ResolvedContract, type ResolvedNetwork, type RunCommandResult, STELLAR_CLI_LAST_TESTED_VERSION, STELLAR_CLI_MIN_VERSION, type SkippedContract, type TemplateManifest, TemplateManifestSchema, WELL_KNOWN_NETWORKS, buildContract, buildDependencyGraph, checkBinary, checkStellarCliVersion, collectProjectStatus, createInitialArtifacts, createProjectFromTemplate, defineConfig, deployContract, deployContractGraph, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, generateBindings, generateBindingsGraph, invokeContract, isTransientTestnetSmokeFailure, loadConfig, parseContractId, parseInvokeTarget, parseStellarCliVersion, readArtifacts, readBindingMarker, resolveContract, resolveDeployArgs, resolveDeployOrder, resolveNetwork, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };
624
+ export { BINDING_MARKER_FILENAME, type BindingFreshness, type BindingFreshnessStatus, type BindingMarker, BindingMarkerSchema, type BuildContractOptions, CAATINGA_CORE_VERSION, CaatingaArtifacts, type CaatingaConfig, CaatingaConfigSchema, CaatingaError, type CheckStellarCliVersionOptions, type CollectProjectStatusOptions, type CompatibilityReport, type CompatibilityStatus, type CompatibilityWarning, type CompatibilityWarningCode, ContractArtifact, type ContractConfig, type ContractStatusEntry, type CreateInitialArtifactsOptions, type CreateProjectFromTemplateOptions, type CreateZkProjectOptions, type DeployArgValue, type DeployContractGraphResult, type DeployContractOptions, type EvaluateBindingFreshnessOptions, type EvaluateStellarCliCompatibilityInput, type GenerateBindingsGraphResult, type GenerateBindingsOptions, type InvokeContractOptions, type InvokeTarget, type LoadConfigOptions, type NetworkConfig, type NetworkStatus, type ProjectStatus, type ResolvedContract, type ResolvedNetwork, type RunCommandResult, STELLAR_CLI_LAST_TESTED_VERSION, STELLAR_CLI_MIN_VERSION, type SkippedContract, type TemplateManifest, TemplateManifestSchema, WELL_KNOWN_NETWORKS, buildContract, buildDependencyGraph, checkBinary, checkStellarCliVersion, collectProjectStatus, createInitialArtifacts, createProjectFromTemplate, createZkProject, defineConfig, deployContract, deployContractGraph, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, generateBindings, generateBindingsGraph, invokeContract, isTransientTestnetSmokeFailure, loadConfig, parseContractId, parseInvokeTarget, parseStellarCliVersion, readArtifacts, readBindingMarker, resolveContract, resolveDefaultContractName, resolveDeployArgs, resolveDeployOrder, resolveNetwork, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { C as CaatingaArtifacts, a as ContractArtifact, b as CaatingaErrorCodeVa
2
2
  export { d as CaatingaArtifactsSchema, e as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './browser-Cq4ZofIq.js';
3
3
  import { z } from 'zod';
4
4
 
5
- declare const CAATINGA_CORE_VERSION = "2.2.1";
5
+ declare const CAATINGA_CORE_VERSION = "2.3.1";
6
6
 
7
7
  declare const ContractConfigSchema: z.ZodObject<{
8
8
  path: z.ZodString;
@@ -75,7 +75,7 @@ declare const CaatingaConfigSchema: z.ZodObject<{
75
75
  rpcUrl: string;
76
76
  networkPassphrase: string;
77
77
  }>>;
78
- frontend: z.ZodObject<{
78
+ frontend: z.ZodOptional<z.ZodObject<{
79
79
  framework: z.ZodDefault<z.ZodEnum<["vite-react", "next", "astro"]>>;
80
80
  bindingsOutput: z.ZodString;
81
81
  }, "strip", z.ZodTypeAny, {
@@ -84,7 +84,39 @@ declare const CaatingaConfigSchema: z.ZodObject<{
84
84
  }, {
85
85
  bindingsOutput: string;
86
86
  framework?: "vite-react" | "next" | "astro" | undefined;
87
- }>;
87
+ }>>;
88
+ zk: z.ZodOptional<z.ZodObject<{
89
+ circuits: z.ZodRecord<z.ZodString, z.ZodObject<{
90
+ path: z.ZodString;
91
+ protocol: z.ZodLiteral<"groth16">;
92
+ curve: z.ZodLiteral<"bls12381">;
93
+ verifierContract: z.ZodOptional<z.ZodString>;
94
+ }, "strip", z.ZodTypeAny, {
95
+ path: string;
96
+ protocol: "groth16";
97
+ curve: "bls12381";
98
+ verifierContract?: string | undefined;
99
+ }, {
100
+ path: string;
101
+ protocol: "groth16";
102
+ curve: "bls12381";
103
+ verifierContract?: string | undefined;
104
+ }>>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ circuits: Record<string, {
107
+ path: string;
108
+ protocol: "groth16";
109
+ curve: "bls12381";
110
+ verifierContract?: string | undefined;
111
+ }>;
112
+ }, {
113
+ circuits: Record<string, {
114
+ path: string;
115
+ protocol: "groth16";
116
+ curve: "bls12381";
117
+ verifierContract?: string | undefined;
118
+ }>;
119
+ }>>;
88
120
  }, "strip", z.ZodTypeAny, {
89
121
  project: string;
90
122
  defaultNetwork: string;
@@ -98,10 +130,18 @@ declare const CaatingaConfigSchema: z.ZodObject<{
98
130
  rpcUrl: string;
99
131
  networkPassphrase: string;
100
132
  }>;
101
- frontend: {
133
+ frontend?: {
102
134
  framework: "vite-react" | "next" | "astro";
103
135
  bindingsOutput: string;
104
- };
136
+ } | undefined;
137
+ zk?: {
138
+ circuits: Record<string, {
139
+ path: string;
140
+ protocol: "groth16";
141
+ curve: "bls12381";
142
+ verifierContract?: string | undefined;
143
+ }>;
144
+ } | undefined;
105
145
  }, {
106
146
  project: string;
107
147
  contracts: Record<string, {
@@ -114,11 +154,19 @@ declare const CaatingaConfigSchema: z.ZodObject<{
114
154
  rpcUrl: string;
115
155
  networkPassphrase: string;
116
156
  }>;
117
- frontend: {
157
+ defaultNetwork?: string | undefined;
158
+ frontend?: {
118
159
  bindingsOutput: string;
119
160
  framework?: "vite-react" | "next" | "astro" | undefined;
120
- };
121
- defaultNetwork?: string | undefined;
161
+ } | undefined;
162
+ zk?: {
163
+ circuits: Record<string, {
164
+ path: string;
165
+ protocol: "groth16";
166
+ curve: "bls12381";
167
+ verifierContract?: string | undefined;
168
+ }>;
169
+ } | undefined;
122
170
  }>;
123
171
  type CaatingaConfig = z.infer<typeof CaatingaConfigSchema>;
124
172
  type ContractConfig = z.infer<typeof ContractConfigSchema>;
@@ -232,6 +280,7 @@ type RunCommandResult = {
232
280
  type RunCommandOptions = {
233
281
  cwd?: string;
234
282
  env?: NodeJS.ProcessEnv;
283
+ input?: string;
235
284
  skipStellarVersionCheck?: boolean;
236
285
  failureCode?: CaatingaErrorCodeValue;
237
286
  };
@@ -286,6 +335,8 @@ type ResolvedContract = {
286
335
  };
287
336
  declare function resolveContract(config: CaatingaConfig, contractName: string, cwd?: string): ResolvedContract;
288
337
 
338
+ declare function resolveDefaultContractName(config: CaatingaConfig): string;
339
+
289
340
  type BuildContractOptions = {
290
341
  config: CaatingaConfig;
291
342
  contractName: string;
@@ -444,6 +495,7 @@ type CreateProjectFromTemplateOptions = {
444
495
  projectName: string;
445
496
  targetDir: string;
446
497
  templateDir: string;
498
+ filter?: (relativePath: string) => boolean;
447
499
  };
448
500
  declare function createProjectFromTemplate(options: CreateProjectFromTemplateOptions): Promise<{
449
501
  targetDir: string;
@@ -470,6 +522,16 @@ declare function createProjectFromTemplate(options: CreateProjectFromTemplateOpt
470
522
  };
471
523
  }>;
472
524
 
525
+ type CreateZkProjectOptions = {
526
+ projectName: string;
527
+ targetDir: string;
528
+ force?: boolean;
529
+ projectFiles?: boolean;
530
+ };
531
+ declare function createZkProject(options: CreateZkProjectOptions): Promise<{
532
+ targetDir: string;
533
+ }>;
534
+
473
535
  declare const TemplateManifestSchema: z.ZodObject<{
474
536
  name: z.ZodString;
475
537
  version: z.ZodString;
@@ -559,4 +621,4 @@ type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
559
621
 
560
622
  declare function isTransientTestnetSmokeFailure(logText: string): boolean;
561
623
 
562
- export { BINDING_MARKER_FILENAME, type BindingFreshness, type BindingFreshnessStatus, type BindingMarker, BindingMarkerSchema, type BuildContractOptions, CAATINGA_CORE_VERSION, CaatingaArtifacts, type CaatingaConfig, CaatingaConfigSchema, CaatingaError, type CheckStellarCliVersionOptions, type CollectProjectStatusOptions, type CompatibilityReport, type CompatibilityStatus, type CompatibilityWarning, type CompatibilityWarningCode, ContractArtifact, type ContractConfig, type ContractStatusEntry, type CreateInitialArtifactsOptions, type CreateProjectFromTemplateOptions, type DeployArgValue, type DeployContractGraphResult, type DeployContractOptions, type EvaluateBindingFreshnessOptions, type EvaluateStellarCliCompatibilityInput, type GenerateBindingsGraphResult, type GenerateBindingsOptions, type InvokeContractOptions, type InvokeTarget, type LoadConfigOptions, type NetworkConfig, type NetworkStatus, type ProjectStatus, type ResolvedContract, type ResolvedNetwork, type RunCommandResult, STELLAR_CLI_LAST_TESTED_VERSION, STELLAR_CLI_MIN_VERSION, type SkippedContract, type TemplateManifest, TemplateManifestSchema, WELL_KNOWN_NETWORKS, buildContract, buildDependencyGraph, checkBinary, checkStellarCliVersion, collectProjectStatus, createInitialArtifacts, createProjectFromTemplate, defineConfig, deployContract, deployContractGraph, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, generateBindings, generateBindingsGraph, invokeContract, isTransientTestnetSmokeFailure, loadConfig, parseContractId, parseInvokeTarget, parseStellarCliVersion, readArtifacts, readBindingMarker, resolveContract, resolveDeployArgs, resolveDeployOrder, resolveNetwork, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };
624
+ export { BINDING_MARKER_FILENAME, type BindingFreshness, type BindingFreshnessStatus, type BindingMarker, BindingMarkerSchema, type BuildContractOptions, CAATINGA_CORE_VERSION, CaatingaArtifacts, type CaatingaConfig, CaatingaConfigSchema, CaatingaError, type CheckStellarCliVersionOptions, type CollectProjectStatusOptions, type CompatibilityReport, type CompatibilityStatus, type CompatibilityWarning, type CompatibilityWarningCode, ContractArtifact, type ContractConfig, type ContractStatusEntry, type CreateInitialArtifactsOptions, type CreateProjectFromTemplateOptions, type CreateZkProjectOptions, type DeployArgValue, type DeployContractGraphResult, type DeployContractOptions, type EvaluateBindingFreshnessOptions, type EvaluateStellarCliCompatibilityInput, type GenerateBindingsGraphResult, type GenerateBindingsOptions, type InvokeContractOptions, type InvokeTarget, type LoadConfigOptions, type NetworkConfig, type NetworkStatus, type ProjectStatus, type ResolvedContract, type ResolvedNetwork, type RunCommandResult, STELLAR_CLI_LAST_TESTED_VERSION, STELLAR_CLI_MIN_VERSION, type SkippedContract, type TemplateManifest, TemplateManifestSchema, WELL_KNOWN_NETWORKS, buildContract, buildDependencyGraph, checkBinary, checkStellarCliVersion, collectProjectStatus, createInitialArtifacts, createProjectFromTemplate, createZkProject, defineConfig, deployContract, deployContractGraph, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, generateBindings, generateBindingsGraph, invokeContract, isTransientTestnetSmokeFailure, loadConfig, parseContractId, parseInvokeTarget, parseStellarCliVersion, readArtifacts, readBindingMarker, resolveContract, resolveDefaultContractName, resolveDeployArgs, resolveDeployOrder, resolveNetwork, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };