@caatinga/cli 0.2.3 → 0.2.4
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.js +23 -8
- package/package.json +2 -2
- package/templates/marketplace-with-token/README.md +21 -0
- package/templates/marketplace-with-token/caatinga.artifacts.json +10 -0
- package/templates/marketplace-with-token/caatinga.config.ts +30 -0
- package/templates/marketplace-with-token/caatinga.template.json +21 -0
- package/templates/marketplace-with-token/contracts/marketplace/Cargo.lock +1731 -0
- package/templates/marketplace-with-token/contracts/marketplace/Cargo.toml +24 -0
- package/templates/marketplace-with-token/contracts/marketplace/src/lib.rs +43 -0
- package/templates/marketplace-with-token/contracts/token/Cargo.lock +1731 -0
- package/templates/marketplace-with-token/contracts/token/Cargo.toml +24 -0
- package/templates/marketplace-with-token/contracts/token/src/lib.rs +13 -0
- package/templates/marketplace-with-token/index.html +12 -0
- package/templates/marketplace-with-token/package.json +28 -0
- package/templates/marketplace-with-token/src/App.tsx +57 -0
- package/templates/marketplace-with-token/src/main.ts +12 -0
- package/templates/marketplace-with-token/src/main.tsx +10 -0
- package/templates/marketplace-with-token/src/styles.css +157 -0
- package/templates/marketplace-with-token/tsconfig.json +21 -0
- package/templates/marketplace-with-token/vite.config.ts +6 -0
- package/templates/react-vite-counter/.env.example +5 -0
- package/templates/react-vite-counter/README.md +67 -0
- package/templates/react-vite-counter/caatinga.artifacts.json +10 -0
- package/templates/react-vite-counter/caatinga.config.ts +26 -0
- package/templates/react-vite-counter/caatinga.template.json +21 -0
- package/templates/react-vite-counter/contracts/counter/Cargo.lock +1731 -0
- package/templates/react-vite-counter/contracts/counter/Cargo.toml +24 -0
- package/templates/react-vite-counter/contracts/counter/src/lib.rs +36 -0
- package/templates/react-vite-counter/index.html +12 -0
- package/templates/react-vite-counter/package.json +30 -0
- package/templates/react-vite-counter/public/.gitkeep +1 -0
- package/templates/react-vite-counter/src/App.tsx +18 -0
- package/templates/react-vite-counter/src/caatinga.ts +20 -0
- package/templates/react-vite-counter/src/components/CounterCard.tsx +82 -0
- package/templates/react-vite-counter/src/components/WalletButton.tsx +69 -0
- package/templates/react-vite-counter/src/contracts/generated/counter.ts +58 -0
- package/templates/react-vite-counter/src/hooks/useStellarWallet.ts +70 -0
- package/templates/react-vite-counter/src/main.tsx +10 -0
- package/templates/react-vite-counter/src/styles.css +206 -0
- package/templates/react-vite-counter/src/wallet.ts +28 -0
- package/templates/react-vite-counter/tsconfig.json +22 -0
- package/templates/react-vite-counter/vite.config.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -419,12 +419,19 @@ import path from "path";
|
|
|
419
419
|
import { fileURLToPath } from "url";
|
|
420
420
|
import { CaatingaError as CaatingaError3, CaatingaErrorCode as CaatingaErrorCode3 } from "@caatinga/core";
|
|
421
421
|
async function resolveTemplateDir(templateName) {
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
422
|
+
const candidates = buildTemplateCandidates(templateName);
|
|
423
|
+
if (process.env.CAATINGA_DEBUG_TEMPLATE_RESOLUTION === "1") {
|
|
424
|
+
const envValue = process.env.CAATINGA_TEMPLATES_DIR ?? "<unset>";
|
|
425
|
+
const cwd = process.cwd();
|
|
426
|
+
process.stderr.write(
|
|
427
|
+
`caatinga: template resolution candidates for "${templateName}": env=${envValue} cwd=${cwd}
|
|
428
|
+
`
|
|
429
|
+
);
|
|
430
|
+
for (const candidate of candidates) {
|
|
431
|
+
process.stderr.write(`caatinga: candidate ${candidate}
|
|
432
|
+
`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
428
435
|
for (const candidate of candidates) {
|
|
429
436
|
try {
|
|
430
437
|
await access2(candidate);
|
|
@@ -435,9 +442,17 @@ async function resolveTemplateDir(templateName) {
|
|
|
435
442
|
throw new CaatingaError3(
|
|
436
443
|
`Template "${templateName}" was not found.`,
|
|
437
444
|
CaatingaErrorCode3.TEMPLATE_NOT_FOUND,
|
|
438
|
-
"Set CAATINGA_TEMPLATES_DIR or run from a Caatinga checkout that includes packages/templates."
|
|
445
|
+
"Set CAATINGA_TEMPLATES_DIR, run `pnpm build` before `pnpm pack`, or run from a Caatinga checkout that includes packages/templates."
|
|
439
446
|
);
|
|
440
447
|
}
|
|
448
|
+
function buildTemplateCandidates(templateName) {
|
|
449
|
+
const envTemplatesDir = process.env.CAATINGA_TEMPLATES_DIR;
|
|
450
|
+
return [
|
|
451
|
+
envTemplatesDir ? path.join(envTemplatesDir, templateName) : void 0,
|
|
452
|
+
path.resolve(process.cwd(), "packages", "templates", templateName),
|
|
453
|
+
...candidatePathsFromModule(templateName)
|
|
454
|
+
].filter((candidate) => Boolean(candidate));
|
|
455
|
+
}
|
|
441
456
|
function candidatePathsFromModule(templateName) {
|
|
442
457
|
const currentFile = fileURLToPath(import.meta.url);
|
|
443
458
|
const start = path.dirname(currentFile);
|
|
@@ -506,7 +521,7 @@ function registerInvokeCommand(program2) {
|
|
|
506
521
|
}
|
|
507
522
|
|
|
508
523
|
// src/version.ts
|
|
509
|
-
var CAATINGA_CLI_VERSION = "0.2.
|
|
524
|
+
var CAATINGA_CLI_VERSION = "0.2.4";
|
|
510
525
|
|
|
511
526
|
// src/program.ts
|
|
512
527
|
function createProgram() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caatinga/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Caatinga CLI for building dApps on Stellar/Soroban",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stellar",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"LICENSE"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@caatinga/core": "^0.2.
|
|
46
|
+
"@caatinga/core": "^0.2.4",
|
|
47
47
|
"chalk": "^5.4.1",
|
|
48
48
|
"commander": "^12.1.0"
|
|
49
49
|
},
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
2
|
+
|
|
3
|
+
Experimental Caatinga multi-contract template with a real constructor dependency.
|
|
4
|
+
|
|
5
|
+
## Deploy
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
npx caatinga build token
|
|
10
|
+
npx caatinga build marketplace
|
|
11
|
+
npx caatinga deploy --network testnet --source alice
|
|
12
|
+
npx caatinga generate token
|
|
13
|
+
npx caatinga generate marketplace
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Deploy order:
|
|
17
|
+
|
|
18
|
+
1. `token`
|
|
19
|
+
2. `marketplace`
|
|
20
|
+
|
|
21
|
+
`marketplace.deployArgs.tokenContractId` resolves from `${contracts.token.contractId}` after the token deploy writes `caatinga.artifacts.json`. Caatinga passes that value to the contract `__constructor` as `--token_contract_id`.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineConfig } from "@caatinga/core";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
project: "__PROJECT_NAME__",
|
|
5
|
+
defaultNetwork: "testnet",
|
|
6
|
+
contracts: {
|
|
7
|
+
token: {
|
|
8
|
+
path: "./contracts/token",
|
|
9
|
+
wasm: "./contracts/token/target/wasm32v1-none/release/token.wasm"
|
|
10
|
+
},
|
|
11
|
+
marketplace: {
|
|
12
|
+
path: "./contracts/marketplace",
|
|
13
|
+
wasm: "./contracts/marketplace/target/wasm32v1-none/release/marketplace.wasm",
|
|
14
|
+
dependsOn: ["token"],
|
|
15
|
+
deployArgs: {
|
|
16
|
+
tokenContractId: "${contracts.token.contractId}"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
networks: {
|
|
21
|
+
testnet: {
|
|
22
|
+
rpcUrl: "https://soroban-testnet.stellar.org",
|
|
23
|
+
networkPassphrase: "Test SDF Network ; September 2015"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
frontend: {
|
|
27
|
+
framework: "vite-react",
|
|
28
|
+
bindingsOutput: "./src/contracts/generated"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "marketplace-with-token",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Experimental multi-contract Soroban template with token dependency injection.",
|
|
5
|
+
"caatinga": {
|
|
6
|
+
"compatibleCore": "^0.2.4",
|
|
7
|
+
"templateVersion": 1
|
|
8
|
+
},
|
|
9
|
+
"frontend": {
|
|
10
|
+
"framework": "vite-react",
|
|
11
|
+
"packageManager": "npm"
|
|
12
|
+
},
|
|
13
|
+
"contracts": {
|
|
14
|
+
"path": "contracts",
|
|
15
|
+
"default": "marketplace"
|
|
16
|
+
},
|
|
17
|
+
"files": {
|
|
18
|
+
"config": "caatinga.config.ts",
|
|
19
|
+
"artifacts": "caatinga.artifacts.json"
|
|
20
|
+
}
|
|
21
|
+
}
|