Skip to content

Commit

Permalink
feat: updated faucet to v4 (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev authored Oct 12, 2023
1 parent 2b4d6d7 commit 6fb6087
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 248 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@openzeppelin/contracts": "^4.9.2",
"@uniswap/v2-periphery": "^1.1.0-beta.0",
"@zetachain/faucet-cli": "2.0.2-athens3.1",
"@zetachain/faucet-cli": "^4.0.1",
"@zetachain/networks": "^2.3.0-athens3",
"@zetachain/protocol-contracts": "^2.1.0",
"axios": "^1.4.0",
"bech32": "^2.0.0",
"bip39": "^3.1.0",
"bitcoinjs-lib": "^6.1.3",
"dotenv": "16.0.3",
"cli-color": "^2.0.3",
"dotenv": "16.0.3",
"ecpair": "^2.1.0",
"envfile": "^6.18.0",
"ethers": "5.4.7",
Expand All @@ -94,4 +94,4 @@
"tiny-secp256k1": "^2.2.3",
"ws": "^8.13.0"
}
}
}
25 changes: 9 additions & 16 deletions tasks/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { drip } from "@zetachain/faucet-cli/dist/commands/drip";
import * as dotenv from "dotenv";
import { ethers } from "ethers";
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { walletError } from "./balances";

Expand All @@ -14,8 +14,7 @@ const faucetError = `
npx hardhat faucet --address <wallet_address>
`;

const getRecipientAddress = (args: any, hre: HardhatRuntimeEnvironment) => {
const { ethers } = hre as any;
const getRecipientAddress = (args: any) => {
if (args.address) {
return args.address;
} else if (process.env.PRIVATE_KEY) {
Expand All @@ -26,10 +25,10 @@ const getRecipientAddress = (args: any, hre: HardhatRuntimeEnvironment) => {
}
};

const main = async (args: any, hre: HardhatRuntimeEnvironment) => {
const main = async (args: any) => {
try {
const address = getRecipientAddress(args, hre);
await drip({ address, chain: args.chain }, []);
const address = getRecipientAddress(args);
await drip({ address });
} catch (error) {
console.error(error);
}
Expand All @@ -39,13 +38,7 @@ export const faucetTask = task(
"faucet",
"Request ZETA tokens from the faucet on a specific chain.",
main
)
.addOptionalParam(
"address",
"Recipient address. (default: address derived from PRIVATE_KEY env variable)"
)
.addParam(
"chain",
`Blockchain network where tokens will be sent.`,
"zeta_testnet"
);
).addOptionalParam(
"address",
"Recipient address. (default: address derived from PRIVATE_KEY env variable)"
);
34 changes: 0 additions & 34 deletions tasks/types/faucet.d.ts

This file was deleted.

Loading

0 comments on commit 6fb6087

Please sign in to comment.