Esempio n. 1
0
        public ActionResult <WalletResponse> CreateWallet()
        {
            var wallet = _walletService.CreateWallet();

            return(new WalletResponse
            {
                PrivateKey = wallet.PrivateKey,
                PublicAddress = Address.AddChecksum(wallet.Address)
            });
        }
 private static HistoricalTransactionContract MapTransactionReceipt(
     TransactionReceipt transactionReceipt)
 {
     return(new HistoricalTransactionContract
     {
         Amount = transactionReceipt.Amount.ToString(),
         AssetId = Constants.AssetId,
         FromAddress = Address.AddChecksum(transactionReceipt.From),
         Hash = transactionReceipt.Hash,
         Timestamp = DateTimeOffset.FromUnixTimeSeconds((long)transactionReceipt.Timestamp).UtcDateTime,
         ToAddress = Address.AddChecksum(transactionReceipt.To)
     });
 }
Esempio n. 3
0
        public async Task <ActionResult <PaginationResponse <BlacklistedAddressResponse> > > GetBlacklistedAddresses(
            PaginationRequest request)
        {
            var(addresses, continuationToken) = await _addressService.GetBlacklistedAddressesAsync(request.Take, request.Continuation);

            var result = new PaginationResponse <BlacklistedAddressResponse>()
            {
                Continuation = continuationToken,
                Items        = addresses.SelectImmutableArray(x => new BlacklistedAddressResponse
                {
                    Address            = Address.AddChecksum(x.Address),
                    BlacklistingReason = x.BlacklistingReason
                })
            };

            return(Ok(result));
        }
Esempio n. 4
0
        public async Task <ActionResult <PaginationResponse <WhitelistedAddressResponse> > > GetWhitelistedAddresses(
            PaginationRequest request)
        {
            var(addresses, continuationToken) = await _addressService.GetWhitelistedAddressesAsync(request.Take, request.Continuation);

            var result = new PaginationResponse <WhitelistedAddressResponse>()
            {
                Continuation = continuationToken,
                Items        = addresses.SelectImmutableArray(x => new WhitelistedAddressResponse
                {
                    Address      = Address.AddChecksum(x.Address),
                    MaxGasAmount = x.MaxGasAmount.ToString()
                })
            };

            return(Ok(result));
        }
        public async Task <ActionResult <PaginationResponse <WalletBalanceContract> > > GetBalanceList(
            PaginationRequest request)
        {
            var(balances, continuation) = await _balanceService.GetTransferableBalancesAsync
                                          (
                request.Take,
                request.Continuation
                                          );

            return(new PaginationResponse <WalletBalanceContract>
            {
                Continuation = continuation,
                Items = balances.Select(x => new WalletBalanceContract
                {
                    Address = Address.AddChecksum(x.Address),
                    AssetId = Constants.AssetId,
                    Balance = x.Amount.ToString(),
                    Block = (long)x.BlockNumber
                }).ToList()
            });
        }
 public void AddChecksum()
 {
     Address.AddChecksum("0x8fa24279718d868d5844527acdb001c6a1adbd08")
     .Should()
     .BeEquivalentTo("0x8FA24279718d868D5844527Acdb001c6a1AdbD08");
 }