@0xsquid/react-hooks 8.0.3 → 8.0.4
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/queries/queries-keys.d.ts +2 -1
- package/dist/core/types/evm.d.ts +1 -0
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/transaction.d.ts +2 -0
- package/dist/{index-9N9n5ehH.js → index-B402hKhN.js} +36 -10
- package/dist/index-B402hKhN.js.map +1 -0
- package/dist/{index-BJ-G_e4C.js → index-fCnKL8wD.js} +36 -10
- package/dist/index-fCnKL8wD.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{secretService-BERsQNwk.js → secretService-CIyWIixx.js} +2 -2
- package/dist/{secretService-BERsQNwk.js.map → secretService-CIyWIixx.js.map} +1 -1
- package/dist/{secretService--_FnkdCU.js → secretService-CV_qKM-f.js} +2 -2
- package/dist/{secretService--_FnkdCU.js.map → secretService-CV_qKM-f.js.map} +1 -1
- package/dist/{stellarService.client-DjyLRqu2.js → stellarService.client-BK4en2TV.js} +2 -2
- package/dist/{stellarService.client-DjyLRqu2.js.map → stellarService.client-BK4en2TV.js.map} +1 -1
- package/dist/{stellarService.client-BJDLgeHd.js → stellarService.client-K2_2eYYZ.js} +2 -2
- package/dist/{stellarService.client-BJDLgeHd.js.map → stellarService.client-K2_2eYYZ.js.map} +1 -1
- package/package.json +3 -3
- package/dist/index-9N9n5ehH.js.map +0 -1
- package/dist/index-BJ-G_e4C.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChainType, RouteResponse } from "@0xsquid/squid-types";
|
|
2
2
|
import { HistoryTransaction } from "../../core/types/history";
|
|
3
3
|
import { AppConfig, SlippageOption } from "../types/config";
|
|
4
|
+
import { ApprovalType } from "../types/evm";
|
|
4
5
|
import { SwapDirection } from "../types/swap";
|
|
5
6
|
import { Timeframe, TokenWithBalance } from "../types/tokens";
|
|
6
7
|
export declare enum QueryKeys {
|
|
@@ -56,7 +57,7 @@ export declare const keys: () => {
|
|
|
56
57
|
fiatToCryptoStatus: (transactionId?: string) => (string | undefined)[];
|
|
57
58
|
sendTransactionStatus: (txHash: string | undefined, chainId: string | undefined) => (string | undefined)[];
|
|
58
59
|
allTransactionsStatus: (transactions: HistoryTransaction[] | undefined) => string[];
|
|
59
|
-
routeApproved: (routeData: RouteResponse["route"] | undefined, allowanceInWei: bigint | undefined) => (string | undefined)[];
|
|
60
|
+
routeApproved: (routeData: RouteResponse["route"] | undefined, allowanceInWei: bigint | undefined, approvalType: ApprovalType | null) => (string | null | undefined)[];
|
|
60
61
|
sendTransactionGas: (chainId: string | undefined, tokenAddress: string | undefined, from: string | undefined) => (string | undefined)[];
|
|
61
62
|
ensData: (address?: string) => (string | undefined)[];
|
|
62
63
|
ensSearch: (query?: string) => (string | undefined)[];
|
package/dist/core/types/evm.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ export * from "./history";
|
|
|
5
5
|
export type * from "./onramps/";
|
|
6
6
|
export type { SwapParams } from "./swap";
|
|
7
7
|
export type { Chain, Token } from "./tokens";
|
|
8
|
-
export { AxelarStatusResponseType, SendTransactionStatus, TransactionStatus, type TransactionParams, } from "./transaction";
|
|
8
|
+
export { AxelarStatusResponseType, SendTransactionStatus, TransactionStatus, type PatchedRouteActionResponse, type TransactionParams, } from "./transaction";
|
|
9
9
|
export type { AddressWithEns, BitcoinWallet, ConnectorID, CosmosWallet, EnsData, EnsSearchResult, FullAddressData, NetworkConfig, SolanaWallet, SupportedChain, Wallet, } from "./wallet";
|
|
10
10
|
export { XamanXrplNetwork } from "./xrpl";
|
|
@@ -67,8 +67,10 @@ export interface StepStatusGetterProps {
|
|
|
67
67
|
}
|
|
68
68
|
export interface PatchedRouteActionResponse extends Omit<RouteActionResponse, "data"> {
|
|
69
69
|
data?: RouteActionResponse["data"];
|
|
70
|
+
coralV2Order?: Record<string, never>;
|
|
70
71
|
}
|
|
71
72
|
export type SwapTransactionForStatus = Pick<SwapTransactionHistory, "fromChain" | "transactionId" | "toChain" | "status" | "fromAddress" | "bridgeType" | "transactionIdForStatus" | "actions" | "quoteId">;
|
|
72
73
|
export type SimplifiedRouteAction = Pick<PatchedRouteActionResponse, "type" | "provider"> & {
|
|
73
74
|
data?: any;
|
|
75
|
+
isCoralV2?: boolean;
|
|
74
76
|
};
|
|
@@ -22048,6 +22048,7 @@ const simplifyRouteAction = (action) => {
|
|
|
22048
22048
|
data: {
|
|
22049
22049
|
type: action.data?.type,
|
|
22050
22050
|
},
|
|
22051
|
+
...(action.coralV2Order ? { isCoralV2: true } : undefined),
|
|
22051
22052
|
};
|
|
22052
22053
|
};
|
|
22053
22054
|
const fetchSwapTransactionStatus = async ({ transaction, integratorId, apiUrl, }) => {
|
|
@@ -22248,7 +22249,7 @@ const keys = () => ({
|
|
|
22248
22249
|
// ============
|
|
22249
22250
|
// Approval
|
|
22250
22251
|
// ============
|
|
22251
|
-
routeApproved: (routeData, allowanceInWei) => [
|
|
22252
|
+
routeApproved: (routeData, allowanceInWei, approvalType) => [
|
|
22252
22253
|
...keys().transactions(),
|
|
22253
22254
|
QueryKeys.RouteApproved,
|
|
22254
22255
|
routeData?.params.fromAddress,
|
|
@@ -22256,6 +22257,7 @@ const keys = () => ({
|
|
|
22256
22257
|
routeData?.params.fromToken,
|
|
22257
22258
|
routeData?.params.fromAmount,
|
|
22258
22259
|
allowanceInWei?.toString(),
|
|
22260
|
+
approvalType,
|
|
22259
22261
|
],
|
|
22260
22262
|
sendTransactionGas: (chainId, tokenAddress, from) => [
|
|
22261
22263
|
QueryKeys.All,
|
|
@@ -23062,7 +23064,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23062
23064
|
};
|
|
23063
23065
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23064
23066
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23065
|
-
const { fetchAllSecretBalances } = await import('./secretService
|
|
23067
|
+
const { fetchAllSecretBalances } = await import('./secretService-CV_qKM-f.js');
|
|
23066
23068
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23067
23069
|
};
|
|
23068
23070
|
function getTokenAssetsKey(token) {
|
|
@@ -26238,7 +26240,7 @@ function useStellarWallets() {
|
|
|
26238
26240
|
return;
|
|
26239
26241
|
try {
|
|
26240
26242
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
26241
|
-
const { formatStellarWallet } = await import('./stellarService.client-
|
|
26243
|
+
const { formatStellarWallet } = await import('./stellarService.client-BK4en2TV.js');
|
|
26242
26244
|
const modules = initializeAllModules();
|
|
26243
26245
|
const promises = modules.map(async (module) => {
|
|
26244
26246
|
const isAvailable = await module.isAvailable();
|
|
@@ -31599,8 +31601,26 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31599
31601
|
const isSrcChainEvmos = isEvmosChain(fromChain);
|
|
31600
31602
|
const isSagaSameChainSwap = isSameChain &&
|
|
31601
31603
|
fromChain?.chainId.toString() === CHAIN_IDS.SAGA_EVM.toString();
|
|
31602
|
-
|
|
31603
|
-
|
|
31604
|
+
const approvalType = useMemo(() => {
|
|
31605
|
+
if (squidRoute?.transactionRequest?.type ===
|
|
31606
|
+
SquidDataType.DepositAddressCalldata) {
|
|
31607
|
+
// No approvals needed for deposit address calls
|
|
31608
|
+
return null;
|
|
31609
|
+
}
|
|
31610
|
+
if (isSrcChainEvmos && !isSagaSameChainSwap) {
|
|
31611
|
+
// Use ICS20 for Evmos chains, except for SagaEVM same-chain swaps
|
|
31612
|
+
return "ics20";
|
|
31613
|
+
}
|
|
31614
|
+
else {
|
|
31615
|
+
return "erc20";
|
|
31616
|
+
}
|
|
31617
|
+
}, [
|
|
31618
|
+
isSagaSameChainSwap,
|
|
31619
|
+
isSrcChainEvmos,
|
|
31620
|
+
squidRoute?.transactionRequest?.type,
|
|
31621
|
+
]);
|
|
31622
|
+
const useIcs20 = approvalType === "ics20";
|
|
31623
|
+
const useErc20 = approvalType === "erc20";
|
|
31604
31624
|
const { hasAllowance: hasErc20Allowance, query: erc20AllowanceQuery, allowanceInWei: erc20AllowanceInWei, } = useErc20Allowance({
|
|
31605
31625
|
tokenAddress: fromToken?.address,
|
|
31606
31626
|
ownerAddress: sourceUserAddress,
|
|
@@ -31608,7 +31628,7 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31608
31628
|
?.target,
|
|
31609
31629
|
amount: BigInt(squidRoute?.params.fromAmount ?? "0"),
|
|
31610
31630
|
chainId: Number(fromChain?.chainId),
|
|
31611
|
-
enabled:
|
|
31631
|
+
enabled: useErc20,
|
|
31612
31632
|
});
|
|
31613
31633
|
const { hasAllowance: hasIcs20Allowance, query: ics20AllowanceQuery, allowanceInWei: ics20AllowanceInWei, } = useIcs20Allowance({
|
|
31614
31634
|
ownerAddress: sourceUserAddress,
|
|
@@ -31627,7 +31647,10 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31627
31647
|
* On Error: Showing the error message if any
|
|
31628
31648
|
* @returns {boolean} approved
|
|
31629
31649
|
*/
|
|
31630
|
-
const routeApproved = useQuery(keys().routeApproved(squidRoute, allowanceInWei), async () => {
|
|
31650
|
+
const routeApproved = useQuery(keys().routeApproved(squidRoute, allowanceInWei, approvalType), async () => {
|
|
31651
|
+
if (approvalType === null) {
|
|
31652
|
+
return true;
|
|
31653
|
+
}
|
|
31631
31654
|
// Approval is only needed for EVM chains
|
|
31632
31655
|
if (getChainType(squidRoute?.params.fromChain) === ChainType.EVM) {
|
|
31633
31656
|
return hasAllowance;
|
|
@@ -31636,8 +31659,8 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31636
31659
|
}, {
|
|
31637
31660
|
enabled: !!squidRoute &&
|
|
31638
31661
|
!!sourceUserAddress &&
|
|
31639
|
-
!allowanceQuery?.isLoading &&
|
|
31640
|
-
|
|
31662
|
+
((!allowanceQuery?.isLoading && allowanceQuery?.isFetched) ||
|
|
31663
|
+
approvalType === null),
|
|
31641
31664
|
});
|
|
31642
31665
|
// USDT has a very specific way of handling approvals
|
|
31643
31666
|
// ```
|
|
@@ -31727,6 +31750,9 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31727
31750
|
*/
|
|
31728
31751
|
const approveRoute = useMutation(async () => {
|
|
31729
31752
|
try {
|
|
31753
|
+
if (approvalType === null) {
|
|
31754
|
+
return true;
|
|
31755
|
+
}
|
|
31730
31756
|
if (fromToken?.address === nativeEvmTokenAddress) {
|
|
31731
31757
|
return true;
|
|
31732
31758
|
}
|
|
@@ -36402,4 +36428,4 @@ const SquidProvider = ({ children, config, placeholder, }) => {
|
|
|
36402
36428
|
};
|
|
36403
36429
|
|
|
36404
36430
|
export { useNativeBalance as $, AxelarStatusResponseType as A, useAddressBookStore as B, CHAIN_IDS as C, DEFAULT_LOCALE as D, useAssetsColorsStore as E, useFavoriteTokensStore as F, useHistoryStore as G, HistoryTxType as H, useSendTransactionStore as I, useConfigStore as J, useSquidStore as K, useSwapRoutePersistStore as L, useTransactionStore as M, ConnectingWalletStatus as N, useWalletStore as O, useDepositAddress as P, useSwap as Q, useAllConnectedWalletBalances as R, SquidStatusErrorType as S, TransactionErrorType as T, useAllTokensWithBalanceForChainType as U, useCosmosBalance as V, WindowWalletFlag as W, XamanXrplNetwork as X, useEvmBalance as Y, useMultiChainBalance as Z, useMultipleTokenPrices as _, chainTypeToZeroAddressMap as a, findToken as a$, useNativeTokenForChain as a0, useSingleTokenPrice as a1, useSquidTokens as a2, useHistoricalData as a3, useTokensData as a4, useEstimateSendTransaction as a5, useSendTransaction as a6, useSendTransactionGas as a7, useAllTransactionsStatus as a8, useApproval as a9, useGetFiatQuote as aA, useGetOnRampConfig as aB, useExecuteFiatQuote as aC, useFiatOnRampTxStatus as aD, useFiatTransactions as aE, useCurrencyDetails as aF, useCountryDetails as aG, useAvailableQuotes as aH, useRecommendedQuote as aI, useGetOnrampPaymentTypes as aJ, useSuggestedFiatAmounts as aK, SquidProvider as aL, EnsService as aM, getXummClient as aN, isXamanXAppContext as aO, getQueryHeaders as aP, getStatusCode as aQ, is404Error as aR, assetsBaseUrl as aS, shareSubgraphId as aT, sortTokensBySharedSubgraphIds as aU, getSupportedChainIdsForDirection as aV, filterChains as aW, filterTokens as aX, getTokenImage as aY, getNewSwapParamsFromInput as aZ, sortAllTokens as a_, useEstimate as aa, useEstimatePriceImpact as ab, useExecuteTransaction as ac, useGetRoute as ad, useGetRouteWrapper as ae, useRouteWarnings as af, useSendTransactionStatus as ag, useSwapTransactionStatus as ah, useAvatar as ai, useHistory as aj, useUserParams as ak, useDebouncedValue as al, useAddToken as am, useAutoConnect as an, useEnsDataForAddress as ao, useEnsSearch as ap, useGnosisContext as aq, useIsSameAddressAndGnosisContext as ar, useIntegratorContext as as, useMultiChainWallet as at, useSigner as au, useWallet as av, useWallets as aw, useXrplTrustLine as ax, TX_STATUS_CONSTANTS as ay, FINAL_TRANSACTION_STATUSES as az, destinationAddressResetValue as b, filterSolanaWallets as b$, findNativeToken as b0, normalizeIbcAddress as b1, groupTokensBySymbol as b2, groupTokensByChainId as b3, filterViewableTokens as b4, getSecretNetworkBalances as b5, getTokenAssetsKey as b6, fetchAssetsColors as b7, initializeSquidWithAssetsColors as b8, isEmptyObject as b9, isSwapRouteError as bA, isStatusError as bB, createQuoteRequestParamsHash as bC, WidgetEvents as bD, EvmNetworkNotSupportedErrorCode as bE, addEthereumChain as bF, parseEvmAddress as bG, formatEvmWallet as bH, filterWagmiConnector as bI, waitForReceiptWithRetry as bJ, getUserCountry as bK, getCountryData as bL, getCurrencyData as bM, adaptiveRound as bN, getSuggestedAmountsForCurrency as bO, parseToBigInt as bP, roundNumericValue as bQ, formatUnitsRounded as bR, formatTokenAmount as bS, formatUsdAmount as bT, trimExtraDecimals as bU, getNumericValue as bV, cleanAmount as bW, convertTokenAmountToUSD as bX, convertUSDToTokenAmount as bY, calculateTotal24hChange as bZ, searchTokens as b_, normalizeTokenSymbol as ba, areTokenSymbolsCompatible as bb, isEvmosChain as bc, getConfigWithDefaults as bd, randomIntFromInterval as be, getTokensForChain as bf, getFirstAvailableChainId as bg, fetchHighestBalanceToken as bh, getInitialOrDefaultTokenAddressForChain as bi, getInitialTokenAddressForChain as bj, filterTokensForDestination as bk, getInitialChainIdFromConfig as bl, getCosmosKey as bm, getKeysSettled as bn, getAllKeysForSupportedCosmosChains as bo, isCosmosAddressValid as bp, getCosmosSigningClient as bq, getCosmosChainInfosObject as br, connectCosmosWallet as bs, isFallbackAddressNeeded as bt, suggestChainOrThrow as bu, normalizeError as bv, transactionErrorCode as bw, isUserRejectionError as bx, getTransactionError as by, handleTransactionErrorEvents as bz, chainTypeToNativeTokenAddressMap as c, isSolanaAddressValid as c0, executeSolanaSwap as c1, executeSolanaTransfer as c2, formatTransactionHistoryDate as c3, getAxelarExplorerTxUrl as c4, getSourceExplorerTxUrl as c5, getMainExplorerUrl as c6, formatDistance as c7, formatSeconds as c8, formatSwapTxStatusResponseForStorage as c9, getDefaultChain as cA, sortWallets as cB, areSameAddress as cC, sortAddressBook as cD, calculateTotalUsdBalanceUSD as cE, addTokenToWallet as cF, isEvmChainNotSupportedError as cG, getWalletSupportedChainTypes as cH, getConnectorForChainType as cI, walletSupportsChainType as cJ, connectWallet as cK, cancelConnectWallet as cL, isProblematicConnector as cM, mergeWallets as cN, isXionSmartContractAddress as cO, isXrplAddressValid as cP, buildXrplTrustSetTx as cQ, getXrplNetwork as cR, parseXrplPaymentTx as cS, simplifyRouteAction as ca, fetchSwapTransactionStatus as cb, compareTransactionIds as cc, isCoralBridgeAction as cd, sleep as ce, isDepositRoute as cf, isChainflipBridgeTransaction as cg, getHistoryTransactionId as ch, getStepStatuses as ci, getHalfSuccessState as cj, getStepsInfos as ck, getSwapTxStatusRefetchInterval as cl, getSendTxStatusRefetchInterval as cm, chainflipMultihopBridgeType as cn, getBridgeType as co, getTransactionStatus as cp, getTransactionEndStatus as cq, isHistoryTransactionPending as cr, isHistoryTransactionFailed as cs, isHistoryTransactionWarning as ct, isHistoryTransactionEnded as cu, formatHash as cv, isWalletAddressValid as cw, redirectToExtensionsStore as cx, accessProperty as cy, populateWallets as cz, definedInWindow as d, fallbackAddressResetValue as e, formatBNToReadable as f, nativeCosmosTokenAddress as g, nativeEvmTokenAddress as h, nativeSolanaTokenAddress as i, nativeStellarTokenAddress as j, nativeSuiTokenAddress as k, nativeXrplTokenAddress as l, CosmosProvider as m, nativeBitcoinTokenAddress as n, SendTransactionStatus as o, TransactionStatus as p, useTrackSearchEmpty as q, useSquidChains as r, useClient as s, useCosmosForChain as t, useCosmosContext as u, useKeyboardNavigation as v, walletIconBaseUrl as w, useSquidQueryClient as x, useSquid as y, useStellarAccountActivation as z };
|
|
36405
|
-
//# sourceMappingURL=index-
|
|
36431
|
+
//# sourceMappingURL=index-B402hKhN.js.map
|