Search in sources :

Example 16 with ExpandedAccountId

use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.

the class TokenFeature method dissociateAccounts.

private void dissociateAccounts(TokenId tokenId, List<ExpandedAccountId> accountIds) {
    for (ExpandedAccountId accountId : accountIds) {
        try {
            tokenClient.dissociate(accountId, tokenId);
            log.info("Successfully dissociated account {} from token {}", accountId, tokenId);
        } catch (Exception ex) {
            log.warn("Error dissociating account {} from token {}, error: {}", accountId, tokenId, ex);
        }
    }
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) ReceiptStatusException(com.hedera.hashgraph.sdk.ReceiptStatusException)

Example 17 with ExpandedAccountId

use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.

the class TokenFeature method transferNftsToRecipient.

@Then("^I transfer serial number (?:(.*) )?of token (?:(.*) )?to recipient(?: (.*))?$")
public void transferNftsToRecipient(Integer serialNumberIndex, Integer tokenIndex, Integer recipientIndex) {
    ExpandedAccountId payer = tokenClient.getSdkClient().getExpandedOperatorAccountId();
    TokenId tokenId = tokenIds.get(getIndexOrDefault(tokenIndex));
    transferNfts(tokenId, tokenSerialNumbers.get(tokenId).get(getIndexOrDefault(serialNumberIndex)), payer, recipients.get(getIndexOrDefault(recipientIndex)).getAccountId());
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) TokenId(com.hedera.hashgraph.sdk.TokenId) Then(io.cucumber.java.en.Then)

Example 18 with ExpandedAccountId

use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.

the class ScheduleFeature method createNewCryptoAccountSchedule.

@Given("I successfully schedule a crypto account create")
public void createNewCryptoAccountSchedule() {
    expectedSignersCount = 1;
    currentSignersCount = 0 + signatoryCountOffset;
    ExpandedAccountId alice = accountClient.getAccount(AccountClient.AccountNameEnum.ALICE);
    scheduledTransaction = accountClient.getAccountCreateTransaction(Hbar.fromTinybars(DEFAULT_TINY_HBAR), KeyList.of(alice.getPublicKey()), true, "scheduled case");
    createNewSchedule(scheduledTransaction, null);
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) Given(io.cucumber.java.en.Given)

Example 19 with ExpandedAccountId

use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.

the class ScheduleFeature method createNewTokenTransferSchedule.

@Given("I successfully schedule a token transfer from {string} to {string}")
public void createNewTokenTransferSchedule(String senderName, String receiverName) {
    expectedSignersCount = 2;
    currentSignersCount = 0 + signatoryCountOffset;
    tokenTreasuryAccount = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(senderName));
    ExpandedAccountId receiver = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(receiverName));
    createAndAssociateToken(TokenType.FUNGIBLE_COMMON, DEFAULT_TINY_HBAR, receiverName, receiver);
    Hbar hbarAmount = Hbar.fromTinybars(DEFAULT_TINY_HBAR);
    scheduledTransaction = tokenClient.getFungibleTokenTransferTransaction(tokenId, tokenTreasuryAccount.getAccountId(), receiver.getAccountId(), 10).addHbarTransfer(receiver.getAccountId(), hbarAmount).addHbarTransfer(tokenTreasuryAccount.getAccountId(), hbarAmount.negated());
    createNewSchedule(scheduledTransaction, null);
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) Hbar(com.hedera.hashgraph.sdk.Hbar) Given(io.cucumber.java.en.Given)

Example 20 with ExpandedAccountId

use of com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId in project hedera-mirror-node by hashgraph.

the class ScheduleFeature method createNewNftTransferSchedule.

@Given("I successfully schedule an nft transfer from {string} to {string}")
public void createNewNftTransferSchedule(String senderName, String receiverName) {
    expectedSignersCount = 2;
    currentSignersCount = 0 + signatoryCountOffset;
    tokenTreasuryAccount = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(senderName));
    ExpandedAccountId receiver = accountClient.getAccount(AccountClient.AccountNameEnum.valueOf(receiverName));
    createAndAssociateToken(TokenType.NON_FUNGIBLE_UNIQUE, 0, receiverName, receiver);
    networkTransactionResponse = tokenClient.mint(tokenId, 0, RandomUtils.nextBytes(4));
    assertNotNull(networkTransactionResponse.getTransactionId());
    assertNotNull(networkTransactionResponse.getReceipt());
    serialNumber = networkTransactionResponse.getReceipt().serials.get(0);
    scheduledTransaction = tokenClient.getNonFungibleTokenTransferTransaction(tokenId, tokenTreasuryAccount.getAccountId(), receiver.getAccountId(), Arrays.asList(serialNumber));
    createNewSchedule(scheduledTransaction, null);
}
Also used : ExpandedAccountId(com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId) Given(io.cucumber.java.en.Given)

Aggregations

ExpandedAccountId (com.hedera.mirror.test.e2e.acceptance.props.ExpandedAccountId)20 Given (io.cucumber.java.en.Given)9 AccountId (com.hedera.hashgraph.sdk.AccountId)4 TokenId (com.hedera.hashgraph.sdk.TokenId)4 KeyList (com.hedera.hashgraph.sdk.KeyList)3 Then (io.cucumber.java.en.Then)3 PrivateKey (com.hedera.hashgraph.sdk.PrivateKey)2 ReceiptStatusException (com.hedera.hashgraph.sdk.ReceiptStatusException)2 NetworkTransactionResponse (com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)2 When (io.cucumber.java.en.When)2 AccountCreateTransaction (com.hedera.hashgraph.sdk.AccountCreateTransaction)1 Hbar (com.hedera.hashgraph.sdk.Hbar)1 PublicKey (com.hedera.hashgraph.sdk.PublicKey)1 TokenUpdateTransaction (com.hedera.hashgraph.sdk.TokenUpdateTransaction)1 TopicId (com.hedera.hashgraph.sdk.TopicId)1 TransactionReceipt (com.hedera.hashgraph.sdk.TransactionReceipt)1 After (io.cucumber.java.After)1