@crypticdot/defituna-api 3.0.1 → 3.0.3

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.cjs CHANGED
@@ -225,11 +225,19 @@ function modifyQuery(url) {
225
225
  async function customFetch(url, init) {
226
226
  const fullUrl = resolveTunaUrl(url, init);
227
227
  const finalInit = { ...init };
228
+ if (finalInit.body && typeof finalInit.body === "string") {
229
+ try {
230
+ const body = JSON.parse(finalInit.body);
231
+ const snaked = normalizeRequestBody(body);
232
+ finalInit.body = JSON.stringify(snaked);
233
+ } catch {
234
+ }
235
+ }
228
236
  if (finalInit.body && typeof finalInit.body === "object" && !(finalInit.body instanceof FormData)) {
229
237
  const snaked = normalizeRequestBody(finalInit.body);
230
238
  finalInit.body = JSON.stringify(snaked);
231
239
  finalInit.headers = {
232
- "content-type": "application/json",
240
+ "Content-Type": "application/json",
233
241
  ...finalInit.headers || {}
234
242
  };
235
243
  }
@@ -952,7 +960,7 @@ var getGetLpPositionsUrl = (userAddress, params) => {
952
960
  }
953
961
  });
954
962
  const stringifiedParams = normalizedParams.toString();
955
- return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/lp-positions?${stringifiedParams}` : `/v1/users/${userAddress}/lp-positions`;
963
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/lp-positions-history?${stringifiedParams}` : `/v1/users/${userAddress}/lp-positions-history`;
956
964
  };
957
965
  var getLpPositions = async (userAddress, params, options) => {
958
966
  return customFetch(
@@ -964,7 +972,7 @@ var getLpPositions = async (userAddress, params, options) => {
964
972
  );
965
973
  };
966
974
  var getGetLpPositionActionsUrl = (userAddress, positionAddress) => {
967
- return `/v1/users/${userAddress}/lp-positions/${positionAddress}/actions`;
975
+ return `/v1/users/${userAddress}/lp-positions-history/${positionAddress}/actions`;
968
976
  };
969
977
  var getLpPositionActions = async (userAddress, positionAddress, options) => {
970
978
  return customFetch(
package/dist/index.d.cts CHANGED
@@ -25,7 +25,8 @@ interface DecreaseSpotPositionQuoteDto {
25
25
  requiredSwapAmount: bigint;
26
26
  }
27
27
  interface FeeAmountWithUsd {
28
- amount: number;
28
+ /** Signed 64-bit integer encoded as a decimal string */
29
+ amount: bigint;
29
30
  usd: number;
30
31
  }
31
32
  interface FeesStatsGroupDto {
@@ -900,8 +901,7 @@ type GenericHttpResponseVecTunaLpPositionDtoDataItem = {
900
901
  lowerPrice: number;
901
902
  marketMaker: PoolProvider;
902
903
  openedAt: Date;
903
- /** Solana public key (base58) */
904
- pool: string;
904
+ pool: PoolDto;
905
905
  /** Solana public key (base58) */
906
906
  positionAddress: string;
907
907
  state: TunaPositionDtoState;
@@ -1901,8 +1901,7 @@ interface TunaLpPositionDto {
1901
1901
  lowerPrice: number;
1902
1902
  marketMaker: PoolProvider;
1903
1903
  openedAt: Date;
1904
- /** Solana public key (base58) */
1905
- pool: string;
1904
+ pool: PoolDto;
1906
1905
  /** Solana public key (base58) */
1907
1906
  positionAddress: string;
1908
1907
  state: TunaPositionDtoState;
package/dist/index.d.ts CHANGED
@@ -25,7 +25,8 @@ interface DecreaseSpotPositionQuoteDto {
25
25
  requiredSwapAmount: bigint;
26
26
  }
27
27
  interface FeeAmountWithUsd {
28
- amount: number;
28
+ /** Signed 64-bit integer encoded as a decimal string */
29
+ amount: bigint;
29
30
  usd: number;
30
31
  }
31
32
  interface FeesStatsGroupDto {
@@ -900,8 +901,7 @@ type GenericHttpResponseVecTunaLpPositionDtoDataItem = {
900
901
  lowerPrice: number;
901
902
  marketMaker: PoolProvider;
902
903
  openedAt: Date;
903
- /** Solana public key (base58) */
904
- pool: string;
904
+ pool: PoolDto;
905
905
  /** Solana public key (base58) */
906
906
  positionAddress: string;
907
907
  state: TunaPositionDtoState;
@@ -1901,8 +1901,7 @@ interface TunaLpPositionDto {
1901
1901
  lowerPrice: number;
1902
1902
  marketMaker: PoolProvider;
1903
1903
  openedAt: Date;
1904
- /** Solana public key (base58) */
1905
- pool: string;
1904
+ pool: PoolDto;
1906
1905
  /** Solana public key (base58) */
1907
1906
  positionAddress: string;
1908
1907
  state: TunaPositionDtoState;
package/dist/index.js CHANGED
@@ -72,11 +72,19 @@ function modifyQuery(url) {
72
72
  async function customFetch(url, init) {
73
73
  const fullUrl = resolveTunaUrl(url, init);
74
74
  const finalInit = { ...init };
75
+ if (finalInit.body && typeof finalInit.body === "string") {
76
+ try {
77
+ const body = JSON.parse(finalInit.body);
78
+ const snaked = normalizeRequestBody(body);
79
+ finalInit.body = JSON.stringify(snaked);
80
+ } catch {
81
+ }
82
+ }
75
83
  if (finalInit.body && typeof finalInit.body === "object" && !(finalInit.body instanceof FormData)) {
76
84
  const snaked = normalizeRequestBody(finalInit.body);
77
85
  finalInit.body = JSON.stringify(snaked);
78
86
  finalInit.headers = {
79
- "content-type": "application/json",
87
+ "Content-Type": "application/json",
80
88
  ...finalInit.headers || {}
81
89
  };
82
90
  }
@@ -799,7 +807,7 @@ var getGetLpPositionsUrl = (userAddress, params) => {
799
807
  }
800
808
  });
801
809
  const stringifiedParams = normalizedParams.toString();
802
- return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/lp-positions?${stringifiedParams}` : `/v1/users/${userAddress}/lp-positions`;
810
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/lp-positions-history?${stringifiedParams}` : `/v1/users/${userAddress}/lp-positions-history`;
803
811
  };
804
812
  var getLpPositions = async (userAddress, params, options) => {
805
813
  return customFetch(
@@ -811,7 +819,7 @@ var getLpPositions = async (userAddress, params, options) => {
811
819
  );
812
820
  };
813
821
  var getGetLpPositionActionsUrl = (userAddress, positionAddress) => {
814
- return `/v1/users/${userAddress}/lp-positions/${positionAddress}/actions`;
822
+ return `/v1/users/${userAddress}/lp-positions-history/${positionAddress}/actions`;
815
823
  };
816
824
  var getLpPositionActions = async (userAddress, positionAddress, options) => {
817
825
  return customFetch(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",