
The existing Stellar Javascript SDK is powerful and complete, however it is also very NodeJS-centric, adds 291kB of download weight to a browser-based application, and lacks perfect compatibility with modern JavaScript backends such as Cloudflare Workers, Deno, and WinterJS.
The JS Worker SDK solves all three issues with a very lightweight SDK built on modern standards, with no dependencies for most usage. Its module lazy-loading design means that reading the Horizon API can be done with a 3.5kB browser download weight and the use of only pure browser standards allows for drop-in compatibility for Cloudflare Workers, Deno, and WinterJS (which runs on Wasmer Edge).
Some quick examples of usage for the Horizon API module:
// include the SDK with a connection to the test network import { horizon } from './horizon.js?network=test'
// grab a single page of 10 transaction records as an array const setOfTenTransactions = await horizon.get.transactions()
// start listing out all transactions with automatic pagination for await (const t of horizon.stream.transactions()) console.log(t)
// start an EventSource based listener to fire an event when new transactions are posted const { listener: transactions } = await horizon.listen.transactions() transactions.addEventListener('message', event => console.log(event.data))
// submit a transaction const secretKey = 'S...', transaction = { ... } const { response } = await horizon.submit(transaction, secretKey)
JavaScript is arguably the most important language to have a modern SDK available for, as it is uniquely able to address both front and back end integrations. Front-end integrations especially require the option of a lightweight SDK for simpler use cases, as well as having unavoidable performance concerns which can deeply inform the choice of SDKs and tools. The JS Worker SDK solves this problem, creating one lightweight, universally compatible, and performant SDK for JavaScript applications.
The JS Worker SDK is architected from first-principle with strict web standards compliance, and is optimized for maximum performance and minimum footprint. A companion SimpleXDR library has been created to power the XDR parsing and serialization aspects of submitting transactions to Stellar.
$35.0K

