rocketh 0.10.15 → 0.10.16
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 +6 -0
- package/dist/esm/cli.d.ts +3 -0
- package/dist/esm/cli.d.ts.map +1 -0
- package/dist/esm/cli.js +31 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/environment/deployments.d.ts +11 -0
- package/dist/esm/environment/deployments.d.ts.map +1 -0
- package/dist/esm/environment/deployments.js +90 -0
- package/dist/esm/environment/deployments.js.map +1 -0
- package/dist/esm/environment/index.d.ts +15 -0
- package/dist/esm/environment/index.d.ts.map +1 -0
- package/dist/esm/environment/index.js +566 -0
- package/dist/esm/environment/index.js.map +1 -0
- package/dist/esm/environment/providers/BaseProvider.d.ts +53 -0
- package/dist/esm/environment/providers/BaseProvider.d.ts.map +1 -0
- package/dist/esm/environment/providers/BaseProvider.js +10 -0
- package/dist/esm/environment/providers/BaseProvider.js.map +1 -0
- package/dist/esm/environment/providers/TransactionHashTracker.d.ts +8 -0
- package/dist/esm/environment/providers/TransactionHashTracker.d.ts.map +1 -0
- package/dist/esm/environment/providers/TransactionHashTracker.js +22 -0
- package/dist/esm/environment/providers/TransactionHashTracker.js.map +1 -0
- package/dist/esm/environment/types.d.ts +294 -0
- package/dist/esm/environment/types.d.ts.map +1 -0
- package/dist/esm/environment/types.js +2 -0
- package/dist/esm/environment/types.js.map +1 -0
- package/dist/esm/environment/utils/artifacts.d.ts +23 -0
- package/dist/esm/environment/utils/artifacts.d.ts.map +1 -0
- package/dist/esm/environment/utils/artifacts.js +142 -0
- package/dist/esm/environment/utils/artifacts.js.map +1 -0
- package/dist/esm/environment/utils/chains.d.ts +10 -0
- package/dist/esm/environment/utils/chains.d.ts.map +1 -0
- package/dist/esm/environment/utils/chains.js +55 -0
- package/dist/esm/environment/utils/chains.js.map +1 -0
- package/dist/esm/executor/index.d.ts +28 -0
- package/dist/esm/executor/index.d.ts.map +1 -0
- package/dist/esm/executor/index.js +354 -0
- package/dist/esm/executor/index.js.map +1 -0
- package/dist/esm/executor/types.d.ts +17 -0
- package/dist/esm/executor/types.d.ts.map +1 -0
- package/dist/esm/executor/types.js +2 -0
- package/dist/esm/executor/types.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/logging.d.ts +11 -0
- package/dist/esm/internal/logging.d.ts.map +1 -0
- package/dist/esm/internal/logging.js +71 -0
- package/dist/esm/internal/logging.js.map +1 -0
- package/dist/esm/internal/types.d.ts +5 -0
- package/dist/esm/internal/types.d.ts.map +1 -0
- package/dist/esm/internal/types.js +2 -0
- package/dist/esm/internal/types.js.map +1 -0
- package/dist/esm/utils/eth.d.ts +24 -0
- package/dist/esm/utils/eth.d.ts.map +1 -0
- package/dist/esm/utils/eth.js +62 -0
- package/dist/esm/utils/eth.js.map +1 -0
- package/dist/esm/utils/fs.d.ts +16 -0
- package/dist/esm/utils/fs.d.ts.map +1 -0
- package/dist/esm/utils/fs.js +52 -0
- package/dist/esm/utils/fs.js.map +1 -0
- package/dist/esm/utils/json.d.ts +5 -0
- package/dist/esm/utils/json.d.ts.map +1 -0
- package/dist/esm/utils/json.js +22 -0
- package/dist/esm/utils/json.js.map +1 -0
- package/package.json +10 -16
- package/src/cli.ts +2 -2
- package/src/environment/deployments.ts +2 -2
- package/src/environment/index.ts +10 -10
- package/src/environment/providers/TransactionHashTracker.ts +1 -1
- package/src/environment/types.ts +2 -2
- package/src/environment/utils/artifacts.ts +1 -1
- package/src/executor/index.ts +8 -14
- package/src/executor/types.ts +1 -1
- package/src/index.ts +8 -8
- package/tsconfig.json +13 -10
- package/dist/cli.cjs +0 -100
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.mjs +0 -97
- package/dist/cli.mjs.map +0 -1
- package/dist/index-CqGGHs42.cjs +0 -1317
- package/dist/index-CqGGHs42.cjs.map +0 -1
- package/dist/index-DESow-6-.mjs +0 -1299
- package/dist/index-DESow-6-.mjs.map +0 -1
- package/dist/index.cjs +0 -33
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -1442
- package/dist/index.mjs +0 -12
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { createPublicClient, custom } from 'viem';
|
|
3
|
+
import { JSONRPCHTTPProvider } from 'eip-1193-jsonrpc-provider';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { JSONToString, stringToJSON } from '../utils/json.js';
|
|
6
|
+
import { loadDeployments } from './deployments.js';
|
|
7
|
+
import { log, spin } from '../internal/logging.js';
|
|
8
|
+
import { getChain } from './utils/chains.js';
|
|
9
|
+
import { mergeArtifacts } from './utils/artifacts.js';
|
|
10
|
+
import { TransactionHashTracker } from './providers/TransactionHashTracker.js';
|
|
11
|
+
//we store this globally so this is not lost
|
|
12
|
+
globalThis.extensions = [];
|
|
13
|
+
export function extendEnvironment(extension) {
|
|
14
|
+
globalThis.extensions.push(extension);
|
|
15
|
+
}
|
|
16
|
+
//we store this globally so this is not lost
|
|
17
|
+
globalThis.signerProtocols = {};
|
|
18
|
+
export function handleSignerProtocol(protocol, getSigner) {
|
|
19
|
+
globalThis.signerProtocols[protocol] = {
|
|
20
|
+
getSigner,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function wait(numSeconds) {
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
setTimeout(resolve, numSeconds * 1000);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function displayTransaction(transaction) {
|
|
29
|
+
if (transaction.type === '0x2') {
|
|
30
|
+
return `(maxFeePerGas: ${BigInt(transaction.maxFeePerGas).toString()}, maxPriorityFeePerGas: ${BigInt(transaction.maxPriorityFeePerGas).toString()})`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return `(gasPrice: ${BigInt(transaction.gasPrice).toString()})`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export async function createEnvironment(config, providedContext) {
|
|
37
|
+
const rawProvider = 'provider' in config.network
|
|
38
|
+
? config.network.provider
|
|
39
|
+
: new JSONRPCHTTPProvider(config.network.nodeUrl);
|
|
40
|
+
const provider = new TransactionHashTracker(rawProvider);
|
|
41
|
+
const transport = custom(provider);
|
|
42
|
+
const viemClient = createPublicClient({ transport });
|
|
43
|
+
const chainId = (await viemClient.getChainId()).toString();
|
|
44
|
+
let genesisHash;
|
|
45
|
+
try {
|
|
46
|
+
genesisHash = (await viemClient.getBlock({ blockTag: 'earliest' })).hash;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error(`failed to get genesis hash`);
|
|
50
|
+
}
|
|
51
|
+
let networkName;
|
|
52
|
+
let saveDeployments;
|
|
53
|
+
let networkTags = {};
|
|
54
|
+
for (const networkTag of config.network.tags) {
|
|
55
|
+
networkTags[networkTag] = true;
|
|
56
|
+
}
|
|
57
|
+
if ('nodeUrl' in config) {
|
|
58
|
+
networkName = config.network.name;
|
|
59
|
+
saveDeployments = true;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (config.network.name) {
|
|
63
|
+
networkName = config.network.name;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
networkName = 'memory';
|
|
67
|
+
}
|
|
68
|
+
if (networkName === 'memory' || networkName === 'hardhat') {
|
|
69
|
+
networkTags['memory'] = true;
|
|
70
|
+
saveDeployments = false;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
saveDeployments = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (config.saveDeployments !== undefined) {
|
|
77
|
+
saveDeployments = config.saveDeployments;
|
|
78
|
+
}
|
|
79
|
+
const resolvedAccounts = {};
|
|
80
|
+
const allRemoteAccounts = await provider.request({ method: 'eth_accounts' });
|
|
81
|
+
const accountCache = {};
|
|
82
|
+
async function getAccount(name, accounts, accountDef) {
|
|
83
|
+
if (accountCache[name]) {
|
|
84
|
+
return accountCache[name];
|
|
85
|
+
}
|
|
86
|
+
let account;
|
|
87
|
+
if (typeof accountDef === 'number') {
|
|
88
|
+
const accountPerIndex = allRemoteAccounts[accountDef];
|
|
89
|
+
if (accountPerIndex) {
|
|
90
|
+
accountCache[name] = account = {
|
|
91
|
+
type: 'remote',
|
|
92
|
+
address: accountPerIndex,
|
|
93
|
+
signer: provider,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (typeof accountDef === 'string') {
|
|
98
|
+
if (accountDef.startsWith('0x')) {
|
|
99
|
+
if (accountDef.length === 66) {
|
|
100
|
+
const privateKeyProtocol = globalThis.signerProtocols['privateKey'];
|
|
101
|
+
if (privateKeyProtocol) {
|
|
102
|
+
const namedSigner = await privateKeyProtocol.getSigner(`privateKey:${accountDef}`);
|
|
103
|
+
const [address] = await namedSigner.signer.request({ method: 'eth_accounts' });
|
|
104
|
+
accountCache[name] = account = {
|
|
105
|
+
...namedSigner,
|
|
106
|
+
address,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
accountCache[name] = account = {
|
|
112
|
+
type: 'remote',
|
|
113
|
+
address: accountDef,
|
|
114
|
+
signer: provider,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
if (accountDef.indexOf(':') > 0) {
|
|
120
|
+
const [protocolID, extra] = accountDef.split(':');
|
|
121
|
+
const protocol = globalThis.signerProtocols[protocolID];
|
|
122
|
+
if (!protocol) {
|
|
123
|
+
throw new Error(`protocol: ${protocol} is not supported`);
|
|
124
|
+
}
|
|
125
|
+
const namedSigner = await protocol.getSigner(accountDef);
|
|
126
|
+
const [address] = await namedSigner.signer.request({ method: 'eth_accounts' });
|
|
127
|
+
accountCache[name] = account = {
|
|
128
|
+
...namedSigner,
|
|
129
|
+
address,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const accountFetched = await getAccount(name, accounts, accounts[accountDef]);
|
|
134
|
+
if (accountFetched) {
|
|
135
|
+
accountCache[name] = account = accountFetched;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
const accountForNetwork = accountDef[networkName] || accountDef[chainId] || accountDef['default'];
|
|
142
|
+
if (typeof accountForNetwork !== undefined) {
|
|
143
|
+
const accountFetched = await getAccount(name, accounts, accountForNetwork);
|
|
144
|
+
if (accountFetched) {
|
|
145
|
+
accountCache[name] = account = accountFetched;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return account;
|
|
150
|
+
}
|
|
151
|
+
if (providedContext.accounts) {
|
|
152
|
+
const accountNames = Object.keys(providedContext.accounts);
|
|
153
|
+
for (const accountName of accountNames) {
|
|
154
|
+
let account = await getAccount(accountName, providedContext.accounts, providedContext.accounts[accountName]);
|
|
155
|
+
resolvedAccounts[accountName] = account;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const context = {
|
|
159
|
+
accounts: resolvedAccounts,
|
|
160
|
+
artifacts: providedContext.artifacts,
|
|
161
|
+
network: {
|
|
162
|
+
name: networkName,
|
|
163
|
+
fork: config.network.fork,
|
|
164
|
+
saveDeployments,
|
|
165
|
+
tags: networkTags,
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
// console.log(`context`, JSON.stringify(context.network, null, 2));
|
|
169
|
+
const { deployments } = loadDeployments(config.deployments, context.network.name, false, context.network.fork
|
|
170
|
+
? undefined
|
|
171
|
+
: {
|
|
172
|
+
chainId,
|
|
173
|
+
genesisHash,
|
|
174
|
+
deleteDeploymentsIfDifferentGenesisHash: true,
|
|
175
|
+
});
|
|
176
|
+
const namedAccounts = {};
|
|
177
|
+
const namedSigners = {};
|
|
178
|
+
const addressSigners = {};
|
|
179
|
+
for (const entry of Object.entries(resolvedAccounts)) {
|
|
180
|
+
const name = entry[0];
|
|
181
|
+
const { address, ...namedSigner } = entry[1];
|
|
182
|
+
namedAccounts[name] = address;
|
|
183
|
+
addressSigners[address] = namedSigner;
|
|
184
|
+
namedSigners[name] = namedSigner;
|
|
185
|
+
}
|
|
186
|
+
const unnamedAccounts = allRemoteAccounts.filter((v) => !addressSigners[v]);
|
|
187
|
+
for (const account of unnamedAccounts) {
|
|
188
|
+
addressSigners[account] = {
|
|
189
|
+
type: 'remote',
|
|
190
|
+
signer: provider,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
const perliminaryEnvironment = {
|
|
194
|
+
config,
|
|
195
|
+
deployments: deployments,
|
|
196
|
+
namedAccounts: namedAccounts,
|
|
197
|
+
namedSigners: namedSigners,
|
|
198
|
+
unnamedAccounts,
|
|
199
|
+
addressSigners: addressSigners,
|
|
200
|
+
artifacts: context.artifacts,
|
|
201
|
+
network: {
|
|
202
|
+
chain: getChain(chainId),
|
|
203
|
+
name: context.network.name,
|
|
204
|
+
tags: context.network.tags,
|
|
205
|
+
provider,
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
function ensureDeploymentFolder() {
|
|
209
|
+
const folderPath = path.join(config.deployments, context.network.name);
|
|
210
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
211
|
+
// const chainIdFilepath = path.join(folderPath, '.chainId');
|
|
212
|
+
// if (!fs.existsSync(chainIdFilepath)) {
|
|
213
|
+
// fs.writeFileSync(chainIdFilepath, chainId);
|
|
214
|
+
// }
|
|
215
|
+
const chainFilepath = path.join(folderPath, '.chain');
|
|
216
|
+
if (!fs.existsSync(chainFilepath)) {
|
|
217
|
+
fs.writeFileSync(chainFilepath, JSON.stringify({ chainId, genesisHash }));
|
|
218
|
+
}
|
|
219
|
+
return folderPath;
|
|
220
|
+
}
|
|
221
|
+
// const signer = {
|
|
222
|
+
// async sendTransaction(
|
|
223
|
+
// provider: EIP1193ProviderWithoutEvents,
|
|
224
|
+
// account: {
|
|
225
|
+
// addresss: EIP1193Account;
|
|
226
|
+
// config: unknown;
|
|
227
|
+
// },
|
|
228
|
+
// transaction: EIP1193TransactionEIP1193DATA
|
|
229
|
+
// ): Promise<EIP1193DATA> {
|
|
230
|
+
// return '0x';
|
|
231
|
+
// },
|
|
232
|
+
// };
|
|
233
|
+
// async function sendTransaction(transaction: EIP1193TransactionEIP1193DATA): Promise<EIP1193DATA> {
|
|
234
|
+
// return '0x';
|
|
235
|
+
// }
|
|
236
|
+
function get(name) {
|
|
237
|
+
const deployment = deployments[name];
|
|
238
|
+
if (!deployment) {
|
|
239
|
+
throw new Error(`no deployment named "${name}" found.`);
|
|
240
|
+
}
|
|
241
|
+
return deployment;
|
|
242
|
+
}
|
|
243
|
+
function getOrNull(name) {
|
|
244
|
+
return (deployments[name] || null);
|
|
245
|
+
}
|
|
246
|
+
function fromAddressToNamedABIOrNull(address) {
|
|
247
|
+
let list = [];
|
|
248
|
+
for (const name of Object.keys(deployments)) {
|
|
249
|
+
const deployment = deployments[name];
|
|
250
|
+
if (deployment.address.toLowerCase() == address.toLowerCase()) {
|
|
251
|
+
list.push({ name, artifact: deployment });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (list.length === 0) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
const { mergedABI } = mergeArtifacts(list);
|
|
258
|
+
return {
|
|
259
|
+
mergedABI: mergedABI,
|
|
260
|
+
names: list.map((v) => v.name),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function fromAddressToNamedABI(address) {
|
|
264
|
+
const n = fromAddressToNamedABIOrNull(address);
|
|
265
|
+
if (!n) {
|
|
266
|
+
throw new Error(`could not find artifact for address ${address}`);
|
|
267
|
+
}
|
|
268
|
+
return n;
|
|
269
|
+
}
|
|
270
|
+
async function save(name, deployment) {
|
|
271
|
+
deployments[name] = deployment;
|
|
272
|
+
if (context.network.saveDeployments) {
|
|
273
|
+
const folderPath = ensureDeploymentFolder();
|
|
274
|
+
fs.writeFileSync(`${folderPath}/${name}.json`, JSONToString(deployment, 2));
|
|
275
|
+
}
|
|
276
|
+
return deployment;
|
|
277
|
+
}
|
|
278
|
+
async function recoverTransactionsIfAny() {
|
|
279
|
+
if (!context.network.saveDeployments) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const folderPath = ensureDeploymentFolder();
|
|
283
|
+
const filepath = path.join(folderPath, '.pending_transactions.json');
|
|
284
|
+
let existingPendingTansactions;
|
|
285
|
+
try {
|
|
286
|
+
existingPendingTansactions = stringToJSON(fs.readFileSync(filepath, 'utf-8'));
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
existingPendingTansactions = [];
|
|
290
|
+
}
|
|
291
|
+
if (existingPendingTansactions.length > 0) {
|
|
292
|
+
while (existingPendingTansactions.length > 0) {
|
|
293
|
+
const pendingTransaction = existingPendingTansactions.shift();
|
|
294
|
+
if (pendingTransaction) {
|
|
295
|
+
if (pendingTransaction.type === 'deployment') {
|
|
296
|
+
const spinner = spin(`recovering ${pendingTransaction.name} with transaction ${pendingTransaction.transaction.hash}`);
|
|
297
|
+
try {
|
|
298
|
+
await waitForDeploymentTransactionAndSave(pendingTransaction);
|
|
299
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
300
|
+
spinner.succeed();
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
spinner.fail();
|
|
304
|
+
throw e;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
const spinner = spin(`recovering execution's transaction ${pendingTransaction.transaction.hash}`);
|
|
309
|
+
try {
|
|
310
|
+
await waitForTransaction(pendingTransaction.transaction.hash);
|
|
311
|
+
fs.writeFileSync(filepath, JSONToString(existingPendingTansactions, 2));
|
|
312
|
+
spinner.succeed();
|
|
313
|
+
}
|
|
314
|
+
catch (e) {
|
|
315
|
+
spinner.fail();
|
|
316
|
+
throw e;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
fs.rmSync(filepath);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
async function savePendingTransaction(pendingTransaction) {
|
|
325
|
+
if (context.network.saveDeployments) {
|
|
326
|
+
const folderPath = ensureDeploymentFolder();
|
|
327
|
+
const filepath = path.join(folderPath, '.pending_transactions.json');
|
|
328
|
+
let existingPendinTransactions;
|
|
329
|
+
try {
|
|
330
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, 'utf-8'));
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
existingPendinTransactions = [];
|
|
334
|
+
}
|
|
335
|
+
existingPendinTransactions.push(pendingTransaction);
|
|
336
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
337
|
+
}
|
|
338
|
+
return deployments;
|
|
339
|
+
}
|
|
340
|
+
async function waitForTransactionReceipt(params) {
|
|
341
|
+
// const {hash, confirmations, pollingInterval, timeout} = {confirmations: 1, pollingInterval: 1, ...params};
|
|
342
|
+
const { hash, pollingInterval } = { pollingInterval: 1, ...params };
|
|
343
|
+
let latestBlockNumber = await provider.request({
|
|
344
|
+
method: 'eth_blockNumber',
|
|
345
|
+
});
|
|
346
|
+
let receipt = await provider.request({
|
|
347
|
+
method: 'eth_getTransactionReceipt',
|
|
348
|
+
params: [hash],
|
|
349
|
+
});
|
|
350
|
+
if (!receipt || !receipt.blockHash) {
|
|
351
|
+
await wait(pollingInterval);
|
|
352
|
+
return waitForTransactionReceipt(params);
|
|
353
|
+
}
|
|
354
|
+
return { receipt, latestBlockNumber };
|
|
355
|
+
}
|
|
356
|
+
async function deleteTransaction(hash) {
|
|
357
|
+
if (context.network.saveDeployments) {
|
|
358
|
+
const folderPath = ensureDeploymentFolder();
|
|
359
|
+
const filepath = path.join(folderPath, '.pending_transactions.json');
|
|
360
|
+
let existingPendinTransactions;
|
|
361
|
+
try {
|
|
362
|
+
existingPendinTransactions = stringToJSON(fs.readFileSync(filepath, 'utf-8'));
|
|
363
|
+
}
|
|
364
|
+
catch {
|
|
365
|
+
existingPendinTransactions = [];
|
|
366
|
+
}
|
|
367
|
+
existingPendinTransactions = existingPendinTransactions.filter((v) => v.transaction.hash !== hash);
|
|
368
|
+
if (existingPendinTransactions.length === 0) {
|
|
369
|
+
fs.rmSync(filepath);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
fs.writeFileSync(filepath, JSONToString(existingPendinTransactions, 2));
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
async function exportDeploymentsAsTypes() {
|
|
377
|
+
const folderPath = './generated';
|
|
378
|
+
fs.mkdirSync(folderPath, { recursive: true });
|
|
379
|
+
fs.writeFileSync(`${folderPath}/deployments.ts`, `export default ${JSONToString(deployments, 2)} as const;`);
|
|
380
|
+
}
|
|
381
|
+
async function waitForTransaction(hash, info) {
|
|
382
|
+
const spinner = spin(info?.message
|
|
383
|
+
? info.message
|
|
384
|
+
: ` - Broadcasting tx:\n ${hash}${info?.transaction ? `\n ${displayTransaction(info?.transaction)}` : ''}`);
|
|
385
|
+
let receiptResult;
|
|
386
|
+
try {
|
|
387
|
+
receiptResult = await waitForTransactionReceipt({
|
|
388
|
+
hash,
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
catch (e) {
|
|
392
|
+
spinner.fail();
|
|
393
|
+
throw e;
|
|
394
|
+
}
|
|
395
|
+
if (!receiptResult) {
|
|
396
|
+
throw new Error(`receipt for ${hash} not found`);
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
spinner.succeed();
|
|
400
|
+
}
|
|
401
|
+
return receiptResult;
|
|
402
|
+
}
|
|
403
|
+
async function waitForDeploymentTransactionAndSave(pendingDeployment, transaction) {
|
|
404
|
+
const message = ` - Deploying ${pendingDeployment.name} with tx:\n ${pendingDeployment.transaction.hash}${transaction ? `\n ${displayTransaction(transaction)}` : ''}`;
|
|
405
|
+
const { receipt, latestBlockNumber } = await waitForTransaction(pendingDeployment.transaction.hash, {
|
|
406
|
+
message,
|
|
407
|
+
transaction,
|
|
408
|
+
});
|
|
409
|
+
// TODO we could make pendingDeployment.expectedAddress a spec for fetching address from event too
|
|
410
|
+
const contractAddress = pendingDeployment.expectedAddress || receipt.contractAddress;
|
|
411
|
+
if (!contractAddress) {
|
|
412
|
+
console.error(receipt);
|
|
413
|
+
throw new Error(`no contract address found for ${pendingDeployment.name}`);
|
|
414
|
+
}
|
|
415
|
+
showMessage(` => ${contractAddress}`);
|
|
416
|
+
const { abi, ...artifactObjectWithoutABI } = pendingDeployment.partialDeployment;
|
|
417
|
+
if (!pendingDeployment.transaction.hash) {
|
|
418
|
+
const spinner = spin(); // TODO spin(`fetching nonce for ${pendingDeployment.txHash}`);
|
|
419
|
+
let transaction = null;
|
|
420
|
+
try {
|
|
421
|
+
transaction = await provider.request({
|
|
422
|
+
method: 'eth_getTransactionByHash',
|
|
423
|
+
params: [pendingDeployment.transaction.hash],
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
catch (e) {
|
|
427
|
+
spinner.fail();
|
|
428
|
+
throw e;
|
|
429
|
+
}
|
|
430
|
+
if (!transaction) {
|
|
431
|
+
spinner.fail(`tx ${pendingDeployment.transaction.hash} not found`);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
spinner.stop();
|
|
435
|
+
}
|
|
436
|
+
if (transaction) {
|
|
437
|
+
pendingDeployment.transaction = {
|
|
438
|
+
nonce: transaction.nonce,
|
|
439
|
+
hash: transaction.hash,
|
|
440
|
+
origin: transaction.from,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
// TODO options
|
|
445
|
+
for (const key of Object.keys(artifactObjectWithoutABI)) {
|
|
446
|
+
if (key.startsWith('_')) {
|
|
447
|
+
delete artifactObjectWithoutABI[key];
|
|
448
|
+
}
|
|
449
|
+
if (key === 'evm') {
|
|
450
|
+
if (artifactObjectWithoutABI.evm) {
|
|
451
|
+
if ('gasEstimates' in artifactObjectWithoutABI['evm']) {
|
|
452
|
+
const { gasEstimates } = artifactObjectWithoutABI.evm;
|
|
453
|
+
artifactObjectWithoutABI.evm = {
|
|
454
|
+
gasEstimates,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
const latestBlockNumberAsNumber = parseInt(latestBlockNumber.slice(2), 16);
|
|
461
|
+
const receiptBlockNumber = parseInt(receipt.blockNumber.slice(2), 16);
|
|
462
|
+
const confirmations = Math.max(0, latestBlockNumberAsNumber - receiptBlockNumber);
|
|
463
|
+
const deployment = {
|
|
464
|
+
address: contractAddress,
|
|
465
|
+
abi,
|
|
466
|
+
...artifactObjectWithoutABI,
|
|
467
|
+
transaction: pendingDeployment.transaction,
|
|
468
|
+
receipt: {
|
|
469
|
+
confirmations,
|
|
470
|
+
blockHash: receipt.blockHash,
|
|
471
|
+
blockNumber: receipt.blockNumber,
|
|
472
|
+
transactionIndex: receipt.transactionIndex,
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
return save(pendingDeployment.name, deployment);
|
|
476
|
+
}
|
|
477
|
+
async function savePendingExecution(pendingExecution) {
|
|
478
|
+
await savePendingTransaction(pendingExecution);
|
|
479
|
+
let transaction = null;
|
|
480
|
+
const spinner = spin(); // TODO spin(`fetching tx from peers ${pendingDeployment.txHash}`);
|
|
481
|
+
try {
|
|
482
|
+
transaction = await provider.request({
|
|
483
|
+
method: 'eth_getTransactionByHash',
|
|
484
|
+
params: [pendingExecution.transaction.hash],
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
catch (e) {
|
|
488
|
+
spinner.fail();
|
|
489
|
+
throw e;
|
|
490
|
+
}
|
|
491
|
+
if (!transaction) {
|
|
492
|
+
spinner.fail(`tx ${pendingExecution.transaction.hash} not found`);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
spinner.stop();
|
|
496
|
+
}
|
|
497
|
+
if (transaction) {
|
|
498
|
+
pendingExecution.transaction.nonce = transaction.nonce;
|
|
499
|
+
pendingExecution.transaction.origin = transaction.from;
|
|
500
|
+
}
|
|
501
|
+
const { receipt } = await waitForTransaction(pendingExecution.transaction.hash, { transaction });
|
|
502
|
+
await deleteTransaction(pendingExecution.transaction.hash);
|
|
503
|
+
return receipt;
|
|
504
|
+
}
|
|
505
|
+
async function savePendingDeployment(pendingDeployment) {
|
|
506
|
+
await savePendingTransaction(pendingDeployment);
|
|
507
|
+
let transaction = null;
|
|
508
|
+
const spinner = spin(); // TODO spin(`fetching tx from peers ${pendingDeployment.txHash}`);
|
|
509
|
+
try {
|
|
510
|
+
transaction = await provider.request({
|
|
511
|
+
method: 'eth_getTransactionByHash',
|
|
512
|
+
params: [pendingDeployment.transaction.hash],
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
catch (e) {
|
|
516
|
+
console.error(`failed to fetch tx ${pendingDeployment.transaction.hash}. Can't know its status`);
|
|
517
|
+
spinner.fail();
|
|
518
|
+
throw e;
|
|
519
|
+
}
|
|
520
|
+
if (!transaction) {
|
|
521
|
+
spinner.fail(`tx ${pendingDeployment.transaction.hash} not found`);
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
spinner.stop();
|
|
525
|
+
}
|
|
526
|
+
if (transaction) {
|
|
527
|
+
// we update the tx data with the one we get from the network
|
|
528
|
+
pendingDeployment = {
|
|
529
|
+
...pendingDeployment,
|
|
530
|
+
transaction: { hash: transaction.hash, nonce: transaction.nonce, origin: transaction.from },
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
const deployment = await waitForDeploymentTransactionAndSave(pendingDeployment, transaction);
|
|
534
|
+
await deleteTransaction(pendingDeployment.transaction.hash);
|
|
535
|
+
return deployment;
|
|
536
|
+
}
|
|
537
|
+
function showMessage(message) {
|
|
538
|
+
log(message);
|
|
539
|
+
}
|
|
540
|
+
function showProgress(message) {
|
|
541
|
+
return spin(message);
|
|
542
|
+
}
|
|
543
|
+
let env = {
|
|
544
|
+
...perliminaryEnvironment,
|
|
545
|
+
save,
|
|
546
|
+
savePendingDeployment,
|
|
547
|
+
savePendingExecution,
|
|
548
|
+
get,
|
|
549
|
+
getOrNull,
|
|
550
|
+
fromAddressToNamedABI,
|
|
551
|
+
fromAddressToNamedABIOrNull,
|
|
552
|
+
showMessage,
|
|
553
|
+
showProgress,
|
|
554
|
+
};
|
|
555
|
+
for (const extension of globalThis.extensions) {
|
|
556
|
+
env = extension(env);
|
|
557
|
+
}
|
|
558
|
+
return {
|
|
559
|
+
external: env,
|
|
560
|
+
internal: {
|
|
561
|
+
exportDeploymentsAsTypes,
|
|
562
|
+
recoverTransactionsIfAny,
|
|
563
|
+
},
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/environment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAqB,kBAAkB,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AAkBpE,OAAO,EAAC,mBAAmB,EAAC,MAAM,2BAA2B,CAAC;AAG9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAUjD,OAAO,EAAoB,GAAG,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAEpE,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAC,MAAM,uCAAuC,CAAC;AAK7E,4CAA4C;AAC3C,UAAkB,CA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AC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC5D,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,SAAS,WAAW,CAAC,OAAe;QACnC,GAAG,CAAC,OAAO,CAAC,CAAC;IACd,CAAC;IAED,SAAS,YAAY,CAAC,OAAgB;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,IAAI,GAAG,GAAuD;QAC7D,GAAG,sBAAsB;QACzB,IAAI;QACJ,qBAAqB;QACrB,oBAAoB;QACpB,GAAG;QACH,SAAS;QACT,qBAAqB;QACrB,2BAA2B;QAC3B,WAAW;QACX,YAAY;KACZ,CAAC;IACF,KAAK,MAAM,SAAS,IAAK,UAAkB,CAAC,UAAU,EAAE,CAAC;QACxD,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAED,OAAO;QACN,QAAQ,EAAE,GAAG;QACb,QAAQ,EAAE;YACT,wBAAwB;YACxB,wBAAwB;SACxB;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { EIP1193Accounts, EIP1193AccountsRequest, EIP1193AddChainError, EIP1193Block, EIP1193BlockNumberRequest, EIP1193BlockWithTransactions, EIP1193CallRequest, EIP1193ChainIdRequest, EIP1193CoinbaseRequest, EIP1193EstimateGasRequest, EIP1193GasPriceRequest, EIP1193GenericRequest, EIP1193GenericRequestProvider, EIP1193GetBalanceRequest, EIP1193GetBlockByHashRequest, EIP1193GetBlockByNumberRequest, EIP1193GetCodeRequest, EIP1193GetLogsRequest, EIP1193GetStorageAtRequest, EIP1193GetTransactionByBlockHashAndIndexRequest, EIP1193GetTransactionByBlockNumberAndIndexRequest, EIP1193GetTransactionByHashRequest, EIP1193GetTransactionCountByHashRequest, EIP1193GetTransactionCountByNumberRequest, EIP1193GetTransactionCountRequest, EIP1193GetTransactionReceiptRequest, EIP1193GetUncleByBlockHashAndIndexRequest, EIP1193GetUncleByBlockNumberAndIndexRequest, EIP1193GetUncleCountByBlockHashRequest, EIP1193GetUncleCountByBlockNumberRequest, EIP1193LegacySignRequest, EIP1193Log, EIP1193NetListeningRequest, EIP1193NetPeerCountRequest, EIP1193NetVersionRequest, EIP1193PTypedSignRequest, EIP1193PTypedSignv4Request, EIP1193PersonalSignRequest, EIP1193ProtocolVersionRequest, EIP1193ProviderWithoutEvents, EIP1193RequestAccountsRequest, EIP1193SendRawTransactionRequest, EIP1193SendTransactionRequest, EIP1193SignTransactionRequest, EIP1193SubscribeRequest, EIP1193SwitchChainError, EIP1193SyncingRequest, EIP1193SyncingStatus, EIP1193Transaction, EIP1193TransactionReceipt, EIP1193UnsubscribeRequest, EIP1193Web3ClientVersionRequest, EIP1193Web3SHARequest, ERIP1193AddChainRequest, ERIP1193SwitchChainRequest } from 'eip-1193';
|
|
2
|
+
export declare abstract class BaseProvider implements EIP1193ProviderWithoutEvents {
|
|
3
|
+
protected provider: EIP1193GenericRequestProvider;
|
|
4
|
+
constructor(provider: EIP1193GenericRequestProvider);
|
|
5
|
+
request(args: EIP1193Web3ClientVersionRequest): Promise<string>;
|
|
6
|
+
request(args: EIP1193Web3SHARequest): Promise<`0x${string}`>;
|
|
7
|
+
request(args: EIP1193NetVersionRequest): Promise<`0x${string}`>;
|
|
8
|
+
request(args: EIP1193NetListeningRequest): Promise<boolean>;
|
|
9
|
+
request(args: EIP1193NetPeerCountRequest): Promise<`0x${string}`>;
|
|
10
|
+
request(args: EIP1193ProtocolVersionRequest): Promise<string>;
|
|
11
|
+
request(args: EIP1193SyncingRequest): Promise<false | EIP1193SyncingStatus>;
|
|
12
|
+
request(args: EIP1193CoinbaseRequest): Promise<`0x${string}`>;
|
|
13
|
+
request(args: EIP1193GasPriceRequest): Promise<`0x${string}`>;
|
|
14
|
+
request(args: EIP1193AccountsRequest): Promise<EIP1193Accounts>;
|
|
15
|
+
request(args: EIP1193BlockNumberRequest): Promise<`0x${string}`>;
|
|
16
|
+
request(args: EIP1193GetBalanceRequest): Promise<`0x${string}`>;
|
|
17
|
+
request(args: EIP1193GetStorageAtRequest): Promise<`0x${string}`>;
|
|
18
|
+
request(args: EIP1193GetTransactionCountRequest): Promise<`0x${string}`>;
|
|
19
|
+
request(args: EIP1193GetTransactionCountByHashRequest): Promise<`0x${string}`>;
|
|
20
|
+
request(args: EIP1193GetTransactionCountByNumberRequest): Promise<`0x${string}`>;
|
|
21
|
+
request(args: EIP1193GetUncleCountByBlockHashRequest): Promise<`0x${string}`>;
|
|
22
|
+
request(args: EIP1193GetUncleCountByBlockNumberRequest): Promise<`0x${string}`>;
|
|
23
|
+
request(args: EIP1193GetCodeRequest): Promise<`0x${string}`>;
|
|
24
|
+
request(args: EIP1193LegacySignRequest): Promise<`0x${string}`>;
|
|
25
|
+
request(args: EIP1193SignTransactionRequest): Promise<`0x${string}`>;
|
|
26
|
+
request(args: EIP1193SendTransactionRequest): Promise<`0x${string}`>;
|
|
27
|
+
request(args: EIP1193SendRawTransactionRequest): Promise<`0x${string}`>;
|
|
28
|
+
request(args: EIP1193CallRequest): Promise<`0x${string}`>;
|
|
29
|
+
request(args: EIP1193EstimateGasRequest): Promise<`0x${string}`>;
|
|
30
|
+
request(args: EIP1193GetBlockByHashRequest<false>): Promise<EIP1193Block | null>;
|
|
31
|
+
request(args: EIP1193GetBlockByHashRequest<true>): Promise<EIP1193BlockWithTransactions | null>;
|
|
32
|
+
request(args: EIP1193GetBlockByNumberRequest<false>): Promise<EIP1193Block | null>;
|
|
33
|
+
request(args: EIP1193GetBlockByNumberRequest<true>): Promise<EIP1193BlockWithTransactions | null>;
|
|
34
|
+
request(args: EIP1193GetTransactionByHashRequest): Promise<EIP1193Transaction | null>;
|
|
35
|
+
request(args: EIP1193GetTransactionByBlockHashAndIndexRequest): Promise<EIP1193Transaction | null>;
|
|
36
|
+
request(args: EIP1193GetTransactionByBlockNumberAndIndexRequest): Promise<EIP1193Transaction | null>;
|
|
37
|
+
request(args: EIP1193GetTransactionReceiptRequest): Promise<EIP1193TransactionReceipt | null>;
|
|
38
|
+
request(args: EIP1193GetUncleByBlockHashAndIndexRequest): Promise<EIP1193Block | null>;
|
|
39
|
+
request(args: EIP1193GetUncleByBlockNumberAndIndexRequest): Promise<EIP1193Block | null>;
|
|
40
|
+
request(args: EIP1193GetLogsRequest): Promise<EIP1193Log[]>;
|
|
41
|
+
request(args: EIP1193PersonalSignRequest): Promise<`0x${string}`>;
|
|
42
|
+
request(args: EIP1193PTypedSignv4Request): Promise<`0x${string}`>;
|
|
43
|
+
request(args: EIP1193PTypedSignRequest): Promise<`0x${string}`>;
|
|
44
|
+
request(args: EIP1193ChainIdRequest): Promise<`0x${string}`>;
|
|
45
|
+
request(args: EIP1193RequestAccountsRequest): Promise<EIP1193Accounts>;
|
|
46
|
+
request(args: ERIP1193SwitchChainRequest): Promise<EIP1193SwitchChainError | null>;
|
|
47
|
+
request(args: ERIP1193AddChainRequest): Promise<EIP1193AddChainError | null>;
|
|
48
|
+
request(args: EIP1193SubscribeRequest): Promise<string>;
|
|
49
|
+
request(args: EIP1193UnsubscribeRequest): Promise<boolean>;
|
|
50
|
+
request<T = unknown, V extends EIP1193GenericRequest = EIP1193GenericRequest>(args: V): Promise<T>;
|
|
51
|
+
protected abstract _request<T = unknown, V extends EIP1193GenericRequest = EIP1193GenericRequest>(args: V): Promise<T>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=BaseProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseProvider.d.ts","sourceRoot":"","sources":["../../../../src/environment/providers/BaseProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,EAC5B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