tonutils 0.6.0a1__tar.gz → 1.0.0a2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/PKG-INFO +3 -6
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/setup.py +3 -6
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tests/tests_utils.py +1 -1
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/__init__.py +22 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/base.py +20 -7
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/codes.py +9 -1
- tonutils-1.0.0a2/tonutils/contracts/jetton/__init__.py +25 -0
- tonutils-1.0.0a2/tonutils/contracts/jetton/get_methods.py +74 -0
- tonutils-1.0.0a2/tonutils/contracts/jetton/master.py +259 -0
- tonutils-1.0.0a2/tonutils/contracts/jetton/wallet.py +75 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/nft/__init__.py +6 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/nft/collection.py +2 -3
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/base.py +6 -6
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/hw.py +4 -4
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/protocols/contract.py +4 -1
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/protocols/wallet.py +1 -1
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/__init__.py +59 -23
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/contract.py +12 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/messages.py +78 -33
- tonutils-1.0.0a2/tonutils/types/opcodes.py +27 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/params.py +1 -1
- tonutils-1.0.0a2/tonutils/types/tlb/__init__.py +122 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/content.py +3 -0
- tonutils-1.0.0a2/tonutils/types/tlb/jetton.py +591 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/nft.py +45 -36
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/stack_codec.py +3 -1
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils.egg-info/PKG-INFO +3 -6
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils.egg-info/SOURCES.txt +5 -0
- tonutils-1.0.0a2/tonutils.egg-info/requires.txt +6 -0
- tonutils-0.6.0a1/tonutils/types/opcodes.py +0 -15
- tonutils-0.6.0a1/tonutils/types/tlb/__init__.py +0 -87
- tonutils-0.6.0a1/tonutils.egg-info/requires.txt +0 -9
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/LICENSE +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/README.md +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/setup.cfg +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tests/tests_clients.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/base.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/liteserver/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/liteserver/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/liteserver/stub.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/quicknode/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/quicknode/api.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/quicknode/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tatum/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tatum/api.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tatum/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tonapi/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tonapi/api.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tonapi/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/tonapi/models.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/toncenter/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/toncenter/api.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/toncenter/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/clients/toncenter/models.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/nft/get_methods.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/nft/item.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/get_methods.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/pp.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/v1.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/v2.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/v3.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/v4.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/contracts/wallet/versions/v5.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/exceptions.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/protocols/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/protocols/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/py.typed +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/tonconnect/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/client.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/common.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/configs.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/keystructs.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/stack.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/contract.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/msg.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/text.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/types/tlb/wallet.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/__init__.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/converters.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/msg_builders.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/parse_config.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/text_cipher.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/validations.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/value_utils.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils/utils/wallet_utils.py +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils.egg-info/dependency_links.txt +0 -0
- {tonutils-0.6.0a1 → tonutils-1.0.0a2}/tonutils.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tonutils
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 1.0.0a2
|
|
4
4
|
Summary: Tonutils is a high-level, object-oriented Python library designed to facilitate seamless interactions with the TON blockchain.
|
|
5
5
|
Home-page: https://github.com/nessshon/tonutils
|
|
6
6
|
Author: nessshon
|
|
@@ -24,12 +24,9 @@ Classifier: Environment :: Console
|
|
|
24
24
|
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
License-File: LICENSE
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist: aiolimiter~=1.2.1
|
|
29
|
-
Requires-Dist: cachetools~=5.5.0
|
|
30
|
-
Requires-Dist: pycryptodomex~=3.20.0
|
|
31
|
-
Requires-Dist: PyNaCl~=1.5.0
|
|
27
|
+
Requires-Dist: pyapiq>=0.1.3
|
|
32
28
|
Requires-Dist: pytoniq-core>=0.1.44
|
|
29
|
+
Requires-Dist: PyNaCl~=1.5.0
|
|
33
30
|
Provides-Extra: pytoniq
|
|
34
31
|
Requires-Dist: pytoniq~=0.1.41; extra == "pytoniq"
|
|
35
32
|
Dynamic: author
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="tonutils",
|
|
8
|
-
version="0.
|
|
8
|
+
version="1.0.0a2",
|
|
9
9
|
author="nessshon",
|
|
10
10
|
description=(
|
|
11
11
|
"Tonutils is a high-level, object-oriented Python library "
|
|
@@ -24,12 +24,9 @@ setuptools.setup(
|
|
|
24
24
|
package_data={"tonutils": ["py.typed"]},
|
|
25
25
|
python_requires=">=3.10",
|
|
26
26
|
install_requires=[
|
|
27
|
-
"
|
|
28
|
-
"aiolimiter~=1.2.1",
|
|
29
|
-
"cachetools~=5.5.0",
|
|
30
|
-
"pycryptodomex~=3.20.0",
|
|
31
|
-
"PyNaCl~=1.5.0",
|
|
27
|
+
"pyapiq>=0.1.3",
|
|
32
28
|
"pytoniq-core>=0.1.44",
|
|
29
|
+
"PyNaCl~=1.5.0",
|
|
33
30
|
],
|
|
34
31
|
extras_require={
|
|
35
32
|
"pytoniq": ["pytoniq~=0.1.41"],
|
|
@@ -185,7 +185,7 @@ class TestUtils(TestCase):
|
|
|
185
185
|
with self.assertRaises(ValueError):
|
|
186
186
|
to_amount(-1, decimals)
|
|
187
187
|
with self.assertRaises(ValueError):
|
|
188
|
-
to_amount(2
|
|
188
|
+
to_amount(2**256, decimals)
|
|
189
189
|
with self.assertRaises(ValueError):
|
|
190
190
|
to_amount(1, -1)
|
|
191
191
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
from .codes import CONTRACT_CODES
|
|
2
|
+
from .jetton import (
|
|
3
|
+
JettonMasterGetMethods,
|
|
4
|
+
JettonWalletGetMethods,
|
|
5
|
+
JettonMasterStandard,
|
|
6
|
+
JettonMasterStablecoin,
|
|
7
|
+
JettonMasterStablecoinV2,
|
|
8
|
+
JettonWalletStandard,
|
|
9
|
+
JettonWalletStablecoin,
|
|
10
|
+
JettonWalletStablecoinV2,
|
|
11
|
+
)
|
|
2
12
|
from .nft import (
|
|
3
13
|
BaseNFTCollection,
|
|
4
14
|
BaseNFTItem,
|
|
15
|
+
NFTCollectionGetMethods,
|
|
16
|
+
NFTItemGetMethods,
|
|
5
17
|
NFTCollectionEditable,
|
|
6
18
|
NFTCollectionStandard,
|
|
7
19
|
NFTItemEditable,
|
|
@@ -32,6 +44,16 @@ __all__ = [
|
|
|
32
44
|
"BaseNFTCollection",
|
|
33
45
|
"BaseNFTItem",
|
|
34
46
|
"BaseWallet",
|
|
47
|
+
"JettonMasterGetMethods",
|
|
48
|
+
"JettonWalletGetMethods",
|
|
49
|
+
"JettonMasterStandard",
|
|
50
|
+
"JettonMasterStablecoin",
|
|
51
|
+
"JettonMasterStablecoinV2",
|
|
52
|
+
"JettonWalletStandard",
|
|
53
|
+
"JettonWalletStablecoin",
|
|
54
|
+
"JettonWalletStablecoinV2",
|
|
55
|
+
"NFTCollectionGetMethods",
|
|
56
|
+
"NFTItemGetMethods",
|
|
35
57
|
"NFTCollectionEditable",
|
|
36
58
|
"NFTCollectionStandard",
|
|
37
59
|
"NFTItemEditable",
|
|
@@ -6,18 +6,21 @@ from pyapiq.exceptions import APIQException
|
|
|
6
6
|
from pytoniq_core import Address, Cell, StateInit
|
|
7
7
|
|
|
8
8
|
from .codes import CONTRACT_CODES
|
|
9
|
-
from ..exceptions import
|
|
9
|
+
from ..exceptions import (
|
|
10
|
+
ContractError,
|
|
11
|
+
NotRefreshedError,
|
|
12
|
+
)
|
|
10
13
|
from ..protocols import (
|
|
11
14
|
ClientProtocol,
|
|
12
15
|
ContractProtocol,
|
|
13
16
|
)
|
|
14
17
|
from ..types import (
|
|
15
|
-
ContractStateInfo,
|
|
16
|
-
WorkchainID,
|
|
17
18
|
AddressLike,
|
|
18
|
-
ContractState,
|
|
19
|
-
BaseContractVersion,
|
|
20
19
|
BaseContractData,
|
|
20
|
+
BaseContractVersion,
|
|
21
|
+
ContractStateInfo,
|
|
22
|
+
ContractState,
|
|
23
|
+
WorkchainID,
|
|
21
24
|
)
|
|
22
25
|
from ..utils import to_cell
|
|
23
26
|
|
|
@@ -29,7 +32,17 @@ TContract = t.TypeVar("TContract", bound="BaseContract")
|
|
|
29
32
|
class BaseContract(ContractProtocol[D]):
|
|
30
33
|
_data_model: t.Type[D]
|
|
31
34
|
|
|
32
|
-
VERSION: t.ClassVar[BaseContractVersion]
|
|
35
|
+
VERSION: t.ClassVar[t.Union[BaseContractVersion, str]]
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
def get_default_code(cls) -> Cell:
|
|
39
|
+
try:
|
|
40
|
+
default_code = to_cell(CONTRACT_CODES[cls.VERSION])
|
|
41
|
+
except KeyError:
|
|
42
|
+
raise ContractError(
|
|
43
|
+
cls, f"No contract code defined for VERSION {cls.VERSION!r}."
|
|
44
|
+
)
|
|
45
|
+
return default_code
|
|
33
46
|
|
|
34
47
|
def __init__(
|
|
35
48
|
self,
|
|
@@ -135,7 +148,7 @@ class BaseContract(ContractProtocol[D]):
|
|
|
135
148
|
data: Cell,
|
|
136
149
|
workchain: WorkchainID = WorkchainID.BASECHAIN,
|
|
137
150
|
) -> TContract:
|
|
138
|
-
code =
|
|
151
|
+
code = cls.get_default_code()
|
|
139
152
|
return cls.from_code_and_data(client, code, data, workchain)
|
|
140
153
|
|
|
141
154
|
@classmethod
|
|
@@ -3,11 +3,13 @@ import typing as t
|
|
|
3
3
|
from ..types import (
|
|
4
4
|
WalletVersion,
|
|
5
5
|
BaseContractVersion,
|
|
6
|
+
JettonWalletVersion,
|
|
7
|
+
JettonMasterVersion,
|
|
6
8
|
NFTCollectionVersion,
|
|
7
9
|
NFTItemVersion,
|
|
8
10
|
)
|
|
9
11
|
|
|
10
|
-
CONTRACT_CODES: t.Dict[BaseContractVersion, str] = {
|
|
12
|
+
CONTRACT_CODES: t.Dict[t.Union[BaseContractVersion, str], str] = {
|
|
11
13
|
WalletVersion.WalletV1R1: "b5ee9c72010101010044000084ff0020dda4f260810200d71820d70b1fed44d0d31fd3ffd15112baf2a122f901541044f910f2a2f80001d31f3120d74a96d307d402fb00ded1a4c8cb1fcbffc9ed54",
|
|
12
14
|
WalletVersion.WalletV1R2: "b5ee9c720101010100530000a2ff0020dd2082014c97ba9730ed44d0d70b1fe0a4f260810200d71820d70b1fed44d0d31fd3ffd15112baf2a122f901541044f910f2a2f80001d31f3120d74a96d307d402fb00ded1a4c8cb1fcbffc9ed54",
|
|
13
15
|
WalletVersion.WalletV1R3: "b5ee9c7201010101005f0000baff0020dd2082014c97ba218201339cbab19c71b0ed44d0d31fd70bffe304e0a4f260810200d71820d70b1fed44d0d31fd3ffd15112baf2a122f901541044f910f2a2f80001d31f3120d74a96d307d402fb00ded1a4c8cb1fcbffc9ed54",
|
|
@@ -27,4 +29,10 @@ CONTRACT_CODES: t.Dict[BaseContractVersion, str] = {
|
|
|
27
29
|
NFTItemVersion.NFTItemStandard: "b5ee9c7201020d010001d0000114ff00f4a413f4bcf2c80b01020162020c0202ce0309020120040802d70c8871c02497c0f83434c0c05c6c2497c0f83e903e900c7e800c5c75c87e800c7e800c3c00812ce3850c1b088d148cb1c17cb865407e90350c0408fc00f801b4c7f4cfe08417f30f45148c2ea3a1cc840dd78c9004f80c0d0d0d4d60840bf2c9a884aeb8c097c12103fcbc20050701f65135c705f2e191fa4021f001fa40d20031fa00820afaf0801ba121945315a0a1de22d70b01c300209206a19136e220c2fff2e192218e3e821005138d91c85009cf16500bcf16712449145446a0708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb00104794102a375be2060082028e3526f0018210d53276db103744006d71708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb0093303234e25502f00300727082108b77173505c8cbff5004cf1610248040708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb0000113e910c1c2ebcb853600201200a0b003b3b513434cffe900835d27080269fc07e90350c04090408f80c1c165b5b60001d00f232cfd633c58073c5b3327b55200009a11f9fe005",
|
|
28
30
|
NFTItemVersion.NFTItemEditable: "b5ee9c72010212010002e5000114ff00f4a413f4bcf2c80b01020162020f0202ce030c020120040b04f70c8871c02497c0f83434c0c05c6c2497c0f83e903e900c7e800c5c75c87e800c7e800c3c00816ce38596db088d148cb1c17cb865407e90353e900c040d3c00f801f4c7f4cfe08417f30f45148c2ea3a28c8412040dc409841140b820840bf2c9a8948c2eb8c0a0840701104a948c2ea3a28c8412040dc409841140a00507080a01f65136c705f2e191fa4021f001fa40d20031fa00820afaf0801ca121945315a0a1de22d70b01c300209206a19136e220c2fff2e192218e3e821005138d91c8500acf16500ccf1671244a145446b0708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb00105894102b385be2060082028e3527f0018210d53276db103845006d71708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb0093303335e25503f0030080135f03333334347082108b77173504c8cbff58cf164430128040708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb0001f65134c705f2e191fa4021f001fa40d20031fa00820afaf0801ca121945315a0a1de22d70b01c300209206a19136e220c2fff2e192218e3e8210511a4463c85008cf16500ccf1671244814544690708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb00103894102b365be2090082028e3527f0018210d53276db103848006d71708010c8cb055007cf165005fa0215cb6a12cb1fcb3f226eb39458cf17019132e201c901fb0093303630e25503f0030046e03136373782101a0b9d5116ba9e5131c705f2e19a01d4304400f003e05f06840ff2f000113e910c1c2ebcb853600201200d0e00413b513434cffe900835d27080271fc07e90353e900c040d440d380c1c165b5b5b600025013232cfd400f3c58073c5b30073c5b27b55200201201011000dbf03a78013628c000bbc7e7f801184",
|
|
29
31
|
NFTItemVersion.NFTItemSoulbound: "b5ee9c720102130100033b000114ff00f4a413f4bcf2c80b01020162020e0202ce030b04bd46c2220c700915be001d0d303fa4030f002f842b38e1c31f84301c705f2e195fa4001f864d401f866fa4030f86570f867f003e002d31f0271b0e30201d33f8210d0c3bfea5230bae302821004ded1485230bae3023082102fcb26a25220ba80405060700943031d31f82100524c7ae12ba8e39d33f308010f844708210c18e86d255036d804003c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb009130e200c26c12fa40d4d30030f847f841c8cbff5006cf16f844cf1612cc14cb3f5230cb0003c30096f8465003cc02de801078b17082100dd607e3403514804003c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb0000c632f8445003c705f2e191fa40d4d30030f847f841c8cbfff844cf1613cc12cb3f5210cb0001c30094f84601ccde801078b17082100524c7ae405503804003c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb0003fa8e4031f841c8cbfff843cf1680107082108b7717354015504403804003c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb00e082101f04537a5220bae30282106f89f5e35220ba8e165bf84501c705f2e191f847c000f2e193f823f867f003e08210d136d3b35220bae302303108090a009231f84422c705f2e1918010708210d53276db102455026d830603c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb008b02f8648b02f865f003008e31f84422c705f2e191820afaf08070fb028010708210d53276db102455026d830603c8cb1f12cb3f216eb39301cf179131e2c97105c8cb055004cf1658fa0213cb6accc901fb00002082105fcc3d14ba93f2c19dde840ff2f00201200c0d00613b513434cfc07e187e90007e18dc3e188835d2708023859ffe18be90007e1935007e19be90007e1974cfcc3e19e44c38a000373e11fe11be107232cffe10f3c5be1133c5b33e1173c5b2cff27b55200201200f120201581011000db5631e005f08b0000db7b07e005f08f0001dbc7e7f8017c217c20fc21fc227c234",
|
|
32
|
+
JettonMasterVersion.JettonMasterStandard: "b5ee9c7201020d0100029c000114ff00f4a413f4bcf2c80b01020162020a0202cc030902f1d906380492f81f000e8698180b8d8492f81f07d207d2018fd0018b8eb90fd0018fd001801698fe99ff6a2687d007d206a6a18400aa9385d47199a9a9b1b289a6382f97024817d207d006a18106840306b90fd001812881a282178050a502819e428027d012c678b666664f6aa7041083deecbef29385d71814040601c036373701fa00fa40f82854120670542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c9f9007074c8cb02ca07cbffc9d05006c705f2e04aa1034545c85004fa0258cf16ccccc9ed5401fa403020d70b01c300915be30d05003e8210d53276db708010c8cb055003cf1622fa0212cb6acb1fcb3fc98042fb0001a682102c76b9735270bae30235373723c0038e1a335035c705f2e04903fa403059c85004fa0258cf16ccccc9ed54e03502c0048e185124c705f2e049d4304300c85004fa0258cf16ccccc9ed54e05f05840ff2f00701fe365f03820898968015a015bcf2e04b02fa40d3003095c821cf16c9916de28210d1735400708018c8cb055005cf1624fa0214cb6a13cb1f14cb3f23fa443070ba8e33f828440370542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c9f9007074c8cb02ca07cbffc9d0cf16966c227001cb01e2f40008000ac98040fb000093b5f0508806e0a84026a8280790a009f404b19e2c039e2d99924591960225e801e80196019241f200e0e9919605940f97ff93a0ef003191960ab19e2ca009f4042796d625999992e3f60102037a600b0c007dadbcf6a2687d007d206a6a183618fc1400b82a1009aa0a01e428027d012c678b00e78b666491646580897a007a00658064fc80383a6465816503e5ffe4e840001faf16f6a2687d007d206a6a183faa9040",
|
|
33
|
+
JettonMasterVersion.JettonMasterStablecoin: "b5ee9c7201021601000494000114ff00f4a413f4bcf2c80b0102016202110202cb031002f5d0cb434c0c05c6c238ecc200835c874c7c0608405e351466ea44c38601035c87e800c3b51343e803e903e90353534541168504d3214017e809400f3c58073c5b333327b55383e903e900c7e800c7d007e800c7e80004c5c3e0e80b4c7c04074cfc044bb51343e803e903e9035353449a084190adf41eeb8c08e4960407019635355161c705f2e04904fa4021fa4430c000f2e14dfa00d4d120d0d31f018210178d4519baf2e0488040d721fa00fa4031fa4031fa0020d70b009ad74bc00101c001b0f2b19130e254431b05018e2191729171e2f839206e938127519120e2216e94318128c39101e25023a813a0738103a370f83ca00270f83612a00170f836a07381040982100966018070f837a0bcf2b025597f0600ea820898968070fb02f828450470546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c920f9007074c8cb02ca07cbffc9d0c8801801cb0501cf1658fa02029858775003cb6bcccc9730017158cb6acce2c98011fb005005a04314c85005fa025003cf1601cf16ccccc9ed5403f682107bdd97deba8ee53505fa00fa40f82854120770546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d05008c705f2e04a12a144145036c85005fa025003cf1601cf16ccccc9ed54fa40d120d70b01c000b3915be30de02582102c76b973bae302342408090b0044c8801001cb0501cf1670fa027001cb6a8210d53276db01cb1f0101cb3fc98042fb0001fe355f033401fa40d2000101d195c821cf16c9916de2c8801001cb055004cf1670fa027001cb6a8210d173540001cb1f500401cb3f23fa4430c0008e35f828440470546004131503c8cb0358fa0201cf1601cf16c921c8cb0113f40012f400cb00c9f9007074c8cb02ca07cbffc9d012cf1697316c127001cb01e2f400c980500a0004fb0004fe82106501f354ba8e2130335142c705f2e04902fa40d1400304c85005fa025003cf1601cf16ccccc9ed54e0248210fb88e119ba8e20313303d15131c705f2e0498b024034c85005fa025003cf1601cf16ccccc9ed54e02482107431f221bae30237238210cb862902bae302365b2082102508d66abae3026c318210d372158c0c0d0e0f004430335042c705f2e04901d18b028b024034c85005fa025003cf1601cf16ccccc9ed540044335142c705f2e049c85003cf16c9134440c85005fa025003cf1601cf16ccccc9ed54001e3002c705f2e049d4d4d101ed54fb04000cbadc840ff2f0001da23864658380e78b64814183fa0bc002012012130025bd9adf6a2687d007d207d206a6a6888122f82402027114150085adbcf6a2687d007d207d206a6a688a2f827c1400b82a3002098a81e46581ac7d0100e78b00e78b6490e4658089fa00097a00658064fc80383a6465816503e5ffe4e84000cfaf16f6a2687d007d207d206a6a68bf99e836c1783872ebdb514d9c97c283b7f0ae5179029e2b6119c39462719e4f46ed8f7413e62c780a417877407e978f01a40711411b1acb773a96bdd93fa83bb5ca8435013c8c4b3ac91f4589cc780a38646583fa0064a18040",
|
|
34
|
+
JettonMasterVersion.JettonMasterStablecoinV2: "b5ee9c72010215010004e0000114ff00f4a413f4bcf2c80b0102016202100202cb030f02f7d0cb434c0c05c6c3000638ecc200835c874c7c0608405e351466ea44c38601035c87e800c3b51343e803e903e90353534541168504d3214017e809400f3c58073c5b333327b55383e903e900c7e800c7d007e800c7e80004c5c3e0e80b4c7c04074cfc044bb51343e803e903e9035353449a084190adf41eeb8c08e60408019635355161c705f2e04904fa4021fa4430c000f2e14dfa00d4d120d0d31f018210178d4519baf2e0488040d721fa00fa4031fa4031fa0020d70b009ad74bc00101c001b0f2b19130e254431b05018e2191729171e2f839206e9381239b9120e2216e94318128309101e25023a813a07381032c70f83ca00270f83612a00170f836a07381040282100966018070f837a0bcf2b025597f0601ea820898968070fb0224800bd721d70b07f82846057054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c9513384f701f90001b07074c8cb02ca0712cb07cbf7c9d0c8801801cb0501cf1658fa020397775003cb6bcccc96317158cb6acce2c98011fb005005a04314070022c85005fa025003cf1601cf16ccccc9ed5404e62582107bdd97debae3022582102c76b973ba8ecb355f033401fa40d2000101d195c821cf16c9916de2c8801001cb055004cf1670fa027001cb6a8210d173540001cb1f500401cb3f23fa4430c00097316c127001cb01e30df400c98050fb00e0342482106501f354bae302248210fb88e119ba090b0c0d01f23505fa00fa40f82854120722800bd721d70b0755207054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c984f701f90001b07074c8cb02ca0712cb07cbf7c9d05008c705f2e04a12a144145036c85005fa025003cf1601cf16ccccc9ed54fa40d120d70b01c000b3915be30d0a0044c8801001cb0501cf1670fa027001cb6a8210d53276db01cb1f0101cb3fc98042fb000092f828440422800bd721d70b0755207054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c984f701f90001b07074c8cb02ca0712cb07cbf7c9d012cf16004230335142c705f2e04902fa40d1400304c85005fa025003cf1601cf16ccccc9ed5401fe8e20313303d15131c705f2e0498b024034c85005fa025003cf1601cf16ccccc9ed54e02482107431f221ba8e2230335042c705f2e04901d18b028b024034c85005fa025003cf1601cf16ccccc9ed54e037238210cb862902ba8e22335142c705f2e049c85003cf16c9134440c85005fa025003cf1601cf16ccccc9ed54e0360e00505b2082102508d66aba9f3002c705f2e049d4d4d101ed54fb04e06c318210d372158cbadc840ff2f0001da23864658380e78b64814183fa0bc002012011120025bd9adf6a2687d007d207d206a6a6888122f824020271131400adadbcf6a2687d007d207d206a6a688a2f827c1400914005eb90eb8583aa90382a10098a642801fd0100e78b00e78b64913c38e4658065826580097a007a00658064c27b80fc8000d8383a6465816503896583e5fbe4e84000cfaf16f6a2687d007d207d206a6a68bf99e836c1783872ebdb514d9c97c283b7f0ae5179029e2b6119c39462719e4f46ed8f7413e62c780a417877407e978f01a40711411b1acb773a96bdd93fa83bb5ca8435013c8c4b3ac91f4589cc780a38646583fa0064a18040",
|
|
35
|
+
JettonWalletVersion.JettonWalletStandard: "b5ee9c7201021101000323000114ff00f4a413f4bcf2c80b0102016202100202cc03060201d4040500c30831c02497c138007434c0c05c6c2544d7c0fc03383e903e900c7e800c5c75c87e800c7e800c1cea6d0000b4c7e08403e29fa954882ea54c4d167c0278208405e3514654882ea58c511100fc02b80d60841657c1ef2ea4d67c02f817c12103fcbc2000113e910c1c2ebcb85360020120070f020120080a01f1503d33ffa00fa4021f001ed44d0fa00fa40fa40d4305136a1522ac705f2e2c128c2fff2e2c254344270542013541403c85004fa0258cf1601cf16ccc922c8cb0112f400f400cb00c920f9007074c8cb02ca07cbffc9d004fa40f40431fa0020d749c200f2e2c4778018c8cb055008cf1670fa0217cb6b13cc809009e8210178d4519c8cb1f19cb3f5007fa0222cf165006cf1625fa025003cf16c95005cc2391729171e25008a813a08209c9c380a014bcf2e2c504c98040fb001023c85004fa0258cf1601cf16ccc9ed540201200b0e02f73b51343e803e903e90350c0234cffe80145468017e903e9014d6f1c1551cdb5c150804d50500f214013e809633c58073c5b33248b232c044bd003d0032c0327e401c1d3232c0b281f2fff274140371c1472c7cb8b0c2be80146a2860822625a019ad822860822625a028062849e5c412440e0dd7c138c34975c2c0600c0d00705279a018a182107362d09cc8cb1f5230cb3f58fa025007cf165007cf16c9718010c8cb0524cf165006fa0215cb6a14ccc971fb0010241023007cc30023c200b08e218210d53276db708010c8cb055008cf165004fa0216cb6a12cb1f12cb3fc972fb0093356c21e203c85004fa0258cf1601cf16ccc9ed5400d73b51343e803e903e90350c01f4cffe803e900c145468549271c17cb8b049f0bffcb8b08160824c4b402805af3cb8b0e0841ef765f7b232c7c572cfd400fe8088b3c58073c5b25c60063232c14933c59c3e80b2dab33260103ec01004f214013e809633c58073c5b3327b55200083d40106b90f6a2687d007d207d206a1802698fc1080bc6a28ca9105d41083deecbef09dd0958f97162e99f98fd001809d02811e428027d012c678b00e78b6664f6aa4001ba0f605da89a1f401f481f481a861",
|
|
36
|
+
JettonWalletVersion.JettonWalletStablecoin: "b5ee9c7201010101002300084202ba2918c8947e9b25af9ac1b883357754173e5812f807a3d6e642a14709595395",
|
|
37
|
+
JettonWalletVersion.JettonWalletStablecoinV2: "b5ee9c7201020d0100038a000114ff00f4a413f4bcf2c80b01020162020c02f4d001d0d3030171b0c0018e43135f038020d721ed44d0fa00fa40fa40d103d31f01840f218210178d4519ba0282107bdd97deba12b1f2f48040d721fa003012a002c85003fa0201cf1601cf16c9ed54e0fa40fa4031fa0031f401fa0031fa00013170f83a02d31f012082100f8a7ea5ba8e85303459db3ce03322030601f403d33f0101fa00fa4021fa4430c000f2e14ded44d0fa00fa40fa40d15219c705f2e0495114a120c2fff2af23800bd721d70b07f82a5425907054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c9514484f701f90001b07074c8cb02ca0712cb07cbf7c9d003fa40f401fa002004019620d70b009ad74bc00101c001b0f2b19130e2c88210178d451901cb1f500901cb3f5007fa0223cf1601cf1625fa025006cf16c9c8801801cb055003cf1670fa025a775003cb6bccccc944460500b02191729171e2f839206e9381239b9120e2216e94318128309101e25023a813a07381032c70f83ca00270f83612a00170f836a07381040282100966018070f837a0bcf2b0038050fb0001c85003fa0201cf1601cf16c9ed54025a8210178d4519ba8e84325adb3ce034218210595f07bcba8e843101db3ce0135f038210d372158cbadc840ff2f0070a02f4ed44d0fa00fa40fa40d106d33f0101fa00fa40fa4053a9c705b38e4ef82a5463c022800bd721d70b0755207054201314c85003fa0201cf1601cf16c9227871c8cb00cb04cb0012f400f400cb00c984f701f90001b07074c8cb02ca0712cb07cbf7c9d0500ac705f2e04a9139e25152a008fa0021925f04e30d2208090060c882107362d09c01cb1f2501cb3f5004fa0258cf1658cf16c9c8801001cb0524cf1658fa02017158cb6accc98011fb0000aed70b01c000b38e3b5043a1f82fa07381040282100966018070f837b60972fb02c8801001cb0501cf1670fa027001cb6a8210d53276db01cb1f0101cb3fc9810082fb0093145f04e258c85003fa0201cf1601cf16c9ed5401eeed44d0fa00fa40fa40d105d33f0101fa00fa40f401d15141a15237c705f2e04925c2fff2afc882107bdd97de01cb1f5801cb3f01fa0221cf1658cf16c9c8801801cb0525cf1670fa02017158cb6accc902f839206e943081160dde718102f270f8380170f836a0811bdf70f836a0bcf2b0018050fb00580b001cc85003fa0201cf1601cf16c9ed54001da0f605da89a1f401f481f481a3f055",
|
|
30
38
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from .get_methods import (
|
|
2
|
+
JettonMasterGetMethods,
|
|
3
|
+
JettonWalletGetMethods,
|
|
4
|
+
)
|
|
5
|
+
from .master import (
|
|
6
|
+
JettonMasterStandard,
|
|
7
|
+
JettonMasterStablecoin,
|
|
8
|
+
JettonMasterStablecoinV2,
|
|
9
|
+
)
|
|
10
|
+
from .wallet import (
|
|
11
|
+
JettonWalletStandard,
|
|
12
|
+
JettonWalletStablecoin,
|
|
13
|
+
JettonWalletStablecoinV2,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"JettonMasterGetMethods",
|
|
18
|
+
"JettonWalletGetMethods",
|
|
19
|
+
"JettonMasterStandard",
|
|
20
|
+
"JettonMasterStablecoin",
|
|
21
|
+
"JettonMasterStablecoinV2",
|
|
22
|
+
"JettonWalletStandard",
|
|
23
|
+
"JettonWalletStablecoin",
|
|
24
|
+
"JettonWalletStablecoinV2",
|
|
25
|
+
]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
|
|
3
|
+
from pytoniq_core import Address
|
|
4
|
+
|
|
5
|
+
from ...protocols import ClientProtocol
|
|
6
|
+
from ...types import AddressLike
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class JettonMasterGetMethods:
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
async def get_jetton_data(
|
|
13
|
+
cls,
|
|
14
|
+
client: ClientProtocol,
|
|
15
|
+
address: AddressLike,
|
|
16
|
+
) -> t.List[t.Any]:
|
|
17
|
+
method_result = await client.run_get_method(
|
|
18
|
+
address=address,
|
|
19
|
+
method_name="get_jetton_data",
|
|
20
|
+
)
|
|
21
|
+
return method_result
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
async def get_wallet_address(
|
|
25
|
+
cls,
|
|
26
|
+
client: ClientProtocol,
|
|
27
|
+
address: AddressLike,
|
|
28
|
+
owner_address: AddressLike,
|
|
29
|
+
) -> Address:
|
|
30
|
+
method_result = await client.run_get_method(
|
|
31
|
+
address=address,
|
|
32
|
+
method_name="get_wallet_address",
|
|
33
|
+
stack=[owner_address],
|
|
34
|
+
)
|
|
35
|
+
return method_result[0]
|
|
36
|
+
|
|
37
|
+
@classmethod
|
|
38
|
+
async def get_next_admin_address(
|
|
39
|
+
cls,
|
|
40
|
+
client: ClientProtocol,
|
|
41
|
+
address: AddressLike,
|
|
42
|
+
) -> t.Optional[Address]:
|
|
43
|
+
method_result = await client.run_get_method(
|
|
44
|
+
address=address,
|
|
45
|
+
method_name="get_next_admin_address",
|
|
46
|
+
)
|
|
47
|
+
return method_result[0]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class JettonWalletGetMethods:
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
async def get_wallet_data(
|
|
54
|
+
cls,
|
|
55
|
+
client: ClientProtocol,
|
|
56
|
+
address: AddressLike,
|
|
57
|
+
) -> t.List[t.Any]:
|
|
58
|
+
method_result = await client.run_get_method(
|
|
59
|
+
address=address,
|
|
60
|
+
method_name="get_wallet_data",
|
|
61
|
+
)
|
|
62
|
+
return method_result
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
async def get_status(
|
|
66
|
+
cls,
|
|
67
|
+
client: ClientProtocol,
|
|
68
|
+
address: AddressLike,
|
|
69
|
+
) -> int:
|
|
70
|
+
method_result = await client.run_get_method(
|
|
71
|
+
address=address,
|
|
72
|
+
method_name="get_status",
|
|
73
|
+
)
|
|
74
|
+
return method_result[0]
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import typing as t
|
|
3
|
+
|
|
4
|
+
from pytoniq_core import (
|
|
5
|
+
Address,
|
|
6
|
+
Cell,
|
|
7
|
+
Slice,
|
|
8
|
+
StateInit,
|
|
9
|
+
begin_cell,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from .get_methods import JettonMasterGetMethods
|
|
13
|
+
from ..base import BaseContract
|
|
14
|
+
from ...types import (
|
|
15
|
+
AddressLike,
|
|
16
|
+
ContentLike,
|
|
17
|
+
MetadataPrefix,
|
|
18
|
+
OnchainContent,
|
|
19
|
+
OffchainContent,
|
|
20
|
+
JettonMasterStandardData,
|
|
21
|
+
JettonMasterStablecoinData,
|
|
22
|
+
JettonMasterVersion,
|
|
23
|
+
WorkchainID,
|
|
24
|
+
)
|
|
25
|
+
from ...utils import to_cell, cell_hash
|
|
26
|
+
|
|
27
|
+
D = t.TypeVar(
|
|
28
|
+
"D",
|
|
29
|
+
bound=t.Union[
|
|
30
|
+
JettonMasterStandardData,
|
|
31
|
+
JettonMasterStablecoinData,
|
|
32
|
+
],
|
|
33
|
+
)
|
|
34
|
+
C = t.TypeVar(
|
|
35
|
+
"C",
|
|
36
|
+
bound=t.Union[
|
|
37
|
+
OnchainContent,
|
|
38
|
+
OffchainContent,
|
|
39
|
+
],
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
DStandard = t.TypeVar("DStandard", bound=JettonMasterStandardData)
|
|
44
|
+
DStablecoin = t.TypeVar("DStablecoin", bound=JettonMasterStablecoinData)
|
|
45
|
+
|
|
46
|
+
CStandard = t.TypeVar("CStandard", bound=ContentLike)
|
|
47
|
+
CStablecoin = t.TypeVar("CStablecoin", bound=OnchainContent)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class BaseJettonMaster(BaseContract[D], t.Generic[D, C], abc.ABC):
|
|
51
|
+
_data_model: t.Type[D]
|
|
52
|
+
|
|
53
|
+
@property
|
|
54
|
+
def jetton_wallet_code(self) -> Cell:
|
|
55
|
+
return self.state_data.jetton_wallet_code
|
|
56
|
+
|
|
57
|
+
@property
|
|
58
|
+
def admin_address(self) -> Address:
|
|
59
|
+
return self.state_data.admin_address
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def total_supply(self) -> int:
|
|
63
|
+
return self.state_data.total_supply
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def content(self) -> C:
|
|
67
|
+
return self.state_data.content
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
@abc.abstractmethod
|
|
71
|
+
def _pack_jetton_wallet_data(
|
|
72
|
+
cls,
|
|
73
|
+
owner_address: AddressLike,
|
|
74
|
+
jetton_master_address: AddressLike,
|
|
75
|
+
jetton_wallet_code: t.Union[Cell, str],
|
|
76
|
+
) -> Cell: ...
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def calculate_user_jetton_wallet_address(
|
|
80
|
+
cls,
|
|
81
|
+
owner_address: AddressLike,
|
|
82
|
+
jetton_master_address: AddressLike,
|
|
83
|
+
jetton_wallet_code: t.Union[Cell, str],
|
|
84
|
+
workchain: WorkchainID = WorkchainID.BASECHAIN,
|
|
85
|
+
) -> Address:
|
|
86
|
+
code = to_cell(jetton_wallet_code)
|
|
87
|
+
data = cls._pack_jetton_wallet_data(
|
|
88
|
+
owner_address=owner_address,
|
|
89
|
+
jetton_master_address=jetton_master_address,
|
|
90
|
+
jetton_wallet_code=code,
|
|
91
|
+
)
|
|
92
|
+
state_init = StateInit(code=code, data=data)
|
|
93
|
+
return Address((workchain.value, state_init.serialize().hash))
|
|
94
|
+
|
|
95
|
+
async def get_wallet_address(self, owner_address: AddressLike) -> Address:
|
|
96
|
+
return await JettonMasterGetMethods.get_wallet_address(
|
|
97
|
+
client=self.client,
|
|
98
|
+
address=self.address,
|
|
99
|
+
owner_address=owner_address,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class JettonMasterStandard(BaseJettonMaster[DStandard, CStandard]):
|
|
104
|
+
_data_model = JettonMasterStandardData
|
|
105
|
+
VERSION = JettonMasterVersion.JettonMasterStandard
|
|
106
|
+
|
|
107
|
+
@classmethod
|
|
108
|
+
def _pack_jetton_wallet_data(
|
|
109
|
+
cls,
|
|
110
|
+
owner_address: AddressLike,
|
|
111
|
+
jetton_master_address: AddressLike,
|
|
112
|
+
jetton_wallet_code: Cell,
|
|
113
|
+
workchain: WorkchainID = WorkchainID.BASECHAIN,
|
|
114
|
+
) -> Cell:
|
|
115
|
+
cell = begin_cell()
|
|
116
|
+
cell.store_coins(0)
|
|
117
|
+
cell.store_address(owner_address)
|
|
118
|
+
cell.store_address(jetton_master_address)
|
|
119
|
+
cell.store_ref(jetton_wallet_code)
|
|
120
|
+
return cell.end_cell()
|
|
121
|
+
|
|
122
|
+
async def get_jetton_data(self) -> t.Tuple[
|
|
123
|
+
int,
|
|
124
|
+
bool,
|
|
125
|
+
Address,
|
|
126
|
+
ContentLike,
|
|
127
|
+
Cell,
|
|
128
|
+
]:
|
|
129
|
+
method_result = await JettonMasterGetMethods.get_jetton_data(
|
|
130
|
+
client=self.client,
|
|
131
|
+
address=self.address,
|
|
132
|
+
)
|
|
133
|
+
content_cs: Slice = method_result[3].begin_parse()
|
|
134
|
+
return (
|
|
135
|
+
method_result[0],
|
|
136
|
+
bool(method_result[1]),
|
|
137
|
+
method_result[2],
|
|
138
|
+
(
|
|
139
|
+
OnchainContent.deserialize(content_cs, False)
|
|
140
|
+
if content_cs.load_uint(8) == MetadataPrefix.ONCHAIN
|
|
141
|
+
else OffchainContent.deserialize(content_cs, False)
|
|
142
|
+
),
|
|
143
|
+
method_result[4],
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class JettonMasterStablecoin(BaseJettonMaster[DStablecoin, CStablecoin]):
|
|
148
|
+
_data_model = JettonMasterStablecoinData
|
|
149
|
+
VERSION = JettonMasterVersion.JettonMasterStablecoin
|
|
150
|
+
|
|
151
|
+
@classmethod
|
|
152
|
+
def _pack_jetton_wallet_data(
|
|
153
|
+
cls,
|
|
154
|
+
owner_address: AddressLike,
|
|
155
|
+
jetton_master_address: AddressLike,
|
|
156
|
+
jetton_wallet_code: Cell,
|
|
157
|
+
) -> Cell:
|
|
158
|
+
cell = begin_cell()
|
|
159
|
+
cell.store_uint(0, 4)
|
|
160
|
+
cell.store_coins(0)
|
|
161
|
+
cell.store_address(owner_address)
|
|
162
|
+
cell.store_address(jetton_master_address)
|
|
163
|
+
return cell.end_cell()
|
|
164
|
+
|
|
165
|
+
async def get_jetton_data(self) -> t.Tuple[
|
|
166
|
+
int,
|
|
167
|
+
bool,
|
|
168
|
+
Address,
|
|
169
|
+
OnchainContent,
|
|
170
|
+
Cell,
|
|
171
|
+
]:
|
|
172
|
+
method_result = await JettonMasterGetMethods.get_jetton_data(
|
|
173
|
+
client=self.client,
|
|
174
|
+
address=self.address,
|
|
175
|
+
)
|
|
176
|
+
content_cs: Slice = method_result[3]
|
|
177
|
+
return (
|
|
178
|
+
method_result[0],
|
|
179
|
+
bool(method_result[1]),
|
|
180
|
+
method_result[2],
|
|
181
|
+
OnchainContent.deserialize(content_cs, True),
|
|
182
|
+
method_result[4],
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def get_next_admin_address(self) -> t.Optional[Address]:
|
|
186
|
+
return await JettonMasterGetMethods.get_next_admin_address(
|
|
187
|
+
client=self.client,
|
|
188
|
+
address=self.address,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class JettonMasterStablecoinV2(JettonMasterStablecoin):
|
|
193
|
+
_SHARD_DEPTH: int = 8
|
|
194
|
+
VERSION = JettonMasterVersion.JettonMasterStablecoinV2
|
|
195
|
+
|
|
196
|
+
@classmethod
|
|
197
|
+
def _get_address_shard_prefix(cls, address: AddressLike) -> int:
|
|
198
|
+
if isinstance(address, str):
|
|
199
|
+
address = Address(address)
|
|
200
|
+
cs = address.to_cell().begin_parse()
|
|
201
|
+
return cs.skip_bits(3 + 8).preload_uint(8)
|
|
202
|
+
|
|
203
|
+
@classmethod
|
|
204
|
+
def _pack_jetton_wallet_data(
|
|
205
|
+
cls,
|
|
206
|
+
owner_address: AddressLike,
|
|
207
|
+
jetton_master_address: AddressLike,
|
|
208
|
+
jetton_wallet_code: Cell,
|
|
209
|
+
) -> Cell:
|
|
210
|
+
cell = begin_cell()
|
|
211
|
+
cell.store_coins(0)
|
|
212
|
+
cell.store_address(owner_address)
|
|
213
|
+
cell.store_address(jetton_master_address)
|
|
214
|
+
return cell.end_cell()
|
|
215
|
+
|
|
216
|
+
@classmethod
|
|
217
|
+
def _calculate_jetton_wallet_state_init_cell(
|
|
218
|
+
cls,
|
|
219
|
+
owner_address: AddressLike,
|
|
220
|
+
jetton_master_address: AddressLike,
|
|
221
|
+
jetton_wallet_code: t.Union[Cell, str],
|
|
222
|
+
) -> Cell:
|
|
223
|
+
code = to_cell(jetton_wallet_code)
|
|
224
|
+
data = cls._pack_jetton_wallet_data(
|
|
225
|
+
owner_address=owner_address,
|
|
226
|
+
jetton_master_address=jetton_master_address,
|
|
227
|
+
jetton_wallet_code=code,
|
|
228
|
+
)
|
|
229
|
+
cell = begin_cell()
|
|
230
|
+
cell.store_uint(1, 1)
|
|
231
|
+
cell.store_uint(cls._SHARD_DEPTH, 5)
|
|
232
|
+
cell.store_uint(0, 1)
|
|
233
|
+
cell.store_maybe_ref(code)
|
|
234
|
+
cell.store_maybe_ref(data)
|
|
235
|
+
cell.store_uint(0, 1)
|
|
236
|
+
return cell.end_cell()
|
|
237
|
+
|
|
238
|
+
@classmethod
|
|
239
|
+
def calculate_user_jetton_wallet_address(
|
|
240
|
+
cls,
|
|
241
|
+
owner_address: AddressLike,
|
|
242
|
+
jetton_master_address: AddressLike,
|
|
243
|
+
jetton_wallet_code: t.Union[Cell, str],
|
|
244
|
+
workchain: WorkchainID = WorkchainID.BASECHAIN,
|
|
245
|
+
) -> Address:
|
|
246
|
+
state_init_cell = cls._calculate_jetton_wallet_state_init_cell(
|
|
247
|
+
owner_address=owner_address,
|
|
248
|
+
jetton_master_address=jetton_master_address,
|
|
249
|
+
jetton_wallet_code=jetton_wallet_code,
|
|
250
|
+
)
|
|
251
|
+
shard_prefix = cls._get_address_shard_prefix(owner_address)
|
|
252
|
+
mask = (1 << (256 - cls._SHARD_DEPTH)) - 1
|
|
253
|
+
prefix_less = cell_hash(state_init_cell) & mask
|
|
254
|
+
cell = begin_cell()
|
|
255
|
+
cell.store_uint(4, 3)
|
|
256
|
+
cell.store_int(workchain.value, 8)
|
|
257
|
+
cell.store_uint(shard_prefix, cls._SHARD_DEPTH)
|
|
258
|
+
cell.store_uint(prefix_less, 256 - cls._SHARD_DEPTH)
|
|
259
|
+
return cell.end_cell().begin_parse().load_address()
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
|
|
3
|
+
from pytoniq_core import Address, Cell
|
|
4
|
+
|
|
5
|
+
from .get_methods import JettonWalletGetMethods
|
|
6
|
+
from ..base import BaseContract
|
|
7
|
+
from ...types import (
|
|
8
|
+
JettonWalletStandardData,
|
|
9
|
+
JettonWalletStablecoinData,
|
|
10
|
+
JettonWalletStablecoinV2Data,
|
|
11
|
+
JettonWalletVersion,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
D = t.TypeVar(
|
|
15
|
+
"D",
|
|
16
|
+
bound=t.Union[
|
|
17
|
+
JettonWalletStandardData,
|
|
18
|
+
JettonWalletStablecoinData,
|
|
19
|
+
JettonWalletStablecoinV2Data,
|
|
20
|
+
],
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class BaseJettonWallet(BaseContract[D]):
|
|
25
|
+
_data_model: t.Type[D]
|
|
26
|
+
|
|
27
|
+
@property
|
|
28
|
+
def jetton_balance(self) -> int:
|
|
29
|
+
return self.state_data.balance
|
|
30
|
+
|
|
31
|
+
@property
|
|
32
|
+
def owner_address(self) -> Address:
|
|
33
|
+
return self.state_data.owner_address
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def jetton_master_address(self) -> Address:
|
|
37
|
+
return self.state_data.jetton_master_address
|
|
38
|
+
|
|
39
|
+
async def get_wallet_data(self) -> t.Tuple[
|
|
40
|
+
int,
|
|
41
|
+
Address,
|
|
42
|
+
Address,
|
|
43
|
+
Cell,
|
|
44
|
+
]:
|
|
45
|
+
method_result = await JettonWalletGetMethods.get_wallet_data(
|
|
46
|
+
client=self.client,
|
|
47
|
+
address=self.address,
|
|
48
|
+
)
|
|
49
|
+
return (
|
|
50
|
+
method_result[0],
|
|
51
|
+
method_result[1],
|
|
52
|
+
method_result[2],
|
|
53
|
+
method_result[3],
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class JettonWalletStandard(BaseJettonWallet[JettonWalletStandardData]):
|
|
58
|
+
_data_model = JettonWalletStandardData
|
|
59
|
+
VERSION = JettonWalletVersion.JettonWalletStandard
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class JettonWalletStablecoin(BaseJettonWallet[JettonWalletStablecoinData]):
|
|
63
|
+
_data_model = JettonWalletStablecoinData
|
|
64
|
+
VERSION = JettonWalletVersion.JettonWalletStablecoin
|
|
65
|
+
|
|
66
|
+
async def get_status(self) -> int:
|
|
67
|
+
return await JettonWalletGetMethods.get_status(
|
|
68
|
+
client=self.client,
|
|
69
|
+
address=self.address,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class JettonWalletStablecoinV2(BaseJettonWallet[JettonWalletStablecoinV2Data]):
|
|
74
|
+
_data_model = JettonWalletStablecoinV2Data
|
|
75
|
+
VERSION = JettonWalletVersion.JettonWalletStablecoinV2
|
|
@@ -3,6 +3,10 @@ from .collection import (
|
|
|
3
3
|
NFTCollectionEditable,
|
|
4
4
|
NFTCollectionStandard,
|
|
5
5
|
)
|
|
6
|
+
from .get_methods import (
|
|
7
|
+
NFTCollectionGetMethods,
|
|
8
|
+
NFTItemGetMethods,
|
|
9
|
+
)
|
|
6
10
|
from .item import (
|
|
7
11
|
BaseNFTItem,
|
|
8
12
|
NFTItemEditable,
|
|
@@ -13,6 +17,8 @@ from .item import (
|
|
|
13
17
|
__all__ = [
|
|
14
18
|
"BaseNFTCollection",
|
|
15
19
|
"BaseNFTItem",
|
|
20
|
+
"NFTCollectionGetMethods",
|
|
21
|
+
"NFTItemGetMethods",
|
|
16
22
|
"NFTCollectionEditable",
|
|
17
23
|
"NFTCollectionStandard",
|
|
18
24
|
"NFTItemEditable",
|
|
@@ -12,10 +12,10 @@ from .get_methods import NFTCollectionGetMethods
|
|
|
12
12
|
from ..base import BaseContract
|
|
13
13
|
from ...types import (
|
|
14
14
|
AddressLike,
|
|
15
|
+
ContentLike,
|
|
15
16
|
NFTCollectionContent,
|
|
16
17
|
NFTCollectionData,
|
|
17
18
|
NFTCollectionVersion,
|
|
18
|
-
NFTItemVersion,
|
|
19
19
|
MetadataPrefix,
|
|
20
20
|
OnchainContent,
|
|
21
21
|
OffchainContent,
|
|
@@ -27,7 +27,6 @@ from ...utils import to_cell
|
|
|
27
27
|
|
|
28
28
|
class BaseNFTCollection(BaseContract[NFTCollectionData]):
|
|
29
29
|
_data_model = NFTCollectionData
|
|
30
|
-
NFT_ITEM_VERSION: NFTItemVersion
|
|
31
30
|
|
|
32
31
|
@property
|
|
33
32
|
def owner_address(self) -> Address:
|
|
@@ -62,7 +61,7 @@ class BaseNFTCollection(BaseContract[NFTCollectionData]):
|
|
|
62
61
|
|
|
63
62
|
async def get_collection_data(self) -> t.Tuple[
|
|
64
63
|
int,
|
|
65
|
-
|
|
64
|
+
ContentLike,
|
|
66
65
|
t.Optional[Address],
|
|
67
66
|
]:
|
|
68
67
|
method_result = await NFTCollectionGetMethods.get_collection_data(
|