Skip to content

Commit

Permalink
Minor API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Jun 5, 2024
1 parent d1a7d0d commit 307ad72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Tzkt.Api/Repositories/RewardsRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ public async Task<object[][]> 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;
Expand Down Expand Up @@ -1195,7 +1195,7 @@ public async Task<object[][]> 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;
Expand Down Expand Up @@ -1604,7 +1604,7 @@ public async Task<object[]> 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;
Expand Down Expand Up @@ -1660,7 +1660,7 @@ public async Task<object[]> 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;
Expand Down
2 changes: 1 addition & 1 deletion Tzkt.Api/Repositories/TokensRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ async Task<IEnumerable<dynamic>> 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""")
Expand Down

0 comments on commit 307ad72

Please sign in to comment.