diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 621b499b..841ef416 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.35.1 +current_version = 0.36.0 commit = True tag = True diff --git a/docs/core/transaction.md b/docs/core/transaction.md deleted file mode 100644 index 14d96557..00000000 --- a/docs/core/transaction.md +++ /dev/null @@ -1,3 +0,0 @@ -# Transaction - -:::solana.transaction diff --git a/poetry.lock b/poetry.lock index 80f4985a..29750068 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,25 +1,25 @@ -# This file is automatically @generated by Poetry 1.8.4 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "anyio" -version = "4.6.2.post1" +version = "4.7.0" description = "High level compatibility layer for multiple asynchronous event loop implementations" optional = false python-versions = ">=3.9" files = [ - {file = "anyio-4.6.2.post1-py3-none-any.whl", hash = "sha256:6d170c36fba3bdd840c73d3868c1e777e33676a69c3a72cf0a0d5d6d8009b61d"}, - {file = "anyio-4.6.2.post1.tar.gz", hash = "sha256:4c8bc31ccdb51c7f7bd251f51c609e038d63e34219b44aa86e47576389880b4c"}, + {file = "anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352"}, + {file = "anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48"}, ] [package.dependencies] exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} idna = ">=2.8" sniffio = ">=1.1" -typing-extensions = {version = ">=4.1", markers = "python_version < \"3.11\""} +typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} [package.extras] -doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] -test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21.0b1)"] +doc = ["Sphinx (>=7.4,<8.0)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx_rtd_theme"] +test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "truststore (>=0.9.1)", "uvloop (>=0.21)"] trio = ["trio (>=0.26.1)"] [[package]] @@ -147,73 +147,73 @@ construct = "2.10.68" [[package]] name = "coverage" -version = "7.6.7" +version = "7.6.9" description = "Code coverage measurement for Python" optional = false python-versions = ">=3.9" files = [ - {file = "coverage-7.6.7-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:108bb458827765d538abcbf8288599fee07d2743357bdd9b9dad456c287e121e"}, - {file = "coverage-7.6.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c973b2fe4dc445cb865ab369df7521df9c27bf40715c837a113edaa2aa9faf45"}, - {file = "coverage-7.6.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3c6b24007c4bcd0b19fac25763a7cac5035c735ae017e9a349b927cfc88f31c1"}, - {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:acbb8af78f8f91b3b51f58f288c0994ba63c646bc1a8a22ad072e4e7e0a49f1c"}, - {file = "coverage-7.6.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad32a981bcdedb8d2ace03b05e4fd8dace8901eec64a532b00b15217d3677dd2"}, - {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:34d23e28ccb26236718a3a78ba72744212aa383141961dd6825f6595005c8b06"}, - {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e25bacb53a8c7325e34d45dddd2f2fbae0dbc230d0e2642e264a64e17322a777"}, - {file = "coverage-7.6.7-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:af05bbba896c4472a29408455fe31b3797b4d8648ed0a2ccac03e074a77e2314"}, - {file = "coverage-7.6.7-cp310-cp310-win32.whl", hash = "sha256:796c9b107d11d2d69e1849b2dfe41730134b526a49d3acb98ca02f4985eeff7a"}, - {file = "coverage-7.6.7-cp310-cp310-win_amd64.whl", hash = "sha256:987a8e3da7da4eed10a20491cf790589a8e5e07656b6dc22d3814c4d88faf163"}, - {file = "coverage-7.6.7-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7e61b0e77ff4dddebb35a0e8bb5a68bf0f8b872407d8d9f0c726b65dfabe2469"}, - {file = "coverage-7.6.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:1a5407a75ca4abc20d6252efeb238377a71ce7bda849c26c7a9bece8680a5d99"}, - {file = "coverage-7.6.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df002e59f2d29e889c37abd0b9ee0d0e6e38c24f5f55d71ff0e09e3412a340ec"}, - {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:673184b3156cba06154825f25af33baa2671ddae6343f23175764e65a8c4c30b"}, - {file = "coverage-7.6.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e69ad502f1a2243f739f5bd60565d14a278be58be4c137d90799f2c263e7049a"}, - {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:60dcf7605c50ea72a14490d0756daffef77a5be15ed1b9fea468b1c7bda1bc3b"}, - {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:9c2eb378bebb2c8f65befcb5147877fc1c9fbc640fc0aad3add759b5df79d55d"}, - {file = "coverage-7.6.7-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3c0317288f032221d35fa4cbc35d9f4923ff0dfd176c79c9b356e8ef8ef2dff4"}, - {file = "coverage-7.6.7-cp311-cp311-win32.whl", hash = "sha256:951aade8297358f3618a6e0660dc74f6b52233c42089d28525749fc8267dccd2"}, - {file = "coverage-7.6.7-cp311-cp311-win_amd64.whl", hash = "sha256:5e444b8e88339a2a67ce07d41faabb1d60d1004820cee5a2c2b54e2d8e429a0f"}, - {file = "coverage-7.6.7-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:f07ff574986bc3edb80e2c36391678a271d555f91fd1d332a1e0f4b5ea4b6ea9"}, - {file = "coverage-7.6.7-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:49ed5ee4109258973630c1f9d099c7e72c5c36605029f3a91fe9982c6076c82b"}, - {file = "coverage-7.6.7-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f3e8796434a8106b3ac025fd15417315d7a58ee3e600ad4dbcfddc3f4b14342c"}, - {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3b925300484a3294d1c70f6b2b810d6526f2929de954e5b6be2bf8caa1f12c1"}, - {file = "coverage-7.6.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c42ec2c522e3ddd683dec5cdce8e62817afb648caedad9da725001fa530d354"}, - {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:0266b62cbea568bd5e93a4da364d05de422110cbed5056d69339bd5af5685433"}, - {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:e5f2a0f161d126ccc7038f1f3029184dbdf8f018230af17ef6fd6a707a5b881f"}, - {file = "coverage-7.6.7-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c132b5a22821f9b143f87446805e13580b67c670a548b96da945a8f6b4f2efbb"}, - {file = "coverage-7.6.7-cp312-cp312-win32.whl", hash = "sha256:7c07de0d2a110f02af30883cd7dddbe704887617d5c27cf373362667445a4c76"}, - {file = "coverage-7.6.7-cp312-cp312-win_amd64.whl", hash = "sha256:fd49c01e5057a451c30c9b892948976f5d38f2cbd04dc556a82743ba8e27ed8c"}, - {file = "coverage-7.6.7-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:46f21663e358beae6b368429ffadf14ed0a329996248a847a4322fb2e35d64d3"}, - {file = "coverage-7.6.7-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:40cca284c7c310d622a1677f105e8507441d1bb7c226f41978ba7c86979609ab"}, - {file = "coverage-7.6.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77256ad2345c29fe59ae861aa11cfc74579c88d4e8dbf121cbe46b8e32aec808"}, - {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87ea64b9fa52bf395272e54020537990a28078478167ade6c61da7ac04dc14bc"}, - {file = "coverage-7.6.7-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2d608a7808793e3615e54e9267519351c3ae204a6d85764d8337bd95993581a8"}, - {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:cdd94501d65adc5c24f8a1a0eda110452ba62b3f4aeaba01e021c1ed9cb8f34a"}, - {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:82c809a62e953867cf57e0548c2b8464207f5f3a6ff0e1e961683e79b89f2c55"}, - {file = "coverage-7.6.7-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:bb684694e99d0b791a43e9fc0fa58efc15ec357ac48d25b619f207c41f2fd384"}, - {file = "coverage-7.6.7-cp313-cp313-win32.whl", hash = "sha256:963e4a08cbb0af6623e61492c0ec4c0ec5c5cf74db5f6564f98248d27ee57d30"}, - {file = "coverage-7.6.7-cp313-cp313-win_amd64.whl", hash = "sha256:14045b8bfd5909196a90da145a37f9d335a5d988a83db34e80f41e965fb7cb42"}, - {file = "coverage-7.6.7-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:f2c7a045eef561e9544359a0bf5784b44e55cefc7261a20e730baa9220c83413"}, - {file = "coverage-7.6.7-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5dd4e4a49d9c72a38d18d641135d2fb0bdf7b726ca60a103836b3d00a1182acd"}, - {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5c95e0fa3d1547cb6f021ab72f5c23402da2358beec0a8e6d19a368bd7b0fb37"}, - {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f63e21ed474edd23f7501f89b53280014436e383a14b9bd77a648366c81dce7b"}, - {file = "coverage-7.6.7-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ead9b9605c54d15be228687552916c89c9683c215370c4a44f1f217d2adcc34d"}, - {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:0573f5cbf39114270842d01872952d301027d2d6e2d84013f30966313cadb529"}, - {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:e2c8e3384c12dfa19fa9a52f23eb091a8fad93b5b81a41b14c17c78e23dd1d8b"}, - {file = "coverage-7.6.7-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:70a56a2ec1869e6e9fa69ef6b76b1a8a7ef709972b9cc473f9ce9d26b5997ce3"}, - {file = "coverage-7.6.7-cp313-cp313t-win32.whl", hash = "sha256:dbba8210f5067398b2c4d96b4e64d8fb943644d5eb70be0d989067c8ca40c0f8"}, - {file = "coverage-7.6.7-cp313-cp313t-win_amd64.whl", hash = "sha256:dfd14bcae0c94004baba5184d1c935ae0d1231b8409eb6c103a5fd75e8ecdc56"}, - {file = "coverage-7.6.7-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:37a15573f988b67f7348916077c6d8ad43adb75e478d0910957394df397d2874"}, - {file = "coverage-7.6.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b6cce5c76985f81da3769c52203ee94722cd5d5889731cd70d31fee939b74bf0"}, - {file = "coverage-7.6.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ab9763d291a17b527ac6fd11d1a9a9c358280adb320e9c2672a97af346ac2c"}, - {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6cf96ceaa275f071f1bea3067f8fd43bec184a25a962c754024c973af871e1b7"}, - {file = "coverage-7.6.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aee9cf6b0134d6f932d219ce253ef0e624f4fa588ee64830fcba193269e4daa3"}, - {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:2bc3e45c16564cc72de09e37413262b9f99167803e5e48c6156bccdfb22c8327"}, - {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:623e6965dcf4e28a3debaa6fcf4b99ee06d27218f46d43befe4db1c70841551c"}, - {file = "coverage-7.6.7-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:850cfd2d6fc26f8346f422920ac204e1d28814e32e3a58c19c91980fa74d8289"}, - {file = "coverage-7.6.7-cp39-cp39-win32.whl", hash = "sha256:c296263093f099da4f51b3dff1eff5d4959b527d4f2f419e16508c5da9e15e8c"}, - {file = "coverage-7.6.7-cp39-cp39-win_amd64.whl", hash = "sha256:90746521206c88bdb305a4bf3342b1b7316ab80f804d40c536fc7d329301ee13"}, - {file = "coverage-7.6.7-pp39.pp310-none-any.whl", hash = "sha256:0ddcb70b3a3a57581b450571b31cb774f23eb9519c2aaa6176d3a84c9fc57671"}, - {file = "coverage-7.6.7.tar.gz", hash = "sha256:d79d4826e41441c9a118ff045e4bccb9fdbdcb1d02413e7ea6eb5c87b5439d24"}, + {file = "coverage-7.6.9-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:85d9636f72e8991a1706b2b55b06c27545448baf9f6dbf51c4004609aacd7dcb"}, + {file = "coverage-7.6.9-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:608a7fd78c67bee8936378299a6cb9f5149bb80238c7a566fc3e6717a4e68710"}, + {file = "coverage-7.6.9-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:96d636c77af18b5cb664ddf12dab9b15a0cfe9c0bde715da38698c8cea748bfa"}, + {file = "coverage-7.6.9-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d75cded8a3cff93da9edc31446872d2997e327921d8eed86641efafd350e1df1"}, + {file = "coverage-7.6.9-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f7b15f589593110ae767ce997775d645b47e5cbbf54fd322f8ebea6277466cec"}, + {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:44349150f6811b44b25574839b39ae35291f6496eb795b7366fef3bd3cf112d3"}, + {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:d891c136b5b310d0e702e186d70cd16d1119ea8927347045124cb286b29297e5"}, + {file = "coverage-7.6.9-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:db1dab894cc139f67822a92910466531de5ea6034ddfd2b11c0d4c6257168073"}, + {file = "coverage-7.6.9-cp310-cp310-win32.whl", hash = "sha256:41ff7b0da5af71a51b53f501a3bac65fb0ec311ebed1632e58fc6107f03b9198"}, + {file = "coverage-7.6.9-cp310-cp310-win_amd64.whl", hash = "sha256:35371f8438028fdccfaf3570b31d98e8d9eda8bb1d6ab9473f5a390969e98717"}, + {file = "coverage-7.6.9-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:932fc826442132dde42ee52cf66d941f581c685a6313feebed358411238f60f9"}, + {file = "coverage-7.6.9-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:085161be5f3b30fd9b3e7b9a8c301f935c8313dcf928a07b116324abea2c1c2c"}, + {file = "coverage-7.6.9-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ccc660a77e1c2bf24ddbce969af9447a9474790160cfb23de6be4fa88e3951c7"}, + {file = "coverage-7.6.9-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c69e42c892c018cd3c8d90da61d845f50a8243062b19d228189b0224150018a9"}, + {file = "coverage-7.6.9-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0824a28ec542a0be22f60c6ac36d679e0e262e5353203bea81d44ee81fe9c6d4"}, + {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:4401ae5fc52ad8d26d2a5d8a7428b0f0c72431683f8e63e42e70606374c311a1"}, + {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:98caba4476a6c8d59ec1eb00c7dd862ba9beca34085642d46ed503cc2d440d4b"}, + {file = "coverage-7.6.9-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ee5defd1733fd6ec08b168bd4f5387d5b322f45ca9e0e6c817ea6c4cd36313e3"}, + {file = "coverage-7.6.9-cp311-cp311-win32.whl", hash = "sha256:f2d1ec60d6d256bdf298cb86b78dd715980828f50c46701abc3b0a2b3f8a0dc0"}, + {file = "coverage-7.6.9-cp311-cp311-win_amd64.whl", hash = "sha256:0d59fd927b1f04de57a2ba0137166d31c1a6dd9e764ad4af552912d70428c92b"}, + {file = "coverage-7.6.9-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:99e266ae0b5d15f1ca8d278a668df6f51cc4b854513daab5cae695ed7b721cf8"}, + {file = "coverage-7.6.9-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9901d36492009a0a9b94b20e52ebfc8453bf49bb2b27bca2c9706f8b4f5a554a"}, + {file = "coverage-7.6.9-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:abd3e72dd5b97e3af4246cdada7738ef0e608168de952b837b8dd7e90341f015"}, + {file = "coverage-7.6.9-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ff74026a461eb0660366fb01c650c1d00f833a086b336bdad7ab00cc952072b3"}, + {file = "coverage-7.6.9-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65dad5a248823a4996724a88eb51d4b31587aa7aa428562dbe459c684e5787ae"}, + {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:22be16571504c9ccea919fcedb459d5ab20d41172056206eb2994e2ff06118a4"}, + {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:0f957943bc718b87144ecaee70762bc2bc3f1a7a53c7b861103546d3a403f0a6"}, + {file = "coverage-7.6.9-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0ae1387db4aecb1f485fb70a6c0148c6cdaebb6038f1d40089b1fc84a5db556f"}, + {file = "coverage-7.6.9-cp312-cp312-win32.whl", hash = "sha256:1a330812d9cc7ac2182586f6d41b4d0fadf9be9049f350e0efb275c8ee8eb692"}, + {file = "coverage-7.6.9-cp312-cp312-win_amd64.whl", hash = "sha256:b12c6b18269ca471eedd41c1b6a1065b2f7827508edb9a7ed5555e9a56dcfc97"}, + {file = "coverage-7.6.9-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:899b8cd4781c400454f2f64f7776a5d87bbd7b3e7f7bda0cb18f857bb1334664"}, + {file = "coverage-7.6.9-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:61f70dc68bd36810972e55bbbe83674ea073dd1dcc121040a08cdf3416c5349c"}, + {file = "coverage-7.6.9-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8a289d23d4c46f1a82d5db4abeb40b9b5be91731ee19a379d15790e53031c014"}, + {file = "coverage-7.6.9-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7e216d8044a356fc0337c7a2a0536d6de07888d7bcda76febcb8adc50bdbbd00"}, + {file = "coverage-7.6.9-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3c026eb44f744acaa2bda7493dad903aa5bf5fc4f2554293a798d5606710055d"}, + {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e77363e8425325384f9d49272c54045bbed2f478e9dd698dbc65dbc37860eb0a"}, + {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:777abfab476cf83b5177b84d7486497e034eb9eaea0d746ce0c1268c71652077"}, + {file = "coverage-7.6.9-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:447af20e25fdbe16f26e84eb714ba21d98868705cb138252d28bc400381f6ffb"}, + {file = "coverage-7.6.9-cp313-cp313-win32.whl", hash = "sha256:d872ec5aeb086cbea771c573600d47944eea2dcba8be5f3ee649bfe3cb8dc9ba"}, + {file = "coverage-7.6.9-cp313-cp313-win_amd64.whl", hash = "sha256:fd1213c86e48dfdc5a0cc676551db467495a95a662d2396ecd58e719191446e1"}, + {file = "coverage-7.6.9-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:ba9e7484d286cd5a43744e5f47b0b3fb457865baf07bafc6bee91896364e1419"}, + {file = "coverage-7.6.9-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e5ea1cf0872ee455c03e5674b5bca5e3e68e159379c1af0903e89f5eba9ccc3a"}, + {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d10e07aa2b91835d6abec555ec8b2733347956991901eea6ffac295f83a30e4"}, + {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:13a9e2d3ee855db3dd6ea1ba5203316a1b1fd8eaeffc37c5b54987e61e4194ae"}, + {file = "coverage-7.6.9-cp313-cp313t-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c38bf15a40ccf5619fa2fe8f26106c7e8e080d7760aeccb3722664c8656b030"}, + {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:d5275455b3e4627c8e7154feaf7ee0743c2e7af82f6e3b561967b1cca755a0be"}, + {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:8f8770dfc6e2c6a2d4569f411015c8d751c980d17a14b0530da2d7f27ffdd88e"}, + {file = "coverage-7.6.9-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8d2dfa71665a29b153a9681edb1c8d9c1ea50dfc2375fb4dac99ea7e21a0bcd9"}, + {file = "coverage-7.6.9-cp313-cp313t-win32.whl", hash = "sha256:5e6b86b5847a016d0fbd31ffe1001b63355ed309651851295315031ea7eb5a9b"}, + {file = "coverage-7.6.9-cp313-cp313t-win_amd64.whl", hash = "sha256:97ddc94d46088304772d21b060041c97fc16bdda13c6c7f9d8fcd8d5ae0d8611"}, + {file = "coverage-7.6.9-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:adb697c0bd35100dc690de83154627fbab1f4f3c0386df266dded865fc50a902"}, + {file = "coverage-7.6.9-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:be57b6d56e49c2739cdf776839a92330e933dd5e5d929966fbbd380c77f060be"}, + {file = "coverage-7.6.9-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1592791f8204ae9166de22ba7e6705fa4ebd02936c09436a1bb85aabca3e599"}, + {file = "coverage-7.6.9-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4e12ae8cc979cf83d258acb5e1f1cf2f3f83524d1564a49d20b8bec14b637f08"}, + {file = "coverage-7.6.9-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bb5555cff66c4d3d6213a296b360f9e1a8e323e74e0426b6c10ed7f4d021e464"}, + {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:b9389a429e0e5142e69d5bf4a435dd688c14478a19bb901735cdf75e57b13845"}, + {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:592ac539812e9b46046620341498caf09ca21023c41c893e1eb9dbda00a70cbf"}, + {file = "coverage-7.6.9-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:a27801adef24cc30871da98a105f77995e13a25a505a0161911f6aafbd66e678"}, + {file = "coverage-7.6.9-cp39-cp39-win32.whl", hash = "sha256:8e3c3e38930cfb729cb8137d7f055e5a473ddaf1217966aa6238c88bd9fd50e6"}, + {file = "coverage-7.6.9-cp39-cp39-win_amd64.whl", hash = "sha256:e28bf44afa2b187cc9f41749138a64435bf340adfcacb5b2290c070ce99839d4"}, + {file = "coverage-7.6.9-pp39.pp310-none-any.whl", hash = "sha256:f3ca78518bc6bc92828cd11867b121891d75cae4ea9e908d72030609b996db1b"}, + {file = "coverage-7.6.9.tar.gz", hash = "sha256:4a8d8977b0c6ef5aeadcb644da9e69ae0dcfe66ec7f368c89c72e058bd71164d"}, ] [package.dependencies] @@ -301,13 +301,13 @@ trio = ["trio (>=0.22.0,<1.0)"] [[package]] name = "httpx" -version = "0.27.2" +version = "0.28.1" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpx-0.27.2-py3-none-any.whl", hash = "sha256:7bb2708e112d8fdd7829cd4243970f0c223274051cb35ee80c03301ee29a3df0"}, - {file = "httpx-0.27.2.tar.gz", hash = "sha256:f7c2be1d2f3c3c3160d441802406b206c2b76f5947b11115e6df10c6c65e66c2"}, + {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, + {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, ] [package.dependencies] @@ -315,7 +315,6 @@ anyio = "*" certifi = "*" httpcore = "==1.*" idna = "*" -sniffio = "*" [package.extras] brotli = ["brotli", "brotlicffi"] @@ -1069,13 +1068,13 @@ files = [ [[package]] name = "six" -version = "1.16.0" +version = "1.17.0" description = "Python 2 and 3 compatibility utilities" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, - {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, + {file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"}, + {file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"}, ] [[package]] @@ -1091,20 +1090,20 @@ files = [ [[package]] name = "solders" -version = "0.21.0" +version = "0.23.0" description = "Python bindings for Solana Rust tools" optional = false python-versions = ">=3.7" files = [ - {file = "solders-0.21.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:7df88e59aea016644c0b2eac84f2f931d5aa570c654132770263b26f2928fdb7"}, - {file = "solders-0.21.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a11dfc5933707c466880ef2116f1bffc74659bf677b79479f4280247d60543c9"}, - {file = "solders-0.21.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33a28fedff80defd01455844700e3b9924c06a87d7ca93aff0a9298a9eb902ac"}, - {file = "solders-0.21.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:3ac70badd0da7e0d87db1c9c2edac63e48470903fd5f28e2fd6b22c7624ef52f"}, - {file = "solders-0.21.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ac79feca36470945ac026433828d4105a4b3bada5422ea77b1083c0e8fe93872"}, - {file = "solders-0.21.0-cp37-abi3-musllinux_1_2_i686.whl", hash = "sha256:6993e2e1709aa04b94267597dc31e29ae5625cde3d65fdf452c6366c6c7f41cd"}, - {file = "solders-0.21.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9521974ffa8b0fc8a4aa3b65f9057392c214a814c10af4f8cd2ad1d3f943ae61"}, - {file = "solders-0.21.0-cp37-abi3-win_amd64.whl", hash = "sha256:7258b0faa97ab3dc2e1951082af63f2971f178519540f7abac43ec2385d84b7f"}, - {file = "solders-0.21.0.tar.gz", hash = "sha256:a228c09b690f215acb01c55e17246efdfdb7c013f7332b057ecd0499363868ad"}, + {file = "solders-0.23.0-cp37-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:87c2865f4f634abf56cc3fe9cfea985ddd0a09097d01b7716ed83ff6ef2ad1c6"}, + {file = "solders-0.23.0-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:183fdc05ed0d6004d24bef17c01794a17be4a90f71c31429207bf33ec2e7738d"}, + {file = "solders-0.23.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1ba84ec23fc7af821dc7e5b48a6d247ae36b86457f930cbc64afa79587e4caf"}, + {file = "solders-0.23.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:37d097f4a3e55e8870b9a81e7675834aa9b516e956c8b0c18adcac742573378c"}, + {file = "solders-0.23.0-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6319929399fdd04d10c5cebbd76993e58d92ade05febec5a488eed7810aae270"}, + {file = "solders-0.23.0-cp37-abi3-musllinux_1_2_i686.whl", hash = "sha256:67514b6dc2ecec9e15198e70eac329eac7b191f0f063c6ab80748b9ff921c3d5"}, + {file = "solders-0.23.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9cb2360a47f3f4772903dfb3314ec57b637f7fc8ac30690fec28d48e16edacf4"}, + {file = "solders-0.23.0-cp37-abi3-win_amd64.whl", hash = "sha256:2976f6589a5a0a45600aee83b34312ad0d96ea03f8d358493143fc01223997c3"}, + {file = "solders-0.23.0.tar.gz", hash = "sha256:f25e8908cca40a766a99dee1aa983fb7816949201b40ec927d0802debd3ec0e4"}, ] [package.dependencies] @@ -1113,13 +1112,43 @@ typing-extensions = ">=4.2.0" [[package]] name = "tomli" -version = "2.1.0" +version = "2.2.1" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" files = [ - {file = "tomli-2.1.0-py3-none-any.whl", hash = "sha256:a5c57c3d1c56f5ccdf89f6523458f60ef716e210fc47c4cfb188c5ba473e0391"}, - {file = "tomli-2.1.0.tar.gz", hash = "sha256:3f646cae2aec94e17d04973e4249548320197cfabdf130015d023de4b74d8ab8"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"}, + {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ece47d672db52ac607a3d9599a9d48dcb2f2f735c6c2d1f34130085bb12b112a"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6972ca9c9cc9f0acaa56a8ca1ff51e7af152a9f87fb64623e31d5c83700080ee"}, + {file = "tomli-2.2.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c954d2250168d28797dd4e3ac5cf812a406cd5a92674ee4c8f123c889786aa8e"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:8dd28b3e155b80f4d54beb40a441d366adcfe740969820caf156c019fb5c7ec4"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:e59e304978767a54663af13c07b3d1af22ddee3bb2fb0618ca1593e4f593a106"}, + {file = "tomli-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:33580bccab0338d00994d7f16f4c4ec25b776af3ffaac1ed74e0b3fc95e885a8"}, + {file = "tomli-2.2.1-cp311-cp311-win32.whl", hash = "sha256:465af0e0875402f1d226519c9904f37254b3045fc5084697cefb9bdde1ff99ff"}, + {file = "tomli-2.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:2d0f2fdd22b02c6d81637a3c95f8cd77f995846af7414c5c4b8d0545afa1bc4b"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:4a8f6e44de52d5e6c657c9fe83b562f5f4256d8ebbfe4ff922c495620a7f6cea"}, + {file = "tomli-2.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8d57ca8095a641b8237d5b079147646153d22552f1c637fd3ba7f4b0b29167a8"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e340144ad7ae1533cb897d406382b4b6fede8890a03738ff1683af800d54192"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db2b95f9de79181805df90bedc5a5ab4c165e6ec3fe99f970d0e302f384ad222"}, + {file = "tomli-2.2.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40741994320b232529c802f8bc86da4e1aa9f413db394617b9a256ae0f9a7f77"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:400e720fe168c0f8521520190686ef8ef033fb19fc493da09779e592861b78c6"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:02abe224de6ae62c19f090f68da4e27b10af2b93213d36cf44e6e1c5abd19fdd"}, + {file = "tomli-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b82ebccc8c8a36f2094e969560a1b836758481f3dc360ce9a3277c65f374285e"}, + {file = "tomli-2.2.1-cp312-cp312-win32.whl", hash = "sha256:889f80ef92701b9dbb224e49ec87c645ce5df3fa2cc548664eb8a25e03127a98"}, + {file = "tomli-2.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:7fc04e92e1d624a4a63c76474610238576942d6b8950a2d7f908a340494e67e4"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f4039b9cbc3048b2416cc57ab3bda989a6fcf9b36cf8937f01a6e731b64f80d7"}, + {file = "tomli-2.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:286f0ca2ffeeb5b9bd4fcc8d6c330534323ec51b2f52da063b11c502da16f30c"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a92ef1a44547e894e2a17d24e7557a5e85a9e1d0048b0b5e7541f76c5032cb13"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9316dc65bed1684c9a98ee68759ceaed29d229e985297003e494aa825ebb0281"}, + {file = "tomli-2.2.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e85e99945e688e32d5a35c1ff38ed0b3f41f43fad8df0bdf79f72b2ba7bc5272"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ac065718db92ca818f8d6141b5f66369833d4a80a9d74435a268c52bdfa73140"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:d920f33822747519673ee656a4b6ac33e382eca9d331c87770faa3eef562aeb2"}, + {file = "tomli-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a198f10c4d1b1375d7687bc25294306e551bf1abfa4eace6650070a5c1ae2744"}, + {file = "tomli-2.2.1-cp313-cp313-win32.whl", hash = "sha256:d3f5614314d758649ab2ab3a62d4f2004c825922f9e370b29416484086b264ec"}, + {file = "tomli-2.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:a38aa0308e754b0e3c67e344754dff64999ff9b513e691d0e786265c93583c69"}, + {file = "tomli-2.2.1-py3-none-any.whl", hash = "sha256:cb55c73c5f4408779d0cf3eef9f762b9c9f147a77de7b258bef0a5628adc85cc"}, + {file = "tomli-2.2.1.tar.gz", hash = "sha256:cd45e1dc79c835ce60f7404ec8119f2eb06d38b1deba146f07ced3bbc44505ff"}, ] [[package]] @@ -1294,4 +1323,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "2bda9bd0b0d4d18d63d69cc17448d4f7353ca298e9c6ed9c6666a6c25b7745d9" +content-hash = "af080e4b2b6a74aa7e4c57747d801bc7ed86ea280fc07654e862063eb87b94ed" diff --git a/pyproject.toml b/pyproject.toml index 68f4e7c4..8f76f2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "solana" -version = "0.35.1" +version = "0.36.0" description = "Solana Python API" authors = [ "Michael Huang ", @@ -32,7 +32,7 @@ construct-typing = "^0.5.2" httpx = ">=0.23.0" typing-extensions = ">=4.2.0" websockets = ">=9.0,<=12.0" -solders = "^0.21.0" +solders = "^0.23.0" [tool.poetry.dev-dependencies] pytest = "^7.4.3" diff --git a/src/solana/rpc/api.py b/src/solana/rpc/api.py index 5cae1cfd..b5811d4f 100644 --- a/src/solana/rpc/api.py +++ b/src/solana/rpc/api.py @@ -4,10 +4,7 @@ from time import sleep, time from typing import Dict, List, Optional, Sequence, Union -from warnings import warn -from solders.hash import Hash as Blockhash -from solders.keypair import Keypair from solders.message import VersionedMessage from solders.pubkey import Pubkey from solders.rpc.responses import ( @@ -43,7 +40,6 @@ GetSignatureStatusesResp, GetSlotLeaderResp, GetSlotResp, - GetStakeActivationResp, GetSupplyResp, GetTokenAccountBalanceResp, GetTokenAccountsByDelegateJsonParsedResp, @@ -67,9 +63,8 @@ from solders.transaction import Transaction, VersionedTransaction from solana.rpc import types -from solana.transaction import Transaction as LegacyTransaction -from .commitment import Commitment, Finalized +from .commitment import Commitment from .core import ( _COMMITMENT_TO_SOLDERS, RPCException, @@ -765,29 +760,6 @@ def get_slot_leader(self, commitment: Optional[Commitment] = None) -> GetSlotLea body = self._get_slot_leader_body(commitment) return self._provider.make_request(body, GetSlotLeaderResp) - def get_stake_activation( - self, - pubkey: Pubkey, - epoch: Optional[int] = None, - commitment: Optional[Commitment] = None, - ) -> GetStakeActivationResp: - """Returns epoch activation information for a stake account. - - Args: - pubkey: Pubkey of stake account to query - epoch: (optional) Epoch for which to calculate activation details. If parameter not provided, - defaults to current epoch. - commitment: Bank state to query. It can be either "finalized", "confirmed" or "processed". - - Example: - >>> solana_client = Client("http://localhost:8899") - >>> solana_client.get_stake_activation().value.active # doctest: +SKIP - 124429280 - """ - warn("get_stake_activation is deprecated. Use get_account_info instead.", DeprecationWarning, stacklevel=1) - body = self._get_stake_activation_body(pubkey, epoch, commitment) - return self._provider.make_request(body, GetStakeActivationResp) - def get_supply(self, commitment: Optional[Commitment] = None) -> GetSupplyResp: """Returns information about the current supply. @@ -1003,62 +975,6 @@ def send_raw_transaction(self, txn: bytes, opts: Optional[types.TxOpts] = None) post_send_args = self._send_raw_transaction_post_send_args(resp, opts_to_use) return self.__post_send_with_confirm(*post_send_args) - def send_legacy_transaction( - self, - txn: LegacyTransaction, - *signers: Keypair, - opts: Optional[types.TxOpts] = None, - recent_blockhash: Optional[Blockhash] = None, - ) -> SendTransactionResp: - """Send a legacy transaction. - - Args: - txn: transaction object. - signers: Signers to sign the transaction. Only supported for legacy Transaction. - opts: (optional) Transaction options. - recent_blockhash: (optional) Pass a valid recent blockhash here if you want to - skip fetching the recent blockhash or relying on the cache. - Only supported for legacy Transaction. - - Example: - >>> from solders.keypair import Keypair - >>> from solders.pubkey import Pubkey - >>> from solana.rpc.api import Client - >>> from solders.system_program import TransferParams, transfer - >>> from solana.transaction import Transaction - >>> leading_zeros = [0] * 31 - >>> sender, receiver = Keypair.from_seed(leading_zeros + [1]), Keypair.from_seed(leading_zeros + [2]) - >>> txn = Transaction().add(transfer(TransferParams( - ... from_pubkey=sender.pubkey(), to_pubkey=receiver.pubkey(), lamports=1000))) - >>> solana_client = Client("http://localhost:8899") - >>> solana_client.send_transaction(txn, sender).value # doctest: +SKIP - Signature( - 1111111111111111111111111111111111111111111111111111111111111111, - ) - """ - warn("send_legacy_transaction is deprecated. Use send_transaction instead.", DeprecationWarning, stacklevel=1) - - last_valid_block_height = None - if recent_blockhash is None: - blockhash_resp = self.get_latest_blockhash(Finalized) - recent_blockhash = self.parse_recent_blockhash(blockhash_resp) - last_valid_block_height = blockhash_resp.value.last_valid_block_height - - txn.recent_blockhash = recent_blockhash - - txn.sign(*signers) - opts_to_use = ( - types.TxOpts( - preflight_commitment=self._commitment, - last_valid_block_height=last_valid_block_height, - ) - if opts is None - else opts - ) - - txn_resp = self.send_raw_transaction(txn.serialize(), opts=opts_to_use) - return txn_resp - def send_transaction( self, txn: Union[VersionedTransaction, Transaction], diff --git a/src/solana/rpc/async_api.py b/src/solana/rpc/async_api.py index 933dda58..c0579070 100644 --- a/src/solana/rpc/async_api.py +++ b/src/solana/rpc/async_api.py @@ -3,10 +3,7 @@ import asyncio from time import time from typing import Dict, List, Optional, Sequence, Union -from warnings import warn -from solders.hash import Hash as Blockhash -from solders.keypair import Keypair from solders.message import VersionedMessage from solders.pubkey import Pubkey from solders.rpc.responses import ( @@ -42,7 +39,6 @@ GetSignatureStatusesResp, GetSlotLeaderResp, GetSlotResp, - GetStakeActivationResp, GetSupplyResp, GetTokenAccountBalanceResp, GetTokenAccountsByDelegateJsonParsedResp, @@ -65,9 +61,8 @@ from solders.transaction import Transaction, VersionedTransaction from solana.rpc import types -from solana.transaction import Transaction as LegacyTransaction -from .commitment import Commitment, Finalized +from .commitment import Commitment from .core import ( _COMMITMENT_TO_SOLDERS, TransactionExpiredBlockheightExceededError, @@ -776,29 +771,6 @@ async def get_slot_leader(self, commitment: Optional[Commitment] = None) -> GetS body = self._get_slot_leader_body(commitment) return await self._provider.make_request(body, GetSlotLeaderResp) - async def get_stake_activation( - self, - pubkey: Pubkey, - epoch: Optional[int] = None, - commitment: Optional[Commitment] = None, - ) -> GetStakeActivationResp: - """Returns epoch activation information for a stake account. - - Args: - pubkey: Pubkey of stake account to query - epoch: (optional) Epoch for which to calculate activation details. If parameter not provided, - defaults to current epoch. - commitment: Bank state to query. It can be either "finalized", "confirmed" or "processed". - - Example: - >>> solana_client = AsyncClient("http://localhost:8899") - >>> (await solana_client.get_stake_activation()).value.active # doctest: +SKIP - 124429280 - """ - warn("get_stake_activation is deprecated. Use get_account_info instead.", DeprecationWarning, stacklevel=1) - body = self._get_stake_activation_body(pubkey, epoch, commitment) - return await self._provider.make_request(body, GetStakeActivationResp) - async def get_supply(self, commitment: Optional[Commitment] = None) -> GetSupplyResp: """Returns information about the current supply. @@ -1016,59 +988,6 @@ async def send_raw_transaction(self, txn: bytes, opts: Optional[types.TxOpts] = post_send_args = self._send_raw_transaction_post_send_args(resp, opts_to_use) return await self.__post_send_with_confirm(*post_send_args) - async def send_legacy_transaction( - self, - txn: LegacyTransaction, - *signers: Keypair, - opts: Optional[types.TxOpts] = None, - recent_blockhash: Optional[Blockhash] = None, - ) -> SendTransactionResp: - """Send a legacy transaction. - - Args: - txn: transaction object. - signers: Signers to sign the transaction. Only supported for legacy Transaction. - opts: (optional) Transaction options. - recent_blockhash: (optional) Pass a valid recent blockhash here if you want to - skip fetching the recent blockhash or relying on the cache. - Only supported for legacy Transaction. - - Example: - >>> from solders.keypair import Keypair - >>> from solders.system_program import TransferParams, transfer - >>> from solana.transaction import Transaction - >>> leading_zeros = [0] * 31 - >>> sender, receiver = Keypair.from_seed(leading_zeros + [1]), Keypair.from_seed(leading_zeros + [2]) - >>> txn = Transaction().add(transfer(TransferParams( - ... from_pubkey=sender.pubkey(), to_pubkey=receiver.pubkey(), lamports=1000))) - >>> solana_client = AsyncClient("http://localhost:8899") - >>> (await solana_client.send_transaction(txn, sender)).value # doctest: +SKIP - Signature( - 1111111111111111111111111111111111111111111111111111111111111111, - ) - """ - warn("send_legacy_transaction is deprecated. Use send_transaction instead.", DeprecationWarning, stacklevel=1) - - last_valid_block_height = None - if recent_blockhash is None: - blockhash_resp = await self.get_latest_blockhash(Finalized) - recent_blockhash = self.parse_recent_blockhash(blockhash_resp) - last_valid_block_height = blockhash_resp.value.last_valid_block_height - - txn.recent_blockhash = recent_blockhash - - txn.sign(*signers) - opts_to_use = ( - types.TxOpts( - preflight_commitment=self._commitment, - last_valid_block_height=last_valid_block_height, - ) - if opts is None - else opts - ) - txn_resp = await self.send_raw_transaction(txn.serialize(), opts=opts_to_use) - return txn_resp - async def send_transaction( self, txn: Union[VersionedTransaction, Transaction], diff --git a/src/solana/transaction.py b/src/solana/transaction.py deleted file mode 100644 index eec75510..00000000 --- a/src/solana/transaction.py +++ /dev/null @@ -1,353 +0,0 @@ -"""Library to package an atomic sequence of instructions to a transaction.""" - -from __future__ import annotations - -from typing import Any, List, NamedTuple, Optional, Sequence, Tuple, Union -from warnings import warn - -from solders.hash import Hash as Blockhash -from solders.instruction import AccountMeta, Instruction -from solders.keypair import Keypair -from solders.message import Message -from solders.message import Message as SoldersMessage -from solders.presigner import Presigner -from solders.pubkey import Pubkey -from solders.signature import Signature -from solders.transaction import Transaction as SoldersTx -from solders.transaction import TransactionError - -PACKET_DATA_SIZE = 1280 - 40 - 8 -"""Constant for maximum over-the-wire size of a Transaction.""" - - -class NonceInformation(NamedTuple): - """NonceInformation to be used to build a Transaction.""" - - nonce: Blockhash - """The current Nonce blockhash.""" - nonce_instruction: Instruction - """AdvanceNonceAccount Instruction.""" - - -def _build_solders_tx( - recent_blockhash: Optional[Blockhash] = None, - nonce_info: Optional[NonceInformation] = None, - fee_payer: Optional[Pubkey] = None, - instructions: Optional[Sequence[Instruction]] = None, -) -> SoldersTx: - core_instructions = [] if instructions is None else instructions - underlying_instructions = ( - core_instructions if nonce_info is None else [nonce_info.nonce_instruction, *core_instructions] - ) - underlying_blockhash: Optional[Blockhash] - if nonce_info is not None: - underlying_blockhash = nonce_info.nonce - elif recent_blockhash is not None: - underlying_blockhash = recent_blockhash - else: - underlying_blockhash = None - underlying_fee_payer = None if fee_payer is None else fee_payer - underlying_blockhash = Blockhash.default() if underlying_blockhash is None else underlying_blockhash - msg = SoldersMessage.new_with_blockhash(underlying_instructions, underlying_fee_payer, underlying_blockhash) - return SoldersTx.new_unsigned(msg) - - -def _decompile_instructions(msg: SoldersMessage) -> List[Instruction]: - account_keys = msg.account_keys - decompiled_instructions: List[Instruction] = [] - for compiled_ix in msg.instructions: - program_id = account_keys[compiled_ix.program_id_index] - account_metas = [ - AccountMeta( - account_keys[idx], - is_signer=msg.is_signer(idx), - is_writable=msg.is_writable(idx), - ) - for idx in compiled_ix.accounts - ] - decompiled_instructions.append(Instruction(program_id, compiled_ix.data, account_metas)) - return decompiled_instructions - - -class Transaction: - """Transaction class to represent an atomic transaction. - - Args: - recent_blockhash: A recent transaction id. - nonce_info: Nonce information. - If populated, transaction will use a durable Nonce hash instead of a `recent_blockhash`. - fee_payer: The transaction fee payer. - instructions: The instructions to be executed in this transaction. - """ - - def __init__( - self, - recent_blockhash: Optional[Blockhash] = None, - nonce_info: Optional[NonceInformation] = None, - fee_payer: Optional[Pubkey] = None, - instructions: Optional[Sequence[Instruction]] = None, - ) -> None: - """Init transaction object.""" - warn( - """Transaction is deprecated and will be removed in a later release. - Please use the Transaction module from solders.transaction instead.""", - DeprecationWarning, - stacklevel=1, - ) - - self._solders = _build_solders_tx( - recent_blockhash=recent_blockhash, - nonce_info=nonce_info, - fee_payer=fee_payer, - instructions=instructions, - ) - - @classmethod - def from_solders(cls, txn: SoldersTx) -> Transaction: - """Convert from a `solders` transaction. - - Args: - txn: The `solders` transaction. - - Returns: - The `solana-py` transaction. - """ - new_tx = cls() - new_tx._solders = txn - return new_tx - - def to_solders(self) -> SoldersTx: - """Convert to a `solders` transaction. - - Returns: - The `solders` transaction. - """ - return self._solders - - def __eq__(self, other: Any) -> bool: - """Equality defintion for Transactions.""" - if not isinstance(other, Transaction): - return False - return self.to_solders() == other.to_solders() - - @property - def recent_blockhash(self) -> Optional[Blockhash]: - """Optional[Blockhash]: The blockhash assigned to this transaction.""" - return self._solders.message.recent_blockhash - - @recent_blockhash.setter - def recent_blockhash(self, blockhash: Optional[Blockhash]) -> None: - self._solders = _build_solders_tx( - recent_blockhash=blockhash, - nonce_info=None, - fee_payer=self.fee_payer, - instructions=self.instructions, - ) - - @property - def fee_payer(self) -> Optional[Pubkey]: - """Optional[Pubkey]: The transaction fee payer.""" - account_keys = self._solders.message.account_keys - return account_keys[0] if account_keys else None - - @fee_payer.setter - def fee_payer(self, payer: Optional[Pubkey]) -> None: - self._solders = _build_solders_tx( - recent_blockhash=self.recent_blockhash, - nonce_info=None, - fee_payer=payer, - instructions=self.instructions, - ) - - @property - def instructions(self) -> Tuple[Instruction, ...]: - """Tuple[Instruction]: The instructions contained in this transaction.""" - msg = self._solders.message - return tuple(_decompile_instructions(msg)) - - @instructions.setter - def instructions(self, ixns: Sequence[Instruction]) -> None: - self._solders = _build_solders_tx( - recent_blockhash=self.recent_blockhash, - nonce_info=None, - fee_payer=self.fee_payer, - instructions=ixns, - ) - - @property - def signatures(self) -> Tuple[Signature, ...]: - """Tuple[Signature]: Signatures for the transaction.""" - return tuple(self._solders.signatures) - - def signature(self) -> Signature: - """The first (payer) Transaction signature. - - Returns: - The payer signature. - """ - return self._solders.signatures[0] - - def add(self, *args: Union[Transaction, Instruction]) -> Transaction: - """Add one or more instructions to this Transaction. - - Args: - *args: The instructions to add to this Transaction. - If a `Transaction` is passsed, the instructions will be extracted from it. - - Returns: - The transaction with the added instructions. - """ - for arg in args: - if isinstance(arg, Transaction): - self.instructions = self.instructions + arg.instructions - elif isinstance(arg, Instruction): - self.instructions = (*self.instructions, arg) - else: - raise ValueError("invalid instruction:", arg) - - return self - - def compile_message(self) -> Message: # pylint: disable=too-many-locals - """Compile transaction data. - - Returns: - The compiled message. - """ - return self._solders.message - - def serialize_message(self) -> bytes: - """Get raw transaction data that need to be covered by signatures. - - Returns: - The serialized message. - """ - return bytes(self.compile_message()) - - def sign_partial(self, *partial_signers: Keypair) -> None: - """Partially sign a Transaction with the specified keypairs. - - All the caveats from the `sign` method apply to `sign_partial` - """ - self._solders.partial_sign(partial_signers, self._solders.message.recent_blockhash) - - def sign(self, *signers: Keypair) -> None: - """Sign the Transaction with the specified accounts. - - Multiple signatures may be applied to a Transaction. The first signature - is considered "primary" and is used when testing for Transaction confirmation. - - Transaction fields should not be modified after the first call to `sign`, - as doing so may invalidate the signature and cause the Transaction to be - rejected. - - The Transaction must be assigned a valid `recent_blockhash` before invoking this method. - """ - self._solders.sign(signers, self._solders.message.recent_blockhash) - - def add_signature(self, pubkey: Pubkey, signature: Signature) -> None: - """Add an externally created signature to a transaction. - - Args: - pubkey: The public key that created the signature. - signature: The signature to add. - """ - presigner = Presigner(pubkey, signature) - self._solders.partial_sign([presigner], self._solders.message.recent_blockhash) - - def verify_signatures(self) -> bool: - """Verify signatures of a complete, signed Transaction. - - Returns: - a bool indicating if the signatures are correct or not. - """ - try: - self._solders.verify() - except TransactionError: - return False - return True - - def serialize(self, verify_signatures: bool = True) -> bytes: - """Serialize the Transaction in the wire format. - - The Transaction must have a valid `signature` before invoking this method. - verify_signatures can be added if the signature does not require to be verified. - - Args: - verify_signatures: a bool indicating to verify the signature or not. Defaults to True - - Example: - >>> from solders.keypair import Keypair - >>> from solders.pubkey import Pubkey - >>> from solders.hash import Hash - >>> from solders.system_program import transfer, TransferParams - >>> leading_zeros = [0] * 31 - >>> seed = bytes(leading_zeros + [1]) - >>> sender, receiver = Keypair.from_seed(seed), Pubkey(leading_zeros + [2]) - >>> transfer_tx = Transaction().add(transfer(TransferParams(from_pubkey=sender.pubkey(), to_pubkey=receiver, lamports=1000))) - >>> transfer_tx.recent_blockhash = Hash(leading_zeros + [3]) - >>> transfer_tx.sign(sender) - >>> transfer_tx.serialize().hex() - '019d53be8af3a7c30f86c1092d2c3ea61d270c0cfa275a23ba504674c8fbbb724827b23b42dc8e08019e23120f1b6f40f9799355ce54185b4415be37ca2cee6e0e010001034cb5abf6ad79fbf5abbccafcc269d85cd2651ed4b885b5869f241aedf0a5ba2900000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000301020200010c02000000e803000000000000' - - Returns: - The serialized transaction. - """ # noqa: E501 pylint: disable=line-too-long - if self.signatures == [Signature.default() for sig in self.signatures]: - raise AttributeError("transaction has not been signed") - - if verify_signatures and not self.verify_signatures(): - raise AttributeError("transaction has not been signed correctly") - - return bytes(self._solders) - - @classmethod - def deserialize(cls, raw_transaction: bytes) -> Transaction: - """Parse a wire transaction into a Transaction object. - - Example: - >>> raw_transaction = bytes.fromhex( - ... '019d53be8af3a7c30f86c1092d2c3ea61d270c0cfa2' - ... '75a23ba504674c8fbbb724827b23b42dc8e08019e23' - ... '120f1b6f40f9799355ce54185b4415be37ca2cee6e0' - ... 'e010001034cb5abf6ad79fbf5abbccafcc269d85cd2' - ... '651ed4b885b5869f241aedf0a5ba290000000000000' - ... '0000000000000000000000000000000000000000000' - ... '0000000200000000000000000000000000000000000' - ... '0000000000000000000000000000000000000000000' - ... '0000000000000000000000000000000000000000000' - ... '000000301020200010c02000000e803000000000000' - ... ) - >>> type(Transaction.deserialize(raw_transaction)) - - - Returns: - The deserialized transaction. - """ - return cls.from_solders(SoldersTx.from_bytes(raw_transaction)) - - @classmethod - def populate(cls, message: Message, signatures: List[Signature]) -> Transaction: - """Populate Transaction object from message and signatures. - - Example: - >>> raw_message = bytes.fromhex( - ... '0200030500000000000000000000000000000000000000000000' - ... '0000000000000000000100000000000000000000000000000000' - ... '0000000000000000000000000000000200000000000000000000' - ... '0000000000000000000000000000000000000000000300000000' - ... '0000000000000000000000000000000000000000000000000000' - ... '0004000000000000000000000000000000000000000000000000' - ... '0000000000000005c49ae77603782054f17a9decea43b444eba0' - ... 'edb12c6f1d31c6e0e4a84bf052eb010403010203050909090909' - ... ) - >>> from solders.message import Message - >>> from solders.signature import Signature - >>> msg = Message.from_bytes(raw_message) - >>> signatures = [Signature(bytes([1] * Signature.LENGTH)), Signature(bytes([2] * Signature.LENGTH))] - >>> type(Transaction.populate(msg, signatures)) - - - Returns: - The populated transaction. - """ - return cls.from_solders(SoldersTx.populate(message, signatures)) diff --git a/src/spl/token/core.py b/src/spl/token/core.py index 046c45cd..f2ce539c 100644 --- a/src/spl/token/core.py +++ b/src/spl/token/core.py @@ -281,7 +281,7 @@ def _transfer_args( ) ] msg = Message.new_with_blockhash(ixs, self.payer.pubkey(), recent_blockhash) - txn = Transaction([self.payer], msg, recent_blockhash) + txn = Transaction([self.payer, *signers], msg, recent_blockhash) return txn, opts def _set_authority_args( @@ -666,7 +666,7 @@ def _transfer_checked_args( ) ] msg = Message.new_with_blockhash(ixs, self.payer.pubkey(), recent_blockhash) - txn = Transaction([self.payer], msg, recent_blockhash) + txn = Transaction([self.payer, *signers], msg, recent_blockhash) return txn, opts def _mint_to_checked_args( diff --git a/tests/unit/test_legacy_transaction.py b/tests/unit/test_legacy_transaction.py deleted file mode 100644 index 2e24b9a1..00000000 --- a/tests/unit/test_legacy_transaction.py +++ /dev/null @@ -1,492 +0,0 @@ -"""Unit tests for solana.transaction.""" - -from base64 import b64decode, b64encode - -import pytest -import solders.system_program as sp -from solders.hash import Hash as Blockhash -from solders.instruction import AccountMeta, CompiledInstruction -from solders.keypair import Keypair -from solders.message import Message -from solders.message import Message as SoldersMessage -from solders.pubkey import Pubkey -from solders.signature import Signature -from solders.transaction import Transaction as SoldersTx - -import solana.transaction as txlib - - -def example_tx(stubbed_blockhash, kp0: Keypair, kp1: Keypair, kp2: Keypair) -> txlib.Transaction: - """Example tx for testing.""" - ixn = txlib.Instruction( - program_id=Pubkey.default(), - data=bytes([0, 0, 0, 0]), - accounts=[ - AccountMeta(kp0.pubkey(), True, True), - AccountMeta(kp1.pubkey(), True, True), - AccountMeta(kp2.pubkey(), True, True), - ], - ) - return txlib.Transaction(fee_payer=kp0.pubkey(), instructions=[ixn], recent_blockhash=stubbed_blockhash) - - -def test_to_solders(stubbed_blockhash: Blockhash) -> None: - """Test converting a Transaction to solders.""" - kp1, kp2 = Keypair(), Keypair() - transfer = sp.transfer(sp.TransferParams(from_pubkey=kp1.pubkey(), to_pubkey=kp2.pubkey(), lamports=123)) - solders_transfer = sp.transfer(sp.TransferParams(from_pubkey=kp1.pubkey(), to_pubkey=kp2.pubkey(), lamports=123)) - assert transfer.data == solders_transfer.data - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash).add(transfer) - solders_msg = SoldersMessage.new_with_blockhash([solders_transfer], None, stubbed_blockhash) - solders_txn = SoldersTx.new_unsigned(solders_msg) - assert txn.to_solders() == solders_txn - assert txlib.Transaction.from_solders(solders_txn) == txn - - -def test_sign_partial(stubbed_blockhash): - """Test partially sigining a transaction.""" - keypair0 = Keypair() - keypair1 = Keypair() - keypair2 = Keypair() - ixn = txlib.Instruction( - program_id=Pubkey.default(), - data=bytes([0, 0, 0, 0]), - accounts=[ - AccountMeta(keypair0.pubkey(), True, True), - AccountMeta(keypair1.pubkey(), True, True), - AccountMeta(keypair2.pubkey(), True, True), - ], - ) - txn = txlib.Transaction(fee_payer=keypair0.pubkey(), instructions=[ixn], recent_blockhash=stubbed_blockhash) - assert txn.to_solders().message.header.num_required_signatures == 3 - txn.sign_partial(keypair0, keypair2) - assert not txn.to_solders().is_signed() - txn.sign_partial(keypair1) - assert txn.to_solders().is_signed() - expected_tx = txlib.Transaction(fee_payer=keypair0.pubkey(), instructions=[ixn], recent_blockhash=stubbed_blockhash) - expected_tx.sign(keypair0, keypair1, keypair2) - assert txn == expected_tx - - -def test_recent_blockhash_setter(stubbed_blockhash): - """Test the recent_blockhash setter property works.""" - kp0, kp1, kp2 = Keypair(), Keypair(), Keypair() - tx0 = example_tx(stubbed_blockhash, kp0, kp1, kp2) - tx1 = example_tx(stubbed_blockhash, kp0, kp1, kp2) - tx1.recent_blockhash = tx0.recent_blockhash - assert tx0 == tx1 - - -def test_transfer_signatures(stubbed_blockhash): - """Test signing transfer transactions.""" - kp1, kp2 = Keypair(), Keypair() - transfer1 = sp.transfer(sp.TransferParams(from_pubkey=kp1.pubkey(), to_pubkey=kp2.pubkey(), lamports=123)) - transfer2 = sp.transfer(sp.TransferParams(from_pubkey=kp2.pubkey(), to_pubkey=kp1.pubkey(), lamports=123)) - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash) - txn.add(transfer1, transfer2) - txn.sign(kp1, kp2) - - expected = txlib.Transaction.populate(txn.compile_message(), txn.signatures) - assert txn == expected - - -def test_dedup_signatures(stubbed_blockhash): - """Test signature deduplication.""" - kp1, kp2 = Keypair(), Keypair() - transfer1 = sp.transfer(sp.TransferParams(from_pubkey=kp1.pubkey(), to_pubkey=kp2.pubkey(), lamports=123)) - transfer2 = sp.transfer(sp.TransferParams(from_pubkey=kp1.pubkey(), to_pubkey=kp2.pubkey(), lamports=123)) - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash).add(transfer1, transfer2) - txn.sign(kp1) - - -def test_wire_format_and_desrialize(stubbed_blockhash, stubbed_receiver, stubbed_sender): - """Test serialize/derialize transaction to/from wire format.""" - transfer = sp.transfer( - sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=49) - ) - expected_txn = txlib.Transaction(recent_blockhash=stubbed_blockhash).add(transfer) - expected_txn.sign(stubbed_sender) - wire_txn = b64decode( - b"AVuErQHaXv0SG0/PchunfxHKt8wMRfMZzqV0tkC5qO6owYxWU2v871AoWywGoFQr4z+q/7mE8lIufNl/kxj+nQ0BAAEDE5j2" - b"LG0aRXxRumpLXz29L2n8qTIWIY3ImX5Ba9F9k8r9Q5/Mtmcn8onFxt47xKj+XdXXd3C8j/FcPu7csUrz/AAAAAAAAAAAAAAA" - b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAxJrndgN4IFTxep3s6kO0ROug7bEsbx0xxuDkqEvwUusBAgIAAQwCAAAAMQAAAAAAAAA=" - ) - txn = txlib.Transaction.deserialize(wire_txn) - assert txn == expected_txn - assert wire_txn == expected_txn.serialize() - - -def test_populate(): - """Test populating transaction with a message and two signatures.""" - account_keys = [Pubkey([0] * 31 + [i + 1]) for i in range(5)] - msg = Message.new_with_compiled_instructions( - num_required_signatures=2, - num_readonly_signed_accounts=0, - num_readonly_unsigned_accounts=3, - account_keys=account_keys, - instructions=[CompiledInstruction(accounts=bytes([1, 2, 3]), data=bytes([9] * 5), program_id_index=4)], - recent_blockhash=Blockhash.default(), - ) - signatures = [Signature(bytes([1] * Signature.LENGTH)), Signature(bytes([2] * Signature.LENGTH))] - transaction = txlib.Transaction.populate(msg, signatures) - assert len(transaction.instructions) == len(msg.instructions) - assert len(transaction.signatures) == len(signatures) - assert transaction.recent_blockhash == msg.recent_blockhash - - -def test_serialize_unsigned_transaction(stubbed_blockhash, stubbed_receiver, stubbed_sender): - """Test to serialize an unsigned transaction.""" - transfer = sp.transfer( - sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=49) - ) - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash).add(transfer) - assert txn.signatures == (Signature.default(),) - # Empty signature array fails - with pytest.raises(AttributeError): - txn.serialize() - assert txn.signatures == (Signature.default(),) - - # Set fee payer - txn.fee_payer = stubbed_sender.pubkey() - # Serialize message - assert b64encode(txn.serialize_message()) == ( - b"AQABAxOY9ixtGkV8UbpqS189vS9p/KkyFiGNyJl+QWvRfZPK/UOfzLZnJ/KJxcbeO8So/l3V13dwvI/xXD7u3LFK8/wAAAAAAAAA" - b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMSa53YDeCBU8Xqd7OpDtETroO2xLG8dMcbg5KhL8FLrAQICAAEMAgAAADEAAAAAAAAA" - ) - assert len(txn.instructions) == 1 - # Signature array populated with null signatures fails - with pytest.raises(AttributeError): - txn.serialize() - assert txn.signatures == (Signature.default(),) - # Properly signed transaction succeeds - txn.sign(stubbed_sender) - assert len(txn.instructions) == 1 - expected_serialization = b64decode( - b"AVuErQHaXv0SG0/PchunfxHKt8wMRfMZzqV0tkC5qO6owYxWU2v871AoWywGoFQr4z+q/7mE8lIufNl/kxj+nQ0BAAEDE5j2" - b"LG0aRXxRumpLXz29L2n8qTIWIY3ImX5Ba9F9k8r9Q5/Mtmcn8onFxt47xKj+XdXXd3C8j/FcPu7csUrz/AAAAAAAAAAAAAAA" - b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAxJrndgN4IFTxep3s6kO0ROug7bEsbx0xxuDkqEvwUusBAgIAAQwCAAAAMQAAAAAAAAA=" - ) - assert txn.serialize() == expected_serialization - assert len(txn.signatures) == 1 - assert txn.signatures != (Signature.default(),) - - -def test_serialize_unsigned_transaction_without_verifying_signatures( - stubbed_blockhash, stubbed_receiver, stubbed_sender -): - """Test to serialize an unsigned transaction without verifying the signatures.""" - transfer = sp.transfer( - sp.TransferParams(from_pubkey=stubbed_sender.pubkey(), to_pubkey=stubbed_receiver, lamports=49) - ) - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash).add(transfer) - assert txn.signatures == (Signature.default(),) - - # empty signatures should not fail - txn.serialize(verify_signatures=False) - assert txn.signatures == (Signature.default(),) - - # Set fee payer - txn.fee_payer = stubbed_sender.pubkey() - # Serialize message - assert b64encode(txn.serialize_message()) == ( - b"AQABAxOY9ixtGkV8UbpqS189vS9p/KkyFiGNyJl+QWvRfZPK/UOfzLZnJ/KJxcbeO8So/l3V13dwvI/xXD7u3LFK8/wAAAAAAAAA" - b"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMSa53YDeCBU8Xqd7OpDtETroO2xLG8dMcbg5KhL8FLrAQICAAEMAgAAADEAAAAAAAAA" - ) - assert len(txn.instructions) == 1 - # Signature array populated with null signatures should not fail - txn.serialize(verify_signatures=False) - assert txn.signatures == (Signature.default(),) - - -def test_sort_account_metas(stubbed_blockhash): - """Test AccountMeta sorting after calling Transaction.compile_message().""" - # S6EA7XsNyxg4yx4DJRMm7fP21jgZb1fuzBAUGhgVtkP - signer_one = Keypair.from_seed( - bytes( - [ - 216, - 214, - 184, - 213, - 199, - 75, - 129, - 160, - 237, - 96, - 96, - 228, - 46, - 251, - 146, - 3, - 71, - 162, - 37, - 117, - 121, - 70, - 143, - 16, - 128, - 78, - 53, - 189, - 222, - 230, - 165, - 249, - ] - ) - ) - - # BKdt9U6V922P17ui81dzLoqgSY2B5ds1UD13rpwFB2zi - receiver_one = Keypair.from_seed( - bytes( - [ - 3, - 140, - 94, - 243, - 0, - 38, - 92, - 138, - 52, - 79, - 153, - 83, - 42, - 236, - 220, - 82, - 227, - 187, - 101, - 104, - 126, - 159, - 103, - 100, - 29, - 183, - 242, - 68, - 144, - 184, - 114, - 211, - ] - ) - ) - - # DtDZCnXEN69n5W6rN5SdJFgedrWdK8NV9bsMiJekNRyu - signer_two = Keypair.from_seed( - bytes( - [ - 177, - 182, - 154, - 154, - 5, - 145, - 253, - 138, - 211, - 126, - 222, - 195, - 21, - 64, - 117, - 211, - 225, - 47, - 115, - 31, - 247, - 242, - 80, - 195, - 38, - 8, - 236, - 155, - 255, - 27, - 20, - 142, - ] - ) - ) - - # FXgds3n6SNCoVVV4oELSumv8nKzAfqSgmeu7cNPikKFT - receiver_two = Keypair.from_seed( - bytes( - [ - 180, - 204, - 139, - 131, - 244, - 6, - 180, - 121, - 191, - 193, - 45, - 109, - 198, - 50, - 163, - 140, - 34, - 4, - 172, - 76, - 129, - 45, - 194, - 83, - 192, - 112, - 76, - 58, - 32, - 174, - 49, - 248, - ] - ) - ) - - # C2UwQHqJ3BmEJHSMVmrtZDQGS2fGv8fZrWYGi18nHF5k - signer_three = Keypair.from_seed( - bytes( - [ - 29, - 79, - 73, - 16, - 137, - 117, - 183, - 2, - 131, - 0, - 209, - 142, - 134, - 100, - 190, - 35, - 95, - 220, - 200, - 163, - 247, - 237, - 161, - 70, - 226, - 223, - 100, - 148, - 49, - 202, - 154, - 180, - ] - ) - ) - - # 8YPqwYXZtWPd31puVLEUPamS4wTv6F89n8nXDA5Ce2Bg - receiver_three = Keypair.from_seed( - bytes( - [ - 167, - 102, - 49, - 166, - 202, - 0, - 132, - 182, - 239, - 182, - 252, - 59, - 25, - 103, - 76, - 217, - 65, - 215, - 210, - 159, - 168, - 50, - 10, - 229, - 144, - 231, - 221, - 74, - 182, - 161, - 52, - 193, - ] - ) - ) - - fee_payer = signer_one - sorted_signers = sorted([x.pubkey() for x in [signer_one, signer_two, signer_three]], key=str) - sorted_signers_excluding_fee_payer = [x for x in sorted_signers if str(x) != str(fee_payer.pubkey())] - sorted_receivers = sorted([x.pubkey() for x in [receiver_one, receiver_two, receiver_three]], key=str) - - txn = txlib.Transaction(recent_blockhash=stubbed_blockhash) - txn.fee_payer = fee_payer.pubkey() - - # Add three transfer transactions - txn.add( - sp.transfer( - sp.TransferParams( - from_pubkey=signer_one.pubkey(), - to_pubkey=receiver_one.pubkey(), - lamports=2_000_000, - ) - ) - ) - txn.add( - sp.transfer( - sp.TransferParams( - from_pubkey=signer_two.pubkey(), - to_pubkey=receiver_two.pubkey(), - lamports=2_000_000, - ) - ) - ) - txn.add( - sp.transfer( - sp.TransferParams( - from_pubkey=signer_three.pubkey(), - to_pubkey=receiver_three.pubkey(), - lamports=2_000_000, - ) - ) - ) - - tx_msg = txn.compile_message() - - js_msg_b64_check = b"AwABBwZtbiRMvgQjcE2kVx9yon8XqPSO5hwc2ApflnOZMu0Qo9G5/xbhB0sp8/03Rv9x4MKSkQ+k4LB6lNLvCgKZ/ju/aw+EyQpTObVa3Xm+NA1gSTzutgFCTfkDto/0KtuIHHAMpKRb92NImxKeWQJ2/291j6nTzFj1D6nW25p7TofHmVsGt8uFnTv7+8vsWZ0uN7azdxa+jCIIm4WzKK+4uKfX39t5UA7S1soBQaJkTGOQkSbBo39gIjDkbW0TrevslgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAxJrndgN4IFTxep3s6kO0ROug7bEsbx0xxuDkqEvwUusDBgIABAwCAAAAgIQeAAAAAAAGAgIFDAIAAACAhB4AAAAAAAYCAQMMAgAAAICEHgAAAAAA" # noqa: E501 pylint: disable=line-too-long - - assert b64encode(bytes(tx_msg)) == js_msg_b64_check - - # Transaction should organize AccountMetas by pubkey - assert tx_msg.account_keys[0] == fee_payer.pubkey() - assert tx_msg.account_keys[1] == sorted_signers_excluding_fee_payer[0] - assert tx_msg.account_keys[2] == sorted_signers_excluding_fee_payer[1] - assert tx_msg.account_keys[3] == sorted_receivers[0] - assert tx_msg.account_keys[4] == sorted_receivers[1] - assert tx_msg.account_keys[5] == sorted_receivers[2]