Package org.ethereum.core

Examples of org.ethereum.core.Wallet


        final Border line = BorderFactory.createLineBorder(Color.LIGHT_GRAY);
        JComponent editor = (JComponent)(creatorAddressCombo.getEditor().getEditorComponent());
        editor.setForeground(Color.RED);

        Wallet wallet = UIEthereumManager.ethereum.getWallet();
        Collection<Account> accounts = wallet.getAccountCollection();

        for (Account account : accounts) {
            creatorAddressCombo.addItem(new AccountWrapper(account));
        }
View Full Code Here


        setResizable(false);

        Container contentPane = this.getContentPane();
        contentPane.setBackground(new Color(255, 255, 255));

        Wallet wallet = UIEthereumManager.ethereum.getWallet();
        wallet.addListener(this);
        loadWallet();

    }
View Full Code Here

        Container contentPane = this.getContentPane();
        contentPane.removeAll();
        contentPane.setLayout(new FlowLayout());

        Wallet wallet = UIEthereumManager.ethereum.getWallet();

        for (Account account : wallet.getAccountCollection()) {
      WalletAddressPanel rowPanel = new WalletAddressPanel(account);
            contentPane.add(rowPanel);
        }

        WalletSumPanel sumPanel = new WalletSumPanel(wallet.totalBalance());
        contentPane.add(sumPanel);

        // TODO: move this to some add button method
        URL addAddressIconURL = ClassLoader.getSystemResource("buttons/add-address.png");
        ImageIcon addAddressIcon = new ImageIcon(addAddressIconURL);
        JLabel addAddressLabel = new JLabel(addAddressIcon);
        addAddressLabel.setToolTipText("Add new address");
        addAddressLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
        addAddressLabel.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {

                Wallet wallet = UIEthereumManager.ethereum.getWallet();
        if (wallet.getAccountCollection().size() >= 5) {
                    JOptionPane.showMessageDialog(walletWindow,
                            "Hey do you really need more than 5 address for a demo wallet");
                    return;
                }

                wallet.addNewAccount();
                Dimension dimension = walletWindow.getSize();
                int height = dimension.height;
                int width = dimension.width;

                Dimension newDimension = new Dimension(width, (height + 45));
View Full Code Here

        ECKey cowKey = ECKey.fromPrivate(HashUtil.sha3("cow".getBytes()));
        repository.createAccount(cowKey.getAddress());
        repository.addBalance(cowKey.getAddress(), BigInteger.TEN);

        Wallet wallet = new Wallet();
        wallet.setWorldManager(worldManager);

        wallet.importKey(cowKey.getPrivKeyBytes());

        BigInteger walletBalance = wallet.getBalance(cowKey.getAddress());
        Assert.assertEquals(BigInteger.TEN, walletBalance);

    }
View Full Code Here

        ECKey cowKey = ECKey.fromPrivate(HashUtil.sha3("cow".getBytes()));
        repository.createAccount(cowKey.getAddress());
        repository.addBalance(cowKey.getAddress(), BigInteger.TEN);

        Wallet wallet = new Wallet();
        wallet.setWorldManager(worldManager);

        wallet.importKey(cowKey.getPrivKeyBytes());

        Transaction tx = new Transaction(
                new byte[]{},
                Hex.decode("09184E72A000"),
                Hex.decode("03E8"),
                cowKey.getAddress(),
                Hex.decode("0A"),
                new byte[]{}
        );

        ECKey catKey = ECKey.fromPrivate(HashUtil.sha3("cat".getBytes()));
        tx.sign(catKey.getPrivKeyBytes());

        wallet.applyTransaction(tx);

        BigInteger walletBalance = wallet.getBalance(cowKey.getAddress());
        Assert.assertEquals(BigInteger.valueOf(20), walletBalance);
    }
View Full Code Here


    @Test
    public void testSave1() throws TransformerException, ParserConfigurationException {

        Wallet wallet = new Wallet();
        wallet.setWorldManager(worldManager);

    ECKey cowKey = ECKey.fromPrivate(HashUtil.sha3("cow".getBytes()));
    ECKey catKey = ECKey.fromPrivate(HashUtil.sha3("cat".getBytes()));

        wallet.importKey(cowKey.getPrivKeyBytes());
        wallet.importKey(catKey.getPrivKeyBytes());

        wallet.setHigh(4354);

        wallet.save();
    }
View Full Code Here

    @Test
    @Ignore
  public void testLoad1() throws TransformerException,
      ParserConfigurationException, IOException, SAXException {
        Wallet wallet = new Wallet();
        wallet.load();
    }
View Full Code Here

  public Transaction call() throws Exception {

    try {
      logger.info("Call() tx: {}", tx.toString());

            Wallet wallet = worldManager.getWallet();
            ChannelManager channelManager = worldManager.getChannelManager();

      WalletTransaction walletTransaction = wallet.addByWalletTransaction(tx);
      channelManager.sendTransaction(tx);

      while (walletTransaction.getApproved() < 1) {
        sleep(10);
      }
View Full Code Here

TOP

Related Classes of org.ethereum.core.Wallet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.