MCPcopy Create free account
hub / github.com/ccxt/ccxt / load_account

Method load_account

python/ccxt/lighter.py:385–409  ·  view source on GitHub ↗
(self, chainId, privateKey, apiKeyIndex: str, accountIndex: str, params={})

Source from the content-addressed store, hash-verified

383 })
384
385 def load_account(self, chainId, privateKey, apiKeyIndex: str, accountIndex: str, params={}):
386 self.init_auth_object(accountIndex, apiKeyIndex)
387 cachedAuths = self.safe_dict(self.options['auths'][accountIndex], apiKeyIndex)
388 signer = self.safe_value(cachedAuths, 'signer')
389 if signer is not None:
390 return signer
391 libraryPath = None
392 libraryPath, params = self.handle_option_and_params(params, 'loadAccount', 'libraryPath')
393 lighterPrivateKeyIsSet = (privateKey is not None) and (privateKey != '')
394 if lighterPrivateKeyIsSet and (libraryPath is not None) and (apiKeyIndex is not None) and (accountIndex is not None):
395 # load lighter library, and create lighter client
396 signer = self.load_lighter_library(libraryPath, chainId, privateKey, self.parse_to_int(apiKeyIndex), self.parse_to_int(accountIndex), True)
397 self.options['auths'][accountIndex][apiKeyIndex]['signer'] = signer
398 return signer
399 privateKeyIsSet = (self.privateKey is not None) and (self.privateKey != '')
400 if privateKeyIsSet and (apiKeyIndex is not None) and (accountIndex is not None):
401 if len(self.privateKey) > 66:
402 raise NotSupported(self.id + ' after the latest update(v4.5.50), CCXT now expects the l1 private key to be provided in the credentials. Please check for more details: https://github.com/ccxt/ccxt/wiki/FAQ#how-to-use-the-lighter-exchange-in-ccxt')
403 # load lighter library without creating lighter client
404 signer = self.load_lighter_library(libraryPath, chainId, '', self.parse_to_int(apiKeyIndex), self.parse_to_int(accountIndex), False)
405 self.options['auths'][accountIndex][apiKeyIndex]['signer'] = signer
406 res = self.change_api_key()
407 self.handle_builder_fee_approval(self.parse_to_int(accountIndex), self.parse_to_int(apiKeyIndex))
408 return res
409 return signer
410
411 def init_auth_object(self, strAccountIndex: str, strApiKeyIndex: str):
412 if not ('auths' in self.options):

Callers 15

create_sub_accountMethod · 0.95
approve_builder_feeMethod · 0.95
create_orderMethod · 0.95
edit_orderMethod · 0.95
fetch_open_ordersMethod · 0.95
fetch_closed_ordersMethod · 0.95
transferMethod · 0.95
fetch_transfersMethod · 0.95
fetch_depositsMethod · 0.95
fetch_withdrawalsMethod · 0.95
withdrawMethod · 0.95

Calls 9

init_auth_objectMethod · 0.95
change_api_keyMethod · 0.95
NotSupportedClass · 0.90
safe_dictMethod · 0.80
safe_valueMethod · 0.80
parse_to_intMethod · 0.80
load_lighter_libraryMethod · 0.45

Tested by

no test coverage detected