diff --git a/CosmosSharp/CosmosSharp.csproj b/CosmosSharp/CosmosSharp.csproj index 1d62e48..c0d28ff 100644 --- a/CosmosSharp/CosmosSharp.csproj +++ b/CosmosSharp/CosmosSharp.csproj @@ -11,7 +11,7 @@ Copyright (c) 2021 BTCTrader BTCTrader.CosmosSharp BTCTrader.CosmosSharp - 1.1.1 + 1.1.2 diff --git a/CosmosSharp/StargateApi.cs b/CosmosSharp/StargateApi.cs index 88f6a87..4b8e35d 100644 --- a/CosmosSharp/StargateApi.cs +++ b/CosmosSharp/StargateApi.cs @@ -33,11 +33,32 @@ public async Task GetAccount(string accountName, CancellationToken return await _httpHandler.GetJsonAsync(url, _config.HeaderKeyValues, cancellationToken); } - public async Task GetAccountBalance(string accountName, string denom, CancellationToken cancellationToken) + /// + /// Receives account balance via cosmos-sdk before v0.44.4. See more details about change in query account balance endpoint fix and release notes. + /// + /// address + /// denom or IBC denom + /// + /// + public async Task GetAccountBalanceLegacy(string accountName, string denom, CancellationToken cancellationToken) { var url = $"{_config.HttpEndpoint}/cosmos/bank/v1beta1/balances/{accountName}/{denom}"; return await _httpHandler.GetJsonAsync(url, _config.HeaderKeyValues, cancellationToken); } + + /// + /// Receives account balance via cosmos-sdk as from v0.44.4. See more details about query account balance endpoint fix and release notes. + /// + /// address + /// denom or IBC denom + /// + /// + public async Task GetAccountBalance(string accountName, string denom, CancellationToken cancellationToken) + { + // grpc-gateway query account balance by IBC denom had an incorrect endpoint + var url = $"{_config.HttpEndpoint}/cosmos/bank/v1beta1/balances/{accountName}/by_denom?denom={denom}"; + return await _httpHandler.GetJsonAsync(url, _config.HeaderKeyValues, cancellationToken); + } public async Task GetLatestBlock(CancellationToken cancellationToken) {