use of com.hedera.hashgraph.sdk.ContractCreateFlow in project hedera-sdk-java by hashgraph.
the class ContractCreateFlowIntegrationTest method createContractWithFlow.
@Test
@DisplayName("Create contract with flow")
void createContractWithFlow() throws Throwable {
var testEnv = new IntegrationTestEnv(1);
var response = new ContractCreateFlow().setBytecode(SMART_CONTRACT_BYTECODE).setAdminKey(testEnv.operatorKey).setGas(100000).setConstructorParameters(new ContractFunctionParameters().addString("Hello from Hedera.")).setContractMemo("[e2e::ContractCreateFlow]").execute(testEnv.client);
var contractId = Objects.requireNonNull(response.getReceipt(testEnv.client).contractId);
var receipt = new ContractExecuteTransaction().setContractId(contractId).setGas(100000).setFunction("setMessage", new ContractFunctionParameters().addString("new message")).execute(testEnv.client).getReceipt(testEnv.client);
assertThat(receipt.status).isEqualTo(Status.SUCCESS);
new ContractDeleteTransaction().setTransferAccountId(testEnv.operatorId).setContractId(contractId).setTransferAccountId(testEnv.operatorId).execute(testEnv.client).getReceipt(testEnv.client);
testEnv.close();
}
Aggregations