Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable more evm chains #684

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion packages/valory/connections/ledger/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,25 @@
from aea.protocols.base import Message
from aea.protocols.dialogue.base import Dialogue, Dialogues

ETHEREUM_LEDGER_ID = "ethereum"

EVM_LEDGERS = {
i: ETHEREUM_LEDGER_ID
for i in [
"matic",
"gnosis",
"bsc",
"optimism",
"arbitrum",
"celo",
"avalanche",
"fantom",
"base",
"zksync",
"canto",
]
}


class RequestDispatcher(ABC):
"""Base class for a request dispatcher."""
Expand Down Expand Up @@ -158,7 +177,11 @@ def dispatch(self, envelope: Envelope) -> Task:
ledger_id = self.get_ledger_id(message)
chain_id = self.get_chain_id(message)
self.set_extra_kwargs(message)
api = self.ledger_api_registry.make(ledger_id, **self.api_config(chain_id))
if ledger_id not in EVM_LEDGERS:
registry_ledger_id = ledger_id
else:
registry_ledger_id = ETHEREUM_LEDGER_ID
api = self.ledger_api_registry.make(registry_ledger_id, **self.api_config(chain_id))
dialogue = self.dialogues.update(message)
if dialogue is None:
raise ValueError( # pragma: nocover
Expand Down
Loading