Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python: add BlockIssuanceCreditContextInput #1193

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
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)