Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Ivanov <[email protected]>
  • Loading branch information
0xivanov committed Nov 14, 2024
1 parent 5f2e437 commit d8bd3a9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ testing.suites {
testType = TestSuiteType.INTEGRATION_TEST
targets.all {
testTask {
failFast = true
group = "build"
systemProperty("CONFIG_FILE", providers.gradleProperty("CONFIG_FILE").getOrElse(""))
systemProperty("HEDERA_NETWORK", providers.gradleProperty("HEDERA_NETWORK").getOrElse(""))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class MirrorNodeContractQuery {
private String senderEvmAddress = null;
// The transaction callData
private byte[] callData;
// The amount we are sending to payable functions
// The amount we are sending to the contract
private long value;
// The gas limit
private long gasLimit;
Expand Down Expand Up @@ -170,6 +170,14 @@ public long getValue() {
return this.value;
}

/**
* Sets the amount of value (in tinybars or wei) to be sent to the contract in the transaction.
* <p>
* Use this to specify an amount for a payable function call.
*
* @param value the amount of value to send, in tinybars or wei
* @return {@code this}
*/
public MirrorNodeContractQuery setValue(long value) {
this.value = value;
return this;
Expand All @@ -179,6 +187,14 @@ public long getGasLimit() {
return this.gasLimit;
}

/**
* Sets the gas limit for the contract call.
* <p>
* This specifies the maximum amount of gas that the transaction can consume.
*
* @param gasLimit the maximum gas allowed for the transaction
* @return {@code this}
*/
public MirrorNodeContractQuery setGasLimit(long gasLimit) {
this.gasLimit = gasLimit;
return this;
Expand All @@ -188,6 +204,14 @@ public long getGasPrice() {
return gasPrice;
}

/**
* Sets the gas price to be used for the contract call.
* <p>
* This specifies the price of each unit of gas used in the transaction.
*
* @param gasPrice the gas price, in tinybars or wei, for each unit of gas
* @return {@code this}
*/
public MirrorNodeContractQuery setGasPrice(long gasPrice) {
this.gasPrice = gasPrice;
return this;
Expand All @@ -197,6 +221,14 @@ public long getBlockNumber() {
return this.blockNumber;
}

/**
* Sets the block number for the simulation of the contract call.
* <p>
* The block number determines the context of the contract call simulation within the blockchain.
*
* @param blockNumber the block number at which to simulate the contract call
* @return {@code this}
*/
public MirrorNodeContractQuery setBlockNumber(long blockNumber) {
this.blockNumber = blockNumber;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void testCreateJsonPayloadAllFieldsSet() {
gasPrice, value, blockNumber, estimate);

JsonObject expectedJson = new JsonObject();
expectedJson.addProperty("data", "testData");
expectedJson.addProperty("data", "7465737444617461");
expectedJson.addProperty("to", contractAddress);
expectedJson.addProperty("estimate", estimate);
expectedJson.addProperty("blockNumber", blockNumber);
Expand All @@ -170,7 +170,7 @@ void testCreateJsonPayloadOnlyRequiredFieldsSet() {
gasPrice, value, blockNumber, estimate);

JsonObject expectedJson = new JsonObject();
expectedJson.addProperty("data", "testData");
expectedJson.addProperty("data", "7465737444617461");
expectedJson.addProperty("to", contractAddress);
expectedJson.addProperty("estimate", estimate);
expectedJson.addProperty("blockNumber", blockNumber);
Expand All @@ -193,7 +193,7 @@ void testCreateJsonPayloadSomeOptionalFieldsSet() {
gasPrice, value, blockNumber, estimate);

JsonObject expectedJson = new JsonObject();
expectedJson.addProperty("data", "testData");
expectedJson.addProperty("data", "7465737444617461");
expectedJson.addProperty("to", contractAddress);
expectedJson.addProperty("estimate", estimate);
expectedJson.addProperty("blockNumber", blockNumber);
Expand All @@ -219,7 +219,7 @@ void testCreateJsonPayloadAllOptionalFieldsDefault() {
gasPrice, value, blockNumber, estimate);

JsonObject expectedJson = new JsonObject();
expectedJson.addProperty("data", "testData");
expectedJson.addProperty("data", "7465737444617461");
expectedJson.addProperty("to", contractAddress);
expectedJson.addProperty("estimate", estimate);
expectedJson.addProperty("blockNumber", blockNumber);
Expand Down

0 comments on commit d8bd3a9

Please sign in to comment.