Skip to content

Commit

Permalink
0.1.0 examples -> README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
PaTara43 committed Jan 31, 2023
1 parent f4f7630 commit 756d122
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 85 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
venv
.idea
crust_file_uploader/js_src/node_modules
crust_file_uploader/js_src/yarn.lock
crust-interface-patara/js_src/node_modules
crust-interface-patara/js_src/yarn.lock
__pycache__
60 changes: 55 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ 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 upload your files to a Crust network.
This is a simple tool to pin your files sing Crust Network or Crust Shadow.

## Setup
### Installation:
```bash
git clone https://github.com/PaTara43/crust-file-uploader/
cd crust-file-uploader
pip3 install .
pip3 install crust-interface-patara
```

## Features
Expand All @@ -22,4 +20,56 @@ 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.

`Shadow` allows you to perform `Xstorage` extrinsic in Crust Shadow network.
```python
import time
from crust-interface-patara 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 crust_file_uploader 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)
```
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
W3GW = "https://crustwebsites.net/api/v0/add"
W3PS = "https://pin.crustcode.com/psa/pins"
CRUST_ROCKY_TESTNET_ENDPOINT = "wss://rpc-rocky.crust.network"
CRUST_MAINNET_ENDPOINT = "wss://rpc.crust.network"
CRUST_SHADOW_ENDPOINT = "wss://rpc-shadow.crust.network/"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 0 additions & 38 deletions example_mainnet.py

This file was deleted.

22 changes: 0 additions & 22 deletions example_shadow.py

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "crust-file-uploader"
version = "1.0.0"
description = "A simple python tool to upload files to Crust Network"
name = "crust-interface-patara"
version = "0.1.0"
description = "A simple tool to interact with Crust Shadow and Crust Mainnet. Under development"
authors = ["PaTara43 <[email protected]>"]
license = "Apache-2.0"

Expand Down
13 changes: 0 additions & 13 deletions setup.py

This file was deleted.

0 comments on commit 756d122

Please sign in to comment.