From 307ad725283844d517f76aa37d98913adb25ee6a Mon Sep 17 00:00:00 2001 From: Maksim Strebkov <257byte@gmail.com> Date: Wed, 5 Jun 2024 11:25:50 +0300 Subject: [PATCH] Minor API fixes --- Tzkt.Api/Repositories/RewardsRepository.cs | 8 ++++---- Tzkt.Api/Repositories/TokensRepository.cs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tzkt.Api/Repositories/RewardsRepository.cs b/Tzkt.Api/Repositories/RewardsRepository.cs index a9a51275..09159b5f 100644 --- a/Tzkt.Api/Repositories/RewardsRepository.cs +++ b/Tzkt.Api/Repositories/RewardsRepository.cs @@ -1139,7 +1139,7 @@ public async Task GetDelegatorRewards( { switch (field) { - case "cycle": columns.Add(@"""Cycle"""); break; + case "cycle": columns.Add(@"dc.""Cycle"""); break; case "delegatedBalance": columns.Add(@"dc.""DelegatedBalance"""); break; case "stakedBalance": columns.Add(@"dc.""StakedBalance"""); break; case "baker": columns.Add(@"dc.""BakerId"""); break; @@ -1195,7 +1195,7 @@ public async Task GetDelegatorRewards( case "nonceRevelationRewardsStakedEdge": columns.Add(@"""NonceRevelationRewardsStakedEdge"""); break; case "nonceRevelationRewardsStakedShared": columns.Add(@"""NonceRevelationRewardsStakedShared"""); break; case "nonceRevelationLosses": columns.Add(@"""NonceRevelationLosses"""); break; - case "quote": columns.Add(@"""Cycle"""); break; + case "quote": columns.Add(@"dc.""Cycle"""); break; #region deprecated case "blockRewardsLiquid": columns.Add(@"""BlockRewardsDelegated"""); break; @@ -1604,7 +1604,7 @@ public async Task GetDelegatorRewards( switch (field) { - case "cycle": columns.Add(@"""Cycle"""); break; + case "cycle": columns.Add(@"dc.""Cycle"""); break; case "delegatedBalance": columns.Add(@"dc.""DelegatedBalance"""); break; case "stakedBalance": columns.Add(@"dc.""StakedBalance"""); break; case "baker": columns.Add(@"dc.""BakerId"""); break; @@ -1660,7 +1660,7 @@ public async Task GetDelegatorRewards( case "nonceRevelationRewardsStakedEdge": columns.Add(@"""NonceRevelationRewardsStakedEdge"""); break; case "nonceRevelationRewardsStakedShared": columns.Add(@"""NonceRevelationRewardsStakedShared"""); break; case "nonceRevelationLosses": columns.Add(@"""NonceRevelationLosses"""); break; - case "quote": columns.Add(@"""Cycle"""); break; + case "quote": columns.Add(@"dc.""Cycle"""); break; #region deprecated case "blockRewardsLiquid": columns.Add(@"""BlockRewardsDelegated"""); break; diff --git a/Tzkt.Api/Repositories/TokensRepository.cs b/Tzkt.Api/Repositories/TokensRepository.cs index e363f75f..0850bba6 100644 --- a/Tzkt.Api/Repositories/TokensRepository.cs +++ b/Tzkt.Api/Repositories/TokensRepository.cs @@ -943,7 +943,7 @@ async Task> QueryHistoricalTokenBalancesAsync(int level, To var sql = new SqlBuilder() .Append($@"SELECT {select} FROM (") - .Append(@"SELECT ROW_NUMBER() over (ORDER BY ""TokenId"", ""AccountId"") as ""Id"", ""TokenId"", ""AccountId"", SUM(""Amount"")::text AS ""Balance"" FROM (") + .Append(@"SELECT ROW_NUMBER() over (ORDER BY ""TokenId"", ""AccountId"") as ""Id"", ""TokenId"", ""AccountId"", SUM(""Amount"") AS ""Balance"" FROM (") .Append(@"SELECT tr.""TokenId"", tr.""FromId"" AS ""AccountId"", -tr.""Amount"" AS ""Amount"" FROM ""TokenTransfers"" as tr") .Append(@"INNER JOIN ""Tokens"" AS t ON t.""Id"" = tr.""TokenId""")