Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 ;
};
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
)
);
}
});
}
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);
}
}
}
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",
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;
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 => {
_getAccountNameById(accountId) {
const account = ChainStore.getAccount(accountId);
if (!account) return "";
return account.get("name");
}
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);
}
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)) {
.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"