movementkit-cli 1.0.1 → 1.0.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 +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 +637 -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,42 @@
|
|
|
1
|
+
import { AptosWalletAdapterProvider } from "@aptos-labs/wallet-adapter-react";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
|
|
4
|
+
// Movement Network Configuration
|
|
5
|
+
const MOVEMENT_NETWORK = {
|
|
6
|
+
testnet: {
|
|
7
|
+
name: "Movement Testnet",
|
|
8
|
+
chainId: "250",
|
|
9
|
+
url: "https://full.testnet.movementinfra.xyz/v1",
|
|
10
|
+
},
|
|
11
|
+
mainnet: {
|
|
12
|
+
name: "Movement Mainnet",
|
|
13
|
+
chainId: "126",
|
|
14
|
+
url: "https://full.mainnet.movementinfra.xyz/v1",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// Default to testnet
|
|
19
|
+
const currentNetwork = MOVEMENT_NETWORK.testnet;
|
|
20
|
+
|
|
21
|
+
export function WalletProvider({ children }: PropsWithChildren) {
|
|
22
|
+
return (
|
|
23
|
+
<AptosWalletAdapterProvider
|
|
24
|
+
autoConnect={true}
|
|
25
|
+
dappConfig={{
|
|
26
|
+
network: "testnet",
|
|
27
|
+
aptosApiKey: import.meta.env.VITE_APTOS_API_KEY,
|
|
28
|
+
aptosConnect: {
|
|
29
|
+
dappId: "movement-dapp",
|
|
30
|
+
},
|
|
31
|
+
}}
|
|
32
|
+
onError={(error) => {
|
|
33
|
+
console.error("Wallet error:", error);
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</AptosWalletAdapterProvider>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { currentNetwork };
|
|
42
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useWallet } from "@aptos-labs/wallet-adapter-react";
|
|
2
|
+
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
3
|
+
import { currentNetwork } from "../contexts/WalletContext";
|
|
4
|
+
|
|
5
|
+
// Module configuration - update these for your dApp
|
|
6
|
+
const MODULE_ADDRESS = import.meta.env.VITE_MODULE_ADDRESS || "0x1";
|
|
7
|
+
const MODULE_NAME = import.meta.env.VITE_MODULE_NAME || "module_name";
|
|
8
|
+
|
|
9
|
+
// Create Aptos client for Movement network
|
|
10
|
+
const aptosConfig = new AptosConfig({
|
|
11
|
+
network: Network.CUSTOM,
|
|
12
|
+
fullnode: currentNetwork.url,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const aptos = new Aptos(aptosConfig);
|
|
16
|
+
|
|
17
|
+
export function useContract() {
|
|
18
|
+
const { signAndSubmitTransaction, account } = useWallet();
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Call an entry function on the contract
|
|
22
|
+
*/
|
|
23
|
+
const callFunction = async (
|
|
24
|
+
functionName: string,
|
|
25
|
+
args: (string | number | boolean | Uint8Array)[]
|
|
26
|
+
) => {
|
|
27
|
+
if (!account) {
|
|
28
|
+
throw new Error("Wallet not connected");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const response = await signAndSubmitTransaction({
|
|
32
|
+
data: {
|
|
33
|
+
function: `${MODULE_ADDRESS}::${MODULE_NAME}::${functionName}`,
|
|
34
|
+
functionArguments: args,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// Wait for transaction confirmation
|
|
39
|
+
const result = await aptos.waitForTransaction({
|
|
40
|
+
transactionHash: response.hash,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Call a view function on the contract (read-only)
|
|
48
|
+
*/
|
|
49
|
+
const viewFunction = async <T>(
|
|
50
|
+
functionName: string,
|
|
51
|
+
args: (string | number | boolean | Uint8Array)[]
|
|
52
|
+
): Promise<T> => {
|
|
53
|
+
const result = await aptos.view({
|
|
54
|
+
payload: {
|
|
55
|
+
function: `${MODULE_ADDRESS}::${MODULE_NAME}::${functionName}`,
|
|
56
|
+
functionArguments: args,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
return result as T;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get account balance
|
|
65
|
+
*/
|
|
66
|
+
const getBalance = async (address: string): Promise<number> => {
|
|
67
|
+
try {
|
|
68
|
+
const resources = await aptos.getAccountResources({
|
|
69
|
+
accountAddress: address,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const coinResource = resources.find(
|
|
73
|
+
(r) => r.type === "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>"
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (coinResource) {
|
|
77
|
+
return parseInt((coinResource.data as { coin: { value: string } }).coin.value, 10);
|
|
78
|
+
}
|
|
79
|
+
return 0;
|
|
80
|
+
} catch {
|
|
81
|
+
return 0;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
callFunction,
|
|
87
|
+
viewFunction,
|
|
88
|
+
getBalance,
|
|
89
|
+
account,
|
|
90
|
+
aptos,
|
|
91
|
+
moduleAddress: MODULE_ADDRESS,
|
|
92
|
+
moduleName: MODULE_NAME,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
* {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
margin: 0;
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body {
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
display: flex;
|
|
25
|
+
place-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#root {
|
|
29
|
+
max-width: 1280px;
|
|
30
|
+
margin: 0 auto;
|
|
31
|
+
padding: 2rem;
|
|
32
|
+
text-align: center;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
button {
|
|
37
|
+
border-radius: 8px;
|
|
38
|
+
border: 1px solid transparent;
|
|
39
|
+
padding: 0.6em 1.2em;
|
|
40
|
+
font-size: 1em;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
font-family: inherit;
|
|
43
|
+
background-color: #1a1a1a;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
transition: border-color 0.25s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
button:hover {
|
|
49
|
+
border-color: #646cff;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
button:focus,
|
|
53
|
+
button:focus-visible {
|
|
54
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.card {
|
|
58
|
+
padding: 2em;
|
|
59
|
+
background: #1a1a1a;
|
|
60
|
+
border-radius: 12px;
|
|
61
|
+
margin: 1em 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@media (prefers-color-scheme: light) {
|
|
65
|
+
:root {
|
|
66
|
+
color: #213547;
|
|
67
|
+
background-color: #ffffff;
|
|
68
|
+
}
|
|
69
|
+
button {
|
|
70
|
+
background-color: #f9f9f9;
|
|
71
|
+
}
|
|
72
|
+
.card {
|
|
73
|
+
background: #f9f9f9;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"],
|
|
20
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
define: {
|
|
7
|
+
// Required for some wallet adapters
|
|
8
|
+
"process.env": {},
|
|
9
|
+
},
|
|
10
|
+
resolve: {
|
|
11
|
+
alias: {
|
|
12
|
+
// Required for some dependencies
|
|
13
|
+
buffer: "buffer",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "movementkit-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "CLI tool for bootstrapping and updating Movement Kit projects for Movement blockchain development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"bin/mk.js",
|
|
20
|
-
"dist/index.js"
|
|
20
|
+
"dist/index.js",
|
|
21
|
+
"kits/engineer"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
23
24
|
"dev": "bun run src/index.ts",
|