()
| 70 | }; |
| 71 | |
| 72 | const DevMenu: React.FC = () => { |
| 73 | const { wallets, addWallet } = useStorage(); |
| 74 | |
| 75 | useEffect(() => { |
| 76 | if (__DEV__) { |
| 77 | // Clear existing Dev Menu items to prevent duplication |
| 78 | DevSettings.addMenuItem('Reset Dev Menu', () => { |
| 79 | DevSettings.reload(); |
| 80 | }); |
| 81 | |
| 82 | DevSettings.addMenuItem('Add New Wallet', async () => { |
| 83 | const wallet = new HDSegwitBech32Wallet(); |
| 84 | await wallet.generate(); |
| 85 | const label = getRandomLabelFromSecret(wallet.getSecret()); |
| 86 | wallet.setLabel(label); |
| 87 | addWallet(wallet); |
| 88 | |
| 89 | Clipboard.setString(wallet.getSecret()); |
| 90 | Alert.alert('New Wallet created!', `Wallet secret copied to clipboard.\nLabel: ${label}`); |
| 91 | }); |
| 92 | |
| 93 | DevSettings.addMenuItem('Copy Wallet Secret', () => { |
| 94 | if (wallets.length === 0) { |
| 95 | Alert.alert('No wallets available'); |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | showAlertWithWalletOptions(wallets, 'Copy Wallet Secret', 'Select the wallet to copy the secret', wallet => { |
| 100 | Clipboard.setString(wallet.getSecret()); |
| 101 | Alert.alert('Wallet Secret copied to clipboard!'); |
| 102 | }); |
| 103 | }); |
| 104 | |
| 105 | DevSettings.addMenuItem('Copy Wallet ID', () => { |
| 106 | if (wallets.length === 0) { |
| 107 | Alert.alert('No wallets available'); |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | showAlertWithWalletOptions(wallets, 'Copy Wallet ID', 'Select the wallet to copy the ID', wallet => { |
| 112 | Clipboard.setString(wallet.getID()); |
| 113 | Alert.alert('Wallet ID copied to clipboard!'); |
| 114 | }); |
| 115 | }); |
| 116 | |
| 117 | DevSettings.addMenuItem('Copy Wallet Xpub', () => { |
| 118 | if (wallets.length === 0) { |
| 119 | Alert.alert('No wallets available'); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | showAlertWithWalletOptions( |
| 124 | wallets, |
| 125 | 'Copy Wallet Xpub', |
| 126 | 'Select the wallet to copy the Xpub', |
| 127 | wallet => { |
| 128 | const xpub = wallet.getXpub(); |
| 129 | if (xpub) { |
nothing calls this directly
no test coverage detected