public static async Task getResponse() { try { Account sender = Account.CreateFromPrivateKey("5cd5a454be8045056bd3c5e67c20dea92a8eb4921351d850f0249983a804a903", NetworkType.Types.TEST_NET); KeyPair keyPair1 = sender.KeyPair; Account reciever = Account.CreateFromPrivateKey("5cd5a454be8045056bd3c5e67c20dea92a8eb4921351d850f0249983a804a903", NetworkType.Types.TEST_NET); KeyPair keyPair2 = reciever.KeyPair; var transaction = TransferTransaction.Create( NetworkType.Types.TEST_NET, Deadline.CreateHours(2), Address.CreateFromEncoded("TB2Z7J-R2K3BZ-2TRS6D-H5747F-Y3XKUM-BNWCI4-BPDJ"), new List <Mosaic> { Xem.CreateRelative(1) }, SecureMessage.Create("Well shit. W/ mosaic", sender.PrivateKey, reciever.PublicKey) ); SignedTransaction signedTransaction = transaction.SignWith(keyPair1); TransactionResponse response = await new TransactionHttp(host).Announce(signedTransaction); Console.WriteLine(response.Message); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } }
public static async Task getResponse() { try { Account account = Account.CreateFromPrivateKey("5cd5a454be8045056bd3c5e67c20dea92a8eb4921351d850f0249983a804a903", NetworkType.Types.TEST_NET); KeyPair keyPair = account.KeyPair; var transaction = TransferTransaction.Create( NetworkType.Types.TEST_NET, Deadline.CreateHours(2), Address.CreateFromEncoded("TB2Z7J-R2K3BZ-2TRS6D-H5747F-Y3XKUM-BNWCI4-BPDJ"), new List <Mosaic> { Xem.CreateRelative(10) }, PlainMessage.Create("Well shit. W/ mosaic") ); SignedTransaction signedTransaction = transaction.SignWith(keyPair); TransactionResponse response = await new TransactionHttp("http://" + Config.Domain + ":7890").Announce(signedTransaction); Console.WriteLine(response.Message); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } }
public void ShouldCreateRelativeXEM() { var xem = Xem.CreateRelative(1); Assert.AreEqual((ulong)1000000, xem.Amount); Assert.AreEqual(Xem.Id.HexId, xem.MosaicId.HexId); }
public void ShouldCreateAccountInfoFromConstructor() { var mosaics = new List <Mosaic> { Xem.CreateRelative(10) }; var accountInfo = new AccountInfo( Address.CreateFromEncoded("SDGLFWDSHILTIUHGIBH5UGX2VYF5VNJEKCCDBR26"), 966, "cf893ffcc47c33e7f68ab1db56365c156b0736824a0c1e273f9e00b8df8f01eb", 964, 0, 0, mosaics ); Assert.AreEqual(Address.CreateFromEncoded("SDGLFWDSHILTIUHGIBH5UGX2VYF5VNJEKCCDBR26").Plain, accountInfo.Address.Plain); Assert.AreEqual((ulong)966, accountInfo.AddressHeight); Assert.AreEqual("cf893ffcc47c33e7f68ab1db56365c156b0736824a0c1e273f9e00b8df8f01eb", accountInfo.PublicKey); Assert.AreEqual((ulong)964, accountInfo.PublicKeyHeight); Assert.AreEqual((ulong)0, accountInfo.Importance); Assert.AreEqual((ulong)0, accountInfo.ImportanceHeight); Assert.AreEqual(mosaics, accountInfo.Mosaics); }