A python module for DeSo

Related tags

MiscellaneousDeSo.py
Overview

DeSo.py

A python package for DeSo.

Developed by ItsAditya

Run pip install deso to install the module!

Examples of How To Use DeSo.py

Getting $DeSo price

import deso
print(deso.Deso.getDeSoPrice())

Getting user(s) info through publicKey(s)

import deso
import json
with open("userInfo.json", "w") as file:
    listOfPublicKeys = ["BC1YLjJVhcVAi5UCYZ2aTNwRMtqvzQar4zbymr7fyinu8MsWLx2A1g1"] # you can pass multiple public key of users
    json.dump(deso.Users.getUserStateless(listOfPublicKeys), file)

Getting user info through DeSo username

import deso
import json
with open("userInfo.json", "w") as file:
    username = "ItsAditya" 
    json.dump(deso.Users.getSingleProfile(username=username), file) #you can also pass publicKey = "
   
    " here instead of username just in case you want to get the profile info from public key
   

Getting profile pic through public key

import deso
publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg" # well, that's my (@ItsAditya) public key :)
print(deso.Users.getProfilePic(publicKey))

Getting wallet of a user through public key

import deso
import json
publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg" 
with open("wallet.json", "w") as file:
    walletData = deso.Users.getWallet(publicKey, includeCreatorCoin = True) # make includeCreatorCoin as false when you don't want to have creator coin investment in the response data
    json.dump(walletData, file)

getting creator coin holders of a user

import deso 
import json
publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
with open("investors.json", "w") as file:
    investorData = deso.Users.getHodlers( username =  "", publicKey= publicKey, lastPublicKey= "", numToFetch = 100, fetchAll = False)
    # well, you can play around with above list of args to get what you want :)
    json.dump(investorData, file) 

Getting users who are blocked by a profile

import deso
import json
with open("blockedUsers.json", "w") as file:
    publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg" # well, that's my (@ItsAditya) public key :)
    json.dump(deso.Users.getUsersBlocked(publicKey), file)

Getting user posts

import deso
import json
with open("UserPosts.json", "w") as file:
    json.dump(deso.Posts.getUserPosts(username="ItsAditya"), file)

Getting information about single post ( likes, comments etc on a post)

import deso
import json
with open("UserPosts.json", "w") as file:
    postHash = "52f9b2dc7f616a94d583a5a167bb49ba7558279e06bdd0642b1777246a6570a2" #the hash of the post. you can find this in post URL :)

    postInfo = deso.Posts.getPostInfo(postHash, commentLimit = 20, fetchParents = False, commentOffset = 0, addGlobalFeedBool = False, readerPublicKey = "BC1YLianxEsskKYNyL959k6b6UPYtRXfZs4MF3GkbWofdoFQzZCkJRB")
    json.dump(postInfo, file)

Getting diamond information about a user (received or sent)

import deso
import json
with open("diamondsReceived.json", "w") as file:
    publicKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
    diamondData = deso.Diamonds.getDiamonds(publicKey=publicKey, received=True)
    '''reveived is an optional arguement when true it returns diamond received by users else
    return diamonds give by users'''
    json.dump(diamondData, file)

Getting deleted posts of a user

import deso
import json

#public Key of @DiamondHands
publicKey = "BC1YLgU67opDhT9bTPsqvue9QmyJLDHRZrSj77cF3P4yYDndmad9Wmx" 
with open("HiddenPosts.json", "w") as file:
    json.dump(deso.Posts.getHiddenPosts(publicKey), file)

Buying creator coin of a user

from deso import *

''' SEEDHEX should always be kept private. It has access to your complete wallet. It's kinda like
    seed phrase. This is why writing methods in backend isn't a good practice until we have derived keys.
    You can only automate your own account and can't have user authorisation. It is recommended to use test account while using write methods.

    You can find the seedHex of your account in your browser storage. Just open https://bitclout.com/ > Dev tools > Application > Storage > Local Storage > https://identity.bitclout.com > users > Select the public key with which you want to post > seedHex'''
SEEDHEX = "" # you seedHex
PUBLIC_KEY = "" #you PublicKey


PublicKeyToBuy = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg" 
trade = Trade(SEEDHEX, PUBLIC_KEY)
status = trade.buy(keyToBuy = PublicKeyToBuy, DeSo = 0.1) # you are buying 0.1 DeSO of the creator's coin
print(status)  #200 if transaction was succesfull

Selling creator coin of a user

from deso import *

''' SEEDHEX should always be kept private. It has access to your complete wallet. It's kinda like
    seed phrase. This is why writing methods in backend isn't a good practice until we have derived keys.
    You can only automate your own account and can't have user authorisation. It is recommended to use test account while using write methods.

    You can find the seedHex of your account in your browser storage. Just open https://bitclout.com/ > Dev tools > Application > Storage > Local Storage > https://identity.bitclout.com > users > Select the public key with which you want to post > seedHex'''
