Ejemplo n.º 1
0
        public Task <PublicVolumeResponse> GetTask(IEnumerable <Network> networks, VolumeProviderContext context = null)
        {
            var nets  = networks.ToList();
            var tasks = nets.Select(x => GetAsync(x, context)).Where(x => x != null);

            return(tasks.WhenAll().ContinueWith(r => After(new PublicVolumeResponse(r.Result), context)));
        }
Ejemplo n.º 2
0
        public async Task <PublicVolumeResponse> GetAsync(VolumeProviderContext context = null)
        {
            var t = GetTask(context);

            if (t == null)
            {
                return(null);
            }
            return(await t.ConfigureAwait(false));
        }
Ejemplo n.º 3
0
        public Task <PublicVolumeResponse> GetTask(Network network, VolumeProviderContext context = null)
        {
            var pv     = network.GetProviders <IPublicVolumeProvider>().FirstOrDefault(x => x.IsDirect);
            var volume = pv?.VolumeFeatures;

            if (volume?.HasBulk == true && volume.Bulk.CanReturnAll)
            {
                return(CoordinatorTask(pv, new PublicVolumesContext()));
            }

            var pp = PricingProvider.I.GetTask(network, new PricingProviderContext()
            {
                OnlyBulk = true, RequestVolume = true, UseReturnAll = true
            });

            if (pp != null)
            {
                return(pp.ContinueWith(r => After(new PublicVolumeResponse(network, r.Result), context)));
            }

            if (context?.UseReturnAll == true)
            {
                return(default);
Ejemplo n.º 4
0
        public async Task <PublicVolumeResponse> GetAsync(Network network, AssetPair pair, VolumeProviderContext context = null)
        {
            var t = GetTask(network, pair, context);

            if (t == null)
            {
                return(null);
            }
            return(await t.ConfigureAwait(false));
        }
Ejemplo n.º 5
0
        public async Task <PublicVolumeResponse> GetAsync(IEnumerable <Network> networks, VolumeProviderContext context = null)
        {
            var t = GetTask(networks, context);

            if (t == null)
            {
                return(null);
            }
            return(await t.ConfigureAwait(false));
        }