sapysol


Namesapysol JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
SummarySuperArmor's Solana Python wrapper.
upload_time2024-04-10 23:00:44
maintainerNone
docs_urlNone
authorAnton Platonov
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sapysol

`sapysol` is a Solana Python wrapper. It doesn't reinvent what [solana-py](https://github.com/michaelhly/solana-py), [solders](https://github.com/kevinheavey/solders) or [AnchorPy](https://github.com/kevinheavey/anchorpy) do, but rather uses their power to create easy-to-use Python classes and wrappers to rapidly develop short and fast Python scripts to interact with Solana blockchain.

Like `@solana/web3.js` helps developers write JS code, `sapysol` will ease using blockchain technologies to more developers that prefer Python instead. More developers on board - better for the community and Solana.

`sapysol` can also serve as a base layer for other wrappers because it simplifies `Pubkey`/`Keypair` management, creating and sending transactions, tokens, instructions etc.

WARNING! `sapysol` is currently in `alpha` version, so, bugs, lack of tests and descriptions are expected. Some things may not work, future versions may bring breaking changes. It is a hard path for Python in Solana and I hope we hat a lot of friends along the way.

# Installation

```sh
pip install sapysol
```

Note: Requires Python >= 3.10.

# Usage

`sapysol` uses `Client` instead of `AsyncClient` for few reasons:
* First - without `async` you can put more logic to Python constructors and other non-async functions;
* Second - what is the point of `async` if you really use `await` in 100% of cases?

Please use `threading` if you need parallel execution.

```py
# ========================================
# Sending SOL to another wallet
from solana.rpc.api import Client 
from sapysol        import *

connection: Client          = Client("https://api.mainnet-beta.solana.com")
wallet:     SapysolWallet   = SapysolWallet(connection=connection, keypair="path/to/file.json")
result:     SapysolTxStatus = wallet.SendSol(destinationAddress="11111111111111111111111111111111", amountSol=0.5)
assert(result==SapysolTxStatus.SUCCESS)

# ========================================
# Jupiter swap
from solana.rpc.api import Client
from sapysol        import *
from sapysol.jupag  import SapysolJupag

connection: Client = Client("https://api.mainnet-beta.solana.com")
quote = SapysolJupag.GetSwapQuote(connection    = connection,
                                  tokenFrom     = "So11111111111111111111111111111111111111112",
                                  tokenTo       = "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", # BONK
                                  inAmount      = 1 * LAMPORTS_PER_SOL)
txB64 = SapysolJupag.GetSwapTxBase64(walletAddress=wallet.KEYPAIR.pubkey(), coinQuote=quote)
tx: SapysolTx = SapysolTx(connection=connection, payer=wallet.KEYPAIR)
tx.FromBase64(txB64)
result: SapysolTxStatus = tx.SendAndWait()
assert(result==SapysolTxStatus.SUCCESS)

# ========================================
# TODO - other simple use cases
```

TODO

# Contributing

All contributions are welcome! Although the devil is in the details:
* One of the main requirements is to **keep the same coding style** for all future changes.
* `sapysol` is designed as a wrapper, one layer above `solders`/`solana-py`, don't expect it to do very narrow or specific tasks. If you need custom behavior in your case just go one level down and implement that using `solders`/`solana-py` in your local scripts.

# Tests

TODO

# Contact

