This API is injected by the host app into the mini app environment. For Nimiq access, the recommended pattern is to use the Mini App SDK init() helper. This section is reference-only.
To load and build a mini app, see Load a Local Mini App in Nimiq Pay, the Mini app tutorial, and Build a Dual-Chain Mini App with Nimiq Pay.
import { init } from '@nimiq/mini-app-sdk'
const nimiq = await init()
const accounts = await nimiq.listAccounts()
const signed = await nimiq.sign('hello')
console.log({ accounts, signed })const provider = window.ethereum
const accounts = await provider.request({ method: 'eth_requestAccounts' })
const address = accounts[0]
const balance = await provider.request({
method: 'eth_getBalance',
params: [address, 'latest'],
})
console.log({ address, balance })