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

Add mana field to python outputs #1177

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
18 changes: 18 additions & 0 deletions bindings/python/iota_sdk/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def build_account_output(self,
account_id: HexStr,
unlock_conditions: List[UnlockCondition],
amount: Optional[int] = None,
mana: Optional[int] = None,
native_tokens: Optional[List[NativeToken]] = None,
state_index: Optional[int] = None,
state_metadata: Optional[str] = None,
Expand All @@ -166,6 +167,7 @@ def build_account_output(self,
account_id: A unique ID for the new account.
unlock_conditions: The unlock conditions for the new output.
amount: The amount of base coins in the new output.
mana: Amount of stored Mana held by this output.
native_tokens: Native tokens added to the new output.
state_index: A counter that must increase by 1 every time the account is state transitioned.
state_metadata: Metadata that can only be changed by the state controller.
Expand Down Expand Up @@ -193,10 +195,14 @@ def build_account_output(self,
if amount:
amount = str(amount)

if mana:
mana = str(mana)

return output_from_dict(self._call_method('buildAccountOutput', {
'accountId': account_id,
'unlockConditions': unlock_conditions,
'amount': amount,
'mana': mana,
'nativeTokens': native_tokens,
'stateIndex': state_index,
'stateMetadata': state_metadata,
Expand All @@ -208,13 +214,15 @@ def build_account_output(self,
def build_basic_output(self,
unlock_conditions: List[UnlockCondition],
amount: Optional[int] = None,
mana: Optional[int] = None,
native_tokens: Optional[List[NativeToken]] = None,
features: Optional[List[Feature]] = None) -> BasicOutput:
"""Build a BasicOutput.

Args:
unlock_conditions: The unlock conditions for the new output.
amount: The amount of base coins in the new output.
mana: Amount of stored Mana held by this output.
native_tokens: Native tokens added to the new output.
features: Features that add utility to the output but do not impose unlocking conditions.

Expand All @@ -235,9 +243,13 @@ def build_basic_output(self,
if amount:
amount = str(amount)

if mana:
mana = str(mana)

return output_from_dict(self._call_method('buildBasicOutput', {
'unlockConditions': unlock_conditions,
'amount': amount,
'mana': mana,
'nativeTokens': native_tokens,
'features': features,
}))
Expand Down Expand Up @@ -295,6 +307,7 @@ def build_nft_output(self,
nft_id: HexStr,
unlock_conditions: List[UnlockCondition],
amount: Optional[int] = None,
mana: Optional[int] = None,
native_tokens: Optional[List[NativeToken]] = None,
features: Optional[List[Feature]] = None,
immutable_features: Optional[List[Feature]] = None) -> NftOutput:
Expand All @@ -304,6 +317,7 @@ def build_nft_output(self,
nft_id: A unique ID for the new NFT.
unlock_conditions: The unlock conditions for the new output.
amount: The amount of base coins in the new output.
mana: Amount of stored Mana held by this output.
native_tokens: Native tokens added to the new output.
features: Features that add utility to the output but do not impose unlocking conditions.
immutable_features: Features that add utility to the output but do not impose unlocking conditions. These features need to be kept in future transitions of the UTXO state machine.
Expand All @@ -328,10 +342,14 @@ def build_nft_output(self,
if amount:
amount = str(amount)

if mana:
mana = str(mana)

return output_from_dict(self._call_method('buildNftOutput', {
'nftId': nft_id,
'unlockConditions': unlock_conditions,
'amount': amount,
'mana': mana,
'nativeTokens': native_tokens,
'features': features,
'immutableFeatures': immutable_features
Expand Down
9 changes: 9 additions & 0 deletions bindings/python/iota_sdk/types/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class BasicOutput(Output):
Attributes:
amount :
The base coin amount of the output.
mana :
Amount of stored Mana held by this output.
unlock_conditions :
The conditions to unlock the output.
features :
Expand All @@ -53,6 +55,7 @@ class BasicOutput(Output):
The type of output.
"""
amount: str
mana: str
unlock_conditions: List[AddressUnlockCondition | ExpirationUnlockCondition | StorageDepositReturnUnlockCondition |
TimelockUnlockCondition]
features: Optional[List[SenderFeature |
Expand All @@ -71,6 +74,8 @@ class AccountOutput(Output):
Attributes:
amount :
The base coin amount of the output.
mana :
Amount of stored Mana held by this output.
unlock_conditions:
The conditions to unlock the output.
account_id :
Expand All @@ -91,6 +96,7 @@ class AccountOutput(Output):
The type of output.
"""
amount: str
mana: str
account_id: HexStr
state_index: int
foundry_counter: int
Expand Down Expand Up @@ -150,6 +156,8 @@ class NftOutput(Output):
Attributes:
amount :
The base coin amount of the output.
mana :
Amount of stored Mana held by this output.
unlock_conditions :
The conditions to unlock the output.
nft_id :
Expand All @@ -164,6 +172,7 @@ class NftOutput(Output):
The type of output.
"""
amount: str
mana: str
nft_id: HexStr
unlock_conditions: List[AddressUnlockCondition | ExpirationUnlockCondition |
StorageDepositReturnUnlockCondition | TimelockUnlockCondition]
Expand Down