Example #1
0
        // Get RealTime Balance
        private async void Get_Balance_Click(object sender, EventArgs e)
        {
            WAction show  = new WAction();
            decimal value = await show.ShowAsset();

            this.label2.Text = Convert.ToString(value);
        }
        public string Parse([FromBody] BeforeParse parse)
        {
            AssetTypesRegisterer.RegisterTypes();
            WAction walletservice = new WAction();
            KeyPair privatekey    = walletservice.GetKeyPair(parse.BeforeParsePrivateKey);

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

            if (mypublickey == null)
            {
                //comment:パブリックキーに変換できませんでした!
                AfterParse missparse = new AfterParse();
                missparse.AfterParsepublickey = string.Empty;
                string resultjson = JsonSerializer.Serialize(missparse);
                return(resultjson);
            }
            string ParsePublicKey = Convert.ToString(mypublickey);

            AfterParse afterparse = new AfterParse();

            afterparse.AfterParsepublickey = ParsePublicKey;
            string successjson = JsonSerializer.Serialize(afterparse);

            return(successjson);
        }
Example #3
0
        private void Form2_Load(object sender, EventArgs e)
        {
            WAction getpubKey = new WAction();

            this.textBox1.Text     = Convert.ToString(getpubKey.GetAddress());
            this.textBox1.ReadOnly = true;
        }
Example #4
0
        public async Task <string> GetTokenownerKey([FromQuery] string publickey)
        {
            NFTTypesRegisterer.RegisterTypes();
            WAction walletservice = new WAction();
            var     result        = await walletservice.ShowNFTOwner("NFTtest", publickey);

            return(result);
        }
        public string ReadFile([FromBody] RegistName registname)
        {
            AssetTypesRegisterer.RegisterTypes();
            Process process = new Process();
            string  arg     = registname.nickname;//argumenrt

            ProcessStartInfo psinfo = new ProcessStartInfo()
            {
                FileName               = "/usr/local/bin/ReadKeyFile.sh",
                UseShellExecute        = false,
                RedirectStandardOutput = true,
                CreateNoWindow         = true,
                Arguments              = "\t" + arg,
            };
            Process p = Process.Start(psinfo);

            p.WaitForExit();
            string privatekey = p.StandardOutput.ReadToEnd();

            privatekey = privatekey.Substring(0, privatekey.Length - 1);
            p.Close();

            WAction walletservice = new WAction();
            KeyPair privatekey1   = walletservice.GetKeyPair(privatekey);

            if (privatekey1 == null)
            {
                // comment:プライベートキーが正しく取得できませんでした!
                getkeypair getkeypair = new getkeypair();
                getkeypair.PrivateKey = string.Empty;
                getkeypair.PublicKey  = string.Empty;
                string resultjson = JsonSerializer.Serialize(getkeypair);
                return(resultjson);
            }
            Address mypublickey = Inputjudgement1(privatekey1);

            if (mypublickey == null)
            {
                //comment:パブリックキーに変換できませんでした!
                getkeypair getkeypair = new getkeypair();
                getkeypair.PrivateKey = string.Empty;
                getkeypair.PublicKey  = string.Empty;
                string resultjson = JsonSerializer.Serialize(getkeypair);
                return(resultjson);
            }
            string ParsePublicKey = Convert.ToString(mypublickey);

            getkeypair keypair = new getkeypair();

            keypair.PrivateKey = privatekey;
            keypair.PublicKey  = ParsePublicKey;
            string keypairjson = JsonSerializer.Serialize(keypair);

            return(keypairjson);
        }
Example #6
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            Forms.Init();
            decimal value = 0m;

            value = await WAction.ShowAsset();

            balancelabel.Text = Convert.ToString(value);
        }
Example #7
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();
        }
        public async Task <string> showcoin([FromBody] Showamount showdata)
        {
            decimal coinamount    = 0m;
            WAction walletservice = new WAction();

            coinamount = await walletservice.ShowAsset(showdata.my_publickey);

            Showresult amountresult = new Showresult();

            amountresult.coin_amount = Convert.ToString(coinamount);
            string amountjson = JsonSerializer.Serialize(amountresult);

            return(amountjson);
        }
Example #9
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);
        }
        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);
        }