diff --git a/bindings/python/examples/exchange/4_listen_events.py b/bindings/python/examples/exchange/4_listen_events.py index 6454da71a9..32417a7885 100644 --- a/bindings/python/examples/exchange/4_listen_events.py +++ b/bindings/python/examples/exchange/4_listen_events.py @@ -3,7 +3,7 @@ # This example listens to the NewOutput event. -from iota_sdk import Wallet, SyncOptions +from iota_sdk import Wallet, SyncOptions, WalletEventType from dotenv import load_dotenv import json import os @@ -33,7 +33,7 @@ def callback(event): # Only interested in new outputs here. -wallet.listen(callback, [2]) +wallet.listen(callback, [WalletEventType.NewOutput]) account = wallet.get_account('Alice') diff --git a/bindings/python/iota_sdk/__init__.py b/bindings/python/iota_sdk/__init__.py index 81bbb03609..652a271655 100644 --- a/bindings/python/iota_sdk/__init__.py +++ b/bindings/python/iota_sdk/__init__.py @@ -15,6 +15,7 @@ from .types.block import * from .types.burn import * from .types.common import * +from .types.event import * from .types.feature import * from .types.native_token import * from .types.node_info import * diff --git a/bindings/python/iota_sdk/types/event.py b/bindings/python/iota_sdk/types/event.py new file mode 100644 index 0000000000..93c998abd4 --- /dev/null +++ b/bindings/python/iota_sdk/types/event.py @@ -0,0 +1,12 @@ +# Copyright 2023 IOTA Stiftung +# SPDX-License-Identifier: Apache-2.0 + +from enum import IntEnum + +class WalletEventType(IntEnum): + ConsolidationRequired = 0, + LedgerAddressGeneration = 1, + NewOutput = 2, + SpentOutput = 3, + TransactionInclusion = 4, + TransactionProgress = 5,