feat: Add initial code
This commit is contained in:
commit
57cc850e1a
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Tools for using Firewallet with test networks
|
||||||
|
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Add this git repository to custom plugins
|
||||||
|
```
|
||||||
|
https://git.woodburn.au/nathanwoodburn/testing-tools-plugin.git
|
||||||
|
```
|
53
testing.py
Normal file
53
testing.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import json
|
||||||
|
import account
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# Plugin Data
|
||||||
|
info = {
|
||||||
|
"name": "Testing tools",
|
||||||
|
"description": "Testing tools",
|
||||||
|
"version": "1.0",
|
||||||
|
"author": "Nathan.Woodburn/"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Functions
|
||||||
|
functions = {
|
||||||
|
"generate":{
|
||||||
|
"name": "Generate blocks",
|
||||||
|
"type": "default",
|
||||||
|
"description": "Generate blocks to your wallet",
|
||||||
|
"params": {
|
||||||
|
"numblocks": {
|
||||||
|
"name":"Number of blocks to generate",
|
||||||
|
"type":"number"
|
||||||
|
},
|
||||||
|
"address": {
|
||||||
|
"name":"Address to generate to",
|
||||||
|
"type":"text"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"returns": {
|
||||||
|
"status":
|
||||||
|
{
|
||||||
|
"name": "Status of the function",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def generate(params, authentication):
|
||||||
|
# hsd-cli rpc generatetoaddress $numblocks $address
|
||||||
|
number = params["numblocks"]
|
||||||
|
address = params["address"]
|
||||||
|
if number == "" or int(number) < 1:
|
||||||
|
number = 1
|
||||||
|
|
||||||
|
if address == "":
|
||||||
|
wallet = authentication.split(":")[0]
|
||||||
|
address = account.getAddress(wallet)
|
||||||
|
|
||||||
|
print(f"Generating {number} blocks to {address}")
|
||||||
|
blocks = account.hsd.rpc_generateToAddress(address,number)
|
||||||
|
return {"status": f"Successfully generated {number} blocks to {address}"}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user