Skip to content

Commit

Permalink
Python: add BlockIssuanceCreditContextInput (#1193)
Browse files Browse the repository at this point in the history
* Python: add BlockIssuanceCreditInput, fixes

* Add ContextInput base class
  • Loading branch information
Thoralf-M authored Sep 11, 2023
1 parent e0af5a5 commit e39e3bc
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions bindings/python/iota_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .types.burn import *
from .types.client_options import *
from .types.common import *
from .types.context_input import *
from .types.event import *
from .types.feature import *
from .types.filter_options import *
Expand Down
1 change: 1 addition & 0 deletions bindings/python/iota_sdk/client/_high_level_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from typing import List, Optional
from dataclasses import dataclass
from iota_sdk.types.block import Block
from iota_sdk.types.common import HexStr, json
from iota_sdk.types.output import OutputWithMetadata
from iota_sdk.types.output_id import OutputId
Expand Down
34 changes: 34 additions & 0 deletions bindings/python/iota_sdk/types/context_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from __future__ import annotations
from dataclasses import dataclass, field
from enum import IntEnum
from iota_sdk.types.common import HexStr, json


class ContextInputType(IntEnum):
"""Context input types.
"""
BlockIssuanceCredit = 1


@json
@dataclass
class ContextInput():
"""Base class for context inputs.
"""
type: int


@json
@dataclass
class BlockIssuanceCreditContextInput(ContextInput):
"""A Block Issuance Credit (BIC) Context Input provides the VM with context for the value of
the BIC vector of a specific slot.
"""
account_id: HexStr
type: int = field(
default_factory=lambda: int(
ContextInputType.BlockIssuanceCredit),
init=False)
6 changes: 5 additions & 1 deletion bindings/python/iota_sdk/types/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from enum import IntEnum

from dataclasses import dataclass, field
from typing import List

from iota_sdk.types.address import Ed25519Address, AccountAddress, NFTAddress
from iota_sdk.types.common import HexStr, json
Expand Down Expand Up @@ -99,4 +100,7 @@ class BlockIssuer(Feature):
expiry_slot: str
# TODO Replace with a list of PublicKey types
public_keys: List[HexStr]
type: int = field(default_factory=lambda: int(FeatureType.BlockIssuer), init=False)
type: int = field(
default_factory=lambda: int(
FeatureType.BlockIssuer),
init=False)

0 comments on commit e39e3bc

Please sign in to comment.