Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abhi shandy feat bip47 #5373

Merged
merged 31 commits into from Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
07d7b2b
chore: add prettier settings
abhiShandy Dec 7, 2022
154377c
feat: show bip47 switch
abhiShandy Dec 7, 2022
f65842b
feat: save BIP47 toggle value
abhiShandy Dec 7, 2022
aeec8e8
feat: payment code button and screen
abhiShandy Dec 7, 2022
bd38911
feat: button style and locale strings
abhiShandy Dec 7, 2022
563f090
feat: get payment codes and tx history
abhiShandy Dec 12, 2022
68dc86e
fix: add bip47 addresses to the hashmap
abhiShandy Dec 12, 2022
70216ef
chore: use bip47 from spsina
abhiShandy Dec 12, 2022
ffed650
fix: imports
abhiShandy Dec 12, 2022
fd61583
feat: working balance
abhiShandy Dec 13, 2022
dc07637
fix: bip47 package
abhiShandy Dec 13, 2022
e0eed1c
feat: reuse bip47 instance for faster address generation
abhiShandy Dec 15, 2022
a61c726
fix: restore the gap-limit
abhiShandy Dec 16, 2022
a8c8f2b
fix: remove all console.log
abhiShandy Dec 16, 2022
8ca3ab8
feat: get WIF and Pubkey
abhiShandy Dec 16, 2022
9d24f6f
Merge branch 'master' into feat/bip47
abhiShandy Feb 10, 2023
d82f46e
fix: header title
abhiShandy Feb 10, 2023
cdff978
fix: use copy-pastable text component
abhiShandy Feb 10, 2023
50c5ce1
fix: private variable name
abhiShandy Feb 10, 2023
1f2e538
fix: more private variables
abhiShandy Feb 10, 2023
88feb00
test: basic bip47 integration
abhiShandy Feb 10, 2023
5bd79ab
Merge branch 'master' into feat/bip47
abhiShandy Feb 24, 2023
aeb7bf2
chore: use bip47 from the original repo
abhiShandy Feb 24, 2023
1d3bbea
remove prettier config
abhiShandy Mar 3, 2023
7734f3f
remove unnecessary electrum util
abhiShandy Mar 3, 2023
49619e4
Merge branch 'feat/bip47' of github.com:abhiShandy/BlueWallet into ab…
Overtorment Mar 4, 2023
b0b7529
REF: refactored and improved BIP47
Overtorment Mar 15, 2023
f9205eb
Merge remote-tracking branch 'origin/master' into abhiShandy-feat-bip47
Overtorment Mar 15, 2023
47b0177
REF: fix ts lint errors
Overtorment Mar 15, 2023
ec85833
REF: lint
Overtorment Mar 15, 2023
0adbe19
TST: fix
Overtorment Mar 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Expand Up @@ -39,6 +39,7 @@ jobs:
- name: Run tests
run: npm test || npm test || npm test
env:
BIP47_HD_MNEMONIC: ${{ secrets.BIP47_HD_MNEMONIC}}
HD_MNEMONIC: ${{ secrets.HD_MNEMONIC }}
HD_MNEMONIC_BIP49: ${{ secrets.HD_MNEMONIC_BIP49 }}
HD_MNEMONIC_BIP49_MANY_TX: ${{ secrets.HD_MNEMONIC_BIP49_MANY_TX }}
Expand Down
19 changes: 19 additions & 0 deletions Navigation.js
Expand Up @@ -83,6 +83,9 @@ import { isDesktop, isTablet, isHandset } from './blue_modules/environment';
import SettingsPrivacy from './screen/settings/SettingsPrivacy';
import LNDViewAdditionalInvoicePreImage from './screen/lnd/lndViewAdditionalInvoicePreImage';
import LdkViewLogs from './screen/wallets/ldkViewLogs';
import PaymentCode from './screen/wallets/paymentCode';
import PaymentCodesList from './screen/wallets/paymentCodesList';
import loc from './loc';

