Exemplo n.º 1
0
            public override async Task <WebThreeState> Handle
            (
                GetNftByTypeAction aGetNftByTypeClientRequest,
                CancellationToken aCancellationToken
            )
            {
                uint getNftId = aGetNftByTypeClientRequest.GetNftType;

                //string requestUri = QueryHelpers.AddQueryString(GetNftByTypeSharedRequest.Route, "GetNftType", getNftId.ToString());
                string requestUri = GetNftByTypeSharedRequest.RouteFactory((int)getNftId);

                GetNftByTypeSharedResponse aNftTemplate = await HttpClient.GetJsonAsync <GetNftByTypeSharedResponse>(requestUri);

                WebThreeState.CurrentNftTemplate = aNftTemplate.NftTypeData;

                return(WebThreeState);
            }
Exemplo n.º 2
0
        public async Task Should_Generate_NftTypesListWithIds()
        {
            var NftTypeList = new List <NftTemplate>();


            var fetchNftTypes = new GetNftTypesClientFeaturesAction();

            WebThreeState response = await Mediator.Send(fetchNftTypes);

            int NumOfTemplates = (int)response.TotalNftTypes;

            // Nft templates are not zero indexed.
            for (uint ctr = 1; ctr <= NumOfTemplates; ctr++)
            {
                string requestUri = GetNftByTypeSharedRequest.RouteFactory((int)ctr);

                GetNftByTypeSharedResponse templateResponse = await HttpClient.GetJsonAsync <GetNftByTypeSharedResponse>(requestUri);

                templateResponse.NftTypeData.ShouldBeOfType <NftTemplate>();
                var template = new NftTemplate()
                {
                    NftId          = ctr,
                    Name           = templateResponse.NftTypeData.Name,
                    Symbol         = templateResponse.NftTypeData.Symbol,
                    MintLimit      = templateResponse.NftTypeData.MintLimit,
                    AttachedTokens = templateResponse.NftTypeData.AttachedTokens
                };
                NftTypeList.Add(template);
                //  NftTypeDict[ctr] = templateResponse;
                //
            }

            NftTypeList[3].NftId.ShouldBe((uint)4);

            //NftTypeList[3].Name.ShouldBe("TesterTemplate_0");
            //NftTypeDict[4].Name.ShouldBe("TesterTemplate_0");
        }
            public override async Task <WebThreeState> Handle
            (
                GetNftTypesClientFeaturesAction aGetNftTypesClientRequest,
                CancellationToken aCancellationToken
            )
            {
                _TemplateList = new List <NftTemplate>();

                GetNftCountSharedResponse aSharedResponse = await HttpClient.GetJsonAsync <GetNftCountSharedResponse>(GetNftCountSharedRequest.Route);

                int nftCount = (int)aSharedResponse.NftCount;

                for (int ctr = 1; ctr <= nftCount; ctr++)
                {
                    string requestUri = GetNftByTypeSharedRequest.RouteFactory(ctr);
                    GetNftByTypeSharedResponse templateResponse = await HttpClient.GetJsonAsync <GetNftByTypeSharedResponse>(requestUri);

                    var template = new NftTemplate()
                    {
                        NftId          = (uint)ctr,
                        Name           = templateResponse.NftTypeDto.Name,
                        Symbol         = templateResponse.NftTypeDto.Symbol,
                        MintLimit      = templateResponse.NftTypeDto.MintLimit,
                        AttachedTokens = templateResponse.NftTypeDto.AttachedTokens
                    };

                    _TemplateList.Add(template);
                }

                var TemplateInfoContainer = new WebThreeState {
                    TemplateDataList = _TemplateList
                };

                TemplateInfoContainer.TotalNftTypes = aSharedResponse.NftCount;
                return(TemplateInfoContainer);
            }
            public override async Task <WebThreeState> Handle
            (
                GetNftTypesClientFeaturesAction aGetNftTypesClientRequest,
                CancellationToken aCancellationToken
            )
            {
                _TemplateList = new List <NftTemplate>();

                GetNftTypesSharedResponse aSharedResponse = await HttpClient.GetJsonAsync <GetNftTypesSharedResponse>(GetNftTypesSharedRequest.Route);

                int NumOfTemplates = (int)aSharedResponse.TotalNftTypes;

                for (uint ctr = 1; ctr <= NumOfTemplates; ctr++)
                {
                    string requestUri = GetNftByTypeSharedRequest.RouteFactory((int)ctr);
                    GetNftByTypeSharedResponse templateResponse = await HttpClient.GetJsonAsync <GetNftByTypeSharedResponse>(requestUri);

                    var template = new NftTemplate()
                    {
                        NftId          = ctr,
                        Name           = templateResponse.NftTypeData.Name,
                        Symbol         = templateResponse.NftTypeData.Symbol,
                        MintLimit      = templateResponse.NftTypeData.MintLimit,
                        AttachedTokens = templateResponse.NftTypeData.AttachedTokens
                    };


                    _TemplateList.Add(template);
                }

                WebThreeState.TemplateDataList = _TemplateList;

                WebThreeState.TotalNftTypes = aSharedResponse.TotalNftTypes;

                return(WebThreeState);
            }