From 136bad10cf856bb1473fdd8d0f080428f9e8de00 Mon Sep 17 00:00:00 2001 From: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:55:44 +0200 Subject: [PATCH] Add WalletEventType (#762) --- bindings/python/examples/exchange/4_listen_events.py | 4 ++-- bindings/python/iota_sdk/__init__.py | 1 + bindings/python/iota_sdk/types/event.py | 12 ++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 bindings/python/iota_sdk/types/event.py 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,