naddison36/tx2uml

Etherscan API limit hit

Genysys opened this issue · 2 comments

I am trying to generate a UML digram for a transaction, but unfortunately I seem to be hittting the Etherscan API rate limit.

 tx2uml -f png -o transaction_trace_1 \
>     -u https://eth-mainnet.alchemyapi.io/v2/1 \
>     -n openeth 0xc5da4cf19c30cb2162249393943939230320203203
Failed to generate UML diagram VError: Failed to get contract details for contract 0xc5da4cf19c30cb2162249393943939230320203203 from Etherscan using url https://api.etherscan.io/api: Failed Etherscan API with result "Max rate limit reached"
    at EtherscanClient.getContract (/Users/samueldare/.nvm/versions/node/v10.22.1/lib/node_modules/tx2uml/lib/clients/EtherscanClient.js:58:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Is there a way to pass personal keys to the tx2uml command?

tx2uml is currently set to run two concurrent queries against Etherscan. That has been working for me but I don't run tx2uml all the time so during peak times the limit may be enforced.

const limit = pLimit(this.apiConcurrencyLimit)

At the moment the Etherscan API is hardcoded

public readonly apiKey: string = "Q35WDQ2354617I8E2Z1E4WU3MIEP89DW9H",

I can add an option so this can be overridden with your own key. I'll try and do this week.

In the meantime, you can either fork and change Etherscan's API concurrency to 1 or API key used.

Thanks for reporting

I've added a --etherscanKey -k option to tx2uml v1.0.6 so the default API key can be overridden.