Skip to content

Commit

Permalink
Merge pull request #61 from zsluedem/master
Browse files Browse the repository at this point in the history
transaction with deploy info
  • Loading branch information
zsluedem authored Apr 23, 2020
2 parents a166906 + 8be4372 commit 4fb7d50
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 7 additions & 3 deletions rchain/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .pb.ProposeServiceV1_pb2 import ProposeResponse
from .pb.ProposeServiceV1_pb2_grpc import ProposeServiceStub
from .pb.RhoTypes_pb2 import Expr, GDeployId, GUnforgeable, Par
from .report import Report, Transaction
from .report import Report, Transaction, DeployWithTransaction
from .util import create_deploy_data

GRPC_Response_T = Union[ProposeResponse,
Expand Down Expand Up @@ -202,7 +202,7 @@ def get_event_data(self, block_hash: str) -> EventInfoResponse:
self._check_response(response)
return response

def get_transaction(self, block_hash: str) -> List[Transaction]:
def get_transaction(self, block_hash: str) -> List[DeployWithTransaction]:
if self.param is None:
raise ValueError("You haven't install your network param.")
transactions = []
Expand All @@ -219,7 +219,11 @@ def get_transaction(self, block_hash: str) -> List[Transaction]:
user = deploy.report[1]
refund = deploy.report[2]
report = Report(precharge, user, refund)
transactions.extend(find_transfer_comm(report.user, self.param.transfer_unforgeable))
transactions.append(
DeployWithTransaction(
deploy.deployInfo,
find_transfer_comm(report.user, self.param.transfer_unforgeable))
)
return transactions


Expand Down
9 changes: 7 additions & 2 deletions rchain/report.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from typing import Optional, Tuple
from typing import Optional, Tuple, List

from .pb.DeployServiceCommon_pb2 import SingleReport
from .pb.DeployServiceCommon_pb2 import SingleReport, DeployInfo
from .pb.RhoTypes_pb2 import Par, ParWithRandom


Expand All @@ -18,3 +18,8 @@ class Transaction:
amount: int
ret_unforgeable: Par
success: Optional[Tuple[bool, str]]

@dataclass
class DeployWithTransaction:
deploy_info: DeployInfo
transactions: List[Transaction]

0 comments on commit 4fb7d50

Please sign in to comment.