@kimafinance/kima-transaction-widget 1.4.4 → 1.4.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.js CHANGED
@@ -6107,7 +6107,7 @@ var SingleForm = ({
6107
6107
  placeholder: true
6108
6108
  }
6109
6109
  )
6110
- ), /* @__PURE__ */ React107.createElement("div", { className: `form-item ${theme.colorMode}` }, /* @__PURE__ */ React107.createElement("span", { className: "label" }, "Amount:"), /* @__PURE__ */ React107.createElement("div", { className: `amount-label-container items ${theme.colorMode}` }, /* @__PURE__ */ React107.createElement(
6110
+ ), mode === "bridge" /* bridge */ && /* @__PURE__ */ React107.createElement("div", { className: `form-item ${theme.colorMode}` }, /* @__PURE__ */ React107.createElement("span", { className: "label" }, "Amount:"), /* @__PURE__ */ React107.createElement("div", { className: `amount-label-container items ${theme.colorMode}` }, /* @__PURE__ */ React107.createElement(
6111
6111
  "input",
6112
6112
  {
6113
6113
  className: `${theme.colorMode}`,
@@ -6654,6 +6654,7 @@ var useSubmitTransaction = () => {
6654
6654
  const feeDeduct = useSelector43(selectFeeDeduct);
6655
6655
  const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
6656
6656
  const ccTransactionIdSeed = useSelector43(selectCCTransactionIdSeed);
6657
+ const submitted = useSelector43(selectSubmitted);
6657
6658
  const [isSubmitting, setIsSubmitting] = useState14(false);
6658
6659
  const mutation = useMutation({
6659
6660
  mutationFn: async (signature) => {
@@ -6710,11 +6711,11 @@ var useSubmitTransaction = () => {
6710
6711
  },
6711
6712
  retry: (failureCount, error) => {
6712
6713
  console.log("cc retry", failureCount, error, mutation.isSuccess);
6713
- if (mutation.isSuccess) {
6714
+ if (mutation.isSuccess || submitted) {
6714
6715
  dispatch(setCCTransactionRetrying(false));
6715
6716
  return false;
6716
6717
  }
6717
- const shouldRetry = transactionValues.originChain === "CC" && failureCount < 5;
6718
+ const shouldRetry = transactionValues.originChain === "CC" && failureCount < 10;
6718
6719
  if (shouldRetry) {
6719
6720
  dispatch(setCCTransactionRetrying(true));
6720
6721
  dispatch(setCCTransactionStatus("error-generic"));
@@ -6873,6 +6874,7 @@ var CCWidget = ({ submitCallback }) => {
6873
6874
  const { transactionValues } = useSelector44(selectServiceFee);
6874
6875
  const randomUserIdRef = useRef7(uuidv4());
6875
6876
  const ccTransactionIdSeedRef = useRef7(uuidv4());
6877
+ const ccTransactionSubmittedRef = useRef7(false);
6876
6878
  const { data: envOptions, isLoading: isEnvLoading } = useGetEnvOptions({
6877
6879
  kimaBackendUrl: backendUrl
6878
6880
  });
@@ -6903,9 +6905,12 @@ var CCWidget = ({ submitCallback }) => {
6903
6905
  }
6904
6906
  logger_default.info("postMessage: new message: ", event);
6905
6907
  if (event.data.type === "isCompleted") {
6906
- console.log("cc widget isCompleted");
6908
+ console.log("cc widget isCompleted", ccTransactionSubmittedRef.current);
6907
6909
  dispatch(setCCTransactionStatus("success"));
6908
- submitCallback();
6910
+ if (!ccTransactionSubmittedRef.current) {
6911
+ ccTransactionSubmittedRef.current = true;
6912
+ submitCallback();
6913
+ }
6909
6914
  }
6910
6915
  if (event.data.type === "isFailed") {
6911
6916
  dispatch(setCCTransactionStatus("failed"));