movementkit-cli 1.0.1 → 1.0.3
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 +11 -7
- package/kits/engineer/.claude/agents/devops.md +176 -0
- package/kits/engineer/.claude/agents/frontend.md +207 -0
- package/kits/engineer/.claude/agents/smart-contract.md +150 -0
- package/kits/engineer/.claude/agents/tester.md +174 -0
- package/kits/engineer/.claude/commands/cook/contracts.md +174 -0
- package/kits/engineer/.claude/commands/cook/frontend.md +325 -0
- package/kits/engineer/.claude/commands/cook.md +118 -0
- package/kits/engineer/.claude/commands/deploy-full.md +158 -0
- package/kits/engineer/.claude/commands/deploy-smart-contract.md +177 -0
- package/kits/engineer/.claude/commands/docs/generate.md +121 -0
- package/kits/engineer/.claude/commands/docs/init.md +132 -0
- package/kits/engineer/.claude/commands/plan.md +103 -0
- package/kits/engineer/.claude/commands/review.md +98 -0
- package/kits/engineer/.claude/commands/test.md +92 -0
- package/kits/engineer/.claude/commands/watzup.md +100 -0
- package/kits/engineer/.claude/workflows/development-rules.md +110 -0
- package/kits/engineer/.claude/workflows/primary-workflow.md +95 -0
- package/kits/engineer/CLAUDE.md +105 -0
- package/kits/engineer/contracts/Move.toml +13 -0
- package/kits/engineer/contracts/sources/counter.move +122 -0
- package/kits/engineer/contracts/tests/counter_tests.move +96 -0
- package/kits/engineer/docs/MOVE_LANGUAGE_REFERENCE.md +560 -0
- package/kits/engineer/frontend/.env.example +9 -0
- package/kits/engineer/frontend/index.html +14 -0
- package/kits/engineer/frontend/package.json +29 -0
- package/kits/engineer/frontend/src/App.tsx +41 -0
- package/kits/engineer/frontend/src/components/WalletConnect.tsx +54 -0
- package/kits/engineer/frontend/src/contexts/WalletContext.tsx +42 -0
- package/kits/engineer/frontend/src/hooks/useContract.ts +95 -0
- package/kits/engineer/frontend/src/index.css +76 -0
- package/kits/engineer/frontend/src/main.tsx +11 -0
- package/kits/engineer/frontend/tsconfig.json +22 -0
- package/kits/engineer/frontend/tsconfig.node.json +11 -0
- package/kits/engineer/frontend/vite.config.ts +17 -0
- package/package.json +3 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# /cook - Full dApp Code Generation
|
|
2
|
+
|
|
3
|
+
Generate complete production-ready code for a Movement blockchain dApp.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
### Install Movement CLI
|
|
8
|
+
|
|
9
|
+
Before generating code, ensure the Movement CLI is installed. See [Movement CLI docs](https://docs.movementnetwork.xyz/devs/movementcli) for details.
|
|
10
|
+
|
|
11
|
+
#### Quick Install (Testnet - with Move 2 support)
|
|
12
|
+
|
|
13
|
+
**macOS (Apple Silicon/M-series):**
|
|
14
|
+
```bash
|
|
15
|
+
curl -LO https://github.com/movementlabsxyz/homebrew-movement-cli/releases/download/bypass-homebrew/movement-move2-testnet-macos-arm64.tar.gz && mkdir -p temp_extract && tar -xzf movement-move2-testnet-macos-arm64.tar.gz -C temp_extract && chmod +x temp_extract/movement && sudo mv temp_extract/movement /usr/local/bin/movement && rm -rf temp_extract movement-move2-testnet-macos-arm64.tar.gz
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**macOS (Intel):**
|
|
19
|
+
```bash
|
|
20
|
+
curl -LO https://github.com/movementlabsxyz/homebrew-movement-cli/releases/download/bypass-homebrew/movement-move2-testnet-macos-x86_64.tar.gz && mkdir -p temp_extract && tar -xzf movement-move2-testnet-macos-x86_64.tar.gz -C temp_extract && chmod +x temp_extract/movement && sudo mv temp_extract/movement /usr/local/bin/movement && rm -rf temp_extract movement-move2-testnet-macos-x86_64.tar.gz
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Linux (x86_64):**
|
|
24
|
+
```bash
|
|
25
|
+
curl -LO https://github.com/movementlabsxyz/homebrew-movement-cli/releases/download/bypass-homebrew/movement-move2-testnet-linux-x86_64.tar.gz && mkdir -p temp_extract && tar -xzf movement-move2-testnet-linux-x86_64.tar.gz -C temp_extract && chmod +x temp_extract/movement && sudo mv temp_extract/movement /usr/local/bin/movement && rm -rf temp_extract movement-move2-testnet-linux-x86_64.tar.gz
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Verify installation:**
|
|
29
|
+
```bash
|
|
30
|
+
movement --version
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Initialize Account (if not done)
|
|
34
|
+
```bash
|
|
35
|
+
movement init --network testnet
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This creates a `.movement/config.yaml` with your account credentials.
|
|
39
|
+
|
|
40
|
+
### Get Testnet Tokens
|
|
41
|
+
Visit https://faucet.movementnetwork.xyz/ to get testnet MOVE tokens.
|
|
42
|
+
|
|
43
|
+
## Workflow
|
|
44
|
+
|
|
45
|
+
This command orchestrates the generation of a complete dApp:
|
|
46
|
+
|
|
47
|
+
### Phase 1: Research & Planning (if no plan exists)
|
|
48
|
+
Check for existing plans and read Move language reference:
|
|
49
|
+
```bash
|
|
50
|
+
cat docs/MOVE_LANGUAGE_REFERENCE.md
|
|
51
|
+
ls plans/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Phase 2: Smart Contract Implementation
|
|
55
|
+
Generate in `contracts/`:
|
|
56
|
+
- `Move.toml` - Package manifest with dependencies
|
|
57
|
+
- `sources/*.move` - Move module source files
|
|
58
|
+
- `tests/*.move` - Move unit tests
|
|
59
|
+
|
|
60
|
+
### Phase 3: Frontend Implementation
|
|
61
|
+
Generate in `frontend/`:
|
|
62
|
+
- `package.json` - React dependencies
|
|
63
|
+
- `src/App.tsx` - Main application component
|
|
64
|
+
- `src/components/*.tsx` - UI components
|
|
65
|
+
- `src/hooks/*.ts` - Custom React hooks
|
|
66
|
+
- `src/contexts/*.tsx` - React contexts (wallet, etc.)
|
|
67
|
+
- `tests/*.test.tsx` - Frontend tests
|
|
68
|
+
|
|
69
|
+
### Phase 4: Testing
|
|
70
|
+
Ensure:
|
|
71
|
+
- Move unit tests pass
|
|
72
|
+
- Frontend tests pass
|
|
73
|
+
- Coverage >90%
|
|
74
|
+
|
|
75
|
+
### Phase 5: Code Review
|
|
76
|
+
Check:
|
|
77
|
+
- Move security best practices
|
|
78
|
+
- No vulnerabilities
|
|
79
|
+
- Code quality standards
|
|
80
|
+
- Documentation completeness
|
|
81
|
+
|
|
82
|
+
## Sub-Commands
|
|
83
|
+
|
|
84
|
+
### /cook:contracts
|
|
85
|
+
Generate only Move smart contracts
|
|
86
|
+
|
|
87
|
+
### /cook:frontend
|
|
88
|
+
Generate only React frontend
|
|
89
|
+
|
|
90
|
+
## Output Summary
|
|
91
|
+
|
|
92
|
+
After completion, display:
|
|
93
|
+
```markdown
|
|
94
|
+
# 🍳 Cook Complete!
|
|
95
|
+
|
|
96
|
+
## Generated Files
|
|
97
|
+
- Contracts: {count} files
|
|
98
|
+
- Frontend: {count} files
|
|
99
|
+
- Tests: {count} files
|
|
100
|
+
|
|
101
|
+
## Test Results
|
|
102
|
+
- Move tests: ✅ {passed}/{total}
|
|
103
|
+
- Frontend tests: ✅ {passed}/{total}
|
|
104
|
+
- Coverage: {percentage}%
|
|
105
|
+
|
|
106
|
+
## Next Steps
|
|
107
|
+
1. Review generated code
|
|
108
|
+
2. Run `/test` for comprehensive testing
|
|
109
|
+
3. Run `/review` for security audit
|
|
110
|
+
4. Run `/deploy-full` to deploy to testnet
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Success Criteria
|
|
114
|
+
- Contracts generated in <3 minutes
|
|
115
|
+
- Frontend generated in <3 minutes
|
|
116
|
+
- All tests passing
|
|
117
|
+
- Coverage >90%
|
|
118
|
+
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# /deploy-full - Full Deployment to Movement Network
|
|
2
|
+
|
|
3
|
+
Deploy the complete dApp to Movement testnet or mainnet.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. **Movement CLI installed** - See [Movement CLI docs](https://docs.movementnetwork.xyz/devs/movementcli)
|
|
8
|
+
2. **Wallet configured** in `.movement/config.yaml`
|
|
9
|
+
3. **Sufficient tokens** from [faucet](https://faucet.movementnetwork.xyz/) (for testnet)
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Pre-Deployment Checks
|
|
14
|
+
|
|
15
|
+
1. **Verify all tests pass**
|
|
16
|
+
```bash
|
|
17
|
+
cd contracts && movement move test
|
|
18
|
+
cd ../frontend && npm test
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Run security review**
|
|
22
|
+
Execute `/review` command and ensure no critical issues
|
|
23
|
+
|
|
24
|
+
3. **Verify Movement CLI configuration**
|
|
25
|
+
Check `.movement/config.yaml` is configured for the target network:
|
|
26
|
+
```yaml
|
|
27
|
+
---
|
|
28
|
+
profiles:
|
|
29
|
+
default:
|
|
30
|
+
network: Custom
|
|
31
|
+
private_key: "0xYOUR_PRIVATE_KEY"
|
|
32
|
+
public_key: "0xYOUR_PUBLIC_KEY"
|
|
33
|
+
account: "YOUR_ACCOUNT_ADDRESS"
|
|
34
|
+
rest_url: "https://full.testnet.movementinfra.xyz/v1" # or mainnet
|
|
35
|
+
faucet_url: "https://faucet.testnet.movementnetwork.xyz/"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
4. **Configure Move.toml addresses**
|
|
39
|
+
Add your deployment address to `contracts/Move.toml`:
|
|
40
|
+
```toml
|
|
41
|
+
[addresses]
|
|
42
|
+
module_addr = "YOUR_ACCOUNT_ADDRESS"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Step 2: Deploy Smart Contracts
|
|
46
|
+
|
|
47
|
+
Use `/deploy-smart-contract` command or run manually:
|
|
48
|
+
|
|
49
|
+
#### Testnet Deployment
|
|
50
|
+
```bash
|
|
51
|
+
cd contracts
|
|
52
|
+
movement move publish --named-addresses module_addr=default
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### Mainnet Deployment
|
|
56
|
+
```bash
|
|
57
|
+
cd contracts
|
|
58
|
+
movement move publish \
|
|
59
|
+
--url https://full.mainnet.movementinfra.xyz/v1 \
|
|
60
|
+
--named-addresses module_addr=default
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
When prompted:
|
|
64
|
+
```
|
|
65
|
+
Do you want to submit this transaction? [Y/n]
|
|
66
|
+
```
|
|
67
|
+
Type `Y` and press **Enter** to confirm.
|
|
68
|
+
|
|
69
|
+
> **Important:** Ensure you have sufficient tokens from the faucet before proceeding.
|
|
70
|
+
|
|
71
|
+
### Step 3: Verify Contract Deployment
|
|
72
|
+
|
|
73
|
+
1. Get deployed address and transaction hash from output
|
|
74
|
+
2. Verify on Movement Explorer:
|
|
75
|
+
- Testnet: `https://explorer.movementnetwork.xyz/?network=testnet`
|
|
76
|
+
- Mainnet: `https://explorer.movementnetwork.xyz/?network=mainnet`
|
|
77
|
+
|
|
78
|
+
### Step 4: Update Frontend Configuration
|
|
79
|
+
|
|
80
|
+
Update contract address in `frontend/.env` so the frontend can interact with the deployed contract:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# frontend/.env
|
|
84
|
+
VITE_MODULE_ADDRESS=<YOUR_DEPLOYED_CONTRACT_ADDRESS>
|
|
85
|
+
VITE_NETWORK=testnet # or mainnet
|
|
86
|
+
VITE_NODE_URL=https://full.testnet.movementinfra.xyz/v1 # or mainnet URL
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 5: Deploy Frontend
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cd frontend
|
|
93
|
+
npm run build
|
|
94
|
+
# Deploy to hosting service (Vercel, Netlify, etc.)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 6: Post-Deployment Verification
|
|
98
|
+
|
|
99
|
+
1. Test contract interactions via Explorer
|
|
100
|
+
2. Test frontend wallet connection
|
|
101
|
+
3. Execute sample transactions
|
|
102
|
+
|
|
103
|
+
## Sub-Commands
|
|
104
|
+
|
|
105
|
+
### /deploy-full:testnet
|
|
106
|
+
Deploy complete dApp to testnet
|
|
107
|
+
|
|
108
|
+
### /deploy-full:mainnet
|
|
109
|
+
Deploy complete dApp to mainnet (requires additional confirmation)
|
|
110
|
+
|
|
111
|
+
### /deploy-full:contracts
|
|
112
|
+
Deploy only smart contracts (see `/deploy-smart-contract`)
|
|
113
|
+
|
|
114
|
+
## Deployment Report
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
# 🚀 Deployment Complete!
|
|
118
|
+
|
|
119
|
+
## Network: {Testnet/Mainnet}
|
|
120
|
+
## Timestamp: {ISO timestamp}
|
|
121
|
+
|
|
122
|
+
## Smart Contracts
|
|
123
|
+
| Module | Address | Tx Hash |
|
|
124
|
+
|--------|---------|---------|
|
|
125
|
+
| module_name | 0x... | 0x... |
|
|
126
|
+
|
|
127
|
+
## Verification Links
|
|
128
|
+
- Explorer: {link}
|
|
129
|
+
- Contract: {link}
|
|
130
|
+
|
|
131
|
+
## Configuration Updates
|
|
132
|
+
- Frontend config updated: ✅
|
|
133
|
+
|
|
134
|
+
## Post-Deployment Tests
|
|
135
|
+
- Contract interaction: ✅
|
|
136
|
+
- Frontend connection: ✅
|
|
137
|
+
|
|
138
|
+
## Next Steps
|
|
139
|
+
1. Monitor contract activity on Explorer
|
|
140
|
+
2. Set up alerts for critical events
|
|
141
|
+
3. Document deployment for team
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Safety Checks
|
|
145
|
+
|
|
146
|
+
### Mainnet Deployment Requires:
|
|
147
|
+
- [ ] All tests passing
|
|
148
|
+
- [ ] Security review completed with no critical issues
|
|
149
|
+
- [ ] Testnet deployment successful
|
|
150
|
+
- [ ] Manual confirmation from user
|
|
151
|
+
- [ ] Backup of deployment keys
|
|
152
|
+
|
|
153
|
+
## Success Criteria
|
|
154
|
+
- Deployment completed in <5 minutes
|
|
155
|
+
- All contracts verified on Explorer
|
|
156
|
+
- Configuration files updated
|
|
157
|
+
- Post-deployment tests passing
|
|
158
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# /deploy-smart-contract - Deploy Move Smart Contracts
|
|
2
|
+
|
|
3
|
+
Deploy Move smart contracts to the Movement Network (testnet or mainnet).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. **Movement CLI installed** - See [Movement CLI docs](https://docs.movementnetwork.xyz/devs/movementcli)
|
|
8
|
+
2. **Wallet configured** with private key
|
|
9
|
+
3. **Sufficient tokens** from [faucet](https://faucet.movementnetwork.xyz/) (for testnet)
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Verify Configuration
|
|
14
|
+
|
|
15
|
+
Check your `.movement/config.yaml` is configured for the target network:
|
|
16
|
+
|
|
17
|
+
#### Testnet Configuration
|
|
18
|
+
```yaml
|
|
19
|
+
---
|
|
20
|
+
profiles:
|
|
21
|
+
default:
|
|
22
|
+
network: Custom
|
|
23
|
+
private_key: "0xYOUR_PRIVATE_KEY"
|
|
24
|
+
public_key: "0xYOUR_PUBLIC_KEY"
|
|
25
|
+
account: "YOUR_ACCOUNT_ADDRESS"
|
|
26
|
+
rest_url: "https://full.testnet.movementinfra.xyz/v1"
|
|
27
|
+
faucet_url: "https://faucet.testnet.movementnetwork.xyz/"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### Mainnet Configuration
|
|
31
|
+
```yaml
|
|
32
|
+
---
|
|
33
|
+
profiles:
|
|
34
|
+
default:
|
|
35
|
+
network: Custom
|
|
36
|
+
private_key: "0xYOUR_PRIVATE_KEY"
|
|
37
|
+
public_key: "0xYOUR_PUBLIC_KEY"
|
|
38
|
+
account: "YOUR_ACCOUNT_ADDRESS"
|
|
39
|
+
rest_url: "https://full.mainnet.movementinfra.xyz/v1"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Step 2: Configure Move.toml
|
|
43
|
+
|
|
44
|
+
Add your deployment address to `contracts/Move.toml`:
|
|
45
|
+
|
|
46
|
+
```toml
|
|
47
|
+
[addresses]
|
|
48
|
+
module_addr = "YOUR_ACCOUNT_ADDRESS"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or use `_` for dynamic address assignment during deployment:
|
|
52
|
+
```toml
|
|
53
|
+
[addresses]
|
|
54
|
+
module_addr = "_"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 3: Compile Contracts
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cd contracts
|
|
61
|
+
movement move compile
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Verify compilation succeeds without errors.
|
|
65
|
+
|
|
66
|
+
### Step 4: Run Tests
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
movement move test
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Ensure all tests pass before deployment.
|
|
73
|
+
|
|
74
|
+
### Step 5: Deploy to Network
|
|
75
|
+
|
|
76
|
+
#### Testnet Deployment
|
|
77
|
+
```bash
|
|
78
|
+
cd contracts
|
|
79
|
+
movement move publish --named-addresses module_addr=default
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### Mainnet Deployment
|
|
83
|
+
```bash
|
|
84
|
+
cd contracts
|
|
85
|
+
movement move publish \
|
|
86
|
+
--url https://full.mainnet.movementinfra.xyz/v1 \
|
|
87
|
+
--named-addresses module_addr=default
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Step 6: Confirm Transaction
|
|
91
|
+
|
|
92
|
+
You'll be prompted:
|
|
93
|
+
```
|
|
94
|
+
Do you want to submit this transaction? [Y/n]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Type `Y` and press **Enter** to confirm.
|
|
98
|
+
|
|
99
|
+
> **Note:** Ensure you have sufficient tokens from the faucet before proceeding.
|
|
100
|
+
|
|
101
|
+
### Step 7: Verify Deployment
|
|
102
|
+
|
|
103
|
+
1. Note the transaction hash from the output
|
|
104
|
+
2. Verify on Movement Explorer:
|
|
105
|
+
- Testnet: `https://explorer.movementnetwork.xyz/?network=testnet`
|
|
106
|
+
- Mainnet: `https://explorer.movementnetwork.xyz/?network=mainnet`
|
|
107
|
+
|
|
108
|
+
### Step 8: Update Frontend Configuration
|
|
109
|
+
|
|
110
|
+
Update the contract address in `frontend/.env` so the frontend can interact with the deployed contract:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# frontend/.env
|
|
114
|
+
VITE_MODULE_ADDRESS=<YOUR_DEPLOYED_CONTRACT_ADDRESS>
|
|
115
|
+
VITE_NETWORK=testnet # or mainnet
|
|
116
|
+
VITE_NODE_URL=https://full.testnet.movementinfra.xyz/v1 # or mainnet URL
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
```bash
|
|
121
|
+
VITE_MODULE_ADDRESS=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
|
|
122
|
+
VITE_NETWORK=testnet
|
|
123
|
+
VITE_NODE_URL=https://full.testnet.movementinfra.xyz/v1
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
> **Note:** After updating `.env`, restart the frontend dev server for changes to take effect.
|
|
127
|
+
|
|
128
|
+
## Sub-Commands
|
|
129
|
+
|
|
130
|
+
### /deploy-smart-contract:testnet
|
|
131
|
+
Deploy to testnet only.
|
|
132
|
+
|
|
133
|
+
### /deploy-smart-contract:mainnet
|
|
134
|
+
Deploy to mainnet (requires additional confirmation).
|
|
135
|
+
|
|
136
|
+
### /deploy-smart-contract:verify
|
|
137
|
+
Verify an existing deployment on the Explorer.
|
|
138
|
+
|
|
139
|
+
## Deployment Report
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
# 📜 Smart Contract Deployment Complete!
|
|
143
|
+
|
|
144
|
+
## Network: {Testnet/Mainnet}
|
|
145
|
+
## Timestamp: {ISO timestamp}
|
|
146
|
+
|
|
147
|
+
## Deployed Modules
|
|
148
|
+
| Module | Address | Tx Hash |
|
|
149
|
+
|--------|---------|---------|
|
|
150
|
+
| {name} | 0x... | 0x... |
|
|
151
|
+
|
|
152
|
+
## Verification
|
|
153
|
+
- Explorer: {link}
|
|
154
|
+
- Status: ✅ Verified
|
|
155
|
+
|
|
156
|
+
## Next Steps
|
|
157
|
+
1. Test contract interactions from frontend
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Troubleshooting
|
|
161
|
+
|
|
162
|
+
### Insufficient Gas
|
|
163
|
+
Ensure you have enough MOVE tokens. Get testnet tokens from:
|
|
164
|
+
- Faucet: https://faucet.movementnetwork.xyz/
|
|
165
|
+
|
|
166
|
+
### Compilation Errors
|
|
167
|
+
Run `movement move compile` first and fix any errors.
|
|
168
|
+
|
|
169
|
+
### Account Not Found
|
|
170
|
+
Initialize your account:
|
|
171
|
+
```bash
|
|
172
|
+
movement init --network testnet
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Named Address Errors
|
|
176
|
+
Ensure `Move.toml` has the correct address mapping and use `--named-addresses` flag.
|
|
177
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# /docs:generate - Auto-Generate Documentation
|
|
2
|
+
|
|
3
|
+
Automatically generate documentation from code for the Movement dApp.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Analyze Codebase
|
|
8
|
+
Scan the project to identify:
|
|
9
|
+
- Move modules and their public interfaces
|
|
10
|
+
- Frontend components and hooks
|
|
11
|
+
|
|
12
|
+
### Step 2: Generate Contract Documentation
|
|
13
|
+
|
|
14
|
+
For each Move module in `contracts/sources/`:
|
|
15
|
+
|
|
16
|
+
1. Extract module name and address
|
|
17
|
+
2. Parse resource definitions
|
|
18
|
+
3. Parse entry functions with parameters
|
|
19
|
+
4. Parse view functions with return types
|
|
20
|
+
5. Parse events
|
|
21
|
+
6. Extract error codes
|
|
22
|
+
|
|
23
|
+
Generate `docs/contracts/{module_name}.md`:
|
|
24
|
+
```markdown
|
|
25
|
+
# {Module Name}
|
|
26
|
+
|
|
27
|
+
**Address:** `{module_address}::{module_name}`
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
{Auto-generated description based on module structure}
|
|
31
|
+
|
|
32
|
+
## Resources
|
|
33
|
+
|
|
34
|
+
### {ResourceName}
|
|
35
|
+
\`\`\`move
|
|
36
|
+
struct ResourceName has key, store {
|
|
37
|
+
field1: u64,
|
|
38
|
+
field2: String,
|
|
39
|
+
}
|
|
40
|
+
\`\`\`
|
|
41
|
+
|
|
42
|
+
## Entry Functions
|
|
43
|
+
|
|
44
|
+
### `function_name`
|
|
45
|
+
\`\`\`move
|
|
46
|
+
public entry fun function_name(account: &signer, param1: u64)
|
|
47
|
+
\`\`\`
|
|
48
|
+
**Parameters:**
|
|
49
|
+
- `account`: Signer account
|
|
50
|
+
- `param1`: {Description}
|
|
51
|
+
|
|
52
|
+
**Effects:**
|
|
53
|
+
- {State changes}
|
|
54
|
+
- Emits `EventName`
|
|
55
|
+
|
|
56
|
+
## View Functions
|
|
57
|
+
|
|
58
|
+
### `get_value`
|
|
59
|
+
\`\`\`move
|
|
60
|
+
#[view]
|
|
61
|
+
public fun get_value(addr: address): u64
|
|
62
|
+
\`\`\`
|
|
63
|
+
**Parameters:**
|
|
64
|
+
- `addr`: Account address to query
|
|
65
|
+
|
|
66
|
+
**Returns:** `u64` - The current value
|
|
67
|
+
|
|
68
|
+
## Events
|
|
69
|
+
|
|
70
|
+
### `EventName`
|
|
71
|
+
\`\`\`move
|
|
72
|
+
#[event]
|
|
73
|
+
struct EventName has drop, store {
|
|
74
|
+
field1: u64,
|
|
75
|
+
timestamp: u64,
|
|
76
|
+
}
|
|
77
|
+
\`\`\`
|
|
78
|
+
Emitted when: {condition}
|
|
79
|
+
|
|
80
|
+
## Error Codes
|
|
81
|
+
| Code | Constant | Description |
|
|
82
|
+
|------|----------|-------------|
|
|
83
|
+
| 1 | E_NOT_AUTHORIZED | Caller is not authorized |
|
|
84
|
+
| 2 | E_ALREADY_EXISTS | Resource already exists |
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Step 3: Generate Component Documentation
|
|
88
|
+
|
|
89
|
+
For each component in `frontend/src/components/`:
|
|
90
|
+
|
|
91
|
+
Generate `docs/frontend/components.md`:
|
|
92
|
+
```markdown
|
|
93
|
+
# Frontend Components
|
|
94
|
+
|
|
95
|
+
## WalletConnect
|
|
96
|
+
Handles wallet connection and disconnection.
|
|
97
|
+
|
|
98
|
+
**Props:** None
|
|
99
|
+
|
|
100
|
+
**Usage:**
|
|
101
|
+
\`\`\`tsx
|
|
102
|
+
<WalletConnect />
|
|
103
|
+
\`\`\`
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Output Summary
|
|
107
|
+
```markdown
|
|
108
|
+
# 📖 Documentation Generated
|
|
109
|
+
|
|
110
|
+
## Contract Docs
|
|
111
|
+
- {n} module documentation files
|
|
112
|
+
|
|
113
|
+
## Frontend Docs
|
|
114
|
+
- {n} component documentation files
|
|
115
|
+
|
|
116
|
+
## Next Steps
|
|
117
|
+
- Review generated documentation
|
|
118
|
+
- Add custom descriptions where needed
|
|
119
|
+
- Keep docs updated as code changes
|
|
120
|
+
```
|
|
121
|
+
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# /docs:init - Initialize Documentation Structure
|
|
2
|
+
|
|
3
|
+
Initialize the documentation structure for the Movement dApp project.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
### Step 1: Create Documentation Directories
|
|
8
|
+
```bash
|
|
9
|
+
mkdir -p docs/api docs/contracts docs/guides docs/architecture
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Step 2: Generate Documentation Templates
|
|
13
|
+
|
|
14
|
+
#### docs/README.md
|
|
15
|
+
```markdown
|
|
16
|
+
# {Project Name} Documentation
|
|
17
|
+
|
|
18
|
+
## Overview
|
|
19
|
+
{Brief project description}
|
|
20
|
+
|
|
21
|
+
## Quick Links
|
|
22
|
+
- [API Reference](./api/README.md)
|
|
23
|
+
- [Contract Documentation](./contracts/README.md)
|
|
24
|
+
- [Architecture Guide](./architecture/README.md)
|
|
25
|
+
- [Development Guide](./guides/development.md)
|
|
26
|
+
|
|
27
|
+
## Getting Started
|
|
28
|
+
1. Clone the repository
|
|
29
|
+
2. Install dependencies
|
|
30
|
+
3. Configure environment
|
|
31
|
+
4. Run development server
|
|
32
|
+
|
|
33
|
+
## Project Structure
|
|
34
|
+
{Link to architecture docs}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### docs/api/README.md
|
|
38
|
+
```markdown
|
|
39
|
+
# API Reference
|
|
40
|
+
|
|
41
|
+
## Endpoints
|
|
42
|
+
|
|
43
|
+
### GET /api/{module}/value/:address
|
|
44
|
+
Get the current value for an address.
|
|
45
|
+
|
|
46
|
+
**Parameters:**
|
|
47
|
+
- `address` (string): The account address
|
|
48
|
+
|
|
49
|
+
**Response:**
|
|
50
|
+
\`\`\`json
|
|
51
|
+
{
|
|
52
|
+
"success": true,
|
|
53
|
+
"data": [value]
|
|
54
|
+
}
|
|
55
|
+
\`\`\`
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### docs/contracts/README.md
|
|
59
|
+
```markdown
|
|
60
|
+
# Smart Contract Documentation
|
|
61
|
+
|
|
62
|
+
## Modules
|
|
63
|
+
|
|
64
|
+
### {module_name}
|
|
65
|
+
{Module description}
|
|
66
|
+
|
|
67
|
+
#### Resources
|
|
68
|
+
- `ResourceName`: {Description}
|
|
69
|
+
|
|
70
|
+
#### Entry Functions
|
|
71
|
+
- `function_name(param1: Type)`: {Description}
|
|
72
|
+
|
|
73
|
+
#### View Functions
|
|
74
|
+
- `get_value(addr: address): u64`: {Description}
|
|
75
|
+
|
|
76
|
+
#### Events
|
|
77
|
+
- `EventName`: Emitted when {condition}
|
|
78
|
+
|
|
79
|
+
#### Error Codes
|
|
80
|
+
| Code | Name | Description |
|
|
81
|
+
|------|------|-------------|
|
|
82
|
+
| 1 | E_NOT_AUTHORIZED | Caller is not authorized |
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### docs/guides/development.md
|
|
86
|
+
```markdown
|
|
87
|
+
# Development Guide
|
|
88
|
+
|
|
89
|
+
## Prerequisites
|
|
90
|
+
- Node.js 18+
|
|
91
|
+
- Movement CLI
|
|
92
|
+
- Rust (for Move development)
|
|
93
|
+
|
|
94
|
+
## Setup
|
|
95
|
+
1. Install dependencies
|
|
96
|
+
2. Configure environment variables
|
|
97
|
+
3. Start development servers
|
|
98
|
+
|
|
99
|
+
## Testing
|
|
100
|
+
- Run Move tests: `cd contracts && movement move test`
|
|
101
|
+
- Run frontend tests: `cd frontend && npm test`
|
|
102
|
+
|
|
103
|
+
## Deployment
|
|
104
|
+
See [Deployment Guide](./deployment.md)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Step 3: Create .env.example Files
|
|
108
|
+
|
|
109
|
+
#### frontend/.env.example
|
|
110
|
+
```
|
|
111
|
+
VITE_NETWORK=testnet
|
|
112
|
+
VITE_MODULE_ADDRESS=0x1
|
|
113
|
+
VITE_NODE_URL=https://full.testnet.movementinfra.xyz/v1
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Output Summary
|
|
117
|
+
```markdown
|
|
118
|
+
# 📚 Documentation Initialized
|
|
119
|
+
|
|
120
|
+
## Created Files
|
|
121
|
+
- docs/README.md
|
|
122
|
+
- docs/api/README.md
|
|
123
|
+
- docs/contracts/README.md
|
|
124
|
+
- docs/guides/development.md
|
|
125
|
+
- docs/architecture/README.md
|
|
126
|
+
- frontend/.env.example
|
|
127
|
+
|
|
128
|
+
## Next Steps
|
|
129
|
+
- Run `/docs:generate` to auto-generate API docs from code
|
|
130
|
+
- Update documentation as you develop
|
|
131
|
+
```
|
|
132
|
+
|