SEEDHEX = "" # you seedHex
PUBLIC_KEY = "" #you PublicKey


publicKeyToSell = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg" 
trade = Trade(SEEDHEX, PUBLIC_KEY)
status = trade.sell(keyToSell = publicKeyToSell, sellMax = True)# you are selling max coins of the creator
print(status)  #200 if transaction was succesfull

Sending a post on deso

from deso import Post

''' SEEDHEX should always be kept private. It has access to your complete wallet. It's kinda like
    seed phrase. This is why writing methods in backend isn't a good practice until we have derived keys.
    You can only automate your own account and can't have user authorisation. It is recommended to use test account while using write methods.

    You can find the seedHex of your account in your browser storage. Just open https://bitclout.com/ > Dev tools > Application > Storage > Local Storage > https://identity.bitclout.com > users > Select the public key with which you want to post > seedHex'''
SEEDHEX = ""  # your seedHex
PUBLIC_KEY = ""  # your PublicKey

post = Post(SEEDHEX, PUBLIC_KEY)

status = post.send("This post was sent using the DeSo python library 😎")
print(status)  # 200 if post was successfull

Uploading image on images.bitclout.com

from deso import Post

''' SEEDHEX should always be kept private. It has access to your complete wallet. It's kinda like
    seed phrase. This is why writing methods in backend isn't a good practice until we have derived keys.
    You can only automate your own account and can't have user authorisation. It is recommended to use test account while using write methods.

    You can find the seedHex of your account in your browser storage. Just open https://bitclout.com/ > Dev tools > Application > Storage > Local Storage > https://identity.bitclout.com > users > Select the public key with which you want to post > seedHex'''
SEEDHEX = ""  # your seedHex
PUBLIC_KEY = ""  # your PublicKey

post = Post(SEEDHEX, PUBLIC_KEY)
imageFileList=[
  ('file',('screenshot.jpg',open("imageToUpload.png", "rb"),'image/png'))
] # 'imageToUpload.png' is the image we are uploading to images.bitclout.com
urlResponse = post.uploadImage(imageFileList)
print(urlResponse) # sample response: {"ImageURL":"https://images.bitclout.com/654c5d57a6f61b053290e232daa8242b7b3f156df20dacac0d20c6b00e0aeb18.webp"}

Posting image on arweave

import deso
#arweave.json is the JSON file of you arweave wallet. Get one at ardrive.io
arweaveURL = deso.Nft.uploadToArweave(
    wallet = "arweave.json",
    image = "image.png"
)
print(arweaveURL) # returns arweave image URL

Minting NFT on deso

import deso
SEED_HEX = "" #your seed hex
PUBLIC_KEY  = "" #Your public key
#uploading image to arweave. Here arweave.json is your arweave wallet JSON file. Get one at ardrive.io
arweaveURL = deso.Nft.uploadToArweave(
    wallet = "arweave.json",
    image = "image.png"
)
#posting image on DeSo
post = deso.Post(SEED_HEX, PUBLIC_KEY)
postResponse = post.send("This is the test NFT made by DeSo.py SD",
                     imageUrl=[str(arweaveURL)])
postHashHex = postResponse["postHashHex"]
status = post.mint(postHashHex, minBidDeSo=0.1, copy = 10)
if status == 200:
    print(f"NFT is live at https://diamondapp.com/nft/{postHashHex}")
else:
    print(status)

Sending direct message on DeSo

from deso import Message
import json

SEEDHEX = "" # your seed Hex
PUBLIC_KEY = "" #your public Key
msg = Message(SEEDHEX, PUBLIC_KEY)
text = "This is a direct message made using DeSo.py"
recipientKey = "BC1YLhBLE1834FBJbQ9JU23JbPanNYMkUsdpJZrFVqNGsCe7YadYiUg"
status = msg.send(recipientKey, text)
print(status)  # 200 if post was successfulld

Getting NFT entries for NFT postHash

from deso import Nft
import json
postHashHex = "d017e4a6f9a7975777f6a4f5b55074590013f362344b8928d1a1a6fcdbe10aca"
with open("NftPostInfo.json", "w") as file:
     niftyInfo = deso.Nft.getNFT(postHashHex)
     json.dump(niftyInfo, file)

More docs coming soon!

Found any issue ? Report us on our repo

Tip the author of this module some $DeSo at: @ItsAditya (even 1 diamond counts :)

Owner
ItsAditya
Learning :)
ItsAditya
Paintbot - Forward & Inverse Kinematics

PAINTBOT - FORWARD & INVERSE KINEMATICS: Overview: We built a simulation of a RRR robot shown in the figure below. The robot has 3 links and is connec

