hardhat 2.6.5 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +45 -0
- package/builtin-tasks/compile.js +9 -0
- package/builtin-tasks/compile.js.map +1 -1
- package/builtin-tasks/node.js +26 -9
- package/builtin-tasks/node.js.map +1 -1
- package/internal/artifacts.d.ts +49 -0
- package/internal/artifacts.d.ts.map +1 -1
- package/internal/artifacts.js +191 -55
- package/internal/artifacts.js.map +1 -1
- package/internal/cli/analytics.js +2 -2
- package/internal/cli/analytics.js.map +1 -1
- package/internal/cli/cli.js +3 -1
- package/internal/cli/cli.js.map +1 -1
- package/internal/constants.d.ts +2 -0
- package/internal/constants.d.ts.map +1 -1
- package/internal/constants.js +3 -1
- package/internal/constants.js.map +1 -1
- package/internal/core/config/config-loading.d.ts.map +1 -1
- package/internal/core/config/config-loading.js +16 -2
- package/internal/core/config/config-loading.js.map +1 -1
- package/internal/core/config/config-resolution.d.ts.map +1 -1
- package/internal/core/config/config-resolution.js +21 -0
- package/internal/core/config/config-resolution.js.map +1 -1
- package/internal/core/config/config-validation.d.ts +1 -0
- package/internal/core/config/config-validation.d.ts.map +1 -1
- package/internal/core/config/config-validation.js +88 -13
- package/internal/core/config/config-validation.js.map +1 -1
- package/internal/core/config/default-config.d.ts +1 -0
- package/internal/core/config/default-config.d.ts.map +1 -1
- package/internal/core/config/default-config.js +11 -4
- package/internal/core/config/default-config.js.map +1 -1
- package/internal/core/errors-list.d.ts +14 -0
- package/internal/core/errors-list.d.ts.map +1 -1
- package/internal/core/errors-list.js +21 -2
- package/internal/core/errors-list.js.map +1 -1
- package/internal/core/jsonrpc/types/output/log.d.ts +1 -0
- package/internal/core/jsonrpc/types/output/log.d.ts.map +1 -1
- package/internal/core/jsonrpc/types/output/log.js +1 -0
- package/internal/core/jsonrpc/types/output/log.js.map +1 -1
- package/internal/core/jsonrpc/types/output/receipt.d.ts +1 -0
- package/internal/core/jsonrpc/types/output/receipt.d.ts.map +1 -1
- package/internal/core/params/hardhat-params.js +2 -2
- package/internal/core/params/hardhat-params.js.map +1 -1
- package/internal/core/providers/accounts.d.ts.map +1 -1
- package/internal/core/providers/accounts.js +14 -0
- package/internal/core/providers/accounts.js.map +1 -1
- package/internal/core/providers/construction.d.ts.map +1 -1
- package/internal/core/providers/construction.js +4 -2
- package/internal/core/providers/construction.js.map +1 -1
- package/internal/core/providers/gas-providers.d.ts.map +1 -1
- package/internal/core/providers/gas-providers.js +1 -1
- package/internal/core/providers/gas-providers.js.map +1 -1
- package/internal/core/typescript-support.d.ts +1 -1
- package/internal/core/typescript-support.d.ts.map +1 -1
- package/internal/core/typescript-support.js +4 -1
- package/internal/core/typescript-support.js.map +1 -1
- package/internal/hardhat-network/jsonrpc/client.d.ts +2 -0
- package/internal/hardhat-network/jsonrpc/client.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.d.ts +2 -1
- package/internal/hardhat-network/provider/TransactionQueue.d.ts.map +1 -1
- package/internal/hardhat-network/provider/TransactionQueue.js +16 -2
- package/internal/hardhat-network/provider/TransactionQueue.js.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.d.ts.map +1 -1
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js +1 -3
- package/internal/hardhat-network/provider/fork/ForkBlockchain.js.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.d.ts +3 -0
- package/internal/hardhat-network/provider/modules/hardhat.d.ts.map +1 -1
- package/internal/hardhat-network/provider/modules/hardhat.js +16 -0
- package/internal/hardhat-network/provider/modules/hardhat.js.map +1 -1
- package/internal/hardhat-network/provider/modules/personal.d.ts +9 -0
- package/internal/hardhat-network/provider/modules/personal.d.ts.map +1 -0
- package/internal/hardhat-network/provider/modules/personal.js +31 -0
- package/internal/hardhat-network/provider/modules/personal.js.map +1 -0
- package/internal/hardhat-network/provider/node-types.d.ts +5 -0
- package/internal/hardhat-network/provider/node-types.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node-types.js.map +1 -1
- package/internal/hardhat-network/provider/node.d.ts +4 -1
- package/internal/hardhat-network/provider/node.d.ts.map +1 -1
- package/internal/hardhat-network/provider/node.js +42 -17
- package/internal/hardhat-network/provider/node.js.map +1 -1
- package/internal/hardhat-network/provider/output.d.ts +1 -1
- package/internal/hardhat-network/provider/output.d.ts.map +1 -1
- package/internal/hardhat-network/provider/output.js +9 -6
- package/internal/hardhat-network/provider/output.js.map +1 -1
- package/internal/hardhat-network/provider/provider.d.ts +6 -2
- package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
- package/internal/hardhat-network/provider/provider.js +12 -2
- package/internal/hardhat-network/provider/provider.js.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +1 -1
- package/internal/hardhat-network/stack-traces/error-inferrer.js +14 -0
- package/internal/hardhat-network/stack-traces/error-inferrer.js.map +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.d.ts +1 -1
- package/internal/hardhat-network/stack-traces/solidityTracer.js +1 -1
- package/internal/lib/hardhat-lib.d.ts.map +1 -1
- package/internal/lib/hardhat-lib.js +2 -0
- package/internal/lib/hardhat-lib.js.map +1 -1
- package/internal/util/antlr-prototype-pollution-workaround.d.ts +16 -0
- package/internal/util/antlr-prototype-pollution-workaround.d.ts.map +1 -0
- package/internal/util/antlr-prototype-pollution-workaround.js +22 -0
- package/internal/util/antlr-prototype-pollution-workaround.js.map +1 -0
- package/package.json +5 -5
- package/register.js +3 -1
- package/register.js.map +1 -1
- package/src/builtin-tasks/compile.ts +14 -0
- package/src/builtin-tasks/node.ts +41 -9
- package/src/internal/artifacts.ts +268 -71
- package/src/internal/cli/analytics.ts +1 -1
- package/src/internal/cli/cli.ts +4 -1
- package/src/internal/constants.ts +3 -0
- package/src/internal/core/config/config-loading.ts +24 -2
- package/src/internal/core/config/config-resolution.ts +28 -0
- package/src/internal/core/config/config-validation.ts +147 -15
- package/src/internal/core/config/default-config.ts +9 -2
- package/src/internal/core/errors-list.ts +21 -2
- package/src/internal/core/jsonrpc/types/output/log.ts +1 -0
- package/src/internal/core/params/hardhat-params.ts +2 -2
- package/src/internal/core/providers/accounts.ts +19 -0
- package/src/internal/core/providers/construction.ts +8 -2
- package/src/internal/core/providers/gas-providers.ts +1 -1
- package/src/internal/core/typescript-support.ts +5 -1
- package/src/internal/hardhat-network/provider/TransactionQueue.ts +31 -4
- package/src/internal/hardhat-network/provider/fork/ForkBlockchain.ts +1 -3
- package/src/internal/hardhat-network/provider/modules/hardhat.ts +23 -0
- package/src/internal/hardhat-network/provider/modules/personal.ts +39 -0
- package/src/internal/hardhat-network/provider/node-types.ts +6 -0
- package/src/internal/hardhat-network/provider/node.ts +45 -15
- package/src/internal/hardhat-network/provider/output.ts +9 -9
- package/src/internal/hardhat-network/provider/provider.ts +15 -1
- package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +19 -0
- package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +1 -1
- package/src/internal/lib/hardhat-lib.ts +3 -0
- package/src/internal/util/antlr-prototype-pollution-workaround.ts +17 -0
- package/src/register.ts +4 -1
- package/src/types/config.ts +14 -0
- package/src/utils/contract-names.ts +112 -0
- package/src/utils/source-names.ts +1 -1
- package/types/config.d.ts +10 -0
- package/types/config.d.ts.map +1 -1
- package/utils/contract-names.d.ts +10 -0
- package/utils/contract-names.d.ts.map +1 -1
- package/utils/contract-names.js +92 -1
- package/utils/contract-names.js.map +1 -1
- package/utils/source-names.d.ts +1 -1
- package/utils/source-names.js +1 -1
|
@@ -3,6 +3,7 @@ import { RunBlockResult } from "@ethereumjs/vm/dist/runBlock";
|
|
|
3
3
|
import { BN } from "ethereumjs-util";
|
|
4
4
|
|
|
5
5
|
import { BuildInfo } from "../../../types";
|
|
6
|
+
import { HARDHAT_MEMPOOL_SUPPORTED_ORDERS } from "../../constants";
|
|
6
7
|
import { MessageTrace } from "../stack-traces/message-trace";
|
|
7
8
|
|
|
8
9
|
import type { ReturnData } from "./return-data";
|
|
@@ -28,6 +29,8 @@ interface CommonConfig {
|
|
|
28
29
|
initialDate?: Date;
|
|
29
30
|
tracingConfig?: TracingConfig;
|
|
30
31
|
initialBaseFeePerGas?: number;
|
|
32
|
+
mempoolOrder: MempoolOrder;
|
|
33
|
+
coinbase: string;
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
export type LocalNodeConfig = CommonConfig;
|
|
@@ -48,6 +51,8 @@ export interface TracingConfig {
|
|
|
48
51
|
|
|
49
52
|
export type IntervalMiningConfig = number | [number, number];
|
|
50
53
|
|
|
54
|
+
export type MempoolOrder = typeof HARDHAT_MEMPOOL_SUPPORTED_ORDERS[number];
|
|
55
|
+
|
|
51
56
|
export interface GenesisAccount {
|
|
52
57
|
privateKey: string;
|
|
53
58
|
balance: string | number | BN;
|
|
@@ -121,6 +126,7 @@ export interface Snapshot {
|
|
|
121
126
|
nextBlockTimestamp: BN;
|
|
122
127
|
irregularStatesByBlockNumber: Map<string, Buffer>;
|
|
123
128
|
userProvidedNextBlockBaseFeePerGas: BN | undefined;
|
|
129
|
+
coinbase: string;
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
export type SendTransactionResult =
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
GatherTracesResult,
|
|
83
83
|
GenesisAccount,
|
|
84
84
|
isForkedNodeConfig,
|
|
85
|
+
MempoolOrder,
|
|
85
86
|
MineBlockResult,
|
|
86
87
|
NodeConfig,
|
|
87
88
|
RunCallResult,
|
|
@@ -115,10 +116,6 @@ const log = debug("hardhat:core:hardhat-network:node");
|
|
|
115
116
|
|
|
116
117
|
const ethSigUtil = require("eth-sig-util");
|
|
117
118
|
|
|
118
|
-
export const COINBASE_ADDRESS = Address.fromString(
|
|
119
|
-
"0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e"
|
|
120
|
-
);
|
|
121
|
-
|
|
122
119
|
/* eslint-disable @nomiclabs/hardhat-internal-rules/only-hardhat-error */
|
|
123
120
|
|
|
124
121
|
export class HardhatNode extends EventEmitter {
|
|
@@ -132,6 +129,7 @@ export class HardhatNode extends EventEmitter {
|
|
|
132
129
|
allowUnlimitedContractSize,
|
|
133
130
|
tracingConfig,
|
|
134
131
|
minGasPrice,
|
|
132
|
+
mempoolOrder,
|
|
135
133
|
} = config;
|
|
136
134
|
|
|
137
135
|
let common: Common;
|
|
@@ -242,6 +240,8 @@ export class HardhatNode extends EventEmitter {
|
|
|
242
240
|
automine,
|
|
243
241
|
minGasPrice,
|
|
244
242
|
initialBlockTimeOffset,
|
|
243
|
+
mempoolOrder,
|
|
244
|
+
config.coinbase,
|
|
245
245
|
genesisAccounts,
|
|
246
246
|
tracingConfig,
|
|
247
247
|
forkNetworkId,
|
|
@@ -315,6 +315,8 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
315
315
|
private _automine: boolean,
|
|
316
316
|
private _minGasPrice: BN,
|
|
317
317
|
private _blockTimeOffsetSeconds: BN = new BN(0),
|
|
318
|
+
private _mempoolOrder: MempoolOrder,
|
|
319
|
+
private _coinbase: string,
|
|
318
320
|
genesisAccounts: GenesisAccount[],
|
|
319
321
|
tracingConfig?: TracingConfig,
|
|
320
322
|
private _forkNetworkId?: number,
|
|
@@ -697,7 +699,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
697
699
|
}
|
|
698
700
|
|
|
699
701
|
public getCoinbaseAddress(): Address {
|
|
700
|
-
return
|
|
702
|
+
return Address.fromString(this._coinbase);
|
|
701
703
|
}
|
|
702
704
|
|
|
703
705
|
public async getStorageAt(
|
|
@@ -870,6 +872,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
870
872
|
irregularStatesByBlockNumber: this._irregularStatesByBlockNumber,
|
|
871
873
|
userProvidedNextBlockBaseFeePerGas:
|
|
872
874
|
this.getUserProvidedNextBlockBaseFeePerGas(),
|
|
875
|
+
coinbase: this.getCoinbaseAddress().toString(),
|
|
873
876
|
};
|
|
874
877
|
|
|
875
878
|
this._irregularStatesByBlockNumber = new Map(
|
|
@@ -924,6 +927,8 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
924
927
|
this._resetUserProvidedNextBlockBaseFeePerGas();
|
|
925
928
|
}
|
|
926
929
|
|
|
930
|
+
this._coinbase = snapshot.coinbase;
|
|
931
|
+
|
|
927
932
|
// We delete this and the following snapshots, as they can only be used
|
|
928
933
|
// once in Ganache
|
|
929
934
|
this._snapshots.splice(snapshotIndex);
|
|
@@ -1103,6 +1108,10 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1103
1108
|
this._automine = automine;
|
|
1104
1109
|
}
|
|
1105
1110
|
|
|
1111
|
+
public getAutomine() {
|
|
1112
|
+
return this._automine;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1106
1115
|
public async setBlockGasLimit(gasLimit: BN | number) {
|
|
1107
1116
|
this._txPool.setBlockGasLimit(gasLimit);
|
|
1108
1117
|
await this._txPool.updatePendingAndQueued();
|
|
@@ -1345,6 +1354,10 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1345
1354
|
};
|
|
1346
1355
|
}
|
|
1347
1356
|
|
|
1357
|
+
public async setCoinbase(coinbase: Address) {
|
|
1358
|
+
this._coinbase = coinbase.toString();
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1348
1361
|
private _getGasUsedRatio(block: Block): number {
|
|
1349
1362
|
const FLOATS_PRECISION = 100_000;
|
|
1350
1363
|
|
|
@@ -1372,12 +1385,28 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1372
1385
|
.map((hash) => this.getTransactionReceipt(hash))
|
|
1373
1386
|
);
|
|
1374
1387
|
|
|
1375
|
-
const
|
|
1376
|
-
.map((r) =>
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1388
|
+
const effectiveGasRewardAndGas = receipts
|
|
1389
|
+
.map((r, i) => {
|
|
1390
|
+
const tx = block.transactions[i];
|
|
1391
|
+
const baseFeePerGas = block.header.baseFeePerGas ?? new BN(0);
|
|
1392
|
+
|
|
1393
|
+
// reward = min(maxPriorityFeePerGas, maxFeePerGas - baseFeePerGas)
|
|
1394
|
+
let effectiveGasReward: BN;
|
|
1395
|
+
if ("maxPriorityFeePerGas" in tx) {
|
|
1396
|
+
effectiveGasReward = tx.maxFeePerGas.sub(baseFeePerGas);
|
|
1397
|
+
if (tx.maxPriorityFeePerGas.lt(effectiveGasReward)) {
|
|
1398
|
+
effectiveGasReward = tx.maxPriorityFeePerGas;
|
|
1399
|
+
}
|
|
1400
|
+
} else {
|
|
1401
|
+
effectiveGasReward = tx.gasPrice.sub(baseFeePerGas);
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
return {
|
|
1405
|
+
effectiveGasReward,
|
|
1406
|
+
gasUsed: rpcQuantityToBN(r?.gasUsed!),
|
|
1407
|
+
};
|
|
1408
|
+
})
|
|
1409
|
+
.sort((a, b) => a.effectiveGasReward.cmp(b.effectiveGasReward));
|
|
1381
1410
|
|
|
1382
1411
|
return rewardPercentiles.map((p) => {
|
|
1383
1412
|
let gasUsed = new BN(0);
|
|
@@ -1385,16 +1414,16 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1385
1414
|
.muln(Math.ceil(p * FLOATS_PRECISION))
|
|
1386
1415
|
.divn(100 * FLOATS_PRECISION);
|
|
1387
1416
|
|
|
1388
|
-
for (const values of
|
|
1417
|
+
for (const values of effectiveGasRewardAndGas) {
|
|
1389
1418
|
gasUsed = gasUsed.add(values.gasUsed);
|
|
1390
1419
|
|
|
1391
1420
|
if (targetGas.lte(gasUsed)) {
|
|
1392
|
-
return values.
|
|
1421
|
+
return values.effectiveGasReward;
|
|
1393
1422
|
}
|
|
1394
1423
|
}
|
|
1395
1424
|
|
|
1396
|
-
return
|
|
1397
|
-
.
|
|
1425
|
+
return effectiveGasRewardAndGas[effectiveGasRewardAndGas.length - 1]
|
|
1426
|
+
.effectiveGasReward;
|
|
1398
1427
|
});
|
|
1399
1428
|
}
|
|
1400
1429
|
|
|
@@ -1559,6 +1588,7 @@ Hardhat Network's forking functionality only works with blocks from at least spu
|
|
|
1559
1588
|
const pendingTxs = this._txPool.getPendingTransactions();
|
|
1560
1589
|
const transactionQueue = new TransactionQueue(
|
|
1561
1590
|
pendingTxs,
|
|
1591
|
+
this._mempoolOrder,
|
|
1562
1592
|
headerData.baseFeePerGas
|
|
1563
1593
|
);
|
|
1564
1594
|
|
|
@@ -292,18 +292,18 @@ export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
|
292
292
|
): RpcReceiptOutput[] {
|
|
293
293
|
const receipts: RpcReceiptOutput[] = [];
|
|
294
294
|
|
|
295
|
-
let
|
|
295
|
+
let blockLogIndex = 0;
|
|
296
296
|
|
|
297
297
|
for (let i = 0; i < runBlockResult.results.length; i += 1) {
|
|
298
298
|
const tx = block.transactions[i];
|
|
299
299
|
const { createdAddress, gasUsed } = runBlockResult.results[i];
|
|
300
300
|
const receipt = runBlockResult.receipts[i];
|
|
301
301
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
);
|
|
302
|
+
const logs = receipt.logs.map((log) => {
|
|
303
|
+
const result = getRpcLogOutput(log, tx, block, i, blockLogIndex);
|
|
304
|
+
blockLogIndex += 1;
|
|
305
|
+
return result;
|
|
306
|
+
});
|
|
307
307
|
|
|
308
308
|
const rpcReceipt: RpcReceiptOutput = {
|
|
309
309
|
transactionHash: bufferToRpcData(tx.hash()),
|
|
@@ -312,7 +312,7 @@ export function getRpcReceiptOutputsFromLocalBlockExecution(
|
|
|
312
312
|
blockNumber: numberToRpcQuantity(new BN(block.header.number)),
|
|
313
313
|
from: bufferToRpcData(tx.getSenderAddress().toBuffer()),
|
|
314
314
|
to: tx.to === undefined ? null : bufferToRpcData(tx.to.toBuffer()),
|
|
315
|
-
cumulativeGasUsed: numberToRpcQuantity(
|
|
315
|
+
cumulativeGasUsed: numberToRpcQuantity(new BN(receipt.gasUsed)),
|
|
316
316
|
gasUsed: numberToRpcQuantity(gasUsed),
|
|
317
317
|
contractAddress:
|
|
318
318
|
createdAddress !== undefined
|
|
@@ -395,7 +395,7 @@ export function remoteReceiptToRpcReceiptOutput(
|
|
|
395
395
|
};
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
export function toRpcLogOutput(log: RpcLog
|
|
398
|
+
export function toRpcLogOutput(log: RpcLog): RpcLogOutput {
|
|
399
399
|
return {
|
|
400
400
|
removed: false,
|
|
401
401
|
address: bufferToRpcData(log.address),
|
|
@@ -403,7 +403,7 @@ export function toRpcLogOutput(log: RpcLog, index?: number): RpcLogOutput {
|
|
|
403
403
|
blockNumber:
|
|
404
404
|
log.blockNumber !== null ? numberToRpcQuantity(log.blockNumber) : null,
|
|
405
405
|
data: bufferToRpcData(log.data),
|
|
406
|
-
logIndex:
|
|
406
|
+
logIndex: log.logIndex !== null ? numberToRpcQuantity(log.logIndex) : null,
|
|
407
407
|
transactionIndex:
|
|
408
408
|
log.transactionIndex !== null
|
|
409
409
|
? numberToRpcQuantity(log.transactionIndex)
|
|
@@ -32,6 +32,7 @@ import { EthModule } from "./modules/eth";
|
|
|
32
32
|
import { EvmModule } from "./modules/evm";
|
|
33
33
|
import { HardhatModule } from "./modules/hardhat";
|
|
34
34
|
import { ModulesLogger } from "./modules/logger";
|
|
35
|
+
import { PersonalModule } from "./modules/personal";
|
|
35
36
|
import { NetModule } from "./modules/net";
|
|
36
37
|
import { Web3Module } from "./modules/web3";
|
|
37
38
|
import { HardhatNode } from "./node";
|
|
@@ -39,6 +40,7 @@ import {
|
|
|
39
40
|
ForkConfig,
|
|
40
41
|
GenesisAccount,
|
|
41
42
|
IntervalMiningConfig,
|
|
43
|
+
MempoolOrder,
|
|
42
44
|
NodeConfig,
|
|
43
45
|
TracingConfig,
|
|
44
46
|
} from "./node-types";
|
|
@@ -53,6 +55,8 @@ const PRIVATE_RPC_METHODS = new Set([
|
|
|
53
55
|
|
|
54
56
|
/* eslint-disable @nomiclabs/hardhat-internal-rules/only-hardhat-error */
|
|
55
57
|
|
|
58
|
+
export const DEFAULT_COINBASE = "0xc014ba5ec014ba5ec014ba5ec014ba5ec014ba5e";
|
|
59
|
+
|
|
56
60
|
export class HardhatNetworkProvider
|
|
57
61
|
extends EventEmitter
|
|
58
62
|
implements EIP1193Provider
|
|
@@ -65,6 +69,7 @@ export class HardhatNetworkProvider
|
|
|
65
69
|
private _evmModule?: EvmModule;
|
|
66
70
|
private _hardhatModule?: HardhatModule;
|
|
67
71
|
private _debugModule?: DebugModule;
|
|
72
|
+
private _personalModule?: PersonalModule;
|
|
68
73
|
private readonly _mutex = new Mutex();
|
|
69
74
|
|
|
70
75
|
constructor(
|
|
@@ -79,6 +84,7 @@ export class HardhatNetworkProvider
|
|
|
79
84
|
private readonly _throwOnCallFailures: boolean,
|
|
80
85
|
private readonly _automine: boolean,
|
|
81
86
|
private readonly _intervalMining: IntervalMiningConfig,
|
|
87
|
+
private readonly _mempoolOrder: MempoolOrder,
|
|
82
88
|
private readonly _logger: ModulesLogger,
|
|
83
89
|
private readonly _genesisAccounts: GenesisAccount[] = [],
|
|
84
90
|
private readonly _artifacts?: Artifacts,
|
|
@@ -86,7 +92,8 @@ export class HardhatNetworkProvider
|
|
|
86
92
|
private readonly _initialDate?: Date,
|
|
87
93
|
private readonly _experimentalHardhatNetworkMessageTraceHooks: BoundExperimentalHardhatNetworkMessageTraceHook[] = [],
|
|
88
94
|
private _forkConfig?: ForkConfig,
|
|
89
|
-
private readonly _forkCachePath?: string
|
|
95
|
+
private readonly _forkCachePath?: string,
|
|
96
|
+
private readonly _coinbase = DEFAULT_COINBASE
|
|
90
97
|
) {
|
|
91
98
|
super();
|
|
92
99
|
}
|
|
@@ -205,6 +212,10 @@ export class HardhatNetworkProvider
|
|
|
205
212
|
return this._debugModule!.processRequest(method, params);
|
|
206
213
|
}
|
|
207
214
|
|
|
215
|
+
if (method.startsWith("personal_")) {
|
|
216
|
+
return this._personalModule!.processRequest(method, params);
|
|
217
|
+
}
|
|
218
|
+
|
|
208
219
|
throw new MethodNotFoundError(`Method ${method} not found`);
|
|
209
220
|
}
|
|
210
221
|
|
|
@@ -221,6 +232,7 @@ export class HardhatNetworkProvider
|
|
|
221
232
|
allowUnlimitedContractSize: this._allowUnlimitedContractSize,
|
|
222
233
|
tracingConfig: await this._makeTracingConfig(),
|
|
223
234
|
initialBaseFeePerGas: this._initialBaseFeePerGas,
|
|
235
|
+
mempoolOrder: this._mempoolOrder,
|
|
224
236
|
hardfork: this._hardfork,
|
|
225
237
|
networkName: this._networkName,
|
|
226
238
|
chainId: this._chainId,
|
|
@@ -229,6 +241,7 @@ export class HardhatNetworkProvider
|
|
|
229
241
|
forkConfig: this._forkConfig,
|
|
230
242
|
forkCachePath:
|
|
231
243
|
this._forkConfig !== undefined ? this._forkCachePath : undefined,
|
|
244
|
+
coinbase: this._coinbase,
|
|
232
245
|
};
|
|
233
246
|
|
|
234
247
|
const [common, node] = await HardhatNode.create(config);
|
|
@@ -265,6 +278,7 @@ export class HardhatNetworkProvider
|
|
|
265
278
|
this._experimentalHardhatNetworkMessageTraceHooks
|
|
266
279
|
);
|
|
267
280
|
this._debugModule = new DebugModule(node);
|
|
281
|
+
this._personalModule = new PersonalModule(node);
|
|
268
282
|
|
|
269
283
|
this._forwardNodeEvents(node);
|
|
270
284
|
}
|
|
@@ -191,6 +191,25 @@ export class ErrorInferrer {
|
|
|
191
191
|
return true;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// look TWO frames ahead to determine if this is a specific occurrence of
|
|
195
|
+
// a redundant CALLSTACK_ENTRY frame observed when using Solidity 0.8.5:
|
|
196
|
+
if (
|
|
197
|
+
frame.type === StackTraceEntryType.CALLSTACK_ENTRY &&
|
|
198
|
+
i + 2 < stacktrace.length &&
|
|
199
|
+
stacktrace[i + 2].sourceReference !== undefined &&
|
|
200
|
+
stacktrace[i + 2].type === StackTraceEntryType.RETURNDATA_SIZE_ERROR
|
|
201
|
+
) {
|
|
202
|
+
// ! below for tsc. we confirmed existence in the enclosing conditional.
|
|
203
|
+
const thatSrcRef = stacktrace[i + 2].sourceReference!;
|
|
204
|
+
if (
|
|
205
|
+
frame.sourceReference.range[0] === thatSrcRef.range[0] &&
|
|
206
|
+
frame.sourceReference.range[1] === thatSrcRef.range[1] &&
|
|
207
|
+
frame.sourceReference.line === thatSrcRef.line
|
|
208
|
+
) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
194
213
|
// constructors contain the whole contract, so we ignore them
|
|
195
214
|
if (
|
|
196
215
|
frame.sourceReference.function === "constructor" &&
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
StackTraceEntryType,
|
|
32
32
|
} from "./solidity-stack-trace";
|
|
33
33
|
|
|
34
|
-
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.
|
|
34
|
+
export const SUPPORTED_SOLIDITY_VERSION_RANGE = "<=0.8.9";
|
|
35
35
|
export const FIRST_SOLC_VERSION_SUPPORTED = "0.5.1";
|
|
36
36
|
|
|
37
37
|
export class SolidityTracer {
|
|
@@ -8,10 +8,13 @@ import { ERRORS } from "../core/errors-list";
|
|
|
8
8
|
import { getEnvHardhatArguments } from "../core/params/env-variables";
|
|
9
9
|
import { HARDHAT_PARAM_DEFINITIONS } from "../core/params/hardhat-params";
|
|
10
10
|
import { Environment } from "../core/runtime-environment";
|
|
11
|
+
import { applyWorkaround } from "../util/antlr-prototype-pollution-workaround";
|
|
11
12
|
|
|
12
13
|
let ctx: HardhatContext;
|
|
13
14
|
let env: HardhatRuntimeEnvironment;
|
|
14
15
|
|
|
16
|
+
applyWorkaround();
|
|
17
|
+
|
|
15
18
|
if (HardhatContext.isCreated()) {
|
|
16
19
|
ctx = HardhatContext.getHardhatContext();
|
|
17
20
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function applies a workaround to an ANTLR issue that arises when used
|
|
3
|
+
* with Immutable.js.
|
|
4
|
+
*
|
|
5
|
+
* ANTLR defines String.prototype.hashCode, and Immutable.js uses hashCode
|
|
6
|
+
* functions internally (for equality), including on strings.
|
|
7
|
+
*
|
|
8
|
+
* If the parser is required lazily (which it normally is) in the middle of an
|
|
9
|
+
* execution, the custom state managers can break, because we'd be redefining
|
|
10
|
+
* the String's equality function as seen by Immutable.js.
|
|
11
|
+
*
|
|
12
|
+
* By always including the parser we make the equality function's definition
|
|
13
|
+
* stable during the entire execution.
|
|
14
|
+
*/
|
|
15
|
+
export function applyWorkaround() {
|
|
16
|
+
require("@solidity-parser/parser");
|
|
17
|
+
}
|
package/src/register.ts
CHANGED
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
disableReplWriterShowProxy,
|
|
14
14
|
isNodeCalledWithoutAScript,
|
|
15
15
|
} from "./internal/util/console";
|
|
16
|
+
import { applyWorkaround } from "./internal/util/antlr-prototype-pollution-workaround";
|
|
17
|
+
|
|
18
|
+
applyWorkaround();
|
|
16
19
|
|
|
17
20
|
if (!HardhatContext.isCreated()) {
|
|
18
21
|
require("source-map-support/register");
|
|
@@ -33,7 +36,7 @@ if (!HardhatContext.isCreated()) {
|
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
if (willRunWithTypescript(hardhatArguments.config)) {
|
|
36
|
-
loadTsNode();
|
|
39
|
+
loadTsNode(hardhatArguments.tsconfig);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const config = loadConfigAndTasks(hardhatArguments);
|
package/src/types/config.ts
CHANGED
|
@@ -18,6 +18,7 @@ import type { BN } from "ethereumjs-util";
|
|
|
18
18
|
|
|
19
19
|
export interface NetworksUserConfig {
|
|
20
20
|
hardhat?: HardhatNetworkUserConfig;
|
|
21
|
+
|
|
21
22
|
[networkName: string]: NetworkUserConfig | undefined;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -43,6 +44,7 @@ export interface HardhatNetworkUserConfig {
|
|
|
43
44
|
initialDate?: string;
|
|
44
45
|
loggingEnabled?: boolean;
|
|
45
46
|
forking?: HardhatNetworkForkingUserConfig;
|
|
47
|
+
coinbase?: string;
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
export type HardhatNetworkAccountsUserConfig =
|
|
@@ -95,6 +97,7 @@ export interface HttpNetworkUserConfig {
|
|
|
95
97
|
export interface NetworksConfig {
|
|
96
98
|
hardhat: HardhatNetworkConfig;
|
|
97
99
|
localhost: HttpNetworkConfig;
|
|
100
|
+
|
|
98
101
|
[networkName: string]: NetworkConfig;
|
|
99
102
|
}
|
|
100
103
|
|
|
@@ -118,6 +121,7 @@ export interface HardhatNetworkConfig {
|
|
|
118
121
|
initialDate: string;
|
|
119
122
|
loggingEnabled: boolean;
|
|
120
123
|
forking?: HardhatNetworkForkingConfig;
|
|
124
|
+
coinbase?: string;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
export type HardhatNetworkAccountsConfig =
|
|
@@ -170,11 +174,21 @@ export interface HttpNetworkHDAccountsConfig {
|
|
|
170
174
|
export interface HardhatNetworkMiningConfig {
|
|
171
175
|
auto: boolean;
|
|
172
176
|
interval: number | [number, number];
|
|
177
|
+
mempool: HardhatNetworkMempoolConfig;
|
|
173
178
|
}
|
|
174
179
|
|
|
175
180
|
export interface HardhatNetworkMiningUserConfig {
|
|
176
181
|
auto?: boolean;
|
|
177
182
|
interval?: number | [number, number];
|
|
183
|
+
mempool?: HardhatNetworkMempoolUserConfig;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface HardhatNetworkMempoolConfig {
|
|
187
|
+
order: string; // Guaranteed at runtime to be have a valid value
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface HardhatNetworkMempoolUserConfig {
|
|
191
|
+
order?: string;
|
|
178
192
|
}
|
|
179
193
|
|
|
180
194
|
// Project paths config
|
|
@@ -56,3 +56,115 @@ export function parseName(name: string): {
|
|
|
56
56
|
|
|
57
57
|
return { sourceName, contractName };
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Returns the edit-distance between two given strings using Levenshtein distance.
|
|
62
|
+
*
|
|
63
|
+
* @param a First string being compared
|
|
64
|
+
* @param b Second string being compared
|
|
65
|
+
* @returns distance between the two strings (lower number == more similar)
|
|
66
|
+
* @see https://github.com/gustf/js-levenshtein
|
|
67
|
+
* @license MIT - https://github.com/gustf/js-levenshtein/blob/master/LICENSE
|
|
68
|
+
*/
|
|
69
|
+
export function findDistance(a: string, b: string): number {
|
|
70
|
+
function _min(
|
|
71
|
+
_d0: number,
|
|
72
|
+
_d1: number,
|
|
73
|
+
_d2: number,
|
|
74
|
+
_bx: number,
|
|
75
|
+
_ay: number
|
|
76
|
+
): number {
|
|
77
|
+
return _d0 < _d1 || _d2 < _d1
|
|
78
|
+
? _d0 > _d2
|
|
79
|
+
? _d2 + 1
|
|
80
|
+
: _d0 + 1
|
|
81
|
+
: _bx === _ay
|
|
82
|
+
? _d1
|
|
83
|
+
: _d1 + 1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (a === b) {
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (a.length > b.length) {
|
|
91
|
+
[a, b] = [b, a];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let la = a.length;
|
|
95
|
+
let lb = b.length;
|
|
96
|
+
|
|
97
|
+
while (la > 0 && a.charCodeAt(la - 1) === b.charCodeAt(lb - 1)) {
|
|
98
|
+
la--;
|
|
99
|
+
lb--;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let offset = 0;
|
|
103
|
+
|
|
104
|
+
while (offset < la && a.charCodeAt(offset) === b.charCodeAt(offset)) {
|
|
105
|
+
offset++;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
la -= offset;
|
|
109
|
+
lb -= offset;
|
|
110
|
+
|
|
111
|
+
if (la === 0 || lb < 3) {
|
|
112
|
+
return lb;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let x = 0;
|
|
116
|
+
let y: number;
|
|
117
|
+
let d0: number;
|
|
118
|
+
let d1: number;
|
|
119
|
+
let d2: number;
|
|
120
|
+
let d3: number;
|
|
121
|
+
let dd: number = 0; // typescript gets angry if we don't assign here
|
|
122
|
+
let dy: number;
|
|
123
|
+
let ay: number;
|
|
124
|
+
let bx0: number;
|
|
125
|
+
let bx1: number;
|
|
126
|
+
let bx2: number;
|
|
127
|
+
let bx3: number;
|
|
128
|
+
|
|
129
|
+
const vector = [];
|
|
130
|
+
|
|
131
|
+
for (y = 0; y < la; y++) {
|
|
132
|
+
vector.push(y + 1);
|
|
133
|
+
vector.push(a.charCodeAt(offset + y));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const len = vector.length - 1;
|
|
137
|
+
|
|
138
|
+
for (; x < lb - 3; ) {
|
|
139
|
+
bx0 = b.charCodeAt(offset + (d0 = x));
|
|
140
|
+
bx1 = b.charCodeAt(offset + (d1 = x + 1));
|
|
141
|
+
bx2 = b.charCodeAt(offset + (d2 = x + 2));
|
|
142
|
+
bx3 = b.charCodeAt(offset + (d3 = x + 3));
|
|
143
|
+
dd = x += 4;
|
|
144
|
+
for (y = 0; y < len; y += 2) {
|
|
145
|
+
dy = vector[y];
|
|
146
|
+
ay = vector[y + 1];
|
|
147
|
+
d0 = _min(dy, d0, d1, bx0, ay);
|
|
148
|
+
d1 = _min(d0, d1, d2, bx1, ay);
|
|
149
|
+
d2 = _min(d1, d2, d3, bx2, ay);
|
|
150
|
+
dd = _min(d2, d3, dd, bx3, ay);
|
|
151
|
+
vector[y] = dd;
|
|
152
|
+
d3 = d2;
|
|
153
|
+
d2 = d1;
|
|
154
|
+
d1 = d0;
|
|
155
|
+
d0 = dy;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
for (; x < lb; ) {
|
|
160
|
+
bx0 = b.charCodeAt(offset + (d0 = x));
|
|
161
|
+
dd = ++x;
|
|
162
|
+
for (y = 0; y < len; y += 2) {
|
|
163
|
+
dy = vector[y];
|
|
164
|
+
vector[y] = dd = _min(dy, d0, dd, bx0, vector[y + 1]);
|
|
165
|
+
d0 = dy;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return dd;
|
|
170
|
+
}
|
|
@@ -179,7 +179,7 @@ function isExplicitRelativePath(sourceName: string): boolean {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
* This function replaces backslashes (
|
|
182
|
+
* This function replaces backslashes (\\) with slashes (/).
|
|
183
183
|
*
|
|
184
184
|
* Note that a source name must not contain backslashes.
|
|
185
185
|
*/
|
package/types/config.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface HardhatNetworkUserConfig {
|
|
|
23
23
|
initialDate?: string;
|
|
24
24
|
loggingEnabled?: boolean;
|
|
25
25
|
forking?: HardhatNetworkForkingUserConfig;
|
|
26
|
+
coinbase?: string;
|
|
26
27
|
}
|
|
27
28
|
export declare type HardhatNetworkAccountsUserConfig = HardhatNetworkAccountUserConfig[] | HardhatNetworkHDAccountsUserConfig;
|
|
28
29
|
export interface HardhatNetworkAccountUserConfig {
|
|
@@ -85,6 +86,7 @@ export interface HardhatNetworkConfig {
|
|
|
85
86
|
initialDate: string;
|
|
86
87
|
loggingEnabled: boolean;
|
|
87
88
|
forking?: HardhatNetworkForkingConfig;
|
|
89
|
+
coinbase?: string;
|
|
88
90
|
}
|
|
89
91
|
export declare type HardhatNetworkAccountsConfig = HardhatNetworkHDAccountsConfig | HardhatNetworkAccountConfig[];
|
|
90
92
|
export interface HardhatNetworkAccountConfig {
|
|
@@ -126,10 +128,18 @@ export interface HttpNetworkHDAccountsConfig {
|
|
|
126
128
|
export interface HardhatNetworkMiningConfig {
|
|
127
129
|
auto: boolean;
|
|
128
130
|
interval: number | [number, number];
|
|
131
|
+
mempool: HardhatNetworkMempoolConfig;
|
|
129
132
|
}
|
|
130
133
|
export interface HardhatNetworkMiningUserConfig {
|
|
131
134
|
auto?: boolean;
|
|
132
135
|
interval?: number | [number, number];
|
|
136
|
+
mempool?: HardhatNetworkMempoolUserConfig;
|
|
137
|
+
}
|
|
138
|
+
export interface HardhatNetworkMempoolConfig {
|
|
139
|
+
order: string;
|
|
140
|
+
}
|
|
141
|
+
export interface HardhatNetworkMempoolUserConfig {
|
|
142
|
+
order?: string;
|
|
133
143
|
}
|
|
134
144
|
export interface ProjectPathsUserConfig {
|
|
135
145
|
root?: string;
|
package/types/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/types/config.ts"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAI1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/types/config.ts"],"names":[],"mappings":";AAcA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAI1C,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAEnC,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;CACtD;AAED,oBAAY,iBAAiB,GACzB,wBAAwB,GACxB,qBAAqB,CAAC;AAE1B,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,8BAA8B,CAAC;IACxC,QAAQ,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c,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,cAAc,CAAC;IACzB,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC;CAC3B;AAID,oBAAY,cAAc,GAAG,CAC3B,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,QAAQ,CAAC,iBAAiB,CAAC,KACpC,IAAI,CAAC"}
|
|
@@ -22,4 +22,14 @@ export declare function parseName(name: string): {
|
|
|
22
22
|
sourceName?: string;
|
|
23
23
|
contractName: string;
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Returns the edit-distance between two given strings using Levenshtein distance.
|
|
27
|
+
*
|
|
28
|
+
* @param a First string being compared
|
|
29
|
+
* @param b Second string being compared
|
|
30
|
+
* @returns distance between the two strings (lower number == more similar)
|
|
31
|
+
* @see https://github.com/gustf/js-levenshtein
|
|
32
|
+
* @license MIT - https://github.com/gustf/js-levenshtein/blob/master/LICENSE
|
|
33
|
+
*/
|
|
34
|
+
export declare function findDistance(a: string, b: string): number;
|
|
25
35
|
//# sourceMappingURL=contract-names.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-names.d.ts","sourceRoot":"","sources":["../src/utils/contract-names.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,GAAG;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAUA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAWA"}
|
|
1
|
+
{"version":3,"file":"contract-names.d.ts","sourceRoot":"","sources":["../src/utils/contract-names.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,kBAAkB,EAAE,MAAM,GAAG;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB,CAUA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAWA;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAqGzD"}
|