@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.cjs CHANGED
@@ -6069,7 +6069,7 @@ var SingleForm = ({
6069
6069
  placeholder: true
6070
6070
  }
6071
6071
  )
6072
- ), /* @__PURE__ */ import_react124.default.createElement("div", { className: `form-item ${theme.colorMode}` }, /* @__PURE__ */ import_react124.default.createElement("span", { className: "label" }, "Amount:"), /* @__PURE__ */ import_react124.default.createElement("div", { className: `amount-label-container items ${theme.colorMode}` }, /* @__PURE__ */ import_react124.default.createElement(
6072
+ ), mode === "bridge" /* bridge */ && /* @__PURE__ */ import_react124.default.createElement("div", { className: `form-item ${theme.colorMode}` }, /* @__PURE__ */ import_react124.default.createElement("span", { className: "label" }, "Amount:"), /* @__PURE__ */ import_react124.default.createElement("div", { className: `amount-label-container items ${theme.colorMode}` }, /* @__PURE__ */ import_react124.default.createElement(
6073
6073
  "input",
6074
6074
  {
6075
6075
  className: `${theme.colorMode}`,
@@ -6616,6 +6616,7 @@ var useSubmitTransaction = () => {
6616
6616
  const feeDeduct = (0, import_react_redux54.useSelector)(selectFeeDeduct);
6617
6617
  const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
6618
6618
  const ccTransactionIdSeed = (0, import_react_redux54.useSelector)(selectCCTransactionIdSeed);
6619
+ const submitted = (0, import_react_redux54.useSelector)(selectSubmitted);
6619
6620
  const [isSubmitting, setIsSubmitting] = (0, import_react132.useState)(false);
6620
6621
  const mutation = (0, import_react_query16.useMutation)({
6621
6622
  mutationFn: async (signature) => {
@@ -6672,11 +6673,11 @@ var useSubmitTransaction = () => {
6672
6673
  },
6673
6674
  retry: (failureCount, error) => {
6674
6675
  console.log("cc retry", failureCount, error, mutation.isSuccess);
6675
- if (mutation.isSuccess) {
6676
+ if (mutation.isSuccess || submitted) {
6676
6677
  dispatch(setCCTransactionRetrying(false));
6677
6678
  return false;
6678
6679
  }
6679
- const shouldRetry = transactionValues.originChain === "CC" && failureCount < 5;
6680
+ const shouldRetry = transactionValues.originChain === "CC" && failureCount < 10;
6680
6681
  if (shouldRetry) {
6681
6682
  dispatch(setCCTransactionRetrying(true));
6682
6683
  dispatch(setCCTransactionStatus("error-generic"));
@@ -6835,6 +6836,7 @@ var CCWidget = ({ submitCallback }) => {
6835
6836
  const { transactionValues } = (0, import_react_redux55.useSelector)(selectServiceFee);
6836
6837
  const randomUserIdRef = (0, import_react134.useRef)((0, import_uuid.v4)());
6837
6838
  const ccTransactionIdSeedRef = (0, import_react134.useRef)((0, import_uuid.v4)());
6839
+ const ccTransactionSubmittedRef = (0, import_react134.useRef)(false);
6838
6840
  const { data: envOptions, isLoading: isEnvLoading } = useGetEnvOptions({
6839
6841
  kimaBackendUrl: backendUrl
6840
6842
  });
@@ -6865,9 +6867,12 @@ var CCWidget = ({ submitCallback }) => {
6865
6867
  }
6866
6868
  logger_default.info("postMessage: new message: ", event);
6867
6869
  if (event.data.type === "isCompleted") {
6868
- console.log("cc widget isCompleted");
6870
+ console.log("cc widget isCompleted", ccTransactionSubmittedRef.current);
6869
6871
  dispatch(setCCTransactionStatus("success"));
6870
- submitCallback();
6872
+ if (!ccTransactionSubmittedRef.current) {
6873
+ ccTransactionSubmittedRef.current = true;
6874
+ submitCallback();
6875
+ }
6871
6876
  }
6872
6877
  if (event.data.type === "isFailed") {
6873
6878
  dispatch(setCCTransactionStatus("failed"));