@0xsquid/react-hooks 8.2.0 → 8.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.
Files changed (27) hide show
  1. package/dist/core/queries/queries-keys.d.ts +1 -1
  2. package/dist/core/types/config.d.ts +5 -1
  3. package/dist/core/types/event.d.ts +2 -1
  4. package/dist/core/types/route.d.ts +4 -0
  5. package/dist/hooks/transaction/useGetRoute.d.ts +6 -4
  6. package/dist/{index-CBCEbiL_.js → index-BYTPPn3v.js} +16 -9
  7. package/dist/index-BYTPPn3v.js.map +1 -0
  8. package/dist/{index-8l2o48hl.js → index-iLEj6QB2.js} +16 -9
  9. package/dist/index-iLEj6QB2.js.map +1 -0
  10. package/dist/{index.es-Cr0Cyn6l.js → index.es-BEOob50G.js} +2 -2
  11. package/dist/{index.es-Cr0Cyn6l.js.map → index.es-BEOob50G.js.map} +1 -1
  12. package/dist/{index.es-BluimAHt.js → index.es-Dng6NJoN.js} +2 -2
  13. package/dist/{index.es-BluimAHt.js.map → index.es-Dng6NJoN.js.map} +1 -1
  14. package/dist/index.esm.js +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/{secretService-DrLLHqjS.js → secretService-D-PXW1nB.js} +2 -2
  17. package/dist/{secretService-DrLLHqjS.js.map → secretService-D-PXW1nB.js.map} +1 -1
  18. package/dist/{secretService-DzyNkwb3.js → secretService-rdyT76TV.js} +2 -2
  19. package/dist/{secretService-DzyNkwb3.js.map → secretService-rdyT76TV.js.map} +1 -1
  20. package/dist/services/internal/eventService.d.ts +2 -1
  21. package/dist/{stellarService.client-cU1Vl8_G.js → stellarService.client-CTIU9xRo.js} +2 -2
  22. package/dist/{stellarService.client-cU1Vl8_G.js.map → stellarService.client-CTIU9xRo.js.map} +1 -1
  23. package/dist/{stellarService.client-BZTyfT7o.js → stellarService.client-kBgnFbAC.js} +2 -2
  24. package/dist/{stellarService.client-BZTyfT7o.js.map → stellarService.client-kBgnFbAC.js.map} +1 -1
  25. package/package.json +1 -1
  26. package/dist/index-8l2o48hl.js.map +0 -1
  27. package/dist/index-CBCEbiL_.js.map +0 -1
@@ -54,7 +54,7 @@ export declare const keys: () => {
54
54
  tokenData: (token?: TokenWithBalance) => (string | undefined)[];
55
55
  balance: (chainId?: number | string, tokenAddress?: string, userAddress?: string) => (string | number | undefined)[];
56
56
  allTokensBalance: (address: string | undefined, chainType: ChainType | undefined, direction?: SwapDirection) => (string | undefined)[];
57
- 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) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
57
+ 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)[];
58
58
  swapTransactionStatus: (transactionId: string | undefined) => (string | undefined)[];
59
59
  fiatToCryptoStatus: (transactionId?: string) => (string | undefined)[];
60
60
  sendTransactionStatus: (txHash: string | undefined, chainId: string | undefined) => (string | undefined)[];
@@ -1,4 +1,4 @@
1
- import { RouteRequest } from "@0xsquid/squid-types";
1
+ import { RouteRequest } from "./route";
2
2
  export type SlippageOption = RouteRequest["slippage"];
