Search in sources :

Example 1 with CurrentAndNextFeeSchedule

use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.

the class FeesJsonToProtoSerdeTest method preservesR4Behavior.

@Test
void preservesR4Behavior() throws Exception {
    // given:
    CurrentAndNextFeeSchedule expectedR4 = CurrentAndNextFeeSchedule.parseFrom(Files.toByteArray(new File(UNTYPED_FEE_SCHEDULE_REPR_PATH)));
    // when:
    CurrentAndNextFeeSchedule actual = loadFeeScheduleFromJson("sysfiles/R4FeeSchedule.json");
    // then:
    assertEquals(expectedR4, actual);
}
Also used : CurrentAndNextFeeSchedule(com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 2 with CurrentAndNextFeeSchedule

use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.

the class FeesAndRatesProvider method downloadFeeSchedule.

private void downloadFeeSchedule() throws Throwable {
    long queryFee = lookupDownloadFee(setup.feeScheduleId());
    FileGetContentsResponse response = downloadWith(queryFee, false, setup.feeScheduleId());
    byte[] bytes = response.getFileContents().getContents().toByteArray();
    CurrentAndNextFeeSchedule wrapper = CurrentAndNextFeeSchedule.parseFrom(bytes);
    feeSchedule = typePatching.withPatchedTypesIfNecessary(wrapper.getCurrentFeeSchedule());
    log.info("The fee schedule covers " + feeSchedule.getTransactionFeeScheduleList().size() + " ops.");
}
Also used : CurrentAndNextFeeSchedule(com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule) FileGetContentsResponse(com.hederahashgraph.api.proto.java.FileGetContentsResponse)

Example 3 with CurrentAndNextFeeSchedule

use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.

the class FeesAndRatesProvider method readFeeSchedule.

private void readFeeSchedule() throws Throwable {
    File f = new File(setup.clientFeeSchedulePath());
    byte[] bytes = Files.readAllBytes(f.toPath());
    CurrentAndNextFeeSchedule wrapper = CurrentAndNextFeeSchedule.parseFrom(bytes);
    feeSchedule = wrapper.getCurrentFeeSchedule();
    log.info("The fee schedule from '" + f.getAbsolutePath() + "' covers " + feeSchedule.getTransactionFeeScheduleList().size() + " ops.");
}
Also used : CurrentAndNextFeeSchedule(com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule) File(java.io.File)

Example 4 with CurrentAndNextFeeSchedule

use of com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule in project hedera-services by hashgraph.

the class BasicFcfsUsagePricesTest method loadsGoodScheduleUneventfully.

@Test
void loadsGoodScheduleUneventfully() throws Exception {
    // setup:
    byte[] bytes = Files.toByteArray(new File(R4_FEE_SCHEDULE_REPR_PATH));
    CurrentAndNextFeeSchedule expectedFeeSchedules = CurrentAndNextFeeSchedule.parseFrom(bytes);
    given(hfs.exists(schedules)).willReturn(true);
    given(hfs.cat(schedules)).willReturn(bytes);
    // when:
    subject.loadPriceSchedules();
    // then:
    assertEquals(expectedFeeSchedules, subject.feeSchedules);
}
Also used : CurrentAndNextFeeSchedule(com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

CurrentAndNextFeeSchedule (com.hederahashgraph.api.proto.java.CurrentAndNextFeeSchedule)4 File (java.io.File)3 Test (org.junit.jupiter.api.Test)2 FileGetContentsResponse (com.hederahashgraph.api.proto.java.FileGetContentsResponse)1