Skip to content

Commit

Permalink
GUI updates for accessing wallet seeds
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Feb 29, 2024
1 parent ada3404 commit 3c543f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTextArea;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import convex.core.crypto.AKeyPair;
import convex.core.crypto.WalletEntry;
import convex.core.data.AccountStatus;
import convex.core.data.Address;
Expand Down Expand Up @@ -106,6 +108,22 @@ public WalletComponent(PeerGUI manager,WalletEntry initialWalletEntry) {
JPopupMenu menu=new JPopupMenu();
JMenuItem m1=new JMenuItem("Edit...");
menu.add(m1);
JMenuItem m2=new JMenuItem("Show seed...");
m2.addActionListener(e-> {
AKeyPair kp=walletEntry.getKeyPair();
if (kp!=null) {
StringBuilder sb=new StringBuilder();
sb.append("\nEd25519 private seed:\n");
sb.append("\n"+kp.getSeed()+"\n\n");
sb.append("\nWarning: keep this private, it can be used to control your accounts\n");
JTextArea text = new JTextArea(sb.toString());
JOptionPane.showMessageDialog(WalletComponent.this, text,"Private Seed",JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(WalletComponent.this, "Seed not available","Warning",JOptionPane.WARNING_MESSAGE);
}
});
menu.add(m2);

DropdownMenu menuButton=new DropdownMenu(menu);
buttons.add(menuButton);

Expand All @@ -127,7 +145,8 @@ private String getInfoString() {
AccountStatus as=s.getAccount(address);
if (as!=null) {
Long bal=as.getBalance();
sb.append("Balance: " + Text.toFriendlyNumber(bal));
sb.append("Public Key: " + walletEntry.getAccountKey()+"\n");
sb.append("Balance: " + Text.toFriendlyNumber(bal));
}
});
//sb.append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public WalletPanel(PeerGUI manager) {
add(toolBar, BorderLayout.SOUTH);

// new wallet button
JButton btnNew = new JButton("New");
JButton btnNew = new JButton("New Account");
toolBar.add(btnNew);
btnNew.addActionListener(e -> {
Convex convex=PeerGUI.getDefaultConvex();
Expand Down

0 comments on commit 3c543f8

Please sign in to comment.