diff --git a/FireWalletBrowser.bsdesign b/FireWalletBrowser.bsdesign
index 3490c6b..e0e019f 100644
Binary files a/FireWalletBrowser.bsdesign and b/FireWalletBrowser.bsdesign differ
diff --git a/account.py b/account.py
index c7ca96d..d8e36b1 100644
--- a/account.py
+++ b/account.py
@@ -665,9 +665,8 @@ def getxPub(account):
#endregion
-def generateReport(account):
+def generateReport(account,format="{name},{expiry},{value},{maxBid}"):
domains = getDomains(account)
- format = str('{name},{expiry},{value},{maxBid}')
lines = [format.replace("{","").replace("}","")]
for domain in domains:
@@ -689,4 +688,7 @@ def generateReport(account):
line = line.replace("{openHeight}",str(domain['height']))
lines.append(line)
- return lines
\ No newline at end of file
+ return lines
+
+def convertHNS(value: int):
+ return value/1000000
\ No newline at end of file
diff --git a/main.py b/main.py
index d85b946..931ee51 100644
--- a/main.py
+++ b/main.py
@@ -371,11 +371,30 @@ def manage(domain: str):
else:
finalize_time = "now"
+ plugins = "
"
+ # Execute domain plugins
+ plugin_links = os.listdir("plugins")
+ for plugin in plugin_links:
+ if os.path.isdir("plugins/" + plugin):
+ module = importlib.import_module("plugins." + plugin + ".main")
+ moduleFunctions = module.listFunctions()
+ for moduleFunction in moduleFunctions:
+ data = moduleFunctions[moduleFunction]
+ if "type" in data:
+ if data["type"] == "domain":
+ # Run function
+ print(data)
+ functionOutput = module.runFunction(moduleFunction,{"domain":domain},account_module.check_account(request.cookies.get("account")))
+ print(functionOutput)
+ plugins += render.plugin_output(functionOutput,data['returns'])
+ plugins += "
"
+
+
return render_template("manage.html", account=account, sync=account_module.getNodeSync(),
error=errorMessage, address=address,
domain=domain,expiry=expiry, dns=dns,
raw_dns=urllib.parse.quote(raw_dns),
- finalize_time=finalize_time)
+ finalize_time=finalize_time,plugins=plugins)
@app.route('/manage//finalize')
diff --git a/plugins/domain/domain.json b/plugins/domain/domain.json
new file mode 100644
index 0000000..f999f8b
--- /dev/null
+++ b/plugins/domain/domain.json
@@ -0,0 +1,4 @@
+{
+ "name":"Domains Plugin",
+ "description":"This is plugin for the domain page"
+}
\ No newline at end of file
diff --git a/plugins/domain/main.py b/plugins/domain/main.py
new file mode 100644
index 0000000..d6a296e
--- /dev/null
+++ b/plugins/domain/main.py
@@ -0,0 +1,48 @@
+import json
+import account
+
+
+functions = {
+ "bids": {
+ "name": "Bid info",
+ "type": "domain",
+ "description": "Check when the domain was last updated",
+ "params": {
+ "domain": {
+ "name":"domain to check",
+ "type":"domain"
+ }
+ },
+ "returns": {
+ "highest":
+ {
+ "name": "Highest bid",
+ "type": "text"
+ },
+ "paid":
+ {
+ "name": "Amount paid in auction",
+ "type": "text"
+ }
+ }
+ }
+}
+
+def listFunctions():
+ return functions
+
+def runFunction(function, params, authentication):
+ if function == "bids":
+ return bids(params['domain'], authentication)
+ else:
+ return "Function not found"
+
+
+def bids(domain, authentication):
+ wallet = authentication.split(":")[0]
+ data = account.getDomain(domain)
+ value = str(account.convertHNS(data['info']['value'])) + " HNS"
+ highest = str(account.convertHNS(data['info']['highest'])) + " HNS"
+
+
+ return {"highest": highest,"paid":value}
\ No newline at end of file
diff --git a/render.py b/render.py
index 98d5a91..75a3ae2 100644
--- a/render.py
+++ b/render.py
@@ -196,11 +196,30 @@ def plugin_functions(functions, pluginName):
name = functions[function]['name']
description = functions[function]['description']
params = functions[function]['params']
- returns = functions[function]['returns']
+ returnsRaw = functions[function]['returns']
+
+ returns = ""
+ for output in returnsRaw:
+ returns += f"{returnsRaw[output]['name']}, "
+
+ returns = returns.removesuffix(', ')
+
+ functionType = "manual"
+ if "type" in functions[function]:
+ functionType = functions[function]["type"]
+
+
html += f''
html += f'
'
html += f'
{name}
'
html += f'
{description}
'
+ html += f'
Function type: {functionType.capitalize()}
'
+
+ if functionType != "manual":
+ html += f'
Returns: {returns}
'
+ html += f'
'
+ html += f'
'
+ continue
# Form
html += f'