@shogun-sdk/swap 0.0.2-test.4 → 0.0.2-test.6

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/core.cjs CHANGED
@@ -177,12 +177,12 @@ async function getQuote(params) {
177
177
  tokenOut: params.tokenOut.address,
178
178
  amount: params.amount
179
179
  });
180
- const inputSlippage = params.slippage ?? 5;
181
- const slippageDecimal = inputSlippage / 100;
182
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
180
+ const inputSlippage = params.slippage ?? 0.05;
181
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
182
+ const slippage = slippagePercent / 100;
183
183
  let warning;
184
- if (slippage > 0.1) {
185
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
184
+ if (slippagePercent > 10) {
185
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
186
186
  }
187
187
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
188
188
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -205,7 +205,8 @@ async function getQuote(params) {
205
205
  },
206
206
  amountIn: params.amount,
207
207
  pricePerInputToken,
208
- slippage,
208
+ slippage: slippagePercent,
209
+ // keep % form in output for clarity
209
210
  internal: {
210
211
  ...data,
211
212
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
package/dist/core.js CHANGED
@@ -139,12 +139,12 @@ async function getQuote(params) {
139
139
  tokenOut: params.tokenOut.address,
140
140
  amount: params.amount
141
141
  });
142
- const inputSlippage = params.slippage ?? 5;
143
- const slippageDecimal = inputSlippage / 100;
144
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
142
+ const inputSlippage = params.slippage ?? 0.05;
143
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
144
+ const slippage = slippagePercent / 100;
145
145
  let warning;
146
- if (slippage > 0.1) {
147
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
146
+ if (slippagePercent > 10) {
147
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
148
148
  }
149
149
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
150
150
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -167,7 +167,8 @@ async function getQuote(params) {
167
167
  },
168
168
  amountIn: params.amount,
169
169
  pricePerInputToken,
170
- slippage,
170
+ slippage: slippagePercent,
171
+ // keep % form in output for clarity
171
172
  internal: {
172
173
  ...data,
173
174
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
package/dist/index.cjs CHANGED
@@ -182,12 +182,12 @@ async function getQuote(params) {
182
182
  tokenOut: params.tokenOut.address,
183
183
  amount: params.amount
184
184
  });
185
- const inputSlippage = params.slippage ?? 5;
186
- const slippageDecimal = inputSlippage / 100;
187
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
185
+ const inputSlippage = params.slippage ?? 0.05;
186
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
187
+ const slippage = slippagePercent / 100;
188
188
  let warning;
189
- if (slippage > 0.1) {
190
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
189
+ if (slippagePercent > 10) {
190
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
191
191
  }
192
192
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
193
193
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -210,7 +210,8 @@ async function getQuote(params) {
210
210
  },
211
211
  amountIn: params.amount,
212
212
  pricePerInputToken,
213
- slippage,
213
+ slippage: slippagePercent,
214
+ // keep % form in output for clarity
214
215
  internal: {
215
216
  ...data,
216
217
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
@@ -854,6 +855,10 @@ function useQuote(params, options) {
854
855
  const abortRef = (0, import_react3.useRef)(null);
855
856
  const debounceRef = (0, import_react3.useRef)(null);
856
857
  const mounted = (0, import_react3.useRef)(false);
858
+ const paramsKey = (0, import_react3.useMemo)(
859
+ () => params ? JSON.stringify(serializeBigIntsToStrings(params)) : null,
860
+ [params]
861
+ );
857
862
  (0, import_react3.useEffect)(() => {
858
863
  mounted.current = true;
859
864
  return () => {
@@ -862,33 +867,30 @@ function useQuote(params, options) {
862
867
  if (debounceRef.current) clearTimeout(debounceRef.current);
863
868
  };
864
869
  }, []);
865
- const fetchQuote = (0, import_react3.useCallback)(
866
- async () => {
867
- if (!params) return;
868
- try {
869
- setLoading(true);
870
- setWarning(null);
871
- const result = await getQuote(params);
872
- const serializeResult = serializeBigIntsToStrings(result);
873
- if (!mounted.current) return;
874
- setData((prev) => {
875
- if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
876
- return serializeResult;
877
- });
878
- setWarning(result.warning ?? null);
879
- setError(null);
880
- } catch (err) {
881
- if (err.name === "AbortError") return;
882
- console.error("[useQuote] fetch error:", err);
883
- if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
884
- } finally {
885
- if (mounted.current) setLoading(false);
886
- }
887
- },
888
- [params]
889
- );
890
- (0, import_react3.useEffect)(() => {
870
+ const fetchQuote = (0, import_react3.useCallback)(async () => {
891
871
  if (!params) return;
872
+ try {
873
+ setLoading(true);
874
+ setWarning(null);
875
+ const result = await getQuote(params);
876
+ const serializeResult = serializeBigIntsToStrings(result);
877
+ if (!mounted.current) return;
878
+ setData((prev) => {
879
+ if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
880
+ return serializeResult;
881
+ });
882
+ setWarning(result.warning ?? null);
883
+ setError(null);
884
+ } catch (err) {
885
+ if (err.name === "AbortError") return;
886
+ console.error("[useQuote] fetch error:", err);
887
+ if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
888
+ } finally {
889
+ if (mounted.current) setLoading(false);
890
+ }
891
+ }, [paramsKey]);
892
+ (0, import_react3.useEffect)(() => {
893
+ if (!paramsKey) return;
892
894
  if (debounceRef.current) clearTimeout(debounceRef.current);
893
895
  debounceRef.current = setTimeout(() => {
894
896
  fetchQuote();
@@ -897,19 +899,19 @@ function useQuote(params, options) {
897
899
  if (debounceRef.current) clearTimeout(debounceRef.current);
898
900
  abortRef.current?.abort();
899
901
  };
900
- }, [params, debounceMs, fetchQuote]);
902
+ }, [paramsKey, debounceMs, fetchQuote]);
901
903
  (0, import_react3.useEffect)(() => {
902
- if (!autoRefreshMs || !params) return;
904
+ if (!autoRefreshMs || !paramsKey) return;
903
905
  const interval = setInterval(() => fetchQuote(), autoRefreshMs);
904
906
  return () => clearInterval(interval);
905
- }, [autoRefreshMs, params, fetchQuote]);
907
+ }, [autoRefreshMs, paramsKey, fetchQuote]);
906
908
  return (0, import_react3.useMemo)(
907
909
  () => ({
908
910
  data,
909
911
  loading,
910
912
  error,
911
913
  warning,
912
- refetch: () => fetchQuote()
914
+ refetch: fetchQuote
913
915
  }),
914
916
  [data, loading, error, warning, fetchQuote]
915
917
  );
package/dist/index.js CHANGED
@@ -139,12 +139,12 @@ async function getQuote(params) {
139
139
  tokenOut: params.tokenOut.address,
140
140
  amount: params.amount
141
141
  });
142
- const inputSlippage = params.slippage ?? 5;
143
- const slippageDecimal = inputSlippage / 100;
144
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
142
+ const inputSlippage = params.slippage ?? 0.05;
143
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
144
+ const slippage = slippagePercent / 100;
145
145
  let warning;
146
- if (slippage > 0.1) {
147
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
146
+ if (slippagePercent > 10) {
147
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
148
148
  }
149
149
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
150
150
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -167,7 +167,8 @@ async function getQuote(params) {
167
167
  },
168
168
  amountIn: params.amount,
169
169
  pricePerInputToken,
170
- slippage,
170
+ slippage: slippagePercent,
171
+ // keep % form in output for clarity
171
172
  internal: {
172
173
  ...data,
173
174
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
@@ -823,6 +824,10 @@ function useQuote(params, options) {
823
824
  const abortRef = useRef3(null);
824
825
  const debounceRef = useRef3(null);
825
826
  const mounted = useRef3(false);
827
+ const paramsKey = useMemo2(
828
+ () => params ? JSON.stringify(serializeBigIntsToStrings(params)) : null,
829
+ [params]
830
+ );
826
831
  useEffect3(() => {
827
832
  mounted.current = true;
828
833
  return () => {
@@ -831,33 +836,30 @@ function useQuote(params, options) {
831
836
  if (debounceRef.current) clearTimeout(debounceRef.current);
832
837
  };
833
838
  }, []);
834
- const fetchQuote = useCallback2(
835
- async () => {
836
- if (!params) return;
837
- try {
838
- setLoading(true);
839
- setWarning(null);
840
- const result = await getQuote(params);
841
- const serializeResult = serializeBigIntsToStrings(result);
842
- if (!mounted.current) return;
843
- setData((prev) => {
844
- if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
845
- return serializeResult;
846
- });
847
- setWarning(result.warning ?? null);
848
- setError(null);
849
- } catch (err) {
850
- if (err.name === "AbortError") return;
851
- console.error("[useQuote] fetch error:", err);
852
- if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
853
- } finally {
854
- if (mounted.current) setLoading(false);
855
- }
856
- },
857
- [params]
858
- );
859
- useEffect3(() => {
839
+ const fetchQuote = useCallback2(async () => {
860
840
  if (!params) return;
841
+ try {
842
+ setLoading(true);
843
+ setWarning(null);
844
+ const result = await getQuote(params);
845
+ const serializeResult = serializeBigIntsToStrings(result);
846
+ if (!mounted.current) return;
847
+ setData((prev) => {
848
+ if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
849
+ return serializeResult;
850
+ });
851
+ setWarning(result.warning ?? null);
852
+ setError(null);
853
+ } catch (err) {
854
+ if (err.name === "AbortError") return;
855
+ console.error("[useQuote] fetch error:", err);
856
+ if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
857
+ } finally {
858
+ if (mounted.current) setLoading(false);
859
+ }
860
+ }, [paramsKey]);
861
+ useEffect3(() => {
862
+ if (!paramsKey) return;
861
863
  if (debounceRef.current) clearTimeout(debounceRef.current);
862
864
  debounceRef.current = setTimeout(() => {
863
865
  fetchQuote();
@@ -866,19 +868,19 @@ function useQuote(params, options) {
866
868
  if (debounceRef.current) clearTimeout(debounceRef.current);
867
869
  abortRef.current?.abort();
868
870
  };
869
- }, [params, debounceMs, fetchQuote]);
871
+ }, [paramsKey, debounceMs, fetchQuote]);
870
872
  useEffect3(() => {
871
- if (!autoRefreshMs || !params) return;
873
+ if (!autoRefreshMs || !paramsKey) return;
872
874
  const interval = setInterval(() => fetchQuote(), autoRefreshMs);
873
875
  return () => clearInterval(interval);
874
- }, [autoRefreshMs, params, fetchQuote]);
876
+ }, [autoRefreshMs, paramsKey, fetchQuote]);
875
877
  return useMemo2(
876
878
  () => ({
877
879
  data,
878
880
  loading,
879
881
  error,
880
882
  warning,
881
- refetch: () => fetchQuote()
883
+ refetch: fetchQuote
882
884
  }),
883
885
  [data, loading, error, warning, fetchQuote]
884
886
  );
package/dist/react.cjs CHANGED
@@ -651,12 +651,12 @@ async function getQuote(params) {
651
651
  tokenOut: params.tokenOut.address,
652
652
  amount: params.amount
653
653
  });
654
- const inputSlippage = params.slippage ?? 5;
655
- const slippageDecimal = inputSlippage / 100;
656
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
654
+ const inputSlippage = params.slippage ?? 0.05;
655
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
656
+ const slippage = slippagePercent / 100;
657
657
  let warning;
658
- if (slippage > 0.1) {
659
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
658
+ if (slippagePercent > 10) {
659
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
660
660
  }
661
661
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
662
662
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -679,7 +679,8 @@ async function getQuote(params) {
679
679
  },
680
680
  amountIn: params.amount,
681
681
  pricePerInputToken,
682
- slippage,
682
+ slippage: slippagePercent,
683
+ // keep % form in output for clarity
683
684
  internal: {
684
685
  ...data,
685
686
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
@@ -699,6 +700,10 @@ function useQuote(params, options) {
699
700
  const abortRef = (0, import_react3.useRef)(null);
700
701
  const debounceRef = (0, import_react3.useRef)(null);
701
702
  const mounted = (0, import_react3.useRef)(false);
703
+ const paramsKey = (0, import_react3.useMemo)(
704
+ () => params ? JSON.stringify(serializeBigIntsToStrings(params)) : null,
705
+ [params]
706
+ );
702
707
  (0, import_react3.useEffect)(() => {
703
708
  mounted.current = true;
704
709
  return () => {
@@ -707,33 +712,30 @@ function useQuote(params, options) {
707
712
  if (debounceRef.current) clearTimeout(debounceRef.current);
708
713
  };
709
714
  }, []);
710
- const fetchQuote = (0, import_react3.useCallback)(
711
- async () => {
712
- if (!params) return;
713
- try {
714
- setLoading(true);
715
- setWarning(null);
716
- const result = await getQuote(params);
717
- const serializeResult = serializeBigIntsToStrings(result);
718
- if (!mounted.current) return;
719
- setData((prev) => {
720
- if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
721
- return serializeResult;
722
- });
723
- setWarning(result.warning ?? null);
724
- setError(null);
725
- } catch (err) {
726
- if (err.name === "AbortError") return;
727
- console.error("[useQuote] fetch error:", err);
728
- if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
729
- } finally {
730
- if (mounted.current) setLoading(false);
731
- }
732
- },
733
- [params]
734
- );
735
- (0, import_react3.useEffect)(() => {
715
+ const fetchQuote = (0, import_react3.useCallback)(async () => {
736
716
  if (!params) return;
717
+ try {
718
+ setLoading(true);
719
+ setWarning(null);
720
+ const result = await getQuote(params);
721
+ const serializeResult = serializeBigIntsToStrings(result);
722
+ if (!mounted.current) return;
723
+ setData((prev) => {
724
+ if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
725
+ return serializeResult;
726
+ });
727
+ setWarning(result.warning ?? null);
728
+ setError(null);
729
+ } catch (err) {
730
+ if (err.name === "AbortError") return;
731
+ console.error("[useQuote] fetch error:", err);
732
+ if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
733
+ } finally {
734
+ if (mounted.current) setLoading(false);
735
+ }
736
+ }, [paramsKey]);
737
+ (0, import_react3.useEffect)(() => {
738
+ if (!paramsKey) return;
737
739
  if (debounceRef.current) clearTimeout(debounceRef.current);
738
740
  debounceRef.current = setTimeout(() => {
739
741
  fetchQuote();
@@ -742,19 +744,19 @@ function useQuote(params, options) {
742
744
  if (debounceRef.current) clearTimeout(debounceRef.current);
743
745
  abortRef.current?.abort();
744
746
  };
745
- }, [params, debounceMs, fetchQuote]);
747
+ }, [paramsKey, debounceMs, fetchQuote]);
746
748
  (0, import_react3.useEffect)(() => {
747
- if (!autoRefreshMs || !params) return;
749
+ if (!autoRefreshMs || !paramsKey) return;
748
750
  const interval = setInterval(() => fetchQuote(), autoRefreshMs);
749
751
  return () => clearInterval(interval);
750
- }, [autoRefreshMs, params, fetchQuote]);
752
+ }, [autoRefreshMs, paramsKey, fetchQuote]);
751
753
  return (0, import_react3.useMemo)(
752
754
  () => ({
753
755
  data,
754
756
  loading,
755
757
  error,
756
758
  warning,
757
- refetch: () => fetchQuote()
759
+ refetch: fetchQuote
758
760
  }),
759
761
  [data, loading, error, warning, fetchQuote]
760
762
  );
package/dist/react.d.cts CHANGED
@@ -93,12 +93,8 @@ declare function useExecuteOrder(): {
93
93
 
94
94
  /**
95
95
  * useQuote — React hook for fetching live swap quotes.
96
- *
97
- * - Supports debounce and auto-refresh.
98
- * - Safe for React 18+ (no double fetch).
99
- * - Compatible with AbortController.
100
96
  */
101
- declare function useQuote(params: SwapQuoteParams, options?: {
97
+ declare function useQuote(params: SwapQuoteParams | null, options?: {
102
98
  debounceMs?: number;
103
99
  autoRefreshMs?: number;
104
100
  }): {
package/dist/react.d.ts CHANGED
@@ -93,12 +93,8 @@ declare function useExecuteOrder(): {
93
93
 
94
94
  /**
95
95
  * useQuote — React hook for fetching live swap quotes.
96
- *
97
- * - Supports debounce and auto-refresh.
98
- * - Safe for React 18+ (no double fetch).
99
- * - Compatible with AbortController.
100
96
  */
101
- declare function useQuote(params: SwapQuoteParams, options?: {
97
+ declare function useQuote(params: SwapQuoteParams | null, options?: {
102
98
  debounceMs?: number;
103
99
  autoRefreshMs?: number;
104
100
  }): {
package/dist/react.js CHANGED
@@ -630,12 +630,12 @@ async function getQuote(params) {
630
630
  tokenOut: params.tokenOut.address,
631
631
  amount: params.amount
632
632
  });
633
- const inputSlippage = params.slippage ?? 5;
634
- const slippageDecimal = inputSlippage / 100;
635
- const slippage = Math.min(Math.max(slippageDecimal, 0), 0.5);
633
+ const inputSlippage = params.slippage ?? 0.05;
634
+ const slippagePercent = Math.min(Math.max(inputSlippage, 0), 50);
635
+ const slippage = slippagePercent / 100;
636
636
  let warning;
637
- if (slippage > 0.1) {
638
- warning = `\u26A0\uFE0F High slippage tolerance (${(slippage * 100).toFixed(2)}%) \u2014 price may vary significantly.`;
637
+ if (slippagePercent > 10) {
638
+ warning = `\u26A0\uFE0F High slippage tolerance (${slippagePercent.toFixed(2)}%) \u2014 price may vary significantly.`;
639
639
  }
640
640
  const estimatedAmountOut = BigInt(data.estimatedAmountOutReduced);
641
641
  const slippageBps = BigInt(Math.round(slippage * 1e4));
@@ -658,7 +658,8 @@ async function getQuote(params) {
658
658
  },
659
659
  amountIn: params.amount,
660
660
  pricePerInputToken,
661
- slippage,
661
+ slippage: slippagePercent,
662
+ // keep % form in output for clarity
662
663
  internal: {
663
664
  ...data,
664
665
  estimatedAmountOutReduced: estimatedAmountOutAfterSlippage
@@ -678,6 +679,10 @@ function useQuote(params, options) {
678
679
  const abortRef = useRef3(null);
679
680
  const debounceRef = useRef3(null);
680
681
  const mounted = useRef3(false);
682
+ const paramsKey = useMemo2(
683
+ () => params ? JSON.stringify(serializeBigIntsToStrings(params)) : null,
684
+ [params]
685
+ );
681
686
  useEffect3(() => {
682
687
  mounted.current = true;
683
688
  return () => {
@@ -686,33 +691,30 @@ function useQuote(params, options) {
686
691
  if (debounceRef.current) clearTimeout(debounceRef.current);
687
692
  };
688
693
  }, []);
689
- const fetchQuote = useCallback2(
690
- async () => {
691
- if (!params) return;
692
- try {
693
- setLoading(true);
694
- setWarning(null);
695
- const result = await getQuote(params);
696
- const serializeResult = serializeBigIntsToStrings(result);
697
- if (!mounted.current) return;
698
- setData((prev) => {
699
- if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
700
- return serializeResult;
701
- });
702
- setWarning(result.warning ?? null);
703
- setError(null);
704
- } catch (err) {
705
- if (err.name === "AbortError") return;
706
- console.error("[useQuote] fetch error:", err);
707
- if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
708
- } finally {
709
- if (mounted.current) setLoading(false);
710
- }
711
- },
712
- [params]
713
- );
714
- useEffect3(() => {
694
+ const fetchQuote = useCallback2(async () => {
715
695
  if (!params) return;
696
+ try {
697
+ setLoading(true);
698
+ setWarning(null);
699
+ const result = await getQuote(params);
700
+ const serializeResult = serializeBigIntsToStrings(result);
701
+ if (!mounted.current) return;
702
+ setData((prev) => {
703
+ if (JSON.stringify(prev) === JSON.stringify(serializeResult)) return prev;
704
+ return serializeResult;
705
+ });
706
+ setWarning(result.warning ?? null);
707
+ setError(null);
708
+ } catch (err) {
709
+ if (err.name === "AbortError") return;
710
+ console.error("[useQuote] fetch error:", err);
711
+ if (mounted.current) setError(err instanceof Error ? err : new Error(String(err)));
712
+ } finally {
713
+ if (mounted.current) setLoading(false);
714
+ }
715
+ }, [paramsKey]);
716
+ useEffect3(() => {
717
+ if (!paramsKey) return;
716
718
  if (debounceRef.current) clearTimeout(debounceRef.current);
717
719
  debounceRef.current = setTimeout(() => {
718
720
  fetchQuote();
@@ -721,19 +723,19 @@ function useQuote(params, options) {
721
723
  if (debounceRef.current) clearTimeout(debounceRef.current);
722
724
  abortRef.current?.abort();
723
725
  };
724
- }, [params, debounceMs, fetchQuote]);
726
+ }, [paramsKey, debounceMs, fetchQuote]);
725
727
  useEffect3(() => {
726
- if (!autoRefreshMs || !params) return;
728
+ if (!autoRefreshMs || !paramsKey) return;
727
729
  const interval = setInterval(() => fetchQuote(), autoRefreshMs);
728
730
  return () => clearInterval(interval);
729
- }, [autoRefreshMs, params, fetchQuote]);
731
+ }, [autoRefreshMs, paramsKey, fetchQuote]);
730
732
  return useMemo2(
731
733
  () => ({
732
734
  data,
733
735
  loading,
734
736
  error,
735
737
  warning,
736
- refetch: () => fetchQuote()
738
+ refetch: fetchQuote
737
739
  }),
738
740
  [data, loading, error, warning, fetchQuote]
739
741
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shogun-sdk/swap",
3
- "version": "0.0.2-test.4",
3
+ "version": "0.0.2-test.6",
4
4
  "type": "module",
5
5
  "description": "Shogun Network Swap utilities and helpers",
6
6
  "author": "Shogun Network",