11# flake8: noqa: E501
2- from typing import Optional
3-
42from sidan_gin import HDWallet
53
6- from deltadefi .api_resources .api_config import ApiConfig
74from deltadefi .api_resources .auth import ApiHeaders
85from deltadefi .clients .accounts import Accounts
96from deltadefi .clients .markets import Markets
@@ -19,9 +16,11 @@ class ApiClient:
1916
2017 def __init__ (
2118 self ,
22- config : ApiConfig ,
23- wallet : HDWallet ,
24- base_url : Optional [str ] = None ,
19+ network : str = "preprod" ,
20+ jwt : str = None ,
21+ api_key : str = None ,
22+ wallet : HDWallet = None ,
23+ base_url : str = None ,
2524 ):
2625 """
2726 Initialize the ApiClient.
@@ -36,18 +35,20 @@ def __init__(
3635 "Content-Type" : "application/json" ,
3736 }
3837
39- if config .get ("network" ):
40- self .network_id = 1 if config ["network" ] == "mainnet" else 0
41- base_url = (
42- "https://api-dev.deltadefi.io"
43- if config ["network" ] == "mainnet"
44- else "https://api-dev.deltadefi.io" # TODO: input production link once available
45- )
46- if config .get ("jwt" ):
47- headers ["Authorization" ] = config ["jwt" ]
48- if config .get ("apiKey" ):
49- headers ["X-API-KEY" ] = config ["apiKey" ]
50- if config .get ("signingKey" ):
38+ if network == "mainnet" :
39+ self .network_id = 1
40+ base_url = "https://api-dev.deltadefi.io" # TODO: input production link once available
41+ else :
42+ self .network_id = 0
43+ base_url = "https://api-dev.deltadefi.io"
44+
45+ if jwt is not None :
46+ headers ["Authorization" ] = jwt
47+
48+ if api_key is not None :
49+ headers ["X-API-KEY" ] = api_key
50+
51+ if wallet is not None :
5152 self .wallet = wallet .signing_key
5253
5354 self .accounts = Accounts (self )
0 commit comments