3
3
  export type TokenConfig = {
4
4
  address: string;
@@ -62,4 +62,8 @@ export interface AppConfig {
62
62
  degenMode?: boolean;
63
63
  preHook?: RouteRequest["preHook"];
64
64
  postHook?: RouteRequest["postHook"];
65
+ /**
66
+ * Override the default gas refund address in Axelar routes
67
+ */
68
+ overrideGasRefundAddress?: RouteRequest["overrideGasRefundAddress"];
65
69
  }
@@ -1,6 +1,7 @@
1
- import type { RouteRequest, RouteResponse } from "@0xsquid/squid-types";
1
+ import type { RouteResponse } from "@0xsquid/squid-types";
2
2
  import { TransactionErrorWithMessage } from "./error";
3
3
  import { ExecuteQuoteServer } from "./onramps";
4
+ import { RouteRequest } from "./route";
4
5
  type BaseSwapEventParams = Pick<RouteRequest, "fromAddress" | "toAddress" | "fromChain" | "toChain" | "fromToken" | "toToken" | "fromAmount">;
5
6
  type BaseSendTransactionEventParams = {
6
7
  fromAddress: string;
@@ -0,0 +1,4 @@
1
+ import { RouteRequest as SquidRouteRequest } from "@0xsquid/squid-types";
2
+ export type RouteRequest = SquidRouteRequest & {
3
+ overrideGasRefundAddress?: string;
4
+ };
@@ -1,9 +1,10 @@
1
- import { ChainType, RouteRequest, Token } from "@0xsquid/squid-types";
1
+ import { ChainType, Token } from "@0xsquid/squid-types";
2
2
  import type { AppConfig } from "../../core/types/config";
3
+ import { RouteRequest } from "../../core/types/route";
3
4
  export declare const useGetRoute: () => import("@tanstack/react-query").UseMutationResult<{
4
5
  estimate: import("@0xsquid/squid-types").Estimate;
5
6
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
6
- params: RouteRequest;
7
+ params: import("@0xsquid/squid-types").RouteRequest;
7
8
  quoteId: string;
8
9
  } | undefined, unknown, {
9
10
  fromChain: RouteRequest["fromChain"] | undefined;
@@ -18,6 +19,7 @@ export declare const useGetRoute: () => import("@tanstack/react-query").UseMutat
18
19
  fromChainType: ChainType | undefined;
19
20
  preHook: AppConfig["preHook"];
20
21
  postHook: AppConfig["postHook"];
22
+ overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"];
21
23
  }, unknown>;
22
24
  export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refetchOnWindowFocus, refetchIntervalInBackground, refetchInterval, quoteOnly, }: {
23
25
  enabled?: boolean | undefined;
@@ -31,7 +33,7 @@ export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refet
31
33
  squidRoute: import("@tanstack/react-query").UseQueryResult<{
32
34
  estimate: import("@0xsquid/squid-types").Estimate;
33
35
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
34
- params: RouteRequest;
36
+ params: import("@0xsquid/squid-types").RouteRequest;
35
37
  quoteId: string;
36
38
  } | undefined, unknown>;
37
39
  showLoading: boolean;
@@ -39,7 +41,7 @@ export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refet
39
41
  routeData: {
40
42
  estimate: import("@0xsquid/squid-types").Estimate;
41
43
  transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
42
- params: RouteRequest;
44
+ params: import("@0xsquid/squid-types").RouteRequest;
43
45
  quoteId: string;
44
46
  } | undefined;
45
47
  };
@@ -22281,7 +22281,7 @@ const keys = () => ({
22281
22281
  // ============
22282
22282
  // Transactions
22283
22283
  // ============
22284
- transaction: (fromChainId, toChainId, toTokenAddress, fromTokenAddress, price, slippage, getGasOnDestination, sourceUserAddress, degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChainType, preHook, postHook) => [
22284
+ transaction: (fromChainId, toChainId, toTokenAddress, fromTokenAddress, price, slippage, getGasOnDestination, sourceUserAddress, degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChainType, preHook, postHook, overrideGasRefundAddress) => [
22285
22285
  ...keys().transactions(),
22286
22286
  exports.QueryKeys.Transaction,
22287
22287
  fromChainId,
@@ -22299,6 +22299,7 @@ const keys = () => ({
22299
22299
  fromChainType,
22300
22300
  preHook,
22301
22301
  postHook,
22302
+ overrideGasRefundAddress,
22302
22303
  ],
22303
22304
  swapTransactionStatus: (transactionId) => [
22304
22305
  ...keys().transactions(),
@@ -22462,6 +22463,7 @@ const getConfigWithDefaults = (config) => {
22462
22463
  degenMode: get$2(config, "degenMode", defaultConfigValues.degenMode),
22463
22464
  preHook: get$2(config, "preHook", defaultConfigValues.preHook),
22464
22465
  postHook: get$2(config, "postHook", defaultConfigValues.postHook),
22466
+ overrideGasRefundAddress: get$2(config, "overrideGasRefundAddress", defaultConfigValues.overrideGasRefundAddress),
22465
22467
  };
22466
22468
  };
22467
22469
  const randomIntFromInterval = (min, max) => {
@@ -23151,7 +23153,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23151
23153
  };
23152
23154
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23153
23155
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23154
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-DrLLHqjS.js'); });
23156
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-D-PXW1nB.js'); });
23155
23157
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23156
23158
  };
23157
23159
  function getTokenAssetsKey(token) {
@@ -26435,7 +26437,7 @@ function useStellarWallets() {
26435
26437
  return;
26436
26438
  try {
26437
26439
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26438
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-cU1Vl8_G.js'); });
26440
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-CTIU9xRo.js'); });
26439
26441
  const modules = initializeAllModules();
26440
26442
  const promises = modules.map(async (module) => {
26441
26443
  const isAvailable = await module.isAvailable();
@@ -27935,7 +27937,7 @@ function hederaWalletConnect(parameters) {
27935
27937
  const optionalChains = config.chains.map((x) => x.id);
27936
27938
  if (!optionalChains.length)
27937
27939
  return;
27938
- const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-Cr0Cyn6l.js'); });
27940
+ const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-BEOob50G.js'); });
27939
27941
  const rawProvider = await EthereumProvider.init({
27940
27942
  ...restParameters,
27941
27943
  disableProviderPing: true,
@@ -32202,7 +32204,9 @@ const useApproval = ({ squidRoute, }) => {
32202
32204
  // This is to ensure we're using the latest expiry timestamp
32203
32205
  if (squidRoute) {
32204
32206
  queryClient.refetchQueries({
32205
- queryKey: keys().transaction(squidRoute.params.fromChain, squidRoute.params.toChain, squidRoute.params.toToken, squidRoute.params.fromToken, fromPrice, squidRoute.params.slippage, squidRoute.params.receiveGasOnDestination, squidRoute.params.fromAddress, squidRoute.params.bypassGuardrails, squidRoute.params.toAddress, squidRoute.params.fallbackAddresses?.[0]?.address, squidRoute.params.quoteOnly, getChainType(squidRoute.params.fromChain), squidRoute.params.preHook, squidRoute.params.postHook),
32207
+ queryKey: keys().transaction(squidRoute.params.fromChain, squidRoute.params.toChain, squidRoute.params.toToken, squidRoute.params.fromToken, fromPrice, squidRoute.params.slippage, squidRoute.params.receiveGasOnDestination, squidRoute.params.fromAddress, squidRoute.params.bypassGuardrails, squidRoute.params.toAddress, squidRoute.params.fallbackAddresses?.[0]?.address, squidRoute.params.quoteOnly, getChainType(squidRoute.params.fromChain), squidRoute.params.preHook, squidRoute.params.postHook,
32208
+ // TODO: update types
32209
+ squidRoute.params?.overrideGasRefundAddress),
32206
32210
  });
32207
32211
  }
32208
32212
  },
@@ -36003,7 +36007,7 @@ const useGetRoute = () => {
36003
36007
  * These data will be used to trigger the transaction
36004
36008
  * @returns {Route} Route data
36005
36009
  */
36006
- return reactQuery.useMutation(async ({ fromChain, toChain, fromToken, toToken, sourceUserAddress, destinationAddress, fromPrice, bypassGuardrails, quoteOnly, fromChainType, postHook, preHook, }) => {
36010
+ return reactQuery.useMutation(async ({ fromChain, toChain, fromToken, toToken, sourceUserAddress, destinationAddress, fromPrice, bypassGuardrails, quoteOnly, fromChainType, postHook, preHook, overrideGasRefundAddress, }) => {
36007
36011
  if (!fromChain || !toChain || !fromToken || !toToken || !fromPrice) {
36008
36012
  return undefined;
36009
36013
  }
@@ -36037,6 +36041,7 @@ const useGetRoute = () => {
36037
36041
  bypassGuardrails,
36038
36042
  preHook,
36039
36043
  postHook,
36044
+ overrideGasRefundAddress,
36040
36045
  };
36041
36046
  // If the swap is involving cosmos chains, we need to add the fallback addresses (if any)
36042
36047
  if (cosmosFallbackAddresses &&
@@ -36049,7 +36054,7 @@ const useGetRoute = () => {
36049
36054
  });
36050
36055
  // Cache the route data
36051
36056
  // Useful when the getRoute mutation is called from another hook
36052
- queryClient.setQueryData(keys().transaction(fromChain, toChain, toToken.address, fromToken.address, fromPrice, config.slippage, config.enableGetGasOnDestination, sourceUserAddress, config.degenMode, destinationAddress, swapRoute?.fallbackAddress, quoteOnly, fromChainType, config.preHook, config.postHook), route);
36057
+ queryClient.setQueryData(keys().transaction(fromChain, toChain, toToken.address, fromToken.address, fromPrice, config.slippage, config.enableGetGasOnDestination, sourceUserAddress, config.degenMode, destinationAddress, swapRoute?.fallbackAddress, quoteOnly, fromChainType, config.preHook, config.postHook, overrideGasRefundAddress), route);
36053
36058
  return route;
36054
36059
  });
36055
36060
  };
@@ -36072,7 +36077,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36072
36077
  const sourceUserAddress = isDepositAddressEnabled && isAvailableAsPaymentMethod
36073
36078
  ? depositRefundAddress ?? sourceConnectedAddress
36074
36079
  : sourceConnectedAddress;
36075
- const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromPrice, config.slippage, config.enableGetGasOnDestination, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook), [
36080
+ const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromPrice, config.slippage, config.enableGetGasOnDestination, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook, config.overrideGasRefundAddress), [
36076
36081
  fromChain?.chainId,
36077
36082
  toChain?.chainId,
36078
36083
  toToken?.address,
@@ -36088,6 +36093,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36088
36093
  fromChain?.chainType,
36089
36094
  config.preHook,
36090
36095
  config.postHook,
36096
+ config.overrideGasRefundAddress,
36091
36097
  ]);
36092
36098
  const queryEnabled = enabled != undefined
36093
36099
  ? enabled
@@ -36117,6 +36123,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36117
36123
  fromChainType: fromChain?.chainType,
36118
36124
  postHook: config.postHook,
36119
36125
  preHook: config.preHook,
36126
+ overrideGasRefundAddress: config.overrideGasRefundAddress,
36120
36127
  });
36121
36128
  return route;
36122
36129
  }, {
@@ -37040,4 +37047,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
37040
37047
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
37041
37048
  exports.walletIconBaseUrl = walletIconBaseUrl;
37042
37049
  exports.walletSupportsChainType = walletSupportsChainType;
37043
- //# sourceMappingURL=index-CBCEbiL_.js.map
37050
+ //# sourceMappingURL=index-BYTPPn3v.js.map