import json import account import requests # Plugin Data info = { "name": "Custom Exporter", "description": "Export info about your wallet with more control", "version": "1.0", "author": "Nathan.Woodburn/" } # Functions functions = { "domainExport":{ "name": "Export domain info", "type": "default", "description": "Use custom format to export domain data
Options are: name, expiry, value, maxBid, state, expiryBlock, openHeight", "params": { "format": { "name": "Format", "type": "text", } }, "returns": { "status": { "name": "Status of the function", "type": "text" } } }, "transactionExport":{ "name": "Export transaction info", "type": "default", "description": "Use custom format to export transaction data
Options are: hash,height,time,mtime,date,mdate,size,virtualSize,fee,rate,confirmations", "params": { "format": { "name": "Format", "type": "text", } }, "returns": { "status": { "name": "Status of the function", "type": "text" } } } } def domainExport(params, authentication): format = params["format"] format = format.split(',') formatStr = "" for item in format: formatStr += "{" + item.strip() + "}," formatStr = formatStr.removesuffix(",") report = account.generateReport(authentication.split(":")[0],formatStr) with open("user_data/report.csv", "w") as f: f.write("\n".join(report)) return {"status": "Success saved in user_data"} def transactionExport(params, authentication): format = params["format"] report = format format = format.split(',') format = [item.strip() for item in format] transactions = account.getAllTransactions(authentication.split(":")[0]) for tx in transactions: for item in format: if item in tx: if item == "outputs" or item == "inputs": # Escape to make sure it doesn't break the csv continue else: report += f"{tx[item]}," else: report += f"{item}," report.removesuffix(",") report += "\n" with open("user_data/report.csv", "w") as f: f.write(report) return {"status": "Success saved in user_data"}