rocketh 0.15.0-testing.1 → 0.15.0-testing.11

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/cli.js +1 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/environment/deployments.d.ts +1 -1
  5. package/dist/environment/deployments.d.ts.map +1 -1
  6. package/dist/environment/index.d.ts +2 -6
  7. package/dist/environment/index.d.ts.map +1 -1
  8. package/dist/environment/index.js +27 -51
  9. package/dist/environment/index.js.map +1 -1
  10. package/dist/environment/types.d.ts +33 -75
  11. package/dist/environment/types.d.ts.map +1 -1
  12. package/dist/environment/utils/artifacts.d.ts +1 -1
  13. package/dist/environment/utils/artifacts.d.ts.map +1 -1
  14. package/dist/environment/utils/chains.d.ts +3 -4
  15. package/dist/environment/utils/chains.d.ts.map +1 -1
  16. package/dist/environment/utils/chains.js +82 -16
  17. package/dist/environment/utils/chains.js.map +1 -1
  18. package/dist/executor/index.d.ts +13 -84
  19. package/dist/executor/index.d.ts.map +1 -1
  20. package/dist/executor/index.js +154 -215
  21. package/dist/executor/index.js.map +1 -1
  22. package/dist/executor/setup.test.d.ts +3 -3
  23. package/dist/executor/setup.test.d.ts.map +1 -1
  24. package/dist/executor/setup.test.js +1 -1
  25. package/dist/executor/setup.test.js.map +1 -1
  26. package/dist/executor/types.d.ts +92 -0
  27. package/dist/executor/types.d.ts.map +1 -1
  28. package/dist/index.d.ts +6 -6
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +6 -6
  31. package/dist/index.js.map +1 -1
  32. package/dist/types.d.ts +469 -0
  33. package/dist/types.d.ts.map +1 -0
  34. package/dist/types.js +2 -0
  35. package/dist/types.js.map +1 -0
  36. package/dist/utils/extensions.d.ts +1 -2
  37. package/dist/utils/extensions.d.ts.map +1 -1
  38. package/dist/utils/extensions.test.d.ts +2 -2
  39. package/dist/utils/extensions.test.d.ts.map +1 -1
  40. package/dist/utils/fs.d.ts +1 -1
  41. package/dist/utils/fs.d.ts.map +1 -1
  42. package/dist/utils/fs.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/cli.ts +3 -3
  45. package/src/environment/deployments.ts +1 -1
  46. package/src/environment/index.ts +33 -62
  47. package/src/environment/utils/artifacts.ts +1 -1
  48. package/src/environment/utils/chains.ts +110 -19
  49. package/src/executor/index.ts +205 -340
  50. package/src/executor/setup.test.ts +2 -2
  51. package/src/index.ts +14 -6
  52. package/src/types.ts +597 -0
  53. package/src/utils/extensions.test.ts +1 -1
  54. package/src/utils/extensions.ts +2 -2
  55. package/src/utils/fs.ts +1 -1
  56. package/src/environment/types.ts +0 -380
  57. package/src/executor/types.ts +0 -176
package/src/index.ts CHANGED
@@ -1,7 +1,15 @@
1
- export * from './executor/index.js';
2
- export * from './executor/types.js';
3
- export * from './environment/types.js';
1
+ export {
2
+ setup,
3
+ loadAndExecuteDeployments,
4
+ executeDeployScriptsDirectly,
5
+ readAndResolveConfig,
6
+ enhanceEnvIfNeeded,
7
+ loadEnvironment,
8
+ } from './executor/index.js';
9
+
10
+ export {getChainConfig, allChains} from './environment/utils/chains.js';
11
+ export * from './types.js';
4
12
  export {loadDeployments} from './environment/deployments.js';
