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

Method get_network_code_by_network_url

python/ccxt/binance.py:11476–11491  ·  view source on GitHub ↗
(self, currencyCode: str, depositUrl: Str = None)

Source from the content-addressed store, hash-verified

11474 return self.safe_string(ledgerType, type, type)
11475
11476 def get_network_code_by_network_url(self, currencyCode: str, depositUrl: Str = None) -> Str:
11477 # depositUrl is like : https://bscscan.com/address/0xEF238AB229342849..
11478 if depositUrl is None:
11479 return None
11480 networkCode = None
11481 currency = self.currency(currencyCode)
11482 networks = self.safe_dict(currency, 'networks', {})
11483 networkCodes = list(networks.keys())
11484 for i in range(0, len(networkCodes)):
11485 currentNetworkCode = networkCodes[i]
11486 info = self.safe_dict(networks[currentNetworkCode], 'info', {})
11487 siteUrl = self.safe_string(info, 'contractAddressUrl')
11488 # check if url matches the field's value
11489 if siteUrl is not None and depositUrl.startswith(self.get_base_domain_from_url(siteUrl)):
11490 networkCode = currentNetworkCode
11491 return networkCode
11492
11493 def get_base_domain_from_url(self, url: Str) -> Str:
11494 if url is None:

Callers 1

parse_deposit_addressMethod · 0.95

Calls 5

safe_dictMethod · 0.80
safe_stringMethod · 0.80
rangeFunction · 0.50
currencyMethod · 0.45

Tested by

no test coverage detected