-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e239ce
commit 7a2bce8
Showing
7 changed files
with
101 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from collections.abc import Callable | ||
from typing import Any | ||
|
||
from aiosubstrate import SubstrateInterface | ||
|
||
from dipdup.datasources import JsonRpcDatasource | ||
|
||
|
||
class SubstrateInterfaceProxy(SubstrateInterface): | ||
def __init__(self, datasource: JsonRpcDatasource[Any]) -> None: | ||
super().__init__(datasource.url) # type: ignore[no-untyped-call] | ||
self._datasource = datasource | ||
|
||
async def http_request( | ||
self, | ||
method: str, | ||
params: list[Any], | ||
) -> Any: | ||
return await self._datasource._jsonrpc_request( | ||
method=method, | ||
params=params, | ||
raw=True, | ||
ws=False, | ||
) | ||
|
||
async def websocket_request( | ||
self, | ||
method: str, | ||
params: Any, | ||
result_handler: Callable[..., Any] | None = None, | ||
) -> Any: | ||
assert not result_handler | ||
return await self._datasource._jsonrpc_request( | ||
method=method, | ||
params=params, | ||
raw=True, | ||
ws=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.