Skip to content

Commit

Permalink
Merge pull request #29 from axelarnetwork/feat/lcd
Browse files Browse the repository at this point in the history
feat: use multiple lcd and change timeout for getTVL
  • Loading branch information
nrsirapop authored May 4, 2024
2 parents b9faa38 + 2a5f53b commit 08acabb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
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.4",
"version": "0.0.5",
"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.4"
default = "0.0.5"
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.4"
default = "0.0.5"
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.4"
default = "0.0.5"
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
8 changes: 4 additions & 4 deletions utils/chain/cosmos.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { toArray } = require('../parser');
const { equalsIgnoreCase } = require('../string');
const { formatUnits } = require('../number');

const getLCDs = (chain, onlyFirstLCD = false) => {
const getLCDs = (chain, onlyFirstLCD = false, timeout) => {
const { deprecated, endpoints } = { ...getChainData(chain, 'cosmos') };
const lcds = toArray(endpoints?.lcd);
if (lcds.length > 0 && !deprecated) {
Expand All @@ -16,7 +16,7 @@ const getLCDs = (chain, onlyFirstLCD = false) => {
let output;
if (path) {
for (const lcd of _.slice(lcds, 0, onlyFirstLCD ? 1 : lcds.length)) {
const response = await request(createInstance(lcd, { timeout: endpoints?.timeout?.lcd, gzip: true }), { path, params });
const response = await request(createInstance(lcd, { timeout: timeout || endpoints?.timeout?.lcd, gzip: true }), { path, params });
const { error } = { ...response };
if (response && !error) {
output = response;
Expand All @@ -33,7 +33,7 @@ const getLCDs = (chain, onlyFirstLCD = false) => {
};

const getCosmosBalance = async (chain, address, denomData) => {
const lcds = getLCDs(chain, true);
const lcds = getLCDs(chain, false, 10000);
const { denom, ibc_denom, decimals } = { ...denomData };
const denoms = toArray([denom, ibc_denom]);
if (!(lcds && address)) return null;
Expand All @@ -58,7 +58,7 @@ const getCosmosBalance = async (chain, address, denomData) => {
};

const getIBCSupply = async (chain, denomData) => {
const lcds = getLCDs(chain, true);
const lcds = getLCDs(chain, false, 10000);
const { ibc_denom, decimals } = { ...denomData };
if (!(lcds && ibc_denom)) return null;

Expand Down

0 comments on commit 08acabb

Please sign in to comment.