@@ -1108,43 +1108,47 @@ For example:
1108
1108
myContract = web3.eth.contract(address = contract_address, abi = contract_abi)
1109
1109
tx_hash = myContract.functions.myFunction().transact()
1110
1110
receipt = web3.eth.get_transaction_receipt(tx_hash)
1111
- myContract.events.myEvent ().process_receipt(receipt)
1111
+ myContract.events.MyEvent ().process_receipt(receipt)
1112
1112
1113
1113
.. py :class :: ContractEvent
1114
1114
1115
1115
Attributes
1116
1116
~~~~~~~~~~
1117
1117
1118
- The :py:class: `ContractEvent ` class provides attributes for each event. Access the event attributes through `Contract.events.myEvent `.
1118
+ The :py:class: `ContractEvent ` class provides attributes for each event. Access the event attributes through `Contract.events.MyEvent `.
1119
1119
1120
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).abi_element_identifier
1120
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).abi_element_identifier
1121
1121
1122
1122
The signature of the event assigned to the class ``__name__ `` during initialization.
1123
1123
1124
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).name
1124
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).name
1125
1125
1126
1126
A string representing the event, receive or fallback name.
1127
1127
1128
- Use :py:attr: `ContractEvent.myEvent (*args, **kwargs).signature ` when the event arguments are needed.
1128
+ Use :py:attr: `ContractEvent.MyEvent (*args, **kwargs).signature ` when the event arguments are needed.
1129
1129
1130
- This is an alias of :py:attr: `ContractEvent.myEvent (*args, **kwargs).event_name `.
1130
+ This is an alias of :py:attr: `ContractEvent.MyEvent (*args, **kwargs).event_name `.
1131
1131
1132
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).signature
1132
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).signature
1133
1133
1134
1134
A string representing the event signature.
1135
1135
1136
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).abi
1136
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).abi
1137
1137
1138
1138
The event ABI with the type, name, inputs.
1139
1139
1140
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).argument_names
1140
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).argument_names
1141
1141
1142
1142
The event input names.
1143
1143
1144
- .. py :attribute :: ContractEvent.myEvent (* args, ** kwargs).argument_types
1144
+ .. py :attribute :: ContractEvent.MyEvent (* args, ** kwargs).argument_types
1145
1145
1146
1146
The event input types.
1147
1147
1148
+ .. py :attribute :: ContractEvent.MyEvent(* args, ** kwargs).topic
1149
+
1150
+ The event topic represented by a hex encoded string from the keccak signature.
1151
+
1148
1152
Methods
1149
1153
~~~~~~~
1150
1154
@@ -1172,9 +1176,9 @@ Methods
1172
1176
1173
1177
my_contract = web3.eth.contract(address = contract_address, abi = contract_abi)
1174
1178
1175
- # get ``myEvent `` logs from block 1337 to block 2337 where the value for the
1179
+ # get ``MyEvent `` logs from block 1337 to block 2337 where the value for the
1176
1180
# event argument "eventArg1" is either 1, 2, or 3
1177
- my_contract.events.myEvent ().get_logs(
1181
+ my_contract.events.MyEvent ().get_logs(
1178
1182
argument_filters = {" eventArg1" : [1 , 2 , 3 ]},
1179
1183
from_block = 1337 ,
1180
1184
to_block = 2337 ,
@@ -1187,14 +1191,14 @@ Methods
1187
1191
1188
1192
Extracts the pertinent logs from a transaction receipt.
1189
1193
1190
- If there are no errors, ``process_receipt `` returns a tuple of :ref: `Event Log Objects <event-log-object >`, emitted from the event (e.g. ``myEvent ``),
1194
+ If there are no errors, ``process_receipt `` returns a tuple of :ref: `Event Log Objects <event-log-object >`, emitted from the event (e.g. ``MyEvent ``),
1191
1195
with decoded output.
1192
1196
1193
1197
.. code-block :: python
1194
1198
1195
1199
>> > tx_hash = contract.functions.myFunction(12345 ).transact({' to' :contract_address})
1196
1200
>> > tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
1197
- >> > rich_logs = contract.events.myEvent ().process_receipt(tx_receipt)
1201
+ >> > rich_logs = contract.events.MyEvent ().process_receipt(tx_receipt)
1198
1202
>> > rich_logs[0 ][' args' ]
1199
1203
{' myArg' : 12345 }
1200
1204
@@ -1211,12 +1215,12 @@ Methods
1211
1215
1212
1216
>> > tx_hash = contract.functions.myFunction(12345 ).transact({' to' :contract_address})
1213
1217
>> > tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
1214
- >> > processed_logs = contract.events.myEvent ().process_receipt(tx_receipt)
1218
+ >> > processed_logs = contract.events.MyEvent ().process_receipt(tx_receipt)
1215
1219
>> > processed_logs
1216
1220
(
1217
1221
AttributeDict({
1218
1222
' args' : AttributeDict({}),
1219
- ' event' : ' myEvent ' ,
1223
+ ' event' : ' MyEvent ' ,
1220
1224
' logIndex' : 0 ,
1221
1225
' transactionIndex' : 0 ,
1222
1226
' transactionHash' : HexBytes(' 0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa' ),
@@ -1229,7 +1233,7 @@ Methods
1229
1233
1230
1234
# Or, if there were errors encountered during processing:
1231
1235
>> > from web3.logs import STRICT , IGNORE , DISCARD , WARN
1232
- >> > processed_logs = contract.events.myEvent ().process_receipt(tx_receipt, errors = IGNORE )
1236
+ >> > processed_logs = contract.events.MyEvent ().process_receipt(tx_receipt, errors = IGNORE )
1233
1237
>> > processed_logs
1234
1238
(
1235
1239
AttributeDict({
@@ -1247,7 +1251,7 @@ Methods
1247
1251
' errors' : LogTopicError(' Expected 1 log topics. Got 0' )})
1248
1252
})
1249
1253
)
1250
- >> > processed_logs = contract.events.myEvent ().process_receipt(tx_receipt, errors = DISCARD )
1254
+ >> > processed_logs = contract.events.MyEvent ().process_receipt(tx_receipt, errors = DISCARD )
1251
1255
>> > assert processed_logs == ()
1252
1256
True
1253
1257
@@ -1261,11 +1265,11 @@ Methods
1261
1265
>> > tx_hash = contract.functions.myFunction(12345 ).transact({' to' :contract_address})
1262
1266
>> > tx_receipt = w3.eth.get_transaction_receipt(tx_hash)
1263
1267
>> > log_to_process = tx_receipt[' logs' ][0 ]
1264
- >> > processed_log = contract.events.myEvent ().process_log(log_to_process)
1268
+ >> > processed_log = contract.events.MyEvent ().process_log(log_to_process)
1265
1269
>> > processed_log
1266
1270
AttributeDict({
1267
1271
' args' : AttributeDict({}),
1268
- ' event' : ' myEvent ' ,
1272
+ ' event' : ' MyEvent ' ,
1269
1273
' logIndex' : 0 ,
1270
1274
' transactionIndex' : 0 ,
1271
1275
' transactionHash' : HexBytes(' 0xfb95ccb6ab39e19821fb339dee33e7afe2545527725b61c64490a5613f8d11fa' ),
0 commit comments