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 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.7";
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 { PetraWallet } from "petra-plugin-wallet-adapter";
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 wallets = [new PetraWallet()];
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 plugins={wallets} autoConnect={true}>
95
- <MainContent />
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
- ## Custom Hook Pattern
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 { useWallet } from "@aptos-labs/wallet-adapter-react";
105
- import { Aptos, AptosConfig } from "@aptos-labs/ts-sdk";
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
- const client = new Aptos(new AptosConfig({
108
- fullnode: "https://full.testnet.movementinfra.xyz/v1"
109
- }));
159
+ ## Reading Data (View Functions)
110
160
 
111
- export function useBalance(address?: string) {
112
- const [balance, setBalance] = useState<bigint | null>(null);
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
- client.view<[string]>({
120
- payload: {
121
- function: `${MODULE}::token::balance`,
122
- functionArguments: [address],
123
- },
124
- })
125
- .then(([bal]) => setBalance(BigInt(bal)))
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 { balance, loading, error };
192
+ return { value, loading, error };
131
193
  }
132
194
  ```
133
195
 
134
- ## Transaction Flow
196
+ ## Sign & Submit Transactions
135
197
 
136
198
  ```tsx
137
- export function useTransfer() {
138
- const { signAndSubmitTransaction } = useWallet();
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 transfer = async (recipient: string, amount: bigint) => {
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: `${MODULE}::token::transfer`,
147
- functionArguments: [recipient, amount.toString()],
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 { transfer, status };
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
- │ │ ├── useBalance.ts
174
- │ │ └── useTransfer.ts
175
- │ ├── contexts/ # React contexts
176
- │ └── lib/ # Utilities
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:contracts - Move Smart Contract Generation
2
2
 
3
+ **Agent:** `smart-contract`
4
+
3
5
  Generate Move smart contracts for the Movement blockchain.
4
6
 
7
+ **IMPORTANT**: Delegate to `smart-contract` agent.
8
+
5
9
  ## Prerequisites
6
10
 
7
11
  ### Install Movement CLI
@@ -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
@@ -1,7 +1,11 @@
1
1
  # /test - Comprehensive Test Generation and Execution
2
2
 
3
+ **Agent:** `tester`
4
+
3
5
  Generate and run comprehensive tests for the Movement dApp.
4
6
 
7
+ **IMPORTANT**: Delegate to `tester` agent.
8
+
5
9
  ## Workflow
6
10
 
7
11
  ### Step 1: Analyze Codebase
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "movementkit-cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "CLI tool for bootstrapping and updating Movement Kit projects for Movement blockchain development",
5
5
  "type": "module",
6
6
  "repository": {