Exemple #1
0
        void JumpToConfirmPage()
        {
            var result = FiiiCoinService.Default.EstimateTxFeeForSendMany(Initializer.Default.DefaultAccount.Address, SendItems);

            if (result.IsFail)
            {
                ShowMessage(result.GetErrorMsg());
                return;
            }

            var feeValue = result.Value.TotalFee;

            SendMsgData <ConfirmSendData> data = new SendMsgData <ConfirmSendData>();
            var             amountAll          = SendItems.Sum(x => x.Amount);
            ConfirmSendData sendData           = new ConfirmSendData
            {
                Amount = amountAll / Math.Pow(10, 8),
            };

            sendData.Fee = feeValue / Math.Pow(10, 8);

            var tags = SendItems.Select(x =>
            {
                if (string.IsNullOrEmpty(x.Tag.Trim()))
                {
                    return(x.Address);
                }
                else
                {
                    return(x.Tag);
                }
            });

            sendData.ToAddress = string.Join(";", SendItems.Select(x => x.Tag));

            if (!SendItems.Any(x => x.IsContainFee))
            {
                sendData.ArrivalAmount = sendData.Amount;
            }
            else
            {
                sendData.ArrivalAmount = (amountAll - feeValue) / Math.Pow(10, 8);
            }
            data.Token = sendData;
            data.SetCallBack(() =>
            {
                SendDataToService();
            });

            SendMessenger(Pages.ConfirmSendPage, data);
            UpdatePage(Pages.ConfirmSendPage);
        }
Exemple #2
0
 void OnGetResponse(SendMsgData <ConfirmSendData> data)
 {
     msgData         = data;
     ConfirmSendData = data.Token;
 }
Exemple #3
0
        void JumpToConfirmPage()
        {
            long feeValue = 0L;

            if (!StaticViewModel.GlobalViewModel.IsEnableProfessional)
            {
                var result = OmniCoinService.Default.EstimateTxFeeForSendMany(Initializer.Default.DefaultAccount.Address, SendItems);
                if (result.IsFail)
                {
                    ShowMessage(result.GetErrorMsg());
                    return;
                }
                feeValue = result.Value.TotalFee;
            }
            else
            {
                var professionalSetting = StaticViewModel.GlobalViewModel.ProfessionalSetting;
                var result = OmniCoinService.Default.EstimateRawTransaction(
                    professionalSetting.UTXO.Select(x => new DTO.SendRawTransactionInputsIM {
                    TxId = x.Txid, Vout = x.Vout
                }).ToList(),
                    SendItems,
                    professionalSetting.ChangeAddress.Address,
                    Convert.ToInt64(Fee * Math.Pow(10, 8)));
                if (result.IsFail)
                {
                    ShowMessage(result.GetErrorMsg());
                    return;
                }
                feeValue = result.Value.TotalFee;
            }



            SendMsgData <ConfirmSendData> data = new SendMsgData <ConfirmSendData>();
            var             amountAll          = SendItems.Sum(x => x.Amount);
            ConfirmSendData sendData           = new ConfirmSendData
            {
                Amount = amountAll / Math.Pow(10, 8),
            };

            sendData.Fee = feeValue / Math.Pow(10, 8);

            var tags = SendItems.Select(x =>
            {
                if (string.IsNullOrEmpty(x.Tag.Trim()))
                {
                    return(x.Address);
                }
                else
                {
                    return(x.Tag);
                }
            });

            sendData.ToAddress = string.Join(";", SendItems.Select(x => x.Tag));

            if (!SendItems.Any(x => x.IsContainFee))
            {
                sendData.ArrivalAmount = sendData.Amount;
            }
            else
            {
                if (!StaticViewModel.GlobalViewModel.IsEnableProfessional)
                {
                    sendData.ArrivalAmount = (amountAll - feeValue) / Math.Pow(10, 8);
                }
                else
                {
                    sendData.ArrivalAmount = amountAll / Math.Pow(10, 8);
                }
            }
            data.Token = sendData;
            data.SetCallBack(() =>
            {
                SendDataToService();
            });

            SendMessenger(Pages.ConfirmSendPage, data);
            UpdatePage(Pages.ConfirmSendPage);
        }