difference between namedAccounts & getNamedAccounts #601
-
I have been curious about this since I saw this. We declare namedAccounts in hardhat config. Under that, we also declare our deployer. But when we use it in our deploy programs, we write getNamedAccounts. First and foremost, are those two things similar? If yes, why do they have two different names in two different places. But if no, how can we access an element of namedAccounts using the {} brackets? NamedAccounts in hardhat config: In deploy functions: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 16 replies
-
@harshuo2 In |
Beta Was this translation helpful? Give feedback.
-
btw chain iD of hardhat is 1337. but what is the use of deployer and player. are these related to local node that is hardhat node. or something else? |
Beta Was this translation helpful? Give feedback.
-
Thanks Ali.
…On Tue, Aug 9, 2022, 17:05 Ali Murtaza ***@***.***> wrote:
@deep0072 <https://github.com/deep0072> add this and you are good to go.
namedAccounts: {
deployer: {
default: 0,
},
player: {
default: 1,
},},
—
Reply to this email directly, view it on GitHub
<#601 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALCGNSBKMB63MVGP7Q44UODVYI67BANCNFSM5Z7G4BSQ>
.
You are receiving this because you were mentioned.Message ID:
<smartcontractkit/full-blockchain-solidity-course-js/repo-discussions/601/comments/3357198
@github.com>
|
Beta Was this translation helpful? Give feedback.
@harshuo2 In
namedAccounts
object inside hardhat.config you write the named accounts and set their values. AndgetNamedAccounts()
is a getter functions that returns these written named accounts to us.