Exemple #1
0
        public async Task <GetWalletInfoByIdResponse> GetWalletInfoByIdAsync(GetWalletInfoByIdRequest request)
        {
            using var activity = MyTelemetry.StartActivity("GetWalletInfoByIdAsync");
            request.AddToActivityAsJsonTag("request");

            await using var ctx = new DatabaseContext(_dbContextOptionsBuilder.Options);
            var walletEntity = ctx.ClientWallet.FirstOrDefault(e => e.WalletId == request.WalletId);

            if (walletEntity == null)
            {
                return(new GetWalletInfoByIdResponse()
                {
                    Success = false,
                    ErrorMessage = "Wallet not found"
                });
            }
            return(new GetWalletInfoByIdResponse()
            {
                Success = true,
                WalletInfo = new ClientWallet()
                {
                    BaseAsset = walletEntity.BaseAsset,
                    CreatedAt = walletEntity.CreatedAt,
                    EnableUseTestNet = walletEntity.EnableUseTestNet,
                    IsDefault = walletEntity.IsDefault,
                    IsInternal = walletEntity.IsInternal,
                    Name = walletEntity.Name,
                    WalletId = walletEntity.WalletId,
                    EnableEarnProgram = walletEntity.EnableEarnProgram
                }
            });
        }
 public Task <GetWalletInfoByIdResponse> GetWalletInfoByIdAsync(GetWalletInfoByIdRequest request)
 {
     return(_grpcService.GetWalletInfoByIdAsync(request));
 }