Hathor.Faucet.Services/HathorService.cs
/// <summary>
/// Get faucet wallet and cache it
/// </summary>
/// <returns></returns>
Get faucet wallet and cache it
Get faucet wallet and cache it
public async Task<string> GetAddressAsync()
        {
            if (!string.IsNullOrEmpty(hathorConfig.Seed))
            {
                var network = faucetConfig.Network == Models.HathorNetwork.Mainnet ? Wallet.HathorNetwork.Mainnet : Wallet.HathorNetwork.Testnet;
                var wallet = new HathorWallet(network, hathorConfig.Seed);
                return wallet.GetAddress(0);
            }
            var result = await memoryCache.GetOrCreateAsync<AddressResponse>(CACHE_KEY_ADDRESS, async (cache) =>
            {
                await StartWalletAsync();
                var addressResult = await client.GetAddress(0);
                if (string.IsNullOrEmpty(addressResult.Address))
                    cache.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(15);
                else
                    cache.SlidingExpiration = TimeSpan.FromHours(1);
                return addressResult;
            });
            return result.Address;
        }
public async Task < string > GetAddressAsync ( ) { if ( ! string . IsNullOrEmpty ( hathorConfig . Seed ) ) { var network = faucetConfig . Network == Models . HathorNetwork . Mainnet ? Wallet . HathorNetwork . Mainnet : Wallet . HathorNetwork . Testnet ; var wallet = new HathorWallet ( network , hathorConfig . Seed ) ; return wallet . GetAddress ( 0 ) ; } var result = await memoryCache . GetOrCreateAsync < AddressResponse > ( CACHE_KEY_ADDRESS , async ( cache ) => { await StartWalletAsync ( ) ; var addressResult = await client . GetAddress ( 0 ) ; if ( string . IsNullOrEmpty ( addressResult . Address ) ) cache . AbsoluteExpirationRelativeToNow = TimeSpan . FromSeconds ( 15 ) ; else cache . SlidingExpiration = TimeSpan . FromHours ( 1 ) ; return addressResult ; } ) ; return result . Address ; }
Get faucet wallet and cache it
Get faucet wallet and cache it
None