movementkit-cli 1.0.7 → 1.0.10
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 +1 -1
- package/kits/engineer/.claude/agents/frontend.md +146 -34
- package/kits/engineer/.claude/commands/cook/contracts.md +4 -0
- package/kits/engineer/.claude/commands/cook/frontend.md +4 -0
- package/kits/engineer/.claude/commands/cook.md +4 -0
- package/kits/engineer/.claude/commands/deploy-full.md +4 -0
- package/kits/engineer/.claude/commands/deploy-smart-contract.md +4 -0
- package/kits/engineer/.claude/commands/docs/generate.md +4 -0
- package/kits/engineer/.claude/commands/docs/init.md +4 -0
- package/kits/engineer/.claude/commands/plan.md +3 -0
- package/kits/engineer/.claude/commands/review.md +4 -0
- package/kits/engineer/.claude/commands/test.md +4 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2912,7 +2912,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
2912
2912
|
// src/index.ts
|
|
2913
2913
|
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
2914
2914
|
// package.json
|
|
2915
|
-
var version = "1.0.
|
|
2915
|
+
var version = "1.0.10";
|
|
2916
2916
|
|
|
2917
2917
|
// node_modules/@clack/core/dist/index.mjs
|
|
2918
2918
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -37,6 +37,26 @@ You are a senior React frontend engineer specializing in Movement blockchain dAp
|
|
|
37
37
|
**IMPORTANT**: Use strict TypeScript with no `any` types.
|
|
38
38
|
**IMPORTANT**: Ensure token efficiency while maintaining high quality.
|
|
39
39
|
|
|
40
|
+
## References
|
|
41
|
+
- [TypeScript SDK](https://docs.movementnetwork.xyz/devs/interactonchain/tsSdk)
|
|
42
|
+
- [Wallet Adapter](https://docs.movementnetwork.xyz/devs/interactonchain/wallet-adapter/connect_wallet)
|
|
43
|
+
- [useWallet Hook](https://docs.movementnetwork.xyz/devs/interactonchain/wallet-adapter/useWallet/ConnectWallet)
|
|
44
|
+
- [Sign & Submit](https://docs.movementnetwork.xyz/devs/interactonchain/wallet-adapter/useWallet/signAndSubmitTx)
|
|
45
|
+
|
|
46
|
+
## Movement Network Configuration
|
|
47
|
+
|
|
48
|
+
**Chain IDs:**
|
|
49
|
+
- Mainnet: `126`
|
|
50
|
+
- Testnet: `250`
|
|
51
|
+
|
|
52
|
+
**RPC Endpoints:**
|
|
53
|
+
- Mainnet: `https://mainnet.movementnetwork.xyz/v1`
|
|
54
|
+
- Testnet: `https://testnet.movementnetwork.xyz/v1`
|
|
55
|
+
- Faucet: `https://faucet.testnet.movementnetwork.xyz/`
|
|
56
|
+
|
|
57
|
+
**Explorer:**
|
|
58
|
+
- `https://explorer.movementnetwork.xyz/txn/{txHash}?network={mainnet|testnet}`
|
|
59
|
+
|
|
40
60
|
## Core Competencies
|
|
41
61
|
|
|
42
62
|
1. **Wallet Integration**
|
|
@@ -81,72 +101,131 @@ You are a senior React frontend engineer specializing in Movement blockchain dAp
|
|
|
81
101
|
- Integration tests for user flows
|
|
82
102
|
- Mock wallet adapter for testing
|
|
83
103
|
|
|
84
|
-
## Wallet Setup
|
|
104
|
+
## Wallet Provider Setup
|
|
85
105
|
|
|
86
106
|
```tsx
|
|
107
|
+
// src/provider/WalletProvider.tsx
|
|
87
108
|
import { AptosWalletAdapterProvider } from "@aptos-labs/wallet-adapter-react";
|
|
88
|
-
import {
|
|
109
|
+
import { AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
110
|
+
import { PropsWithChildren } from "react";
|
|
111
|
+
|
|
112
|
+
export const WalletProvider = ({ children }: PropsWithChildren) => {
|
|
113
|
+
const wallets = [
|
|
114
|
+
// Add plugins for non-AIP-62 compliant wallets here
|
|
115
|
+
];
|
|
89
116
|
|
|
90
|
-
const
|
|
117
|
+
const config = new AptosConfig({
|
|
118
|
+
network: Network.TESTNET,
|
|
119
|
+
fullnode: 'https://testnet.movementnetwork.xyz/v1',
|
|
120
|
+
faucet: 'https://faucet.testnet.movementnetwork.xyz/'
|
|
121
|
+
});
|
|
91
122
|
|
|
92
|
-
function App() {
|
|
93
123
|
return (
|
|
94
|
-
<AptosWalletAdapterProvider
|
|
95
|
-
|
|
124
|
+
<AptosWalletAdapterProvider
|
|
125
|
+
plugins={wallets}
|
|
126
|
+
autoConnect={true}
|
|
127
|
+
dappConfig={config}
|
|
128
|
+
onError={(error) => console.error("Wallet error:", error)}
|
|
129
|
+
>
|
|
130
|
+
{children}
|
|
96
131
|
</AptosWalletAdapterProvider>
|
|
97
132
|
);
|
|
98
|
-
}
|
|
133
|
+
};
|
|
99
134
|
```
|
|
100
135
|
|
|
101
|
-
|
|
136
|
+
**Provider Props:**
|
|
137
|
+
| Field | Description |
|
|
138
|
+
|-------|-------------|
|
|
139
|
+
| `autoConnect` | Auto-connect on page reload (recommended: `true`) |
|
|
140
|
+
| `dappConfig` | Network config (fullnode, faucet URLs) |
|
|
141
|
+
| `plugins` | Legacy wallet plugins array |
|
|
142
|
+
| `onError` | Error callback |
|
|
143
|
+
| `optInWallets` | Limit supported AIP-62 wallets (e.g., `['Petra']`) |
|
|
144
|
+
|
|
145
|
+
## Aptos Client Setup
|
|
102
146
|
|
|
103
147
|
```tsx
|
|
104
|
-
import {
|
|
105
|
-
|
|
148
|
+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
149
|
+
|
|
150
|
+
// Movement Network client
|
|
151
|
+
const config = new AptosConfig({
|
|
152
|
+
network: Network.CUSTOM,
|
|
153
|
+
fullnode: 'https://testnet.movementnetwork.xyz/v1',
|
|
154
|
+
faucet: 'https://faucet.testnet.movementnetwork.xyz/'
|
|
155
|
+
});
|
|
156
|
+
const aptos = new Aptos(config);
|
|
157
|
+
```
|
|
106
158
|
|
|
107
|
-
|
|
108
|
-
fullnode: "https://full.testnet.movementinfra.xyz/v1"
|
|
109
|
-
}));
|
|
159
|
+
## Reading Data (View Functions)
|
|
110
160
|
|
|
111
|
-
|
|
112
|
-
|
|
161
|
+
```tsx
|
|
162
|
+
import { useState, useEffect } from "react";
|
|
163
|
+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
164
|
+
|
|
165
|
+
const MODULE_ADDRESS = "YOUR_CONTRACT_ADDRESS";
|
|
166
|
+
const config = new AptosConfig({
|
|
167
|
+
network: Network.CUSTOM,
|
|
168
|
+
fullnode: 'https://testnet.movementnetwork.xyz/v1',
|
|
169
|
+
});
|
|
170
|
+
const aptos = new Aptos(config);
|
|
171
|
+
|
|
172
|
+
export function useContractValue(address?: string) {
|
|
173
|
+
const [value, setValue] = useState<string | null>(null);
|
|
113
174
|
const [loading, setLoading] = useState(false);
|
|
114
175
|
const [error, setError] = useState<Error | null>(null);
|
|
115
176
|
|
|
116
177
|
useEffect(() => {
|
|
117
178
|
if (!address) return;
|
|
118
179
|
setLoading(true);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
180
|
+
|
|
181
|
+
const viewPayload = {
|
|
182
|
+
function: `${MODULE_ADDRESS}::module_name::get_value`,
|
|
183
|
+
functionArguments: [address]
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
aptos.view({ payload: viewPayload })
|
|
187
|
+
.then((result) => setValue(result[0] as string))
|
|
126
188
|
.catch(setError)
|
|
127
189
|
.finally(() => setLoading(false));
|
|
128
190
|
}, [address]);
|
|
129
191
|
|
|
130
|
-
return {
|
|
192
|
+
return { value, loading, error };
|
|
131
193
|
}
|
|
132
194
|
```
|
|
133
195
|
|
|
134
|
-
##
|
|
196
|
+
## Sign & Submit Transactions
|
|
135
197
|
|
|
136
198
|
```tsx
|
|
137
|
-
|
|
138
|
-
|
|
199
|
+
import { useWallet } from "@aptos-labs/wallet-adapter-react";
|
|
200
|
+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
201
|
+
import { useState } from "react";
|
|
202
|
+
|
|
203
|
+
const MODULE_ADDRESS = "YOUR_CONTRACT_ADDRESS";
|
|
204
|
+
const config = new AptosConfig({
|
|
205
|
+
network: Network.CUSTOM,
|
|
206
|
+
fullnode: 'https://testnet.movementnetwork.xyz/v1',
|
|
207
|
+
});
|
|
208
|
+
const aptos = new Aptos(config);
|
|
209
|
+
|
|
210
|
+
export function useContractAction() {
|
|
211
|
+
const { account, signAndSubmitTransaction } = useWallet();
|
|
139
212
|
const [status, setStatus] = useState<"idle" | "pending" | "success" | "error">("idle");
|
|
140
213
|
|
|
141
|
-
const
|
|
214
|
+
const execute = async (arg1: string, arg2: number) => {
|
|
215
|
+
if (!account) throw new Error("Wallet not connected");
|
|
216
|
+
|
|
142
217
|
setStatus("pending");
|
|
143
218
|
try {
|
|
144
219
|
const response = await signAndSubmitTransaction({
|
|
220
|
+
sender: account.address,
|
|
145
221
|
data: {
|
|
146
|
-
function: `${
|
|
147
|
-
functionArguments: [
|
|
222
|
+
function: `${MODULE_ADDRESS}::module_name::entry_function`,
|
|
223
|
+
functionArguments: [arg1, arg2],
|
|
148
224
|
},
|
|
149
225
|
});
|
|
226
|
+
|
|
227
|
+
// Wait for transaction confirmation
|
|
228
|
+
await aptos.waitForTransaction({ transactionHash: response.hash });
|
|
150
229
|
setStatus("success");
|
|
151
230
|
return response.hash;
|
|
152
231
|
} catch (e) {
|
|
@@ -155,28 +234,61 @@ export function useTransfer() {
|
|
|
155
234
|
}
|
|
156
235
|
};
|
|
157
236
|
|
|
158
|
-
return {
|
|
237
|
+
return { execute, status };
|
|
159
238
|
}
|
|
160
239
|
```
|
|
161
240
|
|
|
241
|
+
## useWallet Hook API
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
import { useWallet } from "@aptos-labs/wallet-adapter-react";
|
|
245
|
+
|
|
246
|
+
const {
|
|
247
|
+
connected, // boolean - wallet connection status
|
|
248
|
+
isLoading, // boolean - loading state
|
|
249
|
+
account, // AccountInfo | null - current account
|
|
250
|
+
network, // NetworkInfo | null - current network
|
|
251
|
+
wallet, // WalletInfo | null - current wallet
|
|
252
|
+
wallets, // Available wallets list
|
|
253
|
+
connect, // (walletName) => void
|
|
254
|
+
disconnect, // () => void
|
|
255
|
+
signAndSubmitTransaction, // (tx) => Promise<{hash}>
|
|
256
|
+
signTransaction, // (tx, asFeePayer?, options?) => Promise<AccountAuthenticator>
|
|
257
|
+
submitTransaction, // (tx) => Promise<PendingTransactionResponse>
|
|
258
|
+
signMessage, // (message) => Promise<SignMessageResponse>
|
|
259
|
+
signMessageAndVerify,// (message) => Promise<boolean>
|
|
260
|
+
changeNetwork, // (network) => Promise<AptosChangeNetworkOutput>
|
|
261
|
+
} = useWallet();
|
|
262
|
+
```
|
|
263
|
+
|
|
162
264
|
## Project Structure
|
|
163
265
|
|
|
164
266
|
```
|
|
165
267
|
frontend/
|
|
166
268
|
├── src/
|
|
167
269
|
│ ├── App.tsx # Entry with wallet provider
|
|
270
|
+
│ ├── provider/
|
|
271
|
+
│ │ └── WalletProvider.tsx # Wallet provider config
|
|
168
272
|
│ ├── components/ # React components
|
|
169
273
|
│ │ ├── WalletButton.tsx
|
|
170
274
|
│ │ ├── BalanceDisplay.tsx
|
|
171
275
|
│ │ └── ...
|
|
172
276
|
│ ├── hooks/ # Custom hooks
|
|
173
|
-
│ │ ├──
|
|
174
|
-
│ │ └──
|
|
175
|
-
│ ├──
|
|
176
|
-
│ └──
|
|
277
|
+
│ │ ├── useContractValue.ts
|
|
278
|
+
│ │ └── useContractAction.ts
|
|
279
|
+
│ ├── lib/ # Utilities
|
|
280
|
+
│ │ └── aptos.ts # Aptos client config
|
|
281
|
+
│ └── config/
|
|
282
|
+
│ └── constants.ts # Contract addresses, network
|
|
177
283
|
└── tests/
|
|
178
284
|
```
|
|
179
285
|
|
|
286
|
+
## Required Dependencies
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
npm install @aptos-labs/wallet-adapter-react @aptos-labs/ts-sdk
|
|
290
|
+
```
|
|
291
|
+
|
|
180
292
|
## Tools & Commands
|
|
181
293
|
|
|
182
294
|
```bash
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /cook:frontend - React Frontend Generation
|
|
2
2
|
|
|
3
|
+
**Agent:** `frontend`
|
|
4
|
+
|
|
3
5
|
Generate React frontend with wallet integration for Movement blockchain.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `frontend` agent.
|
|
8
|
+
|
|
5
9
|
## References
|
|
6
10
|
- [TypeScript SDK](https://docs.movementnetwork.xyz/devs/interactonchain/tsSdk)
|
|
7
11
|
- [Wallet Adapter](https://docs.movementnetwork.xyz/devs/interactonchain/wallet-adapter/connect_wallet)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /cook - Full dApp Code Generation
|
|
2
2
|
|
|
3
|
+
**Agents:** `smart-contract`, `frontend`
|
|
4
|
+
|
|
3
5
|
Generate complete production-ready code for a Movement blockchain dApp.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `smart-contract` agent for contracts, then `frontend` agent for frontend.
|
|
8
|
+
|
|
5
9
|
## Prerequisites
|
|
6
10
|
|
|
7
11
|
### Install Movement CLI
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /deploy-full - Full Deployment to Movement Network
|
|
2
2
|
|
|
3
|
+
**Agent:** `devops`
|
|
4
|
+
|
|
3
5
|
Deploy the complete dApp to Movement testnet or mainnet.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `devops` agent.
|
|
8
|
+
|
|
5
9
|
## Prerequisites
|
|
6
10
|
|
|
7
11
|
1. **Movement CLI installed** - See [Movement CLI docs](https://docs.movementnetwork.xyz/devs/movementcli)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /deploy-smart-contract - Deploy Move Smart Contracts
|
|
2
2
|
|
|
3
|
+
**Agent:** `devops`
|
|
4
|
+
|
|
3
5
|
Deploy Move smart contracts to the Movement Network (testnet or mainnet).
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `devops` agent.
|
|
8
|
+
|
|
5
9
|
## Prerequisites
|
|
6
10
|
|
|
7
11
|
1. **Movement CLI installed** - See [Movement CLI docs](https://docs.movementnetwork.xyz/devs/movementcli)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /docs:generate - Auto-Generate Documentation
|
|
2
2
|
|
|
3
|
+
**Agents:** `smart-contract`, `frontend`
|
|
4
|
+
|
|
3
5
|
Automatically generate documentation from code for the Movement dApp.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `smart-contract` agent for contract docs, `frontend` agent for frontend docs.
|
|
8
|
+
|
|
5
9
|
## Workflow
|
|
6
10
|
|
|
7
11
|
### Step 1: Analyze Codebase
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /docs:init - Initialize Documentation Structure
|
|
2
2
|
|
|
3
|
+
**Agent:** `product-manager`
|
|
4
|
+
|
|
3
5
|
Initialize the documentation structure for the Movement dApp project.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `product-manager` agent.
|
|
8
|
+
|
|
5
9
|
## Workflow
|
|
6
10
|
|
|
7
11
|
### Step 1: Create Documentation Directories
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# /plan - Product Requirements for Movement dApps
|
|
2
2
|
|
|
3
|
+
**Agent:** `product-manager`
|
|
4
|
+
|
|
3
5
|
Create Product Requirements Document (PRD), User Stories, and Acceptance Criteria for a Movement blockchain dApp.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `product-manager` agent.
|
|
5
8
|
**IMPORTANT**: This command focuses on WHAT to build, not HOW. No technical implementation details.
|
|
6
9
|
|
|
7
10
|
## Workflow
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# /review - Code Quality and Security Auditing
|
|
2
2
|
|
|
3
|
+
**Agents:** `smart-contract`, `frontend`
|
|
4
|
+
|
|
3
5
|
Perform comprehensive code review and security audit for the Movement dApp.
|
|
4
6
|
|
|
7
|
+
**IMPORTANT**: Delegate to `smart-contract` agent for contract review, `frontend` agent for frontend review.
|
|
8
|
+
|
|
5
9
|
## Workflow
|
|
6
10
|
|
|
7
11
|
### Step 1: Move Contract Security Audit
|