def get_total_keys(self): ret = eosapi.get_table_rows(True, self.contract_account, self.contract_account, 'global2', '', '', '', 1) if ret['rows']: return ret['rows'][0]['count'] return 0
def get_all_values(self, address): address = normalize_address(address) creator = self.get_creator(address) index = self.get_index(address) # print('+++++index:', creator, index) index = eosapi.n2s(index) ret = eosapi.get_table_rows(True, self.contract_account, index, 'accountstate', '', '', '', 100) return ret['rows']
def get_binded_address(self, account): print('+++get_binded_address', account) ret = eosapi.get_table_rows(True, self.contract_account, self.contract_account, 'addressmap', account, account, account, 1) print(ret) if not ret['rows']: return assert ret['rows'][0]['creator'] == account return ret['rows'][0]['address']
def get_value(self, address, key): address = normalize_address(address) creator = self.get_creator(address) index = self.get_index(address) index = eosapi.n2s(index) ret = eosapi.get_table_rows(True, self.contract_account, index, 'accountstate', '', '', '', 100) for row in ret['rows']: if row['key'] == key: return row['key'] return None
async def test_get_table_rows(self): symbol = eosapi.string_to_symbol(4, 'EOS') symbol_code = symbol >> 8 symbol_code = eosapi.n2s(symbol_code) r = eosapi.get_table_rows(True, 'eosio.token', symbol_code, 'stat', '', '', 10) logger.info(r) assert r['rows'] r = eosapi.get_table_rows(True, 'eosio.token', 'helloworld11', 'accounts', '', '', 10) logger.info(r) assert r['rows'] r = await eosapi_async.get_table_rows(True, 'eosio.token', symbol_code, 'stat', '', '', 10) logger.info(r) assert r['rows'] r = await eosapi_async.get_table_rows(True, 'eosio.token', 'helloworld11', 'accounts', '', '', 10) logger.info(r) assert r['rows']
def get_code_cache(self, address): address = normalize_address(address) row = self.get_address_info(address) if not row: return '' index = row['index'] creator = row['creator'] index = eosapi.n2s(index) ret = eosapi.get_table_rows(False, self.contract_account, creator, 'ethcodecache', index, index, index, 1) if ret['rows']: return ret['rows'][0] return ''
def get_all_address_info(self, json=True): ret = eosapi.get_table_rows(json, self.contract_account, self.contract_account, 'ethaccount', '', '', '', 10000) return ret['rows']
def get_chain_id(self): ret = eosapi.get_table_rows(True, self.contract_account, self.contract_account, 'global', '', '', '', 1) return ret['rows'][0]['chainid']
def get_eth_address_count(self): ret = eosapi.get_table_rows(True, self.contract_account, self.contract_account, 'global', '', '', '', 1) return ret['rows'][0]['count']