Update demo hardhat configs to use env variable for eth endpoint (#277)

* Use an env variable for eth RPC endpoint in hardhat config

* Add a task to get main account address in erc20 watcher
This commit is contained in:
prathamesh0 2022-12-21 06:29:31 -06:00 committed by GitHub
parent 9566dff466
commit a834250259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import './test/tasks/token-transfer';
import './test/tasks/token-approve'; import './test/tasks/token-approve';
import './test/tasks/token-transfer-from'; import './test/tasks/token-transfer-from';
import './test/tasks/block-latest'; import './test/tasks/block-latest';
import './test/tasks/account';
// You need to export an object to set up your config // You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more // Go to https://hardhat.org/config/ to learn more
@ -20,7 +21,7 @@ export default {
solidity: '0.8.0', solidity: '0.8.0',
networks: { networks: {
docker: { docker: {
url: 'http://geth:8545' url: process.env.ETH_RPC_URL
} }
}, },
paths: { paths: {

View File

@ -25,6 +25,8 @@
"token:transfer-from:docker": "hardhat --network docker token-transfer-from", "token:transfer-from:docker": "hardhat --network docker token-transfer-from",
"block:latest": "hardhat --network localhost block-latest", "block:latest": "hardhat --network localhost block-latest",
"block:latest:docker": "hardhat --network docker block-latest", "block:latest:docker": "hardhat --network docker block-latest",
"account": "hardhat --network localhost account",
"account:docker": "hardhat --network docker account",
"reset": "DEBUG=vulcanize:* node --enable-source-maps dist/cli/reset.js", "reset": "DEBUG=vulcanize:* node --enable-source-maps dist/cli/reset.js",
"reset:dev": "DEBUG=vulcanize:* ts-node src/cli/reset.ts" "reset:dev": "DEBUG=vulcanize:* ts-node src/cli/reset.ts"
}, },

View File

@ -0,0 +1,12 @@
//
// Copyright 2022 Vulcanize, Inc.
//
import { task } from 'hardhat/config';
import '@nomiclabs/hardhat-ethers';
task('account', 'Prints the account', async (taskArgs, hre) => {
const [account] = await hre.ethers.getSigners();
console.log(account.address);
});

View File

@ -20,7 +20,7 @@ export default {
solidity: '0.8.0', solidity: '0.8.0',
networks: { networks: {
docker: { docker: {
url: 'http://geth:8545' url: process.env.ETH_RPC_URL
} }
}, },
paths: { paths: {

View File

@ -32,7 +32,8 @@
"nft:transfer:docker": "hardhat --network docker nft-transfer", "nft:transfer:docker": "hardhat --network docker nft-transfer",
"block:latest": "hardhat --network localhost block-latest", "block:latest": "hardhat --network localhost block-latest",
"block:latest:docker": "hardhat --network docker block-latest", "block:latest:docker": "hardhat --network docker block-latest",
"account": "hardhat --network localhost account" "account": "hardhat --network localhost account",
"account:docker": "hardhat --network docker account"
}, },
"repository": { "repository": {
"type": "git", "type": "git",