movehat 0.0.1-alpha.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.
- package/README.md +236 -0
- package/bin/movehat.js +21 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +93 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/compile.d.ts +2 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +71 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/fork/create.d.ts +11 -0
- package/dist/commands/fork/create.d.ts.map +1 -0
- package/dist/commands/fork/create.js +56 -0
- package/dist/commands/fork/create.js.map +1 -0
- package/dist/commands/fork/fund.d.ts +12 -0
- package/dist/commands/fork/fund.d.ts.map +1 -0
- package/dist/commands/fork/fund.js +42 -0
- package/dist/commands/fork/fund.js.map +1 -0
- package/dist/commands/fork/list.d.ts +5 -0
- package/dist/commands/fork/list.d.ts.map +1 -0
- package/dist/commands/fork/list.js +61 -0
- package/dist/commands/fork/list.js.map +1 -0
- package/dist/commands/fork/serve.d.ts +10 -0
- package/dist/commands/fork/serve.d.ts.map +1 -0
- package/dist/commands/fork/serve.js +64 -0
- package/dist/commands/fork/serve.js.map +1 -0
- package/dist/commands/fork/view-resource.d.ts +11 -0
- package/dist/commands/fork/view-resource.d.ts.map +1 -0
- package/dist/commands/fork/view-resource.js +34 -0
- package/dist/commands/fork/view-resource.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +90 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +51 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/test.d.ts +2 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +35 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/core/config.d.ts +15 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +121 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/contract.d.ts +20 -0
- package/dist/core/contract.d.ts.map +1 -0
- package/dist/core/contract.js +59 -0
- package/dist/core/contract.js.map +1 -0
- package/dist/core/deployments.d.ts +32 -0
- package/dist/core/deployments.d.ts.map +1 -0
- package/dist/core/deployments.js +122 -0
- package/dist/core/deployments.js.map +1 -0
- package/dist/core/shell.d.ts +25 -0
- package/dist/core/shell.d.ts.map +1 -0
- package/dist/core/shell.js +56 -0
- package/dist/core/shell.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -0
- package/dist/fork/api.d.ts +33 -0
- package/dist/fork/api.d.ts.map +1 -0
- package/dist/fork/api.js +98 -0
- package/dist/fork/api.js.map +1 -0
- package/dist/fork/manager.d.ts +52 -0
- package/dist/fork/manager.d.ts.map +1 -0
- package/dist/fork/manager.js +221 -0
- package/dist/fork/manager.js.map +1 -0
- package/dist/fork/server.d.ts +55 -0
- package/dist/fork/server.d.ts.map +1 -0
- package/dist/fork/server.js +274 -0
- package/dist/fork/server.js.map +1 -0
- package/dist/fork/storage.d.ts +63 -0
- package/dist/fork/storage.d.ts.map +1 -0
- package/dist/fork/storage.js +183 -0
- package/dist/fork/storage.js.map +1 -0
- package/dist/fork/test.d.ts +75 -0
- package/dist/fork/test.d.ts.map +1 -0
- package/dist/fork/test.js +157 -0
- package/dist/fork/test.js.map +1 -0
- package/dist/helpers/assertions.d.ts +7 -0
- package/dist/helpers/assertions.d.ts.map +1 -0
- package/dist/helpers/assertions.js +17 -0
- package/dist/helpers/assertions.js.map +1 -0
- package/dist/helpers/banner.d.ts +3 -0
- package/dist/helpers/banner.d.ts.map +1 -0
- package/dist/helpers/banner.js +38 -0
- package/dist/helpers/banner.js.map +1 -0
- package/dist/helpers/index.d.ts +11 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +7 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/setup.d.ts +10 -0
- package/dist/helpers/setup.d.ts.map +1 -0
- package/dist/helpers/setup.js +28 -0
- package/dist/helpers/setup.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +26 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +247 -0
- package/dist/runtime.js.map +1 -0
- package/dist/templates/.env.example +9 -0
- package/dist/templates/.mocharc.json +8 -0
- package/dist/templates/README.md +92 -0
- package/dist/templates/move/Counter.move +64 -0
- package/dist/templates/move/Move.toml +16 -0
- package/dist/templates/movehat.config.ts +37 -0
- package/dist/templates/package.json +24 -0
- package/dist/templates/scripts/deploy-counter.ts +48 -0
- package/dist/templates/tests/Counter.test.ts +75 -0
- package/dist/templates/tsconfig.json +15 -0
- package/dist/templates/types/movehat.d.ts +104 -0
- package/dist/types/config.d.ts +35 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +2 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/fork.d.ts +37 -0
- package/dist/types/fork.d.ts.map +1 -0
- package/dist/types/fork.js +5 -0
- package/dist/types/fork.js.map +1 -0
- package/dist/types/runtime.d.ts +28 -0
- package/dist/types/runtime.d.ts.map +1 -0
- package/dist/types/runtime.js +2 -0
- package/dist/types/runtime.js.map +1 -0
- package/package.json +66 -0
- package/src/cli.ts +106 -0
- package/src/commands/compile.ts +84 -0
- package/src/commands/fork/create.ts +70 -0
- package/src/commands/fork/fund.ts +57 -0
- package/src/commands/fork/list.ts +67 -0
- package/src/commands/fork/serve.ts +77 -0
- package/src/commands/fork/view-resource.ts +46 -0
- package/src/commands/init.ts +150 -0
- package/src/commands/run.ts +59 -0
- package/src/commands/test.ts +42 -0
- package/src/core/config.ts +151 -0
- package/src/core/contract.ts +97 -0
- package/src/core/deployments.ts +164 -0
- package/src/core/shell.ts +66 -0
- package/src/errors.ts +21 -0
- package/src/fork/api.ts +117 -0
- package/src/fork/manager.ts +264 -0
- package/src/fork/server.ts +311 -0
- package/src/fork/storage.ts +224 -0
- package/src/fork/test.ts +195 -0
- package/src/helpers/assertions.ts +29 -0
- package/src/helpers/banner.ts +47 -0
- package/src/helpers/index.ts +26 -0
- package/src/helpers/setup.ts +49 -0
- package/src/index.ts +17 -0
- package/src/runtime.ts +322 -0
- package/src/templates/.env.example +9 -0
- package/src/templates/.mocharc.json +8 -0
- package/src/templates/README.md +92 -0
- package/src/templates/move/Counter.move +64 -0
- package/src/templates/move/Move.toml +16 -0
- package/src/templates/movehat.config.ts +37 -0
- package/src/templates/package.json +24 -0
- package/src/templates/scripts/deploy-counter.ts +48 -0
- package/src/templates/tests/Counter.test.ts +75 -0
- package/src/templates/tsconfig.json +15 -0
- package/src/templates/types/movehat.d.ts +104 -0
- package/src/types/config.ts +36 -0
- package/src/types/fork.ts +41 -0
- package/src/types/runtime.ts +49 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* Sanitize address to create a safe filename
|
|
5
|
+
* Prevents path traversal by encoding the address
|
|
6
|
+
*/
|
|
7
|
+
function sanitizeAddressForFilename(address) {
|
|
8
|
+
// Remove any path separators and normalize
|
|
9
|
+
const normalized = address.toLowerCase().replace(/^0x/, '');
|
|
10
|
+
// Validate that it's a valid hex string
|
|
11
|
+
if (!/^[0-9a-f]+$/.test(normalized)) {
|
|
12
|
+
throw new Error(`Invalid address format: ${address}. Expected hexadecimal string.`);
|
|
13
|
+
}
|
|
14
|
+
// Encode to prevent any path traversal
|
|
15
|
+
// Use the normalized hex string directly as it's safe
|
|
16
|
+
const safe = `0x${normalized}`;
|
|
17
|
+
// Validate no path separators in result
|
|
18
|
+
if (safe.includes('/') || safe.includes('\\') || safe.includes('..')) {
|
|
19
|
+
throw new Error(`Address contains invalid characters: ${address}`);
|
|
20
|
+
}
|
|
21
|
+
return safe;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Storage system for fork state
|
|
25
|
+
* Manages the file structure and I/O for fork data
|
|
26
|
+
*/
|
|
27
|
+
export class ForkStorage {
|
|
28
|
+
forkPath;
|
|
29
|
+
constructor(forkPath) {
|
|
30
|
+
this.forkPath = forkPath;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get safe resource file path for an address
|
|
34
|
+
* Prevents path traversal attacks
|
|
35
|
+
*/
|
|
36
|
+
getResourceFilePath(address) {
|
|
37
|
+
const safeFilename = sanitizeAddressForFilename(address);
|
|
38
|
+
return join(this.forkPath, 'resources', `${safeFilename}.json`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Initialize fork directory structure
|
|
42
|
+
*/
|
|
43
|
+
initialize() {
|
|
44
|
+
// Create main fork directory
|
|
45
|
+
if (!existsSync(this.forkPath)) {
|
|
46
|
+
mkdirSync(this.forkPath, { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
// Create subdirectories
|
|
49
|
+
const resourcesDir = join(this.forkPath, 'resources');
|
|
50
|
+
if (!existsSync(resourcesDir)) {
|
|
51
|
+
mkdirSync(resourcesDir, { recursive: true });
|
|
52
|
+
}
|
|
53
|
+
const cacheDir = join(this.forkPath, 'cache');
|
|
54
|
+
if (!existsSync(cacheDir)) {
|
|
55
|
+
mkdirSync(cacheDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
// Create .gitignore for cache
|
|
58
|
+
const gitignorePath = join(cacheDir, '.gitignore');
|
|
59
|
+
if (!existsSync(gitignorePath)) {
|
|
60
|
+
writeFileSync(gitignorePath, '*\n!.gitignore\n');
|
|
61
|
+
}
|
|
62
|
+
// Initialize accounts.json if it doesn't exist
|
|
63
|
+
const accountsPath = join(this.forkPath, 'accounts.json');
|
|
64
|
+
if (!existsSync(accountsPath)) {
|
|
65
|
+
writeFileSync(accountsPath, JSON.stringify({}, null, 2));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check if fork exists
|
|
70
|
+
*/
|
|
71
|
+
exists() {
|
|
72
|
+
return existsSync(this.forkPath) && existsSync(join(this.forkPath, 'metadata.json'));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Save fork metadata
|
|
76
|
+
*/
|
|
77
|
+
saveMetadata(metadata) {
|
|
78
|
+
const metadataPath = join(this.forkPath, 'metadata.json');
|
|
79
|
+
writeFileSync(metadataPath, JSON.stringify(metadata, null, 2));
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Load fork metadata
|
|
83
|
+
*/
|
|
84
|
+
loadMetadata() {
|
|
85
|
+
const metadataPath = join(this.forkPath, 'metadata.json');
|
|
86
|
+
if (!existsSync(metadataPath)) {
|
|
87
|
+
throw new Error(`Fork metadata not found at ${metadataPath}`);
|
|
88
|
+
}
|
|
89
|
+
const data = readFileSync(metadataPath, 'utf-8');
|
|
90
|
+
return JSON.parse(data);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Get account state
|
|
94
|
+
*/
|
|
95
|
+
getAccount(address) {
|
|
96
|
+
const accountsPath = join(this.forkPath, 'accounts.json');
|
|
97
|
+
if (!existsSync(accountsPath)) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const accounts = JSON.parse(readFileSync(accountsPath, 'utf-8'));
|
|
101
|
+
return accounts[address] || null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Save account state
|
|
105
|
+
*/
|
|
106
|
+
saveAccount(address, state) {
|
|
107
|
+
const accountsPath = join(this.forkPath, 'accounts.json');
|
|
108
|
+
let accounts = {};
|
|
109
|
+
if (existsSync(accountsPath)) {
|
|
110
|
+
accounts = JSON.parse(readFileSync(accountsPath, 'utf-8'));
|
|
111
|
+
}
|
|
112
|
+
accounts[address] = state;
|
|
113
|
+
writeFileSync(accountsPath, JSON.stringify(accounts, null, 2));
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get resource for an account
|
|
117
|
+
*/
|
|
118
|
+
getResource(address, resourceType) {
|
|
119
|
+
const resourceFilePath = this.getResourceFilePath(address);
|
|
120
|
+
if (!existsSync(resourceFilePath)) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const resources = JSON.parse(readFileSync(resourceFilePath, 'utf-8'));
|
|
124
|
+
return resources[resourceType] || null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get all resources for an account
|
|
128
|
+
*/
|
|
129
|
+
getAllResources(address) {
|
|
130
|
+
const resourceFilePath = this.getResourceFilePath(address);
|
|
131
|
+
if (!existsSync(resourceFilePath)) {
|
|
132
|
+
return {};
|
|
133
|
+
}
|
|
134
|
+
return JSON.parse(readFileSync(resourceFilePath, 'utf-8'));
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Save resource for an account
|
|
138
|
+
*/
|
|
139
|
+
saveResource(address, resourceType, data) {
|
|
140
|
+
const resourceFilePath = this.getResourceFilePath(address);
|
|
141
|
+
// Ensure resources directory exists
|
|
142
|
+
const resourcesDir = join(this.forkPath, 'resources');
|
|
143
|
+
if (!existsSync(resourcesDir)) {
|
|
144
|
+
mkdirSync(resourcesDir, { recursive: true });
|
|
145
|
+
}
|
|
146
|
+
let resources = {};
|
|
147
|
+
if (existsSync(resourceFilePath)) {
|
|
148
|
+
resources = JSON.parse(readFileSync(resourceFilePath, 'utf-8'));
|
|
149
|
+
}
|
|
150
|
+
resources[resourceType] = data;
|
|
151
|
+
writeFileSync(resourceFilePath, JSON.stringify(resources, null, 2));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Save all resources for an account
|
|
155
|
+
*/
|
|
156
|
+
saveAllResources(address, resources) {
|
|
157
|
+
const resourceFilePath = this.getResourceFilePath(address);
|
|
158
|
+
// Ensure resources directory exists
|
|
159
|
+
const resourcesDir = join(this.forkPath, 'resources');
|
|
160
|
+
if (!existsSync(resourcesDir)) {
|
|
161
|
+
mkdirSync(resourcesDir, { recursive: true });
|
|
162
|
+
}
|
|
163
|
+
writeFileSync(resourceFilePath, JSON.stringify(resources, null, 2));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Check if resource is cached
|
|
167
|
+
*/
|
|
168
|
+
hasResource(address, resourceType) {
|
|
169
|
+
return this.getResource(address, resourceType) !== null;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* List all accounts in the fork
|
|
173
|
+
*/
|
|
174
|
+
listAccounts() {
|
|
175
|
+
const accountsPath = join(this.forkPath, 'accounts.json');
|
|
176
|
+
if (!existsSync(accountsPath)) {
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
const accounts = JSON.parse(readFileSync(accountsPath, 'utf-8'));
|
|
180
|
+
return Object.keys(accounts);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/fork/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B;;;GAGG;AACH,SAAS,0BAA0B,CAAC,OAAe;IACjD,2CAA2C;IAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE5D,wCAAwC;IACxC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,gCAAgC,CAAC,CAAC;IACtF,CAAC;I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mB,CAAC,OAAO,CAAC,CAAC;QAE3D,oCAAoC;QACpC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,CAAC;QAED,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAAe,EAAE,YAAoB;QAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,CAAC,KAAK,IAAI,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,YAAY;QACV,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAE1D,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC;QACjE,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export interface SnapshotOptions {
|
|
2
|
+
path?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ForkInfo {
|
|
6
|
+
path: string;
|
|
7
|
+
networkVersion?: number;
|
|
8
|
+
nodeUrl?: string;
|
|
9
|
+
exists: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a snapshot (fork) of the current network state
|
|
13
|
+
* Useful for debugging test failures or inspecting state after tests
|
|
14
|
+
*
|
|
15
|
+
* @param options - Snapshot configuration
|
|
16
|
+
* @returns Path to the created snapshot
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // In your test
|
|
21
|
+
* after(async () => {
|
|
22
|
+
* const snapshotPath = await snapshot({ name: 'after-counter-test' });
|
|
23
|
+
* console.log(`Snapshot saved to ${snapshotPath}`);
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function snapshot(options?: SnapshotOptions): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Get information about a fork/snapshot
|
|
30
|
+
*
|
|
31
|
+
* @param path - Path to the fork directory
|
|
32
|
+
* @returns Fork information
|
|
33
|
+
*/
|
|
34
|
+
export declare function getForkInfo(path: string): Promise<ForkInfo>;
|
|
35
|
+
/**
|
|
36
|
+
* View a resource from a fork/snapshot
|
|
37
|
+
* Useful for inspecting state without modifying it
|
|
38
|
+
*
|
|
39
|
+
* @param sessionPath - Path to the fork session
|
|
40
|
+
* @param account - Account address
|
|
41
|
+
* @param resourceType - Full resource type (e.g., '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>')
|
|
42
|
+
* @returns Resource data
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const balance = await viewForkResource(
|
|
47
|
+
* '.movehat/snapshots/test-snapshot',
|
|
48
|
+
* '0x123...',
|
|
49
|
+
* '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>'
|
|
50
|
+
* );
|
|
51
|
+
* console.log(`Balance: ${balance.coin.value}`);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function viewForkResource(sessionPath: string, account: string, resourceType: string): Promise<any>;
|
|
55
|
+
/**
|
|
56
|
+
* Compare a resource between current network state and a fork
|
|
57
|
+
* Useful for verifying state changes after tests
|
|
58
|
+
*
|
|
59
|
+
* @param forkPath - Path to the fork
|
|
60
|
+
* @param account - Account address
|
|
61
|
+
* @param resourceType - Resource type to compare
|
|
62
|
+
* @param currentValue - Current value from network (pass from your test)
|
|
63
|
+
* @returns Comparison result
|
|
64
|
+
*/
|
|
65
|
+
export declare function compareForkState(forkPath: string, account: string, resourceType: string, currentValue: any): Promise<{
|
|
66
|
+
fork: any;
|
|
67
|
+
current: any;
|
|
68
|
+
changed: boolean;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* List all snapshots in the project
|
|
72
|
+
* @returns Array of snapshot paths
|
|
73
|
+
*/
|
|
74
|
+
export declare function listSnapshots(): Promise<string[]>;
|
|
75
|
+
//# sourceMappingURL=test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/fork/test.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8B7E;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2BjE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,GAAG,CAAC,CAyBd;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,GAAG,GAChB,OAAO,CAAC;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAQxD;AAED;;;GAGG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAavD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { execFile } from 'child_process';
|
|
2
|
+
import { promisify } from 'util';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
const execFileAsync = promisify(execFile);
|
|
6
|
+
/**
|
|
7
|
+
* Create a snapshot (fork) of the current network state
|
|
8
|
+
* Useful for debugging test failures or inspecting state after tests
|
|
9
|
+
*
|
|
10
|
+
* @param options - Snapshot configuration
|
|
11
|
+
* @returns Path to the created snapshot
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // In your test
|
|
16
|
+
* after(async () => {
|
|
17
|
+
* const snapshotPath = await snapshot({ name: 'after-counter-test' });
|
|
18
|
+
* console.log(`Snapshot saved to ${snapshotPath}`);
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export async function snapshot(options = {}) {
|
|
23
|
+
const name = options.name || `snapshot-${Date.now()}`;
|
|
24
|
+
const snapshotPath = options.path || join(process.cwd(), '.movehat', 'snapshots', name);
|
|
25
|
+
console.log(`📸 Creating snapshot: ${name}...`);
|
|
26
|
+
try {
|
|
27
|
+
// Initialize fork/snapshot using aptos CLI
|
|
28
|
+
// Use execFile with argument array to prevent command injection
|
|
29
|
+
const { stdout, stderr } = await execFileAsync('aptos', [
|
|
30
|
+
'move',
|
|
31
|
+
'sim',
|
|
32
|
+
'init',
|
|
33
|
+
'--path',
|
|
34
|
+
snapshotPath
|
|
35
|
+
]);
|
|
36
|
+
if (stderr && !stderr.includes('Success')) {
|
|
37
|
+
throw new Error(stderr);
|
|
38
|
+
}
|
|
39
|
+
if (!existsSync(snapshotPath)) {
|
|
40
|
+
throw new Error('Snapshot directory was not created');
|
|
41
|
+
}
|
|
42
|
+
console.log(` ✓ Snapshot created at ${snapshotPath}`);
|
|
43
|
+
return snapshotPath;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new Error(`Failed to create snapshot: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get information about a fork/snapshot
|
|
51
|
+
*
|
|
52
|
+
* @param path - Path to the fork directory
|
|
53
|
+
* @returns Fork information
|
|
54
|
+
*/
|
|
55
|
+
export async function getForkInfo(path) {
|
|
56
|
+
const configPath = join(path, 'config.json');
|
|
57
|
+
if (!existsSync(configPath)) {
|
|
58
|
+
return {
|
|
59
|
+
path,
|
|
60
|
+
exists: false
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
try {
|
|
64
|
+
const fs = await import('fs/promises');
|
|
65
|
+
const configContent = await fs.readFile(configPath, 'utf-8');
|
|
66
|
+
const config = JSON.parse(configContent);
|
|
67
|
+
return {
|
|
68
|
+
path,
|
|
69
|
+
exists: true,
|
|
70
|
+
networkVersion: config.base?.Remote?.network_version,
|
|
71
|
+
nodeUrl: config.base?.Remote?.node_url
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return {
|
|
76
|
+
path,
|
|
77
|
+
exists: false
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* View a resource from a fork/snapshot
|
|
83
|
+
* Useful for inspecting state without modifying it
|
|
84
|
+
*
|
|
85
|
+
* @param sessionPath - Path to the fork session
|
|
86
|
+
* @param account - Account address
|
|
87
|
+
* @param resourceType - Full resource type (e.g., '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>')
|
|
88
|
+
* @returns Resource data
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const balance = await viewForkResource(
|
|
93
|
+
* '.movehat/snapshots/test-snapshot',
|
|
94
|
+
* '0x123...',
|
|
95
|
+
* '0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>'
|
|
96
|
+
* );
|
|
97
|
+
* console.log(`Balance: ${balance.coin.value}`);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export async function viewForkResource(sessionPath, account, resourceType) {
|
|
101
|
+
try {
|
|
102
|
+
// Use execFile with argument array to prevent command injection
|
|
103
|
+
const { stdout } = await execFileAsync('aptos', [
|
|
104
|
+
'move',
|
|
105
|
+
'sim',
|
|
106
|
+
'view-resource',
|
|
107
|
+
'--session',
|
|
108
|
+
sessionPath,
|
|
109
|
+
'--account',
|
|
110
|
+
account,
|
|
111
|
+
'--resource',
|
|
112
|
+
resourceType
|
|
113
|
+
]);
|
|
114
|
+
const result = JSON.parse(stdout);
|
|
115
|
+
if (result.Error) {
|
|
116
|
+
throw new Error(result.Error);
|
|
117
|
+
}
|
|
118
|
+
return result.Result;
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
throw new Error(`Failed to view resource: ${error.message}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Compare a resource between current network state and a fork
|
|
126
|
+
* Useful for verifying state changes after tests
|
|
127
|
+
*
|
|
128
|
+
* @param forkPath - Path to the fork
|
|
129
|
+
* @param account - Account address
|
|
130
|
+
* @param resourceType - Resource type to compare
|
|
131
|
+
* @param currentValue - Current value from network (pass from your test)
|
|
132
|
+
* @returns Comparison result
|
|
133
|
+
*/
|
|
134
|
+
export async function compareForkState(forkPath, account, resourceType, currentValue) {
|
|
135
|
+
const forkValue = await viewForkResource(forkPath, account, resourceType);
|
|
136
|
+
return {
|
|
137
|
+
fork: forkValue,
|
|
138
|
+
current: currentValue,
|
|
139
|
+
changed: JSON.stringify(forkValue) !== JSON.stringify(currentValue)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* List all snapshots in the project
|
|
144
|
+
* @returns Array of snapshot paths
|
|
145
|
+
*/
|
|
146
|
+
export async function listSnapshots() {
|
|
147
|
+
const snapshotsDir = join(process.cwd(), '.movehat', 'snapshots');
|
|
148
|
+
if (!existsSync(snapshotsDir)) {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
const fs = await import('fs/promises');
|
|
152
|
+
const entries = await fs.readdir(snapshotsDir, { withFileTypes: true });
|
|
153
|
+
return entries
|
|
154
|
+
.filter(entry => entry.isDirectory())
|
|
155
|
+
.map(entry => join(snapshotsDir, entry.name));
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/fork/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAEhC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAc1C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,UAA2B,EAAE;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IACtD,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;IAExF,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,KAAK,CAAC,CAAC;IAEhD,IAAI,CAA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AS,CAAC,YAAY,CAAC;KACpE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAElE,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAC9B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAExE,OAAO,OAAO;SACX,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;SACpC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type TransactionResult } from "../core/contract.js";
|
|
2
|
+
/**
|
|
3
|
+
* Assert that a transaction was successful
|
|
4
|
+
*/
|
|
5
|
+
export declare function assertTransactionSuccess(result: TransactionResult): void;
|
|
6
|
+
export declare function assertTransactionFailed(result: TransactionResult, expectedError?: string): void;
|
|
7
|
+
//# sourceMappingURL=assertions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.d.ts","sourceRoot":"","sources":["../../src/helpers/assertions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAMxE;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,EACzB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI,CAYN"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assert that a transaction was successful
|
|
3
|
+
*/
|
|
4
|
+
export function assertTransactionSuccess(result) {
|
|
5
|
+
if (!result.success) {
|
|
6
|
+
throw new Error(`Transaction failed with status: ${result.vm_status}\nHash: ${result.hash}`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export function assertTransactionFailed(result, expectedError) {
|
|
10
|
+
if (result.success) {
|
|
11
|
+
throw new Error(`Transaction was expected to fail but succeeded.\nHash: ${result.hash}`);
|
|
12
|
+
}
|
|
13
|
+
if (expectedError && !result.vm_status.includes(expectedError)) {
|
|
14
|
+
throw new Error(`Transaction failed with unexpected error.\nExpected to include: ${expectedError}\nActual status: ${result.vm_status}\nHash: ${result.hash}`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=assertions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../src/helpers/assertions.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAyB;IAChE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,mCAAmC,MAAM,CAAC,SAAS,WAAW,MAAM,CAAC,IAAI,EAAE,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,MAAyB,EACzB,aAAsB;IAEtB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,0DAA0D,MAAM,CAAC,IAAI,EAAE,CACxE,CAAC;IACJ,CAAC;IAED,IAAG,aAAa,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,KAAK,CACb,mEAAmE,aAAa,oBAAoB,MAAM,CAAC,SAAS,WAAW,MAAM,CAAC,IAAI,EAAE,CAC7I,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/helpers/banner.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,mBAAmB,cAO/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAE9B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Warm yellow-to-amber palette for a subtle gradient.
|
|
2
|
+
const gradientPalette = [
|
|
3
|
+
[255, 239, 150],
|
|
4
|
+
[255, 223, 88],
|
|
5
|
+
[255, 207, 64],
|
|
6
|
+
[255, 181, 45],
|
|
7
|
+
[255, 160, 30],
|
|
8
|
+
];
|
|
9
|
+
const bannerLines = [
|
|
10
|
+
" ███╗ ███╗ ██████╗ ██╗ ██╗███████╗██╗ ██╗ █████╗ ████████╗",
|
|
11
|
+
" ████╗ ████║██╔═══██╗██║ ██║██╔════╝██║ ██║██╔══██╗╚══██╔══╝",
|
|
12
|
+
" ██╔████╔██║██║ ██║██║ ██║█████╗ ███████║███████║ ██║ ",
|
|
13
|
+
" ██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██║██╔══██║ ██║ ",
|
|
14
|
+
" ██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗██║ ██║██║ ██║ ██║ ",
|
|
15
|
+
" ╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ",
|
|
16
|
+
];
|
|
17
|
+
const reset = "\x1b[0m";
|
|
18
|
+
const shouldColorize = () => process.env.NO_COLOR === undefined && Boolean(process.stdout.isTTY);
|
|
19
|
+
const toAnsi = ([r, g, b]) => `\x1b[38;2;${r};${g};${b}m`;
|
|
20
|
+
const applyGradient = (line, offset) => {
|
|
21
|
+
let painted = "";
|
|
22
|
+
for (let i = 0; i < line.length; i++) {
|
|
23
|
+
const color = gradientPalette[(i + offset) % gradientPalette.length];
|
|
24
|
+
painted += `${toAnsi(color)}${line[i]}`;
|
|
25
|
+
}
|
|
26
|
+
return painted;
|
|
27
|
+
};
|
|
28
|
+
export const renderMovehatBanner = () => {
|
|
29
|
+
if (!shouldColorize()) {
|
|
30
|
+
return bannerLines.join("\n");
|
|
31
|
+
}
|
|
32
|
+
const coloredLines = bannerLines.map((line, idx) => applyGradient(line, idx * 2));
|
|
33
|
+
return `${coloredLines.join("\n")}${reset}`;
|
|
34
|
+
};
|
|
35
|
+
export const printMovehatBanner = () => {
|
|
36
|
+
console.log(renderMovehatBanner());
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=banner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.js","sourceRoot":"","sources":["../../src/helpers/banner.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,eAAe,GAAU;IAC7B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACf,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IACd,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IACd,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;IACd,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;CAClE,CAAC;AAEF,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAEjG,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAE/D,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,MAAc,EAAE,EAAE;IACrD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;QACrE,OAAO,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE;IACtC,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACtB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IAClF,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,CAAC,CAAC;AACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { setupTestEnvironment, createTestAccount } from "./setup.js";
|
|
2
|
+
export type { TestEnvironment } from "./setup.js";
|
|
3
|
+
export { MoveContract, getContract } from "../core/contract.js";
|
|
4
|
+
export type { TransactionResult } from "../core/contract.js";
|
|
5
|
+
export { assertTransactionSuccess, assertTransactionFailed, } from "./assertions.js";
|
|
6
|
+
export { saveDeployment, loadDeployment, getAllDeployments, getDeployedAddress, } from "../core/deployments.js";
|
|
7
|
+
export type { DeploymentInfo } from "../core/deployments.js";
|
|
8
|
+
export { snapshot, getForkInfo, viewForkResource, compareForkState, listSnapshots, } from "../fork/test.js";
|
|
9
|
+
export type { SnapshotOptions, ForkInfo } from "../fork/test.js";
|
|
10
|
+
export type { MovehatConfig } from "../types/config.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEjE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Re-export all helpers
|
|
2
|
+
export { setupTestEnvironment, createTestAccount } from "./setup.js";
|
|
3
|
+
export { MoveContract, getContract } from "../core/contract.js";
|
|
4
|
+
export { assertTransactionSuccess, assertTransactionFailed, } from "./assertions.js";
|
|
5
|
+
export { saveDeployment, loadDeployment, getAllDeployments, getDeployedAddress, } from "../core/deployments.js";
|
|
6
|
+
export { snapshot, getForkInfo, viewForkResource, compareForkState, listSnapshots, } from "../fork/test.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Account, Aptos } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import { MovehatConfig } from "../types/config.js";
|
|
3
|
+
export interface TestEnvironment {
|
|
4
|
+
aptos: Aptos;
|
|
5
|
+
account: Account;
|
|
6
|
+
config: MovehatConfig;
|
|
7
|
+
}
|
|
8
|
+
export declare function setupTestEnvironment(networkName?: string): Promise<TestEnvironment>;
|
|
9
|
+
export declare function createTestAccount(): Account;
|
|
10
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/helpers/setup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAIN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,wBAAsB,oBAAoB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CA0BzF;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Account, Aptos, AptosConfig, Ed25519PrivateKey, } from "@aptos-labs/ts-sdk";
|
|
2
|
+
import { loadUserConfig, resolveNetworkConfig } from "../core/config.js";
|
|
3
|
+
export async function setupTestEnvironment(networkName) {
|
|
4
|
+
// Load and resolve config for selected network
|
|
5
|
+
const userConfig = await loadUserConfig();
|
|
6
|
+
const network = networkName || process.env.MH_CLI_NETWORK;
|
|
7
|
+
const config = await resolveNetworkConfig(userConfig, network);
|
|
8
|
+
const aptosConfig = new AptosConfig({
|
|
9
|
+
network: config.network,
|
|
10
|
+
fullnode: config.rpc,
|
|
11
|
+
});
|
|
12
|
+
const aptos = new Aptos(aptosConfig);
|
|
13
|
+
const privateKey = new Ed25519PrivateKey(config.privateKey);
|
|
14
|
+
const account = Account.fromPrivateKey({ privateKey });
|
|
15
|
+
console.log(`✅ Test environment ready`);
|
|
16
|
+
console.log(` Account: ${account.accountAddress.toString()}`);
|
|
17
|
+
console.log(` Network: ${config.network}`);
|
|
18
|
+
console.log(` RPC: ${config.rpc}\n`);
|
|
19
|
+
return {
|
|
20
|
+
aptos,
|
|
21
|
+
account,
|
|
22
|
+
config,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function createTestAccount() {
|
|
26
|
+
return Account.generate();
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.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AE,CAAC;AAC9B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./helpers/index.js";
|
|
2
|
+
export type { MovehatConfig } from "./types/config.js";
|
|
3
|
+
export { initRuntime, getRuntime, getMovehat, mh } from "./runtime.js";
|
|
4
|
+
export type { MovehatRuntime, NetworkInfo } from "./types/runtime.js";
|
|
5
|
+
export { ForkManager } from "./fork/manager.js";
|
|
6
|
+
export { MovementApiClient } from "./fork/api.js";
|
|
7
|
+
export { ForkStorage } from "./fork/storage.js";
|
|
8
|
+
export { ForkServer } from "./fork/server.js";
|
|
9
|
+
export type { ForkMetadata, AccountState, LedgerInfo, AccountData, AccountResource } from "./types/fork.js";
|
|
10
|
+
export { ModuleAlreadyDeployedError } from "./errors.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAG5G,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Export all helpers for end users
|
|
2
|
+
export * from "./helpers/index.js";
|
|
3
|
+
// Export Movehat Runtime Environment
|
|
4
|
+
export { initRuntime, getRuntime, getMovehat, mh } from "./runtime.js";
|
|
5
|
+
// Export Fork system
|
|
6
|
+
export { ForkManager } from "./fork/manager.js";
|
|
7
|
+
export { MovementApiClient } from "./fork/api.js";
|
|
8
|
+
export { ForkStorage } from "./fork/storage.js";
|
|
9
|
+
export { ForkServer } from "./fork/server.js";
|
|
10
|
+
// Export custom errors
|
|
11
|
+
export { ModuleAlreadyDeployedError } from "./errors.js";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,cAAc,oBAAoB,CAAC;AAGnC,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAGvE,qBAAqB;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,uBAAuB;AACvB,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
|