How to use the bitsharesjs.ChainStore.getAccount function in bitsharesjs

To help you get started, we’ve selected a few bitsharesjs 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 bitshares / bitshares-ui / app / components / Account / AccountVoting.jsx View on Github external
if (!props.initialBudget) {
        missingProps.initialBudget = SettingsStore.getLastBudgetObject();
    }
    if (!props.account) {
        // don't use store listener, user might be looking at different account. this is for reasonable default
        let accountName =
            AccountStore.getState().currentAccount ||
            AccountStore.getState().passwordAccount;
        accountName =
            accountName && accountName !== "null"
                ? accountName
                : "committee-account";
        missingProps.account = accountName;
    }
    if (!props.proxy) {
        const account = ChainStore.getAccount(props.account);
        let proxy = null;
        if (account) {
            proxy = account.getIn(["options", "voting_account"]);
        } else {
            throw "Account must be loaded";
        }
        missingProps.proxy = proxy;
    }

    return ;
};
github bitshares / bitshares-ui / app / lib / common / permission_utils.js View on Github external
account.getIn([type, "account_auths"]).forEach(auth => {
                    let nestedAccount = ChainStore.getAccount(auth.get(0));
                    if (nestedAccount) {
                        accountPermission.accounts.push(
                            this.unravel(
                                new this.AccountPermission(
                                    nestedAccount,
                                    auth.get(1),
                                    type
                                ),
                                type,
                                recursive_count + 1
                            )
                        );
                    }
                });
            }
github bitshares / bitshares-ui / app / components / Modal / SetDefaultFeeAssetModal.jsx View on Github external
componentWillReceiveProps(np) {
        let account = np.account;
        if (!account) {
            account = ChainStore.getAccount(np.currentAccount);
        }

        if (account) {
            if (
                Object.keys(this.state.balances).length === 0 ||
                account.get("name") !== this.props.currentAccount ||
                (np.current_asset &&
                    this.state.selectedAssetId !== np.current_asset)
            ) {
                this._updateStateForAccount(account, np.current_asset);
            }
        }
    }
