File tree Expand file tree Collapse file tree 3 files changed +15
-8
lines changed
Expand file tree Collapse file tree 3 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -182,15 +182,15 @@ def get_block_reward(self, block_number: int):
182182 "value" )[0 ][1 ].get ("U128" ))
183183 return (reward , author , gas_fee )
184184
185- def get_events_by_txn_hash (self ,txn_hash : str ):
185+ def get_events_by_txn_hash (self , txn_hash : str ):
186186 operation = {
187187 "rpc_method" : "chain.get_events_by_txn_hash" ,
188188 "params" : [txn_hash ],
189189 }
190190 ret = self .execute (operation )
191191 return ret
192-
193-
192+
193+
194194class RpcRequest ():
195195 def __init__ (self , url ):
196196 self .setting = {
Original file line number Diff line number Diff line change @@ -321,7 +321,7 @@ def bcs_deserialize(input: bytes) -> 'EventFilter':
321321@dataclass (frozen = True )
322322class EventHandle :
323323 count : st .uint64
324- key : "EventKey"
324+ key : bytes
325325
326326 def bcs_serialize (self ) -> bytes :
327327 return bcs .serialize (self , EventHandle )
@@ -336,7 +336,8 @@ def bcs_deserialize(input: bytes) -> 'EventHandle':
336336
337337@dataclass (frozen = True )
338338class EventKey :
339- value : bytes
339+ salt : st .uint64
340+ address : AccountAddress
340341
341342 def bcs_serialize (self ) -> bytes :
342343 return bcs .serialize (self , EventKey )
Original file line number Diff line number Diff line change 11from starcoin .sdk import client
22from starcoin import starcoin_types
33from starcoin import starcoin_stdlib
4+ from starcoin .sdk import utils
45cli = client .Client ("http://barnard.seed.starcoin.org:9850" )
56
67
@@ -23,6 +24,11 @@ def test_apis():
2324 payload = bytes .fromhex (payload [2 :])
2425 payload = starcoin_types .TransactionPayload .bcs_deserialize (payload )
2526 script = starcoin_stdlib .decode_peer_to_peer_script_function (payload .value )
26- event = cli .get_events_by_txn_hash ("0xc48e82f3f836b7521ccc62d7a4ecd5a80dd4580da8ef75764d7329967c5b14cb" )
27- e = event [0 ]["data" ]
28-
27+ events = cli .get_events_by_txn_hash (
28+ "0xc48e82f3f836b7521ccc62d7a4ecd5a80dd4580da8ef75764d7329967c5b14cb" )
29+ for event in events :
30+ event_key = event ["event_key" ][2 :]
31+ event_key = starcoin_types .EventKey .bcs_deserialize (
32+ bytes .fromhex (event_key ))
33+ add = utils .account_address_hex (event_key .address )
34+ print (add )
You can’t perform that action at this time.
0 commit comments