doc(@embark/ens): document $accounts for ENS configuration

Adds docs for $accounts in subdomain registers and improve the docs
This commit is contained in:
Jonathan Rainville 2020-02-05 09:13:19 -05:00 committed by Iuri Matias
parent de0102223d
commit c7eb2744cd
1 changed files with 35 additions and 2 deletions

View File

@ -8,9 +8,11 @@ We can configure different naming systems in Embark. In this guide we'll explore
Embark checks our configuration in `config/namesystem.js` by default. A naming system configuration isn't crucial to run Embark, so this only needs to be enabled when planing to use a naming system.
When using ENS as our provider, we can set the `register` section to pre-register sub-domains. This feature is only available in the development environment:
When using ENS as our provider, we can set the `register` section to pre-register sub-domains.
```
This feature is only available in the development environment:
```javascript
module.exports = {
default: {
enabled: true,
@ -28,3 +30,34 @@ module.exports = {
}
};
```
### Parameters
- `rootDomain`: The ENS domain. It gets registered using your default account
- `subdomains`: Object were the key is the subdomain name and the value is the address to set to it
## Special configurations
### $Contracts
For subdomains, you can set the address as one of your contracts address using it's name prefixed by a dollar sign (`$`).
```
subdomains: {
'contract': '$MyContract'
}
```
Now, assuming your `rootDomain` is `embark.eth`, `contract.embark.eth` will resolve to the deployed address of MyContract.
### $accounts
Similarly to `$Contract`, using `$accounts` let's you set the subdomain address to one of your accounts address.
```
subdomains: {
'account': '$accounts[0]'
}
```
Now, assuming your `rootDomain` is `embark.eth`, `account.embark.eth` will resolve to address of your first (index 0) account (aka `defaultAccount`).