rocketh 0.10.9 → 0.10.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.
- package/CHANGELOG.md +12 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{index-DOSnToHV.mjs → index-Cs7zkNfV.mjs} +23 -12
- package/dist/index-Cs7zkNfV.mjs.map +1 -0
- package/dist/{index-BJlVmvtt.cjs → index-t2GbLf0K.cjs} +24 -13
- package/dist/index-t2GbLf0K.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +12 -11
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/environment/index.ts +18 -8
- package/src/environment/types.ts +8 -6
- package/src/executor/index.ts +24 -12
- package/dist/index-BJlVmvtt.cjs.map +0 -1
- package/dist/index-DOSnToHV.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1132,7 +1132,7 @@ type AccountType = AccountDefinition | {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
type ResolvedAccount = {
|
|
1134
1134
|
address: EIP1193Account;
|
|
1135
|
-
} &
|
|
1135
|
+
} & Signer;
|
|
1136
1136
|
type UnknownDeployments = Record<string, Deployment<Abi>>;
|
|
1137
1137
|
type UnknownArtifacts = {
|
|
1138
1138
|
[name: string]: Artifact;
|
|
@@ -1146,7 +1146,7 @@ type UnresolvedUnknownNamedAccounts = {
|
|
|
1146
1146
|
type ResolvedNamedAccounts<T extends UnresolvedUnknownNamedAccounts> = {
|
|
1147
1147
|
[Property in keyof T]: EIP1193Account;
|
|
1148
1148
|
};
|
|
1149
|
-
type
|
|
1149
|
+
type Signer = {
|
|
1150
1150
|
type: 'signerOnly';
|
|
1151
1151
|
signer: EIP1193SignerProvider;
|
|
1152
1152
|
} | {
|
|
@@ -1157,7 +1157,7 @@ type NamedSigner = {
|
|
|
1157
1157
|
signer: EIP1193WalletProvider;
|
|
1158
1158
|
};
|
|
1159
1159
|
type ResolvedNamedSigners<T extends UnknownNamedAccounts> = {
|
|
1160
|
-
[Property in keyof T]:
|
|
1160
|
+
[Property in keyof T]: Signer;
|
|
1161
1161
|
};
|
|
1162
1162
|
type UnknownDeploymentsAcrossNetworks = Record<string, UnknownDeployments>;
|
|
1163
1163
|
type Context<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnknownNamedAccounts = UnknownNamedAccounts> = {
|
|
@@ -1219,10 +1219,11 @@ interface Environment<Artifacts extends UnknownArtifacts = UnknownArtifacts, Nam
|
|
|
1219
1219
|
provider: TransactionHashTracker;
|
|
1220
1220
|
};
|
|
1221
1221
|
deployments: Deployments;
|
|
1222
|
-
|
|
1223
|
-
|
|
1222
|
+
namedAccounts: ResolvedNamedAccounts<NamedAccounts>;
|
|
1223
|
+
namedSigners: ResolvedNamedSigners<ResolvedNamedAccounts<NamedAccounts>>;
|
|
1224
|
+
unnamedAccounts: EIP1193Account[];
|
|
1224
1225
|
addressSigners: {
|
|
1225
|
-
[name: `0x${string}`]:
|
|
1226
|
+
[name: `0x${string}`]: Signer;
|
|
1226
1227
|
};
|
|
1227
1228
|
artifacts: Artifacts;
|
|
1228
1229
|
save<TAbi extends Abi = Abi>(name: string, deployment: Deployment<TAbi>): Promise<Deployment<TAbi>>;
|
|
@@ -1309,13 +1310,13 @@ type ConfigOptions = {
|
|
|
1309
1310
|
declare function readConfig(options: ConfigOptions): Config;
|
|
1310
1311
|
declare function readAndResolveConfig(options: ConfigOptions): ResolvedConfig;
|
|
1311
1312
|
declare function resolveConfig(config: Config): ResolvedConfig;
|
|
1312
|
-
declare function loadEnvironment<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts>(options: ConfigOptions, context: ProvidedContext<Artifacts, NamedAccounts>): Promise<Environment
|
|
1313
|
-
declare function loadAndExecuteDeployments<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts, ArgumentsType = undefined
|
|
1314
|
-
declare function executeDeployScripts<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts, ArgumentsType = undefined
|
|
1313
|
+
declare function loadEnvironment<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts>(options: ConfigOptions, context: ProvidedContext<Artifacts, NamedAccounts>): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>>;
|
|
1314
|
+
declare function loadAndExecuteDeployments<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts, ArgumentsType = undefined>(options: ConfigOptions, context?: ProvidedContext<Artifacts, NamedAccounts>, args?: ArgumentsType): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>>;
|
|
1315
|
+
declare function executeDeployScripts<Artifacts extends UnknownArtifacts = UnknownArtifacts, NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts, ArgumentsType = undefined>(config: ResolvedConfig, context?: ProvidedContext<Artifacts, NamedAccounts>, args?: ArgumentsType): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>>;
|
|
1315
1316
|
|
|
1316
1317
|
type EnvironmentExtenstion = (env: Environment) => Environment;
|
|
1317
1318
|
declare function extendEnvironment(extension: EnvironmentExtenstion): void;
|
|
1318
|
-
type SignerProtocolFunction = (protocolString: string) => Promise<
|
|
1319
|
+
type SignerProtocolFunction = (protocolString: string) => Promise<Signer>;
|
|
1319
1320
|
declare function handleSignerProtocol(protocol: string, getSigner: SignerProtocolFunction): void;
|
|
1320
1321
|
|
|
1321
1322
|
declare function loadDeployments(deploymentsPath: string, networkName: string, onlyABIAndAddress?: boolean, expectedChain?: {
|
|
@@ -1380,4 +1381,4 @@ type RoughEstimateGasPriceResult = {
|
|
|
1380
1381
|
declare function getGasPriceEstimate(provider: EIP1193ProviderWithoutEvents, options?: Partial<EstimateGasPriceOptions>): Promise<EstimateGasPriceResult>;
|
|
1381
1382
|
declare function getRoughGasPriceEstimate(provider: EIP1193ProviderWithoutEvents, options?: Partial<RoughEstimateGasPriceOptions>): Promise<RoughEstimateGasPriceResult>;
|
|
1382
1383
|
|
|
1383
|
-
export { type Abi, type AbiConstructor, type AbiError, type AbiEvent, type AbiFallback, type AbiFunction, type AbiReceive, type AccountDefinition, type AccountType, type Artifact, type ChainType, type Config, type ConfigOptions, type Context, type CreationGasEstimate, type DeployScriptFunction, type DeployScriptModule, type Deployment, type DeploymentConstruction, type DevDoc, type DevErrorDoc, type DevEventDoc, type DevMethodDoc, type Environment, type EstimateGasPriceOptions, type EstimateGasPriceResult, type GasEstimate, type GasEstimates, type GasPrice, type Libraries, type
|
|
1384
|
+
export { type Abi, type AbiConstructor, type AbiError, type AbiEvent, type AbiFallback, type AbiFunction, type AbiReceive, type AccountDefinition, type AccountType, type Artifact, type ChainType, type Config, type ConfigOptions, type Context, type CreationGasEstimate, type DeployScriptFunction, type DeployScriptModule, type Deployment, type DeploymentConstruction, type DevDoc, type DevErrorDoc, type DevEventDoc, type DevMethodDoc, type Environment, type EstimateGasPriceOptions, type EstimateGasPriceResult, type GasEstimate, type GasEstimates, type GasPrice, type Libraries, type NetworkConfig, type NoticeUserDoc, type PartialDeployment, type PendingDeployment, type PendingExecution, type PendingTransaction, type ProvidedContext, type ResolvedAccount, type ResolvedConfig, type ResolvedNamedAccounts, type ResolvedNamedSigners, type RoughEstimateGasPriceOptions, type RoughEstimateGasPriceResult, type ScriptCallback, type Signer, type Storage, type StorageLayout, type TypeDef, type UnknownArtifacts, type UnknownDeployments, type UnknownDeploymentsAcrossNetworks, type UnknownNamedAccounts, type UnresolvedUnknownNamedAccounts, type UserDoc, chainById, chainTypes, execute, executeDeployScripts, extendEnvironment, getChain, getGasPriceEstimate, getRoughGasPriceEstimate, handleSignerProtocol, loadAndExecuteDeployments, loadDeployments, loadEnvironment, mergeArtifacts, readAndResolveConfig, readConfig, resolveConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { j as chainById, i as chainTypes, a as execute, g as executeDeployScripts, e as extendEnvironment, k as getChain, n as getGasPriceEstimate, o as getRoughGasPriceEstimate, h as handleSignerProtocol, f as loadAndExecuteDeployments, l as loadDeployments, d as loadEnvironment, m as mergeArtifacts, b as readAndResolveConfig, r as readConfig, c as resolveConfig } from './index-
|
|
1
|
+
export { j as chainById, i as chainTypes, a as execute, g as executeDeployScripts, e as extendEnvironment, k as getChain, n as getGasPriceEstimate, o as getRoughGasPriceEstimate, h as handleSignerProtocol, f as loadAndExecuteDeployments, l as loadDeployments, d as loadEnvironment, m as mergeArtifacts, b as readAndResolveConfig, r as readConfig, c as resolveConfig } from './index-Cs7zkNfV.mjs';
|
|
2
2
|
import 'module';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:path';
|
package/package.json
CHANGED
package/src/environment/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Artifact,
|
|
8
8
|
Deployment,
|
|
9
9
|
Environment,
|
|
10
|
-
|
|
10
|
+
Signer,
|
|
11
11
|
PendingDeployment,
|
|
12
12
|
PendingTransaction,
|
|
13
13
|
ResolvedAccount,
|
|
@@ -48,7 +48,7 @@ export function extendEnvironment(extension: EnvironmentExtenstion): void {
|
|
|
48
48
|
(globalThis as any).extensions.push(extension);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export type SignerProtocolFunction = (protocolString: string) => Promise<
|
|
51
|
+
export type SignerProtocolFunction = (protocolString: string) => Promise<Signer>;
|
|
52
52
|
export type SignerProtocol = {
|
|
53
53
|
getSigner: SignerProtocolFunction;
|
|
54
54
|
};
|
|
@@ -133,7 +133,9 @@ export async function createEnvironment<
|
|
|
133
133
|
|
|
134
134
|
const resolvedAccounts: {[name: string]: ResolvedAccount} = {};
|
|
135
135
|
|
|
136
|
+
const allRemoteAccounts = await provider.request({method: 'eth_accounts'});
|
|
136
137
|
const accountCache: {[name: string]: ResolvedAccount} = {};
|
|
138
|
+
|
|
137
139
|
async function getAccount(
|
|
138
140
|
name: string,
|
|
139
141
|
accounts: UnresolvedUnknownNamedAccounts,
|
|
@@ -144,8 +146,7 @@ export async function createEnvironment<
|
|
|
144
146
|
}
|
|
145
147
|
let account: ResolvedAccount | undefined;
|
|
146
148
|
if (typeof accountDef === 'number') {
|
|
147
|
-
const
|
|
148
|
-
const accountPerIndex = accounts[accountDef];
|
|
149
|
+
const accountPerIndex = allRemoteAccounts[accountDef];
|
|
149
150
|
if (accountPerIndex) {
|
|
150
151
|
accountCache[name] = account = {
|
|
151
152
|
type: 'remote',
|
|
@@ -240,8 +241,8 @@ export async function createEnvironment<
|
|
|
240
241
|
);
|
|
241
242
|
|
|
242
243
|
const namedAccounts: {[name: string]: EIP1193Account} = {};
|
|
243
|
-
const namedSigners: {[name: string]:
|
|
244
|
-
const addressSigners: {[name: `0x${string}`]:
|
|
244
|
+
const namedSigners: {[name: string]: Signer} = {};
|
|
245
|
+
const addressSigners: {[name: `0x${string}`]: Signer} = {};
|
|
245
246
|
|
|
246
247
|
for (const entry of Object.entries(resolvedAccounts)) {
|
|
247
248
|
const name = entry[0];
|
|
@@ -251,11 +252,20 @@ export async function createEnvironment<
|
|
|
251
252
|
namedSigners[name] = namedSigner;
|
|
252
253
|
}
|
|
253
254
|
|
|
255
|
+
const unnamedAccounts = allRemoteAccounts.filter((v) => !addressSigners[v]);
|
|
256
|
+
for (const account of unnamedAccounts) {
|
|
257
|
+
addressSigners[account] = {
|
|
258
|
+
type: 'remote',
|
|
259
|
+
signer: provider,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
254
263
|
const perliminaryEnvironment = {
|
|
255
264
|
config,
|
|
256
265
|
deployments: deployments as Deployments,
|
|
257
|
-
|
|
258
|
-
|
|
266
|
+
namedAccounts: namedAccounts as ResolvedNamedAccounts<NamedAccounts>,
|
|
267
|
+
namedSigners: namedSigners as ResolvedNamedSigners<ResolvedNamedAccounts<NamedAccounts>>,
|
|
268
|
+
unnamedAccounts,
|
|
259
269
|
addressSigners: addressSigners,
|
|
260
270
|
artifacts: context.artifacts,
|
|
261
271
|
network: {
|
package/src/environment/types.ts
CHANGED
|
@@ -170,7 +170,7 @@ export type AccountType =
|
|
|
170
170
|
|
|
171
171
|
export type ResolvedAccount = {
|
|
172
172
|
address: EIP1193Account;
|
|
173
|
-
} &
|
|
173
|
+
} & Signer;
|
|
174
174
|
|
|
175
175
|
export type UnknownDeployments = Record<string, Deployment<Abi>>;
|
|
176
176
|
export type UnknownArtifacts = {[name: string]: Artifact};
|
|
@@ -186,13 +186,13 @@ export type ResolvedNamedAccounts<T extends UnresolvedUnknownNamedAccounts> = {
|
|
|
186
186
|
[Property in keyof T]: EIP1193Account;
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
-
export type
|
|
189
|
+
export type Signer =
|
|
190
190
|
| {type: 'signerOnly'; signer: EIP1193SignerProvider}
|
|
191
191
|
| {type: 'remote'; signer: EIP1193ProviderWithoutEvents}
|
|
192
192
|
| {type: 'wallet'; signer: EIP1193WalletProvider};
|
|
193
193
|
|
|
194
194
|
export type ResolvedNamedSigners<T extends UnknownNamedAccounts> = {
|
|
195
|
-
[Property in keyof T]:
|
|
195
|
+
[Property in keyof T]: Signer;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
export type UnknownDeploymentsAcrossNetworks = Record<string, UnknownDeployments>;
|
|
@@ -268,9 +268,11 @@ export interface Environment<
|
|
|
268
268
|
provider: TransactionHashTracker;
|
|
269
269
|
};
|
|
270
270
|
deployments: Deployments;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
namedAccounts: ResolvedNamedAccounts<NamedAccounts>;
|
|
272
|
+
namedSigners: ResolvedNamedSigners<ResolvedNamedAccounts<NamedAccounts>>;
|
|
273
|
+
unnamedAccounts: EIP1193Account[];
|
|
274
|
+
// unnamedSigners: {type: 'remote'; signer: EIP1193ProviderWithoutEvents}[];
|
|
275
|
+
addressSigners: {[name: `0x${string}`]: Signer};
|
|
274
276
|
artifacts: Artifacts;
|
|
275
277
|
save<TAbi extends Abi = Abi>(name: string, deployment: Deployment<TAbi>): Promise<Deployment<TAbi>>;
|
|
276
278
|
savePendingDeployment<TAbi extends Abi = Abi>(pendingDeployment: PendingDeployment<TAbi>): Promise<Deployment<TAbi>>;
|
package/src/executor/index.ts
CHANGED
|
@@ -174,7 +174,10 @@ export function resolveConfig(config: Config): ResolvedConfig {
|
|
|
174
174
|
export async function loadEnvironment<
|
|
175
175
|
Artifacts extends UnknownArtifacts = UnknownArtifacts,
|
|
176
176
|
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts
|
|
177
|
-
>(
|
|
177
|
+
>(
|
|
178
|
+
options: ConfigOptions,
|
|
179
|
+
context: ProvidedContext<Artifacts, NamedAccounts>
|
|
180
|
+
): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>> {
|
|
178
181
|
const resolvedConfig = readAndResolveConfig(options);
|
|
179
182
|
const {external, internal} = await createEnvironment(resolvedConfig, context);
|
|
180
183
|
return external;
|
|
@@ -183,21 +186,27 @@ export async function loadEnvironment<
|
|
|
183
186
|
export async function loadAndExecuteDeployments<
|
|
184
187
|
Artifacts extends UnknownArtifacts = UnknownArtifacts,
|
|
185
188
|
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
186
|
-
ArgumentsType = undefined
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
ArgumentsType = undefined
|
|
190
|
+
>(
|
|
191
|
+
options: ConfigOptions,
|
|
192
|
+
context?: ProvidedContext<Artifacts, NamedAccounts>,
|
|
193
|
+
args?: ArgumentsType
|
|
194
|
+
): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>> {
|
|
189
195
|
const resolvedConfig = readAndResolveConfig(options);
|
|
190
196
|
// console.log(JSON.stringify(options, null, 2));
|
|
191
197
|
// console.log(JSON.stringify(resolvedConfig, null, 2));
|
|
192
|
-
return executeDeployScripts<Artifacts, NamedAccounts, ArgumentsType
|
|
198
|
+
return executeDeployScripts<Artifacts, NamedAccounts, ArgumentsType>(resolvedConfig, context, args);
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
export async function executeDeployScripts<
|
|
196
202
|
Artifacts extends UnknownArtifacts = UnknownArtifacts,
|
|
197
203
|
NamedAccounts extends UnresolvedUnknownNamedAccounts = UnresolvedUnknownNamedAccounts,
|
|
198
|
-
ArgumentsType = undefined
|
|
199
|
-
|
|
200
|
-
|
|
204
|
+
ArgumentsType = undefined
|
|
205
|
+
>(
|
|
206
|
+
config: ResolvedConfig,
|
|
207
|
+
context?: ProvidedContext<Artifacts, NamedAccounts>,
|
|
208
|
+
args?: ArgumentsType
|
|
209
|
+
): Promise<Environment<Artifacts, NamedAccounts, UnknownDeployments>> {
|
|
201
210
|
setLogLevel(typeof config.logLevel === 'undefined' ? 0 : config.logLevel);
|
|
202
211
|
|
|
203
212
|
let filepaths;
|
|
@@ -214,7 +223,8 @@ export async function executeDeployScripts<
|
|
|
214
223
|
return 0;
|
|
215
224
|
});
|
|
216
225
|
|
|
217
|
-
let providedContext: ProvidedContext<Artifacts, NamedAccounts> | undefined;
|
|
226
|
+
let providedContext: ProvidedContext<Artifacts, NamedAccounts> | undefined = context;
|
|
227
|
+
const providedFromArguments = !!providedContext;
|
|
218
228
|
|
|
219
229
|
const scriptModuleByFilePath: {[filename: string]: DeployScriptModule<Artifacts, NamedAccounts, ArgumentsType>} = {};
|
|
220
230
|
const scriptPathBags: {[tag: string]: string[]} = {};
|
|
@@ -237,10 +247,12 @@ export async function executeDeployScripts<
|
|
|
237
247
|
}
|
|
238
248
|
}
|
|
239
249
|
scriptModuleByFilePath[scriptFilePath] = scriptModule;
|
|
240
|
-
if (
|
|
241
|
-
|
|
250
|
+
if (!providedFromArguments) {
|
|
251
|
+
if (providedContext && providedContext !== scriptModule.providedContext) {
|
|
252
|
+
throw new Error(`context between 2 scripts is different, please share the same across them`);
|
|
253
|
+
}
|
|
254
|
+
providedContext = scriptModule.providedContext as ProvidedContext<Artifacts, NamedAccounts>;
|
|
242
255
|
}
|
|
243
|
-
providedContext = scriptModule.providedContext as ProvidedContext<Artifacts, NamedAccounts>;
|
|
244
256
|
} catch (e) {
|
|
245
257
|
logger.error(`could not import ${filepath}`);
|
|
246
258
|
throw e;
|