I have a system where there'll be dozens of accounts, for ETH and tokens. I'll have access to the private keys of those.
From time to time I'll need to withdraw all of the coins in each account, in ETH and tokens alike, to my main wallet.
How will I implement it? Meaning, it should be done dynamically, in a script, will I'll run locally on my computer. And the gas price should be determined dynamically as well as the current balance.