Skip to content

Commit 2cb7341

Browse files
committed
rm domain type from bookmarks
1 parent b5b80fe commit 2cb7341

File tree

2 files changed

+14
-47
lines changed

2 files changed

+14
-47
lines changed

modules/utilities.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,12 @@ def create_new_bookmark(self, args):
135135
except:
136136
color_print("{red}Bad args. Usage:{endc} nb <bookmark-name> <account-addr>")
137137
return
138-
if self.ton.IsAddr(addr):
139-
type = "account"
138+
if not self.ton.IsAddr(addr):
139+
raise Exception("Incorrect address")
140140
# end if
141141

142142
bookmark = dict()
143143
bookmark["name"] = name
144-
bookmark["type"] = type
145144
bookmark["addr"] = addr
146145
self.ton.AddBookmark(bookmark)
147146
color_print("CreatNewBookmark - {green}OK{endc}")
@@ -153,24 +152,22 @@ def print_bookmarks_list(self, args):
153152
print("No data")
154153
return
155154
table = list()
156-
table += [["Name", "Type", "Address", "Balance / Exp. date"]]
155+
table += [["Name", "Address", "Balance / Exp. date"]]
157156
for item in data:
158157
name = item.get("name")
159-
type = item.get("type")
160158
addr = item.get("addr")
161159
bookmark_data = item.get("data")
162-
table += [[name, type, addr, bookmark_data]]
160+
table += [[name, addr, bookmark_data]]
163161
print_table(table)
164162
# end define
165163

166164
def delete_bookmark(self, args):
167165
try:
168166
name = args[0]
169-
type = args[1]
170167
except:
171-
color_print("{red}Bad args. Usage:{endc} db <bookmark-name> <bookmark-type>")
168+
color_print("{red}Bad args. Usage:{endc} db <bookmark-name>")
172169
return
173-
self.ton.DeleteBookmark(name, type)
170+
self.ton.DeleteBookmark(name)
174171
color_print("DeleteBookmark - {green}OK{endc}")
175172
# end define
176173

mytoncore/mytoncore.py

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,20 +2730,6 @@ def GetItemFromDict(self, data, search):
27302730
return None
27312731
#end define
27322732

2733-
def GetAutoTransferRules(self):
2734-
autoTransferRules = self.local.db.get("autoTransferRules")
2735-
if autoTransferRules is None:
2736-
autoTransferRules = list()
2737-
self.local.db["autoTransferRules"] = autoTransferRules
2738-
return autoTransferRules
2739-
#end define
2740-
2741-
def AddAutoTransferRule(self, rule):
2742-
autoTransferRules = self.GetAutoTransferRules()
2743-
autoTransferRules.append(rule)
2744-
self.local.save()
2745-
#end define
2746-
27472733
def AddBookmark(self, bookmark):
27482734
if "bookmarks" not in self.local.db:
27492735
self.local.db["bookmarks"] = list()
@@ -2760,40 +2746,24 @@ def GetBookmarks(self):
27602746
return bookmarks
27612747
#end define
27622748

2763-
def GetBookmarkAddr(self, type, name):
2764-
bookmarks = self.local.db.get("bookmarks", list())
2765-
for bookmark in bookmarks:
2766-
bookmarkType = bookmark.get("type")
2767-
bookmarkName = bookmark.get("name")
2768-
bookmarkAddr = bookmark.get("addr")
2769-
if (bookmarkType == type and bookmarkName == name):
2770-
return bookmarkAddr
2771-
raise Exception("GetBookmarkAddr error: Bookmark not found")
2772-
#end define
2773-
2774-
def DeleteBookmark(self, name, type):
2749+
def DeleteBookmark(self, name):
27752750
bookmarks = self.local.db.get("bookmarks")
27762751
for bookmark in bookmarks:
2777-
bookmarkType = bookmark.get("type")
2778-
bookmarkName = bookmark.get("name")
2779-
if (type == bookmarkType and name == bookmarkName):
2752+
bookmark_name = bookmark.get("name")
2753+
if name == bookmark_name:
27802754
bookmarks.remove(bookmark)
27812755
self.local.save()
27822756
return
27832757
raise Exception("DeleteBookmark error: Bookmark not found")
27842758
#end define
27852759

27862760
def WriteBookmarkData(self, bookmark):
2787-
type = bookmark.get("type")
2788-
if type == "account":
2789-
addr = bookmark.get("addr")
2790-
account = self.GetAccount(addr)
2791-
if account.status == "empty":
2792-
data = "empty"
2793-
else:
2794-
data = account.balance
2761+
addr = bookmark.get("addr")
2762+
account = self.GetAccount(addr)
2763+
if account.status == "empty":
2764+
data = "empty"
27952765
else:
2796-
data = "null"
2766+
data = account.balance
27972767
bookmark["data"] = data
27982768
#end define
27992769

0 commit comments

Comments
 (0)