ccip-starter-kit-hardhat icon indicating copy to clipboard operation
ccip-starter-kit-hardhat copied to clipboard

Refactors hardhat tasks code, makes it compact & increases code readability

Open balajipachai opened this issue 1 year ago • 0 comments

Description

Same as that of mentioned in #8

  • Adds getSigner, getProvider & getSignerAndProvider in tasks/utils.ts

    • The functions getSigner, getProvider internally calls getSignerAndProvider, since one function should do one job. There are instances in the codebase wherein, sometimes, only the signer is needed and sometimes only the provider is needed and sometimes both are needed, thus, the above 3 different functions.
  • Having hre.network.name was redundant and was impacting the code readbility, hence, created a variable

    const blockchainNetwork = hre.network.name

    • And replaced all occurences of hre.network.name with blockchainNetwork.
  • @zeuslawyer @andrejrakic As discussed in #8, I did gave a thought about creating a new file setup.ts and having a function accountAndNetworkSetup, however, once I went through all the tasks, having getSigner, getProvider & getSignerAndProvider in utils.ts made more sense, thus, proposing this PR accordingly.

Closes

#8

Please do let me know in case of any improvements/suggestions/feedbacks.

Happy to help and contribute for open source learning!

balajipachai avatar Jan 18 '24 13:01 balajipachai