Alex Lin 1 Oct 21, 2021
A python script to simplify recompiling, signing and installing reverse engineered android apps.

urszi.py A python script to simplify the Uninstall Recompile Sign Zipalign Install cycle when reverse engineering Android applications. It checks if d

Ahmed Harmouche 4 Jun 24, 2022
Get information about what a Python frame is currently doing, particularly the AST node being executed

executing This mini-package lets you get information about what a frame is currently doing, particularly the AST node being executed. Usage Getting th

Alex Hall 211 Jan 01, 2023
eyes is a Public Opinion Mining System focusing on taiwanese forums such as PTT, Dcard.

eyes is a Public Opinion Mining System focusing on taiwanese forums such as PTT, Dcard. Features 🔥 Article monitor: helps you capture the trend at a

Sean 116 Dec 29, 2022
Paxos in Python, tested with Jepsen

Python implementation of Multi-Paxos with a stable leader and reconfiguration, roughly following "Paxos Made Moderately Complex". Run python3 paxos/st

A. Jesse Jiryu Davis 25 Dec 15, 2022
Simple python script for AD enumeration

AutoAD - Simple python script for AD enumeration This tool was created on my spare time to help fellow penetration testers in automating the basic enu

Mohammad Arman 28 Jun 21, 2022
The Blinker Herald includes helpers to easily emit signals using the excellent blinker library.

Blinker Herald The Blinker Herald includes helpers to easily emit signals using the excelent blinker library. Decorate a function or method with @blin

SatelliteQE 7 Nov 03, 2022
Auto check in via GitHub Actions

因为本人毕业离校,本项目交由在校的@hfut-xyc同学接手,请访问hfut-xyc/hfut_auto_check-in获得最新的脚本 本项目遵从GPLv2协定,Copyright (C) 2021, Fw[a]rd 免责声明 根据GPL协定,我、本项目的作者,不会对您使用这个脚本带来的任何后果

Fw[a]rd 3 Jun 27, 2021
Reproducible nvim completion framework benchmarks.

Nvim.Bench Reproducible nvim completion framework benchmarks. Runs inside Docker. Fair and balanced Methodology Note: for all "randomness", they are g

i love my dog 14 Nov 20, 2022
Problem statements on System Design and Software Architecture as part of Arpit's System Design Masterclass

Problem statements on System Design and Software Architecture as part of Arpit's System Design Masterclass

Relog 1.1k Jan 04, 2023
Simple tools for the Horse Reality webgame

Realtools (Web Tools for Horse Reality) These tools were made on request from a close friend of mine who plays this game. A live instance can be found

shay 0 Sep 06, 2022
Awesome open-source alternatives to SaaS

Awesome-oss-alternatives - Awesome list of open-source startup alternatives to well-known SaaS products

Runa Capital 12.7k Jan 03, 2023
Batch obfuscator based on the obfuscation method used by the trick bot launcher

Batch obfuscator based on the obfuscation method used by the trick bot launcher

SlizBinksman 2 Mar 19, 2022
Run Python code right in your Telegram messages

Run Python code right in your Telegram messages Made with Telethon library, TGPy is a tool for evaluating expressions and Telegram API scripts. Instal

29 Nov 22, 2022
A tool for fixing inconsistent timestamp metadata (atime, ctime, and mtime).

Mtime Fixer Mtime Fixer is a tool for fixing inconsistent timestamp metadata (atime, ctime, and mtime). Sometimes timestamp metadata of folders are in

Halit Şimşek 2 Jan 11, 2022
Mahadi-6 - This Is Bangladeshi All Sim 6 Digit Cloner Tools

BANGLADESHI ALL SIM 6 DIGIT CLONER TOOLS TOOLS $ apt update $ apt upgrade $ apt

MAHADI HASAN AFRIDI 2 Jan 23, 2022
Hspice-Wave-Generator is a tool used to quickly generate stimuli souces of hspice format

Hspice-Wave-Generator is a tool used to quickly generate stimuli souces of hspice format. All the stimuli sources are based on `pwl` function of HSPICE and the specific complex operations of writing

3 Aug 02, 2022
This is a simple leaderboard for 30 days of Google Cloud program for students of ASIET

30daysleaderboard #Hacktoberfest - Please don't make changes in readme file. Only improvement in the project will be accepted. Update - Now if you run

5 Oct 29, 2021
Expression interpreter written in Python

Calc Interpreter An interpreter modeled after a calculator implemented in Python 3. The program currently only supports basic mathematical expressions

1 Oct 17, 2021
Use `forge` and `cast` commands in Python scripts

foundrycli.py ( 🔥 , 🐍 ) foundrycli.py is a Python library I've made for personal use; now open source. It lets you access forge and cast CLIs from P

Zero Ekkusu 17 Jul 17, 2022