diff --git a/app/core/_blockchain/ton/wallet_v3cr3.py b/app/core/_blockchain/ton/wallet_v3cr3.py index 06776f8..3a78822 100644 --- a/app/core/_blockchain/ton/wallet_v3cr3.py +++ b/app/core/_blockchain/ton/wallet_v3cr3.py @@ -75,36 +75,3 @@ class WalletV3CR3(WalletContract): ) signing_message = signing_message.store_ref(_commands.end_cell()) return self.create_external_message(signing_message.end_cell(), 0, True) - - def create_init_external_message(self): - create_state_init = self.create_state_init() - state_init = create_state_init["state_init"] - address = create_state_init["address"] - code = create_state_init["code"] - data = create_state_init["data"] - - signing_message = begin_cell().store_cell(self.create_signing_message(seqno=0)) - _commands = begin_cell().store_uint(0, 32) - signing_message = signing_message.store_ref(_commands.end_cell()) - signing_message = signing_message.end_cell() - signature = sign_message( - bytes(signing_message.bytes_hash()), self.options['private_key']).signature - - body = Cell() - body.bits.write_bytes(signature) - body.write_cell(signing_message) - - header = Contract.create_external_message_header(address) - external_message = Contract.create_common_msg_info( - header, state_init, body) - - return { - "address": address, - "message": external_message, - - "body": body, - "signing_message": signing_message, - "state_init": state_init, - "code": code, - "data": data, - } diff --git a/app/core/background/ton_service.py b/app/core/background/ton_service.py index 82babf1..8b1db7f 100644 --- a/app/core/background/ton_service.py +++ b/app/core/background/ton_service.py @@ -1,4 +1,4 @@ - +from tonsdk.boc import begin_cell from app.core.logger import make_log from app.core.storage import db_session from app.core._secrets import service_wallet @@ -18,7 +18,14 @@ async def main(): if sw_seqno_value == 0: make_log("TON", "Service wallet is not deployed, deploying...", level="info") await toncenter.send_boc( - service_wallet.create_init_external_message()['message'].to_boc(False) + service_wallet.create_transfer_message( + [{ + 'address': service_wallet.address.to_string(1, 1, 1), + 'amount': 1, + 'send_mode': 1, + 'payload': begin_cell().store_uint(0, 32).store_bytes(b"Init MY Node").end_cell() + }], 0 + )['message'].to_boc(False) ) await asyncio.sleep(5) return await main()