use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.
the class TokenFeature method mintNftToken.
@Given("I mint a serial number from the token")
public void mintNftToken() {
TokenId tokenId = tokenIds.get(0);
networkTransactionResponse = tokenClient.mint(tokenId, RandomUtils.nextBytes(4));
assertNotNull(networkTransactionResponse.getTransactionId());
TransactionReceipt receipt = networkTransactionResponse.getReceipt();
assertNotNull(receipt);
assertThat(receipt.serials.size()).isEqualTo(1);
long serialNumber = receipt.serials.get(0);
assertThat(serialNumber).isPositive();
tokenSerialNumbers.get(tokenId).add(serialNumber);
}
use of com.hedera.hashgraph.sdk.TokenId in project hedera-mirror-node by hashgraph.
the class CryptoTransferTransactionSupplierTest method createWithCustomAllTransfer.
@Test
void createWithCustomAllTransfer() {
TokenId nftTokenId = TokenId.fromString("0.0.21");
Hbar transferAmount = Hbar.fromTinybars(2);
CryptoTransferTransactionSupplier cryptoTransferTransactionSupplier = new CryptoTransferTransactionSupplier();
cryptoTransferTransactionSupplier.setAmount(2);
cryptoTransferTransactionSupplier.setMaxTransactionFee(1);
cryptoTransferTransactionSupplier.setNftTokenId(nftTokenId.toString());
cryptoTransferTransactionSupplier.setRecipientAccountId(ACCOUNT_ID_2.toString());
cryptoTransferTransactionSupplier.setSenderAccountId(ACCOUNT_ID.toString());
cryptoTransferTransactionSupplier.setSerialNumber(new AtomicLong(10));
cryptoTransferTransactionSupplier.setTokenId(TOKEN_ID.toString());
cryptoTransferTransactionSupplier.setTransferTypes(Set.of(CRYPTO, NFT, TOKEN));
TransferTransaction actual = cryptoTransferTransactionSupplier.get();
assertThat(actual).returns(ONE_TINYBAR, TransferTransaction::getMaxTransactionFee).satisfies(a -> assertThat(a.getHbarTransfers()).containsEntry(ACCOUNT_ID, transferAmount.negated()).containsEntry(ACCOUNT_ID_2, transferAmount)).satisfies(a -> assertThat(a).extracting(TransferTransaction::getTokenNftTransfers, MAP).hasSize(1).extractingByKey(nftTokenId, LIST).extracting("serial", "sender", "receiver").containsExactlyInAnyOrder(tuple(10L, ACCOUNT_ID, ACCOUNT_ID_2), tuple(11L, ACCOUNT_ID, ACCOUNT_ID_2))).extracting(TransferTransaction::getHbarTransfers, MAP).hasSize(2).containsEntry(ACCOUNT_ID, transferAmount.negated()).containsEntry(ACCOUNT_ID_2, transferAmount);
}
Aggregations