firewalletbrowser/plugins/domain/main.py
Nathan Woodburn 78eae529e5
All checks were successful
Build Docker / Build Image (push) Successful in 31s
feat: Add initial domain plugins
2024-02-05 22:40:13 +11:00

48 lines
1.1 KiB
Python

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}