rocketh 0.15.15 → 0.17.0-next.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/dist/environment/index.d.ts +12 -2
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +94 -48
- package/dist/environment/index.js.map +1 -1
- package/dist/executor/index.d.ts +11 -9
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +144 -238
- package/dist/executor/index.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/types.d.ts +0 -1
- package/dist/internal/types.d.ts.map +1 -1
- package/dist/types.d.ts +25 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -20
- package/.prettierignore +0 -3
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -950
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -30
- package/dist/cli.js.map +0 -1
- package/dist/environment/deployments.d.ts +0 -12
- package/dist/environment/deployments.d.ts.map +0 -1
- package/dist/environment/deployments.js +0 -108
- package/dist/environment/deployments.js.map +0 -1
- package/dist/executor/setup.test.d.ts +0 -14
- package/dist/executor/setup.test.d.ts.map +0 -1
- package/dist/executor/setup.test.js +0 -107
- package/dist/executor/setup.test.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -16
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js +0 -52
- package/dist/utils/fs.js.map +0 -1
- package/src/cli.ts +0 -34
- package/src/environment/deployments.ts +0 -135
- package/src/environment/index.ts +0 -696
- package/src/environment/providers/BaseProvider.ts +0 -13
- package/src/environment/providers/TransactionHashTracker.ts +0 -22
- package/src/environment/utils/artifacts.ts +0 -176
- package/src/environment/utils/chains.ts +0 -192
- package/src/executor/index.ts +0 -638
- package/src/executor/setup.test.ts +0 -151
- package/src/index.ts +0 -17
- package/src/internal/logging.ts +0 -80
- package/src/internal/types.ts +0 -5
- package/src/types.ts +0 -601
- package/src/utils/eth.ts +0 -96
- package/src/utils/extensions.test.ts +0 -53
- package/src/utils/extensions.ts +0 -72
- package/src/utils/fs.ts +0 -70
- package/src/utils/json.ts +0 -33
- package/tsconfig.json +0 -18
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type {Environment} from '../types.js';
|
|
2
|
-
import {setup} from './index.js';
|
|
3
|
-
|
|
4
|
-
// Mock environment for testing
|
|
5
|
-
const mockEnv = {} as Environment;
|
|
6
|
-
|
|
7
|
-
// Example utility functions that take Environment as first parameter
|
|
8
|
-
const utilityFunctions = {
|
|
9
|
-
deployContract:
|
|
10
|
-
(env: Environment) =>
|
|
11
|
-
async (contractName: string, args: any[] = []): Promise<string> => {
|
|
12
|
-
console.log(`Deploying ${contractName} with args:`, args);
|
|
13
|
-
return '0x1234567890123456789012345678901234567890';
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
verifyContract:
|
|
17
|
-
(env: Environment) =>
|
|
18
|
-
async (address: string): Promise<boolean> => {
|
|
19
|
-
console.log(`Verifying contract at ${address}`);
|
|
20
|
-
return true;
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
getBalance:
|
|
24
|
-
(env: Environment) =>
|
|
25
|
-
async (address: string): Promise<bigint> => {
|
|
26
|
-
console.log(`Getting balance for ${address}`);
|
|
27
|
-
return BigInt('1000000000000000000'); // 1 ETH
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
calculateGas:
|
|
31
|
-
(env: Environment) =>
|
|
32
|
-
(operation: string): number => {
|
|
33
|
-
console.log(`Calculating gas for ${operation}`);
|
|
34
|
-
return 21000;
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
isDeployed:
|
|
38
|
-
(env: Environment) =>
|
|
39
|
-
(contractName: string): boolean => {
|
|
40
|
-
console.log(`Checking if ${contractName} is deployed`);
|
|
41
|
-
return false;
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
test: (env: Environment) => true,
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Create the enhanced execute function using setup
|
|
48
|
-
const {deployScript} = setup(utilityFunctions);
|
|
49
|
-
|
|
50
|
-
// Test the enhanced execute function
|
|
51
|
-
const testScript = deployScript(
|
|
52
|
-
async (env, args) => {
|
|
53
|
-
// Type test: env should have both original Environment properties AND curried functions
|
|
54
|
-
|
|
55
|
-
// Test curried functions (no need to pass env)
|
|
56
|
-
const address = await env.deployContract('MyToken', ['TokenName', 'TKN']);
|
|
57
|
-
const isVerified = await env.verifyContract(address);
|
|
58
|
-
const balance = await env.getBalance(address);
|
|
59
|
-
const gasEstimate = env.calculateGas('transfer');
|
|
60
|
-
const deployed = env.isDeployed('MyToken');
|
|
61
|
-
|
|
62
|
-
// Test that original environment properties are still accessible
|
|
63
|
-
// (These would normally be available on a real environment)
|
|
64
|
-
// console.log('Network name:', env.network?.name);
|
|
65
|
-
// console.log('Chain ID:', env.network?.chain?.id);
|
|
66
|
-
|
|
67
|
-
console.log('Test results:', {
|
|
68
|
-
address,
|
|
69
|
-
isVerified,
|
|
70
|
-
balance: balance.toString(),
|
|
71
|
-
gasEstimate,
|
|
72
|
-
deployed,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
return true; // Return true to indicate successful completion
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
tags: ['test'],
|
|
79
|
-
dependencies: [],
|
|
80
|
-
id: 'test-setup-function',
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
// Type tests - these should compile without errors
|
|
85
|
-
async function testTypes() {
|
|
86
|
-
// The script should be a valid DeployScriptModule
|
|
87
|
-
console.log('Script tags:', testScript.tags);
|
|
88
|
-
console.log('Script dependencies:', testScript.dependencies);
|
|
89
|
-
console.log('Script ID:', testScript.id);
|
|
90
|
-
|
|
91
|
-
// The script should be callable with an environment
|
|
92
|
-
try {
|
|
93
|
-
const result = await testScript(mockEnv, undefined);
|
|
94
|
-
console.log('Script execution result:', result);
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.log('Script execution test completed (expected with mock env)');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Example of how this would be used in a real deployment script
|
|
101
|
-
export const exampleUsage = () => {
|
|
102
|
-
// Define your utility functions
|
|
103
|
-
const myFunctions = {
|
|
104
|
-
deployERC20:
|
|
105
|
-
(env: Environment) =>
|
|
106
|
-
async (name: string, symbol: string): Promise<string> => {
|
|
107
|
-
// Implementation would use env.save, env.network.provider, etc.
|
|
108
|
-
return '0x...';
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
setupPermissions:
|
|
112
|
-
(env: Environment) =>
|
|
113
|
-
async (contractAddress: string, admin: string): Promise<void> => {
|
|
114
|
-
// Implementation would interact with contracts
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
verifyOnEtherscan:
|
|
118
|
-
(env: Environment) =>
|
|
119
|
-
async (address: string, constructorArgs: any[]): Promise<boolean> => {
|
|
120
|
-
// Implementation would call verification service
|
|
121
|
-
return true;
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// Create the enhanced execute function
|
|
126
|
-
const {deployScript} = setup(myFunctions);
|
|
127
|
-
|
|
128
|
-
// Export your deployment script
|
|
129
|
-
return deployScript(
|
|
130
|
-
async (env, args) => {
|
|
131
|
-
// Now you can use the functions without passing env each time
|
|
132
|
-
const tokenAddress = await env.deployERC20('MyToken', 'MTK');
|
|
133
|
-
await env.setupPermissions(tokenAddress, env.namedAccounts.deployer);
|
|
134
|
-
await env.verifyOnEtherscan(tokenAddress, ['MyToken', 'MTK']);
|
|
135
|
-
|
|
136
|
-
// Original environment is still fully accessible
|
|
137
|
-
console.log(`Deployed on environment: ${env.name}`);
|
|
138
|
-
const deployment = env.get('MyToken');
|
|
139
|
-
|
|
140
|
-
return true;
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
tags: ['token', 'deploy'],
|
|
144
|
-
dependencies: ['setup'],
|
|
145
|
-
id: 'deploy-my-token',
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Export for potential use in actual tests
|
|
151
|
-
export {testTypes, testScript, utilityFunctions};
|
package/src/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
setup,
|
|
3
|
-
loadAndExecuteDeployments,
|
|
4
|
-
executeDeployScripts,
|
|
5
|
-
readAndResolveConfig,
|
|
6
|
-
enhanceEnvIfNeeded,
|
|
7
|
-
loadEnvironment,
|
|
8
|
-
} from './executor/index.js';
|
|
9
|
-
|
|
10
|
-
export {getChainConfig, chainByCanonicalName} from './environment/utils/chains.js';
|
|
11
|
-
export * from './types.js';
|
|
12
|
-
export {loadDeployments} from './environment/deployments.js';
|
|
13
|
-
export {mergeArtifacts, mergeABIs} from './environment/utils/artifacts.js';
|
|
14
|
-
export {getGasPriceEstimate, getRoughGasPriceEstimate} from './utils/eth.js';
|
|
15
|
-
export {bigIntToStringReplacer} from './utils/json.js';
|
|
16
|
-
|
|
17
|
-
export type * from 'eip-1193';
|
package/src/internal/logging.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import {logs} from 'named-logs';
|
|
2
|
-
|
|
3
|
-
import {hookup, factory as Logging} from 'named-logs-console';
|
|
4
|
-
// import ora from 'ora-cjs';
|
|
5
|
-
hookup();
|
|
6
|
-
|
|
7
|
-
export function setLogLevel(level: number) {
|
|
8
|
-
Logging.level = level;
|
|
9
|
-
if (Logging.level > 0) {
|
|
10
|
-
Logging.enable();
|
|
11
|
-
} else {
|
|
12
|
-
Logging.disable();
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const logger = logs('rocketh');
|
|
17
|
-
|
|
18
|
-
export type ProgressIndicator = {
|
|
19
|
-
start(msg?: string): ProgressIndicator;
|
|
20
|
-
stop(): ProgressIndicator;
|
|
21
|
-
succeed(msg?: string): ProgressIndicator;
|
|
22
|
-
fail(msg?: string): ProgressIndicator;
|
|
23
|
-
};
|
|
24
|
-
const loggerProgressIndicator: ProgressIndicator = {
|
|
25
|
-
start(msg?: string) {
|
|
26
|
-
if (msg) {
|
|
27
|
-
console.log(msg);
|
|
28
|
-
}
|
|
29
|
-
return this;
|
|
30
|
-
},
|
|
31
|
-
stop() {
|
|
32
|
-
return this;
|
|
33
|
-
},
|
|
34
|
-
succeed(msg?: string) {
|
|
35
|
-
if (msg) {
|
|
36
|
-
console.log(msg);
|
|
37
|
-
}
|
|
38
|
-
return this;
|
|
39
|
-
},
|
|
40
|
-
fail(msg?: string) {
|
|
41
|
-
if (msg) {
|
|
42
|
-
console.error(msg);
|
|
43
|
-
}
|
|
44
|
-
return this;
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
const voidProgressIndicator: ProgressIndicator = {
|
|
48
|
-
start() {
|
|
49
|
-
return this;
|
|
50
|
-
},
|
|
51
|
-
stop() {
|
|
52
|
-
return this;
|
|
53
|
-
},
|
|
54
|
-
succeed() {
|
|
55
|
-
return this;
|
|
56
|
-
},
|
|
57
|
-
fail() {
|
|
58
|
-
return this;
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
// export function spin(message: string): PartialOra {
|
|
62
|
-
// return Logging.level > 0 ? ora(message).start() : voidProgressIndicator;
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
// let lastSpin = ora('rocketh');
|
|
66
|
-
let lastSpin = loggerProgressIndicator;
|
|
67
|
-
export function spin(message?: string): ProgressIndicator {
|
|
68
|
-
if (Logging.level > 0) {
|
|
69
|
-
lastSpin = lastSpin.start(message);
|
|
70
|
-
return lastSpin;
|
|
71
|
-
} else {
|
|
72
|
-
return voidProgressIndicator;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export function log(message: string) {
|
|
77
|
-
if (Logging.level > 0) {
|
|
78
|
-
console.log(message);
|
|
79
|
-
}
|
|
80
|
-
}
|