diff --git a/docs/client.rst b/docs/client.rst index a363a864d..42f0cfde3 100644 --- a/docs/client.rst +++ b/docs/client.rst @@ -130,7 +130,8 @@ The possible statuses are: - **RECEIVED**: The transaction was received by the operator. - **PENDING**: The transaction passed the validation and is waiting to be sent on-chain. - **REJECTED**: The transaction failed validation and thus was skipped. -- **ACCEPTED_ONCHAIN**: The transaction was accepted on-chain. +- **ACCEPTED_ON_L1**: The transaction was accepted on layer 1. +- **ACCEPTED_ON_L2**: The transaction was accepted on layer 2. .. automethod:: Client.get_transaction .. automethod:: Client.get_transaction_sync diff --git a/poetry.lock b/poetry.lock index 695e47ad6..bc18a970e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -35,7 +35,7 @@ frozenlist = ">=1.1.0" name = "alabaster" version = "0.7.12" description = "A configurable sidebar-enabled Sphinx theme" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -123,7 +123,7 @@ tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (> name = "babel" version = "2.9.1" description = "Internationalization utilities" -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -178,7 +178,7 @@ python-versions = "~=3.5" [[package]] name = "cairo-lang" -version = "0.6.1" +version = "0.6.2" description = "Compiler and runner for the Cairo language" category = "main" optional = false @@ -275,7 +275,7 @@ cython = ["cython"] name = "docutils" version = "0.17.1" description = "Docutils -- Python Documentation Utilities" -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" @@ -523,7 +523,7 @@ python-versions = ">=3.5" name = "imagesize" version = "1.3.0" description = "Getting image size from png/jpeg/jpeg2000/gif file" -category = "dev" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" @@ -590,7 +590,7 @@ python-versions = ">=3.6" name = "jinja2" version = "3.0.3" description = "A very fast and expressive template engine." -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -651,7 +651,7 @@ python-versions = "*" name = "markupsafe" version = "2.0.1" description = "Safely add untrusted strings to HTML/XML markup." -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -909,7 +909,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" name = "pygments" version = "2.10.0" description = "Pygments is a syntax highlighting package written in Python." -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1000,7 +1000,7 @@ testing = ["coverage", "hypothesis (>=5.7.1)"] name = "pytz" version = "2021.3" description = "World timezone definitions, modern and historical" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -1067,7 +1067,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" name = "snowballstemmer" version = "2.2.0" description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms." -category = "dev" +category = "main" optional = false python-versions = "*" @@ -1075,7 +1075,7 @@ python-versions = "*" name = "sphinx" version = "4.3.1" description = "Python documentation generator" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -1121,7 +1121,7 @@ dev = ["transifex-client", "sphinxcontrib-httpdomain", "bump2version"] name = "sphinxcontrib-applehelp" version = "1.0.2" description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books" -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1133,7 +1133,7 @@ test = ["pytest"] name = "sphinxcontrib-devhelp" version = "1.0.2" description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document." -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1145,7 +1145,7 @@ test = ["pytest"] name = "sphinxcontrib-htmlhelp" version = "2.0.0" description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files" -category = "dev" +category = "main" optional = false python-versions = ">=3.6" @@ -1157,7 +1157,7 @@ test = ["pytest", "html5lib"] name = "sphinxcontrib-jsmath" version = "1.0.1" description = "A sphinx extension which renders display math in HTML via JavaScript" -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1168,7 +1168,7 @@ test = ["pytest", "flake8", "mypy"] name = "sphinxcontrib-qthelp" version = "1.0.3" description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document." -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1180,7 +1180,7 @@ test = ["pytest"] name = "sphinxcontrib-serializinghtml" version = "1.1.5" description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)." -category = "dev" +category = "main" optional = false python-versions = ">=3.5" @@ -1194,12 +1194,19 @@ version = "0.1.9" description = "A local testnet for Starknet" category = "dev" optional = false -python-versions = ">=3.7,<4.0" +python-versions = "^3.7" +develop = false [package.dependencies] -cairo-lang = "0.6.1" -Flask = {version = ">=2.0.2,<3.0.0", extras = ["async"]} -flask-cors = ">=3.0.10,<4.0.0" +cairo-lang = "0.6.2" +Flask = {version = "^2.0.2", extras = ["async"]} +flask-cors = "^3.0.10" + +[package.source] +type = "git" +url = "https://github.com/Shard-Labs/starknet-devnet.git" +reference = "update-v0.6.2" +resolved_reference = "909ed79c56ac8adcff4c960dd6b449e92b5dfbd3" [[package]] name = "sympy" @@ -1379,10 +1386,13 @@ python-versions = ">=3.6" docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +[extras] +docs = ["sphinx"] + [metadata] lock-version = "1.1" python-versions = "^3.7.12" -content-hash = "65565f0e886ad4516ebb1a7898c5adcc36bfa3aa714a2c030b8a41a74f2de578" +content-hash = "ca81a5e6528fb17fdd1116ad1a199391bc9a4f48b20637d0eda667ffb7cfc643" [metadata.files] aiohttp = [ @@ -1512,7 +1522,7 @@ cachetools = [ {file = "cachetools-4.2.4.tar.gz", hash = "sha256:89ea6f1b638d5a73a4f9226be57ac5e4f399d22770b92355f92dcb0f7f001693"}, ] cairo-lang = [ - {file = "cairo-lang-0.6.1.zip", hash = "sha256:84e61ae768eee8df9b9c29b31224564d0a21349eb7d6ef0b77e61dca85d985d6"}, + {file = "cairo-lang-0.6.2.zip", hash = "sha256:ff3cf5fd4c92e861f22c853ccb22ec384abdcb6c7fa042b93e16d5c6ace6b9a4"}, ] certifi = [ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, @@ -2241,10 +2251,7 @@ sphinxcontrib-serializinghtml = [ {file = "sphinxcontrib-serializinghtml-1.1.5.tar.gz", hash = "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"}, {file = "sphinxcontrib_serializinghtml-1.1.5-py2.py3-none-any.whl", hash = "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd"}, ] -starknet-devnet = [ - {file = "starknet_devnet-0.1.9-py3-none-any.whl", hash = "sha256:74423d980d20f7d135418c7df89d1e7f0882856332ed6eb33512fe51822a5163"}, - {file = "starknet_devnet-0.1.9.tar.gz", hash = "sha256:4a8d6df2d722c57e36737c728cc0a2a1678af60bf3a5ef9920bb30381a5d69b3"}, -] +starknet-devnet = [] sympy = [ {file = "sympy-1.9-py3-none-any.whl", hash = "sha256:8bc5de4608b7aa4e7ffd1b25452ae87ccc5f6ca667c661aafb854a1ade337d0c"}, {file = "sympy-1.9.tar.gz", hash = "sha256:c7a880e229df96759f955d4f3970d4cabce79f60f5b18830c08b90ce77cd5fdc"}, diff --git a/pyproject.toml b/pyproject.toml index d0f6709df..23744b7c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ documentation = "https://starknetpy.rtfd.io/" [tool.poetry.dependencies] python = "^3.7.12" -cairo-lang = "^0.6.0" +cairo-lang = "0.6.2" asgiref = "^3.4.1" sphinx = {version = "^4.3.1", optional = true} @@ -27,7 +27,7 @@ pytest = "^6.2.5" black = "^21.11b0" poethepoet = "^0.11.0" coverage = "^6.1.2" -starknet-devnet = "^0.1.9" +starknet-devnet = { git = "https://github.com/Shard-Labs/starknet-devnet.git", branch = "update-v0.6.2" } pytest-asyncio = "^0.16.0" sphinx-rtd-theme = "^1.0.0" pylint = "^2.12.2" diff --git a/starknet/constants.py b/starknet/constants.py index b34819cf0..f18578154 100644 --- a/starknet/constants.py +++ b/starknet/constants.py @@ -6,5 +6,8 @@ class TxStatus(Enum): NOT_RECEIVED = "NOT_RECEIVED" REJECTED = "REJECTED" PENDING = "PENDING" - ACCEPTED_ONCHAIN = "ACCEPTED_ONCHAIN" ACCEPTED_ON_L1 = "ACCEPTED_ON_L1" + ACCEPTED_ON_L2 = "ACCEPTED_ON_L2" + + +ACCEPTED_STATUSES = (TxStatus.ACCEPTED_ON_L1, TxStatus.ACCEPTED_ON_L2) diff --git a/starknet/net/client.py b/starknet/net/client.py index 67a1a7ab4..d47015336 100644 --- a/starknet/net/client.py +++ b/starknet/net/client.py @@ -9,7 +9,7 @@ from starkware.starknet.services.api.gateway.gateway_client import GatewayClient from services.external_api.base_client import RetryConfig, BadRequest as BadRequestError -from starknet.constants import TxStatus +from starknet.constants import TxStatus, ACCEPTED_STATUSES from starknet.utils.sync import add_sync_methods from starknet.utils.types import net_address_from_net, InvokeFunction, Transaction @@ -186,7 +186,7 @@ async def wait_for_tx( result = await self.get_transaction(tx_hash=tx_hash) status = TxStatus[result["status"]] - if status in (TxStatus.ACCEPTED_ONCHAIN, TxStatus.ACCEPTED_ON_L1): + if status in ACCEPTED_STATUSES: return result["block_number"], status if status == TxStatus.PENDING: if not wait_for_accept and "block_number" in result: