Skip to content

Commit

Permalink
add MessageToJson method to convert grpc data
Browse files Browse the repository at this point in the history
  • Loading branch information
ink-web3 committed Apr 9, 2024
1 parent 49a2aea commit df19140
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/l3staking/api_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import json
import logging
from google.protobuf.json_format import MessageToJson

from common.helpers import ok_json, error_json
from l3staking.models import (
Expand Down Expand Up @@ -88,7 +89,8 @@ def get_l2_stake_record(request):
page_size=page_size
)
logger.debug(l2_stake_record)
return ok_json(l2_stake_record.page)
serialized = MessageToJson(l2_stake_record)
return ok_json(serialized.page)


# @check_api_token
Expand All @@ -106,4 +108,5 @@ def get_l2_unstake_record(request):
page_size=page_size
)
logger.debug(l2_unstake_record)
return ok_json(l2_unstake_record.page)
serialized = MessageToJson(l2_unstake_record)
return ok_json(serialized.page)

0 comments on commit df19140

Please sign in to comment.