const WalletsStack = createNativeStackNavigator();

Expand Down Expand Up @@ -465,6 +468,20 @@ const ExportMultisigCoordinationSetupRoot = () => {
);
};

const PaymentCodeStack = createNativeStackNavigator();
const PaymentCodeStackRoot = () => {
return (
<PaymentCodeStack.Navigator name="PaymentCodeRoot" screenOptions={{ headerHideShadow: true }} initialRouteName="PaymentCode">
<PaymentCodeStack.Screen name="PaymentCode" component={PaymentCode} options={{ headerTitle: loc.bip47.payment_code }} />
<PaymentCodeStack.Screen
name="PaymentCodesList"
component={PaymentCodesList}
options={{ headerTitle: loc.bip47.payment_codes_list }}
/>
</PaymentCodeStack.Navigator>
);
};

const RootStack = createNativeStackNavigator();
const NavigationDefaultOptions = { headerShown: false, stackPresentation: isDesktop ? 'containedModal' : 'modal' };
const Navigation = () => {
Expand Down Expand Up @@ -500,6 +517,8 @@ const Navigation = () => {
stackPresentation: isDesktop ? 'containedModal' : 'fullScreenModal',
}}
/>

<RootStack.Screen name="PaymentCodeRoot" component={PaymentCodeStackRoot} options={NavigationDefaultOptions} />
</RootStack.Navigator>
);
};
Expand Down
5 changes: 5 additions & 0 deletions blue_modules/storage-context.js
Expand Up @@ -120,6 +120,10 @@ export const BlueStorageProvider = ({ children }) => {
setWalletTransactionUpdateStatus(WalletTransactionsStatus.ALL);
}
await BlueElectrum.waitTillConnected();
const paymentCodesStart = Date.now();
await fetchSenderPaymentCodes(lastSnappedTo);
const paymentCodesEnd = Date.now();
console.log('fetch payment codes took', (paymentCodesEnd - paymentCodesStart) / 1000, 'sec');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does it take?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2-3 sec cold start to instantiate bip47 instance
(shouldbe faster on production builds)

  • ~500ms for a network fetch

const balanceStart = +new Date();
await fetchWalletBalances(lastSnappedTo);
const balanceEnd = +new Date();
Expand Down Expand Up @@ -201,6 +205,7 @@ export const BlueStorageProvider = ({ children }) => {
const getTransactions = BlueApp.getTransactions;
const isAdvancedModeEnabled = BlueApp.isAdvancedModeEnabled;

const fetchSenderPaymentCodes = BlueApp.fetchSenderPaymentCodes;
const fetchWalletBalances = BlueApp.fetchWalletBalances;
const fetchWalletTransactions = BlueApp.fetchWalletTransactions;
const getBalance = BlueApp.getBalance;
Expand Down
22 changes: 22 additions & 0 deletions class/app-storage.js
Expand Up @@ -682,6 +682,7 @@ export class AppStorage {
}
} else {
for (const wallet of this.wallets) {
console.log('fetching balance for', wallet.getLabel());
await wallet.fetchBalance();
}
}
Expand Down Expand Up @@ -725,6 +726,27 @@ export class AppStorage {
}
};

fetchSenderPaymentCodes = async index => {
console.log('fetchSenderPaymentCodes for wallet#', typeof index === 'undefined' ? '(all)' : index);
if (index || index === 0) {
try {
if (!this.wallets[index].allowBIP47()) return;
await this.wallets[index].fetchBIP47SenderPaymentCodes();
} catch (error) {
console.error('Failed to fetch sender payment codes for wallet', index, error);
}
} else {
for (const wallet of this.wallets) {
try {
if (!wallet.allowBIP47()) continue;
await wallet.fetchBIP47SenderPaymentCodes();
} catch (error) {
console.error('Failed to fetch sender payment codes for wallet', wallet.label, error);
}
}
}
};

/**
*
* @returns {Array.<AbstractWallet>}
Expand Down