コード例 #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)));
        }
コード例 #2
0
        public async Task <PublicVolumeResponse> GetAsync(VolumeProviderContext context = null)
        {
            var t = GetTask(context);

            if (t == null)
            {
                return(null);
            }
            return(await t.ConfigureAwait(false));
        }
コード例 #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);
コード例 #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));
        }
コード例 #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));
        }