# DesoPy - A python module to interact with DeSo Blockchain.
Run `pip install deso` to install the module!
The module uses node.deso.org API (by default) and can be changed to any Deso node URL
by passing the argument `nodeURL` to any of the classes.
For example:
```python
import deso
desoUser = deso.User(nodeURL="https://love4src.com/api/v0/")
```
Developed by [ItsAditya](https://diamondapp.com/u/itsaditya)
## How to Use:
### Metadata
1. Getting Deso Price
```python
import deso
# takes two optional Argument; publicKey and nodeURL. By default NodeURL is https://node.deso.org/api/v0/"
desoMetadata = deso.Metadata()
response = desoMetadata.getExchangeRate() # returns a response object.
print(response.json()) # you can also use response.status_code to check if request was succesful
```
2. Getting Node Health
```python
import deso
desoMetadata = deso.Metadata()
print(desoMetadata.getNodeHealth().json())
```
3. Getting App State which includes node fee, diamond level map and other info related to node
```python
import deso
desoMetadata = deso.Metadata()
print(desoMetadata.getAppState().json())
```
4. Getting value of each diamond
```python
import deso
desoMetadata = deso.Metadata()
print(desoMetadata.getDiamondLevelMap()) # getDiamondLevelMap takes optional inDesoNanos argument which is by default True.
```
### User
1. Getting user profile
```python
import deso
desoUser = deso.User()
print(desoUser.getSingleProfile(username="ItsAditya").json())
# you can set username to "" and use publicKey instead. Like: getSingleProfiel(publicKey = "BBC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg")
```
2. Getting publicKey info
```python
import deso
desoUser = deso.User()
publicKeyList = ["BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg",
"BC1YLhGyi3t6ppCMARk3pmXGTkrSJXw3GWxQsYwQp58897ho8Nbr1it"]
print(desoUser.getUsersStateless(listOfPublicKeys=publicKeyList).json())
```
3. Getting profile pic URL
```python
import deso
desoUser = deso.User()
print(desoUser.getProfilePicURL(
"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"))
```
4. Getting User Messages
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getMessagesStateless(
publicKey=userPublicKey, numToFetch=10).json())
# There are more argument in getMessagesStateless like sortAlgorithm, followersOnly, followingOnly, holdersOnly, holdingsOnly, fetchAfterPublicKey
```
5. Getting user notifications
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getNotifications(userPublicKey, numToFetch=1000).json())
# There are other argument in getNotifications() like startIndex, filterOutNotificationCategories, etc.
```
6. Getting User NFTs
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getNFTs(userPublicKey = userPublicKey, isForSale=True).json())
```
7. Get derived keys of a user
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getDerivedKeys(userPublicKey).json())
```
8. Getting transaction info of a user
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getTransactionInfo(userPublicKey).json())
# There are other arguments in getTransactionInfo() like limit, lastPublicKeyTransactionIndex and lastTransactionIDBase58Check
```
9. Getting holders for a public key
```python
import deso
desoUser = deso.User()
userPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getHoldersForPublicKey(userPublicKey).json())
# There are other arugments in getHoldersForPublicKey like username, fetchAll, numToFetch, fetchHodlings, isDAOCOIN, lastPublicKey
```
10. Getting DAO coin limit orders of a DAO coin
```python
import deso
desoUser = deso.User()
daoCoinPublicKey = "BC1YLj3zNA7hRAqBVkvsTeqw7oi4H6ogKiAFL1VXhZy6pYeZcZ6TDRY"
print(desoUser.getDaoCoinLimitOrders(daoCoinPublicKey))
```
11. Getting DAO coin price (market price)
```python
import deso
desoUser = deso.User()
daoCoinPublicKey = "BC1YLj3zNA7hRAqBVkvsTeqw7oi4H6ogKiAFL1VXhZy6pYeZcZ6TDRY"
print(desoUser.getDaoCoinPrice(daoCoinPublicKey))
```
12. Geting user followings/followers
```python
import deso
desoUser = deso.User()
print(desoUser.getFollowsStateless(username = "ItsAditya").json())
```
The default behavior from the above code will return the users the account is following.
To get the list of the account's followers, you must set **getFollowing** to _False_.
```python
print(desoUser.getFollowsStateless(username = "ItsAditya", getFollowing = False).json())
```
13. Getting diamonds sent/received by a publicKey
```python
import deso
desoUser = deso.User()
publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoUser.getDiamondsForPublicKey(publicKey, received=False).json())
# set received = True to get diamonds given to a publicKey
```
### Posts
1. Get posts stateless - getting info about post
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getPostsStateless(postHashHex= postHashHex, numToFetch=10).json())
# There are other functions in getPostsStateless that can be used to get more information about a post.
```
2. Get single post information
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getSinglePost(postHashHex).json())
# There are other functions in getSinglePost() that can be used to get more information about a post.
```
3. Get posts by publicKey or user
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getPostsForPublicKey(username="ItsAditya").json())
# getPostsForPublicKey() has more arguments like publicKey, mediaRequired, numToFetch, lastPostHashHex, readerPublicKey etc.
```
4. Get serials of NFT post include other info
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getNFTEntriesForNFTPost(postHashHex).json())
```
5. Get likes for post
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getLikesForPost(postHashHex).json())
# getLikesForPost has more arguments like limit, offset etc.
```
6. Get diamonds for post
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getDiamondsForPost(postHashHex).json())
# getDiamondsForPost has more arguments like limit, offset etc.
```
7. Get getQuoteRepostsForPost for post
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getQuoteRepostsForPost(postHashHex).json())
# getQuoteRepostsForPost has more arguments like limit, offset etc.
```
8. Get Hot feed/ Posts mentioning any @ username
```python
import deso
desoPosts = deso.Posts()
print(desoPosts.getHotFeed(taggedUsername="ItsAditya").json())
```
9. Get NFT info along with all the bids made to that NFT
```python
import deso
desoPosts = deso.Posts()
postHashHex = "74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196"
print(desoPosts.getNFTBidsForNFTPost(postHashHex).json())
```
### Social
To perform all the WRITE actions to DeSo Blockchain you need SEED_HEX and DESO Public Key.
This is how you generate SEED_HEX using your 12 word mnemonic phrase.
```python
from deso import Identity
SEED_PHRASE = 'YOUR 12 WORD DESO SEED PHRASE'
SEED_HEX = Identity.getSeedHexFromSeedPhrase(SEED_PHRASE)
print(SEED_HEX)
```
You can also generate brand new DeSo seed phrase using this code.
```python
from deso import Identity
seedPhrase = Identity.generateDesoSeedPhrase()
print(seedPhrase)
```
1. Making post to deso blockchain
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(PUBLIC_KEY, SEED_HEX)
'''In the above deso.Social() constructor, you can pass `derivedPublicKey` and `derivedSeedHex`
to make the transactions using derived keys.
NOTE: YOU MUST PASS ORIGINAL PUBLIC KEY TO CREATE THE TRANSACTION
''''
# submitPost() takes many optional argument like imageURLs, videoURLs, postExtraData etc.
# you will use the same function to make comment and quote any post.
print(desoSocial.submitPost("This is a test post")) #returns a response object. add .json() in end to see complete response
```
2. Follow user
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(nodeURL="https://diamondapp.com/api/v0/", publicKey = PUBLIC_KEY, seedHex = SEED_HEX)
print(desoSocial.follow("BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg", isFollow=True).json())
```
3. Repost a post
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHexToRepost = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.repost(postHashHexToRepost).json())
```
4. Quote a post
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHexToQuote = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.quote(body = "this is quoted post", postHashHexToQuote).json())
```
5. Like a post
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.like(postHashHex, isLike=True).json())
```
6. Diamond a post
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
receiverPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoSocial.diamond(postHashHex, receiverPublicKey, diamondLevel=2).json())
```
7. Update Profile
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
print(desoSocial.updateProfile(FR=10, description="This is my description",
username="NotItsAditya", profilePicBase64='').json())
# In the above example, make sure profilePicBase64 is BASE64 encoded image otherwise it wont' work.
# you can also pass `extraData`, a dict argument for extra data in profile
```
8. Send Private Message
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
receiverPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoSocial.sendPrivateMessage(receiverPublicKey, "This DM is send using DesoPy library").json())
```
9. Minting a postHashHex as NFT
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.mint(postHashHex, minBidDeSo=1, copy=2, creatorRoyality=10, coinHolderRoyality=4, isForSale=True).json())
```
10. Updating NFT to put it on sale, or as buy now etc.
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.updateNFT(postHashHex, buyNowPriceInDeso=2,
buyNow=True, minBidDeso=1.5, forSale=2, serialNumber=1).json())
```
11. Burn an NFT
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.burnNFT(postHashHex, serialNumber=2).json())
```
12. Create NFT Bid
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
print(desoSocial.createNFTBid(NFTPostHashHex=postHashHex, serialNumber=1, bidAmountDeso=2).json())
```
13. Transfer NFT
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
postHashHex = "bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177"
receiverPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoSocial.transferNFT(postHashHex, receiverPublicKey, serialNumber=1).json())
```
### Deso Identity
1. Getting JWT token
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoIdentity = deso.Identity(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
print(desoIdentity.getJWT())
```
2. Validate JWT token
```python
import deso
desoIdentity = deso.Identity()
jwt_tokenn = "" # JWT TOKEN TO VALIDATE
userPublicKey = "" # User's public Key whoose JWT you wanna validate
print(desoIdentity.validateJWT(JWT=jwt_token, publicKey=userPublicKey))
```
3. Sign transaction (OFFLINE OBVIOUSLY)
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
transactionHex = " Transaction Hex of the transaction created by public Key"
desoIdentity = deso.Identity()
print(desoIdentity.signTransaction(seedHex = SEED_HEX, transactionHex=transactionHex))
```
### Media
1. Upload image to images.deso.org
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoMedia = deso.Media( PUBLIC_KEY, SEED_HEX)
imageFileList = [
('file', ('screenshot.jpg', open("img.png", "rb"), 'image/png'))
] # 'img.png' is the image we are uploading to images.bitclout.com
urlResponse = desoMedia.uploadImage(imageFileList)
print(urlResponse.json())
```
### Trade
1. Send deso to public Key
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX )
print(desoTrade.sendDeso( recieverPublicKeyOrUsername = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg", desoToSend = 0.01).json())
```
2. Buy creator coin
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)
creatorPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoTrade.buyCreatorCoin(creatorPublicKey=creatorPublicKey, desoAmountToBuy=2).json())
```
3. get creator coins held by a publicKey
```python
import deso
desoTrade = deso.Trade()
creatorPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoTrade.getHeldCoinsOfCreator(publicKeyOfCoin=creatorPublicKey).json())
```
4. Get selling amount of a creator coin
```python
import deso
desoTrade = deso.Trade()
coinsInCirculationNanos = 3857329848
balanceNanons = 34938
desoLockedNanos = 12948584035
print(desoTrade.amountOnSell(desoLockedNanos = desoLockedNanos, coinsInCirculation=coinsInCirculationNanos, balanceNanos=balanceNanos))
```
5. Selling a creator coin
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)
coinsToSellNanons = 34938
creatorPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoTrade.sellCreatorCoin(
creatorPublicKey=creatorPublicKey, coinsToSellNanos=coinsToSellNanons).json())
```
6. Send creator coin
```python
import deso
SEED_HEX = 'YOUR SEED SEED_HEX'
PUBLIC_KEY = 'YOUR PUBLIC_KEY'
desoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)
coinsToSendNanos = 34938
creatorPublicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
print(desoTrade.sendCreatorCoins(creatorPublicKey=creatorPublicKey,
receiverUsernameOrPublicKey="Octane", creatorCoinNanosToSend=coinsToSendNanos).json())
```
7. Send DAO coins
```python
import deso
SEED_HEX = "Your seed Hex here"
PUBLIC_KEY = "Your public key"
'''Sends DAO coin to publicKey or username. Use the hex() function to convert a number to hexadecimal
for Example, if you want to send 15 DAO coin, set coinsToTransfer to hex(int(15*1e18))'''
desoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
coinsToTransfer = 15
coinsToTransferInRequiredForamt = hex(int(coinsToTransfer * 1e18))
transferStatus = desoTrade.sendDAOCoins(coinsToTransfer=coinsToTransferInRequiredForamt,
daoPublicKeyOrName="CockyClout", receiverPublicKeyOrUsername="ItsAditya")
print(transferStatus)
```
8. Burn DAO coins
```python
import deso
SEED_HEX = "Your seed Hex here"
PUBLIC_KEY = "Your public key"
'''Burns DAO coin of daoPublicKeyOrName. Use the hex() function to convert a number to hexadecimal
for Example, if you want to burn 15 DAO coin, set coinsToBurn to hex(int(15*1e18))'''
desoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
coinsToBurn = 5000000
coisToBurnInRequiredFormat = hex(int(coinsToBurn * 1e18))
burnStatus = desoTrade.burnDAOCoins(coinsToBurn=coisToBurnInRequiredFormat,
daoPublicKeyOrName="CockyClout")
print(burnStatus)
```
9. Mint DAO coins
```python
import deso
SEED_HEX = "Your seed Hex here"
PUBLIC_KEY = "Your public key"
'''Mint DAO coins. Use the hex() function to convert a number to hexadecimal
for Example, if you want to mint 15 DAO coin, set coinsToBurn to hex(int(15*1e18))'''
desoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)
coinsToMint = 1000000
coinsToBurnInRequiredFormat = hex(int(coinsToMint * 1e18))
mintStatus = desoTrade.mintDAOCoins(coinsToBurnInRequiredFormat)
print(mintStatus)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "deso",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "deso,python,bitclout,social media,crypto,blockchain,decentralisation,decentralized social media",
"author": "ItsAditya (https://itsaditya.xyz)",
"author_email": "<chaudharyaditya0005@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5c/da/e4f5a0706536d9946878d24dc12b6cf36456982bc3c59eb125a3510142f8/deso-2.3.6.tar.gz",
"platform": null,
"description": "\r\n# DesoPy - A python module to interact with DeSo Blockchain.\r\r\n\r\r\nRun `pip install deso` to install the module!\r\r\n\r\r\nThe module uses node.deso.org API (by default) and can be changed to any Deso node URL\r\r\nby passing the argument `nodeURL` to any of the classes.\r\r\n\r\r\nFor example:\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoUser = deso.User(nodeURL=\"https://love4src.com/api/v0/\")\r\r\n```\r\r\n\r\r\nDeveloped by [ItsAditya](https://diamondapp.com/u/itsaditya)\r\r\n\r\r\n## How to Use:\r\r\n\r\r\n### Metadata\r\r\n\r\r\n1. Getting Deso Price\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\n# takes two optional Argument; publicKey and nodeURL. By default NodeURL is https://node.deso.org/api/v0/\"\r\r\ndesoMetadata = deso.Metadata()\r\r\nresponse = desoMetadata.getExchangeRate() # returns a response object.\r\r\nprint(response.json()) # you can also use response.status_code to check if request was succesful\r\r\n```\r\r\n\r\r\n2. Getting Node Health\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoMetadata = deso.Metadata()\r\r\nprint(desoMetadata.getNodeHealth().json())\r\r\n```\r\r\n\r\r\n3. Getting App State which includes node fee, diamond level map and other info related to node\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoMetadata = deso.Metadata()\r\r\nprint(desoMetadata.getAppState().json())\r\r\n```\r\r\n\r\r\n4. Getting value of each diamond\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoMetadata = deso.Metadata()\r\r\nprint(desoMetadata.getDiamondLevelMap()) # getDiamondLevelMap takes optional inDesoNanos argument which is by default True.\r\r\n```\r\r\n\r\r\n### User\r\r\n\r\r\n1. Getting user profile\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nprint(desoUser.getSingleProfile(username=\"ItsAditya\").json())\r\r\n# you can set username to \"\" and use publicKey instead. Like: getSingleProfiel(publicKey = \"BBC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\")\r\r\n```\r\r\n\r\r\n2. Getting publicKey info\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\npublicKeyList = [\"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\",\r\r\n \"BC1YLhGyi3t6ppCMARk3pmXGTkrSJXw3GWxQsYwQp58897ho8Nbr1it\"]\r\r\nprint(desoUser.getUsersStateless(listOfPublicKeys=publicKeyList).json())\r\r\n```\r\r\n\r\r\n3. Getting profile pic URL\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nprint(desoUser.getProfilePicURL(\r\r\n \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"))\r\r\n```\r\r\n\r\r\n4. Getting User Messages\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getMessagesStateless(\r\r\n publicKey=userPublicKey, numToFetch=10).json())\r\r\n# There are more argument in getMessagesStateless like sortAlgorithm, followersOnly, followingOnly, holdersOnly, holdingsOnly, fetchAfterPublicKey\r\r\n```\r\r\n\r\r\n5. Getting user notifications\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getNotifications(userPublicKey, numToFetch=1000).json())\r\r\n# There are other argument in getNotifications() like startIndex, filterOutNotificationCategories, etc.\r\r\n```\r\r\n\r\r\n6. Getting User NFTs\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getNFTs(userPublicKey = userPublicKey, isForSale=True).json())\r\r\n```\r\r\n\r\r\n7. Get derived keys of a user\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getDerivedKeys(userPublicKey).json())\r\r\n```\r\r\n\r\r\n8. Getting transaction info of a user\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getTransactionInfo(userPublicKey).json())\r\r\n# There are other arguments in getTransactionInfo() like limit, lastPublicKeyTransactionIndex and lastTransactionIDBase58Check\r\r\n```\r\r\n\r\r\n9. Getting holders for a public key\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nuserPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getHoldersForPublicKey(userPublicKey).json())\r\r\n# There are other arugments in getHoldersForPublicKey like username, fetchAll, numToFetch, fetchHodlings, isDAOCOIN, lastPublicKey\r\r\n```\r\r\n\r\r\n10. Getting DAO coin limit orders of a DAO coin\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\ndaoCoinPublicKey = \"BC1YLj3zNA7hRAqBVkvsTeqw7oi4H6ogKiAFL1VXhZy6pYeZcZ6TDRY\"\r\r\nprint(desoUser.getDaoCoinLimitOrders(daoCoinPublicKey))\r\r\n```\r\r\n\r\r\n11. Getting DAO coin price (market price)\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\ndaoCoinPublicKey = \"BC1YLj3zNA7hRAqBVkvsTeqw7oi4H6ogKiAFL1VXhZy6pYeZcZ6TDRY\"\r\r\nprint(desoUser.getDaoCoinPrice(daoCoinPublicKey))\r\r\n```\r\r\n\r\r\n12. Geting user followings/followers\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoUser = deso.User()\r\r\nprint(desoUser.getFollowsStateless(username = \"ItsAditya\").json())\r\r\n```\r\r\n\r\r\nThe default behavior from the above code will return the users the account is following.\r\r\nTo get the list of the account's followers, you must set **getFollowing** to _False_.\r\r\n\r\r\n```python\r\r\nprint(desoUser.getFollowsStateless(username = \"ItsAditya\", getFollowing = False).json())\r\r\n```\r\r\n\r\r\n13. Getting diamonds sent/received by a publicKey\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoUser = deso.User()\r\r\npublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoUser.getDiamondsForPublicKey(publicKey, received=False).json())\r\r\n# set received = True to get diamonds given to a publicKey\r\r\n```\r\r\n\r\r\n### Posts\r\r\n\r\r\n1. Get posts stateless - getting info about post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getPostsStateless(postHashHex= postHashHex, numToFetch=10).json())\r\r\n\r\r\n# There are other functions in getPostsStateless that can be used to get more information about a post.\r\r\n```\r\r\n\r\r\n2. Get single post information\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getSinglePost(postHashHex).json())\r\r\n# There are other functions in getSinglePost() that can be used to get more information about a post.\r\r\n```\r\r\n\r\r\n3. Get posts by publicKey or user\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getPostsForPublicKey(username=\"ItsAditya\").json())\r\r\n# getPostsForPublicKey() has more arguments like publicKey, mediaRequired, numToFetch, lastPostHashHex, readerPublicKey etc.\r\r\n```\r\r\n\r\r\n4. Get serials of NFT post include other info\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getNFTEntriesForNFTPost(postHashHex).json())\r\r\n```\r\r\n\r\r\n5. Get likes for post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getLikesForPost(postHashHex).json())\r\r\n# getLikesForPost has more arguments like limit, offset etc.\r\r\n```\r\r\n\r\r\n6. Get diamonds for post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getDiamondsForPost(postHashHex).json())\r\r\n# getDiamondsForPost has more arguments like limit, offset etc.\r\r\n```\r\r\n\r\r\n7. Get getQuoteRepostsForPost for post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getQuoteRepostsForPost(postHashHex).json())\r\r\n# getQuoteRepostsForPost has more arguments like limit, offset etc.\r\r\n```\r\r\n\r\r\n8. Get Hot feed/ Posts mentioning any @ username\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoPosts = deso.Posts()\r\r\nprint(desoPosts.getHotFeed(taggedUsername=\"ItsAditya\").json())\r\r\n```\r\r\n\r\r\n9. Get NFT info along with all the bids made to that NFT\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoPosts = deso.Posts()\r\r\npostHashHex = \"74d50e4d33b7512941a2ada91a947aecfc2f9fd179d67eb1e0008d4812597196\"\r\r\nprint(desoPosts.getNFTBidsForNFTPost(postHashHex).json())\r\r\n```\r\r\n\r\r\n### Social\r\r\n\r\r\nTo perform all the WRITE actions to DeSo Blockchain you need SEED_HEX and DESO Public Key.\r\r\n\r\r\nThis is how you generate SEED_HEX using your 12 word mnemonic phrase.\r\r\n\r\r\n```python\r\r\nfrom deso import Identity\r\r\nSEED_PHRASE = 'YOUR 12 WORD DESO SEED PHRASE'\r\r\nSEED_HEX = Identity.getSeedHexFromSeedPhrase(SEED_PHRASE)\r\r\nprint(SEED_HEX)\r\r\n```\r\r\n\r\r\nYou can also generate brand new DeSo seed phrase using this code.\r\r\n\r\r\n```python\r\r\nfrom deso import Identity\r\r\nseedPhrase = Identity.generateDesoSeedPhrase()\r\r\nprint(seedPhrase)\r\r\n```\r\r\n\r\r\n1. Making post to deso blockchain\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\ndesoSocial = deso.Social(PUBLIC_KEY, SEED_HEX)\r\r\n'''In the above deso.Social() constructor, you can pass `derivedPublicKey` and `derivedSeedHex`\r\r\nto make the transactions using derived keys.\r\r\nNOTE: YOU MUST PASS ORIGINAL PUBLIC KEY TO CREATE THE TRANSACTION\r\r\n''''\r\r\n\r\r\n# submitPost() takes many optional argument like imageURLs, videoURLs, postExtraData etc.\r\r\n# you will use the same function to make comment and quote any post.\r\r\nprint(desoSocial.submitPost(\"This is a test post\")) #returns a response object. add .json() in end to see complete response\r\r\n```\r\r\n\r\r\n2. Follow user\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(nodeURL=\"https://diamondapp.com/api/v0/\", publicKey = PUBLIC_KEY, seedHex = SEED_HEX)\r\r\nprint(desoSocial.follow(\"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\", isFollow=True).json())\r\r\n```\r\r\n\r\r\n3. Repost a post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHexToRepost = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.repost(postHashHexToRepost).json())\r\r\n```\r\r\n\r\r\n4. Quote a post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHexToQuote = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.quote(body = \"this is quoted post\", postHashHexToQuote).json())\r\r\n```\r\r\n\r\r\n5. Like a post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.like(postHashHex, isLike=True).json())\r\r\n```\r\r\n\r\r\n6. Diamond a post\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nreceiverPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoSocial.diamond(postHashHex, receiverPublicKey, diamondLevel=2).json())\r\r\n```\r\r\n\r\r\n7. Update Profile\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\nprint(desoSocial.updateProfile(FR=10, description=\"This is my description\",\r\r\n username=\"NotItsAditya\", profilePicBase64='').json())\r\r\n\r\r\n\r\r\n# In the above example, make sure profilePicBase64 is BASE64 encoded image otherwise it wont' work.\r\r\n# you can also pass `extraData`, a dict argument for extra data in profile\r\r\n```\r\r\n\r\r\n8. Send Private Message\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\nreceiverPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoSocial.sendPrivateMessage(receiverPublicKey, \"This DM is send using DesoPy library\").json())\r\r\n```\r\r\n\r\r\n9. Minting a postHashHex as NFT\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.mint(postHashHex, minBidDeSo=1, copy=2, creatorRoyality=10, coinHolderRoyality=4, isForSale=True).json())\r\r\n```\r\r\n\r\r\n10. Updating NFT to put it on sale, or as buy now etc.\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.updateNFT(postHashHex, buyNowPriceInDeso=2,\r\r\n buyNow=True, minBidDeso=1.5, forSale=2, serialNumber=1).json())\r\r\n```\r\r\n\r\r\n11. Burn an NFT\r\r\n\r\r\n```python\r\r\n\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.burnNFT(postHashHex, serialNumber=2).json())\r\r\n```\r\r\n\r\r\n12. Create NFT Bid\r\r\n\r\r\n```python\r\r\n\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nprint(desoSocial.createNFTBid(NFTPostHashHex=postHashHex, serialNumber=1, bidAmountDeso=2).json())\r\r\n```\r\r\n\r\r\n13. Transfer NFT\r\r\n\r\r\n```python\r\r\n\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoSocial = deso.Social(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\npostHashHex = \"bd292216e8cc1b7f2dd2cc6bba5afa20b65a4b9966ea191644c90254bedbe177\"\r\r\nreceiverPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoSocial.transferNFT(postHashHex, receiverPublicKey, serialNumber=1).json())\r\r\n```\r\r\n\r\r\n### Deso Identity\r\r\n\r\r\n1. Getting JWT token\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoIdentity = deso.Identity(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\nprint(desoIdentity.getJWT())\r\r\n```\r\r\n\r\r\n2. Validate JWT token\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoIdentity = deso.Identity()\r\r\njwt_tokenn = \"\" # JWT TOKEN TO VALIDATE\r\r\nuserPublicKey = \"\" # User's public Key whoose JWT you wanna validate\r\r\nprint(desoIdentity.validateJWT(JWT=jwt_token, publicKey=userPublicKey))\r\r\n```\r\r\n\r\r\n3. Sign transaction (OFFLINE OBVIOUSLY)\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\ntransactionHex = \" Transaction Hex of the transaction created by public Key\"\r\r\ndesoIdentity = deso.Identity()\r\r\nprint(desoIdentity.signTransaction(seedHex = SEED_HEX, transactionHex=transactionHex))\r\r\n```\r\r\n\r\r\n### Media\r\r\n\r\r\n1. Upload image to images.deso.org\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\ndesoMedia = deso.Media( PUBLIC_KEY, SEED_HEX)\r\r\nimageFileList = [\r\r\n ('file', ('screenshot.jpg', open(\"img.png\", \"rb\"), 'image/png'))\r\r\n] # 'img.png' is the image we are uploading to images.bitclout.com\r\r\nurlResponse = desoMedia.uploadImage(imageFileList)\r\r\nprint(urlResponse.json())\r\r\n```\r\r\n\r\r\n### Trade\r\r\n\r\r\n1. Send deso to public Key\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\ndesoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX )\r\r\n\r\r\nprint(desoTrade.sendDeso( recieverPublicKeyOrUsername = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\", desoToSend = 0.01).json())\r\r\n```\r\r\n\r\r\n2. Buy creator coin\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)\r\r\ncreatorPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoTrade.buyCreatorCoin(creatorPublicKey=creatorPublicKey, desoAmountToBuy=2).json())\r\r\n```\r\r\n\r\r\n3. get creator coins held by a publicKey\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\ndesoTrade = deso.Trade()\r\r\ncreatorPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoTrade.getHeldCoinsOfCreator(publicKeyOfCoin=creatorPublicKey).json())\r\r\n```\r\r\n\r\r\n4. Get selling amount of a creator coin\r\r\n\r\r\n```python\r\r\nimport deso\r\r\ndesoTrade = deso.Trade()\r\r\ncoinsInCirculationNanos = 3857329848\r\r\nbalanceNanons = 34938\r\r\ndesoLockedNanos = 12948584035\r\r\nprint(desoTrade.amountOnSell(desoLockedNanos = desoLockedNanos, coinsInCirculation=coinsInCirculationNanos, balanceNanos=balanceNanos))\r\r\n```\r\r\n\r\r\n5. Selling a creator coin\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)\r\r\n\r\r\ncoinsToSellNanons = 34938\r\r\ncreatorPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoTrade.sellCreatorCoin(\r\r\n creatorPublicKey=creatorPublicKey, coinsToSellNanos=coinsToSellNanons).json())\r\r\n```\r\r\n\r\r\n6. Send creator coin\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = 'YOUR SEED SEED_HEX'\r\r\nPUBLIC_KEY = 'YOUR PUBLIC_KEY'\r\r\n\r\r\ndesoTrade = deso.Trade(PUBLIC_KEY, SEED_HEX)\r\r\n\r\r\ncoinsToSendNanos = 34938\r\r\ncreatorPublicKey = \"BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg\"\r\r\nprint(desoTrade.sendCreatorCoins(creatorPublicKey=creatorPublicKey,\r\r\n receiverUsernameOrPublicKey=\"Octane\", creatorCoinNanosToSend=coinsToSendNanos).json())\r\r\n```\r\r\n\r\r\n7. Send DAO coins\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = \"Your seed Hex here\"\r\r\nPUBLIC_KEY = \"Your public key\"\r\r\n\r\r\n'''Sends DAO coin to publicKey or username. Use the hex() function to convert a number to hexadecimal\r\r\nfor Example, if you want to send 15 DAO coin, set coinsToTransfer to hex(int(15*1e18))'''\r\r\ndesoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\ncoinsToTransfer = 15\r\r\ncoinsToTransferInRequiredForamt = hex(int(coinsToTransfer * 1e18))\r\r\ntransferStatus = desoTrade.sendDAOCoins(coinsToTransfer=coinsToTransferInRequiredForamt,\r\r\n daoPublicKeyOrName=\"CockyClout\", receiverPublicKeyOrUsername=\"ItsAditya\")\r\r\nprint(transferStatus)\r\r\n```\r\r\n\r\r\n8. Burn DAO coins\r\r\n\r\r\n```python\r\r\nimport deso\r\r\nSEED_HEX = \"Your seed Hex here\"\r\r\nPUBLIC_KEY = \"Your public key\"\r\r\n\r\r\n'''Burns DAO coin of daoPublicKeyOrName. Use the hex() function to convert a number to hexadecimal\r\r\n for Example, if you want to burn 15 DAO coin, set coinsToBurn to hex(int(15*1e18))'''\r\r\ndesoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\ncoinsToBurn = 5000000\r\r\ncoisToBurnInRequiredFormat = hex(int(coinsToBurn * 1e18))\r\r\nburnStatus = desoTrade.burnDAOCoins(coinsToBurn=coisToBurnInRequiredFormat,\r\r\n daoPublicKeyOrName=\"CockyClout\")\r\r\nprint(burnStatus)\r\r\n```\r\r\n\r\r\n9. Mint DAO coins\r\r\n\r\r\n```python\r\r\nimport deso\r\r\n\r\r\nSEED_HEX = \"Your seed Hex here\"\r\r\nPUBLIC_KEY = \"Your public key\"\r\r\n\r\r\n'''Mint DAO coins. Use the hex() function to convert a number to hexadecimal\r\r\n for Example, if you want to mint 15 DAO coin, set coinsToBurn to hex(int(15*1e18))'''\r\r\ndesoTrade = deso.Trade(publicKey=PUBLIC_KEY, seedHex=SEED_HEX)\r\r\ncoinsToMint = 1000000\r\r\ncoinsToBurnInRequiredFormat = hex(int(coinsToMint * 1e18))\r\r\nmintStatus = desoTrade.mintDAOCoins(coinsToBurnInRequiredFormat)\r\r\nprint(mintStatus)\r\r\n```\r\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A python module for deso",
"version": "2.3.6",
"project_urls": null,
"split_keywords": [
"deso",
"python",
"bitclout",
"social media",
"crypto",
"blockchain",
"decentralisation",
"decentralized social media"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5cdae4f5a0706536d9946878d24dc12b6cf36456982bc3c59eb125a3510142f8",
"md5": "7ba4a40726522172f4500c6b7eb8a551",
"sha256": "a79f0020e0af4d1c6774f723a07bf9deb42f2fb713c09c1a546175eeeaca0970"
},
"downloads": -1,
"filename": "deso-2.3.6.tar.gz",
"has_sig": false,
"md5_digest": "7ba4a40726522172f4500c6b7eb8a551",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24357,
"upload_time": "2023-08-17T15:44:12",
"upload_time_iso_8601": "2023-08-17T15:44:12.687195Z",
"url": "https://files.pythonhosted.org/packages/5c/da/e4f5a0706536d9946878d24dc12b6cf36456982bc3c59eb125a3510142f8/deso-2.3.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-17 15:44:12",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "deso"
}