mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-01 18:06:11 +00:00
only enabble register in dev
This commit is contained in:
parent
82bbbd6f87
commit
1f02461af1
@ -149,9 +149,10 @@ __embarkENS.registryAddresses = {
|
|||||||
__embarkENS.setProvider = function (config) {
|
__embarkENS.setProvider = function (config) {
|
||||||
const self = this;
|
const self = this;
|
||||||
const ERROR_MESSAGE = 'ENS is not available in this chain';
|
const ERROR_MESSAGE = 'ENS is not available in this chain';
|
||||||
EmbarkJS.onReady(() => {
|
self.registration = config.registration;
|
||||||
self.registration = config.registration;
|
self.env = config.env;
|
||||||
|
|
||||||
|
EmbarkJS.onReady(() => {
|
||||||
web3.eth.net.getId()
|
web3.eth.net.getId()
|
||||||
.then((id) => {
|
.then((id) => {
|
||||||
const registryAddress = self.registryAddresses[id] || config.registryAddress;
|
const registryAddress = self.registryAddresses[id] || config.registryAddress;
|
||||||
@ -228,10 +229,12 @@ __embarkENS.lookup = function (address, callback) {
|
|||||||
__embarkENS.registerSubDomain = function (name, address, callback) {
|
__embarkENS.registerSubDomain = function (name, address, callback) {
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
|
|
||||||
|
if (this.env !== 'development') {
|
||||||
|
return callback('Sub-domain registration is only available in development mode');
|
||||||
|
}
|
||||||
if (!this.registration || !this.registration.rootDomain) {
|
if (!this.registration || !this.registration.rootDomain) {
|
||||||
return callback('No rootDomain is declared in config/namesystem.js (register.rootDomain). Unable to register a subdomain until then.');
|
return callback('No rootDomain is declared in config/namesystem.js (register.rootDomain). Unable to register a subdomain until then.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!address || !web3.utils.isAddress(address)) {
|
if (!address || !web3.utils.isAddress(address)) {
|
||||||
return callback('You need to specify a valid address for the subdomain');
|
return callback('You need to specify a valid address for the subdomain');
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ class ENS {
|
|||||||
], (err, results) => {
|
], (err, results) => {
|
||||||
// result[0] => ENSRegistry; result[1] => FIFSRegistrar; result[2] => FIFSRegistrar
|
// result[0] => ENSRegistry; result[1] => FIFSRegistrar; result[2] => FIFSRegistrar
|
||||||
let config = {
|
let config = {
|
||||||
|
env: self.env,
|
||||||
registration: self.registration,
|
registration: self.registration,
|
||||||
registryAbi: results[0].abiDefinition,
|
registryAbi: results[0].abiDefinition,
|
||||||
registryAddress: results[0].deployedAddress,
|
registryAddress: results[0].deployedAddress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user