diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11b79315e..1687e7975 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,17 @@ name: Build and deploy on: [push, pull_request] jobs: + variables: + ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_DEV }} + rules: + - if: ${{ github.ref == 'refs/heads/master' }} + variables: + ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY_PROD }} main: runs-on: ubuntu-latest env: APP_NAME: wallet + ETHERSCAN_API_KEY: $ETHERSCAN_API_KEY WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }} TOKEN_SALES_URL_MAINNET: ${{ secrets.TOKEN_SALES_URL_MAINNET }} TOKEN_SALES_URL_TESTNET: ${{ secrets.TOKEN_SALES_URL_TESTNET }} diff --git a/src/protocols/ethereum/libs/EtherscanService.ts b/src/protocols/ethereum/libs/EtherscanService.ts index be34b7ad3..0a2052622 100644 --- a/src/protocols/ethereum/libs/EtherscanService.ts +++ b/src/protocols/ethereum/libs/EtherscanService.ts @@ -28,7 +28,7 @@ export class EtherscanService { apiUrl: string; // TODO - update delay if we use paid API key - freeVersionTimeDelay = ETHERSCAN_API_KEY ? 250 : 5300; + freeVersionTimeDelay = 5000 + Math.floor(Math.random() * 1000); constructor(apiUrl: string) { this.apiUrl = apiUrl; @@ -40,7 +40,6 @@ export class EtherscanService { apikey: ETHERSCAN_API_KEY, }).toString(); - // Without API key amount of calls are limited to one per every 5 seconds. // With free API key we can make 5 calls per second. // We're adding delays between calls to avoid getting empty results. // TODO: Use own node or paid version