crust-interface-patara


Namecrust-interface-patara JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/PaTara43/crust-interface-patara
SummaryA simple tool to interact with Crust Shadow, Crust Polkadot Parachain and Crust Mainnet. Under development
upload_time2024-04-04 17:31:38
maintainerNone
docs_urlNone
authorPaTara43
requires_python<4.0,>=3.8
licenseApache-2.0
keywords python ipfs web3 substrate crust pypi-package polkadot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # crust-file-uploader

https://crust.network/
https://apps.crust.network/
https://wiki.crust.network/en
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc-shadow.crust.network%2F#/explorer

This is a simple tool to pin your files sing Crust Network or Crust Shadow.

## Setup
### Installation:
```bash
pip3 install crust-interface-patara
```

## Features

The module is divided into `Mainnet` and `Shadow`

`Mainnet` provides Crust interaction functionality to check user balance, calculate file storage price, placing
file storage order, add tokens to renewal pool and checking replicas count.

```python
import time
from crustinterface import Mainnet
from substrateinterface import KeypairType

seed = "seed"
mainnet = Mainnet(seed=seed, crypto_type=KeypairType.SR25519)

# get any IPFS CID and size
cid, size =  "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>

# Check balance
balance = mainnet.get_balance()
print(balance)

# Check price in Main net. Price in pCRUs
price = mainnet.get_appx_store_price(int(size))
print(price)

# Store file in Mainnet for CRUs
file_stored = mainnet.store_file(cid, size)
print(file_stored)

# Add renewal pool
file_prepaid = mainnet.add_renewal_pool_balance(cid, price*2)
print(file_prepaid)


# Get replicas
time.sleep(10)
replicas = mainnet.get_replicas(cid)
print(replicas)

```

`Shadow` allows you to perform `Xstorage` extrinsic in Crust Shadow network.
```python
from crustinterface import Shadow
from substrateinterface import KeypairType

seed = "seed"
shadow = Shadow(seed=seed, crypto_type=KeypairType.SR25519)

# get any IPFS CID and size
cid, size =  "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>

print(cid, size)

# Check balance
balance = shadow.get_balance()
print(balance)

# Store file in Shadow for CSMs
file_stored = shadow.store_file(cid, size)
print(file_stored)
```

