public static async System.Threading.Tasks.Task CreateTransactionAsync(int xpxAmount, List <Account> recipients) { foreach (var recipient in recipients) { var client = new SiriusClient("http://bctestnet1.brimstone.xpxsirius.io:3000"); var networkType = client.NetworkHttp.GetNetworkType().Wait(); var mosaicToTransfer = NetworkCurrencyMosaic.CreateRelative((ulong)xpxAmount); var transferTransaction = TransferTransaction.Create( Deadline.Create(), recipient.Address, new List <Mosaic>() { mosaicToTransfer }, PlainMessage.Create("Transfered " + xpxAmount.ToString() + " successfully."), NetworkType.TEST_NET ); var generationHash = await client.BlockHttp.GetGenerationHash(); var signedTransaction = senderAccount.Sign(transferTransaction, generationHash); await client.TransactionHttp.Announce(signedTransaction); var newAccountInfo = await client.AccountHttp.GetAccountInfo(senderAccount.Address); Console.WriteLine("Sent " + Convert.ToInt32(xpxAmount) + " XPX to: \n"); Console.WriteLine($"{nameof(newAccountInfo)} : {newAccountInfo}"); } }
public E2EBaseFixture() { var env = GetEnvironment(); SiriusClient = new SiriusClient(env.BaseUrl); GenerationHash = SiriusClient.BlockHttp.GetGenerationHash().Wait(); bool useSSL = false; if (env.Protocol.Equals("https", StringComparison.InvariantCultureIgnoreCase)) { useSSL = true; } SiriusWebSocketClient = new SiriusWebSocketClient(env.Host, env.Port, useSSL); SiriusWebSocketClient.Listener.Open().Wait(); NetworkType = SiriusClient.NetworkHttp.GetNetworkType().Wait(); SeedAccount = Account.CreateFromPrivateKey(env.SeedAccountPK, NetworkType); Task.Run(() => InitializeAccounts()).Wait(); }
private async Task InitializeFixture() { // Setup test environment Environment = GetEnvironment(); // Initiate other services WebSocket = new SiriusWebSocketClient(Environment.Host, Environment.Port); Client = new SiriusClient(Environment.BaseUrl); SeedAccount = await GetSeedAccount(); MultiSigAccount = await GenerateAccountAndSendSomeMoney(100); var networkType = await Client.NetworkHttp.GetNetworkType(); Cosignatory1 = await GenerateAccountAndSendSomeMoney(100); Cosignatory2 = Account.GenerateNewAccount(networkType); Cosignatory3 = Account.GenerateNewAccount(networkType); Cosignatory4 = Account.GenerateNewAccount(networkType); //set default timeout DefaultTimeout = TimeSpan.FromSeconds(100); }