diff --git a/packages/tendermint-rpc/src/comet38/comet38client.ts b/packages/tendermint-rpc/src/comet38/comet38client.ts index 2d20513fac..94065d70c5 100644 --- a/packages/tendermint-rpc/src/comet38/comet38client.ts +++ b/packages/tendermint-rpc/src/comet38/comet38client.ts @@ -39,7 +39,11 @@ export class Comet38Client { // (our CI) when skipping the status call before doing other queries. Sleeping a little // while did not help. Thus we query the version as a way to say "hi" to the backend, // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); + // However we can run this code only inside our CI, so we don't have to run this code inside the prod build, + // this avoids an unnecessary request to the RPC nodes + if (process.env.TENDERMINT_ENABLED) { + const _version = await this.detectVersion(rpcClient); + } return Comet38Client.create(rpcClient); } diff --git a/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts b/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts index 6704a6f066..7111d52150 100644 --- a/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts +++ b/packages/tendermint-rpc/src/tendermint34/tendermint34client.ts @@ -39,7 +39,11 @@ export class Tendermint34Client { // (our CI) when skipping the status call before doing other queries. Sleeping a little // while did not help. Thus we query the version as a way to say "hi" to the backend, // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); + // However we can run this code only inside our CI, so we don't have to run this code inside the prod build, + // this avoids an unnecessary request to the RPC nodes + if (process.env.TENDERMINT_ENABLED) { + const _version = await this.detectVersion(rpcClient); + } return Tendermint34Client.create(rpcClient); } diff --git a/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts b/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts index 3d55949720..d7118a3a03 100644 --- a/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts +++ b/packages/tendermint-rpc/src/tendermint37/tendermint37client.ts @@ -39,7 +39,11 @@ export class Tendermint37Client { // (our CI) when skipping the status call before doing other queries. Sleeping a little // while did not help. Thus we query the version as a way to say "hi" to the backend, // even in cases where we don't use the result. - const _version = await this.detectVersion(rpcClient); + // However we can run this code only inside our CI, so we don't have to run this code inside the prod build, + // this avoids an unnecessary request to the RPC nodes + if (process.env.TENDERMINT_ENABLED) { + const _version = await this.detectVersion(rpcClient); + } return Tendermint37Client.create(rpcClient); }