@caatinga/cli 0.2.3 → 2.0.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.
Files changed (49) hide show
  1. package/README.md +6 -7
  2. package/dist/index.js +220 -157
  3. package/package.json +3 -2
  4. package/templates/marketplace-with-token/README.md +21 -0
  5. package/templates/marketplace-with-token/caatinga.artifacts.json +10 -0
  6. package/templates/marketplace-with-token/caatinga.config.ts +30 -0
  7. package/templates/marketplace-with-token/caatinga.template.json +21 -0
  8. package/templates/marketplace-with-token/contracts/marketplace/Cargo.lock +1731 -0
  9. package/templates/marketplace-with-token/contracts/marketplace/Cargo.toml +24 -0
  10. package/templates/marketplace-with-token/contracts/marketplace/src/lib.rs +43 -0
  11. package/templates/marketplace-with-token/contracts/marketplace/test_snapshots/test/stores_token_contract_id_in_constructor.1.json +86 -0
  12. package/templates/marketplace-with-token/contracts/token/Cargo.lock +1731 -0
  13. package/templates/marketplace-with-token/contracts/token/Cargo.toml +24 -0
  14. package/templates/marketplace-with-token/contracts/token/src/lib.rs +13 -0
  15. package/templates/marketplace-with-token/index.html +12 -0
  16. package/templates/marketplace-with-token/package.json +28 -0
  17. package/templates/marketplace-with-token/src/App.tsx +57 -0
  18. package/templates/marketplace-with-token/src/main.ts +12 -0
  19. package/templates/marketplace-with-token/src/main.tsx +10 -0
  20. package/templates/marketplace-with-token/src/styles.css +157 -0
  21. package/templates/marketplace-with-token/tsconfig.json +21 -0
  22. package/templates/marketplace-with-token/vite.config.ts +6 -0
  23. package/templates/react-vite-counter/.env.example +5 -0
  24. package/templates/react-vite-counter/README.md +83 -0
  25. package/templates/react-vite-counter/caatinga.artifacts.json +10 -0
  26. package/templates/react-vite-counter/caatinga.config.ts +26 -0
  27. package/templates/react-vite-counter/caatinga.template.json +21 -0
  28. package/templates/react-vite-counter/contracts/counter/Cargo.lock +1731 -0
  29. package/templates/react-vite-counter/contracts/counter/Cargo.toml +24 -0
  30. package/templates/react-vite-counter/contracts/counter/src/lib.rs +100 -0
  31. package/templates/react-vite-counter/contracts/counter/test_snapshots/test/get_returns_zero_before_increment.1.json +76 -0
  32. package/templates/react-vite-counter/contracts/counter/test_snapshots/test/increment_returns_overflow_error.1.json +91 -0
  33. package/templates/react-vite-counter/contracts/counter/test_snapshots/test/increments_counter.1.json +91 -0
  34. package/templates/react-vite-counter/contracts/counter/test_snapshots/test/repeated_increments_preserve_state.1.json +92 -0
  35. package/templates/react-vite-counter/index.html +12 -0
  36. package/templates/react-vite-counter/package.json +30 -0
  37. package/templates/react-vite-counter/pnpm-workspace.yaml +12 -0
  38. package/templates/react-vite-counter/public/.gitkeep +1 -0
  39. package/templates/react-vite-counter/src/App.tsx +18 -0
  40. package/templates/react-vite-counter/src/caatinga.ts +20 -0
  41. package/templates/react-vite-counter/src/components/CounterCard.tsx +86 -0
  42. package/templates/react-vite-counter/src/components/WalletButton.tsx +69 -0
  43. package/templates/react-vite-counter/src/contracts/generated/counter.ts +58 -0
  44. package/templates/react-vite-counter/src/hooks/useStellarWallet.ts +70 -0
  45. package/templates/react-vite-counter/src/main.tsx +10 -0
  46. package/templates/react-vite-counter/src/styles.css +206 -0
  47. package/templates/react-vite-counter/src/wallet.ts +29 -0
  48. package/templates/react-vite-counter/tsconfig.json +22 -0
  49. package/templates/react-vite-counter/vite.config.ts +18 -0
