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

Use ints for U256 values in Python #1552

Merged
merged 8 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 6 additions & 2 deletions bindings/python/iota_sdk/types/balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ class NativeTokensBalance:
metadata: Some metadata of the native token.
"""
token_id: HexStr
total: HexStr
available: HexStr
total: int = field(metadata=config(
encoder=hex
))
available: int = field(metadata=config(
encoder=hex
))
metadata: Optional[HexStr]


Expand Down
7 changes: 5 additions & 2 deletions bindings/python/iota_sdk/types/native_token.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright 2023 IOTA Stiftung
# SPDX-License-Identifier: Apache-2.0

from dataclasses import dataclass
from dataclasses import dataclass, field
from dataclasses_json import config

from iota_sdk.types.common import HexStr, json

Expand All @@ -16,4 +17,6 @@ class NativeToken():
amount: The amount of native tokens.
"""
id: HexStr
amount: HexStr
amount: int = field(metadata=config(
encoder=hex
))
15 changes: 11 additions & 4 deletions bindings/python/iota_sdk/types/token_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# SPDX-License-Identifier: Apache-2.0

from dataclasses import dataclass, field
from dataclasses_json import config
from typing import TypeAlias
from iota_sdk.types.common import HexStr, json
from iota_sdk.types.common import json


@json
Expand All @@ -17,9 +18,15 @@ class SimpleTokenScheme:
maximum_supply: The maximum supply of the token.
type: The type code of the token scheme.
"""
minted_tokens: HexStr
melted_tokens: HexStr
maximum_supply: HexStr
minted_tokens: int = field(metadata=config(
encoder=hex
))
melted_tokens: int = field(metadata=config(
encoder=hex
))
maximum_supply: int = field(metadata=config(
encoder=hex
))
type: int = field(default_factory=lambda: 0, init=False)


Expand Down