@crypticdot/defituna-api 1.1.35 → 1.1.36
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/dist/index.d.mts +59 -3
- package/dist/index.d.ts +59 -3
- package/dist/index.js +28 -0
- package/dist/index.mjs +28 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -311,6 +311,55 @@ declare const Vault$1: z.ZodObject<{
|
|
|
311
311
|
pythOracleFeedId: string;
|
|
312
312
|
pythOraclePriceUpdate: string;
|
|
313
313
|
}>;
|
|
314
|
+
declare const VaultHistoricalStats$1: z.ZodObject<{
|
|
315
|
+
date: z.ZodEffects<z.ZodDate, Date, unknown>;
|
|
316
|
+
supply: z.ZodObject<{
|
|
317
|
+
amount: z.ZodBigInt;
|
|
318
|
+
usd: z.ZodNumber;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
amount: bigint;
|
|
321
|
+
usd: number;
|
|
322
|
+
}, {
|
|
323
|
+
amount: bigint;
|
|
324
|
+
usd: number;
|
|
325
|
+
}>;
|
|
326
|
+
borrow: z.ZodObject<{
|
|
327
|
+
amount: z.ZodBigInt;
|
|
328
|
+
usd: z.ZodNumber;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
amount: bigint;
|
|
331
|
+
usd: number;
|
|
332
|
+
}, {
|
|
333
|
+
amount: bigint;
|
|
334
|
+
usd: number;
|
|
335
|
+
}>;
|
|
336
|
+
supplyApy: z.ZodNumber;
|
|
337
|
+
borrowApr: z.ZodNumber;
|
|
338
|
+
}, "strip", z.ZodTypeAny, {
|
|
339
|
+
supplyApy: number;
|
|
340
|
+
date: Date;
|
|
341
|
+
supply: {
|
|
342
|
+
amount: bigint;
|
|
343
|
+
usd: number;
|
|
344
|
+
};
|
|
345
|
+
borrow: {
|
|
346
|
+
amount: bigint;
|
|
347
|
+
usd: number;
|
|
348
|
+
};
|
|
349
|
+
borrowApr: number;
|
|
350
|
+
}, {
|
|
351
|
+
supplyApy: number;
|
|
352
|
+
supply: {
|
|
353
|
+
amount: bigint;
|
|
354
|
+
usd: number;
|
|
355
|
+
};
|
|
356
|
+
borrow: {
|
|
357
|
+
amount: bigint;
|
|
358
|
+
usd: number;
|
|
359
|
+
};
|
|
360
|
+
borrowApr: number;
|
|
361
|
+
date?: unknown;
|
|
362
|
+
}>;
|
|
314
363
|
declare const Pool$1: z.ZodObject<{
|
|
315
364
|
address: z.ZodString;
|
|
316
365
|
provider: z.ZodEnum<["orca", ...("orca" | "fusion")[]]>;
|
|
@@ -3290,7 +3339,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
|
|
|
3290
3339
|
declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
|
|
3291
3340
|
declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
|
|
3292
3341
|
declare namespace schemas {
|
|
3293
|
-
export { LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
|
|
3342
|
+
export { LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
|
|
3294
3343
|
}
|
|
3295
3344
|
|
|
3296
3345
|
type PoolProviderType = z.infer<typeof PoolProviderSchema>;
|
|
@@ -3302,6 +3351,7 @@ type Mint = z.infer<typeof Mint$1>;
|
|
|
3302
3351
|
type Market = z.infer<typeof Market$1>;
|
|
3303
3352
|
type TokenOraclePrice = z.infer<typeof TokenOraclePrice$1>;
|
|
3304
3353
|
type Vault = z.infer<typeof Vault$1>;
|
|
3354
|
+
type VaultHistoricalStats = z.infer<typeof VaultHistoricalStats$1>;
|
|
3305
3355
|
type Pool = z.infer<typeof Pool$1>;
|
|
3306
3356
|
type Tick = z.infer<typeof Tick$1>;
|
|
3307
3357
|
type PoolTicks = z.infer<typeof PoolTicks$1>;
|
|
@@ -3373,7 +3423,13 @@ declare class TunaApiClient {
|
|
|
3373
3423
|
getOraclePrices(): Promise<TokenOraclePrice[]>;
|
|
3374
3424
|
getOraclePrice(mintAddress: string): Promise<TokenOraclePrice>;
|
|
3375
3425
|
getVaults(): Promise<Vault[]>;
|
|
3376
|
-
getVault(vaultAddress:
|
|
3426
|
+
getVault(vaultAddress: string): Promise<Vault>;
|
|
3427
|
+
/**
|
|
3428
|
+
* Returns vault historical data for selected time interval.
|
|
3429
|
+
*
|
|
3430
|
+
* Example usage: getVaultHistory('H3ifgix98vzi3yCPbmZDLTheeTRf2jykXx8FpY5L7Sfd', '2025-03-10', '2025-04-10')
|
|
3431
|
+
*/
|
|
3432
|
+
getVaultHistory(vaultAddress: string, from: Date, to: Date): Promise<VaultHistoricalStats[]>;
|
|
3377
3433
|
getPools(providerFilter?: ProviderFilter): Promise<Pool[]>;
|
|
3378
3434
|
getPool(address: string): Promise<Pool>;
|
|
3379
3435
|
getPoolTicks(poolAddress: string): Promise<PoolTicks>;
|
|
@@ -3396,4 +3452,4 @@ declare class TunaApiClient {
|
|
|
3396
3452
|
private appendUrlSearchParams;
|
|
3397
3453
|
}
|
|
3398
3454
|
|
|
3399
|
-
export { type DurationInMs, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type Vault, type WalletSubscriptionTopicType, schemas };
|
|
3455
|
+
export { type DurationInMs, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
|
package/dist/index.d.ts
CHANGED
|
@@ -311,6 +311,55 @@ declare const Vault$1: z.ZodObject<{
|
|
|
311
311
|
pythOracleFeedId: string;
|
|
312
312
|
pythOraclePriceUpdate: string;
|
|
313
313
|
}>;
|
|
314
|
+
declare const VaultHistoricalStats$1: z.ZodObject<{
|
|
315
|
+
date: z.ZodEffects<z.ZodDate, Date, unknown>;
|
|
316
|
+
supply: z.ZodObject<{
|
|
317
|
+
amount: z.ZodBigInt;
|
|
318
|
+
usd: z.ZodNumber;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
amount: bigint;
|
|
321
|
+
usd: number;
|
|
322
|
+
}, {
|
|
323
|
+
amount: bigint;
|
|
324
|
+
usd: number;
|
|
325
|
+
}>;
|
|
326
|
+
borrow: z.ZodObject<{
|
|
327
|
+
amount: z.ZodBigInt;
|
|
328
|
+
usd: z.ZodNumber;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
amount: bigint;
|
|
331
|
+
usd: number;
|
|
332
|
+
}, {
|
|
333
|
+
amount: bigint;
|
|
334
|
+
usd: number;
|
|
335
|
+
}>;
|
|
336
|
+
supplyApy: z.ZodNumber;
|
|
337
|
+
borrowApr: z.ZodNumber;
|
|
338
|
+
}, "strip", z.ZodTypeAny, {
|
|
339
|
+
supplyApy: number;
|
|
340
|
+
date: Date;
|
|
341
|
+
supply: {
|
|
342
|
+
amount: bigint;
|
|
343
|
+
usd: number;
|
|
344
|
+
};
|
|
345
|
+
borrow: {
|
|
346
|
+
amount: bigint;
|
|
347
|
+
usd: number;
|
|
348
|
+
};
|
|
349
|
+
borrowApr: number;
|
|
350
|
+
}, {
|
|
351
|
+
supplyApy: number;
|
|
352
|
+
supply: {
|
|
353
|
+
amount: bigint;
|
|
354
|
+
usd: number;
|
|
355
|
+
};
|
|
356
|
+
borrow: {
|
|
357
|
+
amount: bigint;
|
|
358
|
+
usd: number;
|
|
359
|
+
};
|
|
360
|
+
borrowApr: number;
|
|
361
|
+
date?: unknown;
|
|
362
|
+
}>;
|
|
314
363
|
declare const Pool$1: z.ZodObject<{
|
|
315
364
|
address: z.ZodString;
|
|
316
365
|
provider: z.ZodEnum<["orca", ...("orca" | "fusion")[]]>;
|
|
@@ -3290,7 +3339,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
|
|
|
3290
3339
|
declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
|
|
3291
3340
|
declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
|
|
3292
3341
|
declare namespace schemas {
|
|
3293
|
-
export { LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
|
|
3342
|
+
export { LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
|
|
3294
3343
|
}
|
|
3295
3344
|
|
|
3296
3345
|
type PoolProviderType = z.infer<typeof PoolProviderSchema>;
|
|
@@ -3302,6 +3351,7 @@ type Mint = z.infer<typeof Mint$1>;
|
|
|
3302
3351
|
type Market = z.infer<typeof Market$1>;
|
|
3303
3352
|
type TokenOraclePrice = z.infer<typeof TokenOraclePrice$1>;
|
|
3304
3353
|
type Vault = z.infer<typeof Vault$1>;
|
|
3354
|
+
type VaultHistoricalStats = z.infer<typeof VaultHistoricalStats$1>;
|
|
3305
3355
|
type Pool = z.infer<typeof Pool$1>;
|
|
3306
3356
|
type Tick = z.infer<typeof Tick$1>;
|
|
3307
3357
|
type PoolTicks = z.infer<typeof PoolTicks$1>;
|
|
@@ -3373,7 +3423,13 @@ declare class TunaApiClient {
|
|
|
3373
3423
|
getOraclePrices(): Promise<TokenOraclePrice[]>;
|
|
3374
3424
|
getOraclePrice(mintAddress: string): Promise<TokenOraclePrice>;
|
|
3375
3425
|
getVaults(): Promise<Vault[]>;
|
|
3376
|
-
getVault(vaultAddress:
|
|
3426
|
+
getVault(vaultAddress: string): Promise<Vault>;
|
|
3427
|
+
/**
|
|
3428
|
+
* Returns vault historical data for selected time interval.
|
|
3429
|
+
*
|
|
3430
|
+
* Example usage: getVaultHistory('H3ifgix98vzi3yCPbmZDLTheeTRf2jykXx8FpY5L7Sfd', '2025-03-10', '2025-04-10')
|
|
3431
|
+
*/
|
|
3432
|
+
getVaultHistory(vaultAddress: string, from: Date, to: Date): Promise<VaultHistoricalStats[]>;
|
|
3377
3433
|
getPools(providerFilter?: ProviderFilter): Promise<Pool[]>;
|
|
3378
3434
|
getPool(address: string): Promise<Pool>;
|
|
3379
3435
|
getPoolTicks(poolAddress: string): Promise<PoolTicks>;
|
|
@@ -3396,4 +3452,4 @@ declare class TunaApiClient {
|
|
|
3396
3452
|
private appendUrlSearchParams;
|
|
3397
3453
|
}
|
|
3398
3454
|
|
|
3399
|
-
export { type DurationInMs, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type Vault, type WalletSubscriptionTopicType, schemas };
|
|
3455
|
+
export { type DurationInMs, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
|
package/dist/index.js
CHANGED
|
@@ -81,6 +81,7 @@ __export(schemas_exports, {
|
|
|
81
81
|
TunaPositionStateSchema: () => TunaPositionStateSchema,
|
|
82
82
|
UpdateStreamSubscriptionResult: () => UpdateStreamSubscriptionResult,
|
|
83
83
|
Vault: () => Vault,
|
|
84
|
+
VaultHistoricalStats: () => VaultHistoricalStats,
|
|
84
85
|
WalletSubscriptionTopic: () => WalletSubscriptionTopic,
|
|
85
86
|
WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
|
|
86
87
|
});
|
|
@@ -198,6 +199,23 @@ var Vault = import_zod.z.object({
|
|
|
198
199
|
pythOracleFeedId: import_zod.z.string(),
|
|
199
200
|
pythOraclePriceUpdate: import_zod.z.string()
|
|
200
201
|
});
|
|
202
|
+
var VaultHistoricalStats = import_zod.z.object({
|
|
203
|
+
date: import_zod.z.preprocess((val, ctx) => {
|
|
204
|
+
if (typeof val === "string") {
|
|
205
|
+
const [year, month, day] = val.split("-").map(Number);
|
|
206
|
+
return new Date(year, month - 1, day);
|
|
207
|
+
}
|
|
208
|
+
ctx.addIssue({
|
|
209
|
+
code: "custom",
|
|
210
|
+
message: "Not a valid date string"
|
|
211
|
+
});
|
|
212
|
+
return import_zod.z.NEVER;
|
|
213
|
+
}, import_zod.z.date()),
|
|
214
|
+
supply: amountWithUsd,
|
|
215
|
+
borrow: amountWithUsd,
|
|
216
|
+
supplyApy: import_zod.z.number(),
|
|
217
|
+
borrowApr: import_zod.z.number()
|
|
218
|
+
});
|
|
201
219
|
var Pool = import_zod.z.object({
|
|
202
220
|
address: import_zod.z.string(),
|
|
203
221
|
provider: PoolProviderSchema,
|
|
@@ -464,6 +482,16 @@ var TunaApiClient = class {
|
|
|
464
482
|
const url = this.buildURL(`vaults/${vaultAddress}`);
|
|
465
483
|
return await this.httpRequest(url.toString(), Vault);
|
|
466
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* Returns vault historical data for selected time interval.
|
|
487
|
+
*
|
|
488
|
+
* Example usage: getVaultHistory('H3ifgix98vzi3yCPbmZDLTheeTRf2jykXx8FpY5L7Sfd', '2025-03-10', '2025-04-10')
|
|
489
|
+
*/
|
|
490
|
+
async getVaultHistory(vaultAddress, from, to) {
|
|
491
|
+
const url = this.buildURL(`vaults/${vaultAddress}/history`);
|
|
492
|
+
this.appendUrlSearchParams(url, { from: from.toISOString().slice(0, 10), to: to.toISOString().slice(0, 10) });
|
|
493
|
+
return await this.httpRequest(url.toString(), VaultHistoricalStats.array());
|
|
494
|
+
}
|
|
467
495
|
async getPools(providerFilter) {
|
|
468
496
|
const url = this.buildURL("pools");
|
|
469
497
|
if (providerFilter && providerFilter !== "all" /* ALL */) {
|
package/dist/index.mjs
CHANGED
|
@@ -46,6 +46,7 @@ __export(schemas_exports, {
|
|
|
46
46
|
TunaPositionStateSchema: () => TunaPositionStateSchema,
|
|
47
47
|
UpdateStreamSubscriptionResult: () => UpdateStreamSubscriptionResult,
|
|
48
48
|
Vault: () => Vault,
|
|
49
|
+
VaultHistoricalStats: () => VaultHistoricalStats,
|
|
49
50
|
WalletSubscriptionTopic: () => WalletSubscriptionTopic,
|
|
50
51
|
WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
|
|
51
52
|
});
|
|
@@ -163,6 +164,23 @@ var Vault = z.object({
|
|
|
163
164
|
pythOracleFeedId: z.string(),
|
|
164
165
|
pythOraclePriceUpdate: z.string()
|
|
165
166
|
});
|
|
167
|
+
var VaultHistoricalStats = z.object({
|
|
168
|
+
date: z.preprocess((val, ctx) => {
|
|
169
|
+
if (typeof val === "string") {
|
|
170
|
+
const [year, month, day] = val.split("-").map(Number);
|
|
171
|
+
return new Date(year, month - 1, day);
|
|
172
|
+
}
|
|
173
|
+
ctx.addIssue({
|
|
174
|
+
code: "custom",
|
|
175
|
+
message: "Not a valid date string"
|
|
176
|
+
});
|
|
177
|
+
return z.NEVER;
|
|
178
|
+
}, z.date()),
|
|
179
|
+
supply: amountWithUsd,
|
|
180
|
+
borrow: amountWithUsd,
|
|
181
|
+
supplyApy: z.number(),
|
|
182
|
+
borrowApr: z.number()
|
|
183
|
+
});
|
|
166
184
|
var Pool = z.object({
|
|
167
185
|
address: z.string(),
|
|
168
186
|
provider: PoolProviderSchema,
|
|
@@ -429,6 +447,16 @@ var TunaApiClient = class {
|
|
|
429
447
|
const url = this.buildURL(`vaults/${vaultAddress}`);
|
|
430
448
|
return await this.httpRequest(url.toString(), Vault);
|
|
431
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Returns vault historical data for selected time interval.
|
|
452
|
+
*
|
|
453
|
+
* Example usage: getVaultHistory('H3ifgix98vzi3yCPbmZDLTheeTRf2jykXx8FpY5L7Sfd', '2025-03-10', '2025-04-10')
|
|
454
|
+
*/
|
|
455
|
+
async getVaultHistory(vaultAddress, from, to) {
|
|
456
|
+
const url = this.buildURL(`vaults/${vaultAddress}/history`);
|
|
457
|
+
this.appendUrlSearchParams(url, { from: from.toISOString().slice(0, 10), to: to.toISOString().slice(0, 10) });
|
|
458
|
+
return await this.httpRequest(url.toString(), VaultHistoricalStats.array());
|
|
459
|
+
}
|
|
432
460
|
async getPools(providerFilter) {
|
|
433
461
|
const url = this.buildURL("pools");
|
|
434
462
|
if (providerFilter && providerFilter !== "all" /* ALL */) {
|