Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Promise.all(promises).then(function () {
// 订阅数据交易广播
// Apis.instance().db_api().exec('unsubscribe_from_transaction', [subscriber, true])
Apis.instance().db_api().exec('set_data_transaction_subscribe_callback', [subscriber, true]);
console.log('已订阅数据交易事件');
startServer();
MerchantTask.resume();
}).catch((ex) => {
let isNotSync = /ChainStore sync error/.test(ex.message);
fetchAllTrustedNodes() {
Apis.instance().db_api().exec('get_trust_nodes', []).then(nodes => {
this.setState({
trust_nodes: Immutable.fromJS(nodes)
});
}).catch(ex => {
console.error('Error fetching trusted nodes: ', ex);
});
}
retrieveVestingBalances(accountId) {
Apis.instance().db_api().exec("get_vesting_balances", [
accountId
]).then(vbs => {
this.setState({vbs});
}).catch(err => {
console.log("error:", err);
});
}
loadLeague() {
let self = this;
this.setState(Object.assign(this.state, defaultState, {id: this.props.router.params.id, loading: true}));
Apis.instance().db_api().exec('get_leagues', [[this.props.router.params.id]]).then(function (res) {
var result = res && res.length > 0 ? res[0] : {};
Apis.instance().db_api().exec('get_data_market_categories', [[result.category_id]]).then(function (res) {
var result = res && res.length > 0 ? res[0] : {};
self.setState({
category_name: result.category_name
});
}).catch(err=> {
console.error('error on fetching data market category', err);
notify.addNotification({
message: `加载产品分类失败`,
level: "error",
autoDismiss: 5
});
self.setState({
loading: false
})
loadCategories() {
let self = this;
Apis.instance().db_api().exec("list_data_market_categories", [1]).then(function (res) {
res = (res || []).filter(function (cate) {
return cate.status == 1;
});
self.setState({
categories: res
});
let currentCategory = res && res.length > 0 ? res[0] : {};
if (currentCategory.id) {
self.onChangeCategory(currentCategory);
}
}).catch(function (err) {
console.error("error on fetching data products", err);
notify.addNotification({
message: "加载行业目录失败",
level: "error",
autoDismiss: 5
loadDataProduct() {
let self = this;
this.setState(Object.assign(this.state, defaultState, {id: this.props.router.params.id, loading: true}));
Apis.instance().db_api().exec('get_free_data_products', [[this.props.router.params.id]]).then(function (res) {
var result = res && res.length > 0 ? res[0] : {};
Apis.instance().db_api().exec('get_data_market_categories', [[result.category_id]]).then(function (res) {
var result = res && res.length > 0 ? res[0] : {};
self.setState({
category_name: result.category_name
});
}).catch(err=> {
console.error('error on fetching data market category', err);
notify.addNotification({
message: `加载产品分类失败`,
level: "error",
autoDismiss: 5
});
self.setState({
loading: false
})
return (dispatch) => {
Apis.instance().db_api().exec("get_settle_orders", [
asset, 100
]).then(result => {
dispatch({
settles: result
});
});
};
}
return new Promise(function (resolve, reject) {
return Apis.instance().db_api().exec('get_data_transaction_by_request_id', [request_id]).then(function (resp) {
resolve(resp);
}).catch(function (ex) {
reject(ex);
});
});
};
_getChainKey(key) {
const chainId = Apis.instance().chain_id;
return key + (chainId ? `_${chainId.substr(0, 8)}` : "");
}
}
_getChainKey(key) {
const chainId = Apis.instance().chain_id;
return key + (chainId ? `_${chainId.substr(0, 8)}` : "");
}
}