@spicenet-io/spiceflow-ui 1.9.14 → 1.9.16
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 +40 -87
- package/dist/index.js +40 -87
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4285,7 +4285,6 @@ const DepositStatusPanel = ({
|
|
|
4285
4285
|
};
|
|
4286
4286
|
if (intentStatus) {
|
|
4287
4287
|
const { steps, overallStatus } = intentStatus;
|
|
4288
|
-
const isProcessing = overallStatus === "processing";
|
|
4289
4288
|
const isSuccess = overallStatus === "success";
|
|
4290
4289
|
const isError = overallStatus === "failed";
|
|
4291
4290
|
const stepWithTxHash = steps.find((step) => step.transactionHash);
|
|
@@ -4322,9 +4321,9 @@ const DepositStatusPanel = ({
|
|
|
4322
4321
|
display: "flex",
|
|
4323
4322
|
alignItems: "center",
|
|
4324
4323
|
gap: "8px",
|
|
4325
|
-
cursor:
|
|
4324
|
+
cursor: "pointer"
|
|
4326
4325
|
},
|
|
4327
|
-
onClick:
|
|
4326
|
+
onClick: toggleDetails,
|
|
4328
4327
|
children: [
|
|
4329
4328
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4330
4329
|
"span",
|
|
@@ -4338,7 +4337,7 @@ const DepositStatusPanel = ({
|
|
|
4338
4337
|
children: "Deposit Results"
|
|
4339
4338
|
}
|
|
4340
4339
|
),
|
|
4341
|
-
|
|
4340
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4342
4341
|
"svg",
|
|
4343
4342
|
{
|
|
4344
4343
|
width: "16",
|
|
@@ -4364,7 +4363,7 @@ const DepositStatusPanel = ({
|
|
|
4364
4363
|
]
|
|
4365
4364
|
}
|
|
4366
4365
|
),
|
|
4367
|
-
|
|
4366
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4368
4367
|
"button",
|
|
4369
4368
|
{
|
|
4370
4369
|
onClick: onClose,
|
|
@@ -4393,47 +4392,7 @@ const DepositStatusPanel = ({
|
|
|
4393
4392
|
]
|
|
4394
4393
|
}
|
|
4395
4394
|
),
|
|
4396
|
-
|
|
4397
|
-
"div",
|
|
4398
|
-
{
|
|
4399
|
-
style: {
|
|
4400
|
-
display: "flex",
|
|
4401
|
-
flexDirection: "column",
|
|
4402
|
-
alignItems: "center",
|
|
4403
|
-
padding: "24px",
|
|
4404
|
-
marginBottom: "16px"
|
|
4405
|
-
},
|
|
4406
|
-
children: [
|
|
4407
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4408
|
-
"div",
|
|
4409
|
-
{
|
|
4410
|
-
style: {
|
|
4411
|
-
width: "48px",
|
|
4412
|
-
height: "48px",
|
|
4413
|
-
border: "3px solid #e5e7eb",
|
|
4414
|
-
borderTopColor: theme.colors.primary,
|
|
4415
|
-
borderRadius: "50%",
|
|
4416
|
-
animation: "spin 1s linear infinite",
|
|
4417
|
-
marginBottom: "16px"
|
|
4418
|
-
}
|
|
4419
|
-
}
|
|
4420
|
-
),
|
|
4421
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4422
|
-
"p",
|
|
4423
|
-
{
|
|
4424
|
-
style: {
|
|
4425
|
-
fontSize: "14px",
|
|
4426
|
-
fontWeight: 500,
|
|
4427
|
-
color: "#374151",
|
|
4428
|
-
margin: 0
|
|
4429
|
-
},
|
|
4430
|
-
children: "Processing your deposit..."
|
|
4431
|
-
}
|
|
4432
|
-
)
|
|
4433
|
-
]
|
|
4434
|
-
}
|
|
4435
|
-
),
|
|
4436
|
-
!isProcessing && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4395
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4437
4396
|
"div",
|
|
4438
4397
|
{
|
|
4439
4398
|
style: {
|
|
@@ -4450,7 +4409,7 @@ const DepositStatusPanel = ({
|
|
|
4450
4409
|
)
|
|
4451
4410
|
}
|
|
4452
4411
|
),
|
|
4453
|
-
|
|
4412
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4454
4413
|
"div",
|
|
4455
4414
|
{
|
|
4456
4415
|
style: {
|
|
@@ -4510,7 +4469,7 @@ const DepositStatusPanel = ({
|
|
|
4510
4469
|
)
|
|
4511
4470
|
}
|
|
4512
4471
|
),
|
|
4513
|
-
|
|
4472
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
4514
4473
|
isError && onRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4515
4474
|
"button",
|
|
4516
4475
|
{
|
|
@@ -4561,13 +4520,7 @@ const DepositStatusPanel = ({
|
|
|
4561
4520
|
children: "CONTINUE \u2192"
|
|
4562
4521
|
}
|
|
4563
4522
|
)
|
|
4564
|
-
] })
|
|
4565
|
-
/* @__PURE__ */ jsxRuntime.jsx("style", { children: `
|
|
4566
|
-
@keyframes spin {
|
|
4567
|
-
from { transform: rotate(0deg); }
|
|
4568
|
-
to { transform: rotate(360deg); }
|
|
4569
|
-
}
|
|
4570
|
-
` })
|
|
4523
|
+
] })
|
|
4571
4524
|
]
|
|
4572
4525
|
}
|
|
4573
4526
|
);
|
|
@@ -4834,9 +4787,7 @@ const DepositWidget = ({
|
|
|
4834
4787
|
provider,
|
|
4835
4788
|
actions
|
|
4836
4789
|
} = wallet;
|
|
4837
|
-
React.useContext(SpiceFlowProviderContext);
|
|
4838
4790
|
const [selectedDepositAsset, setSelectedDepositAsset] = React.useState(null);
|
|
4839
|
-
const [isPending, startTransition] = React.useTransition();
|
|
4840
4791
|
const {
|
|
4841
4792
|
assets: spiceAssets,
|
|
4842
4793
|
loading: loadingSpiceAssets,
|
|
@@ -4851,9 +4802,37 @@ const DepositWidget = ({
|
|
|
4851
4802
|
});
|
|
4852
4803
|
const [isExecuting, setIsExecuting] = React.useState(false);
|
|
4853
4804
|
const [error, setError] = React.useState(null);
|
|
4805
|
+
const spiceDepositSubmittedRef = React.useRef(null);
|
|
4854
4806
|
const { intentStatus, startStatusPolling, clearStatus } = useStatus({
|
|
4855
4807
|
checkStepStatus: (intentId, stepId) => relayerService.checkStepStatus(intentId, stepId)
|
|
4856
4808
|
});
|
|
4809
|
+
React.useEffect(() => {
|
|
4810
|
+
if (intentStatus?.overallStatus === "success" && intentStatus.intentId && spiceDepositSubmittedRef.current !== intentStatus.intentId && selectedDepositAsset && address) {
|
|
4811
|
+
const stepWithTxHash = intentStatus.steps.find(
|
|
4812
|
+
(step) => step.transactionHash
|
|
4813
|
+
);
|
|
4814
|
+
if (stepWithTxHash?.transactionHash) {
|
|
4815
|
+
spiceDepositSubmittedRef.current = intentStatus.intentId;
|
|
4816
|
+
const withdrawalAmount = viem.parseUnits(
|
|
4817
|
+
selectedDepositAsset.amount,
|
|
4818
|
+
selectedDepositAsset.asset.decimals
|
|
4819
|
+
);
|
|
4820
|
+
relayerService.submitSpiceDeposit({
|
|
4821
|
+
user: address,
|
|
4822
|
+
txHash: stepWithTxHash.transactionHash,
|
|
4823
|
+
sender: address,
|
|
4824
|
+
tokenAddress: selectedDepositAsset.asset.address,
|
|
4825
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
4826
|
+
amount: withdrawalAmount.toString(),
|
|
4827
|
+
isDeposit: false
|
|
4828
|
+
}).then(() => {
|
|
4829
|
+
refreshSpiceAssets();
|
|
4830
|
+
}).catch(() => {
|
|
4831
|
+
spiceDepositSubmittedRef.current = null;
|
|
4832
|
+
});
|
|
4833
|
+
}
|
|
4834
|
+
}
|
|
4835
|
+
}, [intentStatus, address]);
|
|
4857
4836
|
React.useEffect(() => {
|
|
4858
4837
|
if (depositInputHook && depositInputHook.depositAmount !== selectedDepositAsset?.amount) {
|
|
4859
4838
|
if (selectedDepositAsset) {
|
|
@@ -4877,7 +4856,7 @@ const DepositWidget = ({
|
|
|
4877
4856
|
const handleDepositAmountChange = React.useCallback(
|
|
4878
4857
|
(amount) => {
|
|
4879
4858
|
if (selectedDepositAsset) {
|
|
4880
|
-
startTransition(() => {
|
|
4859
|
+
React.startTransition(() => {
|
|
4881
4860
|
setSelectedDepositAsset({
|
|
4882
4861
|
...selectedDepositAsset,
|
|
4883
4862
|
amount
|
|
@@ -4950,26 +4929,12 @@ const DepositWidget = ({
|
|
|
4950
4929
|
};
|
|
4951
4930
|
const result = await relayerService.submitTransaction(submitRequest);
|
|
4952
4931
|
if (result) {
|
|
4953
|
-
const withdrawalAmount = viem.parseUnits(
|
|
4954
|
-
selectedDepositAsset.amount,
|
|
4955
|
-
selectedDepositAsset.asset.decimals
|
|
4956
|
-
);
|
|
4957
|
-
await relayerService.submitSpiceDeposit({
|
|
4958
|
-
user: address,
|
|
4959
|
-
txHash: result.hash,
|
|
4960
|
-
sender: address,
|
|
4961
|
-
tokenAddress: selectedDepositAsset.asset.address,
|
|
4962
|
-
chainId: selectedDepositAsset.asset.chainId,
|
|
4963
|
-
amount: withdrawalAmount.toString(),
|
|
4964
|
-
isDeposit: false
|
|
4965
|
-
});
|
|
4966
4932
|
const getChainName = (chainId) => {
|
|
4967
4933
|
return `Chain ${chainId}`;
|
|
4968
4934
|
};
|
|
4969
4935
|
const initialSteps = createInitialSteps(allChainBatches, getChainName);
|
|
4970
4936
|
startStatusPolling(result.intentId, initialSteps);
|
|
4971
4937
|
onDepositSuccess?.(result.intentId);
|
|
4972
|
-
refreshSpiceAssets();
|
|
4973
4938
|
}
|
|
4974
4939
|
} catch (error2) {
|
|
4975
4940
|
const errorMessage = error2 instanceof Error ? error2.message : "Deposit failed";
|
|
@@ -5016,6 +4981,7 @@ const DepositWidget = ({
|
|
|
5016
4981
|
onNewDeposit: () => {
|
|
5017
4982
|
clearStatus();
|
|
5018
4983
|
setSelectedDepositAsset(null);
|
|
4984
|
+
spiceDepositSubmittedRef.current = null;
|
|
5019
4985
|
refreshSpiceAssets();
|
|
5020
4986
|
},
|
|
5021
4987
|
theme
|
|
@@ -5853,7 +5819,7 @@ const CrossChainDepositModal = ({
|
|
|
5853
5819
|
if (confirmations < 2) {
|
|
5854
5820
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
5855
5821
|
}
|
|
5856
|
-
|
|
5822
|
+
await relayerService.submitSpiceDeposit({
|
|
5857
5823
|
txHash: hash,
|
|
5858
5824
|
sender: embeddedWalletAddress,
|
|
5859
5825
|
tokenAddress: asset.address,
|
|
@@ -5862,19 +5828,8 @@ const CrossChainDepositModal = ({
|
|
|
5862
5828
|
user: embeddedWalletAddress,
|
|
5863
5829
|
isDeposit: true
|
|
5864
5830
|
});
|
|
5865
|
-
const depositResult = await relayerService.submitSpiceDeposit({
|
|
5866
|
-
txHash: hash,
|
|
5867
|
-
sender: embeddedWalletAddress,
|
|
5868
|
-
tokenAddress: asset.address,
|
|
5869
|
-
chainId,
|
|
5870
|
-
amount: viem.parseUnits(amount, asset.decimals).toString(),
|
|
5871
|
-
user: embeddedWalletAddress,
|
|
5872
|
-
isDeposit: true
|
|
5873
|
-
});
|
|
5874
|
-
console.log("Deposit result:", depositResult);
|
|
5875
5831
|
results.push({ asset, txHash: hash, success: true });
|
|
5876
5832
|
} catch (err) {
|
|
5877
|
-
console.error(`Deposit error for ${asset.symbol}:`, err);
|
|
5878
5833
|
const error2 = err;
|
|
5879
5834
|
let errorMsg = error2?.message || "Deposit failed";
|
|
5880
5835
|
if (error2?.code === 4001 || error2?.message?.includes("rejected")) {
|
|
@@ -5888,7 +5843,6 @@ const CrossChainDepositModal = ({
|
|
|
5888
5843
|
setDepositResults(results);
|
|
5889
5844
|
setIsSuccess(true);
|
|
5890
5845
|
} catch (err) {
|
|
5891
|
-
console.error("Deposit error:", err);
|
|
5892
5846
|
const error2 = err;
|
|
5893
5847
|
setError(error2?.message || "Deposit failed");
|
|
5894
5848
|
} finally {
|
|
@@ -5901,8 +5855,7 @@ const CrossChainDepositModal = ({
|
|
|
5901
5855
|
chainId,
|
|
5902
5856
|
switchChainAsync,
|
|
5903
5857
|
escrowAddress,
|
|
5904
|
-
assets
|
|
5905
|
-
externalWalletAddress
|
|
5858
|
+
assets
|
|
5906
5859
|
]);
|
|
5907
5860
|
React.useEffect(() => {
|
|
5908
5861
|
if (!isOpen) {
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineChain, createPublicClient, http, isAddress, getAddress, parseEther, parseUnits, erc20Abi, encodeFunctionData } from 'viem';
|
|
3
3
|
import { basecampTestnet, citreaTestnet, baseSepolia, arbitrumSepolia, sepolia } from 'viem/chains';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import React, { useState, useRef, useEffect, useCallback, createContext, useContext, useTransition, useMemo, forwardRef, createElement } from 'react';
|
|
5
|
+
import React, { useState, useRef, useEffect, useCallback, createContext, useContext, useTransition, startTransition, useMemo, forwardRef, createElement } from 'react';
|
|
6
6
|
import { c as createTheme, B as Button, d as defaultTheme } from './Button-CWjGZdAM.js';
|
|
7
7
|
import { getBalance, readContract } from 'viem/actions';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
@@ -4283,7 +4283,6 @@ const DepositStatusPanel = ({
|
|
|
4283
4283
|
};
|
|
4284
4284
|
if (intentStatus) {
|
|
4285
4285
|
const { steps, overallStatus } = intentStatus;
|
|
4286
|
-
const isProcessing = overallStatus === "processing";
|
|
4287
4286
|
const isSuccess = overallStatus === "success";
|
|
4288
4287
|
const isError = overallStatus === "failed";
|
|
4289
4288
|
const stepWithTxHash = steps.find((step) => step.transactionHash);
|
|
@@ -4320,9 +4319,9 @@ const DepositStatusPanel = ({
|
|
|
4320
4319
|
display: "flex",
|
|
4321
4320
|
alignItems: "center",
|
|
4322
4321
|
gap: "8px",
|
|
4323
|
-
cursor:
|
|
4322
|
+
cursor: "pointer"
|
|
4324
4323
|
},
|
|
4325
|
-
onClick:
|
|
4324
|
+
onClick: toggleDetails,
|
|
4326
4325
|
children: [
|
|
4327
4326
|
/* @__PURE__ */ jsx(
|
|
4328
4327
|
"span",
|
|
@@ -4336,7 +4335,7 @@ const DepositStatusPanel = ({
|
|
|
4336
4335
|
children: "Deposit Results"
|
|
4337
4336
|
}
|
|
4338
4337
|
),
|
|
4339
|
-
|
|
4338
|
+
/* @__PURE__ */ jsx(
|
|
4340
4339
|
"svg",
|
|
4341
4340
|
{
|
|
4342
4341
|
width: "16",
|
|
@@ -4362,7 +4361,7 @@ const DepositStatusPanel = ({
|
|
|
4362
4361
|
]
|
|
4363
4362
|
}
|
|
4364
4363
|
),
|
|
4365
|
-
|
|
4364
|
+
/* @__PURE__ */ jsx(
|
|
4366
4365
|
"button",
|
|
4367
4366
|
{
|
|
4368
4367
|
onClick: onClose,
|
|
@@ -4391,47 +4390,7 @@ const DepositStatusPanel = ({
|
|
|
4391
4390
|
]
|
|
4392
4391
|
}
|
|
4393
4392
|
),
|
|
4394
|
-
|
|
4395
|
-
"div",
|
|
4396
|
-
{
|
|
4397
|
-
style: {
|
|
4398
|
-
display: "flex",
|
|
4399
|
-
flexDirection: "column",
|
|
4400
|
-
alignItems: "center",
|
|
4401
|
-
padding: "24px",
|
|
4402
|
-
marginBottom: "16px"
|
|
4403
|
-
},
|
|
4404
|
-
children: [
|
|
4405
|
-
/* @__PURE__ */ jsx(
|
|
4406
|
-
"div",
|
|
4407
|
-
{
|
|
4408
|
-
style: {
|
|
4409
|
-
width: "48px",
|
|
4410
|
-
height: "48px",
|
|
4411
|
-
border: "3px solid #e5e7eb",
|
|
4412
|
-
borderTopColor: theme.colors.primary,
|
|
4413
|
-
borderRadius: "50%",
|
|
4414
|
-
animation: "spin 1s linear infinite",
|
|
4415
|
-
marginBottom: "16px"
|
|
4416
|
-
}
|
|
4417
|
-
}
|
|
4418
|
-
),
|
|
4419
|
-
/* @__PURE__ */ jsx(
|
|
4420
|
-
"p",
|
|
4421
|
-
{
|
|
4422
|
-
style: {
|
|
4423
|
-
fontSize: "14px",
|
|
4424
|
-
fontWeight: 500,
|
|
4425
|
-
color: "#374151",
|
|
4426
|
-
margin: 0
|
|
4427
|
-
},
|
|
4428
|
-
children: "Processing your deposit..."
|
|
4429
|
-
}
|
|
4430
|
-
)
|
|
4431
|
-
]
|
|
4432
|
-
}
|
|
4433
|
-
),
|
|
4434
|
-
!isProcessing && /* @__PURE__ */ jsx(
|
|
4393
|
+
/* @__PURE__ */ jsx(
|
|
4435
4394
|
"div",
|
|
4436
4395
|
{
|
|
4437
4396
|
style: {
|
|
@@ -4448,7 +4407,7 @@ const DepositStatusPanel = ({
|
|
|
4448
4407
|
)
|
|
4449
4408
|
}
|
|
4450
4409
|
),
|
|
4451
|
-
|
|
4410
|
+
/* @__PURE__ */ jsx(
|
|
4452
4411
|
"div",
|
|
4453
4412
|
{
|
|
4454
4413
|
style: {
|
|
@@ -4508,7 +4467,7 @@ const DepositStatusPanel = ({
|
|
|
4508
4467
|
)
|
|
4509
4468
|
}
|
|
4510
4469
|
),
|
|
4511
|
-
|
|
4470
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
4512
4471
|
isError && onRetry && /* @__PURE__ */ jsx(
|
|
4513
4472
|
"button",
|
|
4514
4473
|
{
|
|
@@ -4559,13 +4518,7 @@ const DepositStatusPanel = ({
|
|
|
4559
4518
|
children: "CONTINUE \u2192"
|
|
4560
4519
|
}
|
|
4561
4520
|
)
|
|
4562
|
-
] })
|
|
4563
|
-
/* @__PURE__ */ jsx("style", { children: `
|
|
4564
|
-
@keyframes spin {
|
|
4565
|
-
from { transform: rotate(0deg); }
|
|
4566
|
-
to { transform: rotate(360deg); }
|
|
4567
|
-
}
|
|
4568
|
-
` })
|
|
4521
|
+
] })
|
|
4569
4522
|
]
|
|
4570
4523
|
}
|
|
4571
4524
|
);
|
|
@@ -4832,9 +4785,7 @@ const DepositWidget = ({
|
|
|
4832
4785
|
provider,
|
|
4833
4786
|
actions
|
|
4834
4787
|
} = wallet;
|
|
4835
|
-
useContext(SpiceFlowProviderContext);
|
|
4836
4788
|
const [selectedDepositAsset, setSelectedDepositAsset] = useState(null);
|
|
4837
|
-
const [isPending, startTransition] = useTransition();
|
|
4838
4789
|
const {
|
|
4839
4790
|
assets: spiceAssets,
|
|
4840
4791
|
loading: loadingSpiceAssets,
|
|
@@ -4849,9 +4800,37 @@ const DepositWidget = ({
|
|
|
4849
4800
|
});
|
|
4850
4801
|
const [isExecuting, setIsExecuting] = useState(false);
|
|
4851
4802
|
const [error, setError] = useState(null);
|
|
4803
|
+
const spiceDepositSubmittedRef = useRef(null);
|
|
4852
4804
|
const { intentStatus, startStatusPolling, clearStatus } = useStatus({
|
|
4853
4805
|
checkStepStatus: (intentId, stepId) => relayerService.checkStepStatus(intentId, stepId)
|
|
4854
4806
|
});
|
|
4807
|
+
useEffect(() => {
|
|
4808
|
+
if (intentStatus?.overallStatus === "success" && intentStatus.intentId && spiceDepositSubmittedRef.current !== intentStatus.intentId && selectedDepositAsset && address) {
|
|
4809
|
+
const stepWithTxHash = intentStatus.steps.find(
|
|
4810
|
+
(step) => step.transactionHash
|
|
4811
|
+
);
|
|
4812
|
+
if (stepWithTxHash?.transactionHash) {
|
|
4813
|
+
spiceDepositSubmittedRef.current = intentStatus.intentId;
|
|
4814
|
+
const withdrawalAmount = parseUnits(
|
|
4815
|
+
selectedDepositAsset.amount,
|
|
4816
|
+
selectedDepositAsset.asset.decimals
|
|
4817
|
+
);
|
|
4818
|
+
relayerService.submitSpiceDeposit({
|
|
4819
|
+
user: address,
|
|
4820
|
+
txHash: stepWithTxHash.transactionHash,
|
|
4821
|
+
sender: address,
|
|
4822
|
+
tokenAddress: selectedDepositAsset.asset.address,
|
|
4823
|
+
chainId: selectedDepositAsset.asset.chainId,
|
|
4824
|
+
amount: withdrawalAmount.toString(),
|
|
4825
|
+
isDeposit: false
|
|
4826
|
+
}).then(() => {
|
|
4827
|
+
refreshSpiceAssets();
|
|
4828
|
+
}).catch(() => {
|
|
4829
|
+
spiceDepositSubmittedRef.current = null;
|
|
4830
|
+
});
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
}, [intentStatus, address]);
|
|
4855
4834
|
useEffect(() => {
|
|
4856
4835
|
if (depositInputHook && depositInputHook.depositAmount !== selectedDepositAsset?.amount) {
|
|
4857
4836
|
if (selectedDepositAsset) {
|
|
@@ -4948,26 +4927,12 @@ const DepositWidget = ({
|
|
|
4948
4927
|
};
|
|
4949
4928
|
const result = await relayerService.submitTransaction(submitRequest);
|
|
4950
4929
|
if (result) {
|
|
4951
|
-
const withdrawalAmount = parseUnits(
|
|
4952
|
-
selectedDepositAsset.amount,
|
|
4953
|
-
selectedDepositAsset.asset.decimals
|
|
4954
|
-
);
|
|
4955
|
-
await relayerService.submitSpiceDeposit({
|
|
4956
|
-
user: address,
|
|
4957
|
-
txHash: result.hash,
|
|
4958
|
-
sender: address,
|
|
4959
|
-
tokenAddress: selectedDepositAsset.asset.address,
|
|
4960
|
-
chainId: selectedDepositAsset.asset.chainId,
|
|
4961
|
-
amount: withdrawalAmount.toString(),
|
|
4962
|
-
isDeposit: false
|
|
4963
|
-
});
|
|
4964
4930
|
const getChainName = (chainId) => {
|
|
4965
4931
|
return `Chain ${chainId}`;
|
|
4966
4932
|
};
|
|
4967
4933
|
const initialSteps = createInitialSteps(allChainBatches, getChainName);
|
|
4968
4934
|
startStatusPolling(result.intentId, initialSteps);
|
|
4969
4935
|
onDepositSuccess?.(result.intentId);
|
|
4970
|
-
refreshSpiceAssets();
|
|
4971
4936
|
}
|
|
4972
4937
|
} catch (error2) {
|
|
4973
4938
|
const errorMessage = error2 instanceof Error ? error2.message : "Deposit failed";
|
|
@@ -5014,6 +4979,7 @@ const DepositWidget = ({
|
|
|
5014
4979
|
onNewDeposit: () => {
|
|
5015
4980
|
clearStatus();
|
|
5016
4981
|
setSelectedDepositAsset(null);
|
|
4982
|
+
spiceDepositSubmittedRef.current = null;
|
|
5017
4983
|
refreshSpiceAssets();
|
|
5018
4984
|
},
|
|
5019
4985
|
theme
|
|
@@ -5851,7 +5817,7 @@ const CrossChainDepositModal = ({
|
|
|
5851
5817
|
if (confirmations < 2) {
|
|
5852
5818
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
5853
5819
|
}
|
|
5854
|
-
|
|
5820
|
+
await relayerService.submitSpiceDeposit({
|
|
5855
5821
|
txHash: hash,
|
|
5856
5822
|
sender: embeddedWalletAddress,
|
|
5857
5823
|
tokenAddress: asset.address,
|
|
@@ -5860,19 +5826,8 @@ const CrossChainDepositModal = ({
|
|
|
5860
5826
|
user: embeddedWalletAddress,
|
|
5861
5827
|
isDeposit: true
|
|
5862
5828
|
});
|
|
5863
|
-
const depositResult = await relayerService.submitSpiceDeposit({
|
|
5864
|
-
txHash: hash,
|
|
5865
|
-
sender: embeddedWalletAddress,
|
|
5866
|
-
tokenAddress: asset.address,
|
|
5867
|
-
chainId,
|
|
5868
|
-
amount: parseUnits(amount, asset.decimals).toString(),
|
|
5869
|
-
user: embeddedWalletAddress,
|
|
5870
|
-
isDeposit: true
|
|
5871
|
-
});
|
|
5872
|
-
console.log("Deposit result:", depositResult);
|
|
5873
5829
|
results.push({ asset, txHash: hash, success: true });
|
|
5874
5830
|
} catch (err) {
|
|
5875
|
-
console.error(`Deposit error for ${asset.symbol}:`, err);
|
|
5876
5831
|
const error2 = err;
|
|
5877
5832
|
let errorMsg = error2?.message || "Deposit failed";
|
|
5878
5833
|
if (error2?.code === 4001 || error2?.message?.includes("rejected")) {
|
|
@@ -5886,7 +5841,6 @@ const CrossChainDepositModal = ({
|
|
|
5886
5841
|
setDepositResults(results);
|
|
5887
5842
|
setIsSuccess(true);
|
|
5888
5843
|
} catch (err) {
|
|
5889
|
-
console.error("Deposit error:", err);
|
|
5890
5844
|
const error2 = err;
|
|
5891
5845
|
setError(error2?.message || "Deposit failed");
|
|
5892
5846
|
} finally {
|
|
@@ -5899,8 +5853,7 @@ const CrossChainDepositModal = ({
|
|
|
5899
5853
|
chainId,
|
|
5900
5854
|
switchChainAsync,
|
|
5901
5855
|
escrowAddress,
|
|
5902
|
-
assets
|
|
5903
|
-
externalWalletAddress
|
|
5856
|
+
assets
|
|
5904
5857
|
]);
|
|
5905
5858
|
useEffect(() => {
|
|
5906
5859
|
if (!isOpen) {
|