@caatinga/core 3.1.2 → 3.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.d.cts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { C as CaatingaArtifacts, c as ContractArtifact, A as ArtifactSupersedeReason, d as CaatingaArtifactsV2, e as CaatingaErrorCodeValue, a as CaatingaError } from './artifact.schema-CIDkTrL3.cjs';
2
+ export { g as CURRENT_ARTIFACTS_SCHEMA_VERSION, h as CaatingaArtifactsSchema, b as CaatingaErrorCode, f as formatCaatingaError, t as toCaatingaError } from './artifact.schema-CIDkTrL3.cjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  declare const CAATINGA_CORE_VERSION: string;
@@ -76,14 +76,14 @@ declare const CaatingaConfigSchema: z.ZodObject<{
76
76
  networkPassphrase: string;
77
77
  }>>;
78
78
  frontend: z.ZodOptional<z.ZodObject<{
79
- framework: z.ZodDefault<z.ZodEnum<["vite-react", "next", "astro"]>>;
79
+ framework: z.ZodDefault<z.ZodLiteral<"vite-react">>;
80
80
  bindingsOutput: z.ZodString;
81
81
  }, "strip", z.ZodTypeAny, {
82
- framework: "vite-react" | "next" | "astro";
82
+ framework: "vite-react";
83
83
  bindingsOutput: string;
84
84
  }, {
85
85
  bindingsOutput: string;
86
- framework?: "vite-react" | "next" | "astro" | undefined;
86
+ framework?: "vite-react" | undefined;
87
87
  }>>;
