@0xsquid/react-hooks 8.6.1 → 8.7.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.
Files changed (37) hide show
  1. package/dist/core/constants.d.ts +3 -0
  2. package/dist/core/queries/queries-keys.d.ts +1 -1
  3. package/dist/core/types/config.d.ts +0 -1
  4. package/dist/hooks/index.d.ts +1 -1
  5. package/dist/hooks/tokens/useSourceChainGasToken.d.ts +13 -0
  6. package/dist/hooks/transaction/send/useEstimateSendTransactionGas.d.ts +11 -2
  7. package/dist/hooks/transaction/useEstimate.d.ts +7 -12
  8. package/dist/hooks/transaction/useTempoFeeCheck.d.ts +11 -0
  9. package/dist/{index-uxBoqobR.js → index-BOMoTOCH.js} +279 -155
  10. package/dist/index-BOMoTOCH.js.map +1 -0
  11. package/dist/{index--gt66OVO.js → index-CpHc3uRR.js} +279 -155
  12. package/dist/index-CpHc3uRR.js.map +1 -0
  13. package/dist/{index.es-DXYyLkwM.js → index.es-Bx1b09ob.js} +2 -2
  14. package/dist/{index.es-DXYyLkwM.js.map → index.es-Bx1b09ob.js.map} +1 -1
  15. package/dist/{index.es-zgttb4RJ.js → index.es-DYEb3pTJ.js} +2 -2
  16. package/dist/{index.es-zgttb4RJ.js.map → index.es-DYEb3pTJ.js.map} +1 -1
  17. package/dist/index.esm.js +1 -1
  18. package/dist/index.js +2 -2
  19. package/dist/{secretService-C3pLXo0u.js → secretService-0Y9Bj_Ic.js} +2 -2
  20. package/dist/{secretService-C3pLXo0u.js.map → secretService-0Y9Bj_Ic.js.map} +1 -1
  21. package/dist/{secretService-BoIRJAyQ.js → secretService-DnKMq9Ib.js} +2 -2
  22. package/dist/{secretService-BoIRJAyQ.js.map → secretService-DnKMq9Ib.js.map} +1 -1
  23. package/dist/server.esm.js +3 -0
  24. package/dist/server.esm.js.map +1 -1
  25. package/dist/server.js +3 -0
  26. package/dist/server.js.map +1 -1
  27. package/dist/services/internal/assetsService.d.ts +2 -2
  28. package/dist/services/internal/estimateService.d.ts +15 -28
  29. package/dist/services/internal/tempoService.d.ts +42 -0
  30. package/dist/{stellarService.client-DYLHIsR1.js → stellarService.client-B3kAxROD.js} +2 -2
  31. package/dist/{stellarService.client-DYLHIsR1.js.map → stellarService.client-B3kAxROD.js.map} +1 -1
  32. package/dist/{stellarService.client-8vhPwFQb.js → stellarService.client-Dyichswq.js} +2 -2
  33. package/dist/{stellarService.client-8vhPwFQb.js.map → stellarService.client-Dyichswq.js.map} +1 -1
  34. package/package.json +1 -1
  35. package/dist/hooks/user/useUserParams.d.ts +0 -4
  36. package/dist/index--gt66OVO.js.map +0 -1
  37. package/dist/index-uxBoqobR.js.map +0 -1
