Skip to content

Commit

Permalink
fix(NETWORKS): remove NETWORKS
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKozAllB committed Jul 22, 2024
1 parent 8d7e927 commit 66b7dc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ The Allbridge Core REST API requires the following environment variables:
- `https://horizon.stellar.org`
- `https://stellar-mainnet.rpcpool.com`
- ...
- `NETWORKS` - A list of supported networks. Possible values are `ETH`, `BSC`, `TRX`, `ARB`, `POL`, `AVA`, `OPT`, `BAS`, `CEL`, `SOL`, `SRB`, `STLR`. For Stellar network, you need to provide both `STLR` and `SRB` networks.
- `HEADERS` - Headers for the API requests. For example:
- `{"Authorization": "Bearer YOUR-TOKEN"}`
- `TRON_JSON_RPC` - The JSON RPC URL of the Tron node. For example:
Expand Down Expand Up @@ -134,7 +133,6 @@ docker run -p 3000:3000 \
-e SOL_NODE_URL="https://api.mainnet-beta.solana.com" \
-e SRB_NODE_URL="...soroban rpc node..." \
-e STLR_NODE_URL="https://horizon.stellar.org" \
-e NETWORKS="[\"ETH\",\"BSC\",\"TRX\",\"ARB\",\"POL\",\"AVA\",\"OPT\",\"BAS\",\"CEL\",\"SOL\",\"SRB\",\"STLR\"]" \
-d allbridge/io.allbridge.rest-api:latest
```
or use environment variables from the `.env` file:
Expand All @@ -159,7 +157,6 @@ docker run -p 3000:3000 \
-e SOL_NODE_URL="https://api.mainnet-beta.solana.com" \
-e SRB_NODE_URL="...soroban rpc node..." \
-e STLR_NODE_URL="https://horizon.stellar.org" \
-e NETWORKS="[\"ETH\",\"BSC\",\"TRX\",\"ARB\",\"POL\",\"AVA\",\"OPT\",\"BAS\",\"CEL\",\"SOL\",\"SRB\",\"STLR\"]" \
-d allbridge-core-rest-api
```

Expand Down
13 changes: 6 additions & 7 deletions rest-api/src/service/config.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { mainnet } from '@allbridge/bridge-core-sdk';
import { ChainSymbol, mainnet } from '@allbridge/bridge-core-sdk';
import { VERSION } from '@allbridge/bridge-core-sdk/dist/src/version';
import { LoggerCredential } from '@allbridge/logger';
import { Injectable } from '@nestjs/common';
Expand All @@ -16,10 +16,6 @@ export class ConfigService {
return +(process.env.PORT || DEFAULT_PORT);
}

static getNetworks(): string[] {
return process.env.NETWORKS ? JSON.parse(process.env.NETWORKS) : [];
}

static getNetworkNodeUrl(chainSymbol: string): string {
const nodeUrl = process.env[`${chainSymbol}_NODE_URL`];
if (nodeUrl) {
Expand Down Expand Up @@ -52,8 +48,11 @@ export class ConfigService {

static getRPCUrls(): { [name: string]: string } {
const rpcUrls: any = {};
ConfigService.getNetworks().forEach((chain) => {
rpcUrls[chain] = ConfigService.getNetworkNodeUrl(chain);
const chainSymbols = Object.values(ChainSymbol);
chainSymbols.forEach((chain) => {
try {
rpcUrls[chain] = ConfigService.getNetworkNodeUrl(chain);
} catch (e) {}
});
return rpcUrls;
}
Expand Down

0 comments on commit 66b7dc8

Please sign in to comment.