Installation
Learn how to add the Nimiq Hub API to your project using different 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');
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);