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

Overlay implementation #7

Merged
merged 5 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install flake8 pytest pytest-asyncio
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ cython_debug/
/test/primitives/mytonlib_test.py
/test/primitives/usr/
.idea
/tests/contracts/wallets/priv_key.py
/feats/contracts/wallets/priv_key.py
/pytoniq/tlb/code_generator.py
/main.py
/venv39
/venv_new
/feats
.DS_Store
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

14 changes: 14 additions & 0 deletions examples/adnl/adnl.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ async def main():
# start adnl receiving server
await adnl.start()

# can set default handler for any query
adnl.set_default_query_handler(handler=lambda i: print(i))

# or provide function to process specific queries
def process_get_capabilities_request(_):
return {
'@type': 'tonNode.capabilities',
'version': 2,
'capabilities': 1,
}

adnl.set_query_handler(type_='overlay.getCapabilities',
handler=lambda i: process_get_capabilities_request(i))

# take peer from public config
peer = Node('172.104.59.125', 14432, "/YDNd+IwRUgL0mq21oC0L3RxrS8gTu0nciSPUrhqR78=", adnl)
await adnl.connect_to_peer(peer)
Expand Down
4 changes: 2 additions & 2 deletions pytoniq/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pytoniq_core.boc import *
from .contract import *
from pytoniq_core.crypto import *
from .liteclient import *
from .adnl import *
from pytoniq_core.boc import *
from pytoniq_core.crypto import *
from pytoniq_core.proof import *
from pytoniq_core.tl import *
from pytoniq_core.tlb import *
1 change: 1 addition & 0 deletions pytoniq/adnl/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .adnl import AdnlTransport, AdnlTransportError, AdnlChannel, Node
from .dht import DhtNode, DhtError, DhtClient, DhtValueNotFoundError
from .overlay import OverlayTransport, OverlayNode, OverlayTransportError
Loading