2017-01-25 18:51:41 +01:00
|
|
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
|
2016-11-22 11:54:20 +01:00
|
|
|
// This file is part of Parity.
|
|
|
|
|
|
|
|
// Parity is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
|
|
|
// Parity is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
import BigNumber from 'bignumber.js';
|
|
|
|
import { action, computed, observable, transaction } from 'mobx';
|
2017-03-10 13:31:57 +01:00
|
|
|
import { flatten } from 'lodash';
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2016-12-05 11:47:13 +01:00
|
|
|
import * as abis from '~/contracts/abi';
|
2017-03-10 13:31:57 +01:00
|
|
|
import Contracts from '~/contracts';
|
2017-04-21 13:14:07 +02:00
|
|
|
import builtinJson from '~/config/dappsBuiltin.json';
|
2017-03-13 12:49:26 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
import Dapp from './dappStore.js';
|
|
|
|
import { deleteDapp, registerDapp, updateDapp } from './utils';
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
import { api, trackRequest } from './parity';
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-13 12:49:26 +01:00
|
|
|
const builtins = builtinJson.filter((app) => app.id);
|
|
|
|
|
2016-11-22 11:54:20 +01:00
|
|
|
let instance = null;
|
|
|
|
|
|
|
|
export default class DappsStore {
|
|
|
|
@observable accounts = [];
|
|
|
|
@observable apps = [];
|
|
|
|
@observable contractOwner = null;
|
|
|
|
@observable count = 0;
|
|
|
|
@observable fee = new BigNumber(0);
|
|
|
|
@observable isContractOwner = false;
|
|
|
|
@observable isLoading = true;
|
2017-03-10 13:31:57 +01:00
|
|
|
@observable transactions = {};
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
_instanceGhh = null;
|
|
|
|
_instanceReg = null;
|
|
|
|
_registry = null;
|
2016-11-22 11:54:20 +01:00
|
|
|
_startTime = Date.now();
|
|
|
|
|
|
|
|
constructor () {
|
|
|
|
this._loadDapps();
|
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
static get () {
|
2016-11-22 11:54:20 +01:00
|
|
|
if (!instance) {
|
|
|
|
instance = new DappsStore();
|
|
|
|
}
|
|
|
|
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
createDappId () {
|
|
|
|
return api.util.sha3(`${this._startTime}_${Date.now()}`);
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@computed get ownedCount () {
|
2017-03-10 13:31:57 +01:00
|
|
|
return this.ownDapps.length;
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@computed get ownDapps () {
|
|
|
|
return this.apps.filter((app) => app.isOwner);
|
|
|
|
}
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@computed get otherDapps () {
|
|
|
|
return this.apps.filter((app) => !app.isOwner);
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@action sortApps = () => {
|
|
|
|
// Sort dapps per name, then per id
|
|
|
|
const sort = (a, b) => {
|
|
|
|
if (a.name && b.name) {
|
|
|
|
return a.name.localeCompare(b.name);
|
|
|
|
}
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
if (a.name) {
|
|
|
|
return -1;
|
|
|
|
}
|
2016-11-25 16:46:57 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
if (b.name) {
|
|
|
|
return 1;
|
2016-11-25 16:46:57 +01:00
|
|
|
}
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
return a.id - b.id;
|
|
|
|
};
|
2017-01-23 13:39:52 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
transaction(() => {
|
|
|
|
const ownDapps = this.ownDapps.sort(sort);
|
|
|
|
const otherDapps = this.otherDapps.sort(sort);
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
this.apps = ownDapps.concat(otherDapps);
|
|
|
|
});
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@action setApps = (dapps) => {
|
|
|
|
const filteredDapps = dapps.filter((dapp) => {
|
|
|
|
return new BigNumber(dapp.id).gt(0);
|
2016-11-22 11:54:20 +01:00
|
|
|
});
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
transaction(() => {
|
|
|
|
this.apps = filteredDapps;
|
|
|
|
this.sortApps();
|
|
|
|
});
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@action refreshApp = (dappId) => {
|
|
|
|
const dapp = this.apps.find((dapp) => dapp.id === dappId);
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
this._loadDapp(dapp);
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@action removeApp = (dappId) => {
|
|
|
|
const dapps = this.apps.filter((dapp) => dapp.id !== dappId);
|
2016-11-22 11:54:20 +01:00
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
this.setApps(dapps);
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@action setAccounts = (accountsInfo) => {
|
|
|
|
transaction(() => {
|
2016-12-23 18:52:02 +01:00
|
|
|
this.accounts = Object
|
2016-11-22 11:54:20 +01:00
|
|
|
.keys(accountsInfo)
|
|
|
|
.map((address) => {
|
|
|
|
const account = accountsInfo[address];
|
2017-01-23 13:39:52 +01:00
|
|
|
|
2016-11-22 11:54:20 +01:00
|
|
|
account.address = address;
|
|
|
|
return account;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
return this.accounts;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action setContractOwner = (contractOwner) => {
|
|
|
|
transaction(() => {
|
|
|
|
this.contractOwner = contractOwner;
|
|
|
|
this.isContractOwner = !!this.accounts.find((account) => account.address === contractOwner);
|
|
|
|
});
|
|
|
|
return contractOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action setCount = (count) => {
|
|
|
|
this.count = count;
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action setFee = (fee) => {
|
|
|
|
this.fee = fee;
|
|
|
|
return fee;
|
|
|
|
}
|
|
|
|
|
|
|
|
@action setLoading = (loading) => {
|
|
|
|
this.isLoading = loading;
|
|
|
|
return loading;
|
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
@action updateTransaction = (requestId, nextData) => {
|
|
|
|
const prevTransaction = this.transactions[requestId] || { requestId };
|
|
|
|
const nextTransaction = {
|
|
|
|
...prevTransaction,
|
|
|
|
hide: false,
|
|
|
|
...nextData
|
|
|
|
};
|
|
|
|
|
|
|
|
this.transactions = {
|
|
|
|
...this.transactions,
|
|
|
|
[ requestId ]: nextTransaction
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchRegistryData (dapp) {
|
|
|
|
const ownerAddress = (dapp.wip && dapp.wip.owner.address) || dapp.owner.address;
|
|
|
|
|
|
|
|
this._registry.reverse
|
|
|
|
.call({}, [ ownerAddress ])
|
|
|
|
.then((name) => {
|
|
|
|
if (!name) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const key = api.util.sha3.text(name);
|
|
|
|
|
|
|
|
return Promise
|
|
|
|
.all([
|
|
|
|
this._registry.get.call({}, [ key, 'IMG' ])
|
|
|
|
.then((bytes) => api.util.bytesToHex(bytes))
|
|
|
|
.then((hash) => this._instanceGhh.entries.call({}, [ hash ])),
|
|
|
|
this._registry.get.call({}, [ key, 'CONTENT' ])
|
|
|
|
.then((bytes) => api.util.bytesToHex(bytes))
|
|
|
|
.then((hash) => this._instanceGhh.entries.call({}, [ hash ]))
|
|
|
|
])
|
|
|
|
.then(([ imageGHH, contentGHH ]) => {
|
|
|
|
const imageUrl = imageGHH[0];
|
|
|
|
const contentUrl = contentGHH[0];
|
|
|
|
|
|
|
|
return dapp.update({
|
|
|
|
image: imageUrl,
|
|
|
|
content: contentUrl
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
register (dappId) {
|
|
|
|
const dappRegInstance = this._instanceReg;
|
|
|
|
const dappRegFee = this.fee;
|
|
|
|
|
|
|
|
return registerDapp(dappId, dappRegInstance, dappRegFee)
|
|
|
|
.then((request) => this.trackRequest(request, `Registering ${dappId}`))
|
|
|
|
.then(() => this._loadDapps());
|
|
|
|
}
|
|
|
|
|
|
|
|
delete (dapp) {
|
|
|
|
const dappRegInstance = this._instanceReg;
|
|
|
|
|
|
|
|
return deleteDapp(dapp, dappRegInstance)
|
|
|
|
.then((request) => this.trackRequest(request, `Deleting ${dapp.id}`))
|
|
|
|
.then(() => this._loadDapps());
|
|
|
|
}
|
|
|
|
|
|
|
|
update (dappId, dappOwner, updates) {
|
|
|
|
const dappRegInstance = this._instanceReg;
|
|
|
|
const ghhRegInstance = this._instanceGhh;
|
|
|
|
|
|
|
|
const promises = updateDapp(dappId, dappOwner, updates, dappRegInstance, ghhRegInstance);
|
|
|
|
const handledPromises = promises.map((promise) => {
|
|
|
|
return promise
|
|
|
|
.then((requests) => {
|
|
|
|
const requestPromises = flatten([].concat(requests))
|
|
|
|
.filter((request) => request)
|
|
|
|
.map((request) => this.trackRequest(request.id, request.name));
|
|
|
|
|
|
|
|
return Promise.all(requestPromises);
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
const randomRequestId = api.util.sha3(Date.now()).slice(0, 5);
|
|
|
|
|
|
|
|
this.updateTransaction(randomRequestId, { start: Date.now(), error });
|
|
|
|
});
|
2016-11-22 11:54:20 +01:00
|
|
|
});
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
return Promise.all(handledPromises)
|
|
|
|
.then(() => this._loadDapps());
|
|
|
|
}
|
|
|
|
|
|
|
|
trackRequest (requestId, name) {
|
|
|
|
const statusCallback = (error, data) => {
|
|
|
|
if (error) {
|
|
|
|
return this.updateTransaction(requestId, { error });
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.updateTransaction(requestId, data);
|
|
|
|
};
|
|
|
|
|
|
|
|
this.updateTransaction(requestId, { name, start: Date.now() });
|
|
|
|
return trackRequest(requestId, statusCallback);
|
2016-11-22 11:54:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
lookupHash (hash) {
|
|
|
|
return this._retrieveUrl(hash);
|
|
|
|
}
|
|
|
|
|
|
|
|
_getCount () {
|
|
|
|
return this._instanceReg
|
|
|
|
.count.call()
|
|
|
|
.then((count) => {
|
|
|
|
this.setCount(count.toNumber());
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:getCount', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getFee () {
|
|
|
|
return this._instanceReg
|
|
|
|
.fee.call()
|
|
|
|
.then(this.setFee)
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:getFee', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getOwner () {
|
|
|
|
return this._instanceReg
|
|
|
|
.owner.call()
|
|
|
|
.then(this.setContractOwner)
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:getOwner', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_loadDapps () {
|
|
|
|
return this._loadRegistry()
|
|
|
|
.then(() => Promise.all([
|
|
|
|
this._attachContracts(),
|
|
|
|
this._loadAccounts()
|
|
|
|
]))
|
|
|
|
.then(() => Promise.all([
|
|
|
|
this._getCount(),
|
|
|
|
this._getFee(),
|
|
|
|
this._getOwner()
|
|
|
|
]))
|
|
|
|
.then(() => {
|
|
|
|
const promises = [];
|
|
|
|
|
|
|
|
for (let index = 0; index < this.count; index++) {
|
|
|
|
promises.push(this._instanceReg.at.call({}, [index]));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
})
|
2017-03-10 13:31:57 +01:00
|
|
|
.then((dappsInfo) => {
|
|
|
|
const dapps = dappsInfo.reduce((dapps, [dappId, ownerAddress]) => {
|
|
|
|
const id = api.util.bytesToHex(dappId);
|
|
|
|
const owner = this.accounts.find((account) => account.address === ownerAddress);
|
|
|
|
const isOwner = !!owner;
|
|
|
|
const dapp = {
|
|
|
|
id,
|
|
|
|
owner: owner || { address: ownerAddress },
|
|
|
|
isOwner
|
|
|
|
};
|
|
|
|
|
|
|
|
dapps[id] = dapp;
|
|
|
|
return dapps;
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
const promises = Object.values(dapps)
|
|
|
|
// Only show dapps with id and owners
|
|
|
|
.filter((dapp) => dapp.id && dapp.owner && !/^(0x)?0*$/.test(dapp.owner.address))
|
|
|
|
.map((dapp) => this._loadDapp(dapp));
|
|
|
|
|
|
|
|
return Promise.all(promises);
|
2016-11-22 11:54:20 +01:00
|
|
|
})
|
2017-03-10 13:31:57 +01:00
|
|
|
.then((dapps) => {
|
|
|
|
this.setApps(dapps);
|
2016-11-22 11:54:20 +01:00
|
|
|
this.sortApps();
|
2016-11-25 16:46:57 +01:00
|
|
|
this.setLoading(false);
|
2016-11-22 11:54:20 +01:00
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:loadDapps', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-10 13:31:57 +01:00
|
|
|
_loadDapp = (dappData) => {
|
|
|
|
const { id, owner, isOwner } = dappData;
|
|
|
|
|
2016-11-22 11:54:20 +01:00
|
|
|
return Promise
|
|
|
|
.all([
|
2017-03-10 13:31:57 +01:00
|
|
|
this._loadMeta(id, 'CONTENT'),
|
|
|
|
this._loadMeta(id, 'IMG'),
|
|
|
|
this._loadMeta(id, 'MANIFEST')
|
2016-11-22 11:54:20 +01:00
|
|
|
])
|
|
|
|
.then(([contentHash, imageHash, manifestHash]) => {
|
|
|
|
return Promise
|
|
|
|
.all([
|
|
|
|
this._retrieveUrl(contentHash),
|
|
|
|
this._retrieveUrl(imageHash),
|
|
|
|
this._retrieveUrl(manifestHash)
|
|
|
|
])
|
|
|
|
.then(([contentUrl, imageUrl, manifestUrl]) => {
|
|
|
|
return this
|
2017-03-10 13:31:57 +01:00
|
|
|
._loadManifest(id, manifestHash, manifestUrl)
|
|
|
|
.then((manifestContent) => {
|
|
|
|
const content = {
|
|
|
|
hash: contentHash,
|
|
|
|
url: contentUrl
|
|
|
|
};
|
|
|
|
|
|
|
|
const image = {
|
|
|
|
hash: imageHash,
|
|
|
|
url: imageUrl
|
|
|
|
};
|
|
|
|
|
|
|
|
const manifest = {
|
|
|
|
content: manifestContent,
|
|
|
|
hash: manifestHash,
|
|
|
|
url: manifestUrl
|
|
|
|
};
|
|
|
|
|
|
|
|
return { content, image, manifest };
|
2016-11-22 11:54:20 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
2017-03-10 13:31:57 +01:00
|
|
|
console.error('dappsStore::loadDapp', error);
|
|
|
|
return {};
|
|
|
|
})
|
|
|
|
.then((data) => {
|
|
|
|
const { content, image, manifest } = data;
|
|
|
|
|
|
|
|
const dapp = new Dapp({
|
|
|
|
contractOwner: this.contractOwner,
|
|
|
|
isContractOwner: this.isContractOwner,
|
|
|
|
id,
|
|
|
|
content,
|
|
|
|
image,
|
|
|
|
manifest,
|
|
|
|
owner,
|
|
|
|
isOwner
|
|
|
|
});
|
|
|
|
|
|
|
|
return dapp;
|
2016-11-22 11:54:20 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_loadMeta (appId, key) {
|
|
|
|
return this._instanceReg
|
|
|
|
.meta.call({}, [appId, key])
|
|
|
|
.then((meta) => {
|
|
|
|
const hash = api.util.bytesToHex(meta);
|
|
|
|
const bnhash = new BigNumber(hash);
|
|
|
|
|
|
|
|
return bnhash.gt(0)
|
|
|
|
? hash
|
|
|
|
: null;
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:loadMeta', error);
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_loadManifest (appId, manifestHash) {
|
|
|
|
const builtin = builtins.find((app) => app.id === appId);
|
|
|
|
|
|
|
|
if (builtin) {
|
|
|
|
return Promise.resolve(builtin);
|
2017-03-10 13:31:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!manifestHash) {
|
2016-11-22 11:54:20 +01:00
|
|
|
return Promise.resolve(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
return fetch(`/api/content/${manifestHash.substr(2)}/`, { redirect: 'follow', mode: 'cors' })
|
|
|
|
.then((response) => {
|
|
|
|
return response.ok
|
|
|
|
? response.json()
|
|
|
|
: null;
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:loadManifest', error);
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_retrieveUrl (urlHash) {
|
|
|
|
if (!urlHash) {
|
|
|
|
return Promise.resolve(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this._instanceGhh
|
|
|
|
.entries.call({}, [urlHash])
|
|
|
|
.then(([repo, _commit, owner]) => {
|
|
|
|
const bnowner = new BigNumber(owner);
|
|
|
|
|
|
|
|
if (bnowner.eq(0)) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const commit = api.util.bytesToHex(_commit);
|
|
|
|
const bncommit = new BigNumber(commit);
|
|
|
|
|
|
|
|
if (bncommit.eq(0)) {
|
|
|
|
return repo;
|
|
|
|
} else {
|
|
|
|
return `https://codeload.github.com/${repo}/zip/${commit.substr(2)}`;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:retriveUrl', error);
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_loadAccounts () {
|
|
|
|
return api.parity
|
2016-12-23 18:52:02 +01:00
|
|
|
.accountsInfo()
|
2016-11-22 11:54:20 +01:00
|
|
|
.then(this.setAccounts)
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:loadAccounts', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_loadRegistry () {
|
2017-04-21 13:14:07 +02:00
|
|
|
return Contracts.get(api).registry
|
2017-03-10 13:31:57 +01:00
|
|
|
.fetchContract()
|
|
|
|
.then((contract) => {
|
|
|
|
this._registry = contract.instance;
|
2016-11-22 11:54:20 +01:00
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:loadRegistry', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_attachContracts () {
|
|
|
|
return Promise
|
|
|
|
.all([
|
|
|
|
this._registry.getAddress.call({}, [api.util.sha3('dappreg'), 'A']),
|
|
|
|
this._registry.getAddress.call({}, [api.util.sha3('githubhint'), 'A'])
|
|
|
|
])
|
|
|
|
.then(([dappregAddress, ghhAddress]) => {
|
|
|
|
console.log(`dappreg was found at ${dappregAddress}`);
|
2017-03-10 13:31:57 +01:00
|
|
|
console.log(`githubhint was found at ${ghhAddress}`);
|
|
|
|
|
2016-11-22 11:54:20 +01:00
|
|
|
this._contractReg = api.newContract(abis.dappreg, dappregAddress);
|
|
|
|
this._instanceReg = this._contractReg.instance;
|
2017-03-10 13:31:57 +01:00
|
|
|
|
2016-11-22 11:54:20 +01:00
|
|
|
this._contractGhh = api.newContract(abis.githubhint, ghhAddress);
|
|
|
|
this._instanceGhh = this._contractGhh.instance;
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Store:attachContract', error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|