Last active
November 3, 2021 21:16
-
-
Save Kygandomi/b15d385a3aea663205fcb7bf3a20523a to your computer and use it in GitHub Desktop.
Chia Password Coin Tutorial 5 Snippet 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
full_node_rpc_client = None | |
wallet_rpc_client = None | |
config = load_config(DEFAULT_ROOT_PATH, "config.yaml") | |
wallet_host = "localhost" | |
wallet_rpc_port = config["wallet"]["rpc_port"] | |
node_rpc_port = config["full_node"]["rpc_port"] | |
async def setup_blockchain_connection(): | |
global full_node_rpc_client, wallet_rpc_client | |
# Should not create new connection if already connected | |
if full_node_rpc_client is not None and wallet_rpc_client is not None: | |
return | |
# Setup the RPC connections | |
full_node_rpc_client = await FullNodeRpcClient.create(wallet_host, node_rpc_port, DEFAULT_ROOT_PATH, config) | |
wallet_rpc_client = await WalletRpcClient.create(wallet_host, wallet_rpc_port, DEFAULT_ROOT_PATH, config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment