Installation

Learn how to add the Nimiq Hub API to your project using different installation methods.

Installation Methods

# Using npm
npm install --save @nimiq/hub-api
 
# Using yarn
yarn add @nimiq/hub-api
 
# Using pnpm
pnpm add @nimiq/hub-api

Then import it in your code:

import HubApi from '@nimiq/hub-api';
 
const hubApi = new HubApi('https://hub.nimiq-testnet.com');

Usage Example

After installation, you can initialize the Hub API and start using it:

const hubApi = new HubApi('https://hub.nimiq-testnet.com');
 
// Example: Request user to choose an address
const addressInfo = await hubApi.chooseAddress({
  appName: 'My Nimiq App'
});
 
console.log('Selected address:', addressInfo.address);

Next Steps

On this page