use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class TokenClient method updateToken.
public NetworkTransactionResponse updateToken(TokenId tokenId, ExpandedAccountId expandedAccountId) {
PublicKey publicKey = expandedAccountId.getPublicKey();
String newSymbol = RandomStringUtils.randomAlphabetic(4).toUpperCase();
String memo = getMemo("Update token");
TokenUpdateTransaction tokenUpdateTransaction = new TokenUpdateTransaction().setAdminKey(publicKey).setAutoRenewAccountId(expandedAccountId.getAccountId()).setAutoRenewPeriod(Duration.ofSeconds(8_000_001L)).setTokenName(newSymbol + "_name").setSupplyKey(publicKey).setTokenMemo(memo).setTokenSymbol(newSymbol).setTokenId(tokenId).setTransactionMemo(memo).setTreasuryAccountId(client.getOperatorAccountId()).setWipeKey(publicKey).setMaxTransactionFee(sdkClient.getMaxTransactionFee());
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenUpdateTransaction);
log.debug("Updated token {}.", tokenId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class TokenClient method mint.
public NetworkTransactionResponse mint(TokenId tokenId, long amount, byte[] metadata) {
log.debug("Mint {} tokens from {}", amount, tokenId);
TokenMintTransaction tokenMintTransaction = new TokenMintTransaction().setTokenId(tokenId).setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTransactionMemo(getMemo("Mint token"));
if (metadata != null) {
tokenMintTransaction.addMetadata(metadata);
} else {
tokenMintTransaction.setAmount(amount);
}
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenMintTransaction);
log.debug("Minted {} extra tokens for token {}", amount, tokenId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class TokenClient method revokeKyc.
public NetworkTransactionResponse revokeKyc(TokenId tokenId, AccountId accountId) {
log.debug("Grant account {} with KYC for token {}", accountId, tokenId);
TokenRevokeKycTransaction tokenRevokeKycTransaction = new TokenRevokeKycTransaction().setAccountId(accountId).setTokenId(tokenId).setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTransactionMemo(getMemo("Revoke kyc for token"));
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenRevokeKycTransaction);
log.debug("Revoked Kyc for account {} with token {}", accountId, tokenId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class AccountClient method approveCryptoAllowance.
public NetworkTransactionResponse approveCryptoAllowance(AccountId spender, Hbar hbarAmount) {
var ownerAccountId = sdkClient.getExpandedOperatorAccountId().getAccountId();
log.debug("Approve spender {} an allowance of {} tℏ on {}'s account", spender, hbarAmount.toTinybars(), ownerAccountId);
var transaction = new AccountAllowanceApproveTransaction().approveHbarAllowance(null, spender, hbarAmount);
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(transaction);
log.debug("Sent Account Allowance Approval");
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse in project hedera-mirror-node by hashgraph.
the class AccountClient method sendCryptoTransfer.
private NetworkTransactionResponse sendCryptoTransfer(ExpandedAccountId sender, AccountId recipient, Hbar hbarAmount, boolean isApproval) {
log.debug("Send CryptoTransfer of {} tℏ from {} to {}. isApproval: {}", hbarAmount.toTinybars(), sender.getAccountId(), recipient, isApproval);
TransferTransaction cryptoTransferTransaction = getCryptoTransferTransaction(sender.getAccountId(), recipient, hbarAmount, isApproval);
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(cryptoTransferTransaction, isApproval ? KeyList.of(sender.getPrivateKey()) : null);
log.debug("Sent CryptoTransfer");
return networkTransactionResponse;
}
Aggregations