@spicenet-io/spiceflow-ui 1.7.4 → 1.7.6
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/index.cjs.js +226 -15
- package/dist/index.js +226 -15
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -103,7 +103,7 @@ const CHAIN_CONFIGS = {
|
|
|
103
103
|
symbol: "ETH",
|
|
104
104
|
decimals: 18
|
|
105
105
|
},
|
|
106
|
-
rpc: "https://
|
|
106
|
+
rpc: "https://site1.moralis-nodes.com/base-sepolia/0563a61e273c428f906716cd4befa362",
|
|
107
107
|
blockExplorers: {
|
|
108
108
|
default: {
|
|
109
109
|
name: "Basescan",
|
|
@@ -406,13 +406,16 @@ const getAllAssetsForChain = (chainId, userAssets = []) => {
|
|
|
406
406
|
const config = getChainConfig(chainId);
|
|
407
407
|
if (!config) return [];
|
|
408
408
|
const assets = [];
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
409
|
+
const excludeNativeTokenChains = [11155111, 421614, 84532, 688689];
|
|
410
|
+
if (!excludeNativeTokenChains.includes(chainId)) {
|
|
411
|
+
const userNativeAsset = userAssets.find(
|
|
412
|
+
(asset) => asset.chainId === chainId && asset.isNative
|
|
413
|
+
);
|
|
414
|
+
if (userNativeAsset) {
|
|
415
|
+
assets.push(userNativeAsset);
|
|
416
|
+
} else {
|
|
417
|
+
assets.push(createNativeAsset(chainId));
|
|
418
|
+
}
|
|
416
419
|
}
|
|
417
420
|
if (!config.supportedTokens) return assets;
|
|
418
421
|
config.supportedTokens.forEach((tokenConfig) => {
|
|
@@ -913,12 +916,13 @@ const useAssets = ({
|
|
|
913
916
|
address,
|
|
914
917
|
supportedChains,
|
|
915
918
|
fetchBalances: fetchBalances2,
|
|
916
|
-
refreshInterval =
|
|
917
|
-
//
|
|
919
|
+
refreshInterval = 8e3
|
|
920
|
+
// 8 seconds default
|
|
918
921
|
}) => {
|
|
919
922
|
const [assets, setAssets] = React.useState([]);
|
|
920
923
|
const [loading, setLoading] = React.useState(false);
|
|
921
924
|
const [error, setError] = React.useState(null);
|
|
925
|
+
const isInitialLoadRef = React.useRef(true);
|
|
922
926
|
const addressRef = React.useRef(address);
|
|
923
927
|
const supportedChainsRef = React.useRef(supportedChains);
|
|
924
928
|
const fetchBalancesRef = React.useRef(fetchBalances2);
|
|
@@ -935,7 +939,9 @@ const useAssets = ({
|
|
|
935
939
|
setAssets([]);
|
|
936
940
|
return;
|
|
937
941
|
}
|
|
938
|
-
|
|
942
|
+
if (isInitialLoadRef.current) {
|
|
943
|
+
setLoading(true);
|
|
944
|
+
}
|
|
939
945
|
setError(null);
|
|
940
946
|
try {
|
|
941
947
|
const balances = await currentFetchBalances(currentAddress);
|
|
@@ -954,7 +960,10 @@ const useAssets = ({
|
|
|
954
960
|
setError(errorMessage);
|
|
955
961
|
console.error("Error fetching assets:", err);
|
|
956
962
|
} finally {
|
|
957
|
-
|
|
963
|
+
if (isInitialLoadRef.current) {
|
|
964
|
+
setLoading(false);
|
|
965
|
+
isInitialLoadRef.current = false;
|
|
966
|
+
}
|
|
958
967
|
}
|
|
959
968
|
}, []);
|
|
960
969
|
const getAssetsByChain = React.useCallback(
|
|
@@ -968,6 +977,7 @@ const useAssets = ({
|
|
|
968
977
|
}, [assets]);
|
|
969
978
|
React.useEffect(() => {
|
|
970
979
|
if (address) {
|
|
980
|
+
isInitialLoadRef.current = true;
|
|
971
981
|
refreshAssets();
|
|
972
982
|
}
|
|
973
983
|
}, [address, refreshAssets]);
|
|
@@ -1351,6 +1361,10 @@ const getChainName = (chainId) => {
|
|
|
1351
1361
|
return "Citrea Testnet";
|
|
1352
1362
|
case 123420001114:
|
|
1353
1363
|
return "Basecamp Testnet";
|
|
1364
|
+
case 84532:
|
|
1365
|
+
return "Base Sepolia";
|
|
1366
|
+
case 688689:
|
|
1367
|
+
return "Pharos Atlantic";
|
|
1354
1368
|
default:
|
|
1355
1369
|
return `Chain ${chainId}`;
|
|
1356
1370
|
}
|
|
@@ -5527,6 +5541,84 @@ const ConnectWalletModal = ({
|
|
|
5527
5541
|
},
|
|
5528
5542
|
children: [
|
|
5529
5543
|
/* @__PURE__ */ jsxRuntime.jsx(ModalHeader, { title: "Connect Wallet", onClose }),
|
|
5544
|
+
requiredChainId === 421614 && !isConnected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5545
|
+
"div",
|
|
5546
|
+
{
|
|
5547
|
+
style: {
|
|
5548
|
+
padding: "0 32px",
|
|
5549
|
+
marginTop: "20px"
|
|
5550
|
+
},
|
|
5551
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5552
|
+
"div",
|
|
5553
|
+
{
|
|
5554
|
+
style: {
|
|
5555
|
+
padding: "12px 16px",
|
|
5556
|
+
backgroundColor: "#EFF6FF",
|
|
5557
|
+
borderRadius: "8px",
|
|
5558
|
+
border: "1px solid #BFDBFE",
|
|
5559
|
+
display: "flex",
|
|
5560
|
+
alignItems: "center",
|
|
5561
|
+
gap: "10px"
|
|
5562
|
+
},
|
|
5563
|
+
children: [
|
|
5564
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5565
|
+
"div",
|
|
5566
|
+
{
|
|
5567
|
+
style: {
|
|
5568
|
+
width: "32px",
|
|
5569
|
+
height: "32px",
|
|
5570
|
+
borderRadius: "50%",
|
|
5571
|
+
backgroundColor: "#DBEAFE",
|
|
5572
|
+
display: "flex",
|
|
5573
|
+
alignItems: "center",
|
|
5574
|
+
justifyContent: "center",
|
|
5575
|
+
flexShrink: 0
|
|
5576
|
+
},
|
|
5577
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5578
|
+
"img",
|
|
5579
|
+
{
|
|
5580
|
+
src: img$3,
|
|
5581
|
+
alt: "Rabby",
|
|
5582
|
+
style: {
|
|
5583
|
+
width: "20px",
|
|
5584
|
+
height: "20px",
|
|
5585
|
+
objectFit: "contain"
|
|
5586
|
+
}
|
|
5587
|
+
}
|
|
5588
|
+
)
|
|
5589
|
+
}
|
|
5590
|
+
),
|
|
5591
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
|
|
5592
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5593
|
+
"p",
|
|
5594
|
+
{
|
|
5595
|
+
style: {
|
|
5596
|
+
margin: "0 0 4px 0",
|
|
5597
|
+
color: "#1E40AF",
|
|
5598
|
+
fontSize: "13px",
|
|
5599
|
+
fontWeight: 600
|
|
5600
|
+
},
|
|
5601
|
+
children: "Recommended Wallet"
|
|
5602
|
+
}
|
|
5603
|
+
),
|
|
5604
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5605
|
+
"p",
|
|
5606
|
+
{
|
|
5607
|
+
style: {
|
|
5608
|
+
margin: 0,
|
|
5609
|
+
color: "#1E3A8A",
|
|
5610
|
+
fontSize: "12px",
|
|
5611
|
+
lineHeight: "1.4"
|
|
5612
|
+
},
|
|
5613
|
+
children: "For Arbitrum Sepolia, we recommend using Rabby wallet instead of MetaMask for the best experience."
|
|
5614
|
+
}
|
|
5615
|
+
)
|
|
5616
|
+
] })
|
|
5617
|
+
]
|
|
5618
|
+
}
|
|
5619
|
+
)
|
|
5620
|
+
}
|
|
5621
|
+
),
|
|
5530
5622
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5531
5623
|
"div",
|
|
5532
5624
|
{
|
|
@@ -5658,6 +5750,75 @@ const ConnectWalletModal = ({
|
|
|
5658
5750
|
]
|
|
5659
5751
|
}
|
|
5660
5752
|
),
|
|
5753
|
+
isConnected && requiredChainId === 421614 && activeConnector && (activeConnector.name.toLowerCase().includes("metamask") || activeConnector.type === "injected") && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5754
|
+
"div",
|
|
5755
|
+
{
|
|
5756
|
+
style: {
|
|
5757
|
+
padding: "12px 16px",
|
|
5758
|
+
backgroundColor: "#EFF6FF",
|
|
5759
|
+
borderRadius: "8px",
|
|
5760
|
+
border: "1px solid #BFDBFE",
|
|
5761
|
+
display: "flex",
|
|
5762
|
+
alignItems: "center",
|
|
5763
|
+
gap: "10px"
|
|
5764
|
+
},
|
|
5765
|
+
children: [
|
|
5766
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5767
|
+
"div",
|
|
5768
|
+
{
|
|
5769
|
+
style: {
|
|
5770
|
+
width: "32px",
|
|
5771
|
+
height: "32px",
|
|
5772
|
+
borderRadius: "50%",
|
|
5773
|
+
backgroundColor: "#DBEAFE",
|
|
5774
|
+
display: "flex",
|
|
5775
|
+
alignItems: "center",
|
|
5776
|
+
justifyContent: "center",
|
|
5777
|
+
flexShrink: 0
|
|
5778
|
+
},
|
|
5779
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5780
|
+
"img",
|
|
5781
|
+
{
|
|
5782
|
+
src: img$3,
|
|
5783
|
+
alt: "Rabby",
|
|
5784
|
+
style: {
|
|
5785
|
+
width: "20px",
|
|
5786
|
+
height: "20px",
|
|
5787
|
+
objectFit: "contain"
|
|
5788
|
+
}
|
|
5789
|
+
}
|
|
5790
|
+
)
|
|
5791
|
+
}
|
|
5792
|
+
),
|
|
5793
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
|
|
5794
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5795
|
+
"p",
|
|
5796
|
+
{
|
|
5797
|
+
style: {
|
|
5798
|
+
margin: "0 0 4px 0",
|
|
5799
|
+
color: "#1E40AF",
|
|
5800
|
+
fontSize: "13px",
|
|
5801
|
+
fontWeight: 600
|
|
5802
|
+
},
|
|
5803
|
+
children: "Recommended Wallet"
|
|
5804
|
+
}
|
|
5805
|
+
),
|
|
5806
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5807
|
+
"p",
|
|
5808
|
+
{
|
|
5809
|
+
style: {
|
|
5810
|
+
margin: 0,
|
|
5811
|
+
color: "#1E3A8A",
|
|
5812
|
+
fontSize: "12px",
|
|
5813
|
+
lineHeight: "1.4"
|
|
5814
|
+
},
|
|
5815
|
+
children: "For Arbitrum Sepolia, we recommend using Rabby wallet instead of MetaMask for the best experience."
|
|
5816
|
+
}
|
|
5817
|
+
)
|
|
5818
|
+
] })
|
|
5819
|
+
]
|
|
5820
|
+
}
|
|
5821
|
+
),
|
|
5661
5822
|
isConnected && address ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5662
5823
|
"div",
|
|
5663
5824
|
{
|
|
@@ -7048,7 +7209,7 @@ const DepositModal = React.memo(
|
|
|
7048
7209
|
address: sourceAddress || address,
|
|
7049
7210
|
supportedChains,
|
|
7050
7211
|
fetchBalances,
|
|
7051
|
-
refreshInterval:
|
|
7212
|
+
refreshInterval: 8e3
|
|
7052
7213
|
});
|
|
7053
7214
|
const [isExecuting, setIsExecuting] = React.useState(false);
|
|
7054
7215
|
const [error, setError] = React.useState(null);
|
|
@@ -7086,6 +7247,26 @@ const DepositModal = React.memo(
|
|
|
7086
7247
|
});
|
|
7087
7248
|
}
|
|
7088
7249
|
}, [depositAmount]);
|
|
7250
|
+
React.useEffect(() => {
|
|
7251
|
+
if (selectedDepositAssets.length === 0) return;
|
|
7252
|
+
setSelectedDepositAssets((prev) => {
|
|
7253
|
+
return prev.map((selectedItem) => {
|
|
7254
|
+
if (!selectedItem.asset) return selectedItem;
|
|
7255
|
+
const freshAsset = depositAssets.find(
|
|
7256
|
+
(a) => a.chainId === selectedItem.asset.chainId && a.address.toLowerCase() === selectedItem.asset.address.toLowerCase()
|
|
7257
|
+
);
|
|
7258
|
+
if (freshAsset) {
|
|
7259
|
+
return {
|
|
7260
|
+
...selectedItem,
|
|
7261
|
+
asset: freshAsset,
|
|
7262
|
+
// Preserve the user's entered amount
|
|
7263
|
+
amount: selectedItem.amount
|
|
7264
|
+
};
|
|
7265
|
+
}
|
|
7266
|
+
return selectedItem;
|
|
7267
|
+
});
|
|
7268
|
+
});
|
|
7269
|
+
}, [assets]);
|
|
7089
7270
|
React.useEffect(() => {
|
|
7090
7271
|
if (nonEip7702Mode && intentStatus?.overallStatus === "success" && postDepositInstruction && postDepositStatus === "idle") {
|
|
7091
7272
|
const bridgedAmount = bridgedAmountRef.current;
|
|
@@ -7136,8 +7317,16 @@ const DepositModal = React.memo(
|
|
|
7136
7317
|
const errorMessage = error2?.message || String(error2 || "");
|
|
7137
7318
|
const errorDetails = error2?.details || "";
|
|
7138
7319
|
const errorString = `${errorMessage} ${errorDetails}`.toLowerCase();
|
|
7320
|
+
console.error("RPC Error Details:", {
|
|
7321
|
+
code: error2?.code,
|
|
7322
|
+
message: errorMessage,
|
|
7323
|
+
details: errorDetails,
|
|
7324
|
+
data: error2?.data,
|
|
7325
|
+
stack: error2?.stack,
|
|
7326
|
+
fullError: error2
|
|
7327
|
+
});
|
|
7139
7328
|
if (errorString.includes("internal json-rpc error") || errorString.includes("internal error") || errorString.includes("an internal error was received")) {
|
|
7140
|
-
return "Network error
|
|
7329
|
+
return "RPC Network error. Try switching your MetaMask RPC endpoint or try again.";
|
|
7141
7330
|
}
|
|
7142
7331
|
return errorMessage || "Transaction failed";
|
|
7143
7332
|
}, []);
|
|
@@ -7227,6 +7416,7 @@ const DepositModal = React.memo(
|
|
|
7227
7416
|
}
|
|
7228
7417
|
setAirdropMessage("Airdrop requested successfully.");
|
|
7229
7418
|
} catch (e) {
|
|
7419
|
+
console.log(e);
|
|
7230
7420
|
const msg = handleRpcError(e);
|
|
7231
7421
|
setAirdropError(msg);
|
|
7232
7422
|
} finally {
|
|
@@ -7350,6 +7540,11 @@ const DepositModal = React.memo(
|
|
|
7350
7540
|
}
|
|
7351
7541
|
if (currentChain?.id !== chainId) {
|
|
7352
7542
|
setError("Wrong chain selected. Switching network...");
|
|
7543
|
+
console.log("Attempting to switch to chain:", {
|
|
7544
|
+
chainId,
|
|
7545
|
+
currentChainId: currentChain?.id,
|
|
7546
|
+
chainName: getChainName$1(chainId)
|
|
7547
|
+
});
|
|
7353
7548
|
try {
|
|
7354
7549
|
await switchChainAsync({ chainId });
|
|
7355
7550
|
let attempts = 0;
|
|
@@ -7436,6 +7631,14 @@ const DepositModal = React.memo(
|
|
|
7436
7631
|
tokenAddress = "0x0";
|
|
7437
7632
|
}
|
|
7438
7633
|
const isNative = selectedAsset.asset.isNative || tokenAddress.toLowerCase() === "0x0";
|
|
7634
|
+
console.log("Sending transaction via MetaMask:", {
|
|
7635
|
+
chainId,
|
|
7636
|
+
isNative,
|
|
7637
|
+
tokenAddress,
|
|
7638
|
+
delegateContract,
|
|
7639
|
+
amount: amount.toString(),
|
|
7640
|
+
walletChainId: externalWalletClient.chain?.id
|
|
7641
|
+
});
|
|
7439
7642
|
const txHash = isNative ? await externalWalletClient.sendTransaction({
|
|
7440
7643
|
to: delegateContract,
|
|
7441
7644
|
value: amount
|
|
@@ -7576,6 +7779,14 @@ const DepositModal = React.memo(
|
|
|
7576
7779
|
tokenAddress = "0x0";
|
|
7577
7780
|
}
|
|
7578
7781
|
const isNative = selectedAsset.asset.isNative || tokenAddress.toLowerCase() === "0x0";
|
|
7782
|
+
console.log("Sending EIP-7702 transaction via MetaMask:", {
|
|
7783
|
+
chainId,
|
|
7784
|
+
isNative,
|
|
7785
|
+
tokenAddress,
|
|
7786
|
+
amount: amount.toString(),
|
|
7787
|
+
recipient: address,
|
|
7788
|
+
walletChainId: externalWalletClient.chain?.id
|
|
7789
|
+
});
|
|
7579
7790
|
const transferToEmbeddedTx = isNative ? await externalWalletClient.sendTransaction({
|
|
7580
7791
|
to: address,
|
|
7581
7792
|
value: amount
|
|
@@ -10203,7 +10414,7 @@ const SpiceWithdraw = (props) => {
|
|
|
10203
10414
|
}
|
|
10204
10415
|
const transports = {};
|
|
10205
10416
|
chains.forEach((chain) => {
|
|
10206
|
-
transports[chain.id] = wagmi.http();
|
|
10417
|
+
transports[chain.id] = wagmi.http(chain.rpc);
|
|
10207
10418
|
});
|
|
10208
10419
|
const connectorsList = [connectors.metaMask()];
|
|
10209
10420
|
if (walletConnectProjectId) {
|
package/dist/index.js
CHANGED
|
@@ -101,7 +101,7 @@ const CHAIN_CONFIGS = {
|
|
|
101
101
|
symbol: "ETH",
|
|
102
102
|
decimals: 18
|
|
103
103
|
},
|
|
104
|
-
rpc: "https://
|
|
104
|
+
rpc: "https://site1.moralis-nodes.com/base-sepolia/0563a61e273c428f906716cd4befa362",
|
|
105
105
|
blockExplorers: {
|
|
106
106
|
default: {
|
|
107
107
|
name: "Basescan",
|
|
@@ -404,13 +404,16 @@ const getAllAssetsForChain = (chainId, userAssets = []) => {
|
|
|
404
404
|
const config = getChainConfig(chainId);
|
|
405
405
|
if (!config) return [];
|
|
406
406
|
const assets = [];
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
407
|
+
const excludeNativeTokenChains = [11155111, 421614, 84532, 688689];
|
|
408
|
+
if (!excludeNativeTokenChains.includes(chainId)) {
|
|
409
|
+
const userNativeAsset = userAssets.find(
|
|
410
|
+
(asset) => asset.chainId === chainId && asset.isNative
|
|
411
|
+
);
|
|
412
|
+
if (userNativeAsset) {
|
|
413
|
+
assets.push(userNativeAsset);
|
|
414
|
+
} else {
|
|
415
|
+
assets.push(createNativeAsset(chainId));
|
|
416
|
+
}
|
|
414
417
|
}
|
|
415
418
|
if (!config.supportedTokens) return assets;
|
|
416
419
|
config.supportedTokens.forEach((tokenConfig) => {
|
|
@@ -911,12 +914,13 @@ const useAssets = ({
|
|
|
911
914
|
address,
|
|
912
915
|
supportedChains,
|
|
913
916
|
fetchBalances: fetchBalances2,
|
|
914
|
-
refreshInterval =
|
|
915
|
-
//
|
|
917
|
+
refreshInterval = 8e3
|
|
918
|
+
// 8 seconds default
|
|
916
919
|
}) => {
|
|
917
920
|
const [assets, setAssets] = useState([]);
|
|
918
921
|
const [loading, setLoading] = useState(false);
|
|
919
922
|
const [error, setError] = useState(null);
|
|
923
|
+
const isInitialLoadRef = useRef(true);
|
|
920
924
|
const addressRef = useRef(address);
|
|
921
925
|
const supportedChainsRef = useRef(supportedChains);
|
|
922
926
|
const fetchBalancesRef = useRef(fetchBalances2);
|
|
@@ -933,7 +937,9 @@ const useAssets = ({
|
|
|
933
937
|
setAssets([]);
|
|
934
938
|
return;
|
|
935
939
|
}
|
|
936
|
-
|
|
940
|
+
if (isInitialLoadRef.current) {
|
|
941
|
+
setLoading(true);
|
|
942
|
+
}
|
|
937
943
|
setError(null);
|
|
938
944
|
try {
|
|
939
945
|
const balances = await currentFetchBalances(currentAddress);
|
|
@@ -952,7 +958,10 @@ const useAssets = ({
|
|
|
952
958
|
setError(errorMessage);
|
|
953
959
|
console.error("Error fetching assets:", err);
|
|
954
960
|
} finally {
|
|
955
|
-
|
|
961
|
+
if (isInitialLoadRef.current) {
|
|
962
|
+
setLoading(false);
|
|
963
|
+
isInitialLoadRef.current = false;
|
|
964
|
+
}
|
|
956
965
|
}
|
|
957
966
|
}, []);
|
|
958
967
|
const getAssetsByChain = useCallback(
|
|
@@ -966,6 +975,7 @@ const useAssets = ({
|
|
|
966
975
|
}, [assets]);
|
|
967
976
|
useEffect(() => {
|
|
968
977
|
if (address) {
|
|
978
|
+
isInitialLoadRef.current = true;
|
|
969
979
|
refreshAssets();
|
|
970
980
|
}
|
|
971
981
|
}, [address, refreshAssets]);
|
|
@@ -1349,6 +1359,10 @@ const getChainName = (chainId) => {
|
|
|
1349
1359
|
return "Citrea Testnet";
|
|
1350
1360
|
case 123420001114:
|
|
1351
1361
|
return "Basecamp Testnet";
|
|
1362
|
+
case 84532:
|
|
1363
|
+
return "Base Sepolia";
|
|
1364
|
+
case 688689:
|
|
1365
|
+
return "Pharos Atlantic";
|
|
1352
1366
|
default:
|
|
1353
1367
|
return `Chain ${chainId}`;
|
|
1354
1368
|
}
|
|
@@ -5525,6 +5539,84 @@ const ConnectWalletModal = ({
|
|
|
5525
5539
|
},
|
|
5526
5540
|
children: [
|
|
5527
5541
|
/* @__PURE__ */ jsx(ModalHeader, { title: "Connect Wallet", onClose }),
|
|
5542
|
+
requiredChainId === 421614 && !isConnected && /* @__PURE__ */ jsx(
|
|
5543
|
+
"div",
|
|
5544
|
+
{
|
|
5545
|
+
style: {
|
|
5546
|
+
padding: "0 32px",
|
|
5547
|
+
marginTop: "20px"
|
|
5548
|
+
},
|
|
5549
|
+
children: /* @__PURE__ */ jsxs(
|
|
5550
|
+
"div",
|
|
5551
|
+
{
|
|
5552
|
+
style: {
|
|
5553
|
+
padding: "12px 16px",
|
|
5554
|
+
backgroundColor: "#EFF6FF",
|
|
5555
|
+
borderRadius: "8px",
|
|
5556
|
+
border: "1px solid #BFDBFE",
|
|
5557
|
+
display: "flex",
|
|
5558
|
+
alignItems: "center",
|
|
5559
|
+
gap: "10px"
|
|
5560
|
+
},
|
|
5561
|
+
children: [
|
|
5562
|
+
/* @__PURE__ */ jsx(
|
|
5563
|
+
"div",
|
|
5564
|
+
{
|
|
5565
|
+
style: {
|
|
5566
|
+
width: "32px",
|
|
5567
|
+
height: "32px",
|
|
5568
|
+
borderRadius: "50%",
|
|
5569
|
+
backgroundColor: "#DBEAFE",
|
|
5570
|
+
display: "flex",
|
|
5571
|
+
alignItems: "center",
|
|
5572
|
+
justifyContent: "center",
|
|
5573
|
+
flexShrink: 0
|
|
5574
|
+
},
|
|
5575
|
+
children: /* @__PURE__ */ jsx(
|
|
5576
|
+
"img",
|
|
5577
|
+
{
|
|
5578
|
+
src: img$3,
|
|
5579
|
+
alt: "Rabby",
|
|
5580
|
+
style: {
|
|
5581
|
+
width: "20px",
|
|
5582
|
+
height: "20px",
|
|
5583
|
+
objectFit: "contain"
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
)
|
|
5587
|
+
}
|
|
5588
|
+
),
|
|
5589
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
5590
|
+
/* @__PURE__ */ jsx(
|
|
5591
|
+
"p",
|
|
5592
|
+
{
|
|
5593
|
+
style: {
|
|
5594
|
+
margin: "0 0 4px 0",
|
|
5595
|
+
color: "#1E40AF",
|
|
5596
|
+
fontSize: "13px",
|
|
5597
|
+
fontWeight: 600
|
|
5598
|
+
},
|
|
5599
|
+
children: "Recommended Wallet"
|
|
5600
|
+
}
|
|
5601
|
+
),
|
|
5602
|
+
/* @__PURE__ */ jsx(
|
|
5603
|
+
"p",
|
|
5604
|
+
{
|
|
5605
|
+
style: {
|
|
5606
|
+
margin: 0,
|
|
5607
|
+
color: "#1E3A8A",
|
|
5608
|
+
fontSize: "12px",
|
|
5609
|
+
lineHeight: "1.4"
|
|
5610
|
+
},
|
|
5611
|
+
children: "For Arbitrum Sepolia, we recommend using Rabby wallet instead of MetaMask for the best experience."
|
|
5612
|
+
}
|
|
5613
|
+
)
|
|
5614
|
+
] })
|
|
5615
|
+
]
|
|
5616
|
+
}
|
|
5617
|
+
)
|
|
5618
|
+
}
|
|
5619
|
+
),
|
|
5528
5620
|
/* @__PURE__ */ jsxs(
|
|
5529
5621
|
"div",
|
|
5530
5622
|
{
|
|
@@ -5656,6 +5748,75 @@ const ConnectWalletModal = ({
|
|
|
5656
5748
|
]
|
|
5657
5749
|
}
|
|
5658
5750
|
),
|
|
5751
|
+
isConnected && requiredChainId === 421614 && activeConnector && (activeConnector.name.toLowerCase().includes("metamask") || activeConnector.type === "injected") && /* @__PURE__ */ jsxs(
|
|
5752
|
+
"div",
|
|
5753
|
+
{
|
|
5754
|
+
style: {
|
|
5755
|
+
padding: "12px 16px",
|
|
5756
|
+
backgroundColor: "#EFF6FF",
|
|
5757
|
+
borderRadius: "8px",
|
|
5758
|
+
border: "1px solid #BFDBFE",
|
|
5759
|
+
display: "flex",
|
|
5760
|
+
alignItems: "center",
|
|
5761
|
+
gap: "10px"
|
|
5762
|
+
},
|
|
5763
|
+
children: [
|
|
5764
|
+
/* @__PURE__ */ jsx(
|
|
5765
|
+
"div",
|
|
5766
|
+
{
|
|
5767
|
+
style: {
|
|
5768
|
+
width: "32px",
|
|
5769
|
+
height: "32px",
|
|
5770
|
+
borderRadius: "50%",
|
|
5771
|
+
backgroundColor: "#DBEAFE",
|
|
5772
|
+
display: "flex",
|
|
5773
|
+
alignItems: "center",
|
|
5774
|
+
justifyContent: "center",
|
|
5775
|
+
flexShrink: 0
|
|
5776
|
+
},
|
|
5777
|
+
children: /* @__PURE__ */ jsx(
|
|
5778
|
+
"img",
|
|
5779
|
+
{
|
|
5780
|
+
src: img$3,
|
|
5781
|
+
alt: "Rabby",
|
|
5782
|
+
style: {
|
|
5783
|
+
width: "20px",
|
|
5784
|
+
height: "20px",
|
|
5785
|
+
objectFit: "contain"
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
)
|
|
5789
|
+
}
|
|
5790
|
+
),
|
|
5791
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
|
|
5792
|
+
/* @__PURE__ */ jsx(
|
|
5793
|
+
"p",
|
|
5794
|
+
{
|
|
5795
|
+
style: {
|
|
5796
|
+
margin: "0 0 4px 0",
|
|
5797
|
+
color: "#1E40AF",
|
|
5798
|
+
fontSize: "13px",
|
|
5799
|
+
fontWeight: 600
|
|
5800
|
+
},
|
|
5801
|
+
children: "Recommended Wallet"
|
|
5802
|
+
}
|
|
5803
|
+
),
|
|
5804
|
+
/* @__PURE__ */ jsx(
|
|
5805
|
+
"p",
|
|
5806
|
+
{
|
|
5807
|
+
style: {
|
|
5808
|
+
margin: 0,
|
|
5809
|
+
color: "#1E3A8A",
|
|
5810
|
+
fontSize: "12px",
|
|
5811
|
+
lineHeight: "1.4"
|
|
5812
|
+
},
|
|
5813
|
+
children: "For Arbitrum Sepolia, we recommend using Rabby wallet instead of MetaMask for the best experience."
|
|
5814
|
+
}
|
|
5815
|
+
)
|
|
5816
|
+
] })
|
|
5817
|
+
]
|
|
5818
|
+
}
|
|
5819
|
+
),
|
|
5659
5820
|
isConnected && address ? /* @__PURE__ */ jsxs(
|
|
5660
5821
|
"div",
|
|
5661
5822
|
{
|
|
@@ -7046,7 +7207,7 @@ const DepositModal = React.memo(
|
|
|
7046
7207
|
address: sourceAddress || address,
|
|
7047
7208
|
supportedChains,
|
|
7048
7209
|
fetchBalances,
|
|
7049
|
-
refreshInterval:
|
|
7210
|
+
refreshInterval: 8e3
|
|
7050
7211
|
});
|
|
7051
7212
|
const [isExecuting, setIsExecuting] = useState(false);
|
|
7052
7213
|
const [error, setError] = useState(null);
|
|
@@ -7084,6 +7245,26 @@ const DepositModal = React.memo(
|
|
|
7084
7245
|
});
|
|
7085
7246
|
}
|
|
7086
7247
|
}, [depositAmount]);
|
|
7248
|
+
useEffect(() => {
|
|
7249
|
+
if (selectedDepositAssets.length === 0) return;
|
|
7250
|
+
setSelectedDepositAssets((prev) => {
|
|
7251
|
+
return prev.map((selectedItem) => {
|
|
7252
|
+
if (!selectedItem.asset) return selectedItem;
|
|
7253
|
+
const freshAsset = depositAssets.find(
|
|
7254
|
+
(a) => a.chainId === selectedItem.asset.chainId && a.address.toLowerCase() === selectedItem.asset.address.toLowerCase()
|
|
7255
|
+
);
|
|
7256
|
+
if (freshAsset) {
|
|
7257
|
+
return {
|
|
7258
|
+
...selectedItem,
|
|
7259
|
+
asset: freshAsset,
|
|
7260
|
+
// Preserve the user's entered amount
|
|
7261
|
+
amount: selectedItem.amount
|
|
7262
|
+
};
|
|
7263
|
+
}
|
|
7264
|
+
return selectedItem;
|
|
7265
|
+
});
|
|
7266
|
+
});
|
|
7267
|
+
}, [assets]);
|
|
7087
7268
|
useEffect(() => {
|
|
7088
7269
|
if (nonEip7702Mode && intentStatus?.overallStatus === "success" && postDepositInstruction && postDepositStatus === "idle") {
|
|
7089
7270
|
const bridgedAmount = bridgedAmountRef.current;
|
|
@@ -7134,8 +7315,16 @@ const DepositModal = React.memo(
|
|
|
7134
7315
|
const errorMessage = error2?.message || String(error2 || "");
|
|
7135
7316
|
const errorDetails = error2?.details || "";
|
|
7136
7317
|
const errorString = `${errorMessage} ${errorDetails}`.toLowerCase();
|
|
7318
|
+
console.error("RPC Error Details:", {
|
|
7319
|
+
code: error2?.code,
|
|
7320
|
+
message: errorMessage,
|
|
7321
|
+
details: errorDetails,
|
|
7322
|
+
data: error2?.data,
|
|
7323
|
+
stack: error2?.stack,
|
|
7324
|
+
fullError: error2
|
|
7325
|
+
});
|
|
7137
7326
|
if (errorString.includes("internal json-rpc error") || errorString.includes("internal error") || errorString.includes("an internal error was received")) {
|
|
7138
|
-
return "Network error
|
|
7327
|
+
return "RPC Network error. Try switching your MetaMask RPC endpoint or try again.";
|
|
7139
7328
|
}
|
|
7140
7329
|
return errorMessage || "Transaction failed";
|
|
7141
7330
|
}, []);
|
|
@@ -7225,6 +7414,7 @@ const DepositModal = React.memo(
|
|
|
7225
7414
|
}
|
|
7226
7415
|
setAirdropMessage("Airdrop requested successfully.");
|
|
7227
7416
|
} catch (e) {
|
|
7417
|
+
console.log(e);
|
|
7228
7418
|
const msg = handleRpcError(e);
|
|
7229
7419
|
setAirdropError(msg);
|
|
7230
7420
|
} finally {
|
|
@@ -7348,6 +7538,11 @@ const DepositModal = React.memo(
|
|
|
7348
7538
|
}
|
|
7349
7539
|
if (currentChain?.id !== chainId) {
|
|
7350
7540
|
setError("Wrong chain selected. Switching network...");
|
|
7541
|
+
console.log("Attempting to switch to chain:", {
|
|
7542
|
+
chainId,
|
|
7543
|
+
currentChainId: currentChain?.id,
|
|
7544
|
+
chainName: getChainName$1(chainId)
|
|
7545
|
+
});
|
|
7351
7546
|
try {
|
|
7352
7547
|
await switchChainAsync({ chainId });
|
|
7353
7548
|
let attempts = 0;
|
|
@@ -7434,6 +7629,14 @@ const DepositModal = React.memo(
|
|
|
7434
7629
|
tokenAddress = "0x0";
|
|
7435
7630
|
}
|
|
7436
7631
|
const isNative = selectedAsset.asset.isNative || tokenAddress.toLowerCase() === "0x0";
|
|
7632
|
+
console.log("Sending transaction via MetaMask:", {
|
|
7633
|
+
chainId,
|
|
7634
|
+
isNative,
|
|
7635
|
+
tokenAddress,
|
|
7636
|
+
delegateContract,
|
|
7637
|
+
amount: amount.toString(),
|
|
7638
|
+
walletChainId: externalWalletClient.chain?.id
|
|
7639
|
+
});
|
|
7437
7640
|
const txHash = isNative ? await externalWalletClient.sendTransaction({
|
|
7438
7641
|
to: delegateContract,
|
|
7439
7642
|
value: amount
|
|
@@ -7574,6 +7777,14 @@ const DepositModal = React.memo(
|
|
|
7574
7777
|
tokenAddress = "0x0";
|
|
7575
7778
|
}
|
|
7576
7779
|
const isNative = selectedAsset.asset.isNative || tokenAddress.toLowerCase() === "0x0";
|
|
7780
|
+
console.log("Sending EIP-7702 transaction via MetaMask:", {
|
|
7781
|
+
chainId,
|
|
7782
|
+
isNative,
|
|
7783
|
+
tokenAddress,
|
|
7784
|
+
amount: amount.toString(),
|
|
7785
|
+
recipient: address,
|
|
7786
|
+
walletChainId: externalWalletClient.chain?.id
|
|
7787
|
+
});
|
|
7577
7788
|
const transferToEmbeddedTx = isNative ? await externalWalletClient.sendTransaction({
|
|
7578
7789
|
to: address,
|
|
7579
7790
|
value: amount
|
|
@@ -10201,7 +10412,7 @@ const SpiceWithdraw = (props) => {
|
|
|
10201
10412
|
}
|
|
10202
10413
|
const transports = {};
|
|
10203
10414
|
chains.forEach((chain) => {
|
|
10204
|
-
transports[chain.id] = http$1();
|
|
10415
|
+
transports[chain.id] = http$1(chain.rpc);
|
|
10205
10416
|
});
|
|
10206
10417
|
const connectorsList = [metaMask()];
|
|
10207
10418
|
if (walletConnectProjectId) {
|