Search in sources :

Example 1 with AccountStateConverter

use of org.aion.rpc.types.RPCTypesConverter.AccountStateConverter 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

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