`Parachain` allows you to perform `Xstorage` extrinsic in Crust Polkadot Parachain network.
```python
from crustinterface import Parachain
from substrateinterface import KeypairType

seed = "seed"
parachain = Parachain(seed=seed, crypto_type=KeypairType.SR25519)

# get any IPFS CID and size
cid, size =  "QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>

print(cid, size)

# Check balance
balance = parachain.get_balance()
print(balance)

# Store file in Shadow for CSMs
file_stored = parachain.store_file(cid, size)
print(file_stored)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PaTara43/crust-interface-patara",
    "name": "crust-interface-patara",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "python, ipfs, web3, substrate, crust, pypi-package, polkadot",
    "author": "PaTara43",
    "author_email": "p040399@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/91/73/89bf1c654b94f83839a75bf6a02bee77e136f05fea1c1e81427bbe3f0863/crust_interface_patara-0.2.0.tar.gz",
    "platform": null,
    "description": "# crust-file-uploader\n\nhttps://crust.network/\nhttps://apps.crust.network/\nhttps://wiki.crust.network/en\nhttps://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc-shadow.crust.network%2F#/explorer\n\nThis is a simple tool to pin your files sing Crust Network or Crust Shadow.\n\n## Setup\n### Installation:\n```bash\npip3 install crust-interface-patara\n```\n\n## Features\n\nThe module is divided into `Mainnet` and `Shadow`\n\n`Mainnet` provides Crust interaction functionality to check user balance, calculate file storage price, placing\nfile storage order, add tokens to renewal pool and checking replicas count.\n\n```python\nimport time\nfrom crustinterface import Mainnet\nfrom substrateinterface import KeypairType\n\nseed = \"seed\"\nmainnet = Mainnet(seed=seed, crypto_type=KeypairType.SR25519)\n\n# get any IPFS CID and size\ncid, size =  \"QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui\", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>\n\n# Check balance\nbalance = mainnet.get_balance()\nprint(balance)\n\n# Check price in Main net. Price in pCRUs\nprice = mainnet.get_appx_store_price(int(size))\nprint(price)\n\n# Store file in Mainnet for CRUs\nfile_stored = mainnet.store_file(cid, size)\nprint(file_stored)\n\n# Add renewal pool\nfile_prepaid = mainnet.add_renewal_pool_balance(cid, price*2)\nprint(file_prepaid)\n\n\n# Get replicas\ntime.sleep(10)\nreplicas = mainnet.get_replicas(cid)\nprint(replicas)\n\n```\n\n`Shadow` allows you to perform `Xstorage` extrinsic in Crust Shadow network.\n```python\nfrom crustinterface import Shadow\nfrom substrateinterface import KeypairType\n\nseed = \"seed\"\nshadow = Shadow(seed=seed, crypto_type=KeypairType.SR25519)\n\n# get any IPFS CID and size\ncid, size =  \"QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui\", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>\n\nprint(cid, size)\n\n# Check balance\nbalance = shadow.get_balance()\nprint(balance)\n\n# Store file in Shadow for CSMs\nfile_stored = shadow.store_file(cid, size)\nprint(file_stored)\n```\n\n`Parachain` allows you to perform `Xstorage` extrinsic in Crust Polkadot Parachain network.\n```python\nfrom crustinterface import Parachain\nfrom substrateinterface import KeypairType\n\nseed = \"seed\"\nparachain = Parachain(seed=seed, crypto_type=KeypairType.SR25519)\n\n# get any IPFS CID and size\ncid, size =  \"QmbJtyu82TQSHU52AzRMXBENZGQKYqPsmao9dPuTeorPui\", 18  # <any way to get an IPFS CID and size. One may use ipfshttpclient2 from IPFS-Toolkit>\n\nprint(cid, size)\n\n# Check balance\nbalance = parachain.get_balance()\nprint(balance)\n\n# Store file in Shadow for CSMs\nfile_stored = parachain.store_file(cid, size)\nprint(file_stored)\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A simple tool to interact with Crust Shadow, Crust Polkadot Parachain and Crust Mainnet. Under development",
    "version": "0.2.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/Multi-Agent-io/crust-interface-patara/issues",
        "Documentation": "https://github.com/PaTara43/crust-interface-patara/blob/main/README.md",
        "Homepage": "https://github.com/PaTara43/crust-interface-patara",
        "Repository": "https://github.com/PaTara43/crust-interface-patara"
    },
    "split_keywords": [
        "python",
        " ipfs",
        " web3",
        " substrate",
        " crust",
        " pypi-package",
        " polkadot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3b4f33ede37c1ed8e1f65e7018760c6d7e57cc42e750ec410142c80002e66cc1",
                "md5": "ab4a4c57f60159fc88ae758c90102721",
                "sha256": "d034e9a704805821fefd08a9584b07f996cbdfc388058910b8800c681b2a4803"
            },
            "downloads": -1,
            "filename": "crust_interface_patara-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ab4a4c57f60159fc88ae758c90102721",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 15845,
            "upload_time": "2024-04-04T17:31:35",
            "upload_time_iso_8601": "2024-04-04T17:31:35.959177Z",
            "url": "https://files.pythonhosted.org/packages/3b/4f/33ede37c1ed8e1f65e7018760c6d7e57cc42e750ec410142c80002e66cc1/crust_interface_patara-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "917389bf1c654b94f83839a75bf6a02bee77e136f05fea1c1e81427bbe3f0863",
                "md5": "c93b2174addead40dee09ceca62e4b04",
                "sha256": "7107124897a26f4f9a9791d2bf1d75187a43144eb10c48a0c53a6a53d338dfb6"
            },
            "downloads": -1,
            "filename": "crust_interface_patara-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c93b2174addead40dee09ceca62e4b04",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 9614,
            "upload_time": "2024-04-04T17:31:38",
            "upload_time_iso_8601": "2024-04-04T17:31:38.152773Z",
            "url": "https://files.pythonhosted.org/packages/91/73/89bf1c654b94f83839a75bf6a02bee77e136f05fea1c1e81427bbe3f0863/crust_interface_patara-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 17:31:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PaTara43",
    "github_project": "crust-interface-patara",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "crust-interface-patara"
}
        
Elapsed time: 4.68348s