Lesson -7 getNamedAccount is on my nerves #1643
-
Hi ! I am not able to understand this function even after reading documentation. lol |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 20 replies
-
Sure! There's a module called Named accounts are just named variables that reference the accounts / signers that the framework provides. So instead of doing:
You can just use the configuration from your screenshot, to do this: You can read more about it here. From the documentation of the module in question: Important note: |
Beta Was this translation helpful? Give feedback.
-
The function
In this example, we assign three accounts to the name For the second name users, we also assign a default address of 0 though we could use any account e.g. 5. With this you could chose to use This example from the documentation is pretty good.
|
Beta Was this translation helpful? Give feedback.
-
now let's say if its |
Beta Was this translation helpful? Give feedback.
-
Hey @MasterofBlockchain good question. Just to be clear, in this format |
Beta Was this translation helpful? Give feedback.
-
Well as we have two accounts in so when we run and when we run If it's right then how will Im truly sorry for all this trouble. |
Beta Was this translation helpful? Give feedback.
-
can't thankyou enough for being Patience with me and explained me in every possible way. Thankyou again very much. |
Beta Was this translation helpful? Give feedback.
The function
getNamedAccounts()
comes with hardhat-deploy. It allows us to access accounts and addresses from thenamedAccounts
object inhardhat.config.js
. ThisnamedAccounts
functionality allows us to associate a single name with multiple addresses.In this example, we assign three accounts to the name
deployer
(just a name to represent the person deploying the contract) and we set the default account to 0 (the first account in the list of 10 accounts that ha…