Metadata-Version: 2.1
Name: crust-interface-patara
Version: 0.1.1
Summary: A simple tool to interact with Crust Shadow and Crust Mainnet. Under development
Home-page: https://github.com/PaTara43/crust-interface-patara
License: Apache-2.0
Keywords: python,ipfs,web3,substrate,crust,pypi-package
Author: PaTara43
Author-email: p040399@outlook.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: substrate-interface (>=1.4.0,<2.0)
Project-URL: Bug Tracker, https://github.com/Multi-Agent-io/crust-interface-patara/issues
Project-URL: Documentation, https://github.com/PaTara43/crust-interface-patara/blob/main/README.md
Project-URL: Repository, https://github.com/PaTara43/crust-interface-patara
Description-Content-Type: text/markdown

# 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

seed = "seed"
mainnet = Mainnet(seed=seed)

# 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
seed = "seed"
shadow = Shadow(seed=seed)

# 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)
```

