@0xsquid/react-hooks 8.3.1-beta-update-ethers.0 → 8.3.1-beta-stellar-issued-assets.2

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 (41) hide show
  1. package/dist/core/constants.d.ts +1 -0
  2. package/dist/core/index.d.ts +1 -1
  3. package/dist/core/queries/queries-keys.d.ts +5 -1
  4. package/dist/core/types/index.d.ts +1 -1
  5. package/dist/core/types/stellar.d.ts +52 -0
  6. package/dist/core/types/tokens.d.ts +4 -0
  7. package/dist/core/types/transaction.d.ts +19 -1
  8. package/dist/hooks/index.d.ts +1 -0
  9. package/dist/hooks/stellar/useStellarTrustLine.d.ts +13 -0
  10. package/dist/hooks/transaction/useGetRoute.d.ts +18 -7
  11. package/dist/{index-qAOvcSon.js → index-xSvE7oVI.js} +743 -329
  12. package/dist/index-xSvE7oVI.js.map +1 -0
  13. package/dist/{index-CMrdTYeW.js → index-z1TwF4-p.js} +730 -331
  14. package/dist/index-z1TwF4-p.js.map +1 -0
  15. package/dist/{index.es-Cu_QQTg-.js → index.es-CtYD1WrB.js} +2 -2
  16. package/dist/{index.es-Cu_QQTg-.js.map → index.es-CtYD1WrB.js.map} +1 -1
  17. package/dist/{index.es-DRgOycmm.js → index.es-Rc3LIf6Y.js} +2 -2
  18. package/dist/{index.es-DRgOycmm.js.map → index.es-Rc3LIf6Y.js.map} +1 -1
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.js +16 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/{secretService-B_-XWo1F.js → secretService-BEEQh-7r.js} +2 -2
  23. package/dist/{secretService-B_-XWo1F.js.map → secretService-BEEQh-7r.js.map} +1 -1
  24. package/dist/{secretService-B3sc6ibT.js → secretService-aK5p-g0D.js} +2 -2
  25. package/dist/{secretService-B3sc6ibT.js.map → secretService-aK5p-g0D.js.map} +1 -1
  26. package/dist/services/external/rpcService.d.ts +1 -1
  27. package/dist/services/external/stellarApiClient.d.ts +4 -0
  28. package/dist/services/external/stellarRpcClient.d.ts +2 -2
  29. package/dist/services/external/xrplRpcClient.d.ts +2 -1
  30. package/dist/services/index.d.ts +2 -0
  31. package/dist/services/internal/routeService.d.ts +8 -0
  32. package/dist/services/internal/stellarService.d.ts +9 -0
  33. package/dist/services/internal/transactionService.d.ts +14 -1
  34. package/dist/services/internal/xrplService.d.ts +2 -0
  35. package/dist/{stellarService.client-Ciqw9lmL.js → stellarService.client-BB88L49R.js} +2 -2
  36. package/dist/{stellarService.client-Ciqw9lmL.js.map → stellarService.client-BB88L49R.js.map} +1 -1
  37. package/dist/{stellarService.client-sRzC5VSD.js → stellarService.client-Dl_XfhX_.js} +2 -2
  38. package/dist/{stellarService.client-sRzC5VSD.js.map → stellarService.client-Dl_XfhX_.js.map} +1 -1
  39. package/package.json +5 -5
  40. package/dist/index-CMrdTYeW.js.map +0 -1
  41. package/dist/index-qAOvcSon.js.map +0 -1
@@ -102,6 +102,7 @@ const gasRefundMultiplier = 25;
102
102
  const internalSquidApiBaseUrl = "https://app.squidrouter.com/api";
103
103
  const XAMAN_API_URL = `${internalSquidApiBaseUrl}/xaman/`;
104
104
  const TOKEN_PRICE_API_URL = `${internalSquidApiBaseUrl}/coingecko`;
105
+ const DEFAULT_ROUTE_REFETCH_INTERVAL = 30_000;
105
106
  const SOLANA_RPC_URL = "https://meredith-ute2ko-fast-mainnet.helius-rpc.com";
106
107
  const INTEGRATOR_ID = "squid-widget-playground-local-cd33cba6-7e12-4fcc-8d5d-35e286f655ea";
107
108
  const DEFAULT_COUNTRY_CODE = "US";
@@ -20117,14 +20118,17 @@ function isXrplAddressValid(address) {
20117
20118
  return rippleAddressCodec.isValidXAddress(address) || rippleAddressCodec.isValidClassicAddress(address);
20118
20119
  }
20119
20120
  function buildXrplTrustSetTx({ amount, sourceAddress, token, }) {
20120
- const [currency, issuer] = token.address.split(".");
20121
+ const asset = parseXrplTokenAddress(token.address);
20122
+ if (!asset) {
20123
+ throw new Error("Invalid asset");
20124
+ }
20121
20125
  return {
20122
20126
  TransactionType: XrplTransactionType.TRUST_SET,
20123
20127
  Flags: XrplTransactionFlag.tfSetNoRipple,
20124
20128
  Account: sourceAddress,
20125
20129
  LimitAmount: {
20126
- currency,
20127
- issuer,
20130
+ currency: asset.code,
20131
+ issuer: asset.issuer,
20128
20132
  value: amount,
20129
20133
  },
20130
20134
  };
@@ -20153,6 +20157,16 @@ function parseXrplPaymentTx(data) {
20153
20157
  throw new Error("Could not parse payment transaction");
20154
20158
  }
20155
20159
  }
20160
+ function parseXrplTokenAddress(address) {
20161
+ const [code, issuer] = address.split(".");
20162
+ if (!code || !issuer) {
20163
+ return null;
20164
+ }
20165
+ return {
20166
+ code,
20167
+ issuer,
20168
+ };
20169
+ }
20156
20170
 
20157
20171
  const chains = [XrplCAIP2ChainId.MAINNET, XrplCAIP2ChainId.TESTNET];
20158
20172
  class XrplWalletConnect {
@@ -20855,6 +20869,309 @@ const isBitcoinAddressValid = (address) => {
20855
20869
  }
20856
20870
  };
20857
20871
 
