From 9f11ed2b157a7202fe808bd42e938c467fd4c2f8 Mon Sep 17 00:00:00 2001 From: npty Date: Tue, 6 Aug 2024 15:23:55 +0700 Subject: [PATCH] chore: update localhost to 127.0.0.1 --- .../docker/axelar/bin/libs/evm-rpc.toml | 10 +++++----- .../docker/wasm/bin/init_wasm.sh | 2 +- .../jest/jest.global-setup.ts | 2 +- .../src/__tests__/DockerService.spec.ts | 8 ++++---- .../src/__tests__/lib/fetchLcd.ts | 2 +- .../src/clients/cosmos/CosmosClient.ts | 6 +++--- .../src/config/axelar/config.ts | 6 +++--- .../src/config/wasm/config.ts | 6 +++--- .../src/listeners/AxelarListener.ts | 2 +- .../src/services/DockerService.ts | 12 ++++++------ 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/packages/axelar-local-dev-cosmos/docker/axelar/bin/libs/evm-rpc.toml b/packages/axelar-local-dev-cosmos/docker/axelar/bin/libs/evm-rpc.toml index 0ed30c4c..7c15d1d0 100644 --- a/packages/axelar-local-dev-cosmos/docker/axelar/bin/libs/evm-rpc.toml +++ b/packages/axelar-local-dev-cosmos/docker/axelar/bin/libs/evm-rpc.toml @@ -1,24 +1,24 @@ [[axelar_bridge_evm]] name = "Ethereum" -rpc_addr = "localhost:8500/0" +rpc_addr = "127.0.0.1:8500/0" start-with-bridge = false [[axelar_bridge_evm]] name = "Avalanche" -rpc_addr = "localhost:8500/1" +rpc_addr = "127.0.0.1:8500/1" start-with-bridge = false [[axelar_bridge_evm]] name = "Fantom" -rpc_addr = "localhost:8500/2" +rpc_addr = "127.0.0.1:8500/2" start-with-bridge = false [[axelar_bridge_evm]] name = "Moonbeam" -rpc_addr = "localhost:8500/3" +rpc_addr = "127.0.0.1:8500/3" start-with-bridge = false [[axelar_bridge_evm]] name = "Polygon" -rpc_addr = "localhost:8500/4" +rpc_addr = "127.0.0.1:8500/4" start-with-bridge = false diff --git a/packages/axelar-local-dev-cosmos/docker/wasm/bin/init_wasm.sh b/packages/axelar-local-dev-cosmos/docker/wasm/bin/init_wasm.sh index ffdce9c9..b1dc1dd0 100755 --- a/packages/axelar-local-dev-cosmos/docker/wasm/bin/init_wasm.sh +++ b/packages/axelar-local-dev-cosmos/docker/wasm/bin/init_wasm.sh @@ -14,7 +14,7 @@ wasmd init "$MONIKER" --chain-id ${CHAIN_ID} --home ${HOME} > /dev/null 2>&1 && # edit the app.toml file to enable the API and swagger sed -i '/\[api\]/,/\[/ s/enable = false/enable = true/' "$HOME"/config/app.toml sed -i '/\[api\]/,/\[/ s/swagger = false/swagger = true/' "$HOME"/config/app.toml -sed -i '/\[api\]/,/\[/ s/address = "tcp:\/\/localhost:1317"/address = "tcp:\/\/0.0.0.0:1317"/' "$HOME"/config/app.toml +sed -i '/\[api\]/,/\[/ s/address = "tcp:\/\/127.0.0.1:1317"/address = "tcp:\/\/0.0.0.0:1317"/' "$HOME"/config/app.toml # this is essential for sub-1s block times (or header times go crazy) sed -i 's/"time_iota_ms": "1000"/"time_iota_ms": "10"/' "$HOME"/config/genesis.json diff --git a/packages/axelar-local-dev-cosmos/jest/jest.global-setup.ts b/packages/axelar-local-dev-cosmos/jest/jest.global-setup.ts index d6ca1ea2..098c2b62 100644 --- a/packages/axelar-local-dev-cosmos/jest/jest.global-setup.ts +++ b/packages/axelar-local-dev-cosmos/jest/jest.global-setup.ts @@ -3,7 +3,7 @@ import { startChains } from "../src/setup"; async function waitForRpc(chain: string, timeout = 120000): Promise { const start = Date.now(); const interval = 3000; - const url = `http://localhost/${chain}-rpc/health`; + const url = `http://127.0.0.1/${chain}-rpc/health`; let status = 0; while (Date.now() - start < timeout) { try { diff --git a/packages/axelar-local-dev-cosmos/src/__tests__/DockerService.spec.ts b/packages/axelar-local-dev-cosmos/src/__tests__/DockerService.spec.ts index 51bbae64..03ba1eda 100644 --- a/packages/axelar-local-dev-cosmos/src/__tests__/DockerService.spec.ts +++ b/packages/axelar-local-dev-cosmos/src/__tests__/DockerService.spec.ts @@ -9,12 +9,12 @@ setLogger(() => undefined); describe("DockerService", () => { it("should start containers successfully", async () => { const testLcd = "cosmos/base/tendermint/v1beta1/node_info"; - const healthAxelarRpc = await fetch("http://localhost/axelar-rpc"); + const healthAxelarRpc = await fetch("http://127.0.0.1/axelar-rpc"); const healthAxelarLcd = await fetch( - `http://localhost/axelar-lcd/${testLcd}` + `http://127.0.0.1/axelar-lcd/${testLcd}` ); - const healthWasmRpc = await fetch("http://localhost/wasm-rpc"); - const healthWasmLcd = await fetch(`http://localhost/wasm-lcd/${testLcd}`); + const healthWasmRpc = await fetch("http://127.0.0.1/wasm-rpc"); + const healthWasmLcd = await fetch(`http://127.0.0.1/wasm-lcd/${testLcd}`); expect(healthAxelarRpc.status).toBe(200); expect(healthAxelarLcd.status).toBe(200); diff --git a/packages/axelar-local-dev-cosmos/src/__tests__/lib/fetchLcd.ts b/packages/axelar-local-dev-cosmos/src/__tests__/lib/fetchLcd.ts index 1c62660d..250be32a 100644 --- a/packages/axelar-local-dev-cosmos/src/__tests__/lib/fetchLcd.ts +++ b/packages/axelar-local-dev-cosmos/src/__tests__/lib/fetchLcd.ts @@ -1,7 +1,7 @@ import fetch from "node-fetch"; export function fetchAxelarLcd(endpoint?: string) { - return fetch(`http://localhost/axelar-lcd/${endpoint}`).then((res) => + return fetch(`http://127.0.0.1/axelar-lcd/${endpoint}`).then((res) => res.json() ); } diff --git a/packages/axelar-local-dev-cosmos/src/clients/cosmos/CosmosClient.ts b/packages/axelar-local-dev-cosmos/src/clients/cosmos/CosmosClient.ts index a39a6e45..89dd42e2 100644 --- a/packages/axelar-local-dev-cosmos/src/clients/cosmos/CosmosClient.ts +++ b/packages/axelar-local-dev-cosmos/src/clients/cosmos/CosmosClient.ts @@ -46,9 +46,9 @@ export class CosmosClient { const defaultDenom = chain === "wasm" ? "uwasm" : "uaxl"; const chainInfo = { denom: config.denom || defaultDenom, - lcdUrl: config.lcdUrl || `http://localhost/${chain}-lcd`, - rpcUrl: config.rpcUrl || `http://localhost/${chain}-rpc`, - wsUrl: config.wsUrl || `ws://localhost/${chain}-rpc/websocket`, + lcdUrl: config.lcdUrl || `http://127.0.0.1/${chain}-lcd`, + rpcUrl: config.rpcUrl || `http://127.0.0.1/${chain}-rpc`, + wsUrl: config.wsUrl || `ws://127.0.0.1/${chain}-rpc/websocket`, }; gasPrice = gasPrice || GasPrice.fromString(`1${chainInfo.denom}`); diff --git a/packages/axelar-local-dev-cosmos/src/config/axelar/config.ts b/packages/axelar-local-dev-cosmos/src/config/axelar/config.ts index 2fa51af5..68d235c4 100644 --- a/packages/axelar-local-dev-cosmos/src/config/axelar/config.ts +++ b/packages/axelar-local-dev-cosmos/src/config/axelar/config.ts @@ -40,7 +40,7 @@ export const defaultAxelarConfig: ChainConfig = { export const defaultAxelarChainInfo: Omit = { prefix: "axelar", denom: "uaxl", - lcdUrl: "http://localhost/axelar-lcd", - rpcUrl: "http://localhost/axelar-rpc", - wsUrl: "ws://localhost/axelar-rpc/websocket", + lcdUrl: "http://127.0.0.1/axelar-lcd", + rpcUrl: "http://127.0.0.1/axelar-rpc", + wsUrl: "ws://127.0.0.1/axelar-rpc/websocket", }; diff --git a/packages/axelar-local-dev-cosmos/src/config/wasm/config.ts b/packages/axelar-local-dev-cosmos/src/config/wasm/config.ts index e52be70a..e8e55f96 100644 --- a/packages/axelar-local-dev-cosmos/src/config/wasm/config.ts +++ b/packages/axelar-local-dev-cosmos/src/config/wasm/config.ts @@ -12,7 +12,7 @@ export const defaultWasmConfig: ChainConfig = { export const defaultWasmChainInfo: Omit = { prefix: "wasm", denom: "uwasm", - lcdUrl: "http://localhost/wasm-lcd", - rpcUrl: "http://localhost/wasm-rpc", - wsUrl: "ws://localhost/wasm-rpc/websocket", + lcdUrl: "http://127.0.0.1/wasm-lcd", + rpcUrl: "http://127.0.0.1/wasm-rpc", + wsUrl: "ws://127.0.0.1/wasm-rpc/websocket", }; diff --git a/packages/axelar-local-dev-cosmos/src/listeners/AxelarListener.ts b/packages/axelar-local-dev-cosmos/src/listeners/AxelarListener.ts index aa344e05..e061a7cc 100644 --- a/packages/axelar-local-dev-cosmos/src/listeners/AxelarListener.ts +++ b/packages/axelar-local-dev-cosmos/src/listeners/AxelarListener.ts @@ -16,7 +16,7 @@ export class AxelarListener { constructor(config: Pick) { this.wsMap = new Map(); - this.wsUrl = config.wsUrl || `ws://localhost/axelar-rpc/websocket`; + this.wsUrl = config.wsUrl || `ws://127.0.0.1/axelar-rpc/websocket`; } private getOrInit(topicId: string) { diff --git a/packages/axelar-local-dev-cosmos/src/services/DockerService.ts b/packages/axelar-local-dev-cosmos/src/services/DockerService.ts index a79e6e93..faac4909 100644 --- a/packages/axelar-local-dev-cosmos/src/services/DockerService.ts +++ b/packages/axelar-local-dev-cosmos/src/services/DockerService.ts @@ -45,9 +45,9 @@ export class DockerService { await this.waitForRpc(chain, options?.rpcWaitTimeout); await this.waitForLcd(chain, options?.lcdWaitTimeout); - const rpcUrl = `http://localhost/${chain}-rpc`; - const lcdUrl = `http://localhost/${chain}-lcd`; - const wsUrl = `ws://localhost/${chain}-rpc/websocket`; + const rpcUrl = `http://127.0.0.1/${chain}-rpc`; + const lcdUrl = `http://127.0.0.1/${chain}-lcd`; + const wsUrl = `ws://127.0.0.1/${chain}-rpc/websocket`; logger.log(`RPC server for ${chain} is started at ${rpcUrl}`); logger.log(`LCD server for ${chain} is started at ${lcdUrl}`); @@ -75,7 +75,7 @@ export class DockerService { logger.log("Starting traefik container..."); await compose.upOne("traefik", config); - logger.log("Traefik started at http://localhost:8080"); + logger.log("Traefik started at http://127.0.0.1:8080"); } async stopAll() { @@ -122,7 +122,7 @@ export class DockerService { async waitForRpc(chain: CosmosChain, timeout = 120000): Promise { const start = Date.now(); const interval = 3000; - const url = `http://localhost/${chain}-rpc/health`; + const url = `http://127.0.0.1/${chain}-rpc/health`; let status = 0; while (Date.now() - start < timeout) { try { @@ -144,7 +144,7 @@ export class DockerService { const testUrl = "cosmos/base/tendermint/v1beta1/node_info"; const start = Date.now(); const interval = 3000; - const url = `http://localhost/${chain}-lcd/${testUrl}`; + const url = `http://127.0.0.1/${chain}-lcd/${testUrl}`; let result, network; while (Date.now() - start < timeout) { try {