Skip to content

Commit

Permalink
feat: partially add type annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
gtors committed May 5, 2024
1 parent 6531b87 commit 5557a62
Show file tree
Hide file tree
Showing 23 changed files with 765 additions and 2,131 deletions.
8 changes: 4 additions & 4 deletions examples/tokens/jetton/mint.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from tonsdk_ng.contract import Address
from tonsdk_ng.contract.token.ft import JettonMinter, JettonWallet
from tonsdk_ng.contract.wallet import Wallets, WalletVersionEnum
from tonsdk_ng.types import Address
from tonsdk_ng.utils import bytes_to_b64str, to_nano


def create_jetton_minter():
minter = JettonMinter(
admin_address=Address("admin address"),
admin_address=Address.from_string("admin address"),
jetton_content_uri="https://raw.githubusercontent.com/yungwine/pyton-lessons/master/lesson-6/token_data.json",
jetton_wallet_code_hex=JettonWallet.code,
)
Expand All @@ -18,7 +18,7 @@ def create_mint_body():
minter = create_jetton_minter()

body = minter.create_mint_body(
destination=Address("address"),
destination=Address.from_string("address"),
jetton_amount=to_nano(int("mint amount"), "ton"),
)
return body
Expand All @@ -28,7 +28,7 @@ def create_change_owner_body():
minter = create_jetton_minter()

body = minter.create_change_admin_body(
new_admin_address=Address(
new_admin_address=Address.from_string(
"EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c"
)
)
Expand Down
1,496 changes: 0 additions & 1,496 deletions poetry.lock

This file was deleted.

109 changes: 70 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,58 +1,81 @@
[tool.poetry]
[project]
name = "tonsdk_ng"
version = "0.1.0"
description = "Python SDK for TON"
authors = ["tonfactory.org"]
license = "Apache-2.0"
keywords = ["TON", "TON SDK", "TON utils", "TON tools"]
readme = "README.md"
requires-python = ">=3.10"
authors = [
{ name = "Andrey Torsunov", email = "[email protected]"},
# "tonfactory.org",
]
homepage = "https://github.com/gtors/tonsdk_ng"
keywords = ["TON", "TON SDK", "TON utils", "TON tools"]
classifiers = [
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Adaptive Technologies",
"Environment :: Console",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Adaptive Technologies",
]
dependencies = [
"pynacl>=1.4.0",
"bitarray~=2.6.0",
"typing-extensions~=4.11",
]
readme="README.md"
dynamic = ["version"]

[tool.poetry.dependencies]
python = ">=3.10"
pynacl = { version = ">=1.4.0" }
bitarray = { version = "==2.6.0" }
httpj = { version = "*", optional = true }
[project.urls]
Changelog = "https://github.com/gtors/tonsdk_ng/blob/master/CHANGELOG.md"
Homepage = "https://github.com/gtors/tonsdk_ng"
Source = "https://github.com/gtors/tonsdk_ng"

[tool.poetry.extras]
[project.optional-dependencies]
http_api = ["httpj"]
full = ["httpj"]
dev = [
"black",
"commitizen",
"furo",
"isort",
"mypy",
"pre-commit",
"pytest",
"ruff",
]

[tool.poetry.group.dev.dependencies]
black = "*"
commitizen = "*"
furo = "*"
isort = "*"
mypy = "*"
pre-commit = "*"
pytest = "*"
pytest-cov = "*"
ruff = "*"
[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "tonsdk_ng/__version__.py"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.hatch.build.targets.sdist]
include = [
"/tonsdk_ng",
"/CHANGELOG.md",
"/README.md",
]

[tool.hatch.envs.default]
features = ["dev"]

[tool.commitizen]
name = "cz_conventional_commits"
version = "0.1.0"
version_files = [
"tonsdk_ng/__version__.py:__version__"
]
tag_format = "$version"
update_changelog_on_bump = true

[tool.black]
target-version = ["py310", "py311"]
Expand All @@ -72,7 +95,7 @@ exclude = [
".pants.d",
".ruff_cache",
".svn",
".tox",
".x",
".venv",
"__pypackages__",
"_build",
Expand Down Expand Up @@ -116,11 +139,19 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.mypy]
python_version = "3.10"

strict = true
ignore_missing_imports = true
check_untyped_defs = true

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
check_untyped_defs = true

[tool.isort]
profile = "black"
py_version=310
line_length = 80

[tool.coverage.run]
include = ["tonsdk_ng/*", "tests/*"]
3 changes: 3 additions & 0 deletions tonsdk_ng/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__title__ = "tonsdk_ng"
__description__ = "Ton SDK"
__version__ = "0.1.0"
185 changes: 0 additions & 185 deletions tonsdk_ng/boc/dict/serialize_dict.py

This file was deleted.

4 changes: 2 additions & 2 deletions tonsdk_ng/contract/token/ft/jetton_wallet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ....boc import Cell
from ....utils import Address
from tonsdk_ng.types import Address, Cell

from ... import Contract


Expand Down
7 changes: 4 additions & 3 deletions tonsdk_ng/contract/wallet/_highload_wallet_contract_v2.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import decimal
import time

from ...boc import Cell, begin_cell, begin_dict
from ...utils import Address, sign_message
from tonsdk_ng.types import Address, Cell, begin_cell, begin_dict
from tonsdk_ng.utils import sign_message

from .. import Contract
from ._wallet_contract import WalletContract


class HighloadWalletContractBase(WalletContract):
def create_data_cell(self):
def create_data_cell(self) -> Cell:
return (
begin_cell()
.store_uint(self.options["wallet_id"], 32)
Expand Down
Loading

0 comments on commit 5557a62

Please sign in to comment.