-
Notifications
You must be signed in to change notification settings - Fork 683
Implications failed: fork.headers -> url #2627
Comments
Thanks for reporting this. It looks like there is a bug in the |
In the meantime you can start ganache programmatically with this script: // save as ganache.js
const ganache = require( < PATH TO GANACHE, or just "ganache" if installed in your local node_modules>);
const WEI = 1000000000000000000n;
const server = ganache.server({
// PUT YOUR GANACHE OPTIONS HERE:
fork: {
url: "https://mainnet-nethermind.blockscout.com",
headers: {"User Agent": "Your User Agent"}
}
});
server.listen(8545, () => {
const provider = server.provider;
const liveOptions = provider.getOptions();
const accounts = provider.getInitialAccounts();
const addresses = Object.keys(accounts);
const logs = [];
logs.push("");
logs.push("Available Accounts");
logs.push("==================");
if (addresses.length > 0) {
addresses.forEach(function (address, index) {
const balance = accounts[address].balance;
const strBalance = balance / WEI;
const about = balance % WEI === 0n ? "" : "~";
let line = `(${index}) ${address} (${about}${strBalance} ETH)`;
if (!accounts[address].unlocked) {
line += " 🔒";
}
logs.push(line);
});
logs.push("");
logs.push("Private Keys");
logs.push("==================");
addresses.forEach(function (address, index) {
logs.push(`(${index}) ${accounts[address].secretKey}`);
});
if (liveOptions.wallet.accountKeysPath != null) {
logs.push("");
logs.push(
`Accounts and keys saved to ${liveOptions.wallet.accountKeysPath}`
);
}
} else {
logs.push("(no accounts unlocked)");
}
if (liveOptions.wallet.accounts == null) {
logs.push("");
logs.push("HD Wallet");
logs.push("==================");
logs.push(`Mnemonic: ${liveOptions.wallet.mnemonic}`);
logs.push(
`Base HD Path: ${
liveOptions.wallet.hdPath.join("/") + "/{account_index}"
}`
);
}
if (liveOptions.miner.defaultGasPrice) {
logs.push("");
logs.push("Default Gas Price");
logs.push("==================");
logs.push(liveOptions.miner.defaultGasPrice.toBigInt().toString());
}
if (liveOptions.miner.blockGasLimit) {
logs.push("");
logs.push("BlockGas Limit");
logs.push("==================");
logs.push(liveOptions.miner.blockGasLimit.toBigInt().toString());
}
if (liveOptions.miner.callGasLimit) {
logs.push("");
logs.push("Call Gas Limit");
logs.push("==================");
logs.push(liveOptions.miner.callGasLimit.toBigInt().toString());
}
if (liveOptions.fork.network || liveOptions.fork.url) {
logs.push("");
logs.push("Forked Chain");
logs.push("==================");
let location;
if (liveOptions.fork.network) {
location = `Ethereum ${capitalizeFirstLetter(
liveOptions.fork.network.replace("goerli", "görli")
)}, via 丕Infura`;
} else {
location = (liveOptions.fork.url).toString();
}
logs.push(`Location: ${location}`);
logs.push(
`Block: ${liveOptions.fork.blockNumber.toString()}`
);
logs.push(
`Network ID: ${liveOptions.chain.networkId.toString()}`
);
logs.push(`Time: ${new Date().toString()}`);
if (liveOptions.fork.requestsPerSecond !== 0) {
logs.push(
`Requests/Second: ${
liveOptions.fork.requestsPerSecond.toString()
}`
);
}
}
logs.push("");
logs.push("Chain Id");
logs.push("==================");
logs.push(liveOptions.chain.chainId.toString());
logs.push("");
logs.push("RPC Listening on localhost:8545");
console.log(logs.join("\n"));
}); to run it:
Let me know if that works for you. |
I think we should (temporarily?) remove our use of It's broken because: our options are strongly typed and expect namespace-less option names ( |
I am trying to run the following command:
but get the following error messages:
Is there an error with my command and if so, may I have an example of how I can specify a fork url as well as headers?
I'm using
ganache v7.0.3 (@ganache/cli: 0.1.4, @ganache/core: 0.1.4)
The text was updated successfully, but these errors were encountered: