use of com.hederahashgraph.api.proto.java.TokenType.NON_FUNGIBLE_UNIQUE in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method nftUpdateTreasury.
@Test
void nftUpdateTreasury() {
// given
createAndAssociateToken(TOKEN_ID, NON_FUNGIBLE_UNIQUE, SYMBOL, CREATE_TIMESTAMP, ASSOCIATE_TIMESTAMP, PAYER2, false, false, false, 0);
long mintTimestamp = 10L;
List<Long> serialNumbers = List.of(1L);
TokenTransferList mintTransfer = nftTransfer(TOKEN_ID, PAYER, DEFAULT_ACCOUNT_ID, serialNumbers);
Transaction mintTransaction = tokenSupplyTransaction(TOKEN_ID, NON_FUNGIBLE_UNIQUE, true, 0, serialNumbers);
insertAndParseTransaction(mintTimestamp, mintTransaction, builder -> {
builder.getReceiptBuilder().setNewTotalSupply(serialNumbers.size()).addAllSerialNumbers(serialNumbers);
builder.addTokenTransferLists(mintTransfer);
});
// when
long updateTimestamp = 15L;
TokenTransferList treasuryUpdateTransfer = nftTransfer(TOKEN_ID, PAYER2, PAYER, List.of(NftTransferId.WILDCARD_SERIAL_NUMBER));
insertAndParseTransaction(updateTimestamp, buildTransaction(builder -> builder.getTokenUpdateBuilder().setToken(TOKEN_ID).setTreasury(PAYER2)), builder -> builder.addTokenTransferLists(treasuryUpdateTransfer));
// then
assertThat(nftTransferRepository.findAll()).containsExactlyInAnyOrder(domainNftTransfer(mintTimestamp, PAYER, DEFAULT_ACCOUNT_ID, 1L, TOKEN_ID, PAYER), domainNftTransfer(updateTimestamp, PAYER2, PAYER, 1L, TOKEN_ID, PAYER));
}
Aggregations