@@ -0,0 +1,24 @@
1
+ [package]
2
+ name = "marketplace"
3
+ version = "0.1.0"
4
+ rust-version = "1.84.0"
5
+ edition = "2021"
6
+
7
+ [lib]
8
+ crate-type = ["cdylib"]
9
+
10
+ [dependencies]
11
+ soroban-sdk = "22.0.1"
12
+
13
+ [dev-dependencies]
14
+ soroban-sdk = { version = "22.0.1", features = ["testutils"] }
15
+
16
+ [profile.release]
17
+ opt-level = "z"
18
+ overflow-checks = true
19
+ debug = 0
20
+ strip = "symbols"
21
+ debug-assertions = false
22
+ panic = "abort"
23
+ codegen-units = 1
24
+ lto = true
@@ -0,0 +1,43 @@
1
+ #![no_std]
2
+
3
+ use soroban_sdk::{contract, contractimpl, symbol_short, Address, Env, Symbol};
4
+
5
+ const TOKEN_CONTRACT_ID: Symbol = symbol_short!("TOKEN");
6
+
7
+ #[contract]
8
+ pub struct MarketplaceContract;
9
+
10
+ #[contractimpl]
11
+ impl MarketplaceContract {
12
+ pub fn __constructor(env: Env, token_contract_id: Address) {
13
+ env.storage().instance().set(&TOKEN_CONTRACT_ID, &token_contract_id);
14
+ }
15
+
16
+ pub fn token_contract_id(env: Env) -> Address {
17
+ env.storage().instance().get(&TOKEN_CONTRACT_ID).unwrap()
18
+ }
19
+
20
+ pub fn version(_env: Env) -> u32 {
21
+ 1
22
+ }
23
+ }
24
+
25
+ #[cfg(test)]
26
+ mod test {
27
+ use super::*;
28
+ use soroban_sdk::testutils::Address as _;
29
+
30
+ #[test]
31
+ fn stores_token_contract_id_in_constructor() {
32
+ let env = Env::default();
33
+ let token_contract_id = Address::generate(&env);
34
+ let contract_id = env.register(
35
+ MarketplaceContract,
36
+ MarketplaceContractArgs::__constructor(&token_contract_id),
37
+ );
38
+ let client = MarketplaceContractClient::new(&env, &contract_id);
39
+
40
+ assert_eq!(client.token_contract_id(), token_contract_id);
41
+ assert_eq!(client.version(), 1);
42
+ }
43
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "generators": {
3
+ "address": 2,
4
+ "nonce": 0
5
+ },
6
+ "auth": [
7
+ [],
8
+ [],
9
+ []
10
+ ],
11
+ "ledger": {
12
+ "protocol_version": 22,
13
+ "sequence_number": 0,
14
+ "timestamp": 0,
15
+ "network_id": "0000000000000000000000000000000000000000000000000000000000000000",
16
+ "base_reserve": 0,
17
+ "min_persistent_entry_ttl": 4096,
18
+ "min_temp_entry_ttl": 16,
19
+ "max_entry_ttl": 6312000,
20
+ "ledger_entries": [
21
+ [
22
+ {
23
+ "contract_data": {
24
+ "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
25
+ "key": "ledger_key_contract_instance",
26
+ "durability": "persistent"
27
+ }
28
+ },
29
+ [
30
+ {
31
+ "last_modified_ledger_seq": 0,
32
+ "data": {
33
+ "contract_data": {
34
+ "ext": "v0",
35
+ "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
36
+ "key": "ledger_key_contract_instance",
37
+ "durability": "persistent",
38
+ "val": {
39
+ "contract_instance": {
40
+ "executable": {
41
+ "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
42
+ },
43
+ "storage": [
44
+ {
45
+ "key": {
46
+ "symbol": "TOKEN"
47
+ },
48
+ "val": {
49
+ "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM"
50
+ }
51
+ }
52
+ ]
53
+ }
54
+ }
55
+ }
56
+ },
57
+ "ext": "v0"
58
+ },
59
+ 4095
60
+ ]
61
+ ],
62
+ [
63
+ {
64
+ "contract_code": {
65
+ "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
66
+ }
67
+ },
68
+ [
69
+ {
70
+ "last_modified_ledger_seq": 0,
71
+ "data": {
72
+ "contract_code": {
73
+ "ext": "v0",
74
+ "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
75
+ "code": ""
76
+ }
77
+ },
78
+ "ext": "v0"
79
+ },
80
+ 4095
81
+ ]
82
+ ]
83
+ ]
84
+ },
85
+ "events": []
86
+ }