use of io.nem.symbol.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.
the class BlockInfoTest method createANewBlockInfo.
@Test
void createANewBlockInfo() {
String proofGamma = "proofGamma";
String proofScalar = "proofScalar";
String proofVerificationHash = "proofVerificationHash";
String hash = "24E92B511B54EDB48A4850F9B42485FDD1A30589D92C775632DDDD71D7D1D691";
String generationHash = "57F7DA205008026C776CB6AED843393F04CD458E0AA2D9F1D5F31A402072B2D6";
String signature = "37351C8244AC166BE6664E3FA954E99A3239AC46E51E2B32CEA1C72DD0851100A7731868E932E1A9BEF8A27D48E1" + "FFEE401E933EB801824373E7537E51733E0F";
PublicAccount signer = Account.generateNewAccount(NetworkType.MIJIN_TEST).getPublicAccount();
String previousBlockHash = "0000000000000000000000000000000000000000000000000000000000000000";
String blockTransactionsHash = "702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0";
String blockReceiptsHash = "702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0";
String stateHash = "702090BA31CEF9E90C62BBDECC0CCCC0F88192B6625839382850357F70DD68A0";
List<String> subCacheMerkleRoots = new ArrayList<>();
Address beneficiaryAddress = Account.generateNewAccount(NetworkType.MIJIN_TEST).getAddress();
String id = "abc";
List<String> stateHashSubCacheMerkleRoots = Arrays.asList("abc");
BlockInfo blockInfo = new BlockInfo(id, 10L, hash, generationHash, BigInteger.ZERO, stateHashSubCacheMerkleRoots, 25, 20, 35, subCacheMerkleRoots, signature, signer, NetworkType.MIJIN_TEST, 1, BlockType.NORMAL_BLOCK, BigInteger.ONE, BigInteger.ZERO, BigInteger.valueOf(276447232L), 1L, previousBlockHash, blockTransactionsHash, blockReceiptsHash, stateHash, proofGamma, proofScalar, proofVerificationHash, beneficiaryAddress);
assertEquals(hash, blockInfo.getHash());
assertEquals(generationHash, blockInfo.getGenerationHash());
assertEquals(BigInteger.valueOf(0), blockInfo.getTotalFee());
assertEquals(10L, blockInfo.getSize());
assertEquals(25, blockInfo.getTransactionsCount());
assertEquals(20, blockInfo.getTotalTransactionsCount());
assertEquals(35, blockInfo.getStatementsCount());
assertEquals(signature, blockInfo.getSignature());
Assertions.assertEquals(signer, blockInfo.getSignerPublicAccount());
assertEquals(NetworkType.MIJIN_TEST, blockInfo.getNetworkType());
assertEquals(1, (int) blockInfo.getVersion());
assertEquals(BlockType.NORMAL_BLOCK, blockInfo.getType());
assertEquals(BigInteger.valueOf(1), blockInfo.getHeight());
assertEquals(BigInteger.valueOf(0), blockInfo.getTimestamp());
assertEquals(BigInteger.valueOf(276447232), blockInfo.getDifficulty());
assertEquals(1, blockInfo.getFeeMultiplier());
assertEquals(previousBlockHash, blockInfo.getPreviousBlockHash());
assertEquals(blockTransactionsHash, blockInfo.getBlockTransactionsHash());
assertEquals(blockReceiptsHash, blockInfo.getBlockReceiptsHash());
assertEquals(stateHash, blockInfo.getStateHash());
assertEquals(beneficiaryAddress, blockInfo.getBeneficiaryAddress());
assertEquals(proofGamma, blockInfo.getProofGamma());
assertEquals(proofScalar, blockInfo.getProofScalar());
assertEquals(proofVerificationHash, blockInfo.getProofVerificationHash());
assertEquals("abc", blockInfo.getRecordId().get());
assertEquals(stateHashSubCacheMerkleRoots, blockInfo.getStateHashSubCacheMerkleRoots());
}
use of io.nem.symbol.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.
the class AggregateTransactionCosignatureTest method createAnAggregateCosignatureViaConstructor.
@Test
void createAnAggregateCosignatureViaConstructor() {
AggregateTransactionCosignature aggregateTransactionCosignature = new AggregateTransactionCosignature(AggregateTransactionCosignature.DEFAULT_VERSION, "signature", new PublicAccount("9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", NetworkType.MIJIN_TEST));
assertEquals(AggregateTransactionCosignature.DEFAULT_VERSION, aggregateTransactionCosignature.getVersion());
assertEquals("signature", aggregateTransactionCosignature.getSignature());
assertEquals(new PublicAccount("9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", NetworkType.MIJIN_TEST), aggregateTransactionCosignature.getSigner());
}
use of io.nem.symbol.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.
the class CosignatureSignedTransactionTest method createACosignatureSignedTransactionViaConstructor.
@Test
void createACosignatureSignedTransactionViaConstructor() {
PublicAccount signer = Account.generateNewAccount(NetworkType.MIJIN_TEST).getPublicAccount();
CosignatureSignedTransaction cosignatureSignedTransaction = new CosignatureSignedTransaction(AggregateTransactionCosignature.DEFAULT_VERSION, "parentHash", "signature", signer);
assertEquals(AggregateTransactionCosignature.DEFAULT_VERSION, cosignatureSignedTransaction.getVersion());
assertEquals("parentHash", cosignatureSignedTransaction.getParentHash());
assertEquals("signature", cosignatureSignedTransaction.getSignature());
assertEquals(signer, cosignatureSignedTransaction.getSigner());
}
use of io.nem.symbol.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.
the class NamespaceInfoTest method createSubNamespaceInfo.
NamespaceInfo createSubNamespaceInfo(NamespaceId parentId) {
NamespaceId level0 = NamespaceId.createFromId(new BigInteger("17358872602548358953"));
NamespaceId level1 = NamespaceId.createFromId(new BigInteger("-1087871471161192663"));
return new NamespaceInfo("bcd", 1, true, 0, NamespaceRegistrationType.SUB_NAMESPACE, 1, Arrays.asList(level0, level1), parentId, new PublicAccount("B4F12E7C9F6946091E2CB8B6D3A12B50D17CCBBF646386EA27CE2946A7423DCF", NetworkType.MIJIN_TEST).getAddress(), new BigInteger("1"), new BigInteger("-1"), new MosaicAlias(new MosaicId(new BigInteger("100"))));
}
use of io.nem.symbol.sdk.model.account.PublicAccount in project nem2-sdk-java by nemtech.
the class TransferTransactionTest method toAggregate.
@Test
@DisplayName("To aggregate")
void toAggregate() {
String expected = "61000000000000009A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24000000000190544190F36CA680C35D630662A0C38DC89D4978D10B511B3D241A0100010000000000672B0000CE560000640000000000000000";
TransferTransaction transaction = TransferTransactionFactory.create(networkType, new Deadline(BigInteger.ONE), new Address("SDZWZJUAYNOWGBTCUDBY3SE5JF4NCC2RDM6SIGQ", networkType), Collections.singletonList(new Mosaic(new MosaicId(new BigInteger("95442763262823")), BigInteger.valueOf(100)))).message(new PlainMessage("")).build();
Transaction aggregateTransaction = transaction.toAggregate(new PublicAccount("9A49366406ACA952B88BADF5F1E9BE6CE4968141035A60BE503273EA65456B24", networkType));
assertEmbeddedSerialization(expected, aggregateTransaction);
}
Aggregations