[Telegram](https://t.me/sapysol)

Donations: `SAxxD7JGPQWqDihYDfD6mFp7JWz5xGrf9RXmE4BJWTS`

# Disclaimer

### Intended Purpose and Use
The Content is provided solely for educational, informational, and general purposes. It is not intended for use in making any business, investment, or legal decisions. Although every effort has been made to keep the information up-to-date and accurate, no representations or warranties, express or implied, are made regarding the completeness, accuracy, reliability, suitability, or availability of the Content.

### Opinions and Views
The views and opinions expressed herein are those of Anton Platonov and do not necessarily reflect the official policy, position, or views of any other agency, organization, employer, or company. These views are subject to change, revision, and rethinking at any time.

### Third-Party Content and Intellectual Property
Some Content may include or link to third-party materials. The User agrees to respect all applicable intellectual property laws, including copyrights and trademarks, when engaging with this Content.

### Amendments
Chintan Gurjar reserves the right to update or change this disclaimer at any time without notice. Continued use of the Content following modifications to this disclaimer will constitute acceptance of the revised terms.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sapysol",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Anton Platonov",
    "author_email": "anton@platonov.io",
    "download_url": "https://files.pythonhosted.org/packages/e7/23/1df9f8a258b4221f25a6f51097653d441c1c2f671d801e12fe6f35aed2be/sapysol-0.5.0.tar.gz",
    "platform": null,
    "description": "# sapysol\n\n`sapysol` is a Solana Python wrapper. It doesn't reinvent what [solana-py](https://github.com/michaelhly/solana-py), [solders](https://github.com/kevinheavey/solders) or [AnchorPy](https://github.com/kevinheavey/anchorpy) do, but rather uses their power to create easy-to-use Python classes and wrappers to rapidly develop short and fast Python scripts to interact with Solana blockchain.\n\nLike `@solana/web3.js` helps developers write JS code, `sapysol` will ease using blockchain technologies to more developers that prefer Python instead. More developers on board - better for the community and Solana.\n\n`sapysol` can also serve as a base layer for other wrappers because it simplifies `Pubkey`/`Keypair` management, creating and sending transactions, tokens, instructions etc.\n\nWARNING! `sapysol` is currently in `alpha` version, so, bugs, lack of tests and descriptions are expected. Some things may not work, future versions may bring breaking changes. It is a hard path for Python in Solana and I hope we hat a lot of friends along the way.\n\n# Installation\n\n```sh\npip install sapysol\n```\n\nNote: Requires Python >= 3.10.\n\n# Usage\n\n`sapysol` uses `Client` instead of `AsyncClient` for few reasons:\n* First - without `async` you can put more logic to Python constructors and other non-async functions;\n* Second - what is the point of `async` if you really use `await` in 100% of cases?\n\nPlease use `threading` if you need parallel execution.\n\n```py\n# ========================================\n# Sending SOL to another wallet\nfrom solana.rpc.api import Client \nfrom sapysol        import *\n\nconnection: Client          = Client(\"https://api.mainnet-beta.solana.com\")\nwallet:     SapysolWallet   = SapysolWallet(connection=connection, keypair=\"path/to/file.json\")\nresult:     SapysolTxStatus = wallet.SendSol(destinationAddress=\"11111111111111111111111111111111\", amountSol=0.5)\nassert(result==SapysolTxStatus.SUCCESS)\n\n# ========================================\n# Jupiter swap\nfrom solana.rpc.api import Client\nfrom sapysol        import *\nfrom sapysol.jupag  import SapysolJupag\n\nconnection: Client = Client(\"https://api.mainnet-beta.solana.com\")\nquote = SapysolJupag.GetSwapQuote(connection    = connection,\n                                  tokenFrom     = \"So11111111111111111111111111111111111111112\",\n                                  tokenTo       = \"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263\", # BONK\n                                  inAmount      = 1 * LAMPORTS_PER_SOL)\ntxB64 = SapysolJupag.GetSwapTxBase64(walletAddress=wallet.KEYPAIR.pubkey(), coinQuote=quote)\ntx: SapysolTx = SapysolTx(connection=connection, payer=wallet.KEYPAIR)\ntx.FromBase64(txB64)\nresult: SapysolTxStatus = tx.SendAndWait()\nassert(result==SapysolTxStatus.SUCCESS)\n\n# ========================================\n# TODO - other simple use cases\n```\n\nTODO\n\n# Contributing\n\nAll contributions are welcome! Although the devil is in the details:\n* One of the main requirements is to **keep the same coding style** for all future changes.\n* `sapysol` is designed as a wrapper, one layer above `solders`/`solana-py`, don't expect it to do very narrow or specific tasks. If you need custom behavior in your case just go one level down and implement that using `solders`/`solana-py` in your local scripts.\n\n# Tests\n\nTODO\n\n# Contact\n\n[Telegram](https://t.me/sapysol)\n\nDonations: `SAxxD7JGPQWqDihYDfD6mFp7JWz5xGrf9RXmE4BJWTS`\n\n# Disclaimer\n\n### Intended Purpose and Use\nThe Content is provided solely for educational, informational, and general purposes. It is not intended for use in making any business, investment, or legal decisions. Although every effort has been made to keep the information up-to-date and accurate, no representations or warranties, express or implied, are made regarding the completeness, accuracy, reliability, suitability, or availability of the Content.\n\n### Opinions and Views\nThe views and opinions expressed herein are those of Anton Platonov and do not necessarily reflect the official policy, position, or views of any other agency, organization, employer, or company. These views are subject to change, revision, and rethinking at any time.\n\n### Third-Party Content and Intellectual Property\nSome Content may include or link to third-party materials. The User agrees to respect all applicable intellectual property laws, including copyrights and trademarks, when engaging with this Content.\n\n### Amendments\nChintan Gurjar reserves the right to update or change this disclaimer at any time without notice. Continued use of the Content following modifications to this disclaimer will constitute acceptance of the revised terms.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SuperArmor's Solana Python wrapper.",
    "version": "0.5.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db880f3f81cccc8294cb88996600d0fb35d70fde47d3400385f0919ce5b96e7d",
                "md5": "dc9ede16746c203a486c0ea64d7c8f9c",
                "sha256": "9442f7cb763104e305cccda5b922646cfa7989cb1b0cbe6dd3209eaaacc89381"
            },
            "downloads": -1,
            "filename": "sapysol-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc9ede16746c203a486c0ea64d7c8f9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 25359,
            "upload_time": "2024-04-10T23:00:42",
            "upload_time_iso_8601": "2024-04-10T23:00:42.023902Z",
            "url": "https://files.pythonhosted.org/packages/db/88/0f3f81cccc8294cb88996600d0fb35d70fde47d3400385f0919ce5b96e7d/sapysol-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e7231df9f8a258b4221f25a6f51097653d441c1c2f671d801e12fe6f35aed2be",
                "md5": "74fb9848ffaecbec45494e373cc58479",
                "sha256": "983597babfa771edd4eee5a1e68abb176140374970b0d05023a5c7a0e108e4a9"
            },
            "downloads": -1,
            "filename": "sapysol-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "74fb9848ffaecbec45494e373cc58479",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 20853,
            "upload_time": "2024-04-10T23:00:44",
            "upload_time_iso_8601": "2024-04-10T23:00:44.000034Z",
            "url": "https://files.pythonhosted.org/packages/e7/23/1df9f8a258b4221f25a6f51097653d441c1c2f671d801e12fe6f35aed2be/sapysol-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-10 23:00:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sapysol"
}
        
Elapsed time: 0.25614s