seperated connect to node python to src
This commit is contained in:
parent
98b8494967
commit
c2bc4ac9b0
@ -2,17 +2,10 @@ from flask import Flask, request, jsonify, render_template
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
|
||||
from src import create_wallet
|
||||
from src import create_wallet, connect_to_node
|
||||
|
||||
app = Flask(__name__, static_folder="static")
|
||||
|
||||
# Function to establish an RPC connection to the Bitcoin node
|
||||
def connect_to_node(rpc_host, rpc_port, rpc_user, rpc_password):
|
||||
rpc_connection = AuthServiceProxy(
|
||||
f"http://{rpc_user}:{rpc_password}@{rpc_host}:{rpc_port}"
|
||||
)
|
||||
return rpc_connection
|
||||
|
||||
@app.route("/")
|
||||
def show_wallet_form():
|
||||
return render_template("index.html")
|
||||
|
@ -1,4 +1,5 @@
|
||||
from .create_wallet import create_wallet
|
||||
from .connect_to_node import connect_to_node
|
||||
|
||||
|
||||
__all__ = ["create_wallet",]
|
||||
__all__ = ["create_wallet", "connect_to_node"]
|
||||
|
9
app/src/connect_to_node.py
Normal file
9
app/src/connect_to_node.py
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
|
||||
|
||||
# Function to establish an RPC connection to the Elements node
|
||||
def connect_to_node(rpc_host, rpc_port, rpc_user, rpc_password):
|
||||
rpc_connection = AuthServiceProxy(
|
||||
f"http://{rpc_user}:{rpc_password}@{rpc_host}:{rpc_port}"
|
||||
)
|
||||
return rpc_connection
|
Loading…
Reference in New Issue
Block a user