Skip to content
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
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ Mytonctrl's documentation can be found at https://docs.ton.org/participate/run-n
- [x] Show offers
- [x] Vote for the proposal
- [x] Automatic voting for previously voted proposals
- [x] Domain management
- [x] Rent a new domain
- [x] Show rented domains
- [x] Show domain status
- [x] Delete domain
- [ ] Automatic domain renewal
- [x] Controlling the validator
- [x] Participate in the election of a validator
- [x] Return bet + reward
Expand Down
7 changes: 0 additions & 7 deletions mytoncore/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,6 @@ def Offers(local, ton):
ton.VoteOffer(offer_hash)
# end define


def Domains(local, ton):
pass
# end define


def Telemetry(local, ton):
sendTelemetry = local.db.get("sendTelemetry")
if sendTelemetry is not True:
Expand Down Expand Up @@ -565,7 +559,6 @@ def General(local):
local.start_cycle(Complaints, sec=t, args=(local, ton, ))
local.start_cycle(Slashing, sec=t, args=(local, ton, ))

local.start_cycle(Domains, sec=600, args=(local, ton, ))
local.start_cycle(Telemetry, sec=60, args=(local, ton, ))
local.start_cycle(OverlayTelemetry, sec=7200, args=(local, ton, ))
local.start_cycle(ScanLiteServers, sec=60, args=(local, ton,))
Expand Down
9 changes: 0 additions & 9 deletions mytoncore/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,6 @@ def __init__(self, workchain, addr):
#end class


class Domain(dict):
def __init__(self):
self["name"] = None
self["adnlAddr"] = None
self["walletName"] = None
#end define
#end class


class Block():
def __init__(self, str=None):
self.workchain = None
Expand Down
120 changes: 0 additions & 120 deletions mytoncore/mytoncore.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from mytoncore.models import (
Wallet,
Account,
Domain,
Block,
Trans,
Message,
Expand Down Expand Up @@ -390,48 +389,6 @@ def GetComment(self, body):
return result
#end define

def GetDomainAddr(self, domainName):
cmd = "dnsresolve {domainName} -1".format(domainName=domainName)
result = self.liteClient.Run(cmd)
if "not found" in result:
raise Exception("GetDomainAddr error: domain \"{domainName}\" not found".format(domainName=domainName))
resolver = parse(result, "next resolver", '\n')
buff = resolver.replace(' ', '')
buffList = buff.split('=')
fullHexAddr = buffList[0]
addr = buffList[1]
return addr
#end define

def GetDomainEndTime(self, domainName):
self.local.add_log("start GetDomainEndTime function", "debug")
buff = domainName.split('.')
subdomain = buff.pop(0)
dnsDomain = ".".join(buff)
dnsAddr = self.GetDomainAddr(dnsDomain)

cmd = "runmethodfull {addr} getexpiration \"{subdomain}\"".format(addr=dnsAddr, subdomain=subdomain)
result = self.liteClient.Run(cmd)
result = parse(result, "result:", '\n')
result = parse(result, "[", "]")
result = result.replace(' ', '')
result = int(result)
return result
#end define

def GetDomainAdnlAddr(self, domainName):
self.local.add_log("start GetDomainAdnlAddr function", "debug")
cmd = "dnsresolve {domainName} 1".format(domainName=domainName)
result = self.liteClient.Run(cmd)
lines = result.split('\n')
for line in lines:
if "adnl address" in line:
adnlAddr = parse(line, "=", "\n")
adnlAddr = adnlAddr.replace(' ', '')
adnlAddr = adnlAddr
return adnlAddr
#end define

def GetLocalWallet(self, walletName, version=None, subwallet=None):
self.local.add_log("start GetLocalWallet function", "debug")
if walletName is None:
Expand Down Expand Up @@ -2898,76 +2855,6 @@ def GetItemFromDict(self, data, search):
return None
#end define

def GetDomainFromAuction(self, walletName, addr):
wallet = self.GetLocalWallet(walletName)
bocPath = self.local.buffer.my_temp_dir + "get_dns_data.boc"
bocData = bytes.fromhex("b5ee9c7241010101000e0000182fcb26a20000000000000000f36cae4d")
with open(bocPath, 'wb') as file:
file.write(bocData)
resultFilePath = self.SignBocWithWallet(wallet, bocPath, addr, 0.1)
self.SendFile(resultFilePath, wallet)
#end define

def NewDomain(self, domain):
self.local.add_log("start NewDomain function", "debug")
domainName = domain["name"]
buff = domainName.split('.')
subdomain = buff.pop(0)
dnsDomain = ".".join(buff)
dnsAddr = self.GetDomainAddr(dnsDomain)
wallet = self.GetLocalWallet(domain["walletName"])
expireInSec = 700000 # fix me
catId = 1 # fix me

# Check if domain is busy
domainEndTime = self.GetDomainEndTime(domainName)
if domainEndTime > 0:
raise Exception("NewDomain error: domain is busy")
#end if

fileName = self.tempDir + "dns-msg-body.boc"
args = ["auto-dns.fif", dnsAddr, "add", subdomain, expireInSec, "owner", wallet.addrB64, "cat", catId, "adnl", domain["adnlAddr"], "-o", fileName]
result = self.fift.Run(args)
resultFilePath = parse(result, "Saved to file ", ')')
resultFilePath = self.SignBocWithWallet(wallet, resultFilePath, dnsAddr, 1.7)
self.SendFile(resultFilePath, wallet)
self.AddDomain(domain)
#end define

def AddDomain(self, domain):
if "domains" not in self.local.db:
self.local.db["domains"] = list()
#end if
self.local.db["domains"].append(domain)
self.local.save()
#end define

def GetDomains(self):
domains = self.local.db.get("domains", list())
for domain in domains:
domainName = domain.get("name")
domain["endTime"] = self.GetDomainEndTime(domainName)
return domains
#end define

def GetDomain(self, domainName):
domain = dict()
domain["name"] = domainName
domain["adnlAddr"] = self.GetDomainAdnlAddr(domainName)
domain["endTime"] = self.GetDomainEndTime(domainName)
return domain
#end define

def DeleteDomain(self, domainName):
domains = self.local.db.get("domains")
for domain in domains:
if (domainName == domain.get("name")):
domains.remove(domain)
self.local.save()
return
raise Exception("DeleteDomain error: Domain not found")
#end define

def GetAutoTransferRules(self):
autoTransferRules = self.local.db.get("autoTransferRules")
if autoTransferRules is None:
Expand Down Expand Up @@ -3030,13 +2917,6 @@ def WriteBookmarkData(self, bookmark):
data = "empty"
else:
data = account.balance
elif type == "domain":
domainName = bookmark.get("addr")
endTime = self.GetDomainEndTime(domainName)
if endTime == 0:
data = "free"
else:
data = timestamp2datetime(endTime, "%d.%m.%Y")
else:
data = "null"
bookmark["data"] = data
Expand Down
Loading