File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -115,3 +115,20 @@ async def test_fully_exhaust_query_map():
115
115
fully_exhausted_records_count += 1
116
116
assert fully_exhausted_records_count == initial_records_count_fully_exhaust
117
117
assert initial_records_count_fully_exhaust == exhausted_records_count
118
+
119
+
120
+ @pytest .mark .asyncio
121
+ async def test_get_events_proper_decoding ():
122
+ # known block/hash pair that has the events we seek to decode
123
+ block = 5846788
124
+ block_hash = "0x0a1c45063a59b934bfee827caa25385e60d5ec1fd8566a58b5cc4affc4eec412"
125
+
126
+ async with AsyncSubstrateInterface (ARCHIVE_ENTRYPOINT ) as substrate :
127
+ all_events = await substrate .get_events (block_hash = block_hash )
128
+ event = all_events [1 ]
129
+ print (type (event ["attributes" ]))
130
+ assert event ["attributes" ] == (
131
+ "5G1NjW9YhXLadMWajvTkfcJy6up3yH2q1YzMXDTi6ijanChe" ,
132
+ 30 ,
133
+ "0xa6b4e5c8241d60ece0c25056b19f7d21ae845269fc771ad46bf3e011865129a5" ,
134
+ )
Original file line number Diff line number Diff line change @@ -68,3 +68,19 @@ def test_ss58_conversion():
68
68
if len (value .value ) > 0 :
69
69
for decoded_key in value .value :
70
70
assert isinstance (decoded_key , str )
71
+
72
+
73
+ def test_get_events_proper_decoding ():
74
+ # known block/hash pair that has the events we seek to decode
75
+ block = 5846788
76
+ block_hash = "0x0a1c45063a59b934bfee827caa25385e60d5ec1fd8566a58b5cc4affc4eec412"
77
+
78
+ with SubstrateInterface (ARCHIVE_ENTRYPOINT ) as substrate :
79
+ all_events = substrate .get_events (block_hash = block_hash )
80
+ event = all_events [1 ]
81
+ print (type (event ["attributes" ]))
82
+ assert event ["attributes" ] == (
83
+ "5G1NjW9YhXLadMWajvTkfcJy6up3yH2q1YzMXDTi6ijanChe" ,
84
+ 30 ,
85
+ "0xa6b4e5c8241d60ece0c25056b19f7d21ae845269fc771ad46bf3e011865129a5" ,
86
+ )
You can’t perform that action at this time.
0 commit comments