mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2024-11-19 18:00:17 +01:00
Merge pull request #7021 from BlueWallet/fix-lndhub-refill
Fix lndhub refill
This commit is contained in:
commit
71e674bab4
@ -54,7 +54,7 @@
|
|||||||
"clean:ios": "rm -fr node_modules && rm -fr ios/Pods && npm i && cd ios && pod update && cd ..; npm start -- --reset-cache",
|
"clean:ios": "rm -fr node_modules && rm -fr ios/Pods && npm i && cd ios && pod update && cd ..; npm start -- --reset-cache",
|
||||||
"releasenotes2json": "./scripts/release-notes.sh > release-notes.txt; node -e 'console.log(JSON.stringify(require(\"fs\").readFileSync(\"release-notes.txt\", \"utf8\")));' > release-notes.json",
|
"releasenotes2json": "./scripts/release-notes.sh > release-notes.txt; node -e 'console.log(JSON.stringify(require(\"fs\").readFileSync(\"release-notes.txt\", \"utf8\")));' > release-notes.json",
|
||||||
"branch2json": "./scripts/current-branch.sh > current-branch.json",
|
"branch2json": "./scripts/current-branch.sh > current-branch.json",
|
||||||
"start": "node node_modules/react-native/local-cli/cli.js start",
|
"start": "react-native start",
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
"android:clean": "cd android; ./gradlew clean ; cd .. ; npm run android",
|
"android:clean": "cd android; ./gradlew clean ; cd .. ; npm run android",
|
||||||
"ios": "react-native run-ios",
|
"ios": "react-native run-ios",
|
||||||
|
@ -74,8 +74,8 @@ const SelectWallet: React.FC = () => {
|
|||||||
|
|
||||||
const onPress = (item: TWallet) => {
|
const onPress = (item: TWallet) => {
|
||||||
triggerHapticFeedback(HapticFeedbackTypes.Selection);
|
triggerHapticFeedback(HapticFeedbackTypes.Selection);
|
||||||
if (isModal) {
|
if (onWalletSelect) {
|
||||||
onWalletSelect?.(item, { navigation: { pop, navigate } });
|
onWalletSelect(item, { navigation: { pop, navigate } });
|
||||||
} else {
|
} else {
|
||||||
navigate(previousRouteName, { walletID: item.getID(), merge: true });
|
navigate(previousRouteName, { walletID: item.getID(), merge: true });
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ import { DetailViewStackParamList } from '../../navigation/DetailViewStackParamL
|
|||||||
import { Transaction, TWallet } from '../../class/wallets/types';
|
import { Transaction, TWallet } from '../../class/wallets/types';
|
||||||
import getWalletTransactionsOptions from '../../navigation/helpers/getWalletTransactionsOptions';
|
import getWalletTransactionsOptions from '../../navigation/helpers/getWalletTransactionsOptions';
|
||||||
import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder';
|
import { presentWalletExportReminder } from '../../helpers/presentWalletExportReminder';
|
||||||
|
import selectWallet from '../../helpers/select-wallet';
|
||||||
|
import assert from 'assert';
|
||||||
|
|
||||||
const buttonFontSize =
|
const buttonFontSize =
|
||||||
PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26) > 22
|
PixelRatio.roundToNearestPixel(Dimensions.get('window').width / 26) > 22
|
||||||
@ -177,34 +179,35 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onWalletSelect = async (selectedWallet: TWallet) => {
|
const onWalletSelect = async (selectedWallet: TWallet) => {
|
||||||
if (selectedWallet) {
|
assert(wallet?.type === LightningCustodianWallet.type, `internal error, wallet is not ${LightningCustodianWallet.type}`);
|
||||||
navigate('WalletTransactions', {
|
navigate('WalletTransactions', {
|
||||||
walletType: wallet?.type,
|
walletType: wallet?.type,
|
||||||
walletID: wallet?.getID(),
|
walletID: wallet?.getID(),
|
||||||
key: `WalletTransactions-${wallet?.getID()}`,
|
key: `WalletTransactions-${wallet?.getID()}`,
|
||||||
});
|
}); // navigating back to ln wallet screen
|
||||||
if (wallet?.type === LightningCustodianWallet.type) {
|
|
||||||
let toAddress;
|
// getting refill address, either cached or from the server:
|
||||||
if (wallet?.refill_addressess.length > 0) {
|
let toAddress;
|
||||||
toAddress = wallet.refill_addressess[0];
|
if (wallet?.refill_addressess.length > 0) {
|
||||||
} else {
|
toAddress = wallet.refill_addressess[0];
|
||||||
try {
|
} else {
|
||||||
await wallet?.fetchBtcAddress();
|
try {
|
||||||
toAddress = wallet?.refill_addressess[0];
|
await wallet?.fetchBtcAddress();
|
||||||
} catch (Err) {
|
toAddress = wallet?.refill_addressess[0];
|
||||||
return presentAlert({ message: (Err as Error).message, type: AlertType.Toast });
|
} catch (Err) {
|
||||||
}
|
return presentAlert({ message: (Err as Error).message, type: AlertType.Toast });
|
||||||
}
|
|
||||||
navigate('SendDetailsRoot', {
|
|
||||||
screen: 'SendDetails',
|
|
||||||
params: {
|
|
||||||
memo: loc.lnd.refill_lnd_balance,
|
|
||||||
address: toAddress,
|
|
||||||
walletID: selectedWallet.getID(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// navigating to pay screen where user can pay to refill address:
|
||||||
|
navigate('SendDetailsRoot', {
|
||||||
|
screen: 'SendDetails',
|
||||||
|
params: {
|
||||||
|
memo: loc.lnd.refill_lnd_balance,
|
||||||
|
address: toAddress,
|
||||||
|
walletID: selectedWallet.getID(),
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const navigateToViewEditCosigners = () => {
|
const navigateToViewEditCosigners = () => {
|
||||||
@ -222,7 +225,7 @@ const WalletTransactions: React.FC<WalletTransactionsProps> = ({ route }) => {
|
|||||||
if (availableWallets.length === 0) {
|
if (availableWallets.length === 0) {
|
||||||
presentAlert({ message: loc.lnd.refill_create });
|
presentAlert({ message: loc.lnd.refill_create });
|
||||||
} else {
|
} else {
|
||||||
navigate('SelectWallet', { onWalletSelect, chainType: Chain.ONCHAIN });
|
selectWallet(navigate, name, Chain.ONCHAIN).then(onWalletSelect);
|
||||||
}
|
}
|
||||||
} else if (id === actionKeys.RefillWithExternalWallet) {
|
} else if (id === actionKeys.RefillWithExternalWallet) {
|
||||||
navigate('ReceiveDetailsRoot', {
|
navigate('ReceiveDetailsRoot', {
|
||||||
|
Loading…
Reference in New Issue
Block a user