5
- export * from './environment/utils/artifacts.js';
6
- export * from './environment/utils/chains.js';
7
- export * from './utils/eth.js';
13
+ export {mergeArtifacts} from './environment/utils/artifacts.js';
14
+ export {getGasPriceEstimate, getRoughGasPriceEstimate} from './utils/eth.js';
15
+ export {bigIntToStringReplacer} from './utils/json.js';
package/src/types.ts ADDED
@@ -0,0 +1,597 @@
1
+ import type {Abi, AbiConstructor, AbiError, AbiEvent, AbiFallback, AbiFunction, AbiReceive, Narrow} from 'abitype';
2
+ import {
3
+ EIP1193Account,
4
+ EIP1193DATA,
5
+ EIP1193ProviderWithoutEvents,
6
+ EIP1193QUANTITY,
7
+ EIP1193SignerProvider,
8
+ EIP1193TransactionReceipt,
9
+ EIP1193WalletProvider,
10
+ } from 'eip-1193';
11
+ import type {Address, Chain, DeployContractParameters} from 'viem';
12
+ import {TransactionHashTracker} from './environment/providers/TransactionHashTracker.js';
13
+ import {ProgressIndicator} from './internal/logging.js';
14
+
15
+ export type DeployScriptFunction<
16
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
17
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
18
+ ArgumentsTypes = undefined,
19
+ Deployments extends UnknownDeployments = UnknownDeployments,
20
+ Extra extends Record<string, unknown> = Record<string, unknown>
21
+ > = (env: Environment<NamedAccounts, Data, Deployments, Extra>, args?: ArgumentsTypes) => Promise<void | boolean>;
22
+
23
+ export interface DeployScriptModule<
24
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
25
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
26
+ ArgumentsTypes = undefined,
27
+ Deployments extends UnknownDeployments = UnknownDeployments,
28
+ Extra extends Record<string, unknown> = Record<string, unknown>
29
+ > {
30
+ (env: Environment<NamedAccounts, Data, Deployments, Extra>, args?: ArgumentsTypes): Promise<void | boolean>;
31
+ tags?: string[];
32
+ dependencies?: string[];
33
+ runAtTheEnd?: boolean;
34
+ id?: string;
35
+ }
36
+
37
+ export type ScriptCallback<
38
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
39
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
40
+ Deployments extends UnknownDeployments = UnknownDeployments,
41
+ Extra extends Record<string, unknown> = Record<string, unknown>
42
+ > = (env: Environment<NamedAccounts, Data, Deployments, Extra>) => Promise<void>;
43
+
44
+ /**
45
+ * Utility type to extract the return value from a higher-order function
46
+ * For functions of type (firstParam: T) => (...args: any[]) => V or (firstParam: T) => V
47
+ */
48
+ export type ExtractReturnFunction<T> = T extends (first: any) => infer Return ? Return : never;
49
+
50
+ /**
51
+ * Utility type to transform an object of higher-order functions by extracting their return types
52
+ * This handles both regular functions and getter functions
53
+ */
54
+ export type CurriedFunctions<T> = {
55
+ [K in keyof T]: ExtractReturnFunction<T[K]>;
56
+ };
57
+
58
+ /**
59
+ * Type for the enhanced environment proxy that includes both the original environment
60
+ * and the curried functions
61
+ */
62
+ export type EnhancedEnvironment<
63
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
64
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
65
+ Deployments extends UnknownDeployments = UnknownDeployments,
66
+ Extensions extends Record<
67
+ string,
68
+ (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any
69
+ > = Record<string, (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any>,
70
+ Extra extends Record<string, unknown> = Record<string, unknown>
71
+ > = Environment<NamedAccounts, Data, Deployments, Extra> & CurriedFunctions<Extensions>;
72
+
73
+ /**
74
+ * Type for a deploy script function that receives an enhanced environment
75
+ */
76
+ export type EnhancedDeployScriptFunction<
77
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
78
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
79
+ ArgumentsTypes = undefined,
80
+ Deployments extends UnknownDeployments = UnknownDeployments,
81
+ Functions extends Record<
82
+ string,
83
+ (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any
84
+ > = Record<string, (env: Environment<NamedAccounts, Data, Deployments>, ...args: any[]) => any>,
85
+ Extra extends Record<string, unknown> = Record<string, unknown>
86
+ > = (
87
+ env: EnhancedEnvironment<NamedAccounts, Data, Deployments, Functions, Extra>,
88
+ args?: ArgumentsTypes
89
+ ) => Promise<void | boolean>;
90
+
91
+ type ChainBlockExplorer = {
92
+ name: string;
93
+ url: string;
94
+ apiUrl?: string | undefined;
95
+ };
96
+ type ChainContract = {
97
+ address: Address;
98
+ blockCreated?: number | undefined;
99
+ };
100
+
101
+ type ChainNativeCurrency = {
102
+ name: string;
103
+ /** 2-6 characters long */
104
+ symbol: string;
105
+ decimals: number;
106
+ };
107
+
108
+ type ChainRpcUrls = {
109
+ http: readonly string[];
110
+ webSocket?: readonly string[] | undefined;
111
+ };
112
+
113
+ /**
114
+ * @description Combines members of an intersection into a readable type.
115
+ *
116
+ * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}
117
+ * @example
118
+ * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>
119
+ * => { a: string, b: string, c: number, d: bigint }
120
+ */
121
+ type Prettify<T> = {
122
+ [K in keyof T]: T[K];
123
+ } & {};
124
+
125
+ export type ChainInfo = {
126
+ /** ID in number form */
127
+ id: number;
128
+ /** Human-readable name */
129
+ name: string;
130
+ /** Collection of block explorers */
131
+ blockExplorers?:
132
+ | {
133
+ [key: string]: ChainBlockExplorer;
134
+ default: ChainBlockExplorer;
135
+ }
136
+ | undefined;
137
+ /** Collection of contracts */
138
+ contracts?:
139
+ | Prettify<
140
+ {
141
+ [key: string]: ChainContract | {[sourceId: number]: ChainContract | undefined} | undefined;
142
+ } & {
143
+ ensRegistry?: ChainContract | undefined;
144
+ ensUniversalResolver?: ChainContract | undefined;
145
+ multicall3?: ChainContract | undefined;
146
+ }
147
+ >
148
+ | undefined;
149
+ /** Currency used by chain */
150
+ nativeCurrency: ChainNativeCurrency;
151
+ /** Collection of RPC endpoints */
152
+ rpcUrls: {
153
+ [key: string]: ChainRpcUrls;
154
+ default: ChainRpcUrls;
155
+ };
156
+ /** Source Chain ID (ie. the L1 chain) */
157
+ sourceId?: number | undefined;
158
+ /** Flag for test networks */
159
+ testnet?: boolean | undefined;
160
+
161
+ chainType: 'zksync' | 'op-stack' | 'celo' | 'default';
162
+
163
+ genesisHash?: string;
164
+
165
+ properties?: Record<string, JSONTypePlusBigInt>;
166
+
167
+ // this will bring in the following when reconstructed from the data above
168
+
169
+ // /** Custom chain data. */
170
+ // custom?: any;
171
+
172
+ // /**
173
+ // * Modifies how chain data structures (ie. Blocks, Transactions, etc)
174
+ // * are formatted & typed.
175
+ // */
176
+ // formatters?: any | undefined;
177
+ // /** Modifies how data (ie. Transactions) is serialized. */
178
+ // serializers?: any | undefined;
179
+ // /** Modifies how fees are derived. */
180
+ // fees?: any | undefined;
181
+ };
182
+
183
+ export type NamedAccountExecuteFunction<
184
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
185
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData
186
+ > = <ArgumentsType = undefined, Deployments extends UnknownDeployments = UnknownDeployments>(
187
+ callback: DeployScriptFunction<NamedAccounts, Data, ArgumentsType, Deployments>,
188
+ options: {tags?: string[]; dependencies?: string[]; id?: string}
189
+ ) => DeployScriptModule<NamedAccounts, Data, ArgumentsType, Deployments>;
190
+
191
+ export interface UntypedRequestArguments {
192
+ readonly method: string;
193
+ readonly params?: readonly unknown[] | object;
194
+ }
195
+ export type UntypedEIP1193Provider = {
196
+ request(requestArguments: UntypedRequestArguments): Promise<unknown>;
197
+ };
198
+
199
+ export type ConfigOverrides = {
200
+ deployments?: string;
201
+ scripts?: string | string[];
202
+ };
203
+
204
+ export type Create2DeterministicDeploymentInfo = {
205
+ factory: `0x${string}`;
206
+ deployer: `0x${string}`;
207
+ funding: string;
208
+ signedTx: `0x${string}`;
209
+ };
210
+
211
+ export type Create3DeterministicDeploymentInfo = {
212
+ salt?: `0x${string}`;
213
+ factory: `0x${string}`;
214
+ bytecode: `0x${string}`;
215
+ proxyBytecode: `0x${string}`;
216
+ };
217
+
218
+ export type DeterministicDeploymentInfo =
219
+ | Create2DeterministicDeploymentInfo
220
+ | {
221
+ create2?: Create2DeterministicDeploymentInfo;
222
+ create3?: Create3DeterministicDeploymentInfo;
223
+ };
224
+
225
+ export type ChainUserConfig = {
226
+ rpcUrl?: string;
227
+ tags?: string[];
228
+ deterministicDeployment?: DeterministicDeploymentInfo;
229
+ info?: ChainInfo;
230
+ pollingInterval?: number;
231
+ properties?: Record<string, JSONTypePlusBigInt>;
232
+ };
233
+
234
+ export type ChainConfig = {
235
+ rpcUrl: string;
236
+ tags: string[];
237
+ deterministicDeployment: DeterministicDeploymentInfo;
238
+ info: ChainInfo;
239
+ pollingInterval: number;
240
+ properties: Record<string, JSONTypePlusBigInt>;
241
+ };
242
+
243
+ export type DeploymentTargetConfig = {
244
+ chainId: number;
245
+ scripts?: string | string[];
246
+ overrides: Omit<ChainUserConfig, 'info'>;
247
+ };
248
+
249
+ export type Chains = {
250
+ [idOrName: number | string]: ChainUserConfig;
251
+ };
252
+
253
+ export type SignerProtocolFunction = (protocolString: string) => Promise<Signer>;
254
+ export type SignerProtocol = {
255
+ getSigner: SignerProtocolFunction;
256
+ };
257
+
258
+ export type UserConfig<
259
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
260
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData
261
+ > = {
262
+ targets?: {[name: string]: DeploymentTargetConfig};
263
+ chains?: Chains;
264
+ deployments?: string;
265
+ scripts?: string | string[];
266
+ accounts?: NamedAccounts;
267
+ data?: Data;
268
+ signerProtocols?: Record<string, SignerProtocolFunction>;
269
+ defaultPollingInterval?: number;
270
+ };
271
+
272
+ export type ResolvedUserConfig<
273
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
274
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData
275
+ > = UserConfig & {
276
+ deployments: string;
277
+ scripts: string[];
278
+ defaultPollingInterval: number;
279
+ };
280
+
281
+ export type ExecutionParams<Extra extends Record<string, unknown> = Record<string, unknown>> = {
282
+ target?: string | {fork: string};
283
+ tags?: string[];
284
+ saveDeployments?: boolean;
285
+ askBeforeProceeding?: boolean;
286
+ reportGasUse?: boolean;
287
+ defaultPollingInterval?: number;
288
+ extra?: Extra;
289
+ logLevel?: number;
290
+ provider?: EIP1193ProviderWithoutEvents;
291
+ config?: ConfigOverrides;
292
+ };
293
+
294
+ export type {Abi, AbiConstructor, AbiError, AbiEvent, AbiFallback, AbiFunction, AbiReceive};
295
+ export type Libraries = {readonly [libraryName: string]: EIP1193Account};
296
+
297
+ export type GasEstimate = 'infinite' | `${number}`;
298
+ export type CreationGasEstimate = {
299
+ readonly codeDepositCost: GasEstimate;
300
+ readonly executionCost: GasEstimate;
301
+ readonly totalCost: GasEstimate;
302
+ };
303
+
304
+ export type GasEstimates = {
305
+ readonly creation?: CreationGasEstimate;
306
+ readonly external?: {
307
+ readonly [signature: string]: GasEstimate;
308
+ };
309
+ readonly internal?: {
310
+ readonly [signature: string]: GasEstimate;
311
+ };
312
+ };
313
+
314
+ export type Storage = {
315
+ readonly astId: number;
316
+ readonly contract: string; // canonical name <path>:<name>
317
+ readonly label: string; // variable name
318
+ readonly offset: number;
319
+ readonly slot: `${number}`; // slot bytes32
320
+ readonly type: string; // "t_mapping(t_uint256,t_struct(Cell)12382_storage)"
321
+ };
322
+ export type TypeDef = {
323
+ readonly encoding: 'inplace' | string; // TODO
324
+ readonly label: 'address' | 'byte24' | string; // TODO
325
+ readonly numberOfBytes: `${number}`;
326
+ readonly key?: string; // ref to another typedef
327
+ readonly value?: string;
328
+ readonly members?: readonly Storage[];
329
+ };
330
+
331
+ export type DevEventDoc = {
332
+ readonly details?: string;
333
+ readonly params?: {readonly [name: string]: string};
334
+ };
335
+
336
+ export type DevErrorDoc = {
337
+ readonly details?: string; // TODO check if it can exists
338
+ readonly params?: {readonly [name: string]: string};
339
+ };
340
+
341
+ export type DevMethodDoc = {
342
+ readonly details?: string; // TODO check if it can exists
343
+ readonly params?: {readonly [name: string]: string};
344
+ readonly returns?: {
345
+ readonly [key: string | `_${number}`]: string; // description
346
+ };
347
+ };
348
+
349
+ export type NoticeUserDoc = {
350
+ readonly notice?: string;
351
+ };
352
+
353
+ export type DevDoc = {
354
+ readonly events?: {
355
+ [signature: string]: DevEventDoc;
356
+ };
357
+ readonly errors?: {
358
+ [signature: string]: readonly DevErrorDoc[];
359
+ };
360
+ readonly methods: {
361
+ [signature: string]: DevMethodDoc;
362
+ };
363
+ readonly kind?: 'dev';
364
+ readonly version?: number;
365
+ readonly title?: string;
366
+ readonly author?: string;
367
+ };
368
+
369
+ export type UserDoc = {
370
+ readonly events?: {
371
+ readonly [signature: string]: NoticeUserDoc;
372
+ };
373
+ readonly errors?: {
374
+ readonly [signature: string]: readonly NoticeUserDoc[];
375
+ };
376
+ readonly kind?: 'user';
377
+ readonly methods: {
378
+ readonly [signature: string]: NoticeUserDoc;
379
+ };
380
+ readonly version?: number;
381
+ readonly notice?: string;
382
+ };
383
+
384
+ export type JSONTypePlusBigInt =
385
+ | bigint
386
+ | string
387
+ | number
388
+ | boolean
389
+ | null
390
+ | JSONTypePlusBigInt[]
391
+ | {[key: string]: JSONTypePlusBigInt};
392
+ export type LinkedData = Record<string, JSONTypePlusBigInt>;
393
+
394
+ export type StorageLayout = {
395
+ readonly storage: readonly Storage[];
396
+ readonly types: {
397
+ readonly [name: string]: TypeDef;
398
+ } | null;
399
+ };
400
+
401
+ export type MinimalDeployment<TAbi extends Abi = Abi> = {
402
+ readonly address: EIP1193Account;
403
+ readonly abi: Narrow<TAbi>;
404
+ };
405
+
406
+ export type Deployment<TAbi extends Abi> = MinimalDeployment<TAbi> & {
407
+ readonly bytecode: EIP1193DATA;
408
+ readonly argsData: EIP1193DATA;
409
+ readonly metadata: string;
410
+
411
+ readonly transaction?: {
412
+ readonly hash: EIP1193DATA;
413
+ readonly origin?: EIP1193Account;
414
+ readonly nonce?: EIP1193DATA;
415
+ };
416
+ readonly receipt?: {
417
+ blockHash: EIP1193DATA;
418
+ blockNumber: EIP1193QUANTITY;
419
+ transactionIndex: EIP1193QUANTITY;
420
+ };
421
+ readonly numDeployments?: number;
422
+ readonly libraries?: Libraries;
423
+ readonly linkedData?: LinkedData;
424
+ readonly deployedBytecode?: EIP1193DATA;
425
+ readonly linkReferences?: any; // TODO
426
+ readonly deployedLinkReferences?: any; // TODO
427
+ readonly contractName?: string;
428
+ readonly sourceName?: string; // relative path
429
+ readonly devdoc?: DevDoc;
430
+ readonly evm?: {
431
+ readonly gasEstimates?: GasEstimates | null;
432
+ } & any;
433
+ readonly storageLayout?: StorageLayout;
434
+ readonly userdoc?: UserDoc;
435
+ } & Record<string, unknown>;
436
+
437
+ export type Artifact<TAbi extends Abi = Abi> = {
438
+ readonly abi: TAbi;
439
+ readonly bytecode: EIP1193DATA;
440
+ readonly metadata: string;
441
+ readonly deployedBytecode?: EIP1193DATA;
442
+ readonly linkReferences?: any; // TODO
443
+ readonly deployedLinkReferences?: any; // TODO
444
+ readonly contractName?: string;
445
+ readonly sourceName?: string; // relative path
446
+ readonly devdoc?: DevDoc;
447
+ readonly evm?: {
448
+ readonly gasEstimates?: GasEstimates | null;
449
+ } & any;
450
+ readonly storageLayout?: StorageLayout;
451
+ readonly userdoc?: UserDoc;
452
+ };
453
+
454
+ export type AccountDefinition = EIP1193Account | string | number;
455
+
456
+ export type AccountType =
457
+ | AccountDefinition
458
+ | {
459
+ [networkOrChainId: string | number]: AccountDefinition;
460
+ };
461
+
462
+ export type ResolvedAccount = {
463
+ address: EIP1193Account;
464
+ } & Signer;
465
+
466
+ export type UnknownDeployments = Record<string, Deployment<Abi>>;
467
+ export type UnknownNamedAccounts = {
468
+ [name: string]: EIP1193Account;
469
+ };
470
+
471
+ export type UnresolvedUnknownNamedAccounts = {
472
+ [name: string]: AccountType;
473
+ };
474
+
475
+ export type ResolvedNamedAccounts<T extends UnresolvedUnknownNamedAccounts> = {
476
+ [Property in keyof T]: EIP1193Account;
477
+ };
478
+
479
+ export type DataType<T> = {
480
+ [networkOrChainId: string | number]: T;
481
+ };
482
+
483
+ export type UnknownData = {
484
+ [name: string]: unknown;
485
+ };
486
+
487
+ export type UnresolvedNetworkSpecificData = {
488
+ [name: string]: DataType<unknown>;
489
+ };
490
+
491
+ export type ResolvedNetworkSpecificData<T extends UnresolvedNetworkSpecificData> = {
492
+ [Property in keyof T]: T[Property] extends DataType<infer U> ? U : never;
493
+ };
494
+
495
+ export type Signer =
496
+ | {type: 'signerOnly'; signer: EIP1193SignerProvider}
497
+ | {type: 'remote'; signer: EIP1193ProviderWithoutEvents}
498
+ | {type: 'wallet'; signer: EIP1193WalletProvider};
499
+
500
+ export type ResolvedNamedSigners<T extends UnknownNamedAccounts> = {
501
+ [Property in keyof T]: Signer;
502
+ };
503
+
504
+ export type UnknownDeploymentsAcrossNetworks = Record<string, UnknownDeployments>;
505
+
506
+ export type ResolvedExecutionParams<Extra extends Record<string, unknown> = Record<string, unknown>> = {
507
+ readonly target: {
508
+ readonly name: string;
509
+ readonly tags: readonly string[];
510
+ readonly fork?: boolean;
511
+ readonly deterministicDeployment: DeterministicDeploymentInfo;
512
+ };
513
+ readonly chain: ChainInfo;
514
+ readonly tags: readonly string[];
515
+ readonly saveDeployments: boolean;
516
+ readonly askBeforeProceeding: boolean;
517
+ readonly reportGasUse: boolean;
518
+ readonly pollingInterval: number;
519
+ readonly extra?: Extra;
520
+ readonly logLevel: number;
521
+ readonly provider: EIP1193ProviderWithoutEvents;
522
+ readonly scripts: readonly string[];
523
+ };
524
+
525
+ export interface Environment<
526
+ NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
527
+ Data extends UnresolvedNetworkSpecificData = UnresolvedNetworkSpecificData,
528
+ Deployments extends UnknownDeployments = UnknownDeployments,
529
+ Extra extends Record<string, unknown> = Record<string, unknown>
530
+ > {
531
+ readonly name: string;
532
+ readonly tags: {readonly [tag: string]: boolean};
533
+ readonly network: {
534
+ readonly chain: Chain;
535
+ readonly provider: TransactionHashTracker;
536
+ readonly fork?: boolean;
537
+ readonly deterministicDeployment: DeterministicDeploymentInfo;
538
+ };
539
+ readonly deployments: Deployments;
540
+ readonly namedAccounts: ResolvedNamedAccounts<NamedAccounts>;
541
+ readonly data: ResolvedNetworkSpecificData<Data>;
542
+ readonly namedSigners: ResolvedNamedSigners<ResolvedNamedAccounts<NamedAccounts>>;
543
+ readonly unnamedAccounts: EIP1193Account[];
544
+ // unnamedSigners: {type: 'remote'; signer: EIP1193ProviderWithoutEvents}[];
545
+ readonly addressSigners: {[name: `0x${string}`]: Signer};
546
+ save<TAbi extends Abi = Abi>(
547
+ name: string,
548
+ deployment: Deployment<TAbi>,
549
+ options?: {doNotCountAsNewDeployment?: boolean}
550
+ ): Promise<Deployment<TAbi>>;
551
+ savePendingDeployment<TAbi extends Abi = Abi>(pendingDeployment: PendingDeployment<TAbi>): Promise<Deployment<TAbi>>;
552
+ savePendingExecution(pendingExecution: PendingExecution): Promise<EIP1193TransactionReceipt>;
553
+ get<TAbi extends Abi>(name: string): Deployment<TAbi>;
554
+ getOrNull<TAbi extends Abi>(name: string): Deployment<TAbi> | null;
555
+ fromAddressToNamedABI<TAbi extends Abi>(address: Address): {mergedABI: TAbi; names: string[]};
556
+ fromAddressToNamedABIOrNull<TAbi extends Abi>(address: Address): {mergedABI: TAbi; names: string[]} | null;
557
+ showMessage(message: string): void;
558
+ showProgress(message?: string): ProgressIndicator;
559
+
560
+ hasMigrationBeenDone(id: string): boolean;
561
+ readonly extra?: Extra;
562
+ }
563
+
564
+ export type DeploymentConstruction<TAbi extends Abi> = Omit<
565
+ DeployContractParameters<TAbi>,
566
+ 'bytecode' | 'account' | 'abi' | 'chain'
567
+ > & {account: string | EIP1193Account; artifact: Artifact<TAbi>};
568
+
569
+ export type PartialDeployment<TAbi extends Abi = Abi> = Artifact<TAbi> & {
570
+ argsData: EIP1193DATA;
571
+ libraries?: Libraries;
572
+ linkedData?: LinkedData;
573
+ };
574
+
575
+ export type PendingDeployment<TAbi extends Abi = Abi> = {
576
+ type: 'deployment';
577
+ name?: string;
578
+ transaction: {
579
+ hash: `0x${string}`;
580
+ nonce?: `0x${string}`;
581
+ origin?: `0x${string}`;
582
+ };
583
+ partialDeployment: PartialDeployment<TAbi>;
584
+ expectedAddress?: `0x${string}`; // TODO we could make that a event specification so we can get address from factory event
585
+ };
586
+
587
+ export type PendingExecution = {
588
+ type: 'execution';
589
+ description?: string;
590
+ transaction: {
591
+ hash: `0x${string}`;
592
+ nonce?: `0x${string}`;
593
+ origin?: `0x${string}`;
594
+ };
595
+ };
596
+
597
+ export type PendingTransaction = PendingDeployment | PendingExecution;
@@ -1,4 +1,4 @@
1
- import type {Environment} from '../environment/types.js';
1
+ import type {Environment} from '../types.js';
2
2
  import {withEnvironment} from './extensions.js';
3
3
 
4
4
  // Mock environment for testing
@@ -3,8 +3,8 @@ import type {
3
3
  UnknownDeployments,
4
4
  UnresolvedNetworkSpecificData,
5
5
  UnresolvedUnknownNamedAccounts,
6
- } from '../environment/types.js';
7
- import {CurriedFunctions} from '../executor/types.js';
6
+ CurriedFunctions,
7
+ } from '../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: string[]): string[] {
27
+ export function traverseMultipleDirectory(dirs: readonly string[]): string[] {
28
28
  const filepaths = [];
29
29
  for (const dir of dirs) {
30
30
  let filesStats = traverse(dir);