@@ -69,6 +69,9 @@ export declare const CHAIN_IDS: {
69
69
  readonly SONEIUM: "1868";
70
70
  readonly PEAQ: "3338";
71
71
  readonly HEDERA: "295";
72
+ readonly MANTRA: "5888";
73
+ readonly CITREA: "4114";
74
+ readonly TEMPO: "4217";
72
75
  readonly BITCOIN: "bitcoin";
73
76
  readonly SOLANA: "solana-mainnet-beta";
74
77
  readonly SUI: "sui-mainnet";
@@ -56,7 +56,7 @@ export declare const keys: () => {
56
56
  tokenData: (token?: TokenWithBalance) => (string | undefined)[];
57
57
  balance: (chainId?: number | string, tokenAddress?: string, userAddress?: string) => (string | number | undefined)[];
58
58
  allTokensBalance: (address: string | undefined, chainType: ChainType | undefined, direction?: SwapDirection) => (string | undefined)[];
59
- transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, price: string | undefined, slippage: SlippageOption | undefined, getGasOnDestination: boolean | undefined, sourceUserAddress: string | undefined, degenMode: boolean | undefined, destinationAddress: string | undefined, fallbackAddress: string | undefined, quoteOnly: boolean | undefined, fromChainType: ChainType | undefined, preHook: AppConfig["preHook"] | undefined, postHook: AppConfig["postHook"] | undefined, overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"] | undefined) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
59
+ transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, price: string | undefined, slippage: SlippageOption | undefined, sourceUserAddress: string | undefined, degenMode: boolean | undefined, destinationAddress: string | undefined, fallbackAddress: string | undefined, quoteOnly: boolean | undefined, fromChainType: ChainType | undefined, preHook: AppConfig["preHook"] | undefined, postHook: AppConfig["postHook"] | undefined, overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"] | undefined) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
60
60
  swapTransactionStatus: (transactionId: string | undefined) => (string | undefined)[];
61
61
  fiatToCryptoStatus: (transactionId?: string) => (string | undefined)[];
62
62
  sendTransactionStatus: (txHash: string | undefined, chainId: string | undefined) => (string | undefined)[];
@@ -14,7 +14,6 @@ export type NamedTokenConfig = {
14
14
  export interface AppConfig {
15
15
  integratorId: string;
16
16
  slippage?: SlippageOption;
17
- enableGetGasOnDestination?: boolean;
18
17
  /**
19
18
  * If set to true, will load initial tokens and chains from local storage
20
19
  */
@@ -29,6 +29,7 @@ export { useMultipleTokenPrices } from "./tokens/useMultipleTokenPrices";
29
29
  export { useBitcoinNativeBalance, useCosmosNativeBalance, useEvmNativeBalance, useNativeBalance, useSolanaNativeBalance, useStellarNativeBalance, useSuiNativeBalance, useXrplNativeBalance, } from "./tokens/useNativeBalance";
30
30
  export { useNativeTokenForChain } from "./tokens/useNativeTokenForChain";
31
31
  export { useSingleTokenPrice } from "./tokens/useSingleTokenPrice";
32
+ export { useSourceChainGasToken } from "./tokens/useSourceChainGasToken";
32
33
  export { useSquidTokens } from "./tokens/useSquidTokens";
33
34
  export { useHistoricalData, useTokensData, } from "./tokens/useTokenHistoricalData";
34
35
  export { useEstimateSendTransaction } from "./transaction/send/useEstimateSendTransactionGas";
@@ -45,7 +46,6 @@ export { useSendTransactionStatus } from "./transaction/useSendTransactionStatus
45
46
  export { useSwapTransactionStatus } from "./transaction/useSwapTransactionStatus";
46
47
  export { useAvatar } from "./user/useAvatar";
47
48
  export { useHistory } from "./user/useHistory";
48
- export { useUserParams } from "./user/useUserParams";
49
49
  export { useDebouncedValue } from "./utils/useUtils";
50
50
  export { useAddToken } from "./wallet/useAddToken";
51
51
  export { useAutoConnect } from "./wallet/useAutoConnect";
@@ -0,0 +1,13 @@
1
+ import { ChainData } from "@0xsquid/squid-types";
2
+ import { Token } from "../../core";
3
+ import { ChainFeeParams } from "../../services/internal/tempoService";
4
+ /**
5
+ * Hook that returns the gas token and chain fee params for a given source chain and token.
6
+ */
7
+ export declare function useSourceChainGasToken({ fromChain, fromToken, }: {
8
+ fromChain: ChainData | undefined;
9
+ fromToken: Token | undefined;
10
+ }): {
11
+ gasToken: Token | undefined;
12
+ chainFeeParams: ChainFeeParams | null;
13
+ };
@@ -6,9 +6,9 @@ interface UseEstimateSendReturnType {
6
6
  estimatedGas: bigint | undefined;
7
7
  isLoading: boolean;
8
8
  /**
9
- * Whether the native balance is enough to pay for the network gas fees
9
+ * Whether the gas token balance is enough to pay for the network gas fees
10
10
  */
11
- isNativeBalanceEnoughToPayGasFees: boolean;
11
+ isGasBalanceEnough: boolean;
12
12
  /**
13
13
  * Whether the balance of the selected token is enough to send the requested `amount`.
14
14
  */
@@ -17,6 +17,15 @@ interface UseEstimateSendReturnType {
17
17
  * The safe amount the user can send to have enough balance to pay for the network gas fees
18
18
  */
19
19
  minAmountValueWarnMsg: string | undefined;
20
+ /**
21
+ * Whether the selected token pays the network fee
22
+ */
23
+ tokenPaysGasFees: boolean;
24
+ /**
25
+ * The balance of the gas token needed
26
+ * including source amount if the source token is the gas token
27
+ */
28
+ gasBalanceNeeded: string | undefined;
20
29
  }
21
30
  export declare function useEstimateSendTransaction({ chain, token, amount, balance, from, }: {
22
31
  chain: ChainData | undefined;
@@ -5,25 +5,20 @@ type FeeFormatted = {
5
5
  imageUrl: string;
6
6
  };
7
7
  export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
8
- balanceFormatted: string;
8
+ fromBalanceFormatted: string;
9
9
  slippageFormatted: string;
10
10
  totalWithRefundEstimate: {
11
11
  totalAmount: string;
12
12
  totalAmountUSD: number;
13
13
  feeToken: import("@0xsquid/squid-types").Token | undefined;
14
14
  };
15
- proposedGasDestinationAmount: {
16
- value: number;
17
- currency: string | undefined;
18
- };
19
- enoughBalanceToSwap: boolean;
15
+ fromBalanceEnoughToSwap: boolean;
20
16
  feeCostsFormatted: FeeFormatted[];
21
17
  totalFeeCostsUsd: string;
22
- fromToken: any;
18
+ gasToken: import("../..").Token | undefined;
19
+ fromToken: import("@0xsquid/squid-types").Token | undefined;
23
20
  fromAmount: string | undefined;
24
21
  fromAmountFormatted: string;
25
- sourceChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
26
- destChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
27
22
  toAmountUSD: string | undefined;
28
23
  exchangeRate: string;
29
24
  toAmountMinUSD: string;
@@ -38,14 +33,14 @@ export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
38
33
  expectedGasRefundCost: bigint;
39
34
  expectedGasRefundCostUSD: string;
40
35
  sameTokenBetweenFees: boolean;
41
- isFromTokenNative: boolean;
36
+ fromTokenPaysGasFees: boolean;
42
37
  totalNativeFees: bigint;
43
- totalFeesInNativeTokenPlusRatio: bigint;
44
- fromBalanceEnoughToSwap: boolean;
38
+ isGasBalanceEnough: boolean;
45
39
  minAmountValueWarnMsg: string | undefined;
46
40
  estimatedRouteDuration: {
47
41
  seconds: number;
48
42
  format: (sTemplate?: string | undefined, mTemplate?: string | undefined, hTemplate?: string | undefined) => string;
49
43
  };
44
+ gasBalanceNeeded: string | undefined;
50
45
  };
51
46
  export {};
@@ -0,0 +1,11 @@
1
+ import { ChainData } from "@0xsquid/squid-types";
2
+ import { Token } from "../../core/types";
3
+ import { TempoFeeData } from "../../services/internal/tempoService";
4
+ /**
5
+ * Returns raw on-chain gas token data for Tempo chains, or null when the source
6
+ * chain is not Tempo.
7
+ */
8
+ export declare const useTempoFeeCheck: ({ fromChain, fromToken, }: {
9
+ fromChain: ChainData | undefined;
10
+ fromToken: Token | undefined;
11
+ }) => TempoFeeData | null;