Install the package
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:Configuration options
Chain configuration
Customize the chain connection:WASM location
Specify a custom WASM file location:Framework-specific setup
Vite
Vite handles WASM automatically. No additional configuration needed:Webpack 5
Enable WASM support inwebpack.config.js:
Next.js
For Next.js 13+ with App Router, add tonext.config.js:
Nuxt
WAX supports both SSR and client-side rendering in Nuxt:Node.js
WAX works in Node.js without additional configuration:package.json includes:
TypeScript configuration
For optimal TypeScript support, ensure yourtsconfig.json includes:
Verify installation
Create a test file to verify everything works:test.ts
Installing signer packages
For transaction signing, install a signer package:Troubleshooting
WASM loading errors
If you see WASM loading errors, verify:- Your bundler supports WebAssembly
- The WASM file path is correct
- Your server serves
.wasmfiles with the correct MIME type (application/wasm)
Module resolution errors
For TypeScript errors about module resolution:- Ensure
moduleResolutionis set to"bundler"or"node16" - Check that
@hiveio/waxis installed innode_modules - Restart your TypeScript language server
Bundle size issues
The WASM module is approximately 1.5 MB. For optimal loading:- Enable compression on your web server (gzip or brotli)
- Use code splitting to load WAX only when needed
- Consider using a CDN for the WASM file
Next steps
Now that you have WAX installed:- Learn about createWaxFoundation for offline operations
- Explore createHiveChain for online operations
- Start building transactions