From 31e3a91497c41d3b4653c2637046a4d763aed906 Mon Sep 17 00:00:00 2001 From: oceans404 Date: Mon, 19 Aug 2024 12:15:54 -0700 Subject: [PATCH 1/3] use bootnodes parameter if provided --- nillion_python_helpers/client.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nillion_python_helpers/client.py b/nillion_python_helpers/client.py index 88e9a68..83b50d0 100644 --- a/nillion_python_helpers/client.py +++ b/nillion_python_helpers/client.py @@ -3,19 +3,22 @@ import py_nillion_client as nillion -def create_nillion_client(userkey, nodekey): +def create_nillion_client(userkey, nodekey, bootnodes=None): """ Creates and initializes a Nillion client. Args: userkey: The user key for the Nillion client. nodekey: The node key for the Nillion client. + bootnodes: Optional; a list of bootnode addresses. Defaults to the value of + the "NILLION_BOOTNODE_MULTIADDRESS" environment variable. Returns: nillion.NillionClient: The initialized Nillion client instance. """ - bootnodes = [os.getenv("NILLION_BOOTNODE_MULTIADDRESS")] + if bootnodes is None: + bootnodes = [os.getenv("NILLION_BOOTNODE_MULTIADDRESS")] return nillion.NillionClient( nodekey, bootnodes, nillion.ConnectionMode.relay(), userkey - ) + ) \ No newline at end of file From 36c0e8d9da2e18fcfb1b77688172e2b6b0ddb062 Mon Sep 17 00:00:00 2001 From: oceans404 Date: Mon, 19 Aug 2024 12:22:51 -0700 Subject: [PATCH 2/3] linting fix --- nillion_python_helpers/client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nillion_python_helpers/client.py b/nillion_python_helpers/client.py index 83b50d0..2e4a14f 100644 --- a/nillion_python_helpers/client.py +++ b/nillion_python_helpers/client.py @@ -1,8 +1,6 @@ import os - import py_nillion_client as nillion - def create_nillion_client(userkey, nodekey, bootnodes=None): """ Creates and initializes a Nillion client. @@ -20,5 +18,8 @@ def create_nillion_client(userkey, nodekey, bootnodes=None): bootnodes = [os.getenv("NILLION_BOOTNODE_MULTIADDRESS")] return nillion.NillionClient( - nodekey, bootnodes, nillion.ConnectionMode.relay(), userkey + nodekey, + bootnodes, + nillion.ConnectionMode.relay(), + userkey, ) \ No newline at end of file From 1b33a372f4da45f3bb8f194b6af81f9466b08ca3 Mon Sep 17 00:00:00 2001 From: oceans404 Date: Mon, 19 Aug 2024 16:38:21 -0700 Subject: [PATCH 3/3] fix formatting --- nillion_python_helpers/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nillion_python_helpers/client.py b/nillion_python_helpers/client.py index 2e4a14f..bbac280 100644 --- a/nillion_python_helpers/client.py +++ b/nillion_python_helpers/client.py @@ -1,6 +1,7 @@ import os import py_nillion_client as nillion + def create_nillion_client(userkey, nodekey, bootnodes=None): """ Creates and initializes a Nillion client. @@ -8,7 +9,7 @@ def create_nillion_client(userkey, nodekey, bootnodes=None): Args: userkey: The user key for the Nillion client. nodekey: The node key for the Nillion client. - bootnodes: Optional; a list of bootnode addresses. Defaults to the value of + bootnodes: Optional; a list of bootnode addresses. Defaults to the value of the "NILLION_BOOTNODE_MULTIADDRESS" environment variable. Returns: @@ -22,4 +23,4 @@ def create_nillion_client(userkey, nodekey, bootnodes=None): bootnodes, nillion.ConnectionMode.relay(), userkey, - ) \ No newline at end of file + )