From 294790bc4a7dba0ac24cd38a51835b6ebd56c22d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20V=C3=A9lez?= Date: Mon, 20 Nov 2023 16:02:47 -0400 Subject: [PATCH 1/5] FIX: Update drawer view for nav 6 (#5843) --- Navigation.js | 21 +++++++------ blue_modules/storage-context.js | 6 ++-- components/WalletsCarousel.js | 38 ++++++++++++------------ ios/BlueWallet.xcodeproj/project.pbxproj | 6 ++-- screen/lnd/lndCreateInvoice.js | 6 ++-- screen/lnd/lndViewInvoice.js | 4 +-- screen/send/details.js | 4 +-- screen/transactions/transactionStatus.js | 4 +-- screen/wallets/details.js | 4 +-- screen/wallets/drawerList.js | 5 ++-- screen/wallets/list.js | 4 +-- screen/wallets/transactions.js | 6 ++-- 12 files changed, 56 insertions(+), 52 deletions(-) diff --git a/Navigation.js b/Navigation.js index 0ae9d88c4f..1f56bbaa9d 100644 --- a/Navigation.js +++ b/Navigation.js @@ -352,16 +352,18 @@ const DrawerRoot = () => { const isLargeScreen = useMemo(() => { return Platform.OS === 'android' ? isTablet() : (dimensions.width >= Dimensions.get('screen').width / 2 && isTablet()) || isDesktop; }, [dimensions.width]); - const drawerStyle = useMemo(() => ({ width: isLargeScreen ? 320 : '0%' }), [isLargeScreen]); - const drawerContent = useCallback(props => (isLargeScreen ? : null), [isLargeScreen]); + const drawerStyle = useMemo( + () => ({ + drawerPosition: I18nManager.isRTL ? 'right' : 'left', + drawerStyle: { width: isLargeScreen ? 320 : '0%' }, + drawerType: isLargeScreen ? 'permanent' : 'back', + }), + [isLargeScreen], + ); + const drawerContent = useCallback(props => , []); return ( - + ); @@ -509,13 +511,14 @@ const PaymentCodeStackRoot = () => { const RootStack = createNativeStackNavigator(); const NavigationDefaultOptions = { headerShown: false, presentation: isDesktop ? 'containedModal' : 'modal' }; +const NavigationFormModalOptions = { headerShown: false, presentation: isDesktop ? 'containedModal' : 'formSheet' }; const StatusBarLightOptions = { statusBarStyle: 'light' }; const Navigation = () => { return ( {/* stacks */} - + diff --git a/blue_modules/storage-context.js b/blue_modules/storage-context.js index 6ed44be2cd..7cc180c1cd 100644 --- a/blue_modules/storage-context.js +++ b/blue_modules/storage-context.js @@ -19,7 +19,7 @@ export const WalletTransactionsStatus = { NONE: false, ALL: true }; export const BlueStorageContext = createContext(); export const BlueStorageProvider = ({ children }) => { const [wallets, setWallets] = useState([]); - const [selectedWallet, setSelectedWallet] = useState(''); + const [selectedWalletID, setSelectedWalletID] = useState(''); const [walletTransactionUpdateStatus, setWalletTransactionUpdateStatus] = useState(WalletTransactionsStatus.NONE); const [walletsInitialized, setWalletsInitialized] = useState(false); const [preferredFiatCurrency, _setPreferredFiatCurrency] = useState(FiatUnit.USD); @@ -241,8 +241,8 @@ export const BlueStorageProvider = ({ children }) => { txMetadata, saveToDisk, getTransactions, - selectedWallet, - setSelectedWallet, + selectedWalletID, + setSelectedWalletID, addWallet, deleteWallet, currentSharedCosigner, diff --git a/components/WalletsCarousel.js b/components/WalletsCarousel.js index e5440031f3..b51804f644 100644 --- a/components/WalletsCarousel.js +++ b/components/WalletsCarousel.js @@ -21,7 +21,7 @@ import { LightningCustodianWallet, LightningLdkWallet, MultisigHDWallet } from ' import WalletGradient from '../class/wallet-gradient'; import { BluePrivateBalance } from '../BlueComponents'; import { BlueStorageContext } from '../blue_modules/storage-context'; -import { isHandset, isTablet, isDesktop } from '../blue_modules/environment'; +import { isTablet, isDesktop } from '../blue_modules/environment'; import { useTheme } from './themes'; const nStyles = StyleSheet.create({ @@ -137,7 +137,7 @@ const iStyles = StyleSheet.create({ }, }); -const WalletCarouselItem = ({ item, index, onPress, handleLongPress, isSelectedWallet }) => { +const WalletCarouselItem = ({ item, _, onPress, handleLongPress, isSelectedWallet }) => { const scaleValue = new Animated.Value(1.0); const { colors } = useTheme(); const { walletTransactionUpdateStatus } = useContext(BlueStorageContext); @@ -239,7 +239,6 @@ const WalletCarouselItem = ({ item, index, onPress, handleLongPress, isSelectedW WalletCarouselItem.propTypes = { item: PropTypes.any, - index: PropTypes.number.isRequired, onPress: PropTypes.func.isRequired, handleLongPress: PropTypes.func.isRequired, isSelectedWallet: PropTypes.bool, @@ -262,21 +261,22 @@ const ListHeaderComponent = () => ; const WalletsCarousel = forwardRef((props, ref) => { const { preferredFiatCurrency, language } = useContext(BlueStorageContext); + const { horizontal, data, handleLongPress, onPress, selectedWallet } = props; const renderItem = useCallback( ({ item, index }) => item ? ( ) : ( - + ), // eslint-disable-next-line react-hooks/exhaustive-deps - [props.horizontal, props.selectedWallet, props.handleLongPress, props.onPress, preferredFiatCurrency, language], + [horizontal, selectedWallet, handleLongPress, onPress, preferredFiatCurrency, language], ); const flatListRef = useRef(); @@ -298,7 +298,7 @@ const WalletsCarousel = forwardRef((props, ref) => { console.log(error); flatListRef.current.scrollToOffset({ offset: error.averageItemLength * error.index, animated: true }); setTimeout(() => { - if (props.data.length !== 0 && flatListRef.current !== null) { + if (data.length !== 0 && flatListRef.current !== null) { flatListRef.current.scrollToIndex({ index: error.index, animated: true }); } }, 100); @@ -307,40 +307,40 @@ const WalletsCarousel = forwardRef((props, ref) => { const { width } = useWindowDimensions(); const sliderHeight = 195; const itemWidth = width * 0.82 > 375 ? 375 : width * 0.82; - return isHandset ? ( + return horizontal ? ( index.toString()} showsVerticalScrollIndicator={false} pagingEnabled - disableIntervalMomentum={isHandset} + disableIntervalMomentum={horizontal} snapToInterval={itemWidth} // Adjust to your content width decelerationRate="fast" - contentContainerStyle={props.horizontal ? cStyles.content : cStyles.contentLargeScreen} + contentContainerStyle={cStyles.content} directionalLockEnabled showsHorizontalScrollIndicator={false} initialNumToRender={10} ListHeaderComponent={ListHeaderComponent} - style={props.horizontal ? { minHeight: sliderHeight + 9 } : {}} + style={{ minHeight: sliderHeight + 9 }} onScrollToIndexFailed={onScrollToIndexFailed} {...props} /> ) : ( - {props.data.map((item, index) => + {data.map((item, index) => item ? ( ) : ( - + ), )} diff --git a/ios/BlueWallet.xcodeproj/project.pbxproj b/ios/BlueWallet.xcodeproj/project.pbxproj index 9ffb0ede3b..538f202c63 100644 --- a/ios/BlueWallet.xcodeproj/project.pbxproj +++ b/ios/BlueWallet.xcodeproj/project.pbxproj @@ -817,7 +817,7 @@ ); mainGroup = 83CBB9F61A601CBA00E9B192; packageReferences = ( - 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */, + 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */, ); productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; projectDirPath = ""; @@ -1822,7 +1822,7 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */ = { + 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/EFPrefix/EFQRCode.git"; requirement = { @@ -1835,7 +1835,7 @@ /* Begin XCSwiftPackageProductDependency section */ 6DFC806F24EA0B6C007B8700 /* EFQRCode */ = { isa = XCSwiftPackageProductDependency; - package = 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode" */; + package = 6DFC806E24EA0B6C007B8700 /* XCRemoteSwiftPackageReference "EFQRCode.git" */; productName = EFQRCode; }; /* End XCSwiftPackageProductDependency section */ diff --git a/screen/lnd/lndCreateInvoice.js b/screen/lnd/lndCreateInvoice.js index d59e58a952..586bc9faf5 100644 --- a/screen/lnd/lndCreateInvoice.js +++ b/screen/lnd/lndCreateInvoice.js @@ -36,7 +36,7 @@ const currency = require('../../blue_modules/currency'); const torrific = isTorCapable ? require('../../blue_modules/torrific') : require('../../scripts/maccatalystpatches/torrific.js'); const LNDCreateInvoice = () => { - const { wallets, saveToDisk, setSelectedWallet, isTorDisabled } = useContext(BlueStorageContext); + const { wallets, saveToDisk, setSelectedWalletID, isTorDisabled } = useContext(BlueStorageContext); const { walletID, uri } = useRoute().params; const wallet = useRef(wallets.find(item => item.getID() === walletID) || wallets.find(item => item.chain === Chain.OFFCHAIN)); const { name } = useRoute(); @@ -106,7 +106,7 @@ const LNDCreateInvoice = () => { const newWallet = wallets.find(w => w.getID() === walletID); if (newWallet) { wallet.current = newWallet; - setSelectedWallet(newWallet.getID()); + setSelectedWalletID(newWallet.getID()); } } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -115,7 +115,7 @@ const LNDCreateInvoice = () => { useFocusEffect( useCallback(() => { if (wallet.current) { - setSelectedWallet(walletID); + setSelectedWalletID(walletID); if (wallet.current.getUserHasSavedExport()) { renderReceiveDetails(); } else { diff --git a/screen/lnd/lndViewInvoice.js b/screen/lnd/lndViewInvoice.js index ede8212d6c..17917f19a6 100644 --- a/screen/lnd/lndViewInvoice.js +++ b/screen/lnd/lndViewInvoice.js @@ -17,7 +17,7 @@ import Button from '../../components/Button'; const LNDViewInvoice = () => { const { invoice, walletID } = useRoute().params; - const { wallets, setSelectedWallet, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext); + const { wallets, setSelectedWalletID, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext); const wallet = wallets.find(w => w.getID() === walletID); const { colors, closeImage } = useTheme(); const { goBack, navigate, setParams, setOptions, getParent } = useNavigation(); @@ -98,7 +98,7 @@ const LNDViewInvoice = () => { }, [colors, isModal]); useEffect(() => { - setSelectedWallet(walletID); + setSelectedWalletID(walletID); console.log('LNDViewInvoice - useEffect'); if (!invoice.ispaid) { fetchInvoiceInterval.current = setInterval(async () => { diff --git a/screen/send/details.js b/screen/send/details.js index 3c1131d814..bd102b9acb 100644 --- a/screen/send/details.js +++ b/screen/send/details.js @@ -49,7 +49,7 @@ const fs = require('../../blue_modules/fs'); const btcAddressRx = /^[a-zA-Z0-9]{26,35}$/; const SendDetails = () => { - const { wallets, setSelectedWallet, sleep, txMetadata, saveToDisk } = useContext(BlueStorageContext); + const { wallets, setSelectedWalletID, sleep, txMetadata, saveToDisk } = useContext(BlueStorageContext); const navigation = useNavigation(); const { name, params: routeParams } = useRoute(); const scrollView = useRef(); @@ -230,7 +230,7 @@ const SendDetails = () => { // change header and reset state on wallet change useEffect(() => { if (!wallet) return; - setSelectedWallet(wallet.getID()); + setSelectedWalletID(wallet.getID()); // reset other values setUtxo(null); diff --git a/screen/transactions/transactionStatus.js b/screen/transactions/transactionStatus.js index 7a55db583f..823e759062 100644 --- a/screen/transactions/transactionStatus.js +++ b/screen/transactions/transactionStatus.js @@ -25,7 +25,7 @@ const buttonStatus = Object.freeze({ }); const TransactionsStatus = () => { - const { setSelectedWallet, wallets, txMetadata, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext); + const { setSelectedWalletID, wallets, txMetadata, fetchAndSaveWalletTransactions } = useContext(BlueStorageContext); const { hash, walletID } = useRoute().params; const { navigate, setOptions, goBack } = useNavigation(); const { colors } = useTheme(); @@ -196,7 +196,7 @@ const TransactionsStatus = () => { useEffect(() => { const wID = wallet.current?.getID(); if (wID) { - setSelectedWallet(wallet.current?.getID()); + setSelectedWalletID(wallet.current?.getID()); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [wallet.current]); diff --git a/screen/wallets/details.js b/screen/wallets/details.js index e0c8344499..011bcf62de 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -119,7 +119,7 @@ const styles = StyleSheet.create({ }); const WalletDetails = () => { - const { saveToDisk, wallets, deleteWallet, setSelectedWallet, txMetadata } = useContext(BlueStorageContext); + const { saveToDisk, wallets, deleteWallet, setSelectedWalletID, txMetadata } = useContext(BlueStorageContext); const { walletID } = useRoute().params; const [isLoading, setIsLoading] = useState(false); const [backdoorPressed, setBackdoorPressed] = useState(0); @@ -226,7 +226,7 @@ const WalletDetails = () => { useEffect(() => { if (wallets.some(w => w.getID() === walletID)) { - setSelectedWallet(walletID); + setSelectedWalletID(walletID); } // eslint-disable-next-line react-hooks/exhaustive-deps }, [walletID]); diff --git a/screen/wallets/drawerList.js b/screen/wallets/drawerList.js index 7cc4526e81..8940a0597f 100644 --- a/screen/wallets/drawerList.js +++ b/screen/wallets/drawerList.js @@ -13,7 +13,7 @@ import { useTheme } from '../../components/themes'; const DrawerList = props => { const walletsCarousel = useRef(); - const { wallets, selectedWallet } = useContext(BlueStorageContext); + const { wallets, selectedWalletID, setSelectedWalletID } = useContext(BlueStorageContext); const { colors } = useTheme(); const walletsCount = useRef(wallets.length); const isFocused = useIsFocused(); @@ -33,6 +33,7 @@ const DrawerList = props => { const handleClick = item => { if (item?.getID) { const walletID = item.getID(); + setSelectedWalletID(walletID); props.navigation.navigate('WalletTransactions', { walletID: item.getID(), walletType: item.type, @@ -72,7 +73,7 @@ const DrawerList = props => { handleLongPress={handleLongPress} ref={walletsCarousel} testID="WalletsList" - selectedWallet={selectedWallet} + selectedWallet={selectedWalletID} scrollEnabled={isFocused} /> diff --git a/screen/wallets/list.js b/screen/wallets/list.js index 00ed6df279..3c1147f827 100644 --- a/screen/wallets/list.js +++ b/screen/wallets/list.js @@ -36,7 +36,7 @@ const WalletsListSections = { CAROUSEL: 'CAROUSEL', TRANSACTIONS: 'TRANSACTIONS' const WalletsList = () => { const walletsCarousel = useRef(); const currentWalletIndex = useRef(0); - const { wallets, getTransactions, getBalance, refreshAllWalletTransactions, setSelectedWallet, isElectrumDisabled } = + const { wallets, getTransactions, getBalance, refreshAllWalletTransactions, setSelectedWalletID, isElectrumDisabled } = useContext(BlueStorageContext); const { width } = useWindowDimensions(); const { colors, scanImage } = useTheme(); @@ -66,7 +66,7 @@ const WalletsList = () => { useFocusEffect( useCallback(() => { verifyBalance(); - setSelectedWallet(''); + setSelectedWalletID(undefined); // eslint-disable-next-line react-hooks/exhaustive-deps }, []), ); diff --git a/screen/wallets/transactions.js b/screen/wallets/transactions.js index efe20becae..46ab783f06 100644 --- a/screen/wallets/transactions.js +++ b/screen/wallets/transactions.js @@ -45,7 +45,7 @@ const buttonFontSize = : PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26); const WalletTransactions = ({ navigation }) => { - const { wallets, saveToDisk, setSelectedWallet, walletTransactionUpdateStatus, isElectrumDisabled } = useContext(BlueStorageContext); + const { wallets, saveToDisk, setSelectedWalletID, walletTransactionUpdateStatus, isElectrumDisabled } = useContext(BlueStorageContext); const [isLoading, setIsLoading] = useState(false); const { walletID } = useRoute().params; const { name } = useRoute(); @@ -129,7 +129,7 @@ const WalletTransactions = ({ navigation }) => { setTimeElapsed(0); setItemPriceUnit(wallet.getPreferredBalanceUnit()); setIsLoading(false); - setSelectedWallet(wallet.getID()); + setSelectedWalletID(wallet.getID()); setDataSource([...getTransactionsSliced(limit)]); setOptions({ headerStyle: { @@ -141,7 +141,7 @@ const WalletTransactions = ({ navigation }) => { }, }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [walletID]); + }, [wallet]); useEffect(() => { const newWallet = wallets.find(w => w.getID() === walletID); From 6e9fb487e03d3c68ec9c764c409f77c01eaac9a2 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sun, 19 Nov 2023 13:43:31 -0400 Subject: [PATCH 2/5] FIX: Failing to open Camera Screen when Scanning to Import (iOS) #5831 --- Navigation.js | 1 + screen/send/ScanQRCode.js | 14 ++++++++++++-- screen/wallets/addMultisigStep2.js | 23 +++++++++++------------ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Navigation.js b/Navigation.js index 1f56bbaa9d..0da298afa9 100644 --- a/Navigation.js +++ b/Navigation.js @@ -562,6 +562,7 @@ const Navigation = () => { presentation: isDesktop ? 'containedModal' : 'fullScreenModal', statusBarHidden: true, }} + initialParams={ScanQRCode.initialParams} /> diff --git a/screen/send/ScanQRCode.js b/screen/send/ScanQRCode.js index 72dd04503c..d7269cce16 100644 --- a/screen/send/ScanQRCode.js +++ b/screen/send/ScanQRCode.js @@ -86,8 +86,7 @@ const ScanQRCode = () => { const [isLoading, setIsLoading] = useState(false); const navigation = useNavigation(); const route = useRoute(); - const showFileImportButton = route.params.showFileImportButton || false; - const { launchedBy, onBarScanned, onDismiss, onBarScannerDismissWithoutData = () => {} } = route.params; + const { launchedBy, onBarScanned, onDismiss, showFileImportButton, onBarScannerDismissWithoutData = () => {} } = route.params; const scannedCache = {}; const { colors } = useTheme(); const isFocused = useIsFocused(); @@ -404,3 +403,14 @@ const ScanQRCode = () => { }; export default ScanQRCode; +ScanQRCode.initialParams = { + isLoading: false, + cameraStatusGranted: undefined, + backdoorPressed: undefined, + launchedBy: undefined, + urTotal: undefined, + urHave: undefined, + backdoorText: '', + backdoorVisible: false, + animatedQRCodeData: {}, +} \ No newline at end of file diff --git a/screen/wallets/addMultisigStep2.js b/screen/wallets/addMultisigStep2.js index 8bbde4c1e6..18f4d8459c 100644 --- a/screen/wallets/addMultisigStep2.js +++ b/screen/wallets/addMultisigStep2.js @@ -3,6 +3,7 @@ import { ActivityIndicator, FlatList, I18nManager, + InteractionManager, Keyboard, KeyboardAvoidingView, LayoutAnimation, @@ -461,17 +462,15 @@ const WalletsAddMultisigStep2 = () => { fs.showActionSheet({ anchor: findNodeHandle(openScannerButton.current) }).then(onBarScanned); } else { setIsProvideMnemonicsModalVisible(false); - setTimeout(() => - requestCameraAuthorization().then( - () => - navigation.navigate('ScanQRCodeRoot', { - screen: 'ScanQRCode', - params: { - onBarScanned, - showFileImportButton: true, - }, - }), - 650, + InteractionManager.runAfterInteractions(() => + requestCameraAuthorization().then(() => + navigation.navigate('ScanQRCodeRoot', { + screen: 'ScanQRCode', + params: { + onBarScanned, + showFileImportButton: true, + }, + }), ), ); } @@ -795,7 +794,7 @@ const styles = StyleSheet.create({ }); WalletsAddMultisigStep2.navigationOptions = navigationStyle({ - headerTitle: null, + title: null, gestureEnabled: false, swipeEnabled: false, }); From 8b0e431e745bedd2ce1959b1af2669e3155e2136 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sun, 19 Nov 2023 21:09:33 -0400 Subject: [PATCH 3/5] Update storage-context.js --- blue_modules/storage-context.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/blue_modules/storage-context.js b/blue_modules/storage-context.js index 7cc180c1cd..57063ecfa5 100644 --- a/blue_modules/storage-context.js +++ b/blue_modules/storage-context.js @@ -227,7 +227,6 @@ export const BlueStorageProvider = ({ children }) => { const setIsAdvancedModeEnabled = BlueApp.setIsAdvancedModeEnabled; const getHodlHodlSignatureKey = BlueApp.getHodlHodlSignatureKey; const addHodlHodlContract = BlueApp.addHodlHodlContract; - const getHodlHodlContracts = BlueApp.getHodlHodlContracts; const setDoNotTrack = BlueApp.setDoNotTrack; const isDoNotTrackEnabled = BlueApp.isDoNotTrackEnabled; const getItem = BlueApp.getItem; @@ -250,7 +249,6 @@ export const BlueStorageProvider = ({ children }) => { addAndSaveWallet, setItem, getItem, - getHodlHodlContracts, isAdvancedModeEnabled, fetchWalletBalances, fetchWalletTransactions, From 0bc40d45864efb35f5d9b6960b0af17ec2135e79 Mon Sep 17 00:00:00 2001 From: Marcos Rodriguez Velez Date: Sun, 19 Nov 2023 14:01:29 -0400 Subject: [PATCH 4/5] FIX: Lightning wallet CSV export does not differentiate between paid and expired invoices #5835 --- loc/en.json | 1 + screen/wallets/details.js | 22 ++++++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/loc/en.json b/loc/en.json index 46e8b41dd4..1edf113afc 100644 --- a/loc/en.json +++ b/loc/en.json @@ -64,6 +64,7 @@ "node_alias": "Node alias", "expiresIn": "Expires in {time} minutes", "payButton": "Pay", + "payment": "Payment", "placeholder": "Invoice or address", "open_channel": "Open Channel", "funding_amount_placeholder": "Funding amount, for example 0.001", diff --git a/screen/wallets/details.js b/screen/wallets/details.js index 011bcf62de..a38afb7d90 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -417,12 +417,17 @@ const WalletDetails = () => { }; const onExportHistoryPressed = async () => { - let csvFile = [ + const csvFileArray = [ loc.transactions.date, loc.transactions.txid, `${loc.send.create_amount} (${BitcoinUnit.BTC})`, loc.send.create_memo, - ].join(','); // CSV header + ]; + if (wallet.chain === Chain.OFFCHAIN) { + csvFileArray.push(loc.lnd.payment); + } + + let csvFile = csvFileArray.join(','); // CSV header const transactions = wallet.getTransactions(); for (const transaction of transactions) { @@ -430,17 +435,26 @@ const WalletDetails = () => { let hash = transaction.hash; let memo = txMetadata[transaction.hash]?.memo?.trim() ?? ''; + let status; if (wallet.chain === Chain.OFFCHAIN) { hash = transaction.payment_hash; memo = transaction.description; - + status = transaction.ispaid ? loc._.success : loc.lnd.expired; if (hash?.type === 'Buffer' && hash?.data) { const bb = Buffer.from(hash); hash = bb.toString('hex'); } } - csvFile += '\n' + [new Date(transaction.received).toString(), hash, value, memo].join(','); // CSV line + + const data = [new Date(transaction.received).toString(), hash, value, memo]; + + if (wallet.chain === Chain.OFFCHAIN) { + // Replace 'condition' with your specific condition + data.push(status); + } + + csvFile += '\n' + data.join(','); // CSV line } await writeFileAndExport(`${wallet.label.replace(' ', '-')}-history.csv`, csvFile); From ca31762530a412e696ebdf1adc532c2116a23afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Rodriguez=20V=C3=A9lez?= Date: Mon, 20 Nov 2023 16:53:33 -0400 Subject: [PATCH 5/5] Update details.js --- screen/wallets/details.js | 1 - 1 file changed, 1 deletion(-) diff --git a/screen/wallets/details.js b/screen/wallets/details.js index a38afb7d90..ed76aa9d65 100644 --- a/screen/wallets/details.js +++ b/screen/wallets/details.js @@ -450,7 +450,6 @@ const WalletDetails = () => { const data = [new Date(transaction.received).toString(), hash, value, memo]; if (wallet.chain === Chain.OFFCHAIN) { - // Replace 'condition' with your specific condition data.push(status); }