Search in sources :

Example 1 with BlockSpecifierUnion

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

the class OpsRPCImplTest method testBlockDetailsEncode.

@Test
public void testBlockDetailsEncode() {
    BlockDetailsConverter.encode(opsRPC.ops_getBlockDetails(new BlockSpecifierUnion(1L)));
    BlockDetailsConverter.encode(opsRPC.ops_getBlockDetails(new BlockSpecifierUnion(2L)));
    BlockDetailsConverter.encode(opsRPC.ops_getBlockDetails(new BlockSpecifierUnion(ByteArray.wrap(emptyPowBlock.getHash()))));
    System.out.println(BlockDetailsConverter.encode(opsRPC.ops_getBlockDetails(new BlockSpecifierUnion(ByteArray.wrap(emptyPosBlock.getHash())))));
    BlockDetailsConverter.encode(opsRPC.ops_getBlockDetails(new BlockSpecifierUnion(BlockEnum.LATEST)));
}
Also used : BlockSpecifierUnion(org.aion.rpc.types.RPCTypes.BlockSpecifierUnion) Test(org.junit.Test)

Example 2 with BlockSpecifierUnion

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

the class OpsRPCImplTest method testOps_getBlockDetails.

@Test
public void testOps_getBlockDetails() {
    assertNotNull(execute(new Request(idGenerator.generateID(), "ops_getBlockDetails", BlockSpecifierParamsConverter.encode(new BlockSpecifierParams(new BlockSpecifierUnion(1L))), VersionType.Version2), BlockDetailsConverter::decode));
    assertNotNull(execute(new Request(idGenerator.generateID(), "ops_getBlockDetails", BlockSpecifierParamsConverter.encode(BlockSpecifierParamsConverter.decode("[latest]")), VersionType.Version2), BlockDetailsConverter::decode));
    assertNotNull(execute(new Request(idGenerator.generateID(), "ops_getBlockDetails", BlockSpecifierParamsConverter.encode(BlockSpecifierParamsConverter.decode("{\"block\": \"" + ByteArray.wrap(emptyPowBlock.getHash()) + "\"}")), VersionType.Version2), BlockDetailsConverter::decode));
}
Also used : BlockSpecifierUnion(org.aion.rpc.types.RPCTypes.BlockSpecifierUnion) BlockSpecifierParams(org.aion.rpc.types.RPCTypes.BlockSpecifierParams) Request(org.aion.rpc.types.RPCTypes.Request) Test(org.junit.Test)

Aggregations

BlockSpecifierUnion (org.aion.rpc.types.RPCTypes.BlockSpecifierUnion)2 Test (org.junit.Test)2 BlockSpecifierParams (org.aion.rpc.types.RPCTypes.BlockSpecifierParams)1 Request (org.aion.rpc.types.RPCTypes.Request)1