@caatinga/cli 0.2.0 → 0.2.2

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.
Files changed (34) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +101 -34
  3. package/dist/index.js +326 -39
  4. package/package.json +2 -2
  5. package/templates/marketplace-with-token/README.md +4 -2
  6. package/templates/marketplace-with-token/caatinga.config.ts +2 -2
  7. package/templates/marketplace-with-token/caatinga.template.json +1 -1
  8. package/templates/marketplace-with-token/contracts/marketplace/Cargo.lock +1731 -0
  9. package/templates/marketplace-with-token/contracts/marketplace/Cargo.toml +1 -0
  10. package/templates/marketplace-with-token/contracts/marketplace/src/lib.rs +31 -1
  11. package/templates/marketplace-with-token/contracts/token/Cargo.lock +1731 -0
  12. package/templates/marketplace-with-token/contracts/token/Cargo.toml +1 -0
  13. package/templates/marketplace-with-token/index.html +12 -0
  14. package/templates/marketplace-with-token/package.json +14 -3
  15. package/templates/marketplace-with-token/src/App.tsx +57 -0
  16. package/templates/marketplace-with-token/src/main.ts +3 -1
  17. package/templates/marketplace-with-token/src/main.tsx +10 -0
  18. package/templates/marketplace-with-token/src/styles.css +157 -0
  19. package/templates/marketplace-with-token/tsconfig.json +14 -4
  20. package/templates/marketplace-with-token/vite.config.ts +6 -0
  21. package/templates/react-vite-counter/README.md +1 -1
  22. package/templates/react-vite-counter/caatinga.artifacts.json +10 -0
  23. package/templates/react-vite-counter/caatinga.config.ts +1 -1
  24. package/templates/react-vite-counter/caatinga.template.json +1 -1
  25. package/templates/react-vite-counter/contracts/counter/Cargo.lock +1731 -0
  26. package/templates/react-vite-counter/contracts/counter/Cargo.toml +1 -0
  27. package/templates/react-vite-counter/package.json +3 -3
  28. package/templates/react-vite-counter/src/caatinga.ts +20 -0
  29. package/templates/react-vite-counter/src/components/CounterCard.tsx +40 -3
  30. package/templates/react-vite-counter/src/components/WalletButton.tsx +58 -5
  31. package/templates/react-vite-counter/src/contracts/generated/counter.ts +49 -0
  32. package/templates/react-vite-counter/src/styles.css +21 -0
  33. package/templates/react-vite-counter/tsconfig.json +1 -1
  34. package/templates/react-vite-counter/src/contracts/generated/.gitkeep +0 -1
@@ -1,6 +1,7 @@
1
1
  [package]
2
2
  name = "token"
3
3
  version = "0.1.0"
4
+ rust-version = "1.84.0"
4
5
  edition = "2021"
5
6
 
6
7
  [lib]
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>__PROJECT_NAME__</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>
@@ -4,14 +4,25 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc && vite build",
9
+ "preview": "vite preview",
7
10
  "caatinga:build": "caatinga build token && caatinga build marketplace",
8
- "caatinga:deploy": "caatinga deploy --network testnet"
11
+ "caatinga:deploy": "caatinga deploy --network testnet",
12
+ "caatinga:generate": "caatinga generate token && caatinga generate marketplace"
9
13
  },
10
14
  "dependencies": {
11
- "@caatinga/core": "^0.2.0"
15
+ "@caatinga/client": "^0.2.2",
16
+ "@caatinga/core": "^0.2.2",
17
+ "@vitejs/plugin-react": "^4.3.4",
18
+ "react": "^18.3.1",
19
+ "react-dom": "^18.3.1",
20
+ "vite": "^6.0.6"
12
21
  },
13
22
  "devDependencies": {
14
- "@caatinga/cli": "^0.2.0",
23
+ "@caatinga/cli": "^0.2.2",
24
+ "@types/react": "^18.3.18",
25
+ "@types/react-dom": "^18.3.5",
15
26
  "typescript": "^5.7.2"
16
27
  }
17
28
  }