github bitshares / bitshares-ui / app / components / Account / AccountMembership.jsx View on Github external
render() {
        let {gprops, core_asset} = this.props;

        let account = this.props.account.toJS();

        let ltr = ChainStore.getAccount(account.lifetime_referrer, false);
        if (ltr) account.lifetime_referrer_name = ltr.get("name");
        let ref = ChainStore.getAccount(account.referrer, false);
        if (ref) account.referrer_name = ref.get("name");
        let reg = ChainStore.getAccount(account.registrar, false);
        if (reg) account.registrar_name = reg.get("name");

        let account_name = account.name;

        let network_fee = account.network_fee_percentage / 100;
        let lifetime_fee = account.lifetime_referrer_fee_percentage / 100;
        let referrer_total_fee = 100 - network_fee - lifetime_fee;
        let referrer_fee =
            (referrer_total_fee * account.referrer_rewards_percentage) / 10000;
        let registrar_fee = 100 - referrer_fee - lifetime_fee - network_fee;

        let lifetime_cost =
            (gprops.getIn([
                "parameters",
                "current_fees",
                "parameters",
github GamechainSystem / GameChainBase / GameChainBlockWallet / app / components / Utility / BindToChainState.js View on Github external
let new_obj = ChainStore.getObject(prop);
                    if (new_obj === undefined && this.required_props.indexOf(key) === -1 && new_obj !== this.state[key]) new_state[key] = new_obj;
                    else if (new_obj && new_obj !== this.state[key]) new_state[key] = new_obj;
                    ++all_objects_counter;
                    if (new_obj !== undefined) ++resolved_objects_counter;
                } else {
                    if(this.state[key]) new_state[key] = null;
                }
            }
            for( let key of this.chain_accounts )
            {
                let prop = props[key] || this.dynamic_props[key] || this.default_props[key];
                if(prop) {
                    if(prop[0] === "#" && Number.parseInt(prop.substring(1)))
                        prop = "1.2." + prop.substring(1);
                    let new_obj = ChainStore.getAccount(prop);
                    if (new_obj === undefined && this.required_props.indexOf(key) === -1 && new_obj !== this.state[key]) new_state[key] = new_obj;
                    else if (new_obj && new_obj !== this.state[key]) new_state[key] = new_obj;
                    ++all_objects_counter;
                    if (new_obj !== undefined) ++resolved_objects_counter;
                } else {
                    if(this.state[key]) new_state[key] = null;
                }
            }
            for( let key of this.chain_key_refs )
            {
                let prop = props[key] || this.dynamic_prop[key] || this.default_props[key];
                if(prop) {
                    let new_obj = ChainStore.getAccountRefsOfKey(prop);
                    if (new_obj === undefined && this.required_props.indexOf(key) === -1 && new_obj !== this.state[key]) new_state[key] = new_obj;
                    else if (new_obj && new_obj !== this.state[key]) new_state[key] = new_obj;
                    ++all_objects_counter;
github bitshares / bitshares-ui / app / components / Blockchain / Asset.jsx View on Github external
sorter: (a, b) => {
                        let nameA = ChainStore.getAccount(a.borrower, false);
                        if (nameA) nameA = nameA.get("name");
                        let nameB = ChainStore.getAccount(b.borrower, false);
                        if (nameB) nameB = nameB.get("name");
                        if (nameA > nameB) return 1;
                        if (nameA < nameB) return -1;
                        return 0;
                    },
                    render: item => {
github bitshares / bitshares-ui / app / components / BrowserNotifications / BrowserNotifications.jsx View on Github external
_getAccountNameById(accountId) {
        const account = ChainStore.getAccount(accountId);
        if (!account) return "";
        return account.get("name");
    }
github GamechainSystem / GameChainBase / GameChainBlockWallet / app / components / TransactionConfirm.js View on Github external
onConfirmClick(e) {
        e.preventDefault();
        if (this.props.propose) {
            TransactionConfirmActions.close();
            const propose_options = {
                fee_paying_account: ChainStore.getAccount(this.props.fee_paying_account).get("id")
            };
            this.props.transaction.update_head_block().then(() => {
                WalletDb.process_transaction(this.props.transaction.propose(propose_options), null, true);
            });
        } else
            TransactionConfirmActions.broadcast(this.props.transaction);
    }
github bitshares / bitshares-ui / app / components / PredictionMarkets / PredictionMarketDetailsTable.jsx View on Github external
item => {
                let accountName = ChainStore.getAccount(item.opinionator)
                    ? ChainStore.getAccount(item.opinionator).get("name")
                    : null;
                if (this.props.detailsSearchTerm) {
                    if (
                        (accountName + "\0" + item.opinion)
                            .toUpperCase()
                            .indexOf(this.props.detailsSearchTerm) === -1
                    ) {
                        return false;
                    }
                }
                if (this.props.opinionFilter) {
                    if (this.props.opinionFilter == "all") {
                        return true;
                    } else {
                        if (!(this.props.opinionFilter == item.opinion)) {
github bitshares / bitshares-ui / app / components / Account / AccountSelectorAnt.jsx View on Github external
.map(accountName => {
                    if (this.props.excludeAccounts.indexOf(accountName) !== -1)
                        return null;
                    let account = ChainStore.getAccount(accountName);
                    let account_status = ChainStore.getAccountMemberStatus(
                        account
                    );
                    let account_status_text = !accountUtils.isKnownScammer(
                        accountName
                    )
                        ? "account.member." + account_status
                        : "account.member.suspected_scammer";

                    typeAheadAccounts.push({
                        id: accountName,
                        label: accountName,
                        status: counterpart.translate(account_status_text),
                        className: accountUtils.isKnownScammer(accountName)
                            ? "negative"
                            : "positive"