@caatinga/core 2.2.1 → 2.3.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/dist/index.cjs +40 -7
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +39 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,7 @@ __export(index_exports, {
|
|
|
66
66
|
readArtifacts: () => readArtifacts,
|
|
67
67
|
readBindingMarker: () => readBindingMarker,
|
|
68
68
|
resolveContract: () => resolveContract,
|
|
69
|
+
resolveDefaultContractName: () => resolveDefaultContractName,
|
|
69
70
|
resolveDeployArgs: () => resolveDeployArgs,
|
|
70
71
|
resolveDeployOrder: () => resolveDeployOrder,
|
|
71
72
|
resolveNetwork: () => resolveNetwork,
|
|
@@ -185,7 +186,7 @@ function formatCause(cause) {
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
// src/version.ts
|
|
188
|
-
var CAATINGA_CORE_VERSION = "2.
|
|
189
|
+
var CAATINGA_CORE_VERSION = "2.3.0";
|
|
189
190
|
|
|
190
191
|
// src/config/config.schema.ts
|
|
191
192
|
var import_zod = require("zod");
|
|
@@ -200,6 +201,15 @@ var NetworkConfigSchema = import_zod.z.object({
|
|
|
200
201
|
rpcUrl: import_zod.z.string().url(),
|
|
201
202
|
networkPassphrase: import_zod.z.string().min(1)
|
|
202
203
|
});
|
|
204
|
+
var ZkCircuitSchema = import_zod.z.object({
|
|
205
|
+
path: import_zod.z.string().min(1),
|
|
206
|
+
protocol: import_zod.z.literal("groth16"),
|
|
207
|
+
curve: import_zod.z.literal("bls12381"),
|
|
208
|
+
verifierContract: import_zod.z.string().optional()
|
|
209
|
+
});
|
|
210
|
+
var ZkConfigSchema = import_zod.z.object({
|
|
211
|
+
circuits: import_zod.z.record(import_zod.z.string().min(1), ZkCircuitSchema)
|
|
212
|
+
}).optional();
|
|
203
213
|
var CaatingaConfigSchema = import_zod.z.object({
|
|
204
214
|
project: import_zod.z.string().min(1),
|
|
205
215
|
defaultNetwork: import_zod.z.string().min(1).default("testnet"),
|
|
@@ -214,7 +224,8 @@ var CaatingaConfigSchema = import_zod.z.object({
|
|
|
214
224
|
frontend: import_zod.z.object({
|
|
215
225
|
framework: import_zod.z.enum(["vite-react", "next", "astro"]).default("vite-react"),
|
|
216
226
|
bindingsOutput: import_zod.z.string().min(1)
|
|
217
|
-
})
|
|
227
|
+
}),
|
|
228
|
+
zk: ZkConfigSchema
|
|
218
229
|
});
|
|
219
230
|
|
|
220
231
|
// src/config/define-config.ts
|
|
@@ -658,6 +669,7 @@ async function runCommand(command, args, options = {}) {
|
|
|
658
669
|
const result = await (0, import_execa.execa)(command, args, {
|
|
659
670
|
cwd: options.cwd,
|
|
660
671
|
env: options.env,
|
|
672
|
+
input: options.input,
|
|
661
673
|
all: true,
|
|
662
674
|
reject: true
|
|
663
675
|
});
|
|
@@ -872,6 +884,19 @@ function resolveContract(config, contractName, cwd = process.cwd()) {
|
|
|
872
884
|
};
|
|
873
885
|
}
|
|
874
886
|
|
|
887
|
+
// src/contracts/resolve-default-contract.ts
|
|
888
|
+
function resolveDefaultContractName(config) {
|
|
889
|
+
const names = Object.keys(config.contracts);
|
|
890
|
+
if (names.length === 1) {
|
|
891
|
+
return names[0];
|
|
892
|
+
}
|
|
893
|
+
throw new CaatingaError(
|
|
894
|
+
"Pass a contract name to build.",
|
|
895
|
+
CaatingaErrorCode.CONTRACT_NOT_FOUND,
|
|
896
|
+
`Configured contracts: ${names.join(", ")}. Example: caatinga build ${names[0]}`
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
|
|
875
900
|
// src/contracts/wasm.ts
|
|
876
901
|
var import_node_crypto = require("crypto");
|
|
877
902
|
var import_promises6 = require("fs/promises");
|
|
@@ -1662,15 +1687,18 @@ async function createProjectFromTemplate(options) {
|
|
|
1662
1687
|
);
|
|
1663
1688
|
}
|
|
1664
1689
|
const manifest = await readTemplateManifest(templateDir);
|
|
1690
|
+
const mergeIntoExisting = Boolean(options.filter);
|
|
1665
1691
|
await (0, import_promises8.mkdir)(targetDir, { recursive: true });
|
|
1666
1692
|
await (0, import_promises8.cp)(templateDir, targetDir, {
|
|
1667
1693
|
recursive: true,
|
|
1668
|
-
force:
|
|
1669
|
-
errorOnExist:
|
|
1670
|
-
filter: (source) => shouldCopyTemplateEntry(templateDir, source)
|
|
1694
|
+
force: mergeIntoExisting,
|
|
1695
|
+
errorOnExist: !mergeIntoExisting,
|
|
1696
|
+
filter: (source) => shouldCopyTemplateEntry(templateDir, source, options.filter)
|
|
1671
1697
|
});
|
|
1672
1698
|
await replaceTemplateVariables(targetDir, options.projectName);
|
|
1673
|
-
|
|
1699
|
+
if (!mergeIntoExisting) {
|
|
1700
|
+
await ensureArtifacts(targetDir, options.projectName);
|
|
1701
|
+
}
|
|
1674
1702
|
return { targetDir, template: manifest };
|
|
1675
1703
|
}
|
|
1676
1704
|
async function ensureArtifacts(targetDir, projectName) {
|
|
@@ -1736,11 +1764,15 @@ async function replaceTemplateVariables(dir, projectName) {
|
|
|
1736
1764
|
await (0, import_promises8.writeFile)(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
|
|
1737
1765
|
}));
|
|
1738
1766
|
}
|
|
1739
|
-
function shouldCopyTemplateEntry(templateDir, source) {
|
|
1767
|
+
function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
1740
1768
|
const relativePath = import_node_path10.default.relative(templateDir, source);
|
|
1741
1769
|
if (!relativePath || relativePath === ".") {
|
|
1742
1770
|
return true;
|
|
1743
1771
|
}
|
|
1772
|
+
const normalizedPath = relativePath.split(import_node_path10.default.sep).join("/");
|
|
1773
|
+
if (userFilter && !userFilter(normalizedPath)) {
|
|
1774
|
+
return false;
|
|
1775
|
+
}
|
|
1744
1776
|
return !relativePath.split(import_node_path10.default.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
|
|
1745
1777
|
}
|
|
1746
1778
|
function isTextTemplateFile(filePath) {
|
|
@@ -1814,6 +1846,7 @@ function isTransientTestnetSmokeFailure(logText) {
|
|
|
1814
1846
|
readArtifacts,
|
|
1815
1847
|
readBindingMarker,
|
|
1816
1848
|
resolveContract,
|
|
1849
|
+
resolveDefaultContractName,
|
|
1817
1850
|
resolveDeployArgs,
|
|
1818
1851
|
resolveDeployOrder,
|
|
1819
1852
|
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.
|
|
5
|
+
declare const CAATINGA_CORE_VERSION = "2.3.0";
|
|
6
6
|
|
|
7
7
|
declare const ContractConfigSchema: z.ZodObject<{
|
|
8
8
|
path: z.ZodString;
|
|
@@ -85,6 +85,38 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
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;
|
|
@@ -102,6 +134,14 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
102
134
|
framework: "vite-react" | "next" | "astro";
|
|
103
135
|
bindingsOutput: string;
|
|
104
136
|
};
|
|
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, {
|
|
@@ -119,6 +159,14 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
119
159
|
framework?: "vite-react" | "next" | "astro" | undefined;
|
|
120
160
|
};
|
|
121
161
|
defaultNetwork?: string | 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;
|
|
@@ -559,4 +611,4 @@ type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
|
|
|
559
611
|
|
|
560
612
|
declare function isTransientTestnetSmokeFailure(logText: string): boolean;
|
|
561
613
|
|
|
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 };
|
|
614
|
+
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, 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.
|
|
5
|
+
declare const CAATINGA_CORE_VERSION = "2.3.0";
|
|
6
6
|
|
|
7
7
|
declare const ContractConfigSchema: z.ZodObject<{
|
|
8
8
|
path: z.ZodString;
|
|
@@ -85,6 +85,38 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
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;
|
|
@@ -102,6 +134,14 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
102
134
|
framework: "vite-react" | "next" | "astro";
|
|
103
135
|
bindingsOutput: string;
|
|
104
136
|
};
|
|
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, {
|
|
@@ -119,6 +159,14 @@ declare const CaatingaConfigSchema: z.ZodObject<{
|
|
|
119
159
|
framework?: "vite-react" | "next" | "astro" | undefined;
|
|
120
160
|
};
|
|
121
161
|
defaultNetwork?: string | 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;
|
|
@@ -559,4 +611,4 @@ type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
|
|
|
559
611
|
|
|
560
612
|
declare function isTransientTestnetSmokeFailure(logText: string): boolean;
|
|
561
613
|
|
|
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 };
|
|
614
|
+
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, resolveDefaultContractName, resolveDeployArgs, resolveDeployOrder, resolveNetwork, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };
|
package/dist/index.js
CHANGED
|
@@ -105,7 +105,7 @@ function formatCause(cause) {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// src/version.ts
|
|
108
|
-
var CAATINGA_CORE_VERSION = "2.
|
|
108
|
+
var CAATINGA_CORE_VERSION = "2.3.0";
|
|
109
109
|
|
|
110
110
|
// src/config/config.schema.ts
|
|
111
111
|
import { z } from "zod";
|
|
@@ -120,6 +120,15 @@ var NetworkConfigSchema = z.object({
|
|
|
120
120
|
rpcUrl: z.string().url(),
|
|
121
121
|
networkPassphrase: z.string().min(1)
|
|
122
122
|
});
|
|
123
|
+
var ZkCircuitSchema = z.object({
|
|
124
|
+
path: z.string().min(1),
|
|
125
|
+
protocol: z.literal("groth16"),
|
|
126
|
+
curve: z.literal("bls12381"),
|
|
127
|
+
verifierContract: z.string().optional()
|
|
128
|
+
});
|
|
129
|
+
var ZkConfigSchema = z.object({
|
|
130
|
+
circuits: z.record(z.string().min(1), ZkCircuitSchema)
|
|
131
|
+
}).optional();
|
|
123
132
|
var CaatingaConfigSchema = z.object({
|
|
124
133
|
project: z.string().min(1),
|
|
125
134
|
defaultNetwork: z.string().min(1).default("testnet"),
|
|
@@ -134,7 +143,8 @@ var CaatingaConfigSchema = z.object({
|
|
|
134
143
|
frontend: z.object({
|
|
135
144
|
framework: z.enum(["vite-react", "next", "astro"]).default("vite-react"),
|
|
136
145
|
bindingsOutput: z.string().min(1)
|
|
137
|
-
})
|
|
146
|
+
}),
|
|
147
|
+
zk: ZkConfigSchema
|
|
138
148
|
});
|
|
139
149
|
|
|
140
150
|
// src/config/define-config.ts
|
|
@@ -577,6 +587,7 @@ async function runCommand(command, args, options = {}) {
|
|
|
577
587
|
const result = await execa(command, args, {
|
|
578
588
|
cwd: options.cwd,
|
|
579
589
|
env: options.env,
|
|
590
|
+
input: options.input,
|
|
580
591
|
all: true,
|
|
581
592
|
reject: true
|
|
582
593
|
});
|
|
@@ -791,6 +802,19 @@ function resolveContract(config, contractName, cwd = process.cwd()) {
|
|
|
791
802
|
};
|
|
792
803
|
}
|
|
793
804
|
|
|
805
|
+
// src/contracts/resolve-default-contract.ts
|
|
806
|
+
function resolveDefaultContractName(config) {
|
|
807
|
+
const names = Object.keys(config.contracts);
|
|
808
|
+
if (names.length === 1) {
|
|
809
|
+
return names[0];
|
|
810
|
+
}
|
|
811
|
+
throw new CaatingaError(
|
|
812
|
+
"Pass a contract name to build.",
|
|
813
|
+
CaatingaErrorCode.CONTRACT_NOT_FOUND,
|
|
814
|
+
`Configured contracts: ${names.join(", ")}. Example: caatinga build ${names[0]}`
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
|
|
794
818
|
// src/contracts/wasm.ts
|
|
795
819
|
import { createHash } from "crypto";
|
|
796
820
|
import { access as access2, readdir as readdir2, readFile as readFile3, stat } from "fs/promises";
|
|
@@ -1581,15 +1605,18 @@ async function createProjectFromTemplate(options) {
|
|
|
1581
1605
|
);
|
|
1582
1606
|
}
|
|
1583
1607
|
const manifest = await readTemplateManifest(templateDir);
|
|
1608
|
+
const mergeIntoExisting = Boolean(options.filter);
|
|
1584
1609
|
await mkdir3(targetDir, { recursive: true });
|
|
1585
1610
|
await cp(templateDir, targetDir, {
|
|
1586
1611
|
recursive: true,
|
|
1587
|
-
force:
|
|
1588
|
-
errorOnExist:
|
|
1589
|
-
filter: (source) => shouldCopyTemplateEntry(templateDir, source)
|
|
1612
|
+
force: mergeIntoExisting,
|
|
1613
|
+
errorOnExist: !mergeIntoExisting,
|
|
1614
|
+
filter: (source) => shouldCopyTemplateEntry(templateDir, source, options.filter)
|
|
1590
1615
|
});
|
|
1591
1616
|
await replaceTemplateVariables(targetDir, options.projectName);
|
|
1592
|
-
|
|
1617
|
+
if (!mergeIntoExisting) {
|
|
1618
|
+
await ensureArtifacts(targetDir, options.projectName);
|
|
1619
|
+
}
|
|
1593
1620
|
return { targetDir, template: manifest };
|
|
1594
1621
|
}
|
|
1595
1622
|
async function ensureArtifacts(targetDir, projectName) {
|
|
@@ -1655,11 +1682,15 @@ async function replaceTemplateVariables(dir, projectName) {
|
|
|
1655
1682
|
await writeFile3(entryPath, content.replaceAll("__PROJECT_NAME__", projectName), "utf8");
|
|
1656
1683
|
}));
|
|
1657
1684
|
}
|
|
1658
|
-
function shouldCopyTemplateEntry(templateDir, source) {
|
|
1685
|
+
function shouldCopyTemplateEntry(templateDir, source, userFilter) {
|
|
1659
1686
|
const relativePath = path10.relative(templateDir, source);
|
|
1660
1687
|
if (!relativePath || relativePath === ".") {
|
|
1661
1688
|
return true;
|
|
1662
1689
|
}
|
|
1690
|
+
const normalizedPath = relativePath.split(path10.sep).join("/");
|
|
1691
|
+
if (userFilter && !userFilter(normalizedPath)) {
|
|
1692
|
+
return false;
|
|
1693
|
+
}
|
|
1663
1694
|
return !relativePath.split(path10.sep).some((segment) => TEMPLATE_COPY_EXCLUDED_DIRS.has(segment));
|
|
1664
1695
|
}
|
|
1665
1696
|
function isTextTemplateFile(filePath) {
|
|
@@ -1732,6 +1763,7 @@ export {
|
|
|
1732
1763
|
readArtifacts,
|
|
1733
1764
|
readBindingMarker,
|
|
1734
1765
|
resolveContract,
|
|
1766
|
+
resolveDefaultContractName,
|
|
1735
1767
|
resolveDeployArgs,
|
|
1736
1768
|
resolveDeployOrder,
|
|
1737
1769
|
resolveNetwork,
|