diff --git a/src/screens/Gift/Loading.tsx b/src/screens/Gift/Loading.tsx
index 2c1a8bb0c..b47825d4a 100644
--- a/src/screens/Gift/Loading.tsx
+++ b/src/screens/Gift/Loading.tsx
@@ -23,6 +23,7 @@ import { showSheet } from '../../store/utils/ui';
import { BodyM } from '../../styles/text';
import { giftOrder, giftPay, openChannel } from '../../utils/blocktank';
import { vibrate } from '../../utils/helpers';
+import { waitForLdkPeers } from '../../utils/lightning';
const imageSrc = require('../../assets/illustrations/gift.png');
@@ -117,6 +118,8 @@ const Loading = ({
sheetRef.current?.close();
};
+ await waitForLdkPeers();
+
if (maxInboundCapacity >= amount) {
await getWithLiquidity();
} else {
diff --git a/src/screens/Shop/ShopMain.tsx b/src/screens/Shop/ShopMain.tsx
index e74aad0f9..580907b31 100644
--- a/src/screens/Shop/ShopMain.tsx
+++ b/src/screens/Shop/ShopMain.tsx
@@ -1,6 +1,7 @@
import React, { memo, ReactElement } from 'react';
import { useTranslation } from 'react-i18next';
import { StyleSheet, View } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { WebView, WebViewMessageEvent } from 'react-native-webview';
import NavigationHeader from '../../components/NavigationHeader';
@@ -15,6 +16,7 @@ const ShopMain = ({
}: RootStackScreenProps<'ShopMain'>): ReactElement => {
const { page } = route.params;
const { t } = useTranslation('other');
+ const insets = useSafeAreaInsets();
const baseUrl = 'https://embed.bitrefill.com';
// Payment method "bitcoin" gives a unified invoice
@@ -38,8 +40,9 @@ const ShopMain = ({
@@ -58,8 +61,6 @@ const styles = StyleSheet.create({
webview: {
backgroundColor: '#141716',
borderRadius: 8,
- flex: 1,
- marginBottom: 16,
},
});
diff --git a/src/utils/blocktank/index.ts b/src/utils/blocktank/index.ts
index 57516e5ee..d32789164 100644
--- a/src/utils/blocktank/index.ts
+++ b/src/utils/blocktank/index.ts
@@ -399,12 +399,6 @@ export const giftPay = async (invoice: string): Promise> => {
};
export const giftOrder = async (code: string): Promise> => {
- // Ensure we're properly connected to the Blocktank node prior to buying a channel.
- const addPeersRes = await addPeers();
- if (addPeersRes.isErr()) {
- return err(i18n.t('other:bt_error_connect'));
- }
-
// Get the node ID to use for the order.
const nodeIdResult = await getNodeId();
if (nodeIdResult.isErr()) {
diff --git a/src/utils/lightning/index.ts b/src/utils/lightning/index.ts
index aa6d49a83..2accc4dee 100644
--- a/src/utils/lightning/index.ts
+++ b/src/utils/lightning/index.ts
@@ -1151,6 +1151,23 @@ export const waitForLdk = async (): Promise => {
});
};
+export const waitForLdkPeers = async (): Promise => {
+ await tryNTimes({
+ toTry: async () => {
+ const peersResult = await ldk.listPeers();
+ if (peersResult.isOk()) {
+ if (peersResult.value.length > 0) {
+ return ok(peersResult.value);
+ }
+ return err('no peers connected');
+ }
+ return err('error getting peers');
+ },
+ times: 5,
+ interval: 1000,
+ });
+};
+
export const waitForLdkChannels = async (): Promise => {
await tryNTimes({
toTry: async () => {