private void button17_Click(object sender, EventArgs e) { var permissie = chain.CreateKeys(); this.privkey.Text = permissie.keypairs.First().privkey; this.adres.Text = permissie.keypairs.First().address; this.pubkey.Text = permissie.keypairs.First().pubkey; }
private void button17_Click(object sender, EventArgs e) { if (this.keypairname.Text.Any()) { var permissie = chain.CreateKeys(); this.newkeypair.Visible = false; this.keypairok.Visible = true; var privkey = permissie.keypairs.First().privkey; var adres = permissie.keypairs.First().address; var pubkey = permissie.keypairs.First().pubkey; var privkeyimport = this.chain.ImportPrivateKey(privkey); this.privatekey.Visible = false; this.privatekeyok.Visible = true; var grant = this.GrandPermisions(adres); this.grantpermissions.Visible = false; this.grantpermissionsok.Visible = true; DataAccess da = new DataAccess(); da.SaveClientData( new Client() { Client1 = this.keypairname.Text, ClientId = Guid.NewGuid(), ClientKeypairs = new List <ClientKeypairs> { new ClientKeypairs() { Address = adres, PublicKey = pubkey, ClientId = 1 } } }); this.privkey.Text = privkey; this.pubkey.Text = pubkey; this.adres.Text = adres; ReloadClientData(); Program.SecondClient.RefreshStreams(); Program.FirstClient.RefreshStreams(); } else { MessageBox.Show( "No clientId provided, please fix this issue.", "Client Id not availlable", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void TestMultiChainCreateKeys() { // Setup var processWrapper = new ProcessWrapper { Mock = true, ReplyMessage = "[{ \"address\": \"Test01\", \"pubkey\": \"Test02\", \"privkey\": \"Test03\" }]" }; var chain = new MultiChain(null, processWrapper); // Test var keys = chain.CreateKeys(); // Check Assert.AreEqual(1, keys.keypairs.Length); Assert.AreEqual("Test01", keys.keypairs[0].address); Assert.AreEqual("Test02", keys.keypairs[0].pubkey); Assert.AreEqual("Test03", keys.keypairs[0].privkey); Assert.AreEqual("/c D:\\Development\\Eigenbouw\\bc\\MultiChain\\multichain-cli.exe testchain createkeypairs", processWrapper.ProcessInfo.Arguments); }