@mobula_labs/types 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +380 -0
- package/dist/cjs/index.cjs +6405 -0
- package/dist/cjs/index.cjs.map +105 -0
- package/dist/esm/index.js +5262 -0
- package/dist/esm/index.js.map +105 -0
- package/dist/index.d.ts +89 -0
- package/dist/utils/constants/constants.d.ts +18 -0
- package/dist/utils/functions/bigintAbs.d.ts +1 -0
- package/dist/utils/functions/period.d.ts +3 -0
- package/dist/utils/functions/queryFilters.d.ts +21 -0
- package/dist/utils/functions/zodUtils.d.ts +15 -0
- package/dist/utils/schemas/BaseMessage.d.ts +27 -0
- package/dist/utils/schemas/BigIntLax.d.ts +4 -0
- package/dist/utils/schemas/DateQuery.d.ts +4 -0
- package/dist/utils/schemas/EnrichedHoldersData.d.ts +294 -0
- package/dist/utils/schemas/EnrichedMarketData.d.ts +7638 -0
- package/dist/utils/schemas/Filter.d.ts +35 -0
- package/dist/utils/schemas/MarketDetailsOutput.d.ts +2168 -0
- package/dist/utils/schemas/SecuritySchemas.d.ts +151 -0
- package/dist/utils/schemas/StringOrArray.d.ts +2 -0
- package/dist/utils/schemas/TokenDetailsOutput.d.ts +923 -0
- package/dist/utils/schemas/WalletDeployerSchema.d.ts +3735 -0
- package/dist/v1/all/AllAssetSchema.d.ts +117 -0
- package/dist/v1/all/BlockchainSchema.d.ts +333 -0
- package/dist/v1/market/CreateFeedSchema.d.ts +11 -0
- package/dist/v1/market/FundingRateSchema.d.ts +218 -0
- package/dist/v1/market/HoldersSchema.d.ts +96 -0
- package/dist/v1/market/MarketBlockchainPairsSchema.d.ts +1598 -0
- package/dist/v1/market/MarketBlockchainStatsSchema.d.ts +70 -0
- package/dist/v1/market/MarketDataSchema.d.ts +315 -0
- package/dist/v1/market/MarketHistoryPairSchema.d.ts +83 -0
- package/dist/v1/market/MarketHistorySchema.d.ts +80 -0
- package/dist/v1/market/MarketMultiDataSchema.d.ts +387 -0
- package/dist/v1/market/MarketMultiHistorySchema.d.ts +86 -0
- package/dist/v1/market/MarketMultiPricesSchema.d.ts +60 -0
- package/dist/v1/market/MarketNftSchema.d.ts +35 -0
- package/dist/v1/market/MarketPairSchema.d.ts +2119 -0
- package/dist/v1/market/MarketPairsSchema.d.ts +2803 -0
- package/dist/v1/market/MarketQuerySchema.d.ts +138 -0
- package/dist/v1/market/MarketSparklineSchema.d.ts +32 -0
- package/dist/v1/market/MarketTokenVsMarketSchema.d.ts +121 -0
- package/dist/v1/market/MarketTotalSchema.d.ts +15 -0
- package/dist/v1/market/MarketTradesPairSchema.d.ts +127 -0
- package/dist/v1/metadata/MetadataCategoriesSchema.d.ts +18 -0
- package/dist/v1/metadata/MetadataNewsSchema.d.ts +106 -0
- package/dist/v1/metadata/MetadataSchema.d.ts +941 -0
- package/dist/v1/metadata/MetadataTrendingsSchema.d.ts +84 -0
- package/dist/v1/metadata/SystemMetadataSchema.d.ts +161 -0
- package/dist/v1/misc/ListingStatusSchema.d.ts +8 -0
- package/dist/v1/misc/SubmitTokenSchema.d.ts +149 -0
- package/dist/v1/misc/UploadLogoSchema.d.ts +11 -0
- package/dist/v1/pulse/PulseSchema.d.ts +27561 -0
- package/dist/v1/search/SearchSchema.d.ts +3686 -0
- package/dist/v1/token/FirstBuyerSchema.d.ts +63 -0
- package/dist/v1/wallet/BalanceUSDSchema.d.ts +17 -0
- package/dist/v1/wallet/DeployerSchema.d.ts +2196 -0
- package/dist/v1/wallet/HistorySchema.d.ts +102 -0
- package/dist/v1/wallet/WalletLabelSchema.d.ts +35 -0
- package/dist/v1/wallet/WalletNFTSchema.d.ts +159 -0
- package/dist/v1/wallet/WalletPortfolioSchema.d.ts +2644 -0
- package/dist/v1/wallet/WalletSmartMoneySchema.d.ts +115 -0
- package/dist/v1/wallet/WalletTradesSchema.d.ts +2241 -0
- package/dist/v1/wallet/WalletTransactionSchema.d.ts +1093 -0
- package/dist/v2/asset/AssetDetailsSchema.d.ts +7393 -0
- package/dist/v2/asset/AssetPriceHistorySchema.d.ts +268 -0
- package/dist/v2/market/MarketDetailsSchema.d.ts +6393 -0
- package/dist/v2/market/MarketOHLCVHistorySchema.d.ts +241 -0
- package/dist/v2/perp/PerpModels.d.ts +523 -0
- package/dist/v2/perp/PerpOrderQuotingSchema.d.ts +56 -0
- package/dist/v2/swap/SwapQuotingBatchOutput.d.ts +3623 -0
- package/dist/v2/swap/SwapQuotingBatchSchema.d.ts +156 -0
- package/dist/v2/swap/SwapQuotingOutput.d.ts +2850 -0
- package/dist/v2/swap/SwapQuotingSchema.d.ts +89 -0
- package/dist/v2/swap/SwapSendOutput.d.ts +32 -0
- package/dist/v2/swap/SwapSendSchema.d.ts +12 -0
- package/dist/v2/token/TokenDetailsSchema.d.ts +3063 -0
- package/dist/v2/token/TokenKlineBsPointSchema.d.ts +137 -0
- package/dist/v2/token/TokenMarketsSchema.d.ts +5307 -0
- package/dist/v2/token/TokenOHLCVHistorySchema.d.ts +241 -0
- package/dist/v2/token/TokenPositionsSchema.d.ts +299 -0
- package/dist/v2/token/TokenSecurityOutput.d.ts +182 -0
- package/dist/v2/token/TokenSecurityQuery.d.ts +15 -0
- package/dist/v2/token/TokenSecuritySchema.d.ts +4 -0
- package/dist/v2/token/TokenTradesSchema.d.ts +18991 -0
- package/dist/v2/wallet/WalleAnalysisQuerySchema.d.ts +1135 -0
- package/dist/v2/wallet/WalleFundingQuerySchema.d.ts +57 -0
- package/dist/v2/wallet/WalletActivityV2Schema.d.ts +3303 -0
- package/dist/v2/wallet/WalletDeployerSchema.d.ts +2198 -0
- package/dist/v2/wallet/WalletPerpsPositionsSchema.d.ts +622 -0
- package/dist/v2/wallet/WalletPositionsSchema.d.ts +4332 -0
- package/dist/v2/wallet/WalletTokenBalancesSchema.d.ts +517 -0
- package/dist/wss/BalancePayloadSchema.d.ts +65 -0
- package/dist/wss/FastTradePayloadSchema.d.ts +67 -0
- package/dist/wss/FundingPayloadSchema.d.ts +24 -0
- package/dist/wss/HoldersPayloadSchema.d.ts +35 -0
- package/dist/wss/MarketDetailsPayloadSchema.d.ts +36 -0
- package/dist/wss/MarketPayloadSchema.d.ts +53 -0
- package/dist/wss/OhlcvPayloadSchema.d.ts +44 -0
- package/dist/wss/PairsPayloadSchema.d.ts +30 -0
- package/dist/wss/PositionPayloadSchema.d.ts +76 -0
- package/dist/wss/TokenDetailsPayloadSchema.d.ts +36 -0
- package/dist/wss/aggregated-feed/FeedSchema.d.ts +113 -0
- package/dist/wss/pulse/PausePulsePayloadSchema.d.ts +12 -0
- package/dist/wss/stream/StreamPayloadSchema.d.ts +83 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
# @mobula/types
|
|
2
|
+
|
|
3
|
+
Centralized TypeScript types and Zod schemas for Mobula SDK and applications.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a comprehensive set of TypeScript types and Zod schemas for the Mobula API ecosystem. It serves as the single source of truth for type definitions across all Mobula packages and applications, ensuring type safety and consistency.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- ✅ **Type Safety**: Full TypeScript support with strict typing
|
|
12
|
+
- ✅ **Runtime Validation**: Zod schemas for runtime type validation
|
|
13
|
+
- ✅ **Dual Format Support**: Available in both ESM and CommonJS formats
|
|
14
|
+
- ✅ **API Versioning**: Supports both v1 and v2 API schemas
|
|
15
|
+
- ✅ **WebSocket Types**: Complete type definitions for WebSocket payloads
|
|
16
|
+
- ✅ **Utility Functions**: Helper functions and constants for common operations
|
|
17
|
+
- ✅ **Tree-shakeable**: Only bundle what you use
|
|
18
|
+
- ✅ **Zero Runtime Dependencies**: Only peer dependency is Zod
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @mobula/types zod
|
|
24
|
+
# or
|
|
25
|
+
bun add @mobula/types zod
|
|
26
|
+
# or
|
|
27
|
+
pnpm add @mobula/types zod
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Note:** `zod` (^3.0.0) is a required peer dependency for runtime validation.
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { MarketDataResponseSchema, TokenDetailsResponseSchema } from '@mobula/types';
|
|
36
|
+
import type { z } from 'zod';
|
|
37
|
+
|
|
38
|
+
// Fetch and validate market data
|
|
39
|
+
const response = await fetch('https://api.mobula.io/api/1/market/data?asset=bitcoin');
|
|
40
|
+
const data = await response.json();
|
|
41
|
+
|
|
42
|
+
// Runtime validation
|
|
43
|
+
const validated = MarketDataResponseSchema.parse(data);
|
|
44
|
+
console.log(validated.data.price);
|
|
45
|
+
|
|
46
|
+
// Type inference
|
|
47
|
+
type MarketData = z.infer<typeof MarketDataResponseSchema>;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
### Basic Import
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
import {
|
|
56
|
+
AssetDetailsSchema,
|
|
57
|
+
MarketDataResponseSchema,
|
|
58
|
+
TokenDetailsResponseSchema
|
|
59
|
+
} from '@mobula/types';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Type Inference from Schemas
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { AssetDetailsSchema } from '@mobula/types';
|
|
66
|
+
import type { z } from 'zod';
|
|
67
|
+
|
|
68
|
+
// Infer TypeScript type from Zod schema
|
|
69
|
+
type AssetDetails = z.infer<typeof AssetDetailsSchema>;
|
|
70
|
+
|
|
71
|
+
// Use for validation
|
|
72
|
+
const result = AssetDetailsSchema.parse(apiResponse);
|
|
73
|
+
|
|
74
|
+
// Safe parsing (doesn't throw)
|
|
75
|
+
const safeResult = AssetDetailsSchema.safeParse(apiResponse);
|
|
76
|
+
if (safeResult.success) {
|
|
77
|
+
console.log(safeResult.data);
|
|
78
|
+
} else {
|
|
79
|
+
console.error(safeResult.error);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### API Version Schemas
|
|
84
|
+
|
|
85
|
+
The package exports schemas organized by API version:
|
|
86
|
+
|
|
87
|
+
#### V1 API Schemas
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
import {
|
|
91
|
+
// Market data
|
|
92
|
+
MarketDataSchema,
|
|
93
|
+
MarketHistorySchema,
|
|
94
|
+
MarketPairsSchema,
|
|
95
|
+
MarketSparklineSchema,
|
|
96
|
+
|
|
97
|
+
// Wallet data
|
|
98
|
+
WalletPortfolioSchema,
|
|
99
|
+
WalletTransactionSchema,
|
|
100
|
+
WalletBalanceUSDParamsSchema,
|
|
101
|
+
WalletBalanceUSDResponseSchema,
|
|
102
|
+
|
|
103
|
+
// Metadata
|
|
104
|
+
MetadataSchema,
|
|
105
|
+
MetadataTrendingsSchema,
|
|
106
|
+
MetadataNewsSchema,
|
|
107
|
+
} from '@mobula/types';
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### V2 API Schemas
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import {
|
|
114
|
+
// Assets
|
|
115
|
+
AssetDetailsSchema,
|
|
116
|
+
AssetPriceHistorySchema,
|
|
117
|
+
|
|
118
|
+
// Markets
|
|
119
|
+
MarketDetailsSchema,
|
|
120
|
+
MarketOHLCVHistorySchema,
|
|
121
|
+
|
|
122
|
+
// Tokens
|
|
123
|
+
TokenDetailsSchema,
|
|
124
|
+
TokenSecuritySchema,
|
|
125
|
+
TokenTradesSchema,
|
|
126
|
+
|
|
127
|
+
// Swaps
|
|
128
|
+
SwapQuotingSchema,
|
|
129
|
+
SwapSendSchema,
|
|
130
|
+
|
|
131
|
+
// Wallets
|
|
132
|
+
WalletPositionsSchema,
|
|
133
|
+
WalletTokenBalancesSchema,
|
|
134
|
+
} from '@mobula/types';
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### WebSocket Types
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import {
|
|
141
|
+
MarketPayloadSchema,
|
|
142
|
+
TokenDetailsPayloadSchema,
|
|
143
|
+
BalancePayloadSchema,
|
|
144
|
+
OhlcvPayloadSchema,
|
|
145
|
+
PositionPayloadSchema,
|
|
146
|
+
FeedSchema,
|
|
147
|
+
} from '@mobula/types';
|
|
148
|
+
|
|
149
|
+
// Example: Validate WebSocket message
|
|
150
|
+
const message = await ws.receive();
|
|
151
|
+
const validated = MarketPayloadSchema.parse(message);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Utility Functions & Constants
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import {
|
|
158
|
+
bigintAbs,
|
|
159
|
+
period,
|
|
160
|
+
BigIntLax,
|
|
161
|
+
zodUtils,
|
|
162
|
+
extractZodSchemaKeys,
|
|
163
|
+
extractAllZodKeys,
|
|
164
|
+
} from '@mobula/types';
|
|
165
|
+
|
|
166
|
+
// Use bigint utilities
|
|
167
|
+
const absoluteValue = bigintAbs(-100n); // 100n
|
|
168
|
+
|
|
169
|
+
// Use period helpers
|
|
170
|
+
const timeframe = period('1d');
|
|
171
|
+
|
|
172
|
+
// Use Zod utilities
|
|
173
|
+
const keys = extractZodSchemaKeys(MySchema);
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Available Schema Categories
|
|
177
|
+
|
|
178
|
+
### Market Schemas
|
|
179
|
+
- `MarketDataSchema` - Current market data
|
|
180
|
+
- `MarketHistorySchema` - Historical market data
|
|
181
|
+
- `MarketPairsSchema` - Trading pairs
|
|
182
|
+
- `MarketSparklineSchema` - Price sparklines
|
|
183
|
+
- `MarketOHLCVHistorySchema` - OHLCV candle data
|
|
184
|
+
- `FundingRateSchema` - Perpetual funding rates
|
|
185
|
+
|
|
186
|
+
### Token Schemas
|
|
187
|
+
- `TokenDetailsSchema` - Token metadata and details
|
|
188
|
+
- `TokenSecuritySchema` - Token security analysis
|
|
189
|
+
- `TokenTradesSchema` - Recent trades
|
|
190
|
+
- `TokenMarketsSchema` - Markets listing the token
|
|
191
|
+
- `TokenPositionsSchema` - Token holder positions
|
|
192
|
+
|
|
193
|
+
### Wallet Schemas
|
|
194
|
+
- `WalletPortfolioSchema` - Portfolio overview
|
|
195
|
+
- `WalletBalanceUSDParamsSchema` - USD balance query parameters
|
|
196
|
+
- `WalletBalanceUSDResponseSchema` - USD balance response
|
|
197
|
+
- `WalletTransactionSchema` - Transaction history
|
|
198
|
+
- `WalletPositionsSchema` - Open positions
|
|
199
|
+
- `WalletTokenBalancesSchema` - Token balances
|
|
200
|
+
|
|
201
|
+
### Swap Schemas
|
|
202
|
+
- `SwapQuotingSchema` - Get swap quotes
|
|
203
|
+
- `SwapQuotingBatchSchema` - Batch quote requests
|
|
204
|
+
- `SwapSendSchema` - Execute swaps
|
|
205
|
+
|
|
206
|
+
### Metadata Schemas
|
|
207
|
+
- `MetadataSchema` - Asset metadata
|
|
208
|
+
- `MetadataCategoriesSchema` - Token categories
|
|
209
|
+
- `MetadataNewsSchema` - Latest news
|
|
210
|
+
- `MetadataTrendingsSchema` - Trending tokens
|
|
211
|
+
|
|
212
|
+
## Package Structure
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
packages/types/
|
|
216
|
+
├── src/
|
|
217
|
+
│ ├── v1/ # V1 API schemas
|
|
218
|
+
│ │ ├── market/
|
|
219
|
+
│ │ ├── metadata/
|
|
220
|
+
│ │ ├── wallet/
|
|
221
|
+
│ │ ├── token/
|
|
222
|
+
│ │ └── ...
|
|
223
|
+
│ ├── v2/ # V2 API schemas
|
|
224
|
+
│ │ ├── asset/
|
|
225
|
+
│ │ ├── market/
|
|
226
|
+
│ │ ├── swap/
|
|
227
|
+
│ │ ├── token/
|
|
228
|
+
│ │ └── wallet/
|
|
229
|
+
│ ├── wss/ # WebSocket schemas
|
|
230
|
+
│ │ ├── aggregated-feed/
|
|
231
|
+
│ │ ├── pulse/
|
|
232
|
+
│ │ └── stream/
|
|
233
|
+
│ └── utils/ # Utility functions and constants
|
|
234
|
+
│ ├── functions/
|
|
235
|
+
│ └── schemas/
|
|
236
|
+
├── dist/ # Built output
|
|
237
|
+
│ ├── esm/ # ES modules
|
|
238
|
+
│ ├── cjs/ # CommonJS
|
|
239
|
+
│ └── *.d.ts # TypeScript declarations
|
|
240
|
+
└── package.json
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## Module Formats
|
|
244
|
+
|
|
245
|
+
The package supports multiple module formats with proper exports configuration:
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// ESM (Recommended)
|
|
249
|
+
import { MarketDataSchema } from '@mobula/types';
|
|
250
|
+
|
|
251
|
+
// CommonJS
|
|
252
|
+
const { MarketDataSchema } = require('@mobula/types');
|
|
253
|
+
|
|
254
|
+
// TypeScript
|
|
255
|
+
import type { z } from 'zod';
|
|
256
|
+
type MarketData = z.infer<typeof MarketDataSchema>;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Real-World Example
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import {
|
|
263
|
+
MarketDataResponseSchema,
|
|
264
|
+
TokenDetailsResponseSchema,
|
|
265
|
+
WalletPortfolioSchema
|
|
266
|
+
} from '@mobula/types';
|
|
267
|
+
import type { z } from 'zod';
|
|
268
|
+
|
|
269
|
+
// Define types
|
|
270
|
+
type MarketData = z.infer<typeof MarketDataResponseSchema>;
|
|
271
|
+
type TokenDetails = z.infer<typeof TokenDetailsResponseSchema>;
|
|
272
|
+
|
|
273
|
+
async function getTokenInfo(address: string): Promise<TokenDetails> {
|
|
274
|
+
const response = await fetch(
|
|
275
|
+
`https://api.mobula.io/api/v2/token/details?address=${address}`
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
const data = await response.json();
|
|
279
|
+
|
|
280
|
+
// Validate response with Zod - throws if invalid
|
|
281
|
+
return TokenDetailsResponseSchema.parse(data);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
async function getMarketPrice(asset: string): Promise<number | null> {
|
|
285
|
+
const response = await fetch(
|
|
286
|
+
`https://api.mobula.io/api/1/market/data?asset=${asset}`
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
const data = await response.json();
|
|
290
|
+
const validated = MarketDataResponseSchema.parse(data);
|
|
291
|
+
|
|
292
|
+
return validated.data.price;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Error handling example
|
|
296
|
+
async function safeGetMarketData(asset: string) {
|
|
297
|
+
try {
|
|
298
|
+
const response = await fetch(
|
|
299
|
+
`https://api.mobula.io/api/1/market/data?asset=${asset}`
|
|
300
|
+
);
|
|
301
|
+
const data = await response.json();
|
|
302
|
+
|
|
303
|
+
const result = MarketDataResponseSchema.safeParse(data);
|
|
304
|
+
|
|
305
|
+
if (result.success) {
|
|
306
|
+
return { data: result.data, error: null };
|
|
307
|
+
} else {
|
|
308
|
+
return { data: null, error: result.error.errors };
|
|
309
|
+
}
|
|
310
|
+
} catch (error) {
|
|
311
|
+
return { data: null, error: String(error) };
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## Development
|
|
317
|
+
|
|
318
|
+
### Build
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
bun run build
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
This will:
|
|
325
|
+
1. Clean the `dist` folder
|
|
326
|
+
2. Build ESM format to `dist/esm/`
|
|
327
|
+
3. Build CommonJS format to `dist/cjs/`
|
|
328
|
+
4. Generate TypeScript declaration files to `dist/`
|
|
329
|
+
|
|
330
|
+
### Type Checking
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
bun run typecheck
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Testing Exports
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
# Quick verification
|
|
340
|
+
bun -e "import('./dist/esm/index.js').then(m => console.log('Exports:', Object.keys(m).length))"
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Contributing
|
|
344
|
+
|
|
345
|
+
When adding new schemas:
|
|
346
|
+
|
|
347
|
+
1. Place them in the appropriate version directory (`v1/` or `v2/`)
|
|
348
|
+
2. Follow existing naming conventions (e.g., `*Schema.ts`)
|
|
349
|
+
3. Export them from `src/index.ts`
|
|
350
|
+
4. Ensure they use Zod for validation
|
|
351
|
+
5. Add JSDoc comments for better IDE support
|
|
352
|
+
6. Run `bun run build` and `bun run typecheck` before committing
|
|
353
|
+
|
|
354
|
+
### Schema Naming Convention
|
|
355
|
+
|
|
356
|
+
- **Schemas**: `*Schema.ts` (e.g., `MarketDataSchema.ts`)
|
|
357
|
+
- **Outputs**: `*Output.ts` (e.g., `SwapQuotingOutput.ts`)
|
|
358
|
+
- **Queries**: `*Query.ts` (e.g., `TokenSecurityQuery.ts`)
|
|
359
|
+
- **Payloads**: `*PayloadSchema.ts` (e.g., `MarketPayloadSchema.ts`)
|
|
360
|
+
|
|
361
|
+
## Version History
|
|
362
|
+
|
|
363
|
+
See [CHANGELOG.md](./CHANGELOG.md) for release notes and migration guides.
|
|
364
|
+
|
|
365
|
+
## Links
|
|
366
|
+
|
|
367
|
+
- **Mobula API Documentation**: https://docs.mobula.io
|
|
368
|
+
- **Mobula Website**: https://mobula.io
|
|
369
|
+
- **Repository**: https://github.com/MobulaFi/mobula-api
|
|
370
|
+
- **Issues**: https://github.com/MobulaFi/mobula-api/issues
|
|
371
|
+
|
|
372
|
+
## License
|
|
373
|
+
|
|
374
|
+
MIT © Mobula
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
<div align="center">
|
|
379
|
+
<strong>Built with ❤️ by the Mobula team</strong>
|
|
380
|
+
</div>
|