Skip to main content
Install the WAX TypeScript SDK using your preferred package manager.

Install the package

The package includes TypeScript definitions and works in all JavaScript/TypeScript environments.

Requirements

Your environment needs:
  • Node.js 20.11+ or 21.2+ (for Node.js applications)
  • Modern browsers with WebAssembly support (Chrome 57+, Firefox 52+, Safari 11+, Edge 16+)
  • Build tools configured for WASM (see framework-specific guides below)

Basic setup

Import and initialize the SDK:
For offline operations only:

Configuration options

Chain configuration

Customize the chain connection:

WASM location

Specify a custom WASM file location:
For bundlers, import the WASM file:

Framework-specific setup

Vite

Vite handles WASM automatically. No additional configuration needed:

Webpack 5

Enable WASM support in webpack.config.js:

Next.js

For Next.js 13+ with App Router, add to next.config.js:
Import WAX in client components:

Nuxt

WAX supports both SSR and client-side rendering in Nuxt:

Node.js

WAX works in Node.js without additional configuration:
Make sure your package.json includes:

TypeScript configuration

For optimal TypeScript support, ensure your tsconfig.json includes:

Verify installation

Create a test file to verify everything works:
test.ts
Run it:
Expected output:

Installing signer packages

For transaction signing, install a signer package:
See the transaction signing documentation for usage details.

Troubleshooting

WASM loading errors

If you see WASM loading errors, verify:
  1. Your bundler supports WebAssembly
  2. The WASM file path is correct
  3. Your server serves .wasm files with the correct MIME type (application/wasm)

Module resolution errors

For TypeScript errors about module resolution:
  1. Ensure moduleResolution is set to "bundler" or "node16"
  2. Check that @hiveio/wax is installed in node_modules
  3. Restart your TypeScript language server

Bundle size issues

The WASM module is approximately 1.5 MB. For optimal loading:
  1. Enable compression on your web server (gzip or brotli)
  2. Use code splitting to load WAX only when needed
  3. Consider using a CDN for the WASM file

Next steps

Now that you have WAX installed: