Search in sources :

Example 81 with Account

use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.

the class MosaicDefinitionTransactionTest method createAMosaicCreationTransactionViaStaticConstructor.

@Test
void createAMosaicCreationTransactionViaStaticConstructor() {
    Account owner = Account.generateNewAccount(NetworkType.MIJIN_TEST);
    Duration epochAdjustment = Duration.ofSeconds(100);
    int nonceNumber = 12345;
    MosaicNonce nonce = MosaicNonce.createFromInteger(nonceNumber);
    MosaicDefinitionTransaction mosaicCreationTx = MosaicDefinitionTransactionFactory.create(NetworkType.MIJIN_TEST, Deadline.create(epochAdjustment), nonce, MosaicId.createFromNonce(nonce, owner.getPublicAccount()), MosaicFlags.create(true, true, true), 4, new BlockDuration(222222)).build();
    System.out.println(ConvertUtils.toHex(BinarySerializationImpl.INSTANCE.serialize(mosaicCreationTx)));
    assertEquals(NetworkType.MIJIN_TEST, mosaicCreationTx.getNetworkType());
    assertEquals(1, (int) mosaicCreationTx.getVersion());
    assertTrue(LocalDateTime.now().isBefore(mosaicCreationTx.getDeadline().getLocalDateTime(epochAdjustment)));
    assertEquals(BigInteger.valueOf(0), mosaicCreationTx.getMaxFee());
    // assertEquals(new BigInteger("0"), mosaicCreationTx.getMosaicId().getId());
    assertTrue(mosaicCreationTx.getMosaicFlags().isSupplyMutable());
    assertTrue(mosaicCreationTx.getMosaicFlags().isTransferable());
    assertTrue(mosaicCreationTx.getMosaicFlags().isRestrictable());
    assertEquals(nonceNumber, mosaicCreationTx.getMosaicNonce().getNonceAsInt());
    assertEquals(4, mosaicCreationTx.getDivisibility());
    assertEquals(new BlockDuration(222222), mosaicCreationTx.getBlockDuration());
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) PublicAccount(io.nem.symbol.sdk.model.account.PublicAccount) BlockDuration(io.nem.symbol.sdk.model.blockchain.BlockDuration) BlockDuration(io.nem.symbol.sdk.model.blockchain.BlockDuration) Duration(java.time.Duration) MosaicNonce(io.nem.symbol.sdk.model.mosaic.MosaicNonce) Test(org.junit.jupiter.api.Test)

Example 82 with Account

use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.

the class TransactionStatementTest method setup.

@BeforeAll
public static void setup() {
    receiptSource = new ReceiptSource(1, 1);
    Account account = new Account("787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", NetworkType.MIJIN_TEST);
    MosaicId mosaicId = new MosaicId("85BBEA6CC462B244");
    Address recipientAddress = new Address("SDZWZJUAYNOWGBTCUDBY3SE5JF4NCC2RDM6SIGQ", NetworkType.MIJIN_TEST);
    ArtifactExpiryReceipt<MosaicId> mosaicExpiryReceipt = new ArtifactExpiryReceipt(mosaicId, ReceiptType.MOSAIC_EXPIRED, ReceiptVersion.ARTIFACT_EXPIRY);
    BalanceChangeReceipt balanceChangeReceipt = new BalanceChangeReceipt(account.getAddress(), mosaicId, BigInteger.valueOf(10), ReceiptType.LOCK_SECRET_EXPIRED, ReceiptVersion.BALANCE_CHANGE);
    BalanceTransferReceipt balanceTransferReceipt = new BalanceTransferReceipt(account.getAddress(), recipientAddress, mosaicId, BigInteger.valueOf(10), ReceiptType.MOSAIC_RENTAL_FEE, ReceiptVersion.BALANCE_TRANSFER);
    List<Receipt> list = new ArrayList<>();
    list.add(mosaicExpiryReceipt);
    list.add(balanceChangeReceipt);
    list.add(balanceTransferReceipt);
    receipts = list;
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) Address(io.nem.symbol.sdk.model.account.Address) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) ArrayList(java.util.ArrayList) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 83 with Account

use of io.nem.symbol.sdk.model.account.Account in project nem2-sdk-java by nemtech.

the class BalanceChangeReceiptTest method setup.

@BeforeAll
public void setup() {
    account = new Account("787225aaff3d2c71f4ffa32d4f19ec4922f3cd869747f267378f81f8e3fcb12d", NetworkType.MIJIN_TEST);
    mosaicId = new MosaicId("85BBEA6CC462B244");
}
Also used : Account(io.nem.symbol.sdk.model.account.Account) MosaicId(io.nem.symbol.sdk.model.mosaic.MosaicId) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

Account (io.nem.symbol.sdk.model.account.Account)83 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)39 EnumSource (org.junit.jupiter.params.provider.EnumSource)36 Test (org.junit.jupiter.api.Test)29 TransferTransaction (io.nem.symbol.sdk.model.transaction.TransferTransaction)26 BigInteger (java.math.BigInteger)21 Address (io.nem.symbol.sdk.model.account.Address)20 AggregateTransaction (io.nem.symbol.sdk.model.transaction.AggregateTransaction)18 MosaicId (io.nem.symbol.sdk.model.mosaic.MosaicId)17 SignedTransaction (io.nem.symbol.sdk.model.transaction.SignedTransaction)17 PublicAccount (io.nem.symbol.sdk.model.account.PublicAccount)15 PlainMessage (io.nem.symbol.sdk.model.message.PlainMessage)15 NamespaceId (io.nem.symbol.sdk.model.namespace.NamespaceId)14 Transaction (io.nem.symbol.sdk.model.transaction.Transaction)13 AccountInfo (io.nem.symbol.sdk.model.account.AccountInfo)11 TransactionRepository (io.nem.symbol.sdk.api.TransactionRepository)9 Currency (io.nem.symbol.sdk.model.mosaic.Currency)9 NamespaceRegistrationTransaction (io.nem.symbol.sdk.model.transaction.NamespaceRegistrationTransaction)9 RepositoryFactory (io.nem.symbol.sdk.api.RepositoryFactory)8 UnresolvedAddress (io.nem.symbol.sdk.model.account.UnresolvedAddress)7