@0xsquid/react-hooks 8.0.4-bump-stellar-sdk-beta.0 → 8.0.5

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.
@@ -22069,6 +22069,7 @@ const simplifyRouteAction = (action) => {
22069
22069
  data: {
22070
22070
  type: action.data?.type,
22071
22071
  },
22072
+ ...(action.coralV2Order ? { isCoralV2: true } : undefined),
22072
22073
  };
22073
22074
  };
22074
22075
  const fetchSwapTransactionStatus = async ({ transaction, integratorId, apiUrl, }) => {
@@ -22269,7 +22270,7 @@ const keys = () => ({
22269
22270
  // ============
22270
22271
  // Approval
22271
22272
  // ============
22272
- routeApproved: (routeData, allowanceInWei) => [
22273
+ routeApproved: (routeData, allowanceInWei, approvalType) => [
22273
22274
  ...keys().transactions(),
22274
22275
  QueryKeys.RouteApproved,
22275
22276
  routeData?.params.fromAddress,
@@ -22277,6 +22278,7 @@ const keys = () => ({
22277
22278
  routeData?.params.fromToken,
22278
22279
  routeData?.params.fromAmount,
22279
22280
  allowanceInWei?.toString(),
22281
+ approvalType,
22280
22282
  ],
22281
22283
  sendTransactionGas: (chainId, tokenAddress, from) => [
22282
22284
  QueryKeys.All,
@@ -23083,7 +23085,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23083
23085
  };
23084
23086
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23085
23087
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23086
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-BERsQNwk.js'); });
23088
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-CIyWIixx.js'); });
23087
23089
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23088
23090
  };
23089
23091
  function getTokenAssetsKey(token) {
@@ -26259,7 +26261,7 @@ function useStellarWallets() {
26259
26261
  return;
26260
26262
  try {
26261
26263
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26262
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-BJDLgeHd.js'); });
26264
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-K2_2eYYZ.js'); });
26263
26265
  const modules = initializeAllModules();
26264
26266
  const promises = modules.map(async (module) => {
26265
26267
  const isAvailable = await module.isAvailable();
@@ -31620,8 +31622,26 @@ const useApproval = ({ squidRoute, }) => {
31620
31622
  const isSrcChainEvmos = isEvmosChain(fromChain);
31621
31623
  const isSagaSameChainSwap = isSameChain &&
31622
31624
  fromChain?.chainId.toString() === CHAIN_IDS.SAGA_EVM.toString();
31623
- // Use ICS20 for Evmos chains, except for SAGA same chain swaps
31624
- const useIcs20 = isSrcChainEvmos && !isSagaSameChainSwap;
31625
+ const approvalType = React.useMemo(() => {
31626
+ if (squidRoute?.transactionRequest?.type ===
31627
+ squidTypes.SquidDataType.DepositAddressCalldata) {
31628
+ // No approvals needed for deposit address calls
31629
+ return null;
31630
+ }
31631
+ if (isSrcChainEvmos && !isSagaSameChainSwap) {
31632
+ // Use ICS20 for Evmos chains, except for SagaEVM same-chain swaps
31633
+ return "ics20";
31634
+ }
31635
+ else {
31636
+ return "erc20";
31637
+ }
31638
+ }, [
31639
+ isSagaSameChainSwap,
31640
+ isSrcChainEvmos,
31641
+ squidRoute?.transactionRequest?.type,
31642
+ ]);
31643
+ const useIcs20 = approvalType === "ics20";
31644
+ const useErc20 = approvalType === "erc20";
31625
31645
  const { hasAllowance: hasErc20Allowance, query: erc20AllowanceQuery, allowanceInWei: erc20AllowanceInWei, } = useErc20Allowance({
31626
31646
  tokenAddress: fromToken?.address,
31627
31647
  ownerAddress: sourceUserAddress,
@@ -31629,7 +31649,7 @@ const useApproval = ({ squidRoute, }) => {
31629
31649
  ?.target,
31630
31650
  amount: BigInt(squidRoute?.params.fromAmount ?? "0"),
31631
31651
  chainId: Number(fromChain?.chainId),
31632
- enabled: !useIcs20,
31652
+ enabled: useErc20,
31633
31653
  });
31634
31654
  const { hasAllowance: hasIcs20Allowance, query: ics20AllowanceQuery, allowanceInWei: ics20AllowanceInWei, } = useIcs20Allowance({
31635
31655
  ownerAddress: sourceUserAddress,
@@ -31648,7 +31668,10 @@ const useApproval = ({ squidRoute, }) => {
31648
31668
  * On Error: Showing the error message if any
31649
31669
  * @returns {boolean} approved
31650
31670
  */
31651
- const routeApproved = reactQuery.useQuery(keys().routeApproved(squidRoute, allowanceInWei), async () => {
31671
+ const routeApproved = reactQuery.useQuery(keys().routeApproved(squidRoute, allowanceInWei, approvalType), async () => {
31672
+ if (approvalType === null) {
31673
+ return true;
31674
+ }
31652
31675
  // Approval is only needed for EVM chains
31653
31676
  if (getChainType(squidRoute?.params.fromChain) === squidTypes.ChainType.EVM) {
31654
31677
  return hasAllowance;
@@ -31657,8 +31680,8 @@ const useApproval = ({ squidRoute, }) => {
31657
31680
  }, {
31658
31681
  enabled: !!squidRoute &&
31659
31682
  !!sourceUserAddress &&
31660
- !allowanceQuery?.isLoading &&
31661
- allowanceQuery?.isFetched,
31683
+ ((!allowanceQuery?.isLoading && allowanceQuery?.isFetched) ||
31684
+ approvalType === null),
31662
31685
  });
31663
31686
  // USDT has a very specific way of handling approvals
31664
31687
  // ```
@@ -31748,6 +31771,9 @@ const useApproval = ({ squidRoute, }) => {
31748
31771
  */
31749
31772
  const approveRoute = reactQuery.useMutation(async () => {
31750
31773
  try {
31774
+ if (approvalType === null) {
31775
+ return true;
31776
+ }
31751
31777
  if (fromToken?.address === nativeEvmTokenAddress) {
31752
31778
  return true;
31753
31779
  }
@@ -36650,4 +36676,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
36650
36676
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
36651
36677
  exports.walletIconBaseUrl = walletIconBaseUrl;
36652
36678
  exports.walletSupportsChainType = walletSupportsChainType;
36653
- //# sourceMappingURL=index-BJ-G_e4C.js.map
36679
+ //# sourceMappingURL=index-fCnKL8wD.js.map