
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Install with npm install --save javalon
inside your project. Then just
const javalon = require('javalon')
If you are working in the browser and want to load javalon from a CDN:
<script src="https://unpkg.com/javalon/bin/javalon.min.js"></script>
By default, javalon hits on the main avalon testnet (https://avalon.d.tube). You can eventually make javalon hit on your local node or any avalon node like so:
javalon.init({api: 'http://localhost:3001'})
javalon.getAccount('alice', (err, account) => {
console.log(err, account)
})
Just pass an array of usernames instead
javalon.getAccounts(['alice', 'bob'], (err, accounts) => {
console.log(err, accounts)
})
For the history, you also need to specify a block number. The api will return all blocks lower than the specified block where the user was involved in a transaction
javalon.getAccountHistory('alice', 0, (err, blocks) => {
console.log(err, blocks)
})
javalon.getContent('alice', 'pocNl2YhZdM', (err, content) => {
console.log(err, content)
})
javalon.getFollowers('alice', (err, followers) => {
console.log(err, followers)
})
javalon.getFollowers('alice', (err, followers) => {
console.log(err, followers)
})
You can pass a username and permlink (identifying a content) in the 2nd and 3rd argument to 'get more'.
javalon.getDiscussionsByAuthor('alice', null, null, (err, contents) => {
console.log(err, contents)
})
You can pass a username and a permlink to 'get more'.
javalon.getNewDiscussions('alice', null, null, (err, contents) => {
console.log(err, contents)
})
You can pass a username and a permlink to 'get more'.
javalon.getHotDiscussions(null, null, (err, contents) => {
console.log(err, contents)
})
This lists the contents posted by the following of the passed username.
You can pass a username and a permlink in the 2nd and 3rd argument to 'get more'.
javalon.getFeedDiscussions('alice', null, null, (err, contents) => {
console.log(err, contents)
})
javalon.getNotifications('alice', (err, contents) => {
console.log(err, contents)
})
javalon.getVotesByAccount('alice', 0, (err, votes) => {
console.log(err, votes)
})
javalon.getPendingVotesByAccount('alice', 0, (err, votes) => {
console.log(err, votes)
})
javalon.getClaimableVotesByAccount('alice', 0, (err, votes) => {
console.log(err, votes)
})
javalon.getClaimedVotesByAccount('alice', 0, (err, votes) => {
console.log(err, votes)
})
javalon.getPendingRewards('alice', (err, votes) => {
console.log(err, votes)
})
javalon.getClaimedRewards('alice', (err, votes) => {
console.log(err, votes)
})
javalon.getClaimableRewards('alice', (err, votes) => {
console.log(err, votes)
})
To send a transaction to the network, you will need multiple steps. First you need to define your transaction and sign it.
var newTx = {
type: javalon.TransactionType.FOLLOW,
data: {
target: 'bob'
}
}
newTx = javalon.sign(alice_key, 'alice', newTx)
After this step, the transaction is forged with a timestamp, hash, and signature. This transaction needs to be sent in the next 60 secs or will be forever invalid.
You can send it like so
javalon.sendTransaction(newTx, function(err, res) {
cb(err, res)
})
The callback will return once your transaction has been included in a new block.
Alternatively, you can just want the callback as soon as the receiving node has it, you can do:
javalon.sendRawTransaction(newTx, function(err, res) {
cb(err, res)
})
console.log(javalon.keypair())
Voting Power and Bandwidth are growing in time but the API will only return the latest update in the vt
and bw
fields of the accounts. To get the actual value, use votingPower() and bandwidth()
javalon.getAccount('alice', (err, account) => {
console.log(javalon.votingPower(account))
console.log(javalon.bandwidth(account))
})
FAQs
javascript api for the avalon blockchain
The npm package javalon2 receives a total of 0 weekly downloads. As such, javalon2 popularity was classified as not popular.
We found that javalon2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.