@0xsquid/react-hooks 8.5.1-beta-stellar-tempo.0 → 8.6.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 (47) hide show
  1. package/dist/core/constants.d.ts +0 -3
  2. package/dist/core/externalLinks.d.ts +1 -1
  3. package/dist/core/queries/queries-keys.d.ts +1 -1
  4. package/dist/core/types/config.d.ts +10 -2
  5. package/dist/core/types/event.d.ts +4 -0
  6. package/dist/hooks/index.d.ts +2 -1
  7. package/dist/hooks/swap/useUrlSwapParams.d.ts +10 -0
  8. package/dist/hooks/transaction/send/useEstimateSendTransactionGas.d.ts +2 -10
  9. package/dist/hooks/transaction/useEstimate.d.ts +12 -7
  10. package/dist/hooks/user/useUserParams.d.ts +4 -0
  11. package/dist/{index-BSX11dad.js → index-BvAot66c.js} +317 -298
  12. package/dist/index-BvAot66c.js.map +1 -0
  13. package/dist/{index-XR8ODWxH.js → index-Ck3Byj7H.js} +313 -298
  14. package/dist/index-Ck3Byj7H.js.map +1 -0
  15. package/dist/{index.es-CczeKjuj.js → index.es-83oSJcJe.js} +2 -2
  16. package/dist/{index.es-CczeKjuj.js.map → index.es-83oSJcJe.js.map} +1 -1
  17. package/dist/{index.es-CkrP1GZJ.js → index.es-C_BgGjLx.js} +2 -2
  18. package/dist/{index.es-CkrP1GZJ.js.map → index.es-C_BgGjLx.js.map} +1 -1
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.js +6 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/{secretService-ChCrHmS3.js → secretService-Cj_HK_on.js} +2 -2
  23. package/dist/{secretService-ChCrHmS3.js.map → secretService-Cj_HK_on.js.map} +1 -1
  24. package/dist/{secretService-ScgDU3bX.js → secretService-zFFQM-jC.js} +2 -2
  25. package/dist/{secretService-ScgDU3bX.js.map → secretService-zFFQM-jC.js.map} +1 -1
  26. package/dist/server.d.ts +1 -0
  27. package/dist/server.esm.js +100 -0
  28. package/dist/server.esm.js.map +1 -0
  29. package/dist/server.js +111 -0
  30. package/dist/server.js.map +1 -0
  31. package/dist/services/index.d.ts +1 -0
  32. package/dist/services/internal/assetsService.d.ts +2 -2
  33. package/dist/services/internal/configService.d.ts +2 -1
  34. package/dist/services/internal/estimateService.d.ts +28 -15
  35. package/dist/services/internal/eventService.d.ts +4 -0
  36. package/dist/services/internal/urlParamsService.d.ts +19 -0
  37. package/dist/{stellarService.client-D65n-wCV.js → stellarService.client-CBzr6pLs.js} +2 -2
  38. package/dist/{stellarService.client-D65n-wCV.js.map → stellarService.client-CBzr6pLs.js.map} +1 -1
  39. package/dist/{stellarService.client-BaDOSK8x.js → stellarService.client-CI86BfjV.js} +2 -2
  40. package/dist/{stellarService.client-BaDOSK8x.js.map → stellarService.client-CI86BfjV.js.map} +1 -1
  41. package/dist/tests/urlParamsService.test.d.ts +1 -0
  42. package/package.json +13 -1
  43. package/dist/hooks/tokens/useSourceChainGasToken.d.ts +0 -10
  44. package/dist/hooks/transaction/useTempoFeeCheck.d.ts +0 -11
  45. package/dist/index-BSX11dad.js.map +0 -1
  46. package/dist/index-XR8ODWxH.js.map +0 -1
  47. package/dist/services/internal/tempoService.d.ts +0 -38
@@ -69,9 +69,6 @@ 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";
75
72
  readonly BITCOIN: "bitcoin";
76
73
  readonly SOLANA: "solana-mainnet-beta";
77
74
  readonly SUI: "sui-mainnet";
