Search in sources :

Example 1 with AddressParams

use of org.aion.rpc.types.RPCTypes.AddressParams in project aion by aionnetwork.

the class MiningRPCImplTest method testGetMinerStatsMock.

@Test
public void testGetMinerStatsMock() {
    MinerStats minerStats = execute(buildRequest("getMinerStatistics", AddressParamsConverter.encode(new AddressParams(AddressConverter.decode("0xa0c5bf6c4779bf8c2e0a3ff71353d09b066db2b5876ee2345efb836510b3126b")))), MinerStatsConverter::decode);
    assertNotNull(minerStats);
    assertEquals("1", minerStats.minerHashrate);
    assertEquals("1", minerStats.minerHashrateShare);
    assertEquals("1", minerStats.networkHashRate);
}
Also used : MinerStatsConverter(org.aion.rpc.types.RPCTypesConverter.MinerStatsConverter) AddressParams(org.aion.rpc.types.RPCTypes.AddressParams) MinerStats(org.aion.rpc.types.RPCTypes.MinerStats) Test(org.junit.Test)

Example 2 with AddressParams

use of org.aion.rpc.types.RPCTypes.AddressParams in project aion by aionnetwork.

the class OpsRPCImplTest method testOps_getAccountState.

@Test
public void testOps_getAccountState() {
    AionAddress aionAddress = new AionAddress(ByteUtil.hexStringToBytes("a07913c03686c9659c1b614d098fd1db380a52b71fd58526b53d8107f7b355d5"));
    Request request = new Request(idGenerator.generateID(), getAccountStateMethod, AddressParamsConverter.encode(new AddressParams(aionAddress)), VersionType.Version2);
    final RPCTypes.AccountState result = execute(request, AccountStateConverter::decode);
    assertNotNull(result);
    assertEquals(aionAddress, result.address);
    assertEquals(BigInteger.TEN, result.balance);
    assertEquals(BigInteger.TEN, result.nonce);
}
Also used : AionAddress(org.aion.types.AionAddress) AccountStateConverter(org.aion.rpc.types.RPCTypesConverter.AccountStateConverter) Request(org.aion.rpc.types.RPCTypes.Request) RPCTypes(org.aion.rpc.types.RPCTypes) AddressParams(org.aion.rpc.types.RPCTypes.AddressParams) Test(org.junit.Test)

Aggregations

AddressParams (org.aion.rpc.types.RPCTypes.AddressParams)2 Test (org.junit.Test)2 RPCTypes (org.aion.rpc.types.RPCTypes)1 MinerStats (org.aion.rpc.types.RPCTypes.MinerStats)1 Request (org.aion.rpc.types.RPCTypes.Request)1 AccountStateConverter (org.aion.rpc.types.RPCTypesConverter.AccountStateConverter)1 MinerStatsConverter (org.aion.rpc.types.RPCTypesConverter.MinerStatsConverter)1 AionAddress (org.aion.types.AionAddress)1