@nimiq/mini-app-sdk
v0.0.1
Published
SDK for building Nimiq Mini Apps
Keywords
Readme
Nimiq Mini App SDK
TypeScript helpers for Nimiq mini apps.
This package is intentionally small:
init()waits for the host app to injectwindow.nimiq- global typings make
window.nimiqavailable in TypeScript - provider types are re-exported for app-side DX
Install
npm install @nimiq/mini-app-sdkUsage
If your mini app wants to wait until the host app injects the provider, use init():
import { init } from '@nimiq/mini-app-sdk'
const nimiq = await init()
const accounts = await nimiq.listAccounts()After that import, window.nimiq is typed as NimiqProvider.
Configuration
import { init, type InitOptions } from '@nimiq/mini-app-sdk'
const options: InitOptions = {
timeout: 10_000,
}
const nimiq = await init(options)Provider Access
The injected provider is available in both places:
const nimiq = await init()window.nimiq
Both are typed as NimiqProvider.