88
88
  zk: z.ZodOptional<z.ZodObject<{
89
89
  circuits: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -131,7 +131,7 @@ declare const CaatingaConfigSchema: z.ZodObject<{
131
131
  networkPassphrase: string;
132
132
  }>;
133
133
  frontend?: {
134
- framework: "vite-react" | "next" | "astro";
134
+ framework: "vite-react";
135
135
  bindingsOutput: string;
136
136
  } | undefined;
137
137
  zk?: {
@@ -157,7 +157,7 @@ declare const CaatingaConfigSchema: z.ZodObject<{
157
157
  defaultNetwork?: string | undefined;
158
158
  frontend?: {
159
159
  bindingsOutput: string;
160
- framework?: "vite-react" | "next" | "astro" | undefined;
160
+ framework?: "vite-react" | undefined;
161
161
  } | undefined;
162
162
  zk?: {
163
163
  circuits: Record<string, {
@@ -188,10 +188,106 @@ type CreateInitialArtifactsOptions = {
188
188
  };
189
189
  declare function createInitialArtifacts(project: string, options?: CreateInitialArtifactsOptions): CaatingaArtifacts;
190
190
 
191
- declare function updateArtifact(artifacts: CaatingaArtifacts, networkName: string, contractName: string, contractArtifact: ContractArtifact, networkExtras?: {
191
+ type UpdateArtifactOptions = {
192
192
  dependencyGraph?: Record<string, string[]>;
193
+ supersedeReason?: ArtifactSupersedeReason;
194
+ };
195
+ declare function updateArtifact(artifacts: CaatingaArtifacts, networkName: string, contractName: string, contractArtifact: ContractArtifact, options?: UpdateArtifactOptions): CaatingaArtifacts;
196
+ declare function restoreArtifactFromHistory(input: {
197
+ artifacts: CaatingaArtifacts;
198
+ networkName: string;
199
+ contractName: string;
200
+ contractId: string;
193
201
  }): CaatingaArtifacts;
194
202
 
203
+ type MigrateArtifactsResult = {
204
+ artifacts: CaatingaArtifactsV2;
205
+ migrated: boolean;
206
+ };
207
+ declare function migrateArtifactsToV2(artifacts: CaatingaArtifacts): MigrateArtifactsResult;
208
+
209
+ declare function migrateArtifactsFile(cwd?: string): Promise<{
210
+ path: string;
211
+ migrated: boolean;
212
+ artifacts: {
213
+ project: string;
214
+ networks: Record<string, {
215
+ contracts: Record<string, {
216
+ contractId: string;
217
+ wasmHash: string;
218
+ deployedAt: string;
219
+ sourcePath: string;
220
+ wasmPath: string;
221
+ dependencies: string[];
222
+ resolvedDeployArgs: Record<string, string | number | boolean>;
223
+ history?: {
224
+ contractId: string;
225
+ wasmHash: string;
226
+ deployedAt: string;
227
+ supersededAt: string;
228
+ reason?: "upgrade" | "rollback" | "force-redeploy" | undefined;
229
+ }[] | undefined;
230
+ }>;
231
+ dependencyGraph: Record<string, string[]>;
232
+ }>;
233
+ version: 2;
234
+ };
235
+ }>;
236
+
237
+ declare function rollbackContractArtifact(input: {
238
+ networkName: string;
239
+ contractName: string;
240
+ contractId: string;
241
+ cwd?: string;
242
+ }): Promise<{
243
+ path: string;
244
+ artifacts: {
245
+ project: string;
246
+ networks: Record<string, {
247
+ contracts: Record<string, {
248
+ contractId: string;
249
+ wasmHash: string;
250
+ deployedAt: string;
251
+ sourcePath: string;
252
+ wasmPath: string;
253
+ dependencies: string[];
254
+ resolvedDeployArgs: Record<string, string | number | boolean>;
255
+ history?: {
256
+ contractId: string;
257
+ wasmHash: string;
258
+ deployedAt: string;
259
+ supersededAt: string;
260
+ reason?: "upgrade" | "rollback" | "force-redeploy" | undefined;
261
+ }[] | undefined;
262
+ }>;
263
+ dependencyGraph: Record<string, string[]>;
264
+ }>;
265
+ version: 1;
266
+ } | {
267
+ project: string;
268
+ networks: Record<string, {
269
+ contracts: Record<string, {
270
+ contractId: string;
271
+ wasmHash: string;
272
+ deployedAt: string;
273
+ sourcePath: string;
274
+ wasmPath: string;
275
+ dependencies: string[];
276
+ resolvedDeployArgs: Record<string, string | number | boolean>;
277
+ history?: {
278
+ contractId: string;
279
+ wasmHash: string;
280
+ deployedAt: string;
281
+ supersededAt: string;
282
+ reason?: "upgrade" | "rollback" | "force-redeploy" | undefined;
283
+ }[] | undefined;
284
+ }>;
285
+ dependencyGraph: Record<string, string[]>;
286
+ }>;
287
+ version: 2;
288
+ };
289
+ }>;
290
+
195
291
  declare const BINDING_MARKER_FILENAME = ".caatinga-bindings.json";
196
292
  declare const BindingMarkerSchema: z.ZodObject<{
197
293
  version: z.ZodLiteral<1>;
@@ -325,9 +421,42 @@ type CheckStellarCliVersionOptions = {
325
421
  features?: readonly string[];
326
422
  lastTestedVersion?: string;
327
423
  onWarning?: (warning: CompatibilityWarning) => void;
424
+ /** When false, skip live capability probes (used in unit tests). Default true. */
425
+ probeFeatures?: boolean;
328
426
  };
329
427
  declare function checkStellarCliVersion(input?: CheckStellarCliVersionOptions): Promise<CompatibilityReport>;
330
428
 
429
+ declare const STELLAR_SDK_MIN_VERSION = "16.0.1";
430
+ declare const STELLAR_SDK_LAST_TESTED_VERSION = "16.0.1";
431
+
432
+ type SdkCompatibilityStatus = "supported" | "untested" | "unsupported";
433
+ type SdkCompatibilityWarningCode = "STELLAR_SDK_UNTESTED_VERSION" | "STELLAR_SDK_VERSION_PARSE_FAILED";
434
+ type SdkCompatibilityWarning = {
435
+ code: SdkCompatibilityWarningCode;
436
+ message: string;
437
+ remediation?: string;
438
+ };
439
+ type SdkCompatibilityReport = {
440
+ version: string;
441
+ status: SdkCompatibilityStatus;
442
+ minVersion: string;
443
+ lastTestedVersion: string;
444
+ warnings: SdkCompatibilityWarning[];
445
+ };
446
+ type EvaluateStellarSdkCompatibilityInput = {
447
+ version: string;
448
+ lastTestedVersion?: string;
449
+ };
450
+ declare function evaluateStellarSdkCompatibility(input: EvaluateStellarSdkCompatibilityInput): SdkCompatibilityReport;
451
+ declare function parseStellarSdkVersion(raw: string): string;
452
+
453
+ type CheckStellarSdkVersionOptions = {
454
+ cwd?: string;
455
+ lastTestedVersion?: string;
456
+ onWarning?: (warning: SdkCompatibilityWarning) => void;
457
+ };
458
+ declare function checkStellarSdkVersion(input?: CheckStellarSdkVersionOptions): Promise<SdkCompatibilityReport>;
459
+
331
460
  declare function validateSourceShape(source: string): CaatingaError | undefined;
332
461
 
333
462
  type ResolvedContract = {
@@ -369,9 +498,17 @@ type DeployContractOptions = {
369
498
  source?: string;
370
499
  cwd?: string;
371
500
  force?: boolean;
501
+ upgrade?: boolean;
372
502
  checkStaleWasm?: boolean;
373
503
  resolvedDeployArgs?: Record<string, DeployArgValue>;
374
504
  dependencies?: string[];
505
+ onTransientDeployRetry?: (info: {
506
+ attempt: number;
507
+ maxAttempts: number;
508
+ delayMs: number;
509
+ }) => void;
510
+ /** Override retry backoff delays (primarily for tests). */
511
+ deployRetryDelaysMs?: readonly number[];
375
512
  };
376
513
  declare function deployContract(options: DeployContractOptions): Promise<{
377
514
  contract: {
@@ -429,8 +566,10 @@ declare function deployContractGraph(options: {
429
566
  cwd?: string;
430
567
  includeDependencies: boolean;
431
568
  force: boolean;
569
+ upgrade?: boolean;
432
570
  checkStaleWasm?: boolean;
433
571
  verifyDeps?: boolean;
572
+ onTransientDeployRetry?: DeployContractOptions["onTransientDeployRetry"];
434
573
  }): Promise<DeployContractGraphResult>;
435
574
 
436
575
  declare function buildDependencyGraph(contracts: Record<string, ContractConfig>): Record<string, string[]>;
@@ -512,6 +651,53 @@ declare function readContract(options: ReadContractOptions): Promise<{
512
651
  result: string;
513
652
  }>;
514
653
 
654
+ type DeployCostEstimate = {
655
+ contractName: string;
656
+ network: string;
657
+ wasmPath: string;
658
+ inclusionFeeStroops: number;
659
+ resourceFeeStroops?: number;
660
+ totalFeeStroops: number;
661
+ advisory: string;
662
+ rawOutput?: string;
663
+ };
664
+ type EstimateDeployCostOptions = {
665
+ config: CaatingaConfig;
666
+ contractName: string;
667
+ networkName?: string;
668
+ source?: string;
669
+ cwd?: string;
670
+ };
671
+ declare function estimateDeployCost(options: EstimateDeployCostOptions): Promise<DeployCostEstimate>;
672
+
673
+ type ContractInspectResult = {
674
+ contractName: string;
675
+ network: string;
676
+ artifact: {
677
+ contractId: string;
678
+ wasmHash: string;
679
+ deployedAt: string;
680
+ historyCount: number;
681
+ };
682
+ onChain: {
683
+ reachable: boolean;
684
+ detail?: string;
685
+ };
686
+ localWasm: {
687
+ path: string;
688
+ hash?: string;
689
+ matchesArtifact: boolean;
690
+ };
691
+ dependencies: string[];
692
+ };
693
+ type InspectContractOptions = {
694
+ config: CaatingaConfig;
695
+ contractName: string;
696
+ networkName?: string;
697
+ cwd?: string;
698
+ };
699
+ declare function inspectContract(options: InspectContractOptions): Promise<ContractInspectResult>;
700
+
515
701
  type CreateProjectFromTemplateOptions = {
516
702
  projectName: string;
517
703
  targetDir: string;
@@ -526,7 +712,7 @@ declare function createProjectFromTemplate(options: CreateProjectFromTemplateOpt
526
712
  default?: string | undefined;
527
713
  };
528
714
  frontend: {
529
- framework: "vite-react" | "next" | "astro";
715
+ framework: "vite-react";
530
716
  packageManager: "npm" | "pnpm" | "yarn" | "bun";
531
717
  };
532
718
  version: string;
@@ -536,8 +722,8 @@ declare function createProjectFromTemplate(options: CreateProjectFromTemplateOpt
536
722
  templateVersion: number;
537
723
  };
538
724
  files: {
539
- config: string;
540
725
  artifacts: string;
726
+ config: string;
541
727
  };
542
728
  description?: string | undefined;
543
729
  };
@@ -577,13 +763,13 @@ declare const TemplateManifestSchema: z.ZodObject<{
577
763
  templateVersion: number;
578
764
  }>;
579
765
  frontend: z.ZodObject<{
580
- framework: z.ZodEnum<["vite-react", "next", "astro"]>;
766
+ framework: z.ZodLiteral<"vite-react">;
581
767
  packageManager: z.ZodDefault<z.ZodEnum<["npm", "pnpm", "yarn", "bun"]>>;
582
768
  }, "strip", z.ZodTypeAny, {
583
- framework: "vite-react" | "next" | "astro";
769
+ framework: "vite-react";
584
770
  packageManager: "npm" | "pnpm" | "yarn" | "bun";
585
771
  }, {
586
- framework: "vite-react" | "next" | "astro";
772
+ framework: "vite-react";
587
773
  packageManager?: "npm" | "pnpm" | "yarn" | "bun" | undefined;
588
774
  }>;
589
775
  contracts: z.ZodObject<{
@@ -600,11 +786,11 @@ declare const TemplateManifestSchema: z.ZodObject<{
600
786
  config: z.ZodDefault<z.ZodString>;
601
787
  artifacts: z.ZodDefault<z.ZodString>;
602
788
  }, "strip", z.ZodTypeAny, {
603
- config: string;
604
789
  artifacts: string;
790
+ config: string;
605
791
  }, {
606
- config?: string | undefined;
607
792
  artifacts?: string | undefined;
793
+ config?: string | undefined;
608
794
  }>;
609
795
  }, "strip", z.ZodTypeAny, {
610
796
  contracts: {
@@ -612,7 +798,7 @@ declare const TemplateManifestSchema: z.ZodObject<{
612
798
  default?: string | undefined;
613
799
  };
614
800
  frontend: {
615
- framework: "vite-react" | "next" | "astro";
801
+ framework: "vite-react";
616
802
  packageManager: "npm" | "pnpm" | "yarn" | "bun";
617
803
  };
618
804
  version: string;
@@ -622,8 +808,8 @@ declare const TemplateManifestSchema: z.ZodObject<{
622
808
  templateVersion: number;
623
809
  };
624
810
  files: {
625
- config: string;
626
811
  artifacts: string;
812
+ config: string;
627
813
  };
628
814
  description?: string | undefined;
629
815
  }, {
@@ -632,7 +818,7 @@ declare const TemplateManifestSchema: z.ZodObject<{
632
818
  default?: string | undefined;
633
819
  };
634
820
  frontend: {
635
- framework: "vite-react" | "next" | "astro";
821
+ framework: "vite-react";
636
822
  packageManager?: "npm" | "pnpm" | "yarn" | "bun" | undefined;
637
823
  };
638
824
  version: string;
@@ -642,8 +828,8 @@ declare const TemplateManifestSchema: z.ZodObject<{
642
828
  templateVersion: number;
643
829
  };
644
830
  files: {
645
- config?: string | undefined;
646
831
  artifacts?: string | undefined;
832
+ config?: string | undefined;
647
833
  };
648
834
  description?: string | undefined;
649
835
  }>;
@@ -651,4 +837,4 @@ type TemplateManifest = z.infer<typeof TemplateManifestSchema>;
651
837
 
652
838
  declare function isTransientTestnetSmokeFailure(logText: string): boolean;
653
839
 
654
- 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 CreateMinimalProjectOptions, 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, READ_CALL_FAILURE_REGEX, type ReadContractOptions, 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, buildReadCallHint, checkBinary, checkStellarCliVersion, collectProjectStatus, createInitialArtifacts, createMinimalProject, createProjectFromTemplate, createZkProject, defineConfig, deployContract, deployContractGraph, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, generateBindings, generateBindingsGraph, invokeContract, isCargoBinMissingFromPath, isReadCallFailure, isTransientTestnetSmokeFailure, loadConfig, parseContractId, parseInvokeTarget, parseStellarCliVersion, readArtifacts, readBindingMarker, readContract, resolveContract, resolveDefaultContractName, resolveDeployArgs, resolveDeployOrder, resolveNetwork, resolveSubprocessEnv, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };
840
+ export { BINDING_MARKER_FILENAME, type BindingFreshness, type BindingFreshnessStatus, type BindingMarker, BindingMarkerSchema, type BuildContractOptions, CAATINGA_CORE_VERSION, CaatingaArtifacts, type CaatingaConfig, CaatingaConfigSchema, CaatingaError, type CheckStellarCliVersionOptions, type CheckStellarSdkVersionOptions, type CollectProjectStatusOptions, type CompatibilityReport, type CompatibilityStatus, type CompatibilityWarning, type CompatibilityWarningCode, ContractArtifact, type ContractConfig, type ContractInspectResult, type ContractStatusEntry, type CreateInitialArtifactsOptions, type CreateMinimalProjectOptions, type CreateProjectFromTemplateOptions, type CreateZkProjectOptions, type DeployArgValue, type DeployContractGraphResult, type DeployContractOptions, type DeployCostEstimate, type EstimateDeployCostOptions, type EvaluateBindingFreshnessOptions, type EvaluateStellarCliCompatibilityInput, type EvaluateStellarSdkCompatibilityInput, type GenerateBindingsGraphResult, type GenerateBindingsOptions, type InspectContractOptions, type InvokeContractOptions, type InvokeTarget, type LoadConfigOptions, type NetworkConfig, type NetworkStatus, type ProjectStatus, READ_CALL_FAILURE_REGEX, type ReadContractOptions, type ResolvedContract, type ResolvedNetwork, type RunCommandResult, STELLAR_CLI_LAST_TESTED_VERSION, STELLAR_CLI_MIN_VERSION, STELLAR_SDK_LAST_TESTED_VERSION, STELLAR_SDK_MIN_VERSION, type SdkCompatibilityReport, type SdkCompatibilityStatus, type SdkCompatibilityWarning, type SdkCompatibilityWarningCode, type SkippedContract, type TemplateManifest, TemplateManifestSchema, WELL_KNOWN_NETWORKS, buildContract, buildDependencyGraph, buildReadCallHint, checkBinary, checkStellarCliVersion, checkStellarSdkVersion, collectProjectStatus, createInitialArtifacts, createMinimalProject, createProjectFromTemplate, createZkProject, defineConfig, deployContract, deployContractGraph, estimateDeployCost, evaluateBindingFreshness, evaluateBindingsFreshness, evaluateStellarCliCompatibility, evaluateStellarSdkCompatibility, generateBindings, generateBindingsGraph, inspectContract, invokeContract, isCargoBinMissingFromPath, isReadCallFailure, isTransientTestnetSmokeFailure, loadConfig, migrateArtifactsFile, migrateArtifactsToV2, parseContractId, parseInvokeTarget, parseStellarCliVersion, parseStellarSdkVersion, readArtifacts, readBindingMarker, readContract, resolveContract, resolveDefaultContractName, resolveDeployArgs, resolveDeployOrder, resolveNetwork, resolveSubprocessEnv, restoreArtifactFromHistory, rollbackContractArtifact, runCommand, updateArtifact, validateSourceShape, writeArtifacts, writeBindingMarker };