@spicenet-io/spiceflow-ui 1.9.15 → 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 CHANGED
@@ -4806,6 +4806,33 @@ const DepositWidget = ({
4806
4806
  const { intentStatus, startStatusPolling, clearStatus } = useStatus({
4807
4807
  checkStepStatus: (intentId, stepId) => relayerService.checkStepStatus(intentId, stepId)
4808
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]);
4809
4836
  React.useEffect(() => {
4810
4837
  if (depositInputHook && depositInputHook.depositAmount !== selectedDepositAsset?.amount) {
4811
4838
  if (selectedDepositAsset) {
@@ -4902,41 +4929,12 @@ const DepositWidget = ({
4902
4929
  };
4903
4930
  const result = await relayerService.submitTransaction(submitRequest);
4904
4931
  if (result) {
4905
- React.useEffect(() => {
4906
- if (intentStatus?.overallStatus === "success" && intentStatus.intentId && spiceDepositSubmittedRef.current !== intentStatus.intentId && selectedDepositAsset && address) {
4907
- const stepWithTxHash = intentStatus.steps.find(
4908
- (step) => step.transactionHash
4909
- );
4910
- if (stepWithTxHash?.transactionHash) {
4911
- spiceDepositSubmittedRef.current = intentStatus.intentId;
4912
- const withdrawalAmount = viem.parseUnits(
4913
- selectedDepositAsset.amount,
4914
- selectedDepositAsset.asset.decimals
4915
- );
4916
- relayerService.submitSpiceDeposit({
4917
- user: address,
4918
- txHash: stepWithTxHash.transactionHash,
4919
- sender: address,
4920
- tokenAddress: selectedDepositAsset.asset.address,
4921
- chainId: selectedDepositAsset.asset.chainId,
4922
- amount: withdrawalAmount.toString(),
4923
- isDeposit: false
4924
- }).then(() => {
4925
- refreshSpiceAssets();
4926
- }).catch((error2) => {
4927
- console.error("Failed to submit spice deposit:", error2);
4928
- spiceDepositSubmittedRef.current = null;
4929
- });
4930
- }
4931
- }
4932
- }, [intentStatus, selectedDepositAsset, address, refreshSpiceAssets]);
4933
4932
  const getChainName = (chainId) => {
4934
4933
  return `Chain ${chainId}`;
4935
4934
  };
4936
4935
  const initialSteps = createInitialSteps(allChainBatches, getChainName);
4937
4936
  startStatusPolling(result.intentId, initialSteps);
4938
4937
  onDepositSuccess?.(result.intentId);
4939
- refreshSpiceAssets();
4940
4938
  }
4941
4939
  } catch (error2) {
4942
4940
  const errorMessage = error2 instanceof Error ? error2.message : "Deposit failed";
package/dist/index.js CHANGED
@@ -4804,6 +4804,33 @@ const DepositWidget = ({
4804
4804
  const { intentStatus, startStatusPolling, clearStatus } = useStatus({
4805
4805
  checkStepStatus: (intentId, stepId) => relayerService.checkStepStatus(intentId, stepId)
4806
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]);
4807
4834
  useEffect(() => {
4808
4835
  if (depositInputHook && depositInputHook.depositAmount !== selectedDepositAsset?.amount) {
4809
4836
  if (selectedDepositAsset) {
@@ -4900,41 +4927,12 @@ const DepositWidget = ({
4900
4927
  };
4901
4928
  const result = await relayerService.submitTransaction(submitRequest);
4902
4929
  if (result) {
4903
- useEffect(() => {
4904
- if (intentStatus?.overallStatus === "success" && intentStatus.intentId && spiceDepositSubmittedRef.current !== intentStatus.intentId && selectedDepositAsset && address) {
4905
- const stepWithTxHash = intentStatus.steps.find(
4906
- (step) => step.transactionHash
4907
- );
4908
- if (stepWithTxHash?.transactionHash) {
4909
- spiceDepositSubmittedRef.current = intentStatus.intentId;
4910
- const withdrawalAmount = parseUnits(
4911
- selectedDepositAsset.amount,
4912
- selectedDepositAsset.asset.decimals
4913
- );
4914
- relayerService.submitSpiceDeposit({
4915
- user: address,
4916
- txHash: stepWithTxHash.transactionHash,
4917
- sender: address,
4918
- tokenAddress: selectedDepositAsset.asset.address,
4919
- chainId: selectedDepositAsset.asset.chainId,
4920
- amount: withdrawalAmount.toString(),
4921
- isDeposit: false
4922
- }).then(() => {
4923
- refreshSpiceAssets();
4924
- }).catch((error2) => {
4925
- console.error("Failed to submit spice deposit:", error2);
4926
- spiceDepositSubmittedRef.current = null;
4927
- });
4928
- }
4929
- }
4930
- }, [intentStatus, selectedDepositAsset, address, refreshSpiceAssets]);
4931
4930
  const getChainName = (chainId) => {
4932
4931
  return `Chain ${chainId}`;
4933
4932
  };
4934
4933
  const initialSteps = createInitialSteps(allChainBatches, getChainName);
4935
4934
  startStatusPolling(result.intentId, initialSteps);
4936
4935
  onDepositSuccess?.(result.intentId);
4937
- refreshSpiceAssets();
4938
4936
  }
4939
4937
  } catch (error2) {
4940
4938
  const errorMessage = error2 instanceof Error ? error2.message : "Deposit failed";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "1.9.15",
3
+ "version": "1.9.16",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",