Introduction
DotPassport SDK

The Official JavaScript/TypeScript SDK for DotPassport - Web3 Reputation & Identity
Getting Started • API Reference • Widgets • Examples • Contributing
What is DotPassport?
DotPassport is a comprehensive reputation and identity system for the Polkadot ecosystem. It aggregates on-chain activity across parachains to provide a unified reputation score, verifiable badges, and identity management for Web3 users.
This SDK provides:
API Client - Programmatic access to all DotPassport APIs
Embeddable Widgets - Ready-to-use UI components for displaying reputation data
Full TypeScript Support - Complete type definitions for type-safe development
Table of Contents
🚀 Quick Start
Install the SDK
Use the API Client
Embed a Widget
That's it! You now have a fully functional reputation widget on your page.
📦 Installation
NPM / Yarn / PNPM
CDN (Browser)
Requirements
Node.js
16.0+
TypeScript
5.0+ (optional)
Browser
ES2020 compatible
🔧 Environment Configuration
By default, the SDK connects to the production API (https://api.dotpassport.com). For local development, you have several options:
Option 1: Global Configuration (Recommended for Development)
Option 2: Per-Client Configuration
Option 3: Environment Variable (Node.js only)
Helper Functions
✨ Features
🔌 Complete API Coverage
Access all DotPassport endpoints including profiles, scores, badges, and metadata.
🎨 Beautiful Embeddable Widgets
Drop-in widgets with zero configuration. Supports light/dark themes and full customization.
🛡️ Type-Safe Development
Written in TypeScript with complete type definitions. Catch errors at compile time.
🌳 Tree-Shakeable
Import only what you need. Unused code is automatically eliminated.
⚡ Lightweight & Fast
Core client: ~3KB gzipped
Each widget: ~5KB gzipped
Zero external dependencies (widgets)
🔄 Built-in Caching
Smart caching for widget data with configurable TTL to minimize API calls.
📡 API Client
The DotPassportClient provides programmatic access to all DotPassport API endpoints.
Initialization
Profile Methods
Score Methods
Badge Methods
Metadata Methods
AbortSignal Support
All methods support AbortSignal for request cancellation:
🎨 Embeddable Widgets
DotPassport SDK includes four beautiful, customizable widgets that work with any framework.
Widget Types
Reputation
Total score with category breakdown
User dashboards, profiles
Badge
Earned badges display
Achievement showcases
Profile
User profile card
Social features, identity
Category
Single category deep-dive
Detailed score analysis
🖼️ Widget Gallery
Reputation Widget
Displays total reputation score with category breakdown




Badge Widget
Shows badges earned by the user



Profile Widget
User profile card with social links and identities

Category Widget
Detailed breakdown of a specific reputation category




⚙️ Configuration Reference
Common Widget Options
apiKey
string
required
Your DotPassport API key
address
string
required
Polkadot address to display
type
string
'reputation'
Widget type
theme
'light' | 'dark' | 'auto'
'light'
Color theme
compact
boolean
false
Compact display mode
className
string
''
Custom CSS class
onLoad
() => void
-
Callback when loaded
onError
(error: Error) => void
-
Error callback
Reputation Widget Options
showCategories
boolean
true
Show category breakdown
maxCategories
number
6
Max categories to display
Badge Widget Options
badgeKey
string
-
Show single specific badge
maxBadges
number
10
Max badges to display
showProgress
boolean
true
Show earned dates
Profile Widget Options
showAvatar
boolean
true
Display user avatar
showBio
boolean
true
Display user bio
showSocials
boolean
true
Display social links
showIdentities
boolean
true
Display chain identities
Category Widget Options
categoryKey
string
required
Category key to display
showTitle
boolean
true
Show category title
showDescription
boolean
true
Show description
showBreakdown
boolean
true
Show score breakdown
showAdvice
boolean
true
Show improvement tips
showScoreOnly
boolean
false
Minimal view
🔗 Framework Integration
React
Vue 3
Svelte
Vanilla JavaScript
🔐 Wallet Integration
Connect DotPassport SDK with popular Polkadot wallets to display reputation data for connected users.
Talisman Wallet
SubWallet
React Hook Example
📖 Detailed Wallet Guides:
Talisman Integration - Complete guide with React & Vanilla JS examples
SubWallet Integration - Complete guide with error handling
🎨 Custom Styling
Widgets support CSS variable overrides for custom styling:
❌ Error Handling
The SDK provides structured error handling through DotPassportError:
Error Codes Reference
400
Bad Request
Invalid request parameters
401
Unauthorized
Invalid or missing API key
403
Forbidden
Access denied to resource
404
Not Found
User, badge, or category not found
429
Too Many Requests
Rate limit exceeded
500
Server Error
Internal server error
📘 TypeScript Support
The SDK is written in TypeScript with complete type definitions.
Importing Types
Type-Safe Usage
📖 Examples
Complete Dashboard Example
Widget with Event Handling
🧪 Testing
The SDK includes comprehensive test coverage with 236+ tests.
Running Tests
Coverage
Statements
86%+
Branches
86%+
Functions
86%+
Lines
86%+
🤝 Contributing
We welcome contributions from the community! Here's how you can help:
Ways to Contribute
🐛 Report Bugs - Open an issue with a clear description
💡 Suggest Features - Share your ideas for improvements
📝 Improve Docs - Help make our documentation better
🔧 Submit PRs - Fix bugs or add new features
Development Setup
Code Style
We use ESLint and Prettier for code formatting
Write TypeScript with strict type checking
Add tests for new features
Update documentation for API changes
Pull Request Process
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes and commit:
git commit -m 'Add amazing feature'Push to your fork:
git push origin feature/amazing-featureOpen a Pull Request with a clear description
Commit Convention
We follow Conventional Commits:
👨💻 Author

Sachin
Building the future of Web3 identity and reputation
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
📦 NPM Package
📖 Documentation
🌐 Website
🐛 Issues
💬 Discord
Made with ❤️ by the DotPassport Team
Empowering Web3 identity and reputation
Last updated
