2022-09-26 00:08:27 +02:00
|
|
|
import React, { useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
2023-10-20 04:28:49 +02:00
|
|
|
import { View, ActivityIndicator, Text, TouchableOpacity, StyleSheet, BackHandler } from 'react-native';
|
2020-12-25 17:09:53 +01:00
|
|
|
import { Icon } from 'react-native-elements';
|
2023-11-15 09:40:22 +01:00
|
|
|
import { useNavigation, useRoute } from '@react-navigation/native';
|
2022-01-28 12:13:53 +01:00
|
|
|
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
|
2020-12-25 17:09:53 +01:00
|
|
|
|
2023-11-15 09:40:22 +01:00
|
|
|
import { BlueCard, BlueLoading, BlueSpacing10, BlueSpacing20, BlueText, SafeBlueArea } from '../../BlueComponents';
|
2023-03-04 18:51:11 +01:00
|
|
|
import TransactionIncomingIcon from '../../components/icons/TransactionIncomingIcon';
|
|
|
|
import TransactionOutgoingIcon from '../../components/icons/TransactionOutgoingIcon';
|
|
|
|
import TransactionPendingIcon from '../../components/icons/TransactionPendingIcon';
|
2020-12-25 17:09:53 +01:00
|
|
|
import navigationStyle from '../../components/navigationStyle';
|
2022-01-28 12:13:53 +01:00
|
|
|
import HandoffComponent from '../../components/handoff';
|
2020-03-11 20:16:51 +01:00
|
|
|
import { HDSegwitBech32Transaction } from '../../class';
|
2019-08-10 08:57:55 +02:00
|
|
|
import { BitcoinUnit } from '../../models/bitcoinUnits';
|
2020-07-20 15:38:46 +02:00
|
|
|
import loc, { formatBalanceWithoutSuffix } from '../../loc';
|
2020-10-24 19:20:59 +02:00
|
|
|
import { BlueStorageContext } from '../../blue_modules/storage-context';
|
2021-08-27 17:14:29 +02:00
|
|
|
import * as BlueElectrum from '../../blue_modules/BlueElectrum';
|
2023-11-15 09:40:22 +01:00
|
|
|
import { useTheme } from '../../components/themes';
|
|
|
|
import Button from '../../components/Button';
|
2020-12-25 17:09:53 +01:00
|
|
|
|
2019-08-10 08:57:55 +02:00
|
|
|
const buttonStatus = Object.freeze({
|
|
|
|
possible: 1,
|
|
|
|
unknown: 2,
|
|
|
|
notPossible: 3,
|
|
|
|
});
|
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
const TransactionsStatus = () => {
|
2021-12-17 11:41:18 +01:00
|
|
|
const { setSelectedWallet, wallets, txMetadata, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext);
|
|
|
|
const { hash, walletID } = useRoute().params;
|
2021-08-27 17:14:29 +02:00
|
|
|
const { navigate, setOptions, goBack } = useNavigation();
|
2020-11-30 04:26:25 +01:00
|
|
|
const { colors } = useTheme();
|
2021-12-17 11:41:18 +01:00
|
|
|
const wallet = useRef(wallets.find(w => w.getID() === walletID));
|
2020-12-02 06:24:01 +01:00
|
|
|
const [isCPFPPossible, setIsCPFPPossible] = useState();
|
|
|
|
const [isRBFBumpFeePossible, setIsRBFBumpFeePossible] = useState();
|
|
|
|
const [isRBFCancelPossible, setIsRBFCancelPossible] = useState();
|
2021-02-10 18:41:51 +01:00
|
|
|
const [tx, setTX] = useState();
|
2020-11-30 04:26:25 +01:00
|
|
|
const [isLoading, setIsLoading] = useState(true);
|
2021-08-27 17:14:29 +02:00
|
|
|
const fetchTxInterval = useRef();
|
|
|
|
const [intervalMs, setIntervalMs] = useState(1000);
|
|
|
|
const [eta, setEta] = useState('');
|
2020-11-30 04:26:25 +01:00
|
|
|
const stylesHook = StyleSheet.create({
|
|
|
|
value: {
|
|
|
|
color: colors.alternativeTextColor2,
|
|
|
|
},
|
|
|
|
valueUnit: {
|
|
|
|
color: colors.alternativeTextColor2,
|
|
|
|
},
|
|
|
|
iconRoot: {
|
|
|
|
backgroundColor: colors.success,
|
|
|
|
},
|
2021-09-08 01:46:09 +02:00
|
|
|
detailsText: {
|
|
|
|
color: colors.buttonTextColor,
|
|
|
|
},
|
|
|
|
details: {
|
|
|
|
backgroundColor: colors.lightButton,
|
|
|
|
},
|
2020-11-30 04:26:25 +01:00
|
|
|
});
|
|
|
|
|
2020-12-02 06:24:01 +01:00
|
|
|
useEffect(() => {
|
|
|
|
setIsCPFPPossible(buttonStatus.unknown);
|
|
|
|
setIsRBFBumpFeePossible(buttonStatus.unknown);
|
|
|
|
setIsRBFCancelPossible(buttonStatus.unknown);
|
|
|
|
}, []);
|
|
|
|
|
2022-09-26 00:08:27 +02:00
|
|
|
useLayoutEffect(() => {
|
2020-11-30 04:26:25 +01:00
|
|
|
setOptions({
|
2023-07-25 15:50:04 +02:00
|
|
|
// eslint-disable-next-line react/no-unstable-nested-components
|
2021-09-05 19:35:08 +02:00
|
|
|
headerRight: () => (
|
2021-09-06 19:21:09 +02:00
|
|
|
<TouchableOpacity
|
|
|
|
accessibilityRole="button"
|
|
|
|
testID="TransactionDetailsButton"
|
2021-09-08 01:46:09 +02:00
|
|
|
style={[styles.details, stylesHook.details]}
|
2021-09-06 19:21:09 +02:00
|
|
|
onPress={navigateToTransactionDetials}
|
|
|
|
>
|
2021-09-08 01:46:09 +02:00
|
|
|
<Text style={[styles.detailsText, stylesHook.detailsText]}>{loc.send.create_details}</Text>
|
2021-09-05 19:35:08 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
),
|
2020-11-30 04:26:25 +01:00
|
|
|
});
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2021-09-07 00:35:54 +02:00
|
|
|
}, [colors, tx]);
|
2020-11-30 04:26:25 +01:00
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
useEffect(() => {
|
2023-07-25 15:50:04 +02:00
|
|
|
for (const newTx of wallet.current.getTransactions()) {
|
|
|
|
if (newTx.hash === hash) {
|
|
|
|
setTX(newTx);
|
2021-02-10 18:41:51 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2021-12-17 11:41:18 +01:00
|
|
|
}, [hash, wallet.current]);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
wallet.current = wallets.find(w => w.getID() === walletID);
|
|
|
|
}, [walletID, wallets]);
|
2021-02-10 18:41:51 +01:00
|
|
|
|
2021-08-27 17:14:29 +02:00
|
|
|
// re-fetching tx status periodically
|
|
|
|
useEffect(() => {
|
|
|
|
console.log('transactionStatus - useEffect');
|
|
|
|
|
|
|
|
if (!tx || tx?.confirmations) return;
|
|
|
|
if (!hash) return;
|
|
|
|
|
|
|
|
if (fetchTxInterval.current) {
|
|
|
|
// interval already exists, lets cleanup it and recreate, so theres no duplicate intervals
|
|
|
|
clearInterval(fetchTxInterval.current);
|
|
|
|
fetchTxInterval.current = undefined;
|
|
|
|
}
|
|
|
|
|
|
|
|
console.log('setting up interval to check tx...');
|
|
|
|
fetchTxInterval.current = setInterval(async () => {
|
|
|
|
try {
|
|
|
|
setIntervalMs(31000); // upon first execution we increase poll interval;
|
|
|
|
|
|
|
|
console.log('checking tx', hash, 'for confirmations...');
|
|
|
|
const transactions = await BlueElectrum.multiGetTransactionByTxid([hash], 10, true);
|
|
|
|
const txFromElectrum = transactions[hash];
|
|
|
|
console.log('got txFromElectrum=', txFromElectrum);
|
|
|
|
|
|
|
|
const address = (txFromElectrum?.vout[0]?.scriptPubKey?.addresses || []).pop();
|
|
|
|
|
|
|
|
if (txFromElectrum && !txFromElectrum.confirmations && txFromElectrum.vsize && address) {
|
|
|
|
const txsM = await BlueElectrum.getMempoolTransactionsByAddress(address);
|
|
|
|
let txFromMempool;
|
|
|
|
// searhcing for a correct tx in case this address has several pending txs:
|
|
|
|
for (const tempTxM of txsM) {
|
|
|
|
if (tempTxM.tx_hash === hash) txFromMempool = tempTxM;
|
|
|
|
}
|
|
|
|
if (!txFromMempool) return;
|
|
|
|
console.log('txFromMempool=', txFromMempool);
|
|
|
|
|
|
|
|
const satPerVbyte = Math.round(txFromMempool.fee / txFromElectrum.vsize);
|
|
|
|
const fees = await BlueElectrum.estimateFees();
|
|
|
|
console.log('fees=', fees, 'satPerVbyte=', satPerVbyte);
|
|
|
|
if (satPerVbyte >= fees.fast) {
|
|
|
|
setEta(loc.formatString(loc.transactions.eta_10m));
|
|
|
|
}
|
|
|
|
if (satPerVbyte >= fees.medium && satPerVbyte < fees.fast) {
|
|
|
|
setEta(loc.formatString(loc.transactions.eta_3h));
|
|
|
|
}
|
|
|
|
if (satPerVbyte < fees.medium) {
|
|
|
|
setEta(loc.formatString(loc.transactions.eta_1d));
|
|
|
|
}
|
|
|
|
} else if (txFromElectrum.confirmations > 0) {
|
|
|
|
// now, handling a case when tx became confirmed!
|
|
|
|
ReactNativeHapticFeedback.trigger('notificationSuccess', { ignoreAndroidSystemSettings: false });
|
|
|
|
setEta('');
|
|
|
|
setTX(prevState => {
|
|
|
|
return Object.assign({}, prevState, { confirmations: txFromElectrum.confirmations });
|
|
|
|
});
|
|
|
|
clearInterval(fetchTxInterval.current);
|
|
|
|
fetchTxInterval.current = undefined;
|
|
|
|
wallet?.current?.getID() && fetchAndSaveWalletTransactions(wallet.current.getID());
|
|
|
|
}
|
|
|
|
} catch (error) {
|
|
|
|
console.log(error);
|
|
|
|
}
|
|
|
|
}, intervalMs);
|
|
|
|
}, [hash, intervalMs, tx, fetchAndSaveWalletTransactions]);
|
|
|
|
|
|
|
|
const handleBackButton = () => {
|
|
|
|
goBack(null);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
BackHandler.addEventListener('hardwareBackPress', handleBackButton);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
BackHandler.removeEventListener('hardwareBackPress', handleBackButton);
|
|
|
|
clearInterval(fetchTxInterval.current);
|
|
|
|
fetchTxInterval.current = undefined;
|
|
|
|
};
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
|
|
|
2020-11-30 17:28:50 +01:00
|
|
|
const initialState = async () => {
|
|
|
|
try {
|
|
|
|
await checkPossibilityOfCPFP();
|
|
|
|
await checkPossibilityOfRBFBumpFee();
|
|
|
|
await checkPossibilityOfRBFCancel();
|
|
|
|
} catch (e) {
|
|
|
|
setIsCPFPPossible(buttonStatus.notPossible);
|
|
|
|
setIsRBFBumpFeePossible(buttonStatus.notPossible);
|
|
|
|
setIsRBFCancelPossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
setIsLoading(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
initialState();
|
|
|
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2020-12-07 22:49:56 +01:00
|
|
|
}, [tx, wallets]);
|
2020-11-30 17:28:50 +01:00
|
|
|
|
2020-11-30 04:26:25 +01:00
|
|
|
useEffect(() => {
|
2023-07-25 15:50:04 +02:00
|
|
|
const wID = wallet.current?.getID();
|
|
|
|
if (wID) {
|
2021-02-24 16:03:49 +01:00
|
|
|
setSelectedWallet(wallet.current?.getID());
|
2020-11-30 04:26:25 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
2021-02-24 16:03:49 +01:00
|
|
|
}, [wallet.current]);
|
2020-11-30 04:26:25 +01:00
|
|
|
|
|
|
|
useEffect(() => {
|
2021-08-27 17:14:29 +02:00
|
|
|
console.log('transactionStatus - useEffect');
|
2020-11-30 04:26:25 +01:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
const checkPossibilityOfCPFP = async () => {
|
2021-02-10 18:41:51 +01:00
|
|
|
if (!wallet.current.allowRBF()) {
|
2020-11-30 04:26:25 +01:00
|
|
|
return setIsCPFPPossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
const cpfbTx = new HDSegwitBech32Transaction(null, tx.hash, wallet.current);
|
2020-11-30 04:26:25 +01:00
|
|
|
if ((await cpfbTx.isToUsTransaction()) && (await cpfbTx.getRemoteConfirmationsNum()) === 0) {
|
|
|
|
return setIsCPFPPossible(buttonStatus.possible);
|
|
|
|
} else {
|
|
|
|
return setIsCPFPPossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const checkPossibilityOfRBFBumpFee = async () => {
|
2021-02-10 18:41:51 +01:00
|
|
|
if (!wallet.current.allowRBF()) {
|
2020-11-30 04:26:25 +01:00
|
|
|
return setIsRBFBumpFeePossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
const rbfTx = new HDSegwitBech32Transaction(null, tx.hash, wallet.current);
|
2020-11-30 04:26:25 +01:00
|
|
|
if (
|
|
|
|
(await rbfTx.isOurTransaction()) &&
|
|
|
|
(await rbfTx.getRemoteConfirmationsNum()) === 0 &&
|
|
|
|
(await rbfTx.isSequenceReplaceable()) &&
|
|
|
|
(await rbfTx.canBumpTx())
|
|
|
|
) {
|
|
|
|
return setIsRBFBumpFeePossible(buttonStatus.possible);
|
|
|
|
} else {
|
|
|
|
return setIsRBFBumpFeePossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const checkPossibilityOfRBFCancel = async () => {
|
2021-02-10 18:41:51 +01:00
|
|
|
if (!wallet.current.allowRBF()) {
|
2020-11-30 04:26:25 +01:00
|
|
|
return setIsRBFCancelPossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
const rbfTx = new HDSegwitBech32Transaction(null, tx.hash, wallet.current);
|
2020-11-30 04:26:25 +01:00
|
|
|
if (
|
|
|
|
(await rbfTx.isOurTransaction()) &&
|
|
|
|
(await rbfTx.getRemoteConfirmationsNum()) === 0 &&
|
|
|
|
(await rbfTx.isSequenceReplaceable()) &&
|
|
|
|
(await rbfTx.canCancelTx())
|
|
|
|
) {
|
|
|
|
return setIsRBFCancelPossible(buttonStatus.possible);
|
|
|
|
} else {
|
|
|
|
return setIsRBFCancelPossible(buttonStatus.notPossible);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const navigateToRBFBumpFee = () => {
|
|
|
|
navigate('RBFBumpFee', {
|
|
|
|
txid: tx.hash,
|
2021-02-10 18:41:51 +01:00
|
|
|
wallet: wallet.current,
|
2020-11-30 04:26:25 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const navigateToRBFCancel = () => {
|
|
|
|
navigate('RBFCancel', {
|
|
|
|
txid: tx.hash,
|
2021-02-10 18:41:51 +01:00
|
|
|
wallet: wallet.current,
|
2020-11-30 04:26:25 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const navigateToCPFP = () => {
|
|
|
|
navigate('CPFP', {
|
|
|
|
txid: tx.hash,
|
2021-02-10 18:41:51 +01:00
|
|
|
wallet: wallet.current,
|
2020-11-30 04:26:25 +01:00
|
|
|
});
|
|
|
|
};
|
|
|
|
const navigateToTransactionDetials = () => {
|
|
|
|
navigate('TransactionDetails', { hash: tx.hash });
|
|
|
|
};
|
|
|
|
|
|
|
|
const renderCPFP = () => {
|
|
|
|
if (isCPFPPossible === buttonStatus.unknown) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ActivityIndicator />
|
|
|
|
<BlueSpacing20 />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else if (isCPFPPossible === buttonStatus.possible) {
|
|
|
|
return (
|
|
|
|
<>
|
2023-11-15 09:40:22 +01:00
|
|
|
<Button onPress={navigateToCPFP} title={loc.transactions.status_bump} />
|
2020-12-02 06:24:01 +01:00
|
|
|
<BlueSpacing10 />
|
2020-11-30 04:26:25 +01:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const renderRBFCancel = () => {
|
|
|
|
if (isRBFCancelPossible === buttonStatus.unknown) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ActivityIndicator />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else if (isRBFCancelPossible === buttonStatus.possible) {
|
|
|
|
return (
|
|
|
|
<>
|
2021-06-24 14:50:57 +02:00
|
|
|
<TouchableOpacity accessibilityRole="button" style={styles.cancel}>
|
2020-11-30 04:26:25 +01:00
|
|
|
<Text onPress={navigateToRBFCancel} style={styles.cancelText}>
|
|
|
|
{loc.transactions.status_cancel}
|
|
|
|
</Text>
|
|
|
|
</TouchableOpacity>
|
2020-12-02 06:24:01 +01:00
|
|
|
<BlueSpacing10 />
|
2020-11-30 04:26:25 +01:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const renderRBFBumpFee = () => {
|
|
|
|
if (isRBFBumpFeePossible === buttonStatus.unknown) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ActivityIndicator />
|
|
|
|
<BlueSpacing20 />
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
} else if (isRBFBumpFeePossible === buttonStatus.possible) {
|
|
|
|
return (
|
|
|
|
<>
|
2023-11-15 09:40:22 +01:00
|
|
|
<Button onPress={navigateToRBFBumpFee} title={loc.transactions.status_bump} />
|
2020-12-02 06:24:01 +01:00
|
|
|
<BlueSpacing10 />
|
2020-11-30 04:26:25 +01:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const renderTXMetadata = () => {
|
|
|
|
if (txMetadata[tx.hash]) {
|
|
|
|
if (txMetadata[tx.hash].memo) {
|
|
|
|
return (
|
|
|
|
<View style={styles.memo}>
|
|
|
|
<Text style={styles.memoText}>{txMetadata[tx.hash].memo}</Text>
|
|
|
|
<BlueSpacing20 />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
if (isLoading || !tx) {
|
|
|
|
return (
|
2021-03-22 12:54:17 +01:00
|
|
|
<SafeBlueArea>
|
2020-11-30 04:26:25 +01:00
|
|
|
<BlueLoading />
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return (
|
2021-03-22 12:54:17 +01:00
|
|
|
<SafeBlueArea>
|
2021-01-19 04:40:11 +01:00
|
|
|
<HandoffComponent
|
2021-09-25 05:36:08 +02:00
|
|
|
title={loc.transactions.details_title}
|
|
|
|
type={HandoffComponent.activityTypes.ViewInBlockExplorer}
|
|
|
|
url={`https://mempool.space/tx/${tx.hash}`}
|
2021-01-19 04:40:11 +01:00
|
|
|
/>
|
|
|
|
|
2020-11-30 04:26:25 +01:00
|
|
|
<View style={styles.container}>
|
|
|
|
<BlueCard>
|
|
|
|
<View style={styles.center}>
|
|
|
|
<Text style={[styles.value, stylesHook.value]}>
|
2021-02-10 18:41:51 +01:00
|
|
|
{formatBalanceWithoutSuffix(tx.value, wallet.current.preferredBalanceUnit, true)}{' '}
|
|
|
|
{wallet.current.preferredBalanceUnit !== BitcoinUnit.LOCAL_CURRENCY && (
|
|
|
|
<Text style={[styles.valueUnit, stylesHook.valueUnit]}>{loc.units[wallet.current.preferredBalanceUnit]}</Text>
|
2020-11-30 04:26:25 +01:00
|
|
|
)}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
{renderTXMetadata()}
|
|
|
|
|
|
|
|
<View style={[styles.iconRoot, stylesHook.iconRoot]}>
|
|
|
|
<View>
|
|
|
|
<Icon name="check" size={50} type="font-awesome" color={colors.successCheck} />
|
|
|
|
</View>
|
|
|
|
<View style={[styles.iconWrap, styles.margin]}>
|
|
|
|
{(() => {
|
|
|
|
if (!tx.confirmations) {
|
|
|
|
return (
|
|
|
|
<View style={styles.icon}>
|
2022-01-28 12:13:53 +01:00
|
|
|
<TransactionPendingIcon />
|
2020-11-30 04:26:25 +01:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else if (tx.value < 0) {
|
|
|
|
return (
|
|
|
|
<View style={styles.icon}>
|
2022-01-28 12:13:53 +01:00
|
|
|
<TransactionOutgoingIcon />
|
2020-11-30 04:26:25 +01:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<View style={styles.icon}>
|
2022-01-28 12:13:53 +01:00
|
|
|
<TransactionIncomingIcon />
|
2020-11-30 04:26:25 +01:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
})()}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
{tx.fee && (
|
|
|
|
<View style={styles.fee}>
|
|
|
|
<BlueText style={styles.feeText}>
|
2021-02-10 18:41:51 +01:00
|
|
|
{loc.send.create_fee.toLowerCase()} {formatBalanceWithoutSuffix(tx.fee, wallet.current.preferredBalanceUnit, true)}{' '}
|
|
|
|
{wallet.current.preferredBalanceUnit !== BitcoinUnit.LOCAL_CURRENCY && wallet.current.preferredBalanceUnit}
|
2020-11-30 04:26:25 +01:00
|
|
|
</BlueText>
|
|
|
|
</View>
|
|
|
|
)}
|
|
|
|
|
2021-09-05 19:35:08 +02:00
|
|
|
<View style={styles.confirmations}>
|
2020-12-13 11:07:11 +01:00
|
|
|
<Text style={styles.confirmationsText}>
|
2020-12-13 18:12:18 +01:00
|
|
|
{loc.formatString(loc.transactions.confirmations_lowercase, {
|
|
|
|
confirmations: tx.confirmations > 6 ? '6+' : tx.confirmations,
|
|
|
|
})}
|
2020-12-13 11:07:11 +01:00
|
|
|
</Text>
|
2020-11-30 04:26:25 +01:00
|
|
|
</View>
|
2021-08-27 17:14:29 +02:00
|
|
|
{eta ? (
|
2022-01-28 13:16:47 +01:00
|
|
|
<View style={styles.eta}>
|
2021-08-27 17:14:29 +02:00
|
|
|
<BlueSpacing10 />
|
|
|
|
<Text style={styles.confirmationsText}>{eta}</Text>
|
|
|
|
</View>
|
|
|
|
) : null}
|
2020-11-30 04:26:25 +01:00
|
|
|
</BlueCard>
|
|
|
|
|
|
|
|
<View style={styles.actions}>
|
|
|
|
{renderCPFP()}
|
|
|
|
{renderRBFBumpFee()}
|
|
|
|
{renderRBFCancel()}
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
</SafeBlueArea>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-02-10 18:41:51 +01:00
|
|
|
export default TransactionsStatus;
|
2020-05-24 11:17:26 +02:00
|
|
|
const styles = StyleSheet.create({
|
|
|
|
container: {
|
2020-10-06 19:53:05 +02:00
|
|
|
flex: 1,
|
2020-05-24 11:17:26 +02:00
|
|
|
justifyContent: 'space-between',
|
|
|
|
},
|
|
|
|
center: {
|
|
|
|
alignItems: 'center',
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
fontSize: 36,
|
|
|
|
fontWeight: '600',
|
|
|
|
},
|
|
|
|
valueUnit: {
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: '600',
|
|
|
|
},
|
|
|
|
memo: {
|
|
|
|
alignItems: 'center',
|
|
|
|
marginVertical: 8,
|
|
|
|
},
|
|
|
|
memoText: {
|
|
|
|
color: '#9aa0aa',
|
|
|
|
fontSize: 14,
|
|
|
|
},
|
|
|
|
iconRoot: {
|
|
|
|
width: 120,
|
|
|
|
height: 120,
|
|
|
|
borderRadius: 60,
|
|
|
|
alignSelf: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginTop: 43,
|
|
|
|
marginBottom: 53,
|
|
|
|
},
|
|
|
|
iconWrap: {
|
|
|
|
minWidth: 30,
|
|
|
|
minHeight: 30,
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
borderRadius: 15,
|
|
|
|
},
|
|
|
|
margin: {
|
|
|
|
marginBottom: -40,
|
|
|
|
},
|
|
|
|
icon: {
|
|
|
|
width: 25,
|
|
|
|
},
|
|
|
|
fee: {
|
|
|
|
marginTop: 15,
|
|
|
|
marginBottom: 13,
|
|
|
|
},
|
|
|
|
feeText: {
|
|
|
|
fontSize: 11,
|
|
|
|
fontWeight: '500',
|
|
|
|
marginBottom: 4,
|
|
|
|
color: '#00c49f',
|
|
|
|
alignSelf: 'center',
|
|
|
|
},
|
|
|
|
confirmations: {
|
|
|
|
alignSelf: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
|
|
|
confirmationsText: {
|
|
|
|
color: '#9aa0aa',
|
2021-09-05 19:35:08 +02:00
|
|
|
fontSize: 13,
|
2020-05-24 11:17:26 +02:00
|
|
|
},
|
2021-08-27 17:14:29 +02:00
|
|
|
eta: {
|
|
|
|
alignSelf: 'center',
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
2020-05-24 11:17:26 +02:00
|
|
|
actions: {
|
2020-10-06 19:53:05 +02:00
|
|
|
alignSelf: 'center',
|
2020-05-24 11:17:26 +02:00
|
|
|
justifyContent: 'center',
|
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
marginVertical: 16,
|
|
|
|
},
|
|
|
|
cancelText: {
|
|
|
|
color: '#d0021b',
|
|
|
|
fontSize: 15,
|
|
|
|
fontWeight: '500',
|
|
|
|
textAlign: 'center',
|
|
|
|
},
|
|
|
|
details: {
|
|
|
|
alignItems: 'center',
|
|
|
|
justifyContent: 'center',
|
2021-09-05 19:35:08 +02:00
|
|
|
width: 80,
|
|
|
|
borderRadius: 8,
|
2021-09-14 07:36:00 +02:00
|
|
|
height: 34,
|
2020-05-24 11:17:26 +02:00
|
|
|
},
|
|
|
|
detailsText: {
|
2021-09-05 19:35:08 +02:00
|
|
|
fontSize: 15,
|
|
|
|
fontWeight: '600',
|
2020-05-24 11:17:26 +02:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-09-14 07:36:00 +02:00
|
|
|
TransactionsStatus.navigationOptions = navigationStyle(
|
|
|
|
{
|
|
|
|
headerTitle: '',
|
2023-10-20 04:28:49 +02:00
|
|
|
statusBarStyle: 'auto',
|
2021-09-14 07:36:00 +02:00
|
|
|
},
|
|
|
|
(options, { theme }) => ({
|
|
|
|
...options,
|
|
|
|
headerStyle: {
|
|
|
|
backgroundColor: theme.colors.customHeader,
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
elevation: 0,
|
|
|
|
shadowOpacity: 0,
|
|
|
|
shadowOffset: { height: 0, width: 0 },
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
);
|