Skip to content

Commit

Permalink
Merge pull request #1595 from synonymdev/upgrade-ldk
Browse files Browse the repository at this point in the history
chore(lightning): Upgrade react-native-ldk
  • Loading branch information
Jasonvdb authored Mar 7, 2024
2 parents b456386 + 8d0ae54 commit 57a3502
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ PODS:
- React-Core
- react-native-keep-awake (1.2.2):
- React-Core
- react-native-ldk (0.0.132):
- react-native-ldk (0.0.134):
- React
- react-native-mmkv (2.11.0):
- MMKV (>= 1.2.13)
Expand Down Expand Up @@ -911,7 +911,7 @@ SPEC CHECKSUMS:
react-native-flipper: 9c1957af24b76493ba74f46d000a5c1d485e7731
react-native-image-picker: 2e2e82aba9b6a91a7c78f7d9afde341a2659c7b8
react-native-keep-awake: ad1d67f617756b139536977a0bf06b27cec0714a
react-native-ldk: 4bb809be74082223644931a3239323af56c7ee8f
react-native-ldk: e4971770e3773415fff4e5aa04df83f9d5485744
react-native-mmkv: e97c0c79403fb94577e5d902ab1ebd42b0715b43
react-native-netinfo: 5ddbf20865bcffab6b43d0e4e1fd8b3896beb898
react-native-quick-base64: a5dbe4528f1453e662fcf7351029500b8b63e7bb
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@synonymdev/blocktank-client": "0.0.50",
"@synonymdev/blocktank-lsp-http-client": "0.13.1",
"@synonymdev/feeds": "2.1.1",
"@synonymdev/react-native-ldk": "0.0.132",
"@synonymdev/react-native-ldk": "0.0.134",
"@synonymdev/react-native-lnurl": "0.0.7",
"@synonymdev/result": "0.0.2",
"@synonymdev/slashtags-auth": "1.0.0-alpha.6",
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Wallets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Wallets = ({ navigation, onFocus }: Props): ReactElement => {

const onRefresh = async (): Promise<void> => {
setRefreshing(true);
await refreshWallet({ scanAllAddresses: true });
await refreshWallet();
setRefreshing(false);
};

Expand Down
3 changes: 2 additions & 1 deletion src/utils/i18n/locales/en/wallet.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,6 @@
"refresh_error_title": "Refresh Failed",
"refresh_error_description": "Bitkit was unable to refresh your wallet.",
"refresh_error_throttle_title": "Connection Throttled",
"refresh_error_throttle_description": "Electrum server connection is throttled. Please wait several minutes before trying again."
"refresh_error_throttle_description": "Electrum server connection is throttled. Please wait several minutes before trying again.",
"ldk_sync_error_title": "Lightning Sync Error"
}
16 changes: 14 additions & 2 deletions src/utils/lightning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ export const setupLdk = async ({
removeUnusedPeers({ selectedWallet, selectedNetwork }),
]);
if (shouldRefreshLdk) {
await refreshLdk({ selectedWallet, selectedNetwork });
const refreshRes = await refreshLdk({ selectedWallet, selectedNetwork });
if (refreshRes.isErr()) {
return err(refreshRes.error.message);
}
}

subscribeToLightningPayments({
Expand Down Expand Up @@ -641,9 +644,18 @@ export const refreshLdk = async ({
addPeers({ selectedNetwork, selectedWallet }),
];
const results = await Promise.all(promises);
// Handle & Return syncLdk errors.
if (results[0].isErr()) {
showToast({
type: 'error',
title: i18n.t('wallet:ldk_sync_error_title'),
description: results[0].error.message,
});
return handleRefreshError(results[0].error.message);
}
for (const result of results) {
if (result.isErr()) {
//Can fail, but we should still continue and make UI ready so payments can be attempted
//setFees & addPeers can fail, but we should still continue and make UI ready so payments can be attempted
console.error(result.error.message);
}
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4375,10 +4375,10 @@
dependencies:
b4a "^1.5.3"

"@synonymdev/[email protected].132":
version "0.0.132"
resolved "https://registry.yarnpkg.com/@synonymdev/react-native-ldk/-/react-native-ldk-0.0.132.tgz#82e1aa7721fd4e5e42ee54bb331840e877945f51"
integrity sha512-dNWT3LJ6EZ36K1vTAGpyw0TWITWmGMQAqHwF9gA8p+MrQaOuHRrrqqTA/+cuSuyhA3D1GSmV8iko39kkXdBqUw==
"@synonymdev/[email protected].134":
version "0.0.134"
resolved "https://registry.yarnpkg.com/@synonymdev/react-native-ldk/-/react-native-ldk-0.0.134.tgz#36870d17128ca76bf08aea6ba6909187fe7fbdd7"
integrity sha512-Peb6VQ/HLe9Tv+MsjnU2pQR7Yi/oU6GtryUwBbfytvbxdsq0luFkAEKHxzQ/wNjO7z1QYLmMhK6IVqJC3zaT8Q==
dependencies:
bech32 "^2.0.0"
bitcoinjs-lib "^6.0.2"
Expand Down

0 comments on commit 57a3502

Please sign in to comment.