@0xsquid/react-hooks 8.0.7 → 8.1.1
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/hooks/squid/useSquid.d.ts +2 -2
- package/dist/{index-DuicRCzG.js → index-CumomA_e.js} +74 -251
- package/dist/index-CumomA_e.js.map +1 -0
- package/dist/{index-xi-TkXJQ.js → index-Dns9m27b.js} +74 -251
- package/dist/index-Dns9m27b.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{secretService-DhkEjHMB.js → secretService-DQbR7c-h.js} +2 -2
- package/dist/{secretService-DhkEjHMB.js.map → secretService-DQbR7c-h.js.map} +1 -1
- package/dist/{secretService-C_RrU7VT.js → secretService-xh6N3W9l.js} +2 -2
- package/dist/{secretService-C_RrU7VT.js.map → secretService-xh6N3W9l.js.map} +1 -1
- package/dist/{stellarService.client-CuyF4Qwx.js → stellarService.client-Clze3MKI.js} +2 -2
- package/dist/{stellarService.client-CuyF4Qwx.js.map → stellarService.client-Clze3MKI.js.map} +1 -1
- package/dist/{stellarService.client-BiE1Jy9a.js → stellarService.client-FQblggHS.js} +2 -2
- package/dist/{stellarService.client-BiE1Jy9a.js.map → stellarService.client-FQblggHS.js.map} +1 -1
- package/package.json +1 -1
- package/dist/hooks/transaction/useIcs20Allowance.d.ts +0 -87
- package/dist/index-DuicRCzG.js.map +0 -1
- package/dist/index-xi-TkXJQ.js.map +0 -1
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
export declare const useSquid: () => {
|
|
7
7
|
tokens: import("../..").Token[] | undefined;
|
|
8
8
|
chains: import("../..").Chain[] | undefined;
|
|
9
|
-
forceSquidInfoRefetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../store/useSquidStore").Squid | null,
|
|
10
|
-
squidInfoQuery: import("@tanstack/react-query").UseQueryResult<import("../store/useSquidStore").Squid | null,
|
|
9
|
+
forceSquidInfoRefetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("../store/useSquidStore").Squid | null, Error>>;
|
|
10
|
+
squidInfoQuery: import("@tanstack/react-query").UseQueryResult<import("../store/useSquidStore").Squid | null, Error>;
|
|
11
11
|
maintenanceMode: {
|
|
12
12
|
active: boolean;
|
|
13
13
|
message?: string | undefined;
|
|
@@ -4448,6 +4448,23 @@ const getAllKeysForSupportedCosmosChains = async (chainIds, keplrTypeWallet) =>
|
|
|
4448
4448
|
if (!keplrTypeWallet)
|
|
4449
4449
|
return [];
|
|
4450
4450
|
const addresses = [];
|
|
4451
|
+
if (typeof keplrTypeWallet.getChainInfosWithoutEndpoints === "function") {
|
|
4452
|
+
try {
|
|
4453
|
+
const keys = await getKeysSettled(chainIds, keplrTypeWallet);
|
|
4454
|
+
keys.forEach((key, index) => {
|
|
4455
|
+
if (key.status === "fulfilled" && key.value) {
|
|
4456
|
+
addresses.push({
|
|
4457
|
+
address: key.value,
|
|
4458
|
+
chainId: chainIds[index],
|
|
4459
|
+
});
|
|
4460
|
+
}
|
|
4461
|
+
});
|
|
4462
|
+
return addresses;
|
|
4463
|
+
}
|
|
4464
|
+
catch (error) {
|
|
4465
|
+
console.debug("Batch key fetch failed, trying sequential", error);
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4451
4468
|
for (const chainId of chainIds) {
|
|
4452
4469
|
try {
|
|
4453
4470
|
const keys = await getKeysSettled([chainId], keplrTypeWallet);
|
|
@@ -23084,7 +23101,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23084
23101
|
};
|
|
23085
23102
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23086
23103
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23087
|
-
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-
|
|
23104
|
+
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-xh6N3W9l.js'); });
|
|
23088
23105
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23089
23106
|
};
|
|
23090
23107
|
function getTokenAssetsKey(token) {
|
|
@@ -23158,7 +23175,7 @@ function convertEvmosToEvmChain(cosmosChain) {
|
|
|
23158
23175
|
// @ts-expect-error - isEvmos is not a property on EvmChain
|
|
23159
23176
|
// We still need this attribute in evmos chains
|
|
23160
23177
|
// even after they are converted to evm chains, to perform certain checks
|
|
23161
|
-
// e.g
|
|
23178
|
+
// e.g skipping erc20 approve/allowance checks
|
|
23162
23179
|
isEvmos: true,
|
|
23163
23180
|
chainType: squidTypes.ChainType.EVM,
|
|
23164
23181
|
axelarChainName: cosmosChain.axelarChainName,
|
|
@@ -24863,13 +24880,21 @@ const useSquid = () => {
|
|
|
24863
24880
|
* Fetch squid info
|
|
24864
24881
|
* Will refetch every minute
|
|
24865
24882
|
*/
|
|
24866
|
-
const squidInfoQuery = reactQuery.useQuery(
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24883
|
+
const squidInfoQuery = reactQuery.useQuery({
|
|
24884
|
+
queryKey: keys().squidInfo(),
|
|
24885
|
+
queryFn: async () => {
|
|
24886
|
+
if (squid) {
|
|
24887
|
+
await squid?.init();
|
|
24888
|
+
initializeSquidWithAssetsColors(squid, assetsColors);
|
|
24889
|
+
return squid;
|
|
24890
|
+
}
|
|
24891
|
+
return null;
|
|
24892
|
+
},
|
|
24893
|
+
enabled: !!squid && !maintenanceMode.active,
|
|
24894
|
+
retry: false,
|
|
24895
|
+
onError: (error) => {
|
|
24896
|
+
console.error("Failed to fetch squid info:", error);
|
|
24897
|
+
},
|
|
24873
24898
|
});
|
|
24874
24899
|
const tokens = React.useMemo(() => {
|
|
24875
24900
|
if ((squidInfoQuery?.data?.tokens ?? []).length > 0) {
|
|
@@ -26260,7 +26285,7 @@ function useStellarWallets() {
|
|
|
26260
26285
|
return;
|
|
26261
26286
|
try {
|
|
26262
26287
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
26263
|
-
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-
|
|
26288
|
+
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-Clze3MKI.js'); });
|
|
26264
26289
|
const modules = initializeAllModules();
|
|
26265
26290
|
const promises = modules.map(async (module) => {
|
|
26266
26291
|
const isAvailable = await module.isAvailable();
|
|
@@ -27438,6 +27463,8 @@ const useCosmos = () => {
|
|
|
27438
27463
|
if (cosmosWalletObject) {
|
|
27439
27464
|
setCosmosChainId(chainInfos.chainId.toString());
|
|
27440
27465
|
try {
|
|
27466
|
+
// Check if this wallet supports batch enabling chains
|
|
27467
|
+
// If it does, we can use it to enable all the cosmos chains at once
|
|
27441
27468
|
if (approveAllChains &&
|
|
27442
27469
|
typeof cosmosWalletObject.getChainInfosWithoutEndpoints ===
|
|
27443
27470
|
"function") {
|
|
@@ -27450,6 +27477,11 @@ const useCosmos = () => {
|
|
|
27450
27477
|
await cosmosWalletObject.enable(chainsToEnable);
|
|
27451
27478
|
}
|
|
27452
27479
|
catch (error) {
|
|
27480
|
+
// If the user rejected the batch enable request, throw an error to avoid
|
|
27481
|
+
// Fallback to a loop trying to enable each chain one by one
|
|
27482
|
+
if (isUserRejectionError(normalizeError(error))) {
|
|
27483
|
+
throw error;
|
|
27484
|
+
}
|
|
27453
27485
|
console.warn("Failed to get chain infos, falling back to single chain enable", error);
|
|
27454
27486
|
await cosmosWalletObject.enable(chainInfos.chainId);
|
|
27455
27487
|
}
|
|
@@ -31396,135 +31428,6 @@ const useAllTransactionsStatus = ({ enabled }) => {
|
|
|
31396
31428
|
};
|
|
31397
31429
|
};
|
|
31398
31430
|
|
|
31399
|
-
var ics20Abi = [
|
|
31400
|
-
{
|
|
31401
|
-
inputs: [
|
|
31402
|
-
{
|
|
31403
|
-
internalType: "address",
|
|
31404
|
-
name: "grantee",
|
|
31405
|
-
type: "address"
|
|
31406
|
-
},
|
|
31407
|
-
{
|
|
31408
|
-
internalType: "address",
|
|
31409
|
-
name: "granter",
|
|
31410
|
-
type: "address"
|
|
31411
|
-
}
|
|
31412
|
-
],
|
|
31413
|
-
name: "allowance",
|
|
31414
|
-
outputs: [
|
|
31415
|
-
{
|
|
31416
|
-
components: [
|
|
31417
|
-
{
|
|
31418
|
-
internalType: "string",
|
|
31419
|
-
name: "sourcePort",
|
|
31420
|
-
type: "string"
|
|
31421
|
-
},
|
|
31422
|
-
{
|
|
31423
|
-
internalType: "string",
|
|
31424
|
-
name: "sourceChannel",
|
|
31425
|
-
type: "string"
|
|
31426
|
-
},
|
|
31427
|
-
{
|
|
31428
|
-
components: [
|
|
31429
|
-
{
|
|
31430
|
-
internalType: "string",
|
|
31431
|
-
name: "denom",
|
|
31432
|
-
type: "string"
|
|
31433
|
-
},
|
|
31434
|
-
{
|
|
31435
|
-
internalType: "uint256",
|
|
31436
|
-
name: "amount",
|
|
31437
|
-
type: "uint256"
|
|
31438
|
-
}
|
|
31439
|
-
],
|
|
31440
|
-
internalType: "struct Coin[]",
|
|
31441
|
-
name: "spendLimit",
|
|
31442
|
-
type: "tuple[]"
|
|
31443
|
-
},
|
|
31444
|
-
{
|
|
31445
|
-
internalType: "string[]",
|
|
31446
|
-
name: "allowList",
|
|
31447
|
-
type: "string[]"
|
|
31448
|
-
},
|
|
31449
|
-
{
|
|
31450
|
-
internalType: "string[]",
|
|
31451
|
-
name: "allowedPacketData",
|
|
31452
|
-
type: "string[]"
|
|
31453
|
-
}
|
|
31454
|
-
],
|
|
31455
|
-
internalType: "struct ICS20Allocation[]",
|
|
31456
|
-
name: "allocations",
|
|
31457
|
-
type: "tuple[]"
|
|
31458
|
-
}
|
|
31459
|
-
],
|
|
31460
|
-
stateMutability: "view",
|
|
31461
|
-
type: "function"
|
|
31462
|
-
},
|
|
31463
|
-
{
|
|
31464
|
-
inputs: [
|
|
31465
|
-
{
|
|
31466
|
-
internalType: "address",
|
|
31467
|
-
name: "grantee",
|
|
31468
|
-
type: "address"
|
|
31469
|
-
},
|
|
31470
|
-
{
|
|
31471
|
-
components: [
|
|
31472
|
-
{
|
|
31473
|
-
internalType: "string",
|
|
31474
|
-
name: "sourcePort",
|
|
31475
|
-
type: "string"
|
|
31476
|
-
},
|
|
31477
|
-
{
|
|
31478
|
-
internalType: "string",
|
|
31479
|
-
name: "sourceChannel",
|
|
31480
|
-
type: "string"
|
|
31481
|
-
},
|
|
31482
|
-
{
|
|
31483
|
-
components: [
|
|
31484
|
-
{
|
|
31485
|
-
internalType: "string",
|
|
31486
|
-
name: "denom",
|
|
31487
|
-
type: "string"
|
|
31488
|
-
},
|
|
31489
|
-
{
|
|
31490
|
-
internalType: "uint256",
|
|
31491
|
-
name: "amount",
|
|
31492
|
-
type: "uint256"
|
|
31493
|
-
}
|
|
31494
|
-
],
|
|
31495
|
-
internalType: "struct Coin[]",
|
|
31496
|
-
name: "spendLimit",
|
|
31497
|
-
type: "tuple[]"
|
|
31498
|
-
},
|
|
31499
|
-
{
|
|
31500
|
-
internalType: "string[]",
|
|
31501
|
-
name: "allowList",
|
|
31502
|
-
type: "string[]"
|
|
31503
|
-
},
|
|
31504
|
-
{
|
|
31505
|
-
internalType: "string[]",
|
|
31506
|
-
name: "allowedPacketData",
|
|
31507
|
-
type: "string[]"
|
|
31508
|
-
}
|
|
31509
|
-
],
|
|
31510
|
-
internalType: "struct ICS20Allocation[]",
|
|
31511
|
-
name: "allocations",
|
|
31512
|
-
type: "tuple[]"
|
|
31513
|
-
}
|
|
31514
|
-
],
|
|
31515
|
-
name: "approve",
|
|
31516
|
-
outputs: [
|
|
31517
|
-
{
|
|
31518
|
-
internalType: "bool",
|
|
31519
|
-
name: "approved",
|
|
31520
|
-
type: "bool"
|
|
31521
|
-
}
|
|
31522
|
-
],
|
|
31523
|
-
stateMutability: "nonpayable",
|
|
31524
|
-
type: "function"
|
|
31525
|
-
}
|
|
31526
|
-
];
|
|
31527
|
-
|
|
31528
31431
|
const useErc20Allowance = ({ tokenAddress, ownerAddress, spenderAddress, amount = BigInt(0), chainId, transactionType, enabled = true, }) => {
|
|
31529
31432
|
const parsedTokenAddress = parseEvmAddress(tokenAddress);
|
|
31530
31433
|
const parsedOwnerAddress = parseEvmAddress(ownerAddress);
|
|
@@ -31564,49 +31467,6 @@ const useErc20Allowance = ({ tokenAddress, ownerAddress, spenderAddress, amount
|
|
|
31564
31467
|
};
|
|
31565
31468
|
};
|
|
31566
31469
|
|
|
31567
|
-
/**
|
|
31568
|
-
* ICS20 is similar to ERC20 but the ABI is different
|
|
31569
|
-
* https://docs.evmos.org/develop/smart-contracts/evm-extensions/ibc-transfer
|
|
31570
|
-
* https://github.com/evmos/extensions/blob/main/precompiles/abi/ics20.json
|
|
31571
|
-
*/
|
|
31572
|
-
function useIcs20Allowance({ targetAddress, ownerAddress, amount = BigInt(0), chainId, enabled = true, }) {
|
|
31573
|
-
const parsedTargetAddress = parseEvmAddress(targetAddress);
|
|
31574
|
-
const parsedOwnerAddress = parseEvmAddress(ownerAddress);
|
|
31575
|
-
const query = wagmi.useReadContract({
|
|
31576
|
-
abi: ics20Abi,
|
|
31577
|
-
address: parsedTargetAddress,
|
|
31578
|
-
functionName: "allowance",
|
|
31579
|
-
chainId,
|
|
31580
|
-
args: parsedOwnerAddress && parsedTargetAddress
|
|
31581
|
-
? [parsedOwnerAddress, parsedOwnerAddress] // ICS20: (grantee, granter)
|
|
31582
|
-
: undefined,
|
|
31583
|
-
query: {
|
|
31584
|
-
enabled: enabled && Boolean(parsedTargetAddress && parsedOwnerAddress),
|
|
31585
|
-
},
|
|
31586
|
-
});
|
|
31587
|
-
if (!parsedTargetAddress || !parsedOwnerAddress) {
|
|
31588
|
-
return {
|
|
31589
|
-
hasAllowance: false,
|
|
31590
|
-
error: new Error("Invalid or missing address"),
|
|
31591
|
-
};
|
|
31592
|
-
}
|
|
31593
|
-
// Handle ICS20 format
|
|
31594
|
-
let allowanceInWei;
|
|
31595
|
-
if (query.data) {
|
|
31596
|
-
const ics20Data = query.data;
|
|
31597
|
-
allowanceInWei = ics20Data?.[0]?.spendLimit?.[0]?.amount ?? BigInt(0);
|
|
31598
|
-
}
|
|
31599
|
-
else {
|
|
31600
|
-
allowanceInWei = BigInt(0);
|
|
31601
|
-
}
|
|
31602
|
-
const hasAllowance = allowanceInWei >= amount;
|
|
31603
|
-
return {
|
|
31604
|
-
query,
|
|
31605
|
-
hasAllowance,
|
|
31606
|
-
allowanceInWei,
|
|
31607
|
-
};
|
|
31608
|
-
}
|
|
31609
|
-
|
|
31610
31470
|
const useApproval = ({ squidRoute, }) => {
|
|
31611
31471
|
const { data: walletClient } = wagmi.useWalletClient();
|
|
31612
31472
|
const publicClient = wagmi.usePublicClient();
|
|
@@ -31618,12 +31478,15 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31618
31478
|
const { getChainType } = useSquidChains();
|
|
31619
31479
|
const { switchChainAsync } = wagmi.useSwitchChain();
|
|
31620
31480
|
const { connectedAddress: { address: sourceUserAddress }, } = useMultiChainWallet(fromChain);
|
|
31621
|
-
const
|
|
31622
|
-
const isSagaSameChainSwap = isSameChain &&
|
|
31481
|
+
const isSagaEvmSameChainSwap = isSameChain &&
|
|
31623
31482
|
fromChain?.chainId.toString() === CHAIN_IDS.SAGA_EVM.toString();
|
|
31624
|
-
//
|
|
31625
|
-
|
|
31626
|
-
|
|
31483
|
+
// Swaps on SagaEVM are regular EVM transactions, following the standard ERC20 approve/allowance mechanism.
|
|
31484
|
+
// However, when bridging from SagaEVM to other Saga chainlets, approve/allowance is not needed
|
|
31485
|
+
// as these transfers interact with the SagaEVM ICS20 precompile contract.
|
|
31486
|
+
// See https://github.com/sagaxyz/cosmos-evm/tree/main/precompiles/ics20
|
|
31487
|
+
const erc20AllowanceQueryEnabled = isSagaEvmSameChainSwap ||
|
|
31488
|
+
(fromChain?.chainType === squidTypes.ChainType.EVM && !isEvmosChain(fromChain));
|
|
31489
|
+
const { hasAllowance, query: allowanceQuery, allowanceInWei, } = useErc20Allowance({
|
|
31627
31490
|
tokenAddress: fromToken?.address,
|
|
31628
31491
|
ownerAddress: sourceUserAddress,
|
|
31629
31492
|
spenderAddress: squidRoute?.transactionRequest
|
|
@@ -31631,19 +31494,8 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31631
31494
|
amount: BigInt(squidRoute?.params.fromAmount ?? "0"),
|
|
31632
31495
|
chainId: Number(fromChain?.chainId),
|
|
31633
31496
|
transactionType: squidRoute?.transactionRequest?.type,
|
|
31634
|
-
enabled:
|
|
31635
|
-
});
|
|
31636
|
-
const { hasAllowance: hasIcs20Allowance, query: ics20AllowanceQuery, allowanceInWei: ics20AllowanceInWei, } = useIcs20Allowance({
|
|
31637
|
-
ownerAddress: sourceUserAddress,
|
|
31638
|
-
targetAddress: squidRoute?.transactionRequest
|
|
31639
|
-
?.target,
|
|
31640
|
-
amount: BigInt(squidRoute?.params.fromAmount ?? "0"),
|
|
31641
|
-
chainId: Number(fromChain?.chainId),
|
|
31642
|
-
enabled: useIcs20,
|
|
31497
|
+
enabled: erc20AllowanceQueryEnabled,
|
|
31643
31498
|
});
|
|
31644
|
-
const hasAllowance = useIcs20 ? hasIcs20Allowance : hasErc20Allowance;
|
|
31645
|
-
const allowanceInWei = useIcs20 ? ics20AllowanceInWei : erc20AllowanceInWei;
|
|
31646
|
-
const allowanceQuery = useIcs20 ? ics20AllowanceQuery : erc20AllowanceQuery;
|
|
31647
31499
|
/**
|
|
31648
31500
|
* Checking if spending tokens is allowed for this source address
|
|
31649
31501
|
* On Success: storing the transaction
|
|
@@ -31651,16 +31503,16 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31651
31503
|
* @returns {boolean} approved
|
|
31652
31504
|
*/
|
|
31653
31505
|
const routeApproved = reactQuery.useQuery(keys().routeApproved(squidRoute, allowanceInWei), async () => {
|
|
31654
|
-
|
|
31655
|
-
if (getChainType(squidRoute?.params.fromChain) === squidTypes.ChainType.EVM) {
|
|
31506
|
+
if (erc20AllowanceQueryEnabled) {
|
|
31656
31507
|
return hasAllowance;
|
|
31657
31508
|
}
|
|
31658
31509
|
return true;
|
|
31659
31510
|
}, {
|
|
31660
31511
|
enabled: !!squidRoute &&
|
|
31661
31512
|
!!sourceUserAddress &&
|
|
31662
|
-
|
|
31663
|
-
|
|
31513
|
+
// Only wait for allowance if that query is actually enabled
|
|
31514
|
+
(!erc20AllowanceQueryEnabled ||
|
|
31515
|
+
(!allowanceQuery?.isLoading && allowanceQuery?.isFetched)),
|
|
31664
31516
|
});
|
|
31665
31517
|
// USDT has a very specific way of handling approvals
|
|
31666
31518
|
// ```
|
|
@@ -31750,7 +31602,8 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31750
31602
|
*/
|
|
31751
31603
|
const approveRoute = reactQuery.useMutation(async () => {
|
|
31752
31604
|
try {
|
|
31753
|
-
if (fromToken?.address ===
|
|
31605
|
+
if (fromToken?.address.toLowerCase() ===
|
|
31606
|
+
nativeEvmTokenAddress.toLowerCase()) {
|
|
31754
31607
|
return true;
|
|
31755
31608
|
}
|
|
31756
31609
|
if (!!squidRoute && walletClient && fromToken && evmSigner && squid) {
|
|
@@ -31763,49 +31616,14 @@ const useApproval = ({ squidRoute, }) => {
|
|
|
31763
31616
|
catch (error) {
|
|
31764
31617
|
console.error("Error switching network:", error);
|
|
31765
31618
|
}
|
|
31766
|
-
|
|
31767
|
-
|
|
31768
|
-
|
|
31769
|
-
|
|
31770
|
-
|
|
31771
|
-
|
|
31772
|
-
|
|
31773
|
-
|
|
31774
|
-
{
|
|
31775
|
-
sourcePort: "transfer",
|
|
31776
|
-
sourceChannel: channel,
|
|
31777
|
-
spendLimit: [
|
|
31778
|
-
{
|
|
31779
|
-
denom: squidRoute.estimate.actions[0].fromToken
|
|
31780
|
-
.originalAddress,
|
|
31781
|
-
amount: squidRoute.params.fromAmount,
|
|
31782
|
-
},
|
|
31783
|
-
],
|
|
31784
|
-
allowList: [],
|
|
31785
|
-
allowedPacketData: ["*"],
|
|
31786
|
-
},
|
|
31787
|
-
],
|
|
31788
|
-
]);
|
|
31789
|
-
approveTx = await evmSigner.sendTransaction({
|
|
31790
|
-
to: squidRoute.transactionRequest.target,
|
|
31791
|
-
data: approveData,
|
|
31792
|
-
value: "0",
|
|
31793
|
-
gasLimit: squidRoute.transactionRequest
|
|
31794
|
-
.gasLimit,
|
|
31795
|
-
gasPrice: squidRoute.transactionRequest
|
|
31796
|
-
.gasPrice,
|
|
31797
|
-
});
|
|
31798
|
-
}
|
|
31799
|
-
else {
|
|
31800
|
-
approveTx = await squid.approveRoute({
|
|
31801
|
-
route: squidRoute,
|
|
31802
|
-
signer: evmSigner,
|
|
31803
|
-
// For security reasons, we don't want to allow infinite approvals in our frontends
|
|
31804
|
-
executionSettings: {
|
|
31805
|
-
infiniteApproval: false,
|
|
31806
|
-
},
|
|
31807
|
-
});
|
|
31808
|
-
}
|
|
31619
|
+
const approveTx = await squid.approveRoute({
|
|
31620
|
+
route: squidRoute,
|
|
31621
|
+
signer: evmSigner,
|
|
31622
|
+
// For security reasons, we don't want to allow infinite approvals in our frontends
|
|
31623
|
+
executionSettings: {
|
|
31624
|
+
infiniteApproval: false,
|
|
31625
|
+
},
|
|
31626
|
+
});
|
|
31809
31627
|
if (isProblematicConnector(activeConnector)) {
|
|
31810
31628
|
await sleep(3_000);
|
|
31811
31629
|
}
|
|
@@ -36380,9 +36198,14 @@ const SquidProvider = ({ children, config, placeholder, }) => {
|
|
|
36380
36198
|
catch (error) {
|
|
36381
36199
|
const isAxios503Error = error.isAxiosError &&
|
|
36382
36200
|
error.response?.status === 503;
|
|
36383
|
-
|
|
36384
|
-
|
|
36385
|
-
|
|
36201
|
+
const isBackendDown = isAxios503Error ||
|
|
36202
|
+
error.isAxiosError ||
|
|
36203
|
+
error instanceof Error;
|
|
36204
|
+
if (isBackendDown) {
|
|
36205
|
+
const maintenanceMessage = isAxios503Error
|
|
36206
|
+
? error.response?.data
|
|
36207
|
+
?.message ?? undefined
|
|
36208
|
+
: "Unable to connect to Squid. Please check your connection or try again later.";
|
|
36386
36209
|
// Even with an error, we want wagmi to be defined so that we can display the maintenance mode layout
|
|
36387
36210
|
// Create wagmi config with mainnet as fallback in maintenance mode
|
|
36388
36211
|
const newWagmiConfig = wagmi.createConfig({
|
|
@@ -36652,4 +36475,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
|
|
|
36652
36475
|
exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
|
|
36653
36476
|
exports.walletIconBaseUrl = walletIconBaseUrl;
|
|
36654
36477
|
exports.walletSupportsChainType = walletSupportsChainType;
|
|
36655
|
-
//# sourceMappingURL=index-
|
|
36478
|
+
//# sourceMappingURL=index-CumomA_e.js.map
|