Hello, devs!
my name is stav AKA lonelywolf,
I'm a web developer, I worked with utopian-io for a good amount of time back in the days, I made a lot of useful tutorials mainly about STEEMjs
which is what we're going to talk about today.
so I'm not really familiar with Hive scripting, I don't really have any idea how to transfer some projects of mine to Hive
but I found out that with one command I can transfer my steemJS projects to hive projects.
so, Step 1
Install steemjs if you haven't
npm install steem --save
Step 2
create your script, for example:
const steem = require('steem');
steem.api.getAccounts(['lonelywolf'], function(err, res){
console.log(res, err)
})
this will give me all of my profile configuration and information
so now we want to transfer it to Hive API, right?
Step 3
Now, all you just need to change the API URL,
steem.api.setOptions({ url: 'https://api.hive.blog' })
you can use any other node there is for hive.
so now I'll get my profile but as Hive configuration and Information
(results at the end of the post)
Hope you found it useful, please leave an upvote and comment down below how are you scripting in hive blockchain
[
{
id: 495898,
name: 'lonelywolf',
owner: { weight_threshold: 1, account_auths: [], key_auths: [Array] },
active: { weight_threshold: 1, account_auths: [], key_auths: [Array] },
posting: { weight_threshold: 1, account_auths: [Array], key_auths: [Array] },
memo_key: 'STM7RNp4DJL3zTUMsXsejuy7Grc3AoH1pTvgFv4cuhfvstHwAT4iW',
json_metadata: '{"profile":{"name":"TheRealWolF","about":"RealityHubs Moderator -- FS Developer","website":"https://steemit.com/@lonelywolf","cover_image":"https://cdn.steemitimages.com/DQmUxqC72fjzEraKeZLJU7WFJ89EJu4fTuGoxRNeRsc3GTc/steembanner.png","profile_image":"https://cdn.steemitimages.com/DQmVSxtVsoeUgVN9sjvCFmBqUcPCVzCGoR9gouu8nWg8QUq/therealwolf_logo.png"}}',
posting_json_metadata: '{"profile":{"name":"TheRealWolF","about":"RealityHubs Moderator -- FS Developer","website":"https://steemit.com/@lonelywolf","cover_image":"https://cdn.steemitimages.com/DQmUxqC72fjzEraKeZLJU7WFJ89EJu4fTuGoxRNeRsc3GTc/steembanner.png","profile_image":"https://cdn.steemitimages.com/DQmVSxtVsoeUgVN9sjvCFmBqUcPCVzCGoR9gouu8nWg8QUq/therealwolf_logo.png"}}',
proxy: '',
last_owner_update: '2018-10-13T14:13:21',
last_account_update: '2019-08-08T11:40:00',
created: '2017-12-14T15:13:15',
mined: false,
recovery_account: 'steem',
last_account_recovery: '1970-01-01T00:00:00',
reset_account: 'null',
comment_count: 0,
lifetime_vote_count: 0,
post_count: 865,
can_vote: true,
voting_manabar: { current_mana: '161750492879', last_update_time: 1586559381 },
downvote_manabar: { current_mana: '43566594492', last_update_time: 1586559381 },
voting_power: 9281,
balance: '0.001 HIVE',
savings_balance: '0.000 HIVE',
sbd_balance: '0.000 HBD',
sbd_seconds: '52214760',
sbd_seconds_last_update: '2020-04-07T23:19:45',
sbd_last_interest_payment: '2020-03-23T20:43:36',
savings_sbd_balance: '0.000 HBD',
savings_sbd_seconds: '0',
savings_sbd_seconds_last_update: '2020-04-10T04:08:21',
savings_sbd_last_interest_payment: '2020-04-10T04:08:21',
savings_withdraw_requests: 1,
reward_sbd_balance: '0.000 HBD',
reward_steem_balance: '0.000 HIVE',
reward_vesting_balance: '0.000000 VESTS',
reward_vesting_steem: '0.000 HIVE',
vesting_shares: '2984.805714 VESTS',
delegated_vesting_shares: '2982.828925 VESTS',
received_vesting_shares: '174264.401181 VESTS',
vesting_withdraw_rate: '0.000000 VESTS',
next_vesting_withdrawal: '1969-12-31T23:59:59',
withdrawn: '60272175916',
to_withdraw: '60272175916',
withdraw_routes: 0,
curation_rewards: 6910,
posting_rewards: 1207947,
proxied_vsf_votes: [ 0, 0, 0, 0 ],
witnesses_voted_for: 3,
last_post: '2020-04-10T23:12:00',
last_root_post: '2020-04-10T19:32:24',
last_vote_time: '2020-04-10T22:56:21',
post_bandwidth: 0,
pending_claimed_accounts: 0,
vesting_balance: '0.000 HIVE',
reputation: '16422564795330',
transfer_history: [],
market_history: [],
post_history: [],
vote_history: [],
other_history: [],
witness_votes: [ 'actifit', 'bdcommunity', 'emrebeyler' ],
tags_usage: [],
guest_bloggers: []
}
] null
You should use steem-js-patched, otherwise you will have problems with transfers, account creation...
https://www.npmjs.com/package/steem-js-patched
Thanks for your advice, I'll use it next time!