Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 1.46 KB

File metadata and controls

45 lines (29 loc) · 1.46 KB

API Reference

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.

Contents

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.

Quick Start Examples

Nimiq Provider

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 })

Ethereum dApp (EIP-1193)

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 })