Skip to main content

A project to decentralize and distribute literary infrastructure powered by EVM and IPFS.

Project description

Alexandria

A project to decentralize and distribute literary infrastructure.

See github for a detailed breakdown.

Usage/Examples

import EthAlexandria # import the package
import ipfshttpclient # for connecting to ipfs


# url to connect to 
NETWORK = "https://mainnet.infura.io/v3/"
# currently supports Polygon, Binance Smart Chain, Evmos, etc.


# create an instance of the objects
contract_book = EthAlexandria.Book(NETWORK) # instance of the contract book

ipfs_book = EthAlexandria.BookIPFS(NETWORK) # instance of the ipfs book

library = EthAlexandria.Library(NETWORK) # instance of library

mnemonic = "your mnemonic here"

# ALWAYS LOAD_DATA(), before you begine working with the contract
contract_book.load_data()
ipfs_book.load_data()
library.load_data()


# Load the addresses of already deployed contracts [ignore]
contract_book_address = "0xAD94E1Fd0158C64981D29B03eE0C4C350C5b0B69"
ipfs_book_address = "0x98126F0d49e3137355B71f708Bb564ff9f224ED7"
library_address = "0x80303A8EBF84aeDf25c75ea5e2C474b4aE6dFe3A"

# generate new contracts and return their addresses

# generate a new book contract
print(contract_book.new_book("Rich Dad", "MIT", mnemonic).contractAddress)

# generate a new ipfs contract book, this method deploys the book directly to ipfs before contract deployment
print(ipfs_book.new_ipfs_book("Rich Dad", "MIT", "rich_dad.pdf", "pdf", client, mnemonic).contractAddress)

# generate a new library contract
print(library.new_library("Library of Alexandria", mnemonic).contractAddress)

All the available methods

EthAlexandria.Book

Method: deposit_ether_to_contract()
Doc: Deposit ether to the contract

Method: get_all_time_value()
Doc: return book all time value

Method: get_author()
Doc: return book author

Method: get_book_balance()
Doc: return book balance

Method: get_book_license()
Doc: return book book_license

Method: get_chapter_content()
Doc: return book chapter content

Method: get_chapter_name()
Doc: return book chapter name

Method: get_chapter_status()
Doc: return book chapter status

Method: get_chapters_count()
Doc: return book chapters count

Method: get_title()
Doc: return book title

Method: load_data()
Doc: load neccessary data to work with the object

Method: new_book()
Doc: create new book

Method: new_chapter()
Doc: create new chapter

Method: remove_chapter()
Doc: remove chapter

Method: transfer_ether_from_book_contract()
Doc: transfer ether from contract

EthAlexandria.BookIPFS

Method: deposit_ether_to_contract()
Doc: Deposit ether to the contract

Method: get_all_time_value()
Doc: return book all time value

Method: get_author()
Doc: return book author

Method: get_book_format()
Doc: return book format as deployed to ipfs, used to build the book from the hash

Method: get_book_license()
Doc: return book book_license

Method: get_ipfs_book_balance()
Doc: return book balance

Method: get_ipfs_hash()
Doc: return book ipfs hash

Method: get_title()
Doc: return book title

Method: load_data()
Doc: load neccessary data to work with the object

Method: new_ipfs_book()
Doc: create new ipfs book this is also upload the book to ipfs

Method: resolve_book_from_ipfs()
Doc: return the book from ipfs

Method: transfer_ether_from_book_contract()
Doc: transfer ether from contract

Method: upload_to_ipfs()
Doc: upload book to ipfs

EthAlexandria.Library

Method: add_book()
Doc: add book to library

Method: deposit_ether_to_contract()
Doc: Deposit ether to the contract

Method: get_all_time_value()
Doc: return library all time value

Method: get_book_address()
Doc: return book address

Method: get_book_author()
Doc: return book author

Method: get_book_count()
Doc: return book count

Method: get_book_status()
Doc: return book status

Method: get_book_title()
Doc: return book title

Method: get_librarian()
Doc: return library librarian

Method: get_library_balance()
Doc: get library balance

Method: get_library_name()
Doc: return library name

Method: get_quote()
Doc: return library quote

Method: load_data()
Doc: load neccessary data to work with the object

Method: new_library()
Doc: create new library

Method: remove_book()
Doc: remove book from library

Method: transfer_ether_from_library_contract()
Doc: transfer ether from library contract

Method: transfer_position()
Doc: transfer librarian position

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

EthAlexandria-0.0.5.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file EthAlexandria-0.0.5.tar.gz.

File metadata

  • Download URL: EthAlexandria-0.0.5.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.9

File hashes

Hashes for EthAlexandria-0.0.5.tar.gz
Algorithm Hash digest
SHA256 e0af2568efdf11ea202bc2c7fc49338aad7de72815c6f714613653740c5c7d05
MD5 3c25cedacee9f41022558a9e1aef3040
BLAKE2b-256 f27fc1a38b84eb421fd6738f40362d2305f862f80990e6cbe0915f65b03c7031

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page