bitclout v0.0.1
bitclout
A set of JavaScript utils which allow you to control a BitClout account programmatically.
This is not sponsored, supported, or affiliated with the developers of the BitClout social network.
- This is still experimental -- this is still very much in an 'alpha' stage
- No guarantee is made for this API to work as expected 100% of the time
- No guarantee is made for work to always continue on this API (although I hope work continues for a while!)
Installation
npm install bitclout
How does it work?
This is running on the back of Taiko, a great little Node.js framework for controlling a browser programmatically.
Basically, it very crudely clicks and interacts with the BitClout website, based on commands.
Key points to note
- It's MIT licensed
It can be completely free to use, but by default you pay a very small fee
If you want to use this fully for free, turn off the "nice" feature in the code:
const { CloutNav } = require('bitclout'); let nav = new CloutNav; // Turn the nice feature off nav.options.nice.on = false
If the nice feature is turned on, you send a little bit of BitClout when you run commands. For more details about what the nice feature does, see "I want to be nice" later in the readme
The BitClout website changes very frequently. If functionality stops, please ping the contributors or raise an issue.
Example usage
Everything is async, pretty much. Then and catch to your heart's content.
const { CloutNav } = require('bitclout');
// Create a nav instance
let nav = new CloutNav;
MY_SEED_PHRASE = 'some words which allow you access to your account'
let info = {}
nav.open(
// Open a browser window
).then(
// Then, login
() => nav.login(MY_SEED_PHRASE)
).then(
// Then, check your portfolio
() => nav.portfolio()
).then(
portfolio => {
// Store the portfolio in global object 'info', then buy some creator coin
info.portfolio = portfolio;
nav.buy('maebeam', 0.1);
}
).then(
// Check your portfolio after by logging to console
() => nav.portfolio()
).then(console.log)
Improving the package
Issues
If you find any issues or bugs, please ping a contributor or raise an issue on GitLab.
Contributing
If you want to help out, please feel free to:
- drop me a message on GitLab
- drop me a message on BitClout (although I might be a little bit slow to respond!)
I want to be nice!
Well, that's great! By default, this package assumes you're a lovely person:
- By default, the
CloutNav
class sends0.0001
BitClout to the original package author for every 10 BitClout-related commands you make (a follow, a buy, a sell). To turn off the nice feature, set
options.nice.on
to false on yourCloutNav
instance:const { CloutNav } = require('bitclout'); let nav = new CloutNav; // Turn the nice feature off nav.options.nice.on = false
To change the amount you send, set
options.nice.fee
on yourCloutNav
instance:const { CloutNav } = require('bitclout'); let nav = new CloutNav; // Turn the nice feature down nav.options.nice.fee = 0.000001
To change how often the fee is paid, set
options.nice.every
on yourCloutNav
instance. If the value is10
(the default), you send the fee after 10 commands.So, the amount you send per command is
fee/every
. Tweak every if you want to improve performance by only sending the fee every once in a while.const { CloutNav } = require('bitclout'); nav = new CloutNav; // Pay the fee much less frequently nav.options.nice.every = 100
API
Table of Contents
- login
- logout
- CloutNav
- nice
- balance
- portfolio
- bitcoinAddress
- open
- close
- sendBitClout
- buy
- sell
- Profile
- follow
- profile
login
Login to the BitClout website.
Parameters
parent
phrase
string Seed phrase.
logout
Logout of the BitClout website.
Parameters
parent
CloutNav
Class for browser-based navigation.
Use methods to perform simple operations on the BitClout website.
Parameters
options
nice
Send a little bit of BitClout to the author (if you're feeling nice) :)
The nice settings are set on CloudNav.prototype.options.nice.
Parameters
parent
balance
Check BitClout balance of logged in user.
Parameters
parent
Returns Number Amount of BitClout.
portfolio
Check creator coin portfolio of logged in user.
Parameters
parent
Returns Object The portfolio. Keys are usernames (each as a string), values are holdings (number of creator coin, as a float). The values are only accurate to 4 decimal places (0.0001 BTCLT).
bitcoinAddress
Check Bitcoin address of logged in user.
Parameters
parent
Returns string Bitcoin address.
open
Open a browser window.
Uses Taiko (Chromium). You can have a maximum of 1 window open.
If successful, CloudNav.prototype.status.browser is set to true.
Parameters
parent
close
Close a browser window.
Uses Taiko (Chromium).
If successful, CloudNav.prototype.status.browser is set to false.
Parameters
parent
sendBitClout
Send BitClout to a user.
Parameters
buy
Buy creator coins.
Parameters
parent
username
string Username corresponding to the coin.amount
number Amount of Bitclout to use for the purchase.
sell
Sell creator coins.
Parameters
parent
username
string Username corresponding to the coin.amount
number Amount of creator coin to sell.
Profile
Type: Object
Properties
username
string Username.text
string Headline text field on profile.numFollowers
number Number of followers.price
number Coin price, in USD.publicKey
string User public key.
follow
Follow/unfollow a user.
Parameters
parent
username
string Username to follow/unfollow.
Returns boolean After running this function, true if following, false if not.
profile
Extract metadata from profile.
Parameters
parent
username
string Username to extract metadata from.
Returns Profile Profile object.
3 years ago