Skip to content

Commit 3e6ba6e

Browse files
authored
Allow to add starknet contracts in runtime (#1140)
1 parent bed745f commit 3e6ba6e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/dipdup/context.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from dipdup.config.evm import EvmIndexConfig
2828
from dipdup.config.evm_events import EvmEventsIndexConfig
2929
from dipdup.config.evm_transactions import EvmTransactionsIndexConfig
30-
from dipdup.config.starknet import StarknetIndexConfig
30+
from dipdup.config.starknet import StarknetIndexConfig, StarknetContractConfig
3131
from dipdup.config.starknet_events import StarknetEventsIndexConfig
3232
from dipdup.config.tezos import TezosContractConfig
3333
from dipdup.config.tezos import TezosIndexConfig
@@ -239,15 +239,15 @@ async def reindex(
239239

240240
async def add_contract(
241241
self,
242-
kind: Literal['tezos'] | Literal['evm'],
242+
kind: Literal['tezos'] | Literal['evm'] | Literal['starknet'],
243243
name: str,
244244
address: str | None = None,
245245
typename: str | None = None,
246246
code_hash: str | int | None = None,
247247
) -> None:
248248
"""Adds contract to the inventory.
249249
250-
:param kind: Either 'tezos' or 'evm' allowed
250+
:param kind: Either 'tezos' or 'evm' or 'starknet' allowed
251251
:param name: Contract name
252252
:param address: Contract address
253253
:param typename: Alias for the contract script
@@ -274,6 +274,14 @@ async def add_contract(
274274
address=address,
275275
typename=typename,
276276
)
277+
elif kind == 'starknet':
278+
if address is None:
279+
raise ConfigurationError('Starknet contract address is required')
280+
contract_config = StarknetContractConfig(
281+
kind=kind,
282+
address=address,
283+
typename=typename,
284+
)
277285
else:
278286
raise NotImplementedError('Unknown contract kind', kind)
279287

0 commit comments

Comments
 (0)