News for Nexa developers
We just released the modern libnexa-ts TypeScript/JavaScript SDK. This powerful and efficient SDK is designed to help developers integrate their applications with the Nexa network seamlessly.
Why Upgrade to libnexa-ts?
If you are currently using libnexa-js or nexcore-lib, you are encouraged to migrate to libnexa-ts, as the older libraries will no longer be actively maintained.
However, you can still use the old libraries if needed. The migration is optional, but if you want continued support and access to new features, transitioning to libnexa-ts is recommended. There are no deadlines, so you can migrate at your own pace.
What’s New in libnexa-ts?
The modern libnexa-ts library introduces several new features that were not available in the older JavaScript libraries, including support for new sighash types that provide advanced transaction signing options for developers, improved script handling for better flexibility and security, full TypeScript support with strong typing for a better development experience, optimized compatibility with both ES modules and CommonJS, lightweight design with tree-shaking support to reduce bundle size, cross-platform compatibility for Node.js and browser applications, and well-documented open-source resources.
How to Get Started
Install the Library
To install the new SDK, simply run:
npm install libnexa-ts
Importing the Library
Using ES Modules (Recommended for Tree Shaking)
import { Address, PrivateKey } from 'libnexa-ts';
Using CommonJS
const libnexa = require('libnexa-ts');
Using libnexa-ts in Node.js & Browser Applications
- For Node.js – No additional configuration is needed.
- For Browser-Based Apps – Some dependencies may require polyfills based on your bundler (e.g., Webpack, Vite, Rollup).
Example with Vite
To polyfill necessary modules for browser environments using Vite, install:
npm install -D vite-plugin-node-polyfills
Then, configure your vite.config.ts
file:
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
export default defineConfig({
plugins: [nodePolyfills({
protocolImports: true,
globals: {
global: true,
process: true,
Buffer: true
}
})],
});
Migration Guide
Migrating from libnexa-js or nexcore-lib to libnexa-ts is straightforward. Follow the official documentation for detailed instructions: