Exemplo n.º 1
0
        /// <summary>
        /// Send Transaction with all info
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void Button1_Click(object sender, EventArgs e)
        {
            this.count++;
            var config         = new SdkConfig(Utils.ApiUrl);
            var client         = new Client(config);
            var _generalClient = new GeneralApi(client);

            // Get textBox1 string
            string  text1       = this.textBox1.Text;
            Address mypublickey = this.Inputjudgement(text1);

            if (mypublickey == null)
            {
                this.count--;
                return;
            }

            // get textBox2 string
            string  text2            = this.textBox2.Text;
            Address opponetpublickey = this.Inputjudgement(text2);

            if (opponetpublickey == null)
            {
                this.count--;
                return;
            }

            // get textBox3 string
            string  text3  = this.textBox3.Text;
            decimal amount = this.Inputnumjudgement(text3);

            if (amount == 0m)
            {
                this.count--;
                return;
            }

            // throw amount to form1
            this.Showtransaction(amount);

            // send coin BroadCast Miyabi
            WAction send = new WAction();

            (string transaction, string result) = await send.Send(mypublickey, opponetpublickey, amount);

            // Open Form6
            Form6 frmForm6 = new Form6();

            frmForm6.TxId      = transaction;
            frmForm6.Tx_result = result;
            frmForm6.ShowDialog();
            this.Close();
        }
Exemplo n.º 2
0
        async partial void Send_bottun_TouchUpInsideAsync(UIButton sender)
        {
            var client         = WAction.SetClient();
            var _generalClient = new GeneralApi(client);

            //mypublickey
            string  text1       = "0338f9e2e7ad512fe039adaa509f7b555fb88719144945bd94f58887d8d54fed78";
            Address mypublickey = this.Inputjudgement(text1);

            if (mypublickey == null)
            {
                return;
            }
            // Get destinationpublickey string
            string  text2            = this.destinationpubkey.Text;
            Address opponetpublickey = this.Inputjudgement(text2);

            if (opponetpublickey == null)
            {
                return;
            }

            // get textBox3 string
            string  text3  = this.amount.Text;
            decimal amount = this.Inputnumjudgement(text3);

            if (amount == 0m)
            {
                return;
            }

            // throw amount to form1
            //this.Showtransaction(amount);

            // send coin BroadCast Miyabi
            WAction send = new WAction();

            (string transaction, string result) = await send.Send(mypublickey, opponetpublickey, amount);

            //Transaction result
            //Create Alert
            var okAlertController = UIAlertController.Create("Result:\t" + result, "tx:\t" + transaction, UIAlertControllerStyle.Alert);

            //Add Action
            okAlertController.AddAction(UIAlertAction.Create("confirm", UIAlertActionStyle.Default, null));

            // Present Alert
            PresentViewController(okAlertController, true, null);
        }
Exemplo n.º 3
0
        public async Task <string> Coinsend([FromBody] Transactioninfo info)
        {
            AssetTypesRegisterer.RegisterTypes();
            WAction walletservice = new WAction();
            KeyPair privatekey    = walletservice.GetKeyPair(info.my_privatekey);

            if (privatekey == null)
            {
                // comment:プライベートキーが適正ではありません!
                Result txresult = new Result();
                txresult.code          = 1;
                txresult.transactionId = string.Empty;
                txresult.result        = string.Empty;
                string resultjson = JsonSerializer.Serialize(txresult);
                return(resultjson);
            }
            Address mypublickey = Inputjudgement1(privatekey);

            if (mypublickey == null)
            {
                //comment:パブリックキーを適正に変換できませんでした!
                Result txresult = new Result();
                txresult.code          = 2;
                txresult.transactionId = string.Empty;
                txresult.result        = string.Empty;
                string resultjson = JsonSerializer.Serialize(txresult);
                return(resultjson);
            }
            Address opponetpublickey = Inputjudgement2(info.opponet_pubkey);

            if (opponetpublickey == null)
            {
                // comment:入力された送信相手のパブリックキーが不適正です!入力値を再確認してください!
                Result txresult = new Result();
                txresult.code          = 3;
                txresult.transactionId = string.Empty;
                txresult.result        = string.Empty;
                string resultjson = JsonSerializer.Serialize(txresult);
                return(resultjson);
            }
            decimal amount = Inputnumjudgement(info.send_amount);

            if (amount == 0m)
            {
                //comment:数字ではない文字が入力されています!数字に直してください
                Result txresult = new Result();
                txresult.code          = 4;
                txresult.transactionId = string.Empty;
                txresult.result        = string.Empty;
                string resultjson = JsonSerializer.Serialize(txresult);
                return(resultjson);
            }
            (string transaction, string result) = await walletservice.Send(privatekey, mypublickey, opponetpublickey, amount);

            Result successtxresult = new Result();

            successtxresult.code          = 5;
            successtxresult.transactionId = transaction;
            successtxresult.result        = result;
            string successresultjson = JsonSerializer.Serialize(successtxresult);

            return(successresultjson);
        }