TypeScript type definitions for BMAP API
npm install bmap-api-typesTypeScript types for the BMAP API - Bitcoin SV transaction processing and analytics platform.
``bash`
npm install bmap-api-typesor
yarn add bmap-api-typesor
pnpm add bmap-api-types
`typescript
import type {
BMAPTransaction,
BAPIdentity,
Post,
Message,
Friend,
Like
} from 'bmap-api-types';
// Use in your client application
const processTransaction = (tx: BMAPTransaction) => {
console.log(Processing transaction: ${tx.tx.h});MAP type: ${mapData.type}
if (tx.MAP) {
tx.MAP.forEach(mapData => {
console.log();`
});
}
};
`typescript
import type {
NetworkOverviewResponse,
TrendingChannelsResponse,
ContentAnalyticsResponse,
UserMetricsResponse
} from 'bmap-api-types';
// Perfect for client libraries
const fetchNetworkStats = async (): Promise
const response = await fetch('/analytics/network/overview');
return response.json();
};
`
`typescript
import type {
FriendRequest,
LikeResponse,
IdentityData,
PostSearchResponse
} from 'bmap-api-types';
// Type-safe social interactions
const sendFriendRequest = async (friend: FriendRequest) => {
// Your implementation
};
`
`typescript
import type {
QueryRequest,
QueryResponse,
TransactionIngest,
SearchParams,
ChartRequest
} from 'bmap-api-types';
// Type-safe API client
class BMAPClient {
async query
// Implementation
}
async ingestTransaction(tx: TransactionIngest): Promise
// Implementation
}
}
`
✅ Complete Coverage - All BMAP API endpoints typed
✅ Strict Types - No any types, full type safety
✅ Tree Shakeable - Import only what you need
✅ Backwards Compatible - Semantic versioning
✅ Well Documented - JSDoc comments throughout
✅ Framework Agnostic - Works with any TypeScript project
`typescript
import type { NetworkOverviewResponse } from '@bmap/types';
const Dashboard: React.FC = () => { Total Users: {stats?.totalUsers} Active Users (24h): {stats?.activeUsers24h}
const [stats, setStats] = useState
useEffect(() => {
fetch('/analytics/network/overview')
.then(res => res.json())
.then(setStats);
}, []);
return (
Network Stats
);
};
`
`typescript
import type {
QueryRequest,
BMAPTransaction,
TrendingUsersResponse
} from '@bmap/types';
class BMAPAnalytics {
constructor(private baseUrl: string) {}
async getTrendingUsers(
timeframe: '24h' | '7d' | '30d' = '24h',
limit: number = 20
): Promise
const response = await fetch(
${this.baseUrl}/analytics/trending/users?timeframe=${timeframe}&limit=${limit}${this.baseUrl}/q
);
return response.json();
}
async searchTransactions(query: QueryRequest): Promise
const response = await fetch(, {`
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(query)
});
const result = await response.json();
return result.results;
}
}
`typescript
import type { IdentityData, PostSearchResponse } from '@bmap/types';
const useIdentitySearch = (query: string) => {
const [results, setResults] = useState
useEffect(() => {
if (query.length < 2) return;
fetch(/social/identity/search?q=${encodeURIComponent(query)})`
.then(res => res.json())
.then((data: { identities: IdentityData[] }) => {
setResults(data.identities);
});
}, [query]);
return results;
};
| @bmap/types | BMAP API | Features |
|-------------|----------|----------|
| 1.0.x | 1.0.x | Core types, Analytics Phases 1-5 |
| 1.1.x | 1.1.x | Enhanced social features |
| 2.0.x | 2.0.x | Breaking changes, new protocols |
This package is automatically generated from the BMAP API source code.
To update types:
1. Make changes to the API schemas
2. Run bun run build:types` in the main repository
3. The types package will be automatically updated
MIT License - see LICENSE file for details.