@@ -0,0 +1,57 @@
1
+ const deploySteps = [
2
+ "Build token and marketplace contracts",
3
+ "Deploy token first so artifacts capture its contractId",
4
+ "Deploy marketplace and inject tokenContractId via __constructor",
5
+ "Generate bindings for both contracts"
6
+ ];
7
+
8
+ export default function App() {
9
+ return (
10
+ <main className="app-shell">
11
+ <header className="hero">
12
+ <p className="eyebrow">Caatinga Multi-Contract</p>
13
+ <h1>__PROJECT_NAME__</h1>
14
+ <p className="lede">
15
+ Official demo template for dependency-ordered deploys where the marketplace constructor
16
+ receives the deployed token contract ID.
17
+ </p>
18
+ </header>
19
+
20
+ <section className="panel">
21
+ <div className="panel__header">
22
+ <div>
23
+ <p className="eyebrow">Contracts</p>
24
+ <h2>Deployment graph</h2>
25
+ </div>
26
+ <span className="network-pill">testnet</span>
27
+ </div>
28
+
29
+ <div className="graph">
30
+ <article className="graph-card">
31
+ <p className="graph-card__label">Root contract</p>
32
+ <h3>token</h3>
33
+ <p>Deploys first and publishes its contract ID into local artifacts.</p>
34
+ </article>
35
+ <article className="graph-card graph-card--dependent">
36
+ <p className="graph-card__label">Dependent contract</p>
37
+ <h3>marketplace</h3>
38
+ <p>
39
+ Receives <code>tokenContractId</code> through <code>deployArgs</code> mapped to the
40
+ contract <code>__constructor</code>.
41
+ </p>
42
+ </article>
43
+ </div>
44
+ </section>
45
+
46
+ <section className="panel">
47
+ <p className="eyebrow">Flow</p>
48
+ <h2>What this template proves</h2>
49
+ <ol className="steps">
50
+ {deploySteps.map((step) => (
51
+ <li key={step}>{step}</li>
52
+ ))}
53
+ </ol>
54
+ </section>
55
+ </main>
56
+ );
57
+ }
@@ -5,6 +5,8 @@ export function describeDeployFlow(): string {
5
5
  "1. caatinga build token",
6
6
  "2. caatinga build marketplace",
7
7
  "3. caatinga deploy --network testnet --source <identity>",
8
- "marketplace.deployArgs.tokenContractId resolves from caatinga.artifacts.json"
8
+ "4. caatinga generate token",
9
+ "5. caatinga generate marketplace",
10
+ "marketplace.deployArgs.tokenContractId resolves from caatinga.artifacts.json and is passed to __constructor"
9
11
  ].join("\n");
10
12
  }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import ReactDOM from "react-dom/client";
