mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-09 04:15:08 +00:00
fix lookup and also enable lookup for new subdomains
This commit is contained in:
parent
9125fe82d9
commit
ead79cd77f
@ -243,6 +243,7 @@ __embarkENS.lookup = function (address, callback) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
__embarkENS.registerSubDomain = function (name, address, callback) {
|
__embarkENS.registerSubDomain = function (name, address, callback) {
|
||||||
|
const self = this;
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
|
|
||||||
if (!web3.eth.defaultAccount) {
|
if (!web3.eth.defaultAccount) {
|
||||||
|
@ -225,41 +225,14 @@ class ENS {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
registerConfigDomains(config, cb) {
|
|
||||||
const self = this;
|
|
||||||
self.events.request("blockchain:defaultAccount:get", (defaultAccount) => {
|
|
||||||
self.events.request("blockchain:contract:create",
|
|
||||||
{abi: config.registrarAbi, address: config.registrarAddress},
|
|
||||||
(registrar) => {
|
|
||||||
async.each(Object.keys(self.registration.domains), (subDomainName, eachCb) => {
|
|
||||||
const toSend = registrar.methods.register(utils.sha3(subDomainName),
|
|
||||||
defaultAccount, self.registration.domains[subDomainName]);
|
|
||||||
|
|
||||||
toSend.estimateGas().then(gasEstimated => {
|
|
||||||
return toSend.send({gas: gasEstimated + 1000, from: defaultAccount}).then(transaction => {
|
|
||||||
if (transaction.status !== "0x1" && transaction.status !== "0x01" && transaction.status !== true) {
|
|
||||||
return eachCb('Failed to register. Check gas cost.');
|
|
||||||
}
|
|
||||||
eachCb(null, transaction);
|
|
||||||
}).catch(err => {
|
|
||||||
eachCb('Failed to register with error: ' + (err.message || err));
|
|
||||||
});
|
|
||||||
}).catch(err => {
|
|
||||||
eachCb("Register would error. Is it already registered? Do you have token balance? Is Allowance set? " + (err.message || err));
|
|
||||||
});
|
|
||||||
}, cb);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addENSToEmbarkJS() {
|
addENSToEmbarkJS() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
// get namehash, import it into file
|
// get namehash, import it into file
|
||||||
self.events.request("version:get:eth-ens-namehash", function (EnsNamehashVersion) {
|
self.events.request("version:get:eth-ens-namehash", function(EnsNamehashVersion) {
|
||||||
let currentEnsNamehashVersion = require('../../../package.json').dependencies["eth-ens-namehash"];
|
let currentEnsNamehashVersion = require('../../../package.json').dependencies["eth-ens-namehash"];
|
||||||
if (EnsNamehashVersion !== currentEnsNamehashVersion) {
|
if (EnsNamehashVersion !== currentEnsNamehashVersion) {
|
||||||
self.events.request("version:getPackageLocation", "eth-ens-namehash", EnsNamehashVersion, function (err, location) {
|
self.events.request("version:getPackageLocation", "eth-ens-namehash", EnsNamehashVersion, function(err, location) {
|
||||||
self.embark.registerImportFile("eth-ens-namehash", fs.dappPath(location));
|
self.embark.registerImportFile("eth-ens-namehash", fs.dappPath(location));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user