Beispiel #1
0
        public async Task <decimal> GetTokenBalance(ContractToken token, string accountAddress)
        {
            var service = new Nethereum.StandardTokenEIP20.StandardTokenService(GetWeb3(), token.Address);
            var wei     = await service.GetBalanceOfAsync <BigInteger>(accountAddress).ConfigureAwait(false);

            return(Web3.Convert.FromWei(wei, token.NumberOfDecimalPlaces));
        }
Beispiel #2
0
        private async Task SaveToken()
        {
            var error = false;

            try
            {
                var contractToken = new ContractToken
                {
                    Address = TokenAddress,
                    Name    = TokenName,
                    Symbol  = Symbol,
                    NumberOfDecimalPlaces = DecimalPlaces
                };

                await _tokenRegistryService.RegisterToken(contractToken);

                _walletService.InvalidateCache();
                await _navigationService.Navigate <BalanceSummaryViewModel>();
            }
            catch
            {
                error = true;
            }

            if (error)
            {
                var page = new ContentPage();
                await page.DisplayAlert("Error", "No se pudo registrar el token", "OK");
            }

            IsBusy = false;
        }
Beispiel #3
0
 /// <summary>
 /// 用户登出
 /// </summary>
 /// <param name="account">账户(手机号)</param>
 /// <param name="token">token</param>
 /// <returns>状态</returns>
 /// <remarks> 2013-7-5 杨浩 创建</remarks>
 public Result LogOut(string account, string token)
 {
     ContractToken.InvalidToken(account, token);
     return(new Result
     {
         Status = true,
         StatusCode = 1
     });
 }
        public async Task <long> TokenBalance(ContractToken token, string address)
        {
            long balance = -1;

            if (walletConfiguration.IsConfigured())
            {
                EthWalletService wallet = new EthWalletService(walletConfiguration, tokenRegistryService, accountRegistryService);
                balance = Convert.ToInt64(await wallet.GetTokenBalance(token, address));
            }

            return(balance);
        }
Beispiel #5
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="account">账户(手机号)</param>
        /// <param name="password">密码</param>
        /// <returns>用户信息</returns>
        /// <remarks> 2013-7-5 杨浩 创建</remarks>
        public Result <Customer> Login(string account, string password)
        {
            var temp = BLL.Authentication.CustomerAuthenticationBo.Instance.Login(account, password);

            if (temp.Status == false)
            {
                return(new Result <Customer>
                {
                    Data = null,
                    Message = temp.Message,
                    Status = temp.Status,
                    StatusCode = temp.StatusCode
                });
            }
            var customer = new Result <Customer>
            {
                Data = new Customer
                {
                    Account       = temp.Data.Account,
                    SysNo         = temp.Data.SysNo,
                    StreetAddress = temp.Data.StreetAddress,
                    NickName      = temp.Data.NickName,
                    Name          = temp.Data.Name,
                    LevelSysNo    = temp.Data.LevelSysNo,
                    EmailAddress  = temp.Data.EmailAddress,
                    LevelName     = temp.Data.LevelName
                },
                Status     = true,
                StatusCode = 1
            };

            customer.Data.HeadImage = BLL.Web.ProductImageBo.Instance.GetHeadImagePath(ProductThumbnailType.CustomerFace, temp.Data.SysNo);
            customer.Data.AppToken  = ContractToken.CreateToken(temp.Data.SysNo, account, password);
            Hyt.Infrastructure.Memory.MemoryProvider.Default.Set(account, temp.Data, int.MaxValue);
            return(customer);
        }
 public Task RegisterToken(ContractToken token)
 {
     throw new NotImplementedException();
 }