Skip to content

Commit

Permalink
Merge pull request #31 from axelarnetwork/chore/cosmosSupply
Browse files Browse the repository at this point in the history
chore: not return zero when lcd not return supply amount
  • Loading branch information
pjenviri authored May 7, 2024
2 parents 89febed + 1f82dc7 commit dfbf507
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,8 +560,8 @@ mainnet:
chain_name: "osmosis"
endpoints:
lcd:
- "https://api-osmosis-ia.cosmosia.notional.ventures"
- "https://lcd.osmosis.zone"
- "https://api-osmosis-ia.cosmosia.notional.ventures"
- "https://lcd-osmosis.blockapsis.com"
- "https://rest-osmosis.ecostake.com"
- "https://api.osmosis.interbloc.org"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "axelarscan-api",
"version": "0.0.6",
"version": "0.0.7",
"description": "Axelarscan API",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion terraform/mainnet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.6"
default = "0.0.7"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/stagenet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.6"
default = "0.0.7"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
2 changes: 1 addition & 1 deletion terraform/testnet/variables.tf.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ variable "log_level" {

variable "app_version" {
description = "App version, same as docker image version"
default = "0.0.6"
default = "0.0.7"
validation {
error_message = "Must be valid semantic version. $Major.$Minor.$Patch"
condition = can(regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", var.app_version))
Expand Down
5 changes: 3 additions & 2 deletions utils/chain/cosmos.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { getChainData } = require('../config');
const { createInstance, request } = require('../http');
const { toArray } = require('../parser');
const { equalsIgnoreCase } = require('../string');
const { formatUnits } = require('../number');
const { isNumber, formatUnits } = require('../number');

const getLCDs = (chain, numLCDs, timeout) => {
const { deprecated, endpoints } = { ...getChainData(chain, 'cosmos') };
Expand Down Expand Up @@ -74,8 +74,9 @@ const getIBCSupply = async (chain, denomData) => {
const response = await lcds.query('/cosmos/bank/v1beta1/supply', { 'pagination.limit': 10000 });
supply = toArray(response?.supply).find(d => equalsIgnoreCase(d.denom, ibc_denom))?.amount;
if (!(supply && supply !== '0') && response?.supply) supply = '0';
valid = isNumber(supply);
}
return formatUnits(supply, decimals || 6, false);
return valid ? formatUnits(supply, decimals || 6, false) : null;
};

module.exports = {
Expand Down

0 comments on commit dfbf507

Please sign in to comment.