import os

from tonclient.client import TonClient
from tonclient.types import Abi, CallSet, Signer, ClientConfig, \
    ParamsOfEncodeMessage, ParamsOfProcessMessage

BASE_DIR = os.path.dirname(__file__)
SAMPLES_DIR = os.path.join(BASE_DIR, 'samples')
GIVER_ADDRESS = '0:f5c2510bfe407363cb1db6b9d7bc1184a05f8b343aeaa828189c580e8569ee23'

client_config = ClientConfig()
client_config.network.endpoints = ['https://tonos.freeton.surf']
async_core_client = TonClient(config=client_config)
sync_core_client = TonClient(config=client_config, is_core_async=False)


def send_grams(address: str):
    giver_abi = Abi.from_path(
        path=os.path.join(SAMPLES_DIR, 'Giver.abi.json'))
    call_set = CallSet(
        function_name='grant', input={'dest': address})
    encode_params = ParamsOfEncodeMessage(
        abi=giver_abi, signer=Signer.NoSigner(), address=GIVER_ADDRESS,
        call_set=call_set)
    process_params = ParamsOfProcessMessage(
        message_encode_params=encode_params, send_events=False)
    async_core_client.processing.process_message(params=process_params)


def tonos_punch():
    send_grams(
        address='0:b5e9240fc2d2f1ff8cbb1d1dee7fb7cae155e5f6320e585fcc685698994a19a5')

[((178, 203), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (193, 203), False, 'import os\n'), ((218, 251), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""samples"""'], {}), "(BASE_DIR, 'samples')\n", (230, 251), False, 'import os\n'), ((354, 368), 'tonclient.types.ClientConfig', 'ClientConfig', ([], {}), '()\n', (366, 368), False, 'from tonclient.types import Abi, CallSet, Signer, ClientConfig, ParamsOfEncodeMessage, ParamsOfProcessMessage\n'), ((454, 485), 'tonclient.client.TonClient', 'TonClient', ([], {'config': 'client_config'}), '(config=client_config)\n', (463, 485), False, 'from tonclient.client import TonClient\n'), ((505, 557), 'tonclient.client.TonClient', 'TonClient', ([], {'config': 'client_config', 'is_core_async': '(False)'}), '(config=client_config, is_core_async=False)\n', (514, 557), False, 'from tonclient.client import TonClient\n'), ((694, 749), 'tonclient.types.CallSet', 'CallSet', ([], {'function_name': '"""grant"""', 'input': "{'dest': address}"}), "(function_name='grant', input={'dest': address})\n", (701, 749), False, 'from tonclient.types import Abi, CallSet, Signer, ClientConfig, ParamsOfEncodeMessage, ParamsOfProcessMessage\n'), ((922, 1000), 'tonclient.types.ParamsOfProcessMessage', 'ParamsOfProcessMessage', ([], {'message_encode_params': 'encode_params', 'send_events': '(False)'}), '(message_encode_params=encode_params, send_events=False)\n', (944, 1000), False, 'from tonclient.types import Abi, CallSet, Signer, ClientConfig, ParamsOfEncodeMessage, ParamsOfProcessMessage\n'), ((634, 677), 'os.path.join', 'os.path.join', (['SAMPLES_DIR', '"""Giver.abi.json"""'], {}), "(SAMPLES_DIR, 'Giver.abi.json')\n", (646, 677), False, 'import os\n'), ((832, 849), 'tonclient.types.Signer.NoSigner', 'Signer.NoSigner', ([], {}), '()\n', (847, 849), False, 'from tonclient.types import Abi, CallSet, Signer, ClientConfig, ParamsOfEncodeMessage, ParamsOfProcessMessage\n')]