3
+ import App from "./App";
4
+ import "./styles.css";
5
+
6
+ ReactDOM.createRoot(document.getElementById("root")!).render(
7
+ <React.StrictMode>
8
+ <App />
9
+ </React.StrictMode>
10
+ );
@@ -0,0 +1,157 @@
1
+ :root {
2
+ color: #142322;
3
+ background:
4
+ radial-gradient(circle at top, rgba(255, 208, 118, 0.22), transparent 32%),
5
+ linear-gradient(180deg, #f7f1e4 0%, #efe7d2 100%);
6
+ font-family:
7
+ "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
8
+ font-synthesis: none;
9
+ text-rendering: optimizeLegibility;
10
+ }
11
+
12
+ * {
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ margin: 0;
18
+ min-width: 320px;
19
+ min-height: 100vh;
20
+ }
21
+
22
+ code {
23
+ padding: 0.1rem 0.35rem;
24
+ border-radius: 0.35rem;
25
+ background: rgba(20, 35, 34, 0.08);
26
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
27
+ }
28
+
29
+ .app-shell {
30
+ width: min(960px, calc(100vw - 32px));
31
+ margin: 0 auto;
32
+ padding: 32px 0 48px;
33
+ }
34
+
35
+ .hero,
36
+ .panel {
37
+ border: 1px solid rgba(20, 35, 34, 0.12);
38
+ border-radius: 24px;
39
+ background: rgba(255, 252, 245, 0.86);
40
+ box-shadow: 0 18px 60px rgba(20, 35, 34, 0.08);
41
+ }
42
+
43
+ .hero {
44
+ margin-bottom: 20px;
45
+ padding: clamp(24px, 5vw, 48px);
46
+ }
47
+
48
+ .panel {
49
+ margin-bottom: 20px;
50
+ padding: 24px;
51
+ }
52
+
53
+ .hero h1,
54
+ .panel h2,
55
+ .graph-card h3 {
56
+ margin: 0;
57
+ }
58
+
59
+ .hero h1 {
60
+ font-size: clamp(2.4rem, 8vw, 4.6rem);
61
+ line-height: 0.95;
62
+ max-width: 10ch;
63
+ }
64
+
65
+ .lede {
66
+ max-width: 60ch;
67
+ margin: 16px 0 0;
68
+ font-size: 1.05rem;
69
+ line-height: 1.6;
70
+ }
71
+
72
+ .eyebrow {
73
+ margin: 0 0 10px;
74
+ color: #7c5a16;
75
+ font-family: "Trebuchet MS", "Avenir Next", sans-serif;
76
+ font-size: 0.78rem;
77
+ font-weight: 800;
78
+ letter-spacing: 0.12em;
79
+ text-transform: uppercase;
80
+ }
81
+
82
+ .panel__header {
83
+ display: flex;
84
+ align-items: flex-start;
85
+ justify-content: space-between;
86
+ gap: 16px;
87
+ margin-bottom: 20px;
88
+ }
89
+
90
+ .network-pill {
91
+ display: inline-flex;
92
+ align-items: center;
93
+ min-height: 32px;
94
+ border-radius: 999px;
95
+ padding: 0 12px;
96
+ background: #173f3a;
97
+ color: #fff8ec;
98
+ font-family: "Trebuchet MS", "Avenir Next", sans-serif;
99
+ font-size: 0.8rem;
100
+ font-weight: 700;
101
+ letter-spacing: 0.08em;
102
+ text-transform: uppercase;
103
+ }
104
+
105
+ .graph {
106
+ display: grid;
107
+ gap: 16px;
108
+ }
109
+
110
+ .graph-card {
111
+ position: relative;
112
+ padding: 18px;
113
+ border-radius: 18px;
114
+ background: #fffdfa;
115
+ border: 1px solid rgba(20, 35, 34, 0.1);
116
+ }
117
+
118
+ .graph-card--dependent::before {
119
+ content: "dependsOn token";
120
+ display: inline-block;
121
+ margin-bottom: 12px;
122
+ padding: 0.3rem 0.6rem;
123
+ border-radius: 999px;
124
+ background: rgba(124, 90, 22, 0.12);
125
+ color: #7c5a16;
126
+ font-family: "Trebuchet MS", "Avenir Next", sans-serif;
127
+ font-size: 0.75rem;
128
+ font-weight: 700;
129
+ letter-spacing: 0.04em;
130
+ text-transform: uppercase;
131
+ }
132
+
133
+ .graph-card__label {
134
+ margin: 0 0 6px;
135
+ color: #5d6766;
136
+ font-family: "Trebuchet MS", "Avenir Next", sans-serif;
137
+ font-size: 0.8rem;
138
+ text-transform: uppercase;
139
+ }
140
+
141
+ .steps {
142
+ margin: 16px 0 0;
143
+ padding-left: 1.25rem;
144
+ line-height: 1.7;
145
+ }
146
+
147
+ @media (min-width: 700px) {
148
+ .graph {
149
+ grid-template-columns: repeat(2, minmax(0, 1fr));
150
+ }
151
+ }
152
+
153
+ @media (max-width: 560px) {
154
+ .panel__header {
155
+ flex-direction: column;
156
+ }
157
+ }
@@ -1,11 +1,21 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "ES2020",
4
- "module": "ESNext",
5
- "moduleResolution": "Bundler",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["DOM", "DOM.Iterable", "ES2020"],
6
+ "allowJs": false,
6
7
  "strict": true,
7
8
  "skipLibCheck": true,
8
- "noEmit": true
9
+ "esModuleInterop": true,
10
+ "allowSyntheticDefaultImports": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "module": "ESNext",
13
+ "moduleResolution": "Node",
14
+ "resolveJsonModule": true,
15
+ "isolatedModules": true,
16
+ "noEmit": true,
17
+ "jsx": "react-jsx"
9
18
  },
10
- "include": ["src", "caatinga.config.ts"]
19
+ "include": ["src"],
20
+ "references": []
11
21
  }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()]
6
+ });
@@ -13,7 +13,7 @@ npx caatinga invoke counter.increment --network testnet --source alice
13
13
  npm run dev
14
14
  ```
15
15
 
16
- Use a Stellar CLI identity alias or public account address for `--source`; do not pass seed phrases or secret keys.
16
+ Use a local Stellar CLI identity alias for `--source`; public `G...` addresses, seed phrases, and secret keys are rejected for signing operations.
17
17
 
18
18
  ## Client Smoke Path
19
19
 
@@ -0,0 +1,10 @@
1
+ {
2
+ "project": "__PROJECT_NAME__",
3
+ "version": 1,
4
+ "networks": {
5
+ "testnet": {
6
+ "contracts": {},
7
+ "dependencyGraph": {}
8
+ }
9
+ }
10
+ }
@@ -6,7 +6,7 @@ export default defineConfig({
6
6
  contracts: {
7
7
  counter: {
8
8
  path: "./contracts/counter",
9
- wasm: "./contracts/counter/target/wasm32-unknown-unknown/release/counter.wasm"
9
+ wasm: "./contracts/counter/target/wasm32v1-none/release/counter.wasm"
10
10
  }
11
11
  },
12
12
  networks: {
@@ -3,7 +3,7 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Minimal Vite + React + Soroban counter dApp.",
5
5
  "caatinga": {
6
- "compatibleCore": "^0.1.0",
6
+ "compatibleCore": "^0.2.2",
7
7
  "templateVersion": 1
8
8
  },
9
9
  "frontend": {