Exemplo n.º 1
0
        public async Task <IActionResult> Nfts()
        {
            RetornoNfts nfts = new RetornoNfts();

            nfts.InfosGerais = new List <NftsIntermediario>();

            foreach (var conta in _contas)
            {
                HttpClient client = new HttpClient();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var result = await client.GetAsync("https://atomic.wax.io/atomicassets/v1/assets?owner=" + conta);

                var jsonContent = JsonConvert.DeserializeObject <RetornoNfts>(await result.Content.ReadAsStringAsync());

                foreach (var infoGeral in jsonContent.InfosGerais)
                {
                    infoGeral.Conta = conta;
                }

                nfts.InfosGerais.AddRange(jsonContent.InfosGerais);
            }

            return(View(nfts));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> JohannNfts()
        {
            RetornoNfts nfts = new RetornoNfts();

            nfts.InfosGerais = new List <NftsIntermediario>();

            foreach (var conta in _contasJohann)
            {
                HttpClient client = new HttpClient();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                var result = await client.GetAsync("https://atomic.wax.io/atomicassets/v1/assets?owner=" + conta);

                var jsonContent = JsonConvert.DeserializeObject <RetornoNfts>(await result.Content.ReadAsStringAsync());

                Account account = new Account()
                {
                    account_name = conta
                };

                var resultContent = JsonConvert.SerializeObject(account);
                var contentString = new StringContent(resultContent, Encoding.UTF8, "application/json");
                contentString.Headers.ContentType = new
                                                    MediaTypeHeaderValue("application/json");

                var getAccount = await client.PostAsync("https://chain.wax.io/v1/chain/get_account", contentString);

                var accountContent = JsonConvert.DeserializeObject <AccountContent>(await getAccount.Content.ReadAsStringAsync());

                foreach (var infoGeral in jsonContent.InfosGerais)
                {
                    infoGeral.Conta          = conta;
                    infoGeral.DonoConta      = "Johann";
                    infoGeral.AccountContent = accountContent;
                }
                nfts.InfosGerais.AddRange(jsonContent.InfosGerais);
            }
            return(View(nfts));
        }