Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Robust steem blockchain client library that runs in both node.js and the browser.
note As of version 0.7.0 WebSocket support has been removed. The only transport provided now is HTTP(2). For most users the only change required is to swap wss://
to https://
in the address. If you run your own full node make sure to set the proper CORS headers if you plan to access it from a browser.
For node.js or the browser with browserify or webpack.
npm install dsteem
Grab dist/dsteem.js
from a release and include in your html:
<script src="dsteem.js"></script>
Or from the unpkg cdn:
<script src="https://unpkg.com/dsteem@^0.8.0/dist/dsteem.js"></script>
Make sure to set the version you want when including from the cdn, you can also use dsteem@latest
but that is not always desirable. See unpkg.com for more information.
<script src="https://unpkg.com/dsteem@latest/dist/dsteem.js"></script>
<script>
var client = new dsteem.Client('https://api.steemit.com')
client.database.getDiscussions('trending', {tag: 'writing', limit: 1}).then(function(discussions){
document.body.innerHTML += '<h1>' + discussions[0].title + '</h1>'
document.body.innerHTML += '<h2>by ' + discussions[0].author + '</h2>'
document.body.innerHTML += '<pre style="white-space: pre-wrap">' + discussions[0].body + '</pre>'
})
</script>
See the demo source for an example on how to setup a livereloading TypeScript pipeline with wintersmith and browserify.
With TypeScript:
import {Client} from 'dsteem'
const client = new Client('https://api.steemit.com')
for await (const block of client.blockchain.getBlocks()) {
console.log(`New block, id: ${ block.block_id }`)
}
With JavaScript:
var dsteem = require('dsteem')
var client = new dsteem.Client('https://api.steemit.com')
var key = dsteem.PrivateKey.fromLogin('username', 'password', 'posting')
client.broadcast.vote({
voter: 'username',
author: 'almost-digital',
permlink: 'dsteem-is-the-best',
weight: 10000
}, key).then(function(result){
console.log('Included in block: ' + result.block_num)
}, function(error) {
console.error(error)
})
With ES2016 (node.js 7+):
const {Client} = require('dsteem')
const client = new Client('https://api.steemit.com')
async function main() {
const props = await client.database.getChainProperties()
console.log(`Maximum blocksize consensus: ${ props.maximum_block_size } bytes`)
client.disconnect()
}
main().catch(console.error)
With node.js streams:
var dsteem = require('dsteem')
var es = require('event-stream') // npm install event-stream
var util = require('util')
var client = new dsteem.Client('https://api.steemit.com')
var stream = client.blockchain.getBlockStream()
stream.pipe(es.map(function(block, callback) {
callback(null, util.inspect(block, {colors: true, depth: null}) + '\n')
})).pipe(process.stdout)
The easiest way to bundle dsteem (with browserify, webpack etc.) is to just npm install dsteem
and require('dsteem')
which will give you well-tested (see browser compatibility matrix above) pre-bundled code guaranteed to JustWork™. However, that is not always desirable since it will not allow your bundler to de-duplicate any shared dependencies dsteem and your app might have.
To allow for deduplication you can require('dsteem/lib/index-browser')
, or if you plan to provide your own polyfills: require('dsteem/lib/index')
. See src/index-browser.ts
for a list of polyfills expected.
Share and Enjoy!
FAQs
Steem blockchain RPC client library
The npm package dsteem receives a total of 109 weekly downloads. As such, dsteem popularity was classified as not popular.
We found that dsteem demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.