def deactivate(self, address):
     validate_address(address)
     res = requests.delete(base('ethereum-scaffolds/' + address),
                           headers=merge_headers(
                               [CONTENT_JSON, self.headers]))
     raise_for_error(res)
     return res.json()
 def get_transactions(self, address):
     validate_address(address)
     res = requests.get(base('ethereum-scaffolds/' + address +
                             '/transactions'),
                        headers=self.headers)
     raise_for_error(res)
     return res.json()
 def update(self, address, holder_address, data):
     validate_address(address)
     res = requests.put(base('ethereum-scaffolds/' + address + '/holders/' +
                             holder_address),
                        json=data,
                        headers=merge_headers([CONTENT_JSON, self.headers]))
     raise_for_error(res)
     return res.json()
 def set_webhook(self, address, data):
     validate_address(address)
     res = requests.patch(base('ethereum-scaffolds/' + address),
                          json=data,
                          headers=merge_headers(
                              [CONTENT_JSON, self.headers]))
     raise_for_error(res)
     return res.json()
Exemplo n.º 5
0
 def test_address_validation(self):
     address = 'address'
     # validation should raise AttributeError. Address should start with '0x'
     with self.assertRaises(AttributeError):
         validate_address(address)
     address = '0xNotEnoughLength'
     # validation should raise AttributeError. Address should be 42 characters long
     with self.assertRaises(AttributeError):
         validate_address(address)
     # valid address should pass
     validate_address(valid_address)
 def get_single(self, address):
     validate_address(address)
     res = requests.get(base('ethereum-scaffolds/' + address),
                        headers=self.headers)
     raise_for_error(res)
     return res.json()