Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(({ account, ...rest }) => {
const bridge = getAccountBridge(account, null);
if (!bridge) throw new Error("no bridge for " + account.id);
let accountSyncedPromise;
// lazy eval so we don't run this yet
const getSynced = () =>
accountSyncedPromise ||
(accountSyncedPromise = syncAccount(bridge, account));
return { getSynced, bridge, initialAccount: account, ...rest };
})
.forEach(arg => {
render() {
const { navigation, account } = this.props;
const bridge = getAccountBridge(account);
return (
}
desc={}
arrowRight
alignedTop
onPress={() =>
navigation.navigate("EditAccountNode", {
accountId: account.id,
})
}
>
onAcceptFees = async () => {
const { account, parentAccount, navigation } = this.props;
if (!account) return;
const transaction = navigation.getParam("transaction");
const bridge = getAccountBridge(account, parentAccount);
const mainAccount = getMainAccount(account, parentAccount);
await bridge.checkValidTransaction(mainAccount, transaction);
navigation.navigate("SendConnectDevice", {
accountId: account.id,
parentId: parentAccount && parentAccount.id,
transaction,
});
this.setState({ highFeesOpen: false });
};
export const editTxFeeByFamily = (
account: Account,
navigation: NavigationScreenProp<*>,
field: string,
fee: ?BigNumber,
) => {
const transaction = navigation.getParam("transaction");
const bridge = getAccountBridge(account);
return bridge.editTransactionExtra(account, transaction, field, fee);
};
defer(() =>
getAccountBridge(account)
.getTransactionStatus(account, transaction)
.then(status => ({ transaction, status }))
)
onResult = (result: string) => {
const { account, parentAccount, navigation } = this.props;
if (!account) return;
const bridge = getAccountBridge(account, parentAccount);
const { amount, address, currency, ...rest } = decodeURIScheme(result);
const transaction = navigation.getParam("transaction");
const patch: Object = {};
patch.recipient = address;
if (amount) {
patch.amount = amount;
}
for (const k in rest) {
if (k in transaction) {
patch[k] = rest[k];
}
}
this.props.navigation.navigate("SendSelectRecipient", {
accountId: account.id,
parentId: parentAccount && parentAccount.id,
return
}
const account = this.props.accounts.find(a => a.id === accountId)
if (!account) {
next()
return
}
const downStatus = currencyDownStatusLocal(this.props.currenciesStatus, account.currency)
if (downStatus && !downStatus.keepSync) {
next()
return
}
try {
const bridge = getAccountBridge(account)
this.props.setAccountSyncState(accountId, { pending: true, error: null })
const startSyncTime = Date.now()
const trackedRecently =
lastTimeAnalyticsTrackPerAccountId[accountId] &&
startSyncTime - lastTimeAnalyticsTrackPerAccountId[accountId] < 90 * 1000
if (!trackedRecently) {
lastTimeAnalyticsTrackPerAccountId[accountId] = startSyncTime
}
const trackEnd = event => {
if (trackedRecently) return
const account = this.props.accounts.find(a => a.id === accountId)
if (!account) return
const subAccounts = account.subAccounts || []
track(event, {
duration: (Date.now() - startSyncTime) / 1000,
updateTransaction = (item: any) => {
const { account, navigation } = this.props;
const transaction = navigation.getParam("transaction");
const bridge = getAccountBridge(account);
navigation.setParams({
transaction: bridge.editTransactionExtra(
account,
transaction,
"feeCustomUnit",
item,
),
});
this.onRequestClose();
};
validateNode = async () => {
const { account } = this.props;
const { accountNode } = this.state;
const bridge = getAccountBridge(account);
try {
if (bridge.validateEndpointConfig) {
await bridge.validateEndpointConfig(accountNode);
}
return true;
} catch (error) {
this.setState({ error });
return false;
}
};
const EditFeeUnitEthereum = ({
account,
parentAccount,
transaction,
t,
navigation,
}: Props) => {
const { setAccount, setTransaction } = useBridgeTransaction();
useMemo(() => {
setAccount(account, parentAccount);
setTransaction(transaction);
}, [setAccount, setTransaction, account, parentAccount, transaction]);
const mainAccount = getMainAccount(account, parentAccount);
const bridge = getAccountBridge(account, parentAccount);
const [gasPrice, setGasPrice] = useState(() => transaction.gasPrice);
const feeCustomUnit = transaction.feeCustomUnit;
const onChangeF = useCallback(
value => {
const { gasPrice } = bridge.updateTransaction(transaction, {
gasPrice: value,
});
setGasPrice(gasPrice);
},
[bridge, transaction],
);
const onValidateFees = useCallback(() => {
navigation.navigate("SendSummary", {