whats the module function within the below packages to get BURST acount balance? https://burstappsteam.org/phoenix/ https://www.npmjs.com/search?q=burstjs there was only few words after that, would also like some more details explaining it.
Asked
Active
Viewed 88 times
0
-
1The documentation is right on the page you posted. What have you tried that we can troubleshoot? Nobody is going to write code for you but we can help with errors. – shadow2020 Oct 28 '19 at 18:26
-
https://stackoverflow.com/questions/415511/how-to-get-the-current-time-in-python Thx for your advice bro, i reckon my question is just similar to this one.....but how to get acc balance using burstjs which is brand new library.....whynot try help me a bit..please. – andylamgot Oct 28 '19 at 19:10
1 Answers
0
With no attempt being made, I'll still answer your question using the link you posted yourself.
Connecting to blockchain:
// using core
const api = b$.composeApi({
nodeHost: "http://at-testnet.burst-alliance.org:6876",
apiRootUrl: "/burst"
});
api.network.getBlockchainStatus().then(console.log);
// using crypto
console.log(b$crypto.hashSHA256("test"))
// using util
const value = b$util.convertNumberToNQTString(1000)
// using http
const client = new b$http.HttpImpl('https://jsonplaceholder.typicode.com/');
client.get('/todos/1').then(console.log)
And then in a separate file ("preferribly index.js or main.js write your entry point like this:")
import {composeApi, ApiSettings} from '@burstjs/core'
import {convertNQTStringToNumber} from '@burstjs/util'
const apiSettings = new ApiSettings('http://at-testnet.burst-alliance.org:6876', 'burst');
const api = composeApi(apiSettings);
// this self-executing file makes turns this file into a starting point of your app
(async () => {
try{
const {balanceNQT} = await api.account.getAccountBalance('13036514135565182944')
console.log(`Account Balance: ${convertNQTStringToNumber(balanceNQT)} BURST`)
}
catch(e){ // e is of type HttpError (as part of @burstjs/http)
console.error(`Whooops, something went wrong: ${e.message}`)
}
})()
IF this does not satisfy your answer, please check the documentation page.

shadow2020
- 1,315
- 1
- 8
- 30