How to use gxbjs-ws - 10 common examples

To help you get started, we’ve selected a few gxbjs-ws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gxchain / gxb-box / lib / index.js View on Github external
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);
github gxchain / gxchain-light / web / app / components / Account / AccountVoting.jsx View on Github external
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);
        });
    }
github gxchain / gxchain-light / web / app / components / Account / AccountVesting.jsx View on Github external
retrieveVestingBalances(accountId) {
        Apis.instance().db_api().exec("get_vesting_balances", [
            accountId
        ]).then(vbs => {
            this.setState({vbs});
        }).catch(err => {
            console.log("error:", err);
        });
    }
github gxchain / gxchain-light / web / app / components / DataMarket / LeagueDetail.jsx View on Github external
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
                })
github gxchain / gxchain-light / web / app / components / Dashboard / DataProductList.jsx View on Github external
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
github gxchain / gxchain-light / web / app / components / DataMarket / DataMarketDetail.jsx View on Github external
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
                })
github gxchain / gxchain-light / web / app / actions / MarketsActions.js View on Github external
return (dispatch) => {
            Apis.instance().db_api().exec("get_settle_orders", [
                asset, 100
            ]).then(result => {
                dispatch({
                    settles: result
                });
            });
        };
    }
github gxchain / gxb-box / lib / services / GXChainService.js View on Github external
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);
        });
    });
};
github gxchain / gxchain-light / app / stores / SettingsStore.js View on Github external
_getChainKey(key) {
        const chainId = Apis.instance().chain_id;
        return key + (chainId ? `_${chainId.substr(0, 8)}` : "");
    }
}
github gxchain / gxchain-light / web / app / stores / SettingsStore.js View on Github external
_getChainKey(key) {
        const chainId = Apis.instance().chain_id;
        return key + (chainId ? `_${chainId.substr(0, 8)}` : "");
    }
}

gxbjs-ws

Pure JavaScript GXChain websocket interface for node.js and browsers.

MIT
Latest version published 4 years ago

Package Health Score

40 / 100
Full package analysis

Popular gxbjs-ws functions

Similar packages