@@ -61,20 +61,21 @@ def __init__(
6161 credentials : grpc .ChannelCredentials = None ,
6262 ):
6363
64- creds = None
6564 # load root CA cert
6665 if not insecure :
6766 if network .env == 'testnet' :
68- with open (os .path .join (os .path .dirname (__file__ ), 'cert/testnet.crt' ), 'rb' ) as f :
69- creds = grpc .ssl_channel_credentials (f .read ())
67+ if credentials is None :
68+ with open (os .path .join (os .path .dirname (__file__ ), 'cert/testnet.crt' ), 'rb' ) as f :
69+ credentials = grpc .ssl_channel_credentials (f .read ())
7070 if network .env == 'mainnet' :
71- with open (os .path .join (os .path .dirname (__file__ ), 'cert/mainnet.crt' ), 'rb' ) as f :
72- creds = grpc .ssl_channel_credentials (f .read ())
71+ if credentials is None :
72+ with open (os .path .join (os .path .dirname (__file__ ), 'cert/mainnet.crt' ), 'rb' ) as f :
73+ credentials = grpc .ssl_channel_credentials (f .read ())
7374
7475 # chain stubs
7576 self .chain_channel = (
7677 grpc .aio .insecure_channel (network .grpc_endpoint )
77- if insecure else grpc .aio .secure_channel (network .grpc_endpoint , creds )
78+ if insecure else grpc .aio .secure_channel (network .grpc_endpoint , credentials )
7879 )
7980 self .stubCosmosTendermint = tendermint_query_grpc .ServiceStub (self .chain_channel )
8081 self .stubAuth = auth_query_grpc .QueryStub (self .chain_channel )
@@ -84,7 +85,7 @@ def __init__(
8485 # exchange stubs
8586 self .exchange_channel = (
8687 grpc .aio .insecure_channel (network .grpc_exchange_endpoint )
87- if insecure else grpc .aio .secure_channel (network .grpc_exchange_endpoint , creds )
88+ if insecure else grpc .aio .secure_channel (network .grpc_exchange_endpoint , credentials )
8889 )
8990 self .stubMeta = exchange_meta_rpc_grpc .InjectiveMetaRPCStub (self .exchange_channel )
9091 self .stubExchangeAccount = exchange_accounts_rpc_grpc .InjectiveAccountsRPCStub (self .exchange_channel )
0 commit comments