-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guoshijiang
authored and
guoshijiang
committed
Apr 7, 2024
1 parent
764b30a
commit 95f3deb
Showing
8 changed files
with
530 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.1.1 on 2024-04-01 11:59 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('l3staking', '0004_stakingchain_icon'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='node', | ||
name='detail', | ||
field=models.CharField(default='unknown', max_length=500, verbose_name='节点详情'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# encoding=utf-8 | ||
|
||
import grpc | ||
from django.conf import settings | ||
from services.savour_rpc import appchain_pb2_grpc, appchain_pb2 | ||
|
||
|
||
class AppChainClient: | ||
def __init__(self): | ||
options = [ | ||
('grpc.max_receive_message_length', settings.GRPC_MAX_MESSAGE_LENGTH), | ||
] | ||
channel = grpc.insecure_channel("acorus-rpc.testnet.dapplink.xyz:443", options=options) | ||
self.stub = appchain_pb2_grpc.AppChainServiceStub(channel) | ||
|
||
def l1_staker_reward_amount(self, chain_id: str, staker_address: str, strategies: str, consumer_token: str = None) -> appchain_pb2.L1StakerRewardsAmountResponse: | ||
return self.stub.L1StakerRewardsAmount( | ||
appchain_pb2.L1StakerRewardsAmountRequest( | ||
chain_id=chain_id, | ||
staker_address=staker_address, | ||
strategies=strategies | ||
) | ||
) | ||
|
||
def l2_staker_reward_amount(self, chain_id: str, staker_address: str, strategy: str, consumer_token: str = None) -> appchain_pb2.L2StakerRewardsAmountResponse: | ||
return self.stub.L2StakerRewardsAmount( | ||
appchain_pb2.L2StakerRewardsAmountRequest( | ||
chain_id=chain_id, | ||
staker_address=staker_address, | ||
strategy=strategy | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generated by the Protocol Buffers compiler. DO NOT EDIT! | ||
# source: savour_rpc/appchain.proto | ||
# plugin: grpclib.plugin.main | ||
import abc | ||
import typing | ||
|
||
import grpclib.const | ||
import grpclib.client | ||
if typing.TYPE_CHECKING: | ||
import grpclib.server | ||
|
||
from services.savour_rpc import appchain_pb2 | ||
|
||
|
||
class AppChainServiceBase(abc.ABC): | ||
|
||
@abc.abstractmethod | ||
async def L1StakerRewardsAmount(self, stream: 'grpclib.server.Stream[appchain_pb2.L1StakerRewardsAmountRequest, savour_rpc.appchain_pb2.L1StakerRewardsAmountResponse]') -> None: | ||
pass | ||
|
||
@abc.abstractmethod | ||
async def L2StakerRewardsAmount(self, stream: 'grpclib.server.Stream[appchain_pb2.L2StakerRewardsAmountRequest, savour_rpc.appchain_pb2.L2StakerRewardsAmountResponse]') -> None: | ||
pass | ||
|
||
def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]: | ||
return { | ||
'/services.savour_rpc.appchain.AppChainService/L1StakerRewardsAmount': grpclib.const.Handler( | ||
self.L1StakerRewardsAmount, | ||
grpclib.const.Cardinality.UNARY_UNARY, | ||
appchain_pb2.L1StakerRewardsAmountRequest, | ||
appchain_pb2.L1StakerRewardsAmountResponse, | ||
), | ||
'/services.savour_rpc.appchain.AppChainService/L2StakerRewardsAmount': grpclib.const.Handler( | ||
self.L2StakerRewardsAmount, | ||
grpclib.const.Cardinality.UNARY_UNARY, | ||
appchain_pb2.L2StakerRewardsAmountRequest, | ||
appchain_pb2.L2StakerRewardsAmountResponse, | ||
), | ||
} | ||
|
||
|
||
class AppChainServiceStub: | ||
|
||
def __init__(self, channel: grpclib.client.Channel) -> None: | ||
self.L1StakerRewardsAmount = grpclib.client.UnaryUnaryMethod( | ||
channel, | ||
'/services.savour_rpc.appchain.AppChainService/L1StakerRewardsAmount', | ||
appchain_pb2.L1StakerRewardsAmountRequest, | ||
appchain_pb2.L1StakerRewardsAmountResponse, | ||
) | ||
self.L2StakerRewardsAmount = grpclib.client.UnaryUnaryMethod( | ||
channel, | ||
'/services.savour_rpc.appchain.AppChainService/L2StakerRewardsAmount', | ||
appchain_pb2.L2StakerRewardsAmountRequest, | ||
appchain_pb2.L2StakerRewardsAmountResponse, | ||
) |
Oops, something went wrong.