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))); }
public async Task <PublicVolumeResponse> GetAsync(VolumeProviderContext context = null) { var t = GetTask(context); if (t == null) { return(null); } return(await t.ConfigureAwait(false)); }
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);
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)); }
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)); }