20872
+ exports.HistoryTxType = void 0;
20873
+ (function (HistoryTxType) {
20874
+ HistoryTxType[HistoryTxType["SWAP"] = 0] = "SWAP";
20875
+ HistoryTxType[HistoryTxType["BUY"] = 1] = "BUY";
20876
+ HistoryTxType[HistoryTxType["SEND"] = 2] = "SEND";
20877
+ })(exports.HistoryTxType || (exports.HistoryTxType = {}));
20878
+
20879
+ var TransactionType;
20880
+ (function (TransactionType) {
20881
+ TransactionType["BRIDGE"] = "BRIDGE";
20882
+ TransactionType["BRIDGE_CALL"] = "BRIDGE_CALL";
20883
+ TransactionType["CALL_BRIDGE"] = "CALL_BRIDGE";
20884
+ TransactionType["CALL_BRIDGE_CALL"] = "CALL_BRIDGE_CALL";
20885
+ })(TransactionType || (TransactionType = {}));
20886
+ exports.AxelarStatusResponseType = void 0;
20887
+ (function (AxelarStatusResponseType) {
20888
+ AxelarStatusResponseType["GAS_PAID_NOT_ENOUGH_GAS"] = "gas_paid_not_enough_gas";
20889
+ AxelarStatusResponseType["DESTINATION_EXECUTED"] = "destination_executed";
20890
+ AxelarStatusResponseType["EXPRESS_EXECUTED"] = "express_executed";
20891
+ AxelarStatusResponseType["CROSS_MULTICALL_EXECUTED"] = "CrossMulticallExecuted";
20892
+ AxelarStatusResponseType["CROSS_MULTICALL_FAILED"] = "CrossMulticallFailed";
20893
+ AxelarStatusResponseType["SRC_GATEWAY_CALLED"] = "source_gateway_called";
20894
+ AxelarStatusResponseType["DEST_GATEWAY_APPROVED"] = "destination_gateway_approved";
20895
+ AxelarStatusResponseType["DESTINATION_EXECUTE_ERROR"] = "destination_execute_error";
20896
+ AxelarStatusResponseType["DESTINATION_EXECUTING"] = "executing";
20897
+ AxelarStatusResponseType["UNKNOWN_ERROR"] = "unknown_error";
20898
+ AxelarStatusResponseType["CANNOT_FETCH_STATUS"] = "cannot_fetch_status";
20899
+ AxelarStatusResponseType["ERROR"] = "error";
20900
+ })(exports.AxelarStatusResponseType || (exports.AxelarStatusResponseType = {}));
20901
+ exports.TransactionStatus = void 0;
20902
+ (function (TransactionStatus) {
20903
+ // Submitted transaction, returned by squid axelar
20904
+ TransactionStatus["SUCCESS"] = "success";
20905
+ TransactionStatus["NEEDS_GAS"] = "needs_gas";
20906
+ TransactionStatus["ONGOING"] = "ongoing";
20907
+ TransactionStatus["PARTIAL_SUCCESS"] = "partial_success";
20908
+ TransactionStatus["NOT_FOUND"] = "not_found";
20909
+ // Unsubmitted Transaction, can be status from wallet
20910
+ TransactionStatus["INITIAL_LOADING"] = "initialLoading";
20911
+ TransactionStatus["GENERATING_DEPOSIT"] = "generating_deposit";
20912
+ TransactionStatus["ERROR"] = "error";
20913
+ TransactionStatus["WARNING"] = "warning";
20914
+ TransactionStatus["PENDING"] = "pending";
20915
+ TransactionStatus["REJECTED"] = "rejected";
20916
+ // Coral refund
20917
+ TransactionStatus["REFUNDED"] = "refunded";
20918
+ })(exports.TransactionStatus || (exports.TransactionStatus = {}));
20919
+ exports.SendTransactionStatus = void 0;
20920
+ (function (SendTransactionStatus) {
20921
+ SendTransactionStatus[SendTransactionStatus["ONGOING"] = 0] = "ONGOING";
20922
+ SendTransactionStatus[SendTransactionStatus["SUCCESS"] = 1] = "SUCCESS";
20923
+ SendTransactionStatus[SendTransactionStatus["ERROR"] = 2] = "ERROR";
20924
+ })(exports.SendTransactionStatus || (exports.SendTransactionStatus = {}));
20925
+
20926
+ const getQueryHeaders = (integratorId, requestId) => {
20927
+ return {
20928
+ ...(integratorId ? { "X-Integrator-Id": integratorId } : {}),
20929
+ ...(requestId ? { "X-Request-Id": requestId } : {}),
20930
+ };
20931
+ };
20932
+ const getStatusCode = (error) => {
20933
+ if (axios.isAxiosError(error)) {
20934
+ return error.response?.status;
20935
+ }
20936
+ return undefined;
20937
+ };
20938
+ const is404Error = (error) => {
20939
+ const statusCode = getStatusCode(error);
20940
+ if (statusCode === 404) {
20941
+ return true;
20942
+ }
20943
+ return false;
20944
+ };
20945
+
20946
+ const formatTransactionHistoryDate = (transaction) => {
20947
+ if (!transaction?.timestamp)
20948
+ return undefined;
20949
+ try {
20950
+ const date = new Date(Number(transaction.timestamp));
20951
+ // Format date to: MMM DD. Examples:
20952
+ // Jan 01
20953
+ // May 12
20954
+ const month = new Intl.DateTimeFormat(DEFAULT_LOCALE, {
20955
+ month: "short",
20956
+ }).format(date);
20957
+ const day = date.toLocaleString(DEFAULT_LOCALE, { day: "2-digit" });
20958
+ return { month, day };
20959
+ }
20960
+ catch (error) {
20961
+ console.error("Error formatting date:", error);
20962
+ return undefined;
20963
+ }
20964
+ };
20965
+ const getAxelarExplorerTxUrl = (urlPrefix, routeType, txID) => {
20966
+ if (!urlPrefix) {
20967
+ return undefined;
20968
+ }
20969
+ const txType = routeType ?? TransactionType.BRIDGE;
20970
+ if (txType === TransactionType.CALL_BRIDGE ||
20971
+ txType === TransactionType.BRIDGE) {
20972
+ return `${urlPrefix}transfer/${txID}`;
20973
+ }
20974
+ return `${urlPrefix}gmp/${txID}`;
20975
+ };
20976
+ const getSourceExplorerTxUrl = (chain, txID) => {
20977
+ if (!chain || !chain.blockExplorerUrls[0] || !txID) {
20978
+ return undefined;
20979
+ }
20980
+ let txSuffix;
20981
+ switch (chain.chainId) {
20982
+ case CHAIN_IDS.AGORIC:
20983
+ case CHAIN_IDS.XRPL:
20984
+ case CHAIN_IDS.XRPL_TESTNET:
20985
+ txSuffix = "/transactions/";
20986
+ break;
20987
+ default:
20988
+ txSuffix = "/tx/";
20989
+ }
20990
+ if (chain.blockExplorerUrls[0].endsWith("/")) {
20991
+ txSuffix = txSuffix.slice(1);
20992
+ }
20993
+ return `${chain.blockExplorerUrls[0]}${txSuffix}${txID}`;
20994
+ };
20995
+ const getMainExplorerUrl = (transaction) => {
20996
+ // The most accurate one is coming from squid /status api
20997
+ if (transaction?.statusResponse?.axelarTransactionUrl) {
20998
+ return transaction?.statusResponse.axelarTransactionUrl;
20999
+ }
21000
+ // If not, we can try to get it from the source chain
21001
+ if (transaction?.sourceTxExplorerUrl) {
21002
+ return transaction?.sourceTxExplorerUrl;
21003
+ }
21004
+ // If not, we can try to guess it from the transaction type
21005
+ if (transaction && transaction?.transactionId) {
21006
+ return getAxelarExplorerTxUrl(transaction.statusResponse?.axelarTransactionUrl, transaction.routeType, transaction.transactionId);
21007
+ }
21008
+ return undefined;
21009
+ };
21010
+ const formatDistance = (date, baseDate, options) => {
21011
+ const { includeSeconds = false, addSuffix = false, locale = { locale: DEFAULT_LOCALE }, } = options || {};
21012
+ const elapsedMilliseconds = Math.abs(new Date(date).getTime() - new Date(baseDate).getTime());
21013
+ const seconds = Math.round(elapsedMilliseconds / 1000);
21014
+ const minutes = Math.round(seconds / 60);
21015
+ const hours = Math.round(minutes / 60);
21016
+ const days = Math.round(hours / 24);
21017
+ const months = Math.round(days / 30.44);
21018
+ const years = Math.round(days / 365.25);
21019
+ const rtf = new Intl.RelativeTimeFormat(locale.locale, { numeric: "auto" });
21020
+ let formatted = "";
21021
+ if (includeSeconds && seconds < 45) {
21022
+ const unit = addSuffix ? "second" : "seconds";
21023
+ formatted = rtf.format(-seconds, unit);
21024
+ }
21025
+ else if (minutes < 60) {
21026
+ formatted = rtf.format(-minutes, "minutes");
21027
+ }
21028
+ else if (hours < 24) {
21029
+ formatted = rtf.format(-hours, "hours");
21030
+ }
21031
+ else if (days < 30) {
21032
+ formatted = rtf.format(-days, "days");
21033
+ }
21034
+ else if (months < 12) {
21035
+ formatted = rtf.format(-months, "months");
21036
+ }
21037
+ else {
21038
+ formatted = rtf.format(-years, "years");
21039
+ }
21040
+ // remove "ago" from the string
21041
+ // before: "2 minutes ago"
21042
+ // after: "2 minutes"
21043
+ return addSuffix ? formatted : formatted.replace(/\b(?:ago)\b/, "").trim();
21044
+ };
21045
+ const formatSeconds = (seconds, secondsTemplate = "s", minutesTemplate = "m", hoursTemplate = "h") => {
21046
+ let duration = "";
21047
+ if (seconds < 60) {
21048
+ duration = `${seconds.toString()}${secondsTemplate}`;
21049
+ }
21050
+ else {
21051
+ duration = formatDistance(0, seconds * 1000, { includeSeconds: true });
21052
+ }
21053
+ const result = duration.startsWith("1 ")
21054
+ ? duration
21055
+ .replace(" minute", minutesTemplate)
21056
+ .replace(" hour", hoursTemplate)
21057
+ : duration
21058
+ .replace(" minutes", minutesTemplate)
21059
+ .replace(" hours", hoursTemplate);
21060
+ return result;
21061
+ };
21062
+ /**
21063
+ * Remove the chainData from statusResponse to gain some storage space
21064
+ */
21065
+ const formatSwapTxStatusResponseForStorage = (sr) => {
21066
+ if (!sr) {
21067
+ return sr;
21068
+ }
21069
+ return {
21070
+ axelarTransactionUrl: sr.axelarTransactionUrl,
21071
+ toChain: sr.toChain?.transactionUrl
21072
+ ? {
21073
+ transactionUrl: sr.toChain?.transactionUrl,
21074
+ }
21075
+ : undefined,
21076
+ };
21077
+ };
21078
+ const simplifyRouteAction = (action) => {
21079
+ return {
21080
+ type: action.type,
21081
+ provider: action.provider,
21082
+ data: {
21083
+ type: action.data?.type,
21084
+ },
21085
+ ...(action.coralV2Order ? { isCoralV2: true } : undefined),
21086
+ };
21087
+ };
21088
+ const fetchSwapTransactionStatus = async ({ transaction, integratorId, apiUrl, }) => {
21089
+ const statusEndpoint = `${apiUrl}/v2/status`;
21090
+ try {
21091
+ const response = await axios.get(statusEndpoint, {
21092
+ params: {
21093
+ transactionId: transaction?.transactionIdForStatus ?? transaction?.transactionId,
21094
+ fromChainId: transaction?.fromChain,
21095
+ toChainId: transaction?.toChain,
21096
+ bridgeType: transaction?.bridgeType,
21097
+ quoteId: transaction?.quoteId,
21098
+ depositTxVerificationSignature: transaction?.depositTxVerificationSignature,
21099
+ },
21100
+ headers: getQueryHeaders(integratorId, transaction?.quoteId),
21101
+ });
21102
+ return response.data;
21103
+ }
21104
+ catch (error) {
21105
+ if (error) {
21106
+ throw new Error("Fetch transaction status failed", { cause: error });
21107
+ }
21108
+ throw new Error("Fetch transaction status failed", { cause: undefined });
21109
+ }
21110
+ };
21111
+ const compareTransactionIds = (idA, idB) => {
21112
+ if (!idA || !idB) {
21113
+ return false;
21114
+ }
21115
+ const normalizedA = idA.toLowerCase();
21116
+ const normalizedB = idB.toLowerCase();
21117
+ return normalizedA.includes(normalizedB) || normalizedB.includes(normalizedA);
21118
+ };
21119
+ /**
21120
+ * Checks if the provided action is Coral bridge action
21121
+ */
21122
+ function isCoralBridgeAction(action) {
21123
+ return (action.type === squidTypes.ActionType.RFQ &&
21124
+ // TODO: update types
21125
+ action.provider?.toLowerCase() === "coral");
21126
+ }
21127
+ function sleep(ms) {
21128
+ return new Promise((resolve) => setTimeout(resolve, ms));
21129
+ }
21130
+ const isDepositRoute = (route) => {
21131
+ return (!!route &&
21132
+ route.transactionRequest?.type === squidTypes.SquidDataType.ChainflipDepositAddress);
21133
+ };
21134
+ /**
21135
+ * Checks if the route contains a Chainflip bridge action
21136
+ */
21137
+ function isChainflipBridgeTransaction(actions = []) {
21138
+ return actions.some((action) => action.type === squidTypes.ActionType.BRIDGE &&
21139
+ action.data?.type === squidTypes.BridgeType.CHAINFLIP);
21140
+ }
21141
+ /**
21142
+ * Checks if a route is of type {@link OnChainExecutionData}
21143
+ *
21144
+ * On-chain routes require calling a smart contract to execute
21145
+ */
21146
+ function isOnChainTxData(squidData) {
21147
+ return [
21148
+ squidTypes.SquidDataType.OnChainExecution,
21149
+ squidTypes.SquidDataType.DepositAddressWithSignature,
21150
+ squidTypes.SquidDataType.DepositAddressCalldata,
21151
+ squidTypes.SquidDataType.DepositAddressWithSignature,
21152
+ squidTypes.SquidDataType.DepositAddressWithMemo,
21153
+ ].includes(squidData.type);
21154
+ }
21155
+ /**
21156
+ * Checks if a route is of type deposit-with-signature
21157
+ *
21158
+ * deposit-with-signature routes are on-chain routes
21159
+ * that require a signature from the user to execute
21160
+ */
21161
+ function isDepositWithSignatureTxData(squidData) {
21162
+ return squidData.type === squidTypes.SquidDataType.DepositAddressWithSignature;
21163
+ }
21164
+ function getHistoryTransactionId(tx) {
21165
+ switch (tx.txType) {
21166
+ case exports.HistoryTxType.SWAP:
21167
+ return tx.data.transactionId;
21168
+ case exports.HistoryTxType.BUY:
21169
+ return tx.data.orderId;
21170
+ case exports.HistoryTxType.SEND:
21171
+ return tx.data.hash;
21172
+ }
21173
+ }
21174
+
20858
21175
  const STANDARD_FEATURES = [
20859
21176
  "standard:connect",
20860
21177
  "standard:events",
@@ -21031,7 +21348,7 @@ const isSolanaAddressValid = (address) => {
21031
21348
  * This will be used for the swap flow - Using Jupiter Dex under the hood
21032
21349
  */
21033
21350
  const executeSolanaSwap = async ({ route, signer, connection, onSigned, }) => {
21034
- if (!route?.transactionRequest?.data) {
21351
+ if (!route.transactionRequest || !isOnChainTxData(route.transactionRequest)) {
21035
21352
  throw new Error("Invalid parameters");
21036
21353
  }
21037
21354
  const swapRequest = route.transactionRequest.data;
@@ -21118,6 +21435,28 @@ const executeSolanaTransfer = async ({ amount, target, signer, connection, sourc
21118
21435
  return signature;
21119
21436
  };
21120
21437
 
21438
+ var StellarHorizonAssetType;
21439
+ (function (StellarHorizonAssetType) {
21440
+ /**
21441
+ * XLM native token
21442
+ */
21443
+ StellarHorizonAssetType["NATIVE"] = "native";
21444
+ /**
21445
+ * 1-4 char asset code (e.g. USDC)
21446
+ */
21447
+ StellarHorizonAssetType["ALPHANUM4"] = "credit_alphanum4";
21448
+ /**
21449
+ * 5-12 char asset code (e.g. wstETH)
21450
+ */
21451
+ StellarHorizonAssetType["ALPHANUM12"] = "credit_alphanum12";
21452
+ })(StellarHorizonAssetType || (StellarHorizonAssetType = {}));
21453
+ var StellarTokenType;
21454
+ (function (StellarTokenType) {
21455
+ StellarTokenType["NATIVE_TOKEN"] = "nativeToken";
21456
+ StellarTokenType["ISSUER_TOKEN"] = "issuerToken";
21457
+ StellarTokenType["CONTRACT_TOKEN"] = "contractToken";
21458
+ })(StellarTokenType || (StellarTokenType = {}));
21459
+
21121
21460
  function isStellarAddressValid(address) {
21122
21461
  return stellarSdk.StrKey.isValidEd25519PublicKey(address);
21123
21462
  }
@@ -21139,6 +21478,78 @@ function stellarAddressToScVal(addressString) {
21139
21478
  type: "address",
21140
21479
  });
21141
21480
  }
21481
+ function getStellarTrustLineAsset(token) {
21482
+ // The address format for issued assets is `CODE-ISSUER`
21483
+ // Example: USDC-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
21484
+ const [code, issuer] = token.address.split("-");
21485
+ if (!code || !issuer) {
21486
+ return null;
21487
+ }
21488
+ return {
21489
+ code,
21490
+ issuer,
21491
+ };
21492
+ }
21493
+ function isStellarToken(token) {
21494
+ try {
21495
+ const stellarToken = token;
21496
+ return (Object.values(StellarTokenType).includes(stellarToken.chainAssetConfig.stellar.assetType) &&
21497
+ typeof stellarToken.chainAssetConfig.stellar.contractAddress === "string");
21498
+ }
21499
+ catch {
21500
+ return false;
21501
+ }
21502
+ }
21503
+ function isStellarIssuedToken(token) {
21504
+ try {
21505
+ return (isStellarToken(token) &&
21506
+ token.chainAssetConfig.stellar.assetType === StellarTokenType.ISSUER_TOKEN);
21507
+ }
21508
+ catch {
21509
+ return false;
21510
+ }
21511
+ }
21512
+ function getStellarHorizonApiUrl(chain) {
21513
+ try {
21514
+ const stellarChain = chain;
21515
+ const [horizonApiUrl] = stellarChain.horizonRpcList;
21516
+ if (typeof horizonApiUrl !== "string") {
21517
+ throw new Error("Invalid Horizon API URL");
21518
+ }
21519
+ return horizonApiUrl;
21520
+ }
21521
+ catch {
21522
+ return null;
21523
+ }
21524
+ }
21525
+ const VALID_ASSET_TYPES = new Set(Object.values(StellarHorizonAssetType));
21526
+ function isValidNativeAsset(asset) {
21527
+ return (typeof asset === "object" &&
21528
+ asset !== null &&
21529
+ "balance" in asset &&
21530
+ typeof asset.balance === "string" &&
21531
+ "asset_type" in asset &&
21532
+ asset.asset_type === StellarHorizonAssetType.NATIVE);
21533
+ }
21534
+ function isValidIssuedAsset(asset) {
21535
+ return (typeof asset === "object" &&
21536
+ asset !== null &&
21537
+ "balance" in asset &&
21538
+ typeof asset.balance === "string" &&
21539
+ "asset_type" in asset &&
21540
+ typeof asset.asset_type === "string" &&
21541
+ VALID_ASSET_TYPES.has(asset.asset_type) &&
21542
+ asset.asset_type !== StellarHorizonAssetType.NATIVE &&
21543
+ "asset_code" in asset &&
21544
+ typeof asset.asset_code === "string" &&
21545
+ "asset_issuer" in asset &&
21546
+ typeof asset.asset_issuer === "string" &&
21547
+ "limit" in asset &&
21548
+ typeof asset.limit === "string");
21549
+ }
21550
+ function isValidHorizonAsset(asset) {
21551
+ return isValidNativeAsset(asset) || isValidIssuedAsset(asset);
21552
+ }
21142
21553
 
21143
21554
  const SUI_FEATURES = ["sui:signTransaction"];
21144
21555
  function isSuiStandardWallet(wallet) {
@@ -21906,285 +22317,6 @@ async function getXummClient() {
21906
22317
  return xummClient;
21907
22318
  }
21908
22319
 
21909
- const getQueryHeaders = (integratorId, requestId) => {
21910
- return {
21911
- ...(integratorId ? { "X-Integrator-Id": integratorId } : {}),
21912
- ...(requestId ? { "X-Request-Id": requestId } : {}),
21913
- };
21914
- };
21915
- const getStatusCode = (error) => {
21916
- if (axios.isAxiosError(error)) {
21917
- return error.response?.status;
21918
- }
21919
- return undefined;
21920
- };
21921
- const is404Error = (error) => {
21922
- const statusCode = getStatusCode(error);
21923
- if (statusCode === 404) {
21924
- return true;
21925
- }
21926
- return false;
21927
- };
21928
-
21929
- exports.HistoryTxType = void 0;
21930
- (function (HistoryTxType) {
21931
- HistoryTxType[HistoryTxType["SWAP"] = 0] = "SWAP";
21932
- HistoryTxType[HistoryTxType["BUY"] = 1] = "BUY";
21933
- HistoryTxType[HistoryTxType["SEND"] = 2] = "SEND";
21934
- })(exports.HistoryTxType || (exports.HistoryTxType = {}));
21935
-
21936
- var TransactionType;
21937
- (function (TransactionType) {
21938
- TransactionType["BRIDGE"] = "BRIDGE";
21939
- TransactionType["BRIDGE_CALL"] = "BRIDGE_CALL";
21940
- TransactionType["CALL_BRIDGE"] = "CALL_BRIDGE";
21941
- TransactionType["CALL_BRIDGE_CALL"] = "CALL_BRIDGE_CALL";
21942
- })(TransactionType || (TransactionType = {}));
21943
- exports.AxelarStatusResponseType = void 0;
21944
- (function (AxelarStatusResponseType) {
21945
- AxelarStatusResponseType["GAS_PAID_NOT_ENOUGH_GAS"] = "gas_paid_not_enough_gas";
21946
- AxelarStatusResponseType["DESTINATION_EXECUTED"] = "destination_executed";
21947
- AxelarStatusResponseType["EXPRESS_EXECUTED"] = "express_executed";
21948
- AxelarStatusResponseType["CROSS_MULTICALL_EXECUTED"] = "CrossMulticallExecuted";
21949
- AxelarStatusResponseType["CROSS_MULTICALL_FAILED"] = "CrossMulticallFailed";
21950
- AxelarStatusResponseType["SRC_GATEWAY_CALLED"] = "source_gateway_called";
21951
- AxelarStatusResponseType["DEST_GATEWAY_APPROVED"] = "destination_gateway_approved";
21952
- AxelarStatusResponseType["DESTINATION_EXECUTE_ERROR"] = "destination_execute_error";
21953
- AxelarStatusResponseType["DESTINATION_EXECUTING"] = "executing";
21954
- AxelarStatusResponseType["UNKNOWN_ERROR"] = "unknown_error";
21955
- AxelarStatusResponseType["CANNOT_FETCH_STATUS"] = "cannot_fetch_status";
21956
- AxelarStatusResponseType["ERROR"] = "error";
21957
- })(exports.AxelarStatusResponseType || (exports.AxelarStatusResponseType = {}));
21958
- exports.TransactionStatus = void 0;
21959
- (function (TransactionStatus) {
21960
- // Submitted transaction, returned by squid axelar
21961
- TransactionStatus["SUCCESS"] = "success";
21962
- TransactionStatus["NEEDS_GAS"] = "needs_gas";
21963
- TransactionStatus["ONGOING"] = "ongoing";
21964
- TransactionStatus["PARTIAL_SUCCESS"] = "partial_success";
21965
- TransactionStatus["NOT_FOUND"] = "not_found";
21966
- // Unsubmitted Transaction, can be status from wallet
21967
- TransactionStatus["INITIAL_LOADING"] = "initialLoading";
21968
- TransactionStatus["GENERATING_DEPOSIT"] = "generating_deposit";
21969
- TransactionStatus["ERROR"] = "error";
21970
- TransactionStatus["WARNING"] = "warning";
21971
- TransactionStatus["PENDING"] = "pending";
21972
- TransactionStatus["REJECTED"] = "rejected";
21973
- // Coral refund
21974
- TransactionStatus["REFUNDED"] = "refunded";
21975
- })(exports.TransactionStatus || (exports.TransactionStatus = {}));
21976
- exports.SendTransactionStatus = void 0;
21977
- (function (SendTransactionStatus) {
21978
- SendTransactionStatus[SendTransactionStatus["ONGOING"] = 0] = "ONGOING";
21979
- SendTransactionStatus[SendTransactionStatus["SUCCESS"] = 1] = "SUCCESS";
21980
- SendTransactionStatus[SendTransactionStatus["ERROR"] = 2] = "ERROR";
21981
- })(exports.SendTransactionStatus || (exports.SendTransactionStatus = {}));
21982
-
21983
- const formatTransactionHistoryDate = (transaction) => {
21984
- if (!transaction?.timestamp)
21985
- return undefined;
21986
- try {
21987
- const date = new Date(Number(transaction.timestamp));
21988
- // Format date to: MMM DD. Examples:
21989
- // Jan 01
21990
- // May 12
21991
- const month = new Intl.DateTimeFormat(DEFAULT_LOCALE, {
21992
- month: "short",
21993
- }).format(date);
21994
- const day = date.toLocaleString(DEFAULT_LOCALE, { day: "2-digit" });
21995
- return { month, day };
21996
- }
21997
- catch (error) {
21998
- console.error("Error formatting date:", error);
21999
- return undefined;
22000
- }
22001
- };
22002
- const getAxelarExplorerTxUrl = (urlPrefix, routeType, txID) => {
22003
- if (!urlPrefix) {
22004
- return undefined;
22005
- }
22006
- const txType = routeType ?? TransactionType.BRIDGE;
22007
- if (txType === TransactionType.CALL_BRIDGE ||
22008
- txType === TransactionType.BRIDGE) {
22009
- return `${urlPrefix}transfer/${txID}`;
22010
- }
22011
- return `${urlPrefix}gmp/${txID}`;
22012
- };
22013
- const getSourceExplorerTxUrl = (chain, txID) => {
22014
- if (!chain || !chain.blockExplorerUrls[0] || !txID) {
22015
- return undefined;
22016
- }
22017
- let txSuffix;
22018
- switch (chain.chainId) {
22019
- case CHAIN_IDS.AGORIC:
22020
- case CHAIN_IDS.XRPL:
22021
- case CHAIN_IDS.XRPL_TESTNET:
22022
- txSuffix = "/transactions/";
22023
- break;
22024
- default:
22025
- txSuffix = "/tx/";
22026
- }
22027
- if (chain.blockExplorerUrls[0].endsWith("/")) {
22028
- txSuffix = txSuffix.slice(1);
22029
- }
22030
- return `${chain.blockExplorerUrls[0]}${txSuffix}${txID}`;
22031
- };
22032
- const getMainExplorerUrl = (transaction) => {
22033
- // The most accurate one is coming from squid /status api
22034
- if (transaction?.statusResponse?.axelarTransactionUrl) {
22035
- return transaction?.statusResponse.axelarTransactionUrl;
22036
- }
22037
- // If not, we can try to get it from the source chain
22038
- if (transaction?.sourceTxExplorerUrl) {
22039
- return transaction?.sourceTxExplorerUrl;
22040
- }
22041
- // If not, we can try to guess it from the transaction type
22042
- if (transaction && transaction?.transactionId) {
22043
- return getAxelarExplorerTxUrl(transaction.statusResponse?.axelarTransactionUrl, transaction.routeType, transaction.transactionId);
22044
- }
22045
- return undefined;
22046
- };
22047
- const formatDistance = (date, baseDate, options) => {
22048
- const { includeSeconds = false, addSuffix = false, locale = { locale: DEFAULT_LOCALE }, } = options || {};
22049
- const elapsedMilliseconds = Math.abs(new Date(date).getTime() - new Date(baseDate).getTime());
22050
- const seconds = Math.round(elapsedMilliseconds / 1000);
22051
- const minutes = Math.round(seconds / 60);
22052
- const hours = Math.round(minutes / 60);
22053
- const days = Math.round(hours / 24);
22054
- const months = Math.round(days / 30.44);
22055
- const years = Math.round(days / 365.25);
22056
- const rtf = new Intl.RelativeTimeFormat(locale.locale, { numeric: "auto" });
22057
- let formatted = "";
22058
- if (includeSeconds && seconds < 45) {
22059
- const unit = addSuffix ? "second" : "seconds";
22060
- formatted = rtf.format(-seconds, unit);
22061
- }
22062
- else if (minutes < 60) {
22063
- formatted = rtf.format(-minutes, "minutes");
22064
- }
22065
- else if (hours < 24) {
22066
- formatted = rtf.format(-hours, "hours");
22067
- }
22068
- else if (days < 30) {
22069
- formatted = rtf.format(-days, "days");
22070
- }
22071
- else if (months < 12) {
22072
- formatted = rtf.format(-months, "months");
22073
- }
22074
- else {
22075
- formatted = rtf.format(-years, "years");
22076
- }
22077
- // remove "ago" from the string
22078
- // before: "2 minutes ago"
22079
- // after: "2 minutes"
22080
- return addSuffix ? formatted : formatted.replace(/\b(?:ago)\b/, "").trim();
22081
- };
22082
- const formatSeconds = (seconds, secondsTemplate = "s", minutesTemplate = "m", hoursTemplate = "h") => {
22083
- let duration = "";
22084
- if (seconds < 60) {
22085
- duration = `${seconds.toString()}${secondsTemplate}`;
22086
- }
22087
- else {
22088
- duration = formatDistance(0, seconds * 1000, { includeSeconds: true });
22089
- }
22090
- const result = duration.startsWith("1 ")
22091
- ? duration
22092
- .replace(" minute", minutesTemplate)
22093
- .replace(" hour", hoursTemplate)
22094
- : duration
22095
- .replace(" minutes", minutesTemplate)
22096
- .replace(" hours", hoursTemplate);
22097
- return result;
22098
- };
22099
- /**
22100
- * Remove the chainData from statusResponse to gain some storage space
22101
- */
22102
- const formatSwapTxStatusResponseForStorage = (sr) => {
22103
- if (!sr) {
22104
- return sr;
22105
- }
22106
- return {
22107
- axelarTransactionUrl: sr.axelarTransactionUrl,
22108
- toChain: sr.toChain?.transactionUrl
22109
- ? {
22110
- transactionUrl: sr.toChain?.transactionUrl,
22111
- }
22112
- : undefined,
22113
- };
22114
- };
22115
- const simplifyRouteAction = (action) => {
22116
- return {
22117
- type: action.type,
22118
- provider: action.provider,
22119
- data: {
22120
- type: action.data?.type,
22121
- },
22122
- ...(action.coralV2Order ? { isCoralV2: true } : undefined),
22123
- };
22124
- };
22125
- const fetchSwapTransactionStatus = async ({ transaction, integratorId, apiUrl, }) => {
22126
- const statusEndpoint = `${apiUrl}/v2/status`;
22127
- try {
22128
- const response = await axios.get(statusEndpoint, {
22129
- params: {
22130
- transactionId: transaction?.transactionIdForStatus ?? transaction?.transactionId,
22131
- fromChainId: transaction?.fromChain,
22132
- toChainId: transaction?.toChain,
22133
- bridgeType: transaction?.bridgeType,
22134
- quoteId: transaction?.quoteId,
22135
- },
22136
- headers: getQueryHeaders(integratorId, transaction?.quoteId),
22137
- });
22138
- return response.data;
22139
- }
22140
- catch (error) {
22141
- if (error) {
22142
- throw new Error("Fetch transaction status failed", { cause: error });
22143
- }
22144
- throw new Error("Fetch transaction status failed", { cause: undefined });
22145
- }
22146
- };
22147
- const compareTransactionIds = (idA, idB) => {
22148
- if (!idA || !idB) {
22149
- return false;
22150
- }
22151
- const normalizedA = idA.toLowerCase();
22152
- const normalizedB = idB.toLowerCase();
22153
- return normalizedA.includes(normalizedB) || normalizedB.includes(normalizedA);
22154
- };
22155
- /**
22156
- * Checks if the provided action is Coral bridge action
22157
- */
22158
- function isCoralBridgeAction(action) {
22159
- return (action.type === squidTypes.ActionType.RFQ &&
22160
- // TODO: update types
22161
- action.provider?.toLowerCase() === "coral");
22162
- }
22163
- function sleep(ms) {
22164
- return new Promise((resolve) => setTimeout(resolve, ms));
22165
- }
22166
- const isDepositRoute = (route) => {
22167
- return (!!route &&
22168
- route.transactionRequest?.type === squidTypes.SquidDataType.ChainflipDepositAddress);
22169
- };
22170
- /**
22171
- * Checks if the route contains a Chainflip bridge action
22172
- */
22173
- function isChainflipBridgeTransaction(actions = []) {
22174
- return actions.some((action) => action.type === squidTypes.ActionType.BRIDGE &&
22175
- action.data?.type === squidTypes.BridgeType.CHAINFLIP);
22176
- }
22177
- function getHistoryTransactionId(tx) {
22178
- switch (tx.txType) {
22179
- case exports.HistoryTxType.SWAP:
22180
- return tx.data.transactionId;
22181
- case exports.HistoryTxType.BUY:
22182
- return tx.data.orderId;
22183
- case exports.HistoryTxType.SEND:
22184
- return tx.data.hash;
22185
- }
22186
- }
22187
-
22188
22320
  exports.QueryKeys = void 0;
22189
22321
  (function (QueryKeys) {
22190
22322
  QueryKeys["All"] = "all";
@@ -22217,6 +22349,8 @@ exports.QueryKeys = void 0;
22217
22349
  QueryKeys["XrplAccountActivatedInfo"] = "xrplAccountActivatedInfo";
22218
22350
  QueryKeys["FiatToCryptoPaymentMethods"] = "fiatToCryptoPaymentMethods";
22219
22351
  QueryKeys["Stellar"] = "stellar";
22352
+ QueryKeys["StellarTrustLine"] = "stellarTrustLine";
22353
+ QueryKeys["IsStellarTrustLineApproved"] = "isStellarTrustLineApproved";
22220
22354
  QueryKeys["StellarAccountActivatedInfo"] = "stellarAccountActivatedInfo";
22221
22355
  QueryKeys["Hedera"] = "hedera";
22222
22356
  QueryKeys["IsHederaTokenAssociated"] = "isHederaTokenAssociated";
@@ -22324,7 +22458,7 @@ const keys = () => ({
22324
22458
  // ============
22325
22459
  // Approval
22326
22460
  // ============
22327
- routeApproved: (routeData, allowanceInWei) => [
22461
+ routeApproved: (routeData, allowanceInWei, isAllowanceQueryEnabled, hasAllowance) => [
22328
22462
  ...keys().transactions(),
22329
22463
  exports.QueryKeys.RouteApproved,
22330
22464
  routeData?.params.fromAddress,
@@ -22332,6 +22466,8 @@ const keys = () => ({
22332
22466
  routeData?.params.fromToken,
22333
22467
  routeData?.params.fromAmount,
22334
22468
  allowanceInWei?.toString(),
22469
+ isAllowanceQueryEnabled,
22470
+ hasAllowance,
22335
22471
  ],
22336
22472
  sendTransactionGas: (chainId, tokenAddress, from) => [
22337
22473
  exports.QueryKeys.All,
@@ -22404,6 +22540,23 @@ const keys = () => ({
22404
22540
  // ============
22405
22541
  // Stellar
22406
22542
  // ============
22543
+ stellarTrustLine: (tokenAddress, chainId, address) => [
22544
+ ...keys().stellar(),
22545
+ exports.QueryKeys.StellarTrustLine,
22546
+ tokenAddress,
22547
+ chainId,
22548
+ address,
22549
+ ],
22550
+ isStellarTrustLineApproved: (address, chainId, chainType, tokenAddress, trustLineLimit, amountToApprove) => [
22551
+ ...keys().stellar(),
22552
+ exports.QueryKeys.IsStellarTrustLineApproved,
22553
+ address,
22554
+ chainId,
22555
+ chainType,
22556
+ tokenAddress,
22557
+ trustLineLimit,
22558
+ amountToApprove?.toString(),
22559
+ ],
22407
22560
  stellarAccountActivatedInfo: (address, chainId, chainType) => [
22408
22561
  ...keys().stellar(),
22409
22562
  exports.QueryKeys.StellarAccountActivatedInfo,
@@ -22439,6 +22592,8 @@ const getPrefixKey = (key) => {
22439
22592
  return [...keys().transactions(), key];
22440
22593
  case exports.QueryKeys.XrplTrustLine:
22441
22594
  return [...keys().xrpl(), key];
22595
+ case exports.QueryKeys.StellarTrustLine:
22596
+ return [...keys().stellar(), key];
22442
22597
  case exports.QueryKeys.IsHederaTokenAssociated:
22443
22598
  return [...keys().hedera(), key];
22444
22599
  default:
@@ -23153,7 +23308,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23153
23308
  };
23154
23309
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23155
23310
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23156
- const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-B_-XWo1F.js'); });
23311
+ const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-BEEQh-7r.js'); });
23157
23312
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23158
23313
  };
23159
23314
  function getTokenAssetsKey(token) {
@@ -24626,6 +24781,25 @@ function convertEvmAddressToHederaAccountId(address) {
24626
24781
  return "0.0." + Number(address);
24627
24782
  }
24628
24783
 
24784
+ /**
24785
+ * Return the expiry of a route in milliseconds
24786
+ *
24787
+ * @param route - Squid route
24788
+ * @returns expiry in milliseconds
24789
+ */
24790
+ function getRouteExpiry(route) {
24791
+ if (!route?.transactionRequest)
24792
+ return DEFAULT_ROUTE_REFETCH_INTERVAL;
24793
+ if (!isOnChainTxData(route.transactionRequest)) {
24794
+ return DEFAULT_ROUTE_REFETCH_INTERVAL;
24795
+ }
24796
+ const { expiryOffset } = route.transactionRequest;
24797
+ if (expiryOffset != null && Number(expiryOffset) >= 0) {
24798
+ return Number(expiryOffset) * 1_000;
24799
+ }
24800
+ return DEFAULT_ROUTE_REFETCH_INTERVAL;
24801
+ }
24802
+
24629
24803
  /**
24630
24804
  * Minimum length of a search query to search by address
24631
24805
  * Some tokens can have very short addresses (e.g. "uosmo", "uixo", "satoshi", etc...)
@@ -26438,7 +26612,7 @@ function useStellarWallets() {
26438
26612
  try {
26439
26613
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26440
26614
  const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module');
26441
- const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-sRzC5VSD.js'); });
26615
+ const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-Dl_XfhX_.js'); });
26442
26616
  const modules = [...initializeAllModules(), new LedgerModule()];
26443
26617
  const promises = modules.map(async (module) => {
26444
26618
  const isAvailable = await module.isAvailable();
@@ -27938,7 +28112,7 @@ function hederaWalletConnect(parameters) {
27938
28112
  const optionalChains = config.chains.map((x) => x.id);
27939
28113
  if (!optionalChains.length)
27940
28114
  return;
27941
- const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-Cu_QQTg-.js'); });
28115
+ const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-CtYD1WrB.js'); });
27942
28116
  const rawProvider = await EthereumProvider.init({
27943
28117
  ...restParameters,
27944
28118
  disableProviderPing: true,
@@ -29301,12 +29475,15 @@ const getAllXrplTokensBalance = async (userAddress, xrplTokens, xrplChains) => {
29301
29475
  };
29302
29476
  const getStellarTokenBalance = async (userAddress, token, chain) => {
29303
29477
  const stellarClient = await getClient(chain);
29304
- const balance = await stellarClient.getBalance(userAddress, token.address, chain.chainId);
29478
+ if (!isStellarToken(token)) {
29479
+ throw new Error("Token must be a Stellar token");
29480
+ }
29481
+ const balance = await stellarClient.getBalance(userAddress, token.chainAssetConfig.stellar.contractAddress, chain.chainId);
29305
29482
  return BigInt(balance);
29306
29483
  };
29307
29484
  const getAllStellarTokensBalance = async (userAddress, stellarTokens, stellarChains) => {
29308
29485
  const getBalancesForChain = async (chain) => {
29309
- const tokensForChain = stellarTokens.filter((t) => t.chainId === chain.chainId);
29486
+ const tokensForChain = stellarTokens.filter((t) => t.chainId === chain.chainId && isStellarToken(t));
29310
29487
  const stellarClient = await getClient(chain);
29311
29488
  const allBalances = await stellarClient.getAllBalances(userAddress, tokensForChain);
29312
29489
  return allBalances.map((token) => {
@@ -29361,7 +29538,7 @@ class StellarRpcClient {
29361
29538
  .build();
29362
29539
  const simulateTxResponse = await this.server.simulateTransaction(tx);
29363
29540
  if ("error" in simulateTxResponse) {
29364
- const isNoBalanceError = simulateTxResponse.error.includes("trying to get non-existing value for contract instance");
29541
+ const isNoBalanceError = /trying to get non-existing value for contract instance|trustline entry is missing for account/.test(simulateTxResponse.error);
29365
29542
  // If the error message indicates that the user has no balance just return 0
29366
29543
  // We don't want to spam with this error as it's pretty common
29367
29544
  if (isNoBalanceError) {
@@ -29377,7 +29554,7 @@ class StellarRpcClient {
29377
29554
  }
29378
29555
  async getAllBalances(userAddress, tokens) {
29379
29556
  const balancePromises = tokens.map((token) => {
29380
- return this.getBalance(userAddress, token.address, token.chainId);
29557
+ return this.getBalance(userAddress, token.chainAssetConfig.stellar.contractAddress, token.chainId);
29381
29558
  });
29382
29559
  const results = await Promise.allSettled(balancePromises);
29383
29560
  const balances = results.map((result) => {
@@ -29477,9 +29654,9 @@ class XrplRpcClient {
29477
29654
  },
29478
29655
  ]);
29479
29656
  }
29480
- async getTrustLine(address, issuer, currency) {
29481
- const response = await this.getTrustLines(address, issuer);
29482
- const trustLine = response.lines.find((line) => line.currency === currency);
29657
+ async getTrustLine(address, asset) {
29658
+ const response = await this.getTrustLines(address, asset.issuer);
29659
+ const trustLine = response.lines.find((line) => line.currency === asset.code);
29483
29660
  return trustLine ?? null;
29484
29661
  }
29485
29662
  async accountActivatedInfo(address) {
@@ -29655,9 +29832,26 @@ class StellarApiClient {
29655
29832
  const baseReserveBn = BigInt(latestLedger.base_reserve_in_stroops);
29656
29833
  return baseReserveBn;
29657
29834
  }
29835
+ async getTrustLines(userAddress) {
29836
+ const response = await fetch(`${this.apiUrl}/accounts/${userAddress}`);
29837
+ if (!response.ok) {
29838
+ throw new Error(`Failed to fetch account data: ${response.statusText}`);
29839
+ }
29840
+ const data = await response.json();
29841
+ if (!Array.isArray(data?.balances)) {
29842
+ throw new Error("Invalid response from Horizon API");
29843
+ }
29844
+ const assets = data.balances.filter(isValidHorizonAsset);
29845
+ return assets.filter(isValidIssuedAsset);
29846
+ }
29847
+ async getTrustLine(address, asset) {
29848
+ const trustLines = await this.getTrustLines(address);
29849
+ const trustLine = trustLines.find((line) => line.asset_code === asset.code && line.asset_issuer === asset.issuer);
29850
+ return trustLine ?? null;
29851
+ }
29658
29852
  }
29659
29853
 
29660
- const DEFAULT_REFETCH_INTERVAL$1 = 20_000;
29854
+ const DEFAULT_REFETCH_INTERVAL$2 = 20_000;
29661
29855
  function useStellarAccountActivation({ address, chain, token, }) {
29662
29856
  /**
29663
29857
  * Checks if the destination account exists on the Stellar network
@@ -29673,9 +29867,8 @@ function useStellarAccountActivation({ address, chain, token, }) {
29673
29867
  if (!address) {
29674
29868
  throw new Error("Destination address is required");
29675
29869
  }
29676
- // TODO: update types
29677
- const [horizonApiUrl] = chain?.horizonRpcList;
29678
- if (typeof horizonApiUrl !== "string") {
29870
+ const horizonApiUrl = getStellarHorizonApiUrl(chain);
29871
+ if (!horizonApiUrl) {
29679
29872
  throw new Error("Invalid Horizon API URL");
29680
29873
  }
29681
29874
  const stellarApiClient = new StellarApiClient(horizonApiUrl);
@@ -29691,7 +29884,7 @@ function useStellarAccountActivation({ address, chain, token, }) {
29691
29884
  };
29692
29885
  },
29693
29886
  enabled: !!address && chain?.chainType === squidTypes.ChainType.STELLAR,
29694
- refetchInterval: DEFAULT_REFETCH_INTERVAL$1,
29887
+ refetchInterval: DEFAULT_REFETCH_INTERVAL$2,
29695
29888
  refetchOnWindowFocus: true,
29696
29889
  });
29697
29890
  return {
@@ -29699,6 +29892,149 @@ function useStellarAccountActivation({ address, chain, token, }) {
29699
29892
  };
29700
29893
  }
29701
29894
 
29895
+ /**
29896
+ * Maximum asset amount on Stellar
29897
+ * @see https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/assets#amount-precision
29898
+ */
29899
+ const MAX_ASSET_AMOUNT = "922337203685.4775807";
29900
+ const DEFAULT_REFETCH_INTERVAL$1 = 20_000;
29901
+ function useStellarTrustLine({ address, chain, token, amount }) {
29902
+ const { stellarSigner } = useSigner({ chain });
29903
+ const queryClient = reactQuery.useQueryClient();
29904
+ /**
29905
+ * Retrieves the destination account's trust line data for the given token
29906
+ */
29907
+ const trustLineQuery = reactQuery.useQuery({
29908
+ queryKey: keys().stellarTrustLine(token?.address, chain?.chainId, address),
29909
+ queryFn: async () => {
29910
+ if (chain?.chainType !== squidTypes.ChainType.STELLAR ||
29911
+ token?.type !== squidTypes.ChainType.STELLAR) {
29912
+ return null;
29913
+ }
29914
+ if (!address || !isStellarAddressValid(address)) {
29915
+ return null;
29916
+ }
29917
+ // Only issued tokens require trust lines
29918
+ // Other token types like contract tokens don't need trust lines
29919
+ if (!isStellarIssuedToken(token)) {
29920
+ return null;
29921
+ }
29922
+ const asset = getStellarTrustLineAsset(token);
29923
+ if (!asset) {
29924
+ throw new Error("Invalid asset");
29925
+ }
29926
+ const horizonApiUrl = getStellarHorizonApiUrl(chain);
29927
+ if (!horizonApiUrl) {
29928
+ throw new Error("Invalid Horizon API URL");
29929
+ }
29930
+ const stellarApiClient = new StellarApiClient(horizonApiUrl);
29931
+ return stellarApiClient.getTrustLine(address, asset);
29932
+ },
29933
+ enabled: !!address &&
29934
+ chain?.chainType === squidTypes.ChainType.STELLAR &&
29935
+ token?.type === squidTypes.ChainType.STELLAR,
29936
+ refetchInterval: DEFAULT_REFETCH_INTERVAL$1,
29937
+ });
29938
+ /**
29939
+ * Creates a trust line where the destination account authorizes to receive the given token
29940
+ */
29941
+ const createTrustLine = reactQuery.useMutation({
29942
+ mutationFn: async () => {
29943
+ try {
29944
+ if (!stellarSigner) {
29945
+ throw new Error("Stellar signer not found");
29946
+ }
29947
+ if (!address) {
29948
+ throw new Error("Destination address is required");
29949
+ }
29950
+ if (chain?.chainType !== squidTypes.ChainType.STELLAR ||
29951
+ token?.type !== squidTypes.ChainType.STELLAR) {
29952
+ throw new Error("Chain and token to approve must be a Stellar token");
29953
+ }
29954
+ if (!isStellarIssuedToken(token)) {
29955
+ throw new Error("Token must be a Stellar issued token");
29956
+ }
29957
+ const assetInfo = getStellarTrustLineAsset(token);
29958
+ if (!assetInfo) {
29959
+ throw new Error("Invalid asset");
29960
+ }
29961
+ const network = getStellarNetwork(chain.chainId);
29962
+ if (network == null) {
29963
+ throw new Error(`Stellar network not found for chain ${chain.chainId}`);
29964
+ }
29965
+ const client = await getClient(chain);
29966
+ const account = await client.getAccount(address);
29967
+ const asset = new stellarSdk.Asset(assetInfo.code, assetInfo.issuer);
29968
+ const changeTrustOperation = stellarSdk.Operation.changeTrust({
29969
+ asset,
29970
+ limit: MAX_ASSET_AMOUNT,
29971
+ });
29972
+ const builtTransaction = new stellarSdk.TransactionBuilder(account, {
29973
+ fee: (BigInt(stellarSdk.BASE_FEE) * BigInt(2)).toString(),
29974
+ networkPassphrase: network,
29975
+ })
29976
+ .addOperation(changeTrustOperation)
29977
+ .setTimeout(300)
29978
+ .build();
29979
+ const { signedTxXdr } = await stellarSigner.signTransaction(builtTransaction.toXDR(), {
29980
+ networkPassphrase: network,
29981
+ });
29982
+ const signedTransaction = new stellarSdk.Transaction(signedTxXdr, network);
29983
+ const sentTransaction = await client.sendTransaction(signedTransaction);
29984
+ const txStatus = await client.waitForTransaction(sentTransaction.hash, {
29985
+ interval: 1_000,
29986
+ });
29987
+ if (txStatus !== stellarSdk.rpc.Api.GetTransactionStatus.SUCCESS) {
29988
+ throw new Error(`Transaction failed with status: ${txStatus}`);
29989
+ }
29990
+ return true;
29991
+ }
29992
+ catch (error) {
29993
+ console.error("Error creating trust line:", error);
29994
+ return false;
29995
+ }
29996
+ },
29997
+ async onSuccess() {
29998
+ queryClient.invalidateQueries({
29999
+ queryKey: getPrefixKey(exports.QueryKeys.StellarTrustLine),
30000
+ });
30001
+ },
30002
+ });
30003
+ /**
30004
+ * Checks if the destination account has created a trust line to receive the given token.
30005
+ */
30006
+ const isTrustLineApproved = reactQuery.useQuery({
30007
+ queryKey: keys().isStellarTrustLineApproved(address, token?.chainId, token?.type, token?.address, trustLineQuery.data?.limit, amount),
30008
+ queryFn: async () => {
30009
+ if (token?.type !== squidTypes.ChainType.STELLAR) {
30010
+ return true;
30011
+ }
30012
+ // The native Stellar token doesn't need a trust line
30013
+ if (token.address.toLowerCase() === nativeStellarTokenAddress.toLowerCase()) {
30014
+ return true;
30015
+ }
30016
+ if (!amount) {
30017
+ throw new Error("Amount is required");
30018
+ }
30019
+ const limitBn = BigNumber(trustLineQuery.data?.limit || "0");
30020
+ const balanceBn = BigNumber(trustLineQuery.data?.balance || "0");
30021
+ const availableAllowanceBn = limitBn.minus(balanceBn);
30022
+ const amountBn = BigNumber(formatBNToReadable(amount, token.decimals));
30023
+ return availableAllowanceBn.gte(amountBn);
30024
+ },
30025
+ enabled: !!address &&
30026
+ !!amount &&
30027
+ !trustLineQuery?.isLoading &&
30028
+ trustLineQuery?.isFetched &&
30029
+ token?.type === squidTypes.ChainType.STELLAR,
30030
+ });
30031
+ return {
30032
+ createTrustLine,
30033
+ trustLineQuery,
30034
+ isTrustLineApproved,
30035
+ };
30036
+ }
30037
+
29702
30038
  const useAddressBookStore = zustand.create(middleware.persist((set) => ({
29703
30039
  addressBook: [],
29704
30040
  add: (newAddressData) => {
@@ -31321,15 +31657,18 @@ async function sendTransactionXrpl({ amount, signer, to, token, from, }) {
31321
31657
  txHash: hash,
31322
31658
  };
31323
31659
  }
31324
- const [currency, issuer] = token.address.split(".");
31660
+ const asset = parseXrplTokenAddress(token.address);
31661
+ if (!asset) {
31662
+ throw new Error("Invalid asset");
31663
+ }
31325
31664
  const amountFormatted = formatBNToReadable(amount, token.decimals);
31326
31665
  const { hash } = await signer.signAndSubmit({
31327
31666
  network: xrplNetwork,
31328
31667
  tx: {
31329
31668
  ...baseTransaction,
31330
31669
  Amount: {
31331
- currency,
31332
- issuer,
31670
+ currency: asset.code,
31671
+ issuer: asset.issuer,
31333
31672
  value: amountFormatted,
31334
31673
  },
31335
31674
  },
@@ -31993,7 +32332,12 @@ const useErc20Allowance = ({ tokenAddress, ownerAddress, spenderAddress, amount
31993
32332
  const parsedOwnerAddress = parseEvmAddress(ownerAddress);
31994
32333
  const parsedSpenderAddress = parseEvmAddress(spenderAddress);
31995
32334
  const isNativeToken = parsedTokenAddress?.toLowerCase() === nativeEvmTokenAddress.toLowerCase();
31996
- const isDepositAddressTx = transactionType === squidTypes.SquidDataType.DepositAddressCalldata;
32335
+ const isDepositAddressTx = !!transactionType &&
32336
+ [
32337
+ squidTypes.SquidDataType.DepositAddressCalldata,
32338
+ squidTypes.SquidDataType.DepositAddressWithSignature,
32339
+ squidTypes.SquidDataType.DepositAddressWithMemo,
32340
+ ].includes(transactionType);
31997
32341
  const result = wagmi.useReadContract({
31998
32342
  abi: viem.erc20Abi,
31999
32343
  address: parsedTokenAddress ?? undefined,
@@ -32062,7 +32406,7 @@ const useApproval = ({ squidRoute, }) => {
32062
32406
  * On Error: Showing the error message if any
32063
32407
  * @returns {boolean} approved
32064
32408
  */
32065
- const routeApproved = reactQuery.useQuery(keys().routeApproved(squidRoute, allowanceInWei), async () => {
32409
+ const routeApproved = reactQuery.useQuery(keys().routeApproved(squidRoute, allowanceInWei, erc20AllowanceQueryEnabled, hasAllowance), async () => {
32066
32410
  if (erc20AllowanceQueryEnabled) {
32067
32411
  return hasAllowance;
32068
32412
  }
@@ -35283,7 +35627,9 @@ const useExecuteTransaction = (squidRoute) => {
35283
35627
  if (!route?.transactionRequest)
35284
35628
  return undefined;
35285
35629
  const { quoteId } = route;
35630
+ const currentTx = getTransaction(id);
35286
35631
  const tx = {
35632
+ ...currentTx,
35287
35633
  fromChain,
35288
35634
  toChain,
35289
35635
  routeType: route.transactionRequest.type,
@@ -35301,7 +35647,7 @@ const useExecuteTransaction = (squidRoute) => {
35301
35647
  };
35302
35648
  setTransactionStoreState(id, tx);
35303
35649
  return tx;
35304
- }, [fromChain, setTransactionStoreState, toChain]);
35650
+ }, [fromChain, toChain, setTransactionStoreState, getTransaction]);
35305
35651
  const getCosmosSignerClient = React.useCallback(async () => {
35306
35652
  if (!fromChain)
35307
35653
  return null;
@@ -35673,7 +36019,7 @@ const useExecuteTransaction = (squidRoute) => {
35673
36019
  if (!route?.transactionRequest || !xrplSigner) {
35674
36020
  throw new Error("Need all parameters");
35675
36021
  }
35676
- if (route.transactionRequest.type !== squidTypes.SquidDataType.OnChainExecution) {
36022
+ if (!isOnChainTxData(route.transactionRequest)) {
35677
36023
  throw new Error("Invalid route type");
35678
36024
  }
35679
36025
  const { data } = route.transactionRequest;
@@ -35709,10 +36055,10 @@ const useExecuteTransaction = (squidRoute) => {
35709
36055
  }
35710
36056
  }, {});
35711
36057
  const swapMutationSui = reactQuery.useMutation(async ({ id, route }) => {
35712
- if (!route || !suiSigner || !fromChain) {
36058
+ if (!route?.transactionRequest || !suiSigner || !fromChain) {
35713
36059
  throw new Error("Need all parameters");
35714
36060
  }
35715
- if (route.transactionRequest?.type !== squidTypes.SquidDataType.OnChainExecution) {
36061
+ if (!isOnChainTxData(route.transactionRequest)) {
35716
36062
  throw new Error("Invalid route type");
35717
36063
  }
35718
36064
  const suiWalletState = connectedWalletsByChainType[squidTypes.ChainType.SUI];
@@ -35763,28 +36109,56 @@ const useExecuteTransaction = (squidRoute) => {
35763
36109
  });
35764
36110
  }, {});
35765
36111
  const swapMutationStellar = reactQuery.useMutation(async ({ id, route }) => {
35766
- if (!stellarSigner || !route || !squid || !fromChain) {
36112
+ if (!stellarSigner ||
36113
+ !route?.transactionRequest ||
36114
+ !squid ||
36115
+ !fromChain) {
35767
36116
  throw new Error("Need all parameters");
35768
36117
  }
36118
+ if (!isOnChainTxData(route.transactionRequest)) {
36119
+ throw new Error("Invalid route type");
36120
+ }
35769
36121
  const fromChainId = route.params.fromChain;
35770
36122
  const stellarNetwork = getStellarNetwork(fromChainId);
35771
36123
  if (stellarNetwork == null) {
35772
36124
  throw new Error(`No Stellar network found for chainId ${fromChainId}`);
35773
36125
  }
35774
- const { data: xdrHex, gasPrice } = route.transactionRequest;
35775
- const { address } = await stellarSigner.getAddress();
35776
36126
  const client = await getClient(fromChain);
35777
- const account = await client.getAccount(address);
35778
- const operation = stellarSdk.xdr.Operation.fromXDR(xdrHex, "hex");
35779
- const builtTransaction = new stellarSdk.TransactionBuilder(account, {
35780
- fee: gasPrice || (BigInt(stellarSdk.BASE_FEE) * BigInt(2)).toString(),
35781
- networkPassphrase: stellarNetwork,
35782
- })
35783
- .addOperation(operation)
35784
- .setTimeout(300)
35785
- .build();
35786
- const preparedTransaction = await client.prepareTransaction(builtTransaction);
35787
- const { signedTxXdr } = await stellarSigner.signTransaction(preparedTransaction.toXDR(), {
36127
+ // TODO: at the moment we're receiving different formats depending on the route type.
36128
+ //
36129
+ // For OnChainExecution we get a single operation xdr string, so we need to build
36130
+ // a full transaction frontend-side (by adding the operation to a new transaction).
36131
+ //
36132
+ // For DepositAddressCalldata we get the full transaction xdr,
36133
+ // so we just need to send it to the wallet for signing.
36134
+ //
36135
+ // In the future this will be standardized backend-side so we have a unified flow for all route types.
36136
+ let txXdrToSign;
36137
+ if (route.transactionRequest.type === squidTypes.SquidDataType.OnChainExecution) {
36138
+ const { data: operationXdrHex, gasPrice } = route.transactionRequest;
36139
+ const { address } = await stellarSigner.getAddress();
36140
+ const account = await client.getAccount(address);
36141
+ const operation = stellarSdk.xdr.Operation.fromXDR(operationXdrHex, "hex");
36142
+ const builtTransaction = new stellarSdk.TransactionBuilder(account, {
36143
+ fee: gasPrice || (BigInt(stellarSdk.BASE_FEE) * BigInt(2)).toString(),
36144
+ networkPassphrase: stellarNetwork,
36145
+ })
36146
+ .addOperation(operation)
36147
+ .setTimeout(300)
36148
+ .build();
36149
+ // This is a smart-contract transaction, so it needs to be simulated first
36150
+ const preparedTransaction = await client.prepareTransaction(builtTransaction);
36151
+ txXdrToSign = preparedTransaction.toXDR();
36152
+ }
36153
+ else if (route.transactionRequest.type === squidTypes.SquidDataType.DepositAddressCalldata) {
36154
+ // For this route type, we get the full transaction xdr in the data field.
36155
+ // This is a payment transaction, so simulation must be skipped.
36156
+ txXdrToSign = route.transactionRequest.data;
36157
+ }
36158
+ else {
36159
+ throw new Error(`Invalid route type ${route.transactionRequest.type}`);
36160
+ }
36161
+ const { signedTxXdr } = await stellarSigner.signTransaction(txXdrToSign, {
35788
36162
  networkPassphrase: stellarNetwork,
35789
36163
  });
35790
36164
  const signedTransaction = new stellarSdk.Transaction(signedTxXdr, stellarNetwork);
@@ -35868,11 +36242,36 @@ const useExecuteTransaction = (squidRoute) => {
35868
36242
  squidRoute,
35869
36243
  ]);
35870
36244
  const swapMutation = reactQuery.useMutation(async (mutationParams) => {
35871
- if (!mutationParams.route)
35872
- throw new Error("route is required");
36245
+ if (!mutationParams.route?.transactionRequest) {
36246
+ throw new Error("Route is required");
36247
+ }
35873
36248
  const sourceChain = findChain(mutationParams.route.params?.fromChain);
35874
36249
  if (!sourceChain)
35875
36250
  throw new Error("Could not find source chain");
36251
+ // For deposit-with-signature routes, we need to prompt the user
36252
+ // for a signature before continuing the swap flow
36253
+ if (isDepositWithSignatureTxData(mutationParams.route.transactionRequest)) {
36254
+ if (!mutationParams.route.transactionRequest.signatureRequired) {
36255
+ throw new Error("Data to sign was empty");
36256
+ }
36257
+ switch (sourceChain.chainType) {
36258
+ case squidTypes.ChainType.EVM: {
36259
+ if (!evmSigner) {
36260
+ throw new Error("EVM signer is required");
36261
+ }
36262
+ const signature = await evmSigner.signMessage(mutationParams.route.transactionRequest.signatureRequired);
36263
+ const currentTx = getTransaction(mutationParams.id);
36264
+ setTransactionStoreState(mutationParams.id, {
36265
+ ...currentTx,
36266
+ depositTxVerificationSignature: signature,
36267
+ });
36268
+ break;
36269
+ }
36270
+ default:
36271
+ throw new Error(`deposit-with-signature flow not implemented for chain type: ${sourceChain.chainType}`);
36272
+ }
36273
+ }
36274
+ // After getting signature (if needed), continue with the swap flow
35876
36275
  switch (sourceChain.chainType) {
35877
36276
  case squidTypes.ChainType.COSMOS: {
35878
36277
  return swapMutationCosmos.mutateAsync(mutationParams);
@@ -36061,7 +36460,7 @@ const useGetRoute = () => {
36061
36460
  };
36062
36461
  const useGetRouteWrapper = ({ enabled, cacheTime = 5 * 60 * 1000, // 5 minutes
36063
36462
  staleTime = 60 * 1000, // 1 minute
36064
- refetchOnWindowFocus = (query) => Date.now() - query.state.dataUpdatedAt > 30000, // Update if older than 30 seconds, when window is focused
36463
+ refetchOnWindowFocus = (query) => Date.now() - query.state.dataUpdatedAt > DEFAULT_ROUTE_REFETCH_INTERVAL, // Update if older than default refetch interval, when window is focused
36065
36464
  refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true, }) => {
36066
36465
  const config = useConfigStore((state) => state.config);
36067
36466
  const squid = useSquidStore((state) => state.squid);
@@ -36570,12 +36969,12 @@ function useXrplTrustLine({ address, chain, token, amount }) {
36570
36969
  if (!address || !isXrplAddressValid(address)) {
36571
36970
  return null;
36572
36971
  }
36573
- const [currency, issuer] = token.address.split(".");
36574
- if (!currency || !issuer) {
36972
+ const trustLineAsset = parseXrplTokenAddress(token.address);
36973
+ if (!trustLineAsset) {
36575
36974
  return null;
36576
36975
  }
36577
36976
  const xrplClient = await getClient(chain);
36578
- const trustLine = await xrplClient.getTrustLine(address, issuer, currency);
36977
+ const trustLine = await xrplClient.getTrustLine(address, trustLineAsset);
36579
36978
  return trustLine;
36580
36979
  },
36581
36980
  enabled: !!address &&
@@ -36816,6 +37215,7 @@ const SquidProvider = ({ children, config, placeholder, }) => {
36816
37215
  exports.CHAIN_IDS = CHAIN_IDS;
36817
37216
  exports.CosmosProvider = CosmosProvider;
36818
37217
  exports.DEFAULT_LOCALE = DEFAULT_LOCALE;
37218
+ exports.DEFAULT_ROUTE_REFETCH_INTERVAL = DEFAULT_ROUTE_REFETCH_INTERVAL;
36819
37219
  exports.EnsService = EnsService;
36820
37220
  exports.EvmNetworkNotSupportedErrorCode = EvmNetworkNotSupportedErrorCode;
36821
37221
  exports.FINAL_TRANSACTION_STATUSES = FINAL_TRANSACTION_STATUSES;
@@ -36897,10 +37297,14 @@ exports.getMainExplorerUrl = getMainExplorerUrl;
36897
37297
  exports.getNewSwapParamsFromInput = getNewSwapParamsFromInput;
36898
37298
  exports.getNumericValue = getNumericValue;
36899
37299
  exports.getQueryHeaders = getQueryHeaders;
37300
+ exports.getRouteExpiry = getRouteExpiry;
36900
37301
  exports.getSecretNetworkBalances = getSecretNetworkBalances;
36901
37302
  exports.getSendTxStatusRefetchInterval = getSendTxStatusRefetchInterval;
36902
37303
  exports.getSourceExplorerTxUrl = getSourceExplorerTxUrl;
36903
37304
  exports.getStatusCode = getStatusCode;
37305
+ exports.getStellarHorizonApiUrl = getStellarHorizonApiUrl;
37306
+ exports.getStellarNetwork = getStellarNetwork;
37307
+ exports.getStellarTrustLineAsset = getStellarTrustLineAsset;
36904
37308
  exports.getStepStatuses = getStepStatuses;
36905
37309
  exports.getStepsInfos = getStepsInfos;
36906
37310
  exports.getSuggestedAmountsForCurrency = getSuggestedAmountsForCurrency;
@@ -36925,6 +37329,7 @@ exports.isChainflipBridgeTransaction = isChainflipBridgeTransaction;
36925
37329
  exports.isCoralBridgeAction = isCoralBridgeAction;
36926
37330
  exports.isCosmosAddressValid = isCosmosAddressValid;
36927
37331
  exports.isDepositRoute = isDepositRoute;
37332
+ exports.isDepositWithSignatureTxData = isDepositWithSignatureTxData;
36928
37333
  exports.isEmptyObject = isEmptyObject;
36929
37334
  exports.isEvmChainNotSupportedError = isEvmChainNotSupportedError;
36930
37335
  exports.isEvmosChain = isEvmosChain;
@@ -36933,11 +37338,17 @@ exports.isHistoryTransactionEnded = isHistoryTransactionEnded;
36933
37338
  exports.isHistoryTransactionFailed = isHistoryTransactionFailed;
36934
37339
  exports.isHistoryTransactionPending = isHistoryTransactionPending;
36935
37340
  exports.isHistoryTransactionWarning = isHistoryTransactionWarning;
37341
+ exports.isOnChainTxData = isOnChainTxData;
36936
37342
  exports.isProblematicConnector = isProblematicConnector;
36937
37343
  exports.isSolanaAddressValid = isSolanaAddressValid;
36938
37344
  exports.isStatusError = isStatusError;
37345
+ exports.isStellarAddressValid = isStellarAddressValid;
37346
+ exports.isStellarIssuedToken = isStellarIssuedToken;
37347
+ exports.isStellarToken = isStellarToken;
36939
37348
  exports.isSwapRouteError = isSwapRouteError;
36940
37349
  exports.isUserRejectionError = isUserRejectionError;
37350
+ exports.isValidHorizonAsset = isValidHorizonAsset;
37351
+ exports.isValidIssuedAsset = isValidIssuedAsset;
36941
37352
  exports.isWalletAddressValid = isWalletAddressValid;
36942
37353
  exports.isXamanXAppContext = isXamanXAppContext;
36943
37354
  exports.isXionSmartContractAddress = isXionSmartContractAddress;
@@ -36956,6 +37367,7 @@ exports.normalizeTokenSymbol = normalizeTokenSymbol;
36956
37367
  exports.parseEvmAddress = parseEvmAddress;
36957
37368
  exports.parseToBigInt = parseToBigInt;
36958
37369
  exports.parseXrplPaymentTx = parseXrplPaymentTx;
37370
+ exports.parseXrplTokenAddress = parseXrplTokenAddress;
36959
37371
  exports.populateWallets = populateWallets;
36960
37372
  exports.randomIntFromInterval = randomIntFromInterval;
36961
37373
  exports.redirectToExtensionsStore = redirectToExtensionsStore;
@@ -36968,6 +37380,7 @@ exports.sortAddressBook = sortAddressBook;
36968
37380
  exports.sortAllTokens = sortAllTokens;
36969
37381
  exports.sortTokensBySharedSubgraphIds = sortTokensBySharedSubgraphIds;
36970
37382
  exports.sortWallets = sortWallets;
37383
+ exports.stellarAddressToScVal = stellarAddressToScVal;
36971
37384
  exports.suggestChainOrThrow = suggestChainOrThrow;
36972
37385
  exports.transactionErrorCode = transactionErrorCode;
36973
37386
  exports.trimExtraDecimals = trimExtraDecimals;
@@ -37033,6 +37446,7 @@ exports.useSquidQueryClient = useSquidQueryClient;
37033
37446
  exports.useSquidStore = useSquidStore;
37034
37447
  exports.useSquidTokens = useSquidTokens;
37035
37448
  exports.useStellarAccountActivation = useStellarAccountActivation;
37449
+ exports.useStellarTrustLine = useStellarTrustLine;
37036
37450
  exports.useSuggestedFiatAmounts = useSuggestedFiatAmounts;
37037
37451
  exports.useSwap = useSwap;
37038
37452
  exports.useSwapRoutePersistStore = useSwapRoutePersistStore;
@@ -37048,4 +37462,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
37048
37462
  exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
37049
37463
  exports.walletIconBaseUrl = walletIconBaseUrl;
37050
37464
  exports.walletSupportsChainType = walletSupportsChainType;
37051
- //# sourceMappingURL=index-qAOvcSon.js.map
37465
+ //# sourceMappingURL=index-xSvE7oVI.js.map