Search in sources :

Example 1 with Wallet

use of org.tron.core.Wallet in project java-tron by tronprotocol.

the class WalletTest method testGetAddress.

@Test
public void testGetAddress() {
    ECKey ecKey = new ECKey(Utils.getRandom());
    Wallet wallet = new Wallet(ecKey);
    logger.info("ecKey address = {}", ByteArray.toHexString(ecKey.getAddress()));
    logger.info("wallet address = {}", ByteArray.toHexString(wallet.getAddress()));
    assertArrayEquals(wallet.getAddress(), ecKey.getAddress());
}
Also used : Wallet(org.tron.core.Wallet) ECKey(org.tron.common.crypto.ECKey) Test(org.junit.Test)

Example 2 with Wallet

use of org.tron.core.Wallet in project java-tron by tronprotocol.

the class WalletTest method testWallet.

@Test
public void testWallet() {
    Wallet wallet = new Wallet();
    Wallet wallet2 = new Wallet();
    logger.info("wallet address = {}", ByteArray.toHexString(wallet.getAddress()));
    logger.info("wallet2 address = {}", ByteArray.toHexString(wallet2.getAddress()));
    assertFalse(wallet.getAddress().equals(wallet2.getAddress()));
}
Also used : Wallet(org.tron.core.Wallet) Test(org.junit.Test)

Example 3 with Wallet

use of org.tron.core.Wallet in project java-tron by tronprotocol.

the class WalletTest method testGetEcKey.

@Test
public void testGetEcKey() {
    ECKey ecKey = new ECKey(Utils.getRandom());
    ECKey ecKey2 = new ECKey(Utils.getRandom());
    Wallet wallet = new Wallet(ecKey);
    logger.info("ecKey address = {}", ByteArray.toHexString(ecKey.getAddress()));
    logger.info("wallet address = {}", ByteArray.toHexString(wallet.getAddress()));
    assertEquals("Wallet ECKey should match provided ECKey", wallet.getEcKey(), ecKey);
}
Also used : Wallet(org.tron.core.Wallet) ECKey(org.tron.common.crypto.ECKey) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Wallet (org.tron.core.Wallet)3 ECKey (org.tron.common.crypto.ECKey)2