use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class AccountClient method createCryptoAccount.
public ExpandedAccountId createCryptoAccount(Hbar initialBalance, boolean receiverSigRequired, KeyList keyList, String memo) {
// 1. Generate a Ed25519 private, public key pair
PrivateKey privateKey = PrivateKey.generate();
PublicKey publicKey = privateKey.getPublicKey();
log.trace("Private key = {}", privateKey);
log.trace("Public key = {}", publicKey);
KeyList publicKeyList = KeyList.of(privateKey.getPublicKey());
if (keyList != null) {
publicKeyList.addAll(keyList);
}
AccountCreateTransaction accountCreateTransaction = getAccountCreateTransaction(initialBalance, publicKeyList, receiverSigRequired, memo == null ? "" : memo);
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(accountCreateTransaction, receiverSigRequired ? KeyList.of(privateKey) : null);
TransactionReceipt receipt = networkTransactionResponse.getReceipt();
AccountId newAccountId = receipt.accountId;
// verify accountId
if (receipt.accountId == null) {
throw new NetworkException(String.format("Receipt for %s returned no accountId, receipt: %s", networkTransactionResponse.getTransactionId(), receipt));
}
log.debug("Created new account {}, receiverSigRequired: {}", newAccountId, receiverSigRequired);
return new ExpandedAccountId(newAccountId, privateKey, privateKey.getPublicKey());
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class AccountFeature method sendHbars.
@When("I send {int} ℏ to account {int}")
public void sendHbars(int amount, int accountNum) {
senderAccountId = new ExpandedAccountId(new AccountId(accountNum));
startingBalance = accountClient.getBalance(senderAccountId);
networkTransactionResponse = accountClient.sendCryptoTransfer(senderAccountId.getAccountId(), Hbar.from(amount));
assertNotNull(networkTransactionResponse.getTransactionId());
assertNotNull(networkTransactionResponse.getReceipt());
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class ScheduleFeature method createNewHBarTransferSchedule.
@Given("I successfully schedule a treasury HBAR disbursement to {string}")
public void createNewHBarTransferSchedule(String accountName) {
expectedSignersCount = 2;
currentSignersCount = 0 + signatoryCountOffset;
ExpandedAccountId recipient = accountClient.getAccount(// receiverSigRequired
AccountClient.AccountNameEnum.valueOf(accountName));
scheduledTransaction = accountClient.getCryptoTransferTransaction(accountClient.getTokenTreasuryAccount().getAccountId(), recipient.getAccountId(), Hbar.fromTinybars(DEFAULT_TINY_HBAR), false);
createNewSchedule(scheduledTransaction, null);
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method createNewToken.
private TokenId createNewToken(String symbol, int freezeStatus, int kycStatus, TokenType tokenType, TokenSupplyType tokenSupplyType, List<CustomFee> customFees) {
ExpandedAccountId admin = tokenClient.getSdkClient().getExpandedOperatorAccountId();
networkTransactionResponse = tokenClient.createToken(admin, symbol, freezeStatus, kycStatus, admin, INITIAL_SUPPLY, tokenSupplyType, MAX_SUPPLY, tokenType, customFees);
assertNotNull(networkTransactionResponse.getTransactionId());
assertNotNull(networkTransactionResponse.getReceipt());
TokenId tokenId = networkTransactionResponse.getReceipt().tokenId;
assertNotNull(tokenId);
tokenIds.add(tokenId);
tokenCustomFees.put(tokenId, customFees);
return tokenId;
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method associateSenderWithToken.
@Given("^I associate a(?:n)? (?:existing|new) sender account(?: (.*))? with token(?: (.*))?$")
public void associateSenderWithToken(Integer senderIndex, Integer tokenIndex) {
ExpandedAccountId sender;
if (senderIndex == null) {
sender = accountClient.createNewAccount(10_000_000);
senders.add(sender);
} else {
sender = senders.get(senderIndex);
}
associateWithToken(sender, tokenIds.get(getIndexOrDefault(tokenIndex)));
}
Aggregations