@crypticdot/defituna-api 1.2.1 → 1.3.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/dist/index.d.mts CHANGED
@@ -5118,6 +5118,17 @@ type SubscriptionPayload = {
5118
5118
  topics: WalletSubscriptionTopicType[];
5119
5119
  };
5120
5120
  };
5121
+ type GetUserLimitOrdersOptions = {
5122
+ pool?: string[];
5123
+ status?: LimitOrderStateType[];
5124
+ openedAt?: {
5125
+ from?: Date;
5126
+ to?: Date;
5127
+ };
5128
+ cursor?: string;
5129
+ limit?: number;
5130
+ desc?: boolean;
5131
+ };
5121
5132
  type DurationInMs = number;
5122
5133
  declare enum ProviderFilter {
5123
5134
  ORCA = "orca",
@@ -5187,7 +5198,7 @@ declare class TunaApiClient {
5187
5198
  getUserTunaPositionByAddress(userAddress: string, tunaPositionAddress: string): Promise<TunaPosition>;
5188
5199
  getUserTunaSpotPositions(userAddress: string): Promise<TunaSpotPosition[]>;
5189
5200
  getUserTunaSpotPositionByAddress(userAddress: string, tunaSpotPositionAddress: string): Promise<TunaSpotPosition>;
5190
- getUserLimitOrders(userAddress: string, poolFilter?: string): Promise<LimitOrder[]>;
5201
+ getUserLimitOrders(userAddress: string, options?: GetUserLimitOrdersOptions): Promise<LimitOrder[]>;
5191
5202
  getUserLimitOrderByAddress(userAddress: string, limitOrderAddress: string): Promise<LimitOrder>;
5192
5203
  getUserStakingPosition(userAddress: string): Promise<StakingPosition>;
5193
5204
  getUserStakingPositionHistory(userAddress: string): Promise<StakingPositionHistoryAction[]>;
@@ -5199,4 +5210,4 @@ declare class TunaApiClient {
5199
5210
  private appendUrlSearchParams;
5200
5211
  }
5201
5212
 
5202
- export { type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
5213
+ export { type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type GetUserLimitOrdersOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
package/dist/index.d.ts CHANGED
@@ -5118,6 +5118,17 @@ type SubscriptionPayload = {
5118
5118
  topics: WalletSubscriptionTopicType[];
5119
5119
  };
5120
5120
  };
5121
+ type GetUserLimitOrdersOptions = {
5122
+ pool?: string[];
5123
+ status?: LimitOrderStateType[];
5124
+ openedAt?: {
5125
+ from?: Date;
5126
+ to?: Date;
5127
+ };
5128
+ cursor?: string;
5129
+ limit?: number;
5130
+ desc?: boolean;
5131
+ };
5121
5132
  type DurationInMs = number;
5122
5133
  declare enum ProviderFilter {
5123
5134
  ORCA = "orca",
@@ -5187,7 +5198,7 @@ declare class TunaApiClient {
5187
5198
  getUserTunaPositionByAddress(userAddress: string, tunaPositionAddress: string): Promise<TunaPosition>;
5188
5199
  getUserTunaSpotPositions(userAddress: string): Promise<TunaSpotPosition[]>;
5189
5200
  getUserTunaSpotPositionByAddress(userAddress: string, tunaSpotPositionAddress: string): Promise<TunaSpotPosition>;
5190
- getUserLimitOrders(userAddress: string, poolFilter?: string): Promise<LimitOrder[]>;
5201
+ getUserLimitOrders(userAddress: string, options?: GetUserLimitOrdersOptions): Promise<LimitOrder[]>;
5191
5202
  getUserLimitOrderByAddress(userAddress: string, limitOrderAddress: string): Promise<LimitOrder>;
5192
5203
  getUserStakingPosition(userAddress: string): Promise<StakingPosition>;
5193
5204
  getUserStakingPositionHistory(userAddress: string): Promise<StakingPositionHistoryAction[]>;
@@ -5199,4 +5210,4 @@ declare class TunaApiClient {
5199
5210
  private appendUrlSearchParams;
5200
5211
  }
5201
5212
 
5202
- export { type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
5213
+ export { type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type GetUserLimitOrdersOptions, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type Tick, type TokenOraclePrice, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
package/dist/index.js CHANGED
@@ -740,10 +740,32 @@ var TunaApiClient = class {
740
740
  const url = this.buildURL(`users/${userAddress}/spot-positions/${tunaSpotPositionAddress}`);
741
741
  return await this.httpRequest(url, TunaSpotPosition);
742
742
  }
743
- async getUserLimitOrders(userAddress, poolFilter) {
744
- const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/limit-orders`), {
745
- pool: poolFilter || void 0
746
- });
743
+ async getUserLimitOrders(userAddress, options) {
744
+ let query = {};
745
+ if (options) {
746
+ if (options.pool?.length) {
747
+ query.pool = options.pool.join(",");
748
+ }
749
+ if (options.status?.length) {
750
+ query.status = options.status.join(",");
751
+ }
752
+ if (options.openedAt?.from) {
753
+ query.opened_at_from = options.openedAt.from.toISOString();
754
+ }
755
+ if (options.openedAt?.to) {
756
+ query.opened_at_from = options.openedAt.to.toISOString();
757
+ }
758
+ if (options.limit) {
759
+ query.limit = options.limit;
760
+ }
761
+ if (options.cursor) {
762
+ query.cursor = options.cursor;
763
+ }
764
+ if (options.desc !== void 0) {
765
+ query.desc = options.desc;
766
+ }
767
+ }
768
+ const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/limit-orders`), query);
747
769
  return await this.httpRequest(url, LimitOrder.array());
748
770
  }
749
771
  async getUserLimitOrderByAddress(userAddress, limitOrderAddress) {
package/dist/index.mjs CHANGED
@@ -705,10 +705,32 @@ var TunaApiClient = class {
705
705
  const url = this.buildURL(`users/${userAddress}/spot-positions/${tunaSpotPositionAddress}`);
706
706
  return await this.httpRequest(url, TunaSpotPosition);
707
707
  }
708
- async getUserLimitOrders(userAddress, poolFilter) {
709
- const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/limit-orders`), {
710
- pool: poolFilter || void 0
711
- });
708
+ async getUserLimitOrders(userAddress, options) {
709
+ let query = {};
710
+ if (options) {
711
+ if (options.pool?.length) {
712
+ query.pool = options.pool.join(",");
713
+ }
714
+ if (options.status?.length) {
715
+ query.status = options.status.join(",");
716
+ }
717
+ if (options.openedAt?.from) {
718
+ query.opened_at_from = options.openedAt.from.toISOString();
719
+ }
720
+ if (options.openedAt?.to) {
721
+ query.opened_at_from = options.openedAt.to.toISOString();
722
+ }
723
+ if (options.limit) {
724
+ query.limit = options.limit;
725
+ }
726
+ if (options.cursor) {
727
+ query.cursor = options.cursor;
728
+ }
729
+ if (options.desc !== void 0) {
730
+ query.desc = options.desc;
731
+ }
732
+ }
733
+ const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/limit-orders`), query);
712
734
  return await this.httpRequest(url, LimitOrder.array());
713
735
  }
714
736
  async getUserLimitOrderByAddress(userAddress, limitOrderAddress) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -18,6 +18,7 @@
18
18
  "@crypticdot/eslint-config": "^1.0.2",
19
19
  "@crypticdot/prettier-config": "^1.0.0",
20
20
  "@crypticdot/typescript-config": "^1.0.0",
21
+ "@crypticdot/fusionamm-client": "^1.0.62",
21
22
  "@solana/kit": "^2.1.0",
22
23
  "@types/node": "^22.13.14",
23
24
  "decimal.js": "^10.5.0",