Exemplo n.º 1
0
 def __get_last_actions(self, depth: int):
     out = {}
     ce = Cleos(url=eos_endpoint)
     actions = ce.get_actions(self.account, pos=-1, offset=-depth)
     if 'actions' in actions.keys():
         out = actions['actions']
     memos = []
     for s in out:
         receiver = s['action_trace']['receipt']['receiver']
         data = s['action_trace']['act']['data']
         if s['action_trace']['act']['name'] == 'transfer' \
                 and receiver == self.account \
                 and 'to' in data.keys() \
                 and data['to'] == self.account \
                 and 'from' in data.keys() \
                 and 'quantity' in data.keys() \
                 and (data['quantity'].find('EOS') != -1 or data['quantity'].find('KNYGA') != -1):
             data['recv_sequence'] = s['action_trace']['receipt'][
                 'recv_sequence']
             data['account'] = s['action_trace']['act']['account']
             block_n = s['account_action_seq']
             data['block_num'] = block_n
             data['glob_num'] = s['block_num']
             memos.append(data)
     memos.reverse()
     return memos
Exemplo n.º 2
0
 def get_file(self) -> str:
     ce = Cleos(url=eos_endpoint)
     dir_l = self.get_dir()
     if dir_l == {}:
         return ''
     if self.file_name in dir_l.keys():
         head_block = dir_l[self.file_name]
         print(head_block)
         out = {}
         n_block = head_block
         r_data = ''
         while n_block != 0:
             actions = ce.get_actions(self.account, pos=n_block, offset=0)
             if 'actions' in actions.keys():
                 out = actions['actions']
             for s in out:
                 memo_l = (s['action_trace']['act']['data']['memo'])
                 memo_d = json.loads(memo_l)
                 r_data = memo_d['data'] + r_data
                 n_block = memo_d['next_block']
                 print('next_block is: ', n_block)
                 #print(r_data)
         dec_data = self.__decode_str(r_data)
         #print(dec_data)
         fb = open(f'{self.path}/{self.file_name}', 'wb')
         fb.write(dec_data)
         fb.close()
     else:
         return ''
Exemplo n.º 3
0
 def get_last(self):
     out = {}
     ce = Cleos(url=eos_endpoint)
     # actions = ce.get_actions(self.account, pos=-1, offset=-depth)
     actions = ce.get_actions(self.account, pos=6940, offset=1)
     print(actions)
     if 'actions' in actions.keys():
         out = actions['actions']
def get_last_actions():
    out = {}
    ce = Cleos(url=eos_endpoint)
    actions = ce.get_actions(bartender_account, pos=-1, offset=-depth)
    # actions = ce.get_actions('hojwakobvfsa', pos=-1, offset=-1)
    if 'actions' in actions.keys():
        out = actions['actions']
    memos = []
    for s in out:
        receiver = s['action_trace']['receipt']['receiver']
        data = s['action_trace']['act']['data']
        if s['action_trace']['act']['name'] == 'transfer' \
                and receiver == bartender_account \
                and 'to' in data.keys() \
                and data['to'] == bartender_account \
                and 'from' in data.keys() \
                and 'quantity' in data.keys() \
                and (data['quantity'].find('EOS') != -1 or data['quantity'].find('KNYGA') != -1):
            data['recv_sequence'] = s['action_trace']['receipt'][
                'recv_sequence']
            data['account'] = s['action_trace']['act']['account']
            memos.append(data)
    # memos.reverse()
    return memos
Exemplo n.º 5
0
                    action='store',
                    default='https://api.eosnewyork.io',
                    dest='url')
parser.add_argument('--account',
                    '-a',
                    type=str,
                    action='store',
                    required=True,
                    dest='account')
parser.add_argument('--pos', type=int, action='store', default=-1, dest='pos')
parser.add_argument('--offset',
                    type=int,
                    action='store',
                    default=-1000000,
                    dest='offset')
args = parser.parse_args()

# get information
ce = Cleos(url=args.url, version=args.api_version)
#print(ce.get_info())
print('block_time,from,quantity')
actions = ce.get_actions(args.account, args.pos, args.offset)
for act in actions['actions']:
    if act['action_trace']['act']['name'] == 'transfer' and act[
            'action_trace']['act']['account'] == 'eosio.token':
        if act['action_trace']['act']['data']['from'] == 'eosio.vpay' or act[
                'action_trace']['act']['data']['from'] == 'eosio.bpay':
            print(act['block_time'] + ',' +
                  act['action_trace']['act']['data']['from'] + ',' +
                  act['action_trace']['act']['data']['quantity'])