use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method associateRecipientWithToken.
@Given("^I associate a(?:n)? (?:existing|new) recipient account(?: (.*))? with token(?: (.*))?$")
public void associateRecipientWithToken(Integer recipientIndex, Integer tokenIndex) {
ExpandedAccountId recipient;
if (recipientIndex == null) {
recipient = accountClient.createNewAccount(10_000_000);
recipients.add(recipient);
} else {
recipient = recipients.get(recipientIndex);
}
associateWithToken(recipient, tokenIds.get(getIndexOrDefault(tokenIndex)));
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method cleanup.
@After
public void cleanup() {
// dissociate all applicable accounts from token to reduce likelihood of max token association error
for (TokenId tokenId : tokenIds) {
// a nonzero balance will result in a TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES error
// not possible to wipe a treasury account as it results in CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT error
// as a result to dissociate first delete token
ExpandedAccountId admin = tokenClient.getSdkClient().getExpandedOperatorAccountId();
try {
tokenClient.delete(admin, tokenId);
dissociateAccounts(tokenId, List.of(admin));
dissociateAccounts(tokenId, recipients);
dissociateAccounts(tokenId, senders);
} catch (Exception ex) {
log.warn("Error cleaning up token {} and associations error: {}", tokenId, ex);
}
}
recipients.clear();
senders.clear();
tokenCustomFees.clear();
tokenIds.clear();
tokenSerialNumbers.clear();
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method transferTokensToSender.
@Then("^I transfer (.*) tokens (?:(.*) )?to sender(?: (.*))?$")
public void transferTokensToSender(int amount, Integer tokenIndex, Integer senderIndex) {
ExpandedAccountId payer = tokenClient.getSdkClient().getExpandedOperatorAccountId();
transferTokens(tokenIds.get(getIndexOrDefault(tokenIndex)), amount, payer, senders.get(getIndexOrDefault(senderIndex)).getAccountId());
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenFeature method updateTokenFeeSchedule.
@Given("I update token {int} with new custom fees schedule")
public void updateTokenFeeSchedule(int tokenIndex, List<CustomFee> customFees) {
ExpandedAccountId admin = tokenClient.getSdkClient().getExpandedOperatorAccountId();
TokenId tokenId = tokenIds.get(tokenIndex);
networkTransactionResponse = tokenClient.updateTokenFeeSchedule(tokenId, admin, customFees);
assertNotNull(networkTransactionResponse.getTransactionId());
assertNotNull(networkTransactionResponse.getReceipt());
tokenCustomFees.put(tokenId, customFees);
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class AccountClient method getAccount.
public ExpandedAccountId getAccount(AccountNameEnum accountNameEnum) {
// retrieve account, setting if it doesn't exist
ExpandedAccountId accountId = accountMap.computeIfAbsent(accountNameEnum, x -> {
try {
return createNewAccount(SMALL_INITIAL_BALANCE, accountNameEnum);
} catch (Exception e) {
log.debug("Issue creating additional account: {}, ex: {}", accountNameEnum, e);
return null;
}
});
if (accountId == null) {
throw new NetworkException("Null accountId retrieved from receipt");
}
long balance = getBalance(accountId);
if (log.isDebugEnabled()) {
log.debug("Retrieved Account: {}, {} w balance {}", accountId, accountNameEnum, balance);
}
return accountId;
}
Aggregations