def __init__(self,
                 blockchain="neo",
                 contract_version='V3',
                 api_url='https://test-api.switcheo.network/',
                 api_version='/v2'):
        """

        :param blockchain: Choose which blockchain to trade on.  Allowed value are neo (future eth and qtum)
        :type blockchain: str
        :param api_url: The URL for the Switcheo API endpoint.
        :type api_url: str
        :param api_version: Choose the version of the Switcho API to use.
        :type api_version: str
        """
        self.request = Request(api_url=api_url,
                               api_version=api_version,
                               timeout=30)
        self.blockchain = blockchain
        self.blockchain_key = blockchain.upper()
        self.contracts = self.get_contracts()
        self.contract_version = contract_version.upper()
        self.contract_hash = self.contracts[self.blockchain_key][
            self.contract_version]
        self.current_contract_hash = current_contract_hash(
            self.contracts)[self.blockchain_key]
 def test_current_contract_hash(self):
     pc = PublicClient()
     expected_current_contract_dict = {
         'NEO': 'a195c1549e7da61b8da315765a790ac7e7633b82',
         'ETH': '0x607af5164d95bd293dbe2b994c7d8aef6bec03bf'
     }
     self.assertDictEqual(current_contract_hash(pc.contracts),
                          expected_current_contract_dict)
 def test_current_contract_hash(self):
     pc = PublicClient()
     expected_current_contract_dict = {
         'NEO': '58efbb3cca7f436a55b1a05c0f36788d2d9a032e',
         'ETH': '0x4d19fd42e780d56ff6464fe9e7d5158aee3d125d',
         'QTUM': 'fake_qtum_contract_hash',
         'EOS': 'toweredbyob2'
     }
     self.assertDictEqual(current_contract_hash(pc.contracts),
                          expected_current_contract_dict)
 def test_current_contract_hash(self):
     pc = PublicClient()
     expected_current_contract_dict = {
         'NEO': '58efbb3cca7f436a55b1a05c0f36788d2d9a032e',
         'ETH': '0x4dcf0244742e72309666db20d367f6dd196e884e',
         'QTUM': '0x2b25406b0000c3661e9c88890690fd4b5c7b4234',
         'EOS': 'oboluswitch4'
     }
     self.assertDictEqual(current_contract_hash(pc.contracts),
                          expected_current_contract_dict)
 def balance_current_contract(self, *addresses):
     address_list = []
     contract_dict = {}
     for address in addresses:
         address_list.append(
             neo_get_scripthash_from_address(address=address))
     current_contract = current_contract_hash(self.contracts)
     for chain in current_contract.keys():
         contract_dict[chain] =\
             self.get_balance(addresses=address_list, contracts=current_contract[chain])
     return contract_dict