@@ -1 +1 @@
1
- export declare const squidApiBaseUrl = "https://api.uatsquidrouter.com";
1
+ export declare const squidApiBaseUrl = "https://v2.api.squidrouter.com";
@@ -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, 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, 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)[];
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)[];
@@ -4,9 +4,17 @@ export type TokenConfig = {
4
4
  address: string;
5
5
  chainId: string;
6
6
  };
7
+ export type NamedTokenConfig = {
8
+ networkName: string;
9
+ /**
10
+ * When omitted, a default token will be selected automatically
11
+ */
12
+ symbol?: string;
13
+ };
7
14
  export interface AppConfig {
8
15
  integratorId: string;
9
16
  slippage?: SlippageOption;
17
+ enableGetGasOnDestination?: boolean;
10
18
  /**
11
19
  * If set to true, will load initial tokens and chains from local storage
12
20
  */
@@ -22,8 +30,8 @@ export interface AppConfig {
22
30
  * If {@link loadPreviousStateFromLocalStorage} is set to true, this will be ignored
23
31
  */
24
32
  initialAssets?: {
25
- from?: TokenConfig;
26
- to?: TokenConfig;
33
+ from?: TokenConfig | NamedTokenConfig;
34
+ to?: TokenConfig | NamedTokenConfig;
27
35
  };
28
36
  /**
29
37
  * When chains are changed, this allows to choose the first token that will be selected
@@ -36,6 +36,10 @@ export interface WidgetEventMap {
36
36
  toChainId?: string;
37
37
  fromTokenAddress?: string;
38
38
  toTokenAddress?: string;
39
+ fromNetworkName?: string;
40
+ toNetworkName?: string;
41
+ fromTokenSymbol?: string;
42
+ toTokenSymbol?: string;
39
43
  };
40
44
  swapTxSignatureRequested: {
41
45
  route: RouteResponse["route"];
@@ -20,6 +20,7 @@ export { ConnectingWalletStatus, useWalletStore } from "./store/useWalletStore";
20
20
  export type { ConnectingWalletState } from "./store/useWalletStore";
21
21
  export { useDepositAddress } from "./swap/useDepositAddress";
22
22
  export { useSwap } from "./swap/useSwap";
23
+ export { buildUrlSearchParamsFromSwapEvent, parseInitialAssetsFromUrl, useUrlSwapParams, } from "./swap/useUrlSwapParams";
23
24
  export { useAllConnectedWalletBalances } from "./tokens/useAllConnectedWalletBalances";
24
25
  export { useAllTokensWithBalanceForChainType } from "./tokens/useAllTokensWithBalanceForChainType";
25
26
  export { useCosmosBalance, useEvmBalance } from "./tokens/useBalance";
@@ -28,7 +29,6 @@ export { useMultipleTokenPrices } from "./tokens/useMultipleTokenPrices";
28
29
  export { useBitcoinNativeBalance, useCosmosNativeBalance, useEvmNativeBalance, useNativeBalance, useSolanaNativeBalance, useStellarNativeBalance, useSuiNativeBalance, useXrplNativeBalance, } from "./tokens/useNativeBalance";
29
30
  export { useNativeTokenForChain } from "./tokens/useNativeTokenForChain";
30
31
  export { useSingleTokenPrice } from "./tokens/useSingleTokenPrice";
31
- export { useSourceChainGasToken } from "./tokens/useSourceChainGasToken";
32
32
  export { useSquidTokens } from "./tokens/useSquidTokens";
33
33
  export { useHistoricalData, useTokensData, } from "./tokens/useTokenHistoricalData";
34
34
  export { useEstimateSendTransaction } from "./transaction/send/useEstimateSendTransactionGas";
@@ -45,6 +45,7 @@ export { useSendTransactionStatus } from "./transaction/useSendTransactionStatus
45
45
  export { useSwapTransactionStatus } from "./transaction/useSwapTransactionStatus";
46
46
  export { useAvatar } from "./user/useAvatar";
47
47
  export { useHistory } from "./user/useHistory";
48
+ export { useUserParams } from "./user/useUserParams";
48
49
  export { useDebouncedValue } from "./utils/useUtils";
49
50
  export { useAddToken } from "./wallet/useAddToken";
50
51
  export { useAutoConnect } from "./wallet/useAutoConnect";
@@ -0,0 +1,10 @@
1
+ import type { AppConfig } from "../../core/types/config";
2
+ import { buildUrlSearchParamsFromSwapEvent, parseInitialAssetsFromUrl } from "../../services/internal/urlParamsService";
3
+ export { buildUrlSearchParamsFromSwapEvent, parseInitialAssetsFromUrl };
4
+ /**
5
+ * Reads initial swap assets from URL params on mount, and keeps the URL in
6
+ * sync with swap param changes emitted by the widget.
7
+ */
8
+ export declare const useUrlSwapParams: () => {
9
+ initialAssets: AppConfig["initialAssets"];
10
+ };
@@ -6,9 +6,9 @@ interface UseEstimateSendReturnType {
6
6
  estimatedGas: bigint | undefined;
7
7
  isLoading: boolean;
8
8
  /**
9
- * Whether the gas token balance is enough to pay for the network gas fees
9
+ * Whether the native balance is enough to pay for the network gas fees
10
10
  */
11
- isGasBalanceEnough: boolean;
11
+ isNativeBalanceEnoughToPayGasFees: boolean;
12
12
  /**
13
13
  * Whether the balance of the selected token is enough to send the requested `amount`.
14
14
  */
@@ -17,14 +17,6 @@ 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
- tokenPaysNetworkFee: boolean;
24
- /**
25
- * TODO: add description
26
- */
27
- gasBalanceNeeded: string | undefined;
28
20
  }
29
21
  export declare function useEstimateSendTransaction({ chain, token, amount, balance, from, }: {
30
22
  chain: ChainData | undefined;
@@ -5,20 +5,25 @@ type FeeFormatted = {
5
5
  imageUrl: string;
6
6
  };
7
7
  export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
8
- fromBalanceFormatted: string;
8
+ balanceFormatted: 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
- fromBalanceEnoughToSwap: boolean;
15
+ proposedGasDestinationAmount: {
16
+ value: number;
17
+ currency: string | undefined;
18
+ };
19
+ enoughBalanceToSwap: boolean;
16
20
  feeCostsFormatted: FeeFormatted[];
17
21
  totalFeeCostsUsd: string;
18
- gasToken: import("../..").Token | undefined;
19
- fromToken: import("@0xsquid/squid-types").Token | undefined;
22
+ fromToken: any;
20
23
  fromAmount: string | undefined;
21
24
  fromAmountFormatted: string;
25
+ sourceChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
26
+ destChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
22
27
  toAmountUSD: string | undefined;
23
28
  exchangeRate: string;
24
29
  toAmountMinUSD: string;
@@ -33,14 +38,14 @@ export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
33
38
  expectedGasRefundCost: bigint;
34
39
  expectedGasRefundCostUSD: string;
35
40
  sameTokenBetweenFees: boolean;
36
- fromTokenPaysNetworkFee: boolean;
41
+ isFromTokenNative: boolean;
37
42
  totalNativeFees: bigint;
38
- gasBalanceEnough: boolean;
43
+ totalFeesInNativeTokenPlusRatio: bigint;
44
+ fromBalanceEnoughToSwap: boolean;
39
45
  minAmountValueWarnMsg: string | undefined;
40
46
  estimatedRouteDuration: {
41
47
  seconds: number;
42
48
  format: (sTemplate?: string | undefined, mTemplate?: string | undefined, hTemplate?: string | undefined) => string;
43
49
  };
44
- gasBalanceNeeded: string | undefined;
45
50
  };
46
51
  export {};
@@ -0,0 +1,4 @@
1
+ export declare const useUserParams: () => {
2
+ gasEnabled: boolean | undefined;
3
+ getGasOnDestSupportedForThisRoute: boolean | undefined;
4
+ };