
The existing Stellar Javascript SDK is powerful and complete, however it is also very NodeJS-centric, adds 291kB of download weight to browser-based applications, and lacks perfect compatibility with modern JavaScript backends such as Browser Service Workers, Cloudflare Workers, Deno and WinterJS (which runs on Wasmer Edge).
The JS Worker SDK solves all three issues with a very lightweight SDK built on modern standards, with no dependencies. Its module lazy-loading design means that reading the Horizon API can be done with a 6.3kB browser download weight (before minification) and the use of only pure browser standards allows for drop-in compatibility for Service Workers, Cloudflare Workers, Deno and WinterJS.
Some quick examples of usage:
// 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))
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.
This JS Worker SDK solves this problem, creating one lightweight, universally compatible and performant SDK for JavaScript applications.
$12.5K

