from nacl.bindings import crypto_sign_seed_keypair from app.core.active_config import active_config from app.core.logger import make_log from app.core._blockchain.ton.wallet_v3cr3 import WalletV3CR3 from os import urandom, getenv from tonsdk.utils import Address def load_hot_pair(): hot_seed = active_config.get('private_key') if hot_seed is None: make_log("HotWallet", "No seed found, generating new one", level='info') hot_seed = urandom(32).hex() active_config.set('private_key', hot_seed) return load_hot_pair() public_key, private_key = crypto_sign_seed_keypair(bytes.fromhex(hot_seed)) return public_key, private_key _extra_ton_wallet_options = {} if getenv('TON_CUSTOM_WALLET_ADDRESS'): _extra_ton_wallet_options['wallet_address'] = Address(getenv('TON_CUSTOM_WALLET_ADDRESS')) hot_pubkey, hot_privkey = load_hot_pair() service_wallet = WalletV3CR3( private_key=hot_privkey, public_key=hot_pubkey, **_extra_ton_wallet_options )