async def get_wallet_action(self, id: int) -> Optional[WalletAction]: """ Return a wallet action by id """ cursor = await self.db_connection.execute( "SELECT * from action_queue WHERE id=?", (id, )) row = await cursor.fetchone() await cursor.close() if row is None: return None return WalletAction(row[0], row[1], row[2], WalletType(row[3]), row[4], bool(row[5]), row[6])
async def get_all_pending_actions(self) -> List[WalletAction]: """ Returns list of all pending action """ result: List[WalletAction] = [] cursor = await self.db_connection.execute( "SELECT * from action_queue WHERE done=?", (0, )) rows = await cursor.fetchall() await cursor.close() if rows is None: return result for row in rows: action = WalletAction(row[0], row[1], row[2], WalletType(row[3]), row[4], bool(row[5]), row[6]) result.append(action) return result