@pollar/react 0.12.1-rc.5 → 0.12.1-rc.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.mjs CHANGED
@@ -1270,7 +1270,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1270
1270
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1271
1271
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1272
1272
  "v",
1273
- "0.12.1-rc.5"
1273
+ "0.12.1-rc.6"
1274
1274
  ] })
1275
1275
  ] });
1276
1276
  };
@@ -10256,6 +10256,9 @@ var REVEAL_MS = 3e4;
10256
10256
  var TX_LIMIT = 10;
10257
10257
  var FUNDING_POLL_MS = 5e3;
10258
10258
  var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "SENT", "BURNED", "ATTESTED", "MINTED"]);
10259
+ function newFundingKey() {
10260
+ return `fund-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
10261
+ }
10259
10262
  var FUNDING_STEPS = {
10260
10263
  STELLAR: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
10261
10264
  SOLANA: ["CREATED", "SENT"]
@@ -10323,6 +10326,7 @@ function CardModal({ onClose }) {
10323
10326
  const [deposit, setDeposit] = useState(null);
10324
10327
  const [fundings, setFundings] = useState(null);
10325
10328
  const [fundAmount, setFundAmount] = useState("");
10329
+ const fundKey = useRef(null);
10326
10330
  const [fundChain, setFundChain] = useState(null);
10327
10331
  const [showManual, setShowManual] = useState(false);
10328
10332
  const [occupations, setOccupations] = useState([]);
@@ -10504,7 +10508,19 @@ function CardModal({ onClose }) {
10504
10508
  const fund = () => run(
10505
10509
  "fund-send",
10506
10510
  async () => {
10507
- const outcome = await getClient().fundCard({ amount: fundAmount.trim(), chain: selectedFundChain });
10511
+ fundKey.current ?? (fundKey.current = newFundingKey());
10512
+ let outcome;
10513
+ try {
10514
+ outcome = await getClient().fundCard({
10515
+ amount: fundAmount.trim(),
10516
+ chain: selectedFundChain,
10517
+ idempotencyKey: fundKey.current
10518
+ });
10519
+ } catch (e) {
10520
+ if (isPollarApiError(e)) fundKey.current = null;
10521
+ throw e;
10522
+ }
10523
+ fundKey.current = null;
10508
10524
  if (outcome.status === "cancelled") {
10509
10525
  setError(copy.notSigned);
10510
10526
  return;