For the complete documentation index, see llms.txt. This page is also available as Markdown.

Overview

This guide explains how to integrate DotPassport SDK with Polkadot wallet libraries to display reputation data for connected users.

How It Works

DotPassport SDK needs a Polkadot address to fetch and display reputation data. Wallet libraries provide this address when users connect their wallets to your application.

User connects wallet → Get address from wallet → Pass address to DotPassport SDK

Supported Wallets

Wallet
Library
Guide

Talisman

@talismn/connect-wallets

SubWallet

@subwallet/wallet-connect

Polkadot.js

@polkadot/extension-dapp

Compatible (similar pattern)

Nova Wallet

@polkadot/extension-dapp

Compatible (similar pattern)

Quick Start Pattern

All wallet integrations follow this basic pattern:

import { DotPassportClient, createWidget } from '@dotpassport/sdk';

// 1. Connect wallet and get address (wallet-specific code)
const address = await connectWalletAndGetAddress();

// 2. Use with DotPassport API Client
const client = new DotPassportClient({ apiKey: 'your_key' });
const scores = await client.getScores(address);
console.log(`Reputation Score: ${scores.totalScore}`);

// 3. Or use with DotPassport Widgets
const widget = createWidget({
  apiKey: 'your_key',
  address: address,
  type: 'reputation'
});
widget.mount('#reputation-widget');

// 4. Handle address changes (when user switches accounts)
function onAddressChange(newAddress: string) {
  widget.update({ address: newAddress });
}

Address Format

DotPassport accepts standard Polkadot/Substrate addresses:

Common Integration Patterns

React Hook Pattern

Event-Driven Pattern

Error Handling

Always handle these common scenarios:

Best Practices

1. Validate Addresses

2. Cache Wisely

DotPassport SDK has built-in caching. When the address changes, the widget automatically fetches new data.

3. Clean Up on Disconnect

4. Show Loading States

Next Steps

Last updated