[steemit] How to migrate your DAPPS to Hive - Script 2: WHERE IS MY HONEY?? {dsteemJS}
Here is how you can check you balance on https://hive.blog using dsteemJS:
NOTE:
This script does not requires a pre-existing Steemit account or any private key so it's very safe to use.
If you're the paranoid type feel free to log out, use a different browser, use incognito, etc. This script does not require authentication.
STEP 1
Open your favorite browser on any site (I strongly recommend using Brave browser for its speed and security)
and open the DevTools (
Ctrl + Shift + J
on Linux/Windows and Cmd + Opt + J
on Mac)
STEP 2
Open https://unpkg.com/dsteem@0.8.7/dist/dsteem.js(dsteemJs) and copy & paste (
Ctrl + A
and Ctrl + C
) the javascript code displayed on the page into the Browser Console (DevTools) that you opened in the first tab.
STEP 3
- Copy & paste my script below in the Console
- Change the value of
targetAccount
(first line of the script) with your account name - Press enter.
var targetAccount = 'gaottantacinque';
var opts = { addressPrefix: 'STM' };
var client = new dsteem.Client('https://api.hive.blog');
var getAccountInfo = async () => {
const account = await client.database.call(
'get_accounts',
[[targetAccount]],
);
const { balance, savings_balance, sbd_balance } = account[0];
console.log(JSON.stringify({
balance, savings_balance, sbd_balance,
}));
};
getAccountInfo();
// OUTPUT:
// {"balance":"13.709 HIVE","savings_balance":"0.000 HIVE","sbd_balance":"1.136 HBD"}
Enjoy & HIVE ON!! =]
You prefer running this as a nodeJs script?
Here are the steps:
mkdir hello-hive
cd hello-hive
npm init
and (to keep it simple) keep pressing enter until you get back control of the terminalindex.js
, copy my code snippet above and add this 1 line at the top:const dsteem = require('dsteem');
npm install --save dsteem
You can now execute the script running:
node index.js
Upvoted and resteemed
You prefer running this as a nodeJs script?
Here are the steps:
mkdir hello-hive
cd hello-hive
npm init
and (to keep it simple) keep pressing enter until you get back control of the terminalindex.js
, copy my code snippet above and add this 1 line at the top:const dsteem = require('dsteem');
npm install --save dsteem
You can now execute the script running:
node index.js
😎