Skip to content

Commit 8ffbbf6

Browse files
committed
fix(mobula): Address Copilot feedback - asset ID consistency and type safety
1. Fix SOL asset ID inconsistency: - Correct SOL mapping from 102484775 → 100010811 in includes.json - 102484775 is BBSOL (Bybit Staked SOL), not SOL (Solana) - Ensures consistency between base currency and quote currency mappings 2. Improve TypeScript type safety: - Replace 'any' type with proper MobulaSubscribeMessage interface - Define structure for WebSocket subscription messages - Maintains type safety throughout transport logic All hardcoded quote currencies now match includes.json mappings: ✅ BTC: 100001656, ETH: 100004304, SOL: 100010811
1 parent 3501b04 commit 8ffbbf6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/sources/mobula-state/src/config/includes.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1544,7 +1544,7 @@
15441544
"to": "USD",
15451545
"includes": [
15461546
{
1547-
"from": "102484775",
1547+
"from": "100010811",
15481548
"to": "USD",
15491549
"inverse": false
15501550
}

packages/sources/mobula-state/src/transport/price.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ export interface WSResponse {
1414
quoteID: string
1515
}
1616

17+
// Interface for Mobula WebSocket subscription message
18+
interface MobulaSubscribeMessage {
19+
type: 'feed'
20+
authorization: string
21+
kind: 'asset_ids'
22+
asset_ids: number[]
23+
quote_id?: number
24+
}
25+
1726
export type WsTransportTypes = BaseEndpointTypes & {
1827
Provider: {
1928
WsMessage: WSResponse
@@ -105,7 +114,7 @@ export const wsTransport: WebsocketReverseMappingTransport<WsTransportTypes, str
105114
const compositeKey = `${assetId}-${quoteId || 'USD'}`
106115
wsTransport.setReverseMapping(compositeKey, params)
107116

108-
const subscribeMsg: any = {
117+
const subscribeMsg: MobulaSubscribeMessage = {
109118
type: 'feed',
110119
authorization: context.adapterSettings.API_KEY,
111120
kind: 'asset_ids',

0 commit comments

Comments
 (0)