rocketh 0.15.0-testing.17 → 0.15.0-testing.2
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/CHANGELOG.md +0 -90
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/environment/deployments.d.ts +1 -1
- package/dist/environment/deployments.d.ts.map +1 -1
- package/dist/environment/index.d.ts +6 -2
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +60 -42
- package/dist/environment/index.js.map +1 -1
- package/dist/environment/types.d.ts +75 -33
- package/dist/environment/types.d.ts.map +1 -1
- package/dist/environment/utils/artifacts.d.ts +1 -1
- package/dist/environment/utils/artifacts.d.ts.map +1 -1
- package/dist/environment/utils/chains.d.ts +5 -6
- package/dist/environment/utils/chains.d.ts.map +1 -1
- package/dist/environment/utils/chains.js +19 -85
- package/dist/environment/utils/chains.js.map +1 -1
- package/dist/executor/index.d.ts +84 -12
- package/dist/executor/index.d.ts.map +1 -1
- package/dist/executor/index.js +216 -167
- package/dist/executor/index.js.map +1 -1
- package/dist/executor/setup.test.d.ts +3 -3
- package/dist/executor/setup.test.d.ts.map +1 -1
- package/dist/executor/setup.test.js +1 -1
- package/dist/executor/setup.test.js.map +1 -1
- package/dist/executor/types.d.ts +0 -92
- package/dist/executor/types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/utils/extensions.d.ts +2 -1
- package/dist/utils/extensions.d.ts.map +1 -1
- package/dist/utils/extensions.test.d.ts +2 -2
- package/dist/utils/extensions.test.d.ts.map +1 -1
- package/dist/utils/fs.d.ts +1 -1
- package/dist/utils/fs.d.ts.map +1 -1
- package/dist/utils/fs.js.map +1 -1
- package/package.json +3 -3
- package/src/cli.ts +3 -3
- package/src/environment/deployments.ts +1 -1
- package/src/environment/index.ts +72 -56
- package/src/environment/types.ts +380 -0
- package/src/environment/utils/artifacts.ts +1 -1
- package/src/environment/utils/chains.ts +22 -113
- package/src/executor/index.ts +341 -218
- package/src/executor/setup.test.ts +2 -2
- package/src/executor/types.ts +176 -0
- package/src/index.ts +6 -14
- package/src/utils/extensions.test.ts +1 -1
- package/src/utils/extensions.ts +2 -2
- package/src/utils/fs.ts +1 -1
- package/dist/types.d.ts +0 -472
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/types.ts +0 -600
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Environment} from '../types.js';
|
|
1
|
+
import type {Environment} from '../environment/types.js';
|
|
2
2
|
import {setup} from './index.js';
|
|
3
3
|
|
|
4
4
|
// Mock environment for testing
|
|
@@ -134,7 +134,7 @@ export const exampleUsage = () => {
|
|
|
134
134
|
await env.verifyOnEtherscan(tokenAddress, ['MyToken', 'MTK']);
|
|
135
135
|
|
|
136
136
|
// Original environment is still fully accessible
|
|
137
|
-
console.log(`Deployed on
|
|
137
|
+
console.log(`Deployed on network: ${env.network.name}`);
|
|
138
138
|
const deployment = env.get('MyToken');
|
|
139
139
|
|
|
140
140
|
return true;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import {Address} from 'abitype';
|
|
2
|
+
import type {
|
|
3
|
+
Environment,
|
|
4
|
+
JSONTypePlusBigInt,
|
|
5
|
+
UnknownDeployments,
|
|
6
|
+
UnresolvedNetworkSpecificData,
|
|
7
|
+
UnresolvedUnknownNamedAccounts,
|
|
8
|
+
} from '../environment/types.js';
|
|
9
|
+
|
|
10
|
+
export type DeployScriptFunction<
|
|
11
|
+
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
12
|
+
Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
|
|
13
|
+
ArgumentsTypes = undefined,
|
|
14
|
+
Deployments extends UnknownDeployments = UnknownDeployments,
|
|
15
|
+
Extra extends Record<string, unknown> = Record<string, unknown>
|
|
16
|
+
> = (env: Environment<NamedAccounts, Data, Deployments, Extra>, args?: ArgumentsTypes) => Promise<void | boolean>;
|
|
17
|
+
|
|
18
|
+
export interface DeployScriptModule<
|
|
19
|
+
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
20
|
+
Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
|
|
21
|
+
ArgumentsTypes = undefined,
|
|
22
|
+
Deployments extends UnknownDeployments = UnknownDeployments,
|
|
23
|
+
Extra extends Record<string, unknown> = Record<string, unknown>
|
|
24
|
+
> {
|
|
25
|
+
(env: Environment<NamedAccounts, Data, Deployments, Extra>, args?: ArgumentsTypes): Promise<void | boolean>;
|
|
26
|
+
tags?: string[];
|
|
27
|
+
dependencies?: string[];
|
|
28
|
+
runAtTheEnd?: boolean;
|
|
29
|
+
id?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type ScriptCallback<
|
|
33
|
+
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
34
|
+
Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
|
|
35
|
+
Deployments extends UnknownDeployments = UnknownDeployments,
|
|
36
|
+
Extra extends Record<string, unknown> = Record<string, unknown>
|
|
37
|
+
> = (env: Environment<NamedAccounts, Data, Deployments, Extra>) => Promise<void>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Utility type to extract the return value from a higher-order function
|
|
41
|
+
* For functions of type (firstParam: T) => (...args: any[]) => V or (firstParam: T) => V
|
|
42
|
+
*/
|
|
43
|
+
export type ExtractReturnFunction<T> = T extends (first: any) => infer Return ? Return : never;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Utility type to transform an object of higher-order functions by extracting their return types
|
|
47
|
+
* This handles both regular functions and getter functions
|
|
48
|
+
*/
|
|
49
|
+
export type CurriedFunctions<T> = {
|
|
50
|
+
[K in keyof T]: ExtractReturnFunction<T[K]>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Type for the enhanced environment proxy that includes both the original environment
|
|
55
|
+
* and the curried functions
|
|
56
|
+
*/
|
|
57
|
+
export type EnhancedEnvironment<
|
|
58
|
+
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
59
|
+
Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
|
|
60
|
+
Deployments extends UnknownDeployments = UnknownDeployments,
|
|
61
|
+
Extensions extends Record<
|
|
62
|
+
string,
|
|
63
|
+
(env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any
|
|
64
|
+
> = Record<string, (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any>,
|
|
65
|
+
Extra extends Record<string, unknown> = Record<string, unknown>
|
|
66
|
+
> = Environment<NamedAccounts, Data, Deployments, Extra> & CurriedFunctions<Extensions>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Type for a deploy script function that receives an enhanced environment
|
|
70
|
+
*/
|
|
71
|
+
export type EnhancedDeployScriptFunction<
|
|
72
|
+
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
73
|
+
Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
|
|
74
|
+
ArgumentsTypes = undefined,
|
|
75
|
+
Deployments extends UnknownDeployments = UnknownDeployments,
|
|
76
|
+
Functions extends Record<
|
|
77
|
+
string,
|
|
78
|
+
(env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any
|
|
79
|
+
> = Record<string, (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any>,
|
|
80
|
+
Extra extends Record<string, unknown> = Record<string, unknown>
|
|
81
|
+
> = (
|
|
82
|
+
env: EnhancedEnvironment<NamedAccounts, Data, Deployments, Functions, Extra>,
|
|
83
|
+
args?: ArgumentsTypes
|
|
84
|
+
) => Promise<void | boolean>;
|
|
85
|
+
|
|
86
|
+
type ChainBlockExplorer = {
|
|
87
|
+
name: string;
|
|
88
|
+
url: string;
|
|
89
|
+
apiUrl?: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
type ChainContract = {
|
|
92
|
+
address: Address;
|
|
93
|
+
blockCreated?: number | undefined;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type ChainNativeCurrency = {
|
|
97
|
+
name: string;
|
|
98
|
+
/** 2-6 characters long */
|
|
99
|
+
symbol: string;
|
|
100
|
+
decimals: number;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
type ChainRpcUrls = {
|
|
104
|
+
http: readonly string[];
|
|
105
|
+
webSocket?: readonly string[] | undefined;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @description Combines members of an intersection into a readable type.
|
|
110
|
+
*
|
|
111
|
+
* @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
|
|
112
|
+
* @example
|
|
113
|
+
* Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
|
|
114
|
+
* => { a: string, b: string, c: number, d: bigint }
|
|
115
|
+
*/
|
|
116
|
+
type Prettify<T> = {
|
|
117
|
+
[K in keyof T]: T[K];
|
|
118
|
+
} & {};
|
|
119
|
+
|
|
120
|
+
export type ChainInfo = {
|
|
121
|
+
/** ID in number form */
|
|
122
|
+
id: number;
|
|
123
|
+
/** Human-readable name */
|
|
124
|
+
name: string;
|
|
125
|
+
/** Collection of block explorers */
|
|
126
|
+
blockExplorers?:
|
|
127
|
+
| {
|
|
128
|
+
[key: string]: ChainBlockExplorer;
|
|
129
|
+
default: ChainBlockExplorer;
|
|
130
|
+
}
|
|
131
|
+
| undefined;
|
|
132
|
+
/** Collection of contracts */
|
|
133
|
+
contracts?:
|
|
134
|
+
| Prettify<
|
|
135
|
+
{
|
|
136
|
+
[key: string]: ChainContract | {[sourceId: number]: ChainContract | undefined} | undefined;
|
|
137
|
+
} & {
|
|
138
|
+
ensRegistry?: ChainContract | undefined;
|
|
139
|
+
ensUniversalResolver?: ChainContract | undefined;
|
|
140
|
+
multicall3?: ChainContract | undefined;
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
| undefined;
|
|
144
|
+
/** Currency used by chain */
|
|
145
|
+
nativeCurrency: ChainNativeCurrency;
|
|
146
|
+
/** Collection of RPC endpoints */
|
|
147
|
+
rpcUrls: {
|
|
148
|
+
[key: string]: ChainRpcUrls;
|
|
149
|
+
default: ChainRpcUrls;
|
|
150
|
+
};
|
|
151
|
+
/** Source Chain ID (ie. the L1 chain) */
|
|
152
|
+
sourceId?: number | undefined;
|
|
153
|
+
/** Flag for test networks */
|
|
154
|
+
testnet?: boolean | undefined;
|
|
155
|
+
|
|
156
|
+
chainType: 'zksync' | 'op-stack' | 'celo' | 'default';
|
|
157
|
+
|
|
158
|
+
genesisHash?: string;
|
|
159
|
+
|
|
160
|
+
properties?: Record<string, JSONTypePlusBigInt>;
|
|
161
|
+
|
|
162
|
+
// this will bring in the following when reconstructed from the data above
|
|
163
|
+
|
|
164
|
+
// /** Custom chain data. */
|
|
165
|
+
// custom?: any;
|
|
166
|
+
|
|
167
|
+
// /**
|
|
168
|
+
// * Modifies how chain data structures (ie. Blocks, Transactions, etc)
|
|
169
|
+
// * are formatted & typed.
|
|
170
|
+
// */
|
|
171
|
+
// formatters?: any | undefined;
|
|
172
|
+
// /** Modifies how data (ie. Transactions) is serialized. */
|
|
173
|
+
// serializers?: any | undefined;
|
|
174
|
+
// /** Modifies how fees are derived. */
|
|
175
|
+
// fees?: any | undefined;
|
|
176
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
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';
|
|
1
|
+
export * from './executor/index.js';
|
|
2
|
+
export * from './executor/types.js';
|
|
3
|
+
export * from './environment/types.js';
|
|
12
4
|
export {loadDeployments} from './environment/deployments.js';
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
5
|
+
export * from './environment/utils/artifacts.js';
|
|
6
|
+
export * from './environment/utils/chains.js';
|
|
7
|
+
export * from './utils/eth.js';
|
package/src/utils/extensions.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type {
|
|
|
3
3
|
UnknownDeployments,
|
|
4
4
|
UnresolvedNetworkSpecificData,
|
|
5
5
|
UnresolvedUnknownNamedAccounts,
|
|
6
|
-
|
|
7
|
-
} from '../types.js';
|
|
6
|
+
} from '../environment/types.js';
|
|
7
|
+
import {CurriedFunctions} from '../executor/types.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param env - The environment object to inject as the first parameter
|
package/src/utils/fs.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function lookupFile(dir: string, formats: string[], options?: LookupFileO
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export function traverseMultipleDirectory(dirs:
|
|
27
|
+
export function traverseMultipleDirectory(dirs: string[]): string[] {
|
|
28
28
|
const filepaths = [];
|
|
29
29
|
for (const dir of dirs) {
|
|
30
30
|
let filesStats = traverse(dir);
|