use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class ScheduleFeature method createNewCryptoAccountSchedule.
@Given("I schedule a crypto transfer with {int} initial signatures but require an additional signature from " + "{string}")
public void createNewCryptoAccountSchedule(int initSignatureCount, String accountName) {
// new account, accountName and initSignatureCount
expectedSignersCount = 2 + initSignatureCount;
currentSignersCount = initSignatureCount + signatoryCountOffset;
ExpandedAccountId finalSignatory = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(accountName));
KeyList privateKeyList = new KeyList();
KeyList publicKeyList = new KeyList();
for (int i = 0; i < initSignatureCount; i++) {
PrivateKey accountKey = PrivateKey.generate();
privateKeyList.add(accountKey);
publicKeyList.add(accountKey.getPublicKey());
}
// additional signatory not provided up front to prevent schedule from executing
publicKeyList.add(finalSignatory.getPublicKey());
ExpandedAccountId newAccountId = accountClient.createCryptoAccount(Hbar.fromTinybars(DEFAULT_TINY_HBAR), false, publicKeyList, "scheduled transfer");
scheduledTransaction = accountClient.getCryptoTransferTransaction(newAccountId.getAccountId(), accountClient.getSdkClient().getExpandedOperatorAccountId().getAccountId(), Hbar.fromTinybars(DEFAULT_TINY_HBAR));
// add sender private key to ensure only Alice's signature is the only signature left that is required
privateKeyList.add(newAccountId.getPrivateKey());
createNewSchedule(scheduledTransaction, privateKeyList);
currentSignersCount++;
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class ScheduleFeature method createNewHCSSchedule.
@Given("I successfully schedule a topic message submit with {string}'s submit key")
public void createNewHCSSchedule(String accountName) {
expectedSignersCount = 1;
currentSignersCount = 0 + signatoryCountOffset;
ExpandedAccountId submitAdmin = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(accountName));
// create topic w submit key
log.debug("Create new topic with {}'s submit key", accountName);
networkTransactionResponse = topicClient.createTopic(scheduleClient.getSdkClient().getExpandedOperatorAccountId(), submitAdmin.getPublicKey());
assertNotNull(networkTransactionResponse.getTransactionId());
assertNotNull(networkTransactionResponse.getReceipt());
TopicId topicId = networkTransactionResponse.getReceipt().topicId;
assertNotNull(topicId);
scheduledTransaction = topicClient.getTopicMessageSubmitTransaction(topicId, "scheduled hcs message".getBytes(StandardCharsets.UTF_8));
createNewSchedule(scheduledTransaction, null);
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class TokenClient method updateTokenTreasury.
public NetworkTransactionResponse updateTokenTreasury(TokenId tokenId, ExpandedAccountId newTreasuryId) {
AccountId treasuryAccountId = newTreasuryId.getAccountId();
String memo = getMemo("Update token");
TokenUpdateTransaction tokenUpdateTransaction = new TokenUpdateTransaction().setTokenId(tokenId).setTokenMemo(memo).setTreasuryAccountId(treasuryAccountId).setTransactionMemo(memo);
KeyList keyList = KeyList.of(newTreasuryId.getPrivateKey());
NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(tokenUpdateTransaction, keyList);
log.debug("Updated token {} treasury account {}.", tokenId, treasuryAccountId);
return networkTransactionResponse;
}
use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.
the class AccountFeature method sendTinyHbars.
@When("I send {long} tℏ to account {int}")
public void sendTinyHbars(long amount, int accountNum) {
senderAccountId = new ExpandedAccountId(new AccountId(accountNum));
startingBalance = accountClient.getBalance(senderAccountId);
networkTransactionResponse = accountClient.sendCryptoTransfer(senderAccountId.getAccountId(), Hbar.fromTinybars(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 TokenFeature method transferTokensToRecipient.
@Then("^I transfer (.*) tokens (?:(.*) )?to recipient(?: (.*))?$")
public void transferTokensToRecipient(int amount, Integer tokenIndex, Integer recipientIndex) {
ExpandedAccountId payer = tokenClient.getSdkClient().getExpandedOperatorAccountId();
transferTokens(tokenIds.get(getIndexOrDefault(tokenIndex)), amount, payer, recipients.get(getIndexOrDefault(recipientIndex)).getAccountId());
}
Aggregations