@rhinestone/deposit-modal 0.13.0 → 0.14.1

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.
Files changed (57) hide show
  1. package/README.md +47 -12
  2. package/bridge-transcript.json +653 -0
  3. package/dist/ClaimModal-GDFENSLV.mjs +13 -0
  4. package/dist/ClaimModal-L3FUBI5U.cjs +13 -0
  5. package/dist/{DepositModalReown-3H75G3XQ.mjs → DepositModalReown-2EVV64OA.mjs} +30 -27
  6. package/dist/{DepositModalReown-YNNHLAV2.cjs → DepositModalReown-GAD45GIC.cjs} +77 -74
  7. package/dist/WithdrawModal-FAQH35NG.cjs +12 -0
  8. package/dist/WithdrawModal-IKUHF5CF.mjs +12 -0
  9. package/dist/{chunk-RAADLTSW.cjs → chunk-4J5ADVIN.cjs} +184 -139
  10. package/dist/{chunk-DSIZNRWA.mjs → chunk-5Q5CSVKF.mjs} +1049 -388
  11. package/dist/{chunk-HOGZKHHY.cjs → chunk-62UCV2LG.cjs} +3 -3
  12. package/dist/{chunk-CVGNCUVU.cjs → chunk-7AZFT2MV.cjs} +22 -13
  13. package/dist/{chunk-7N77GIP4.cjs → chunk-A6JPBMYY.cjs} +465 -171
  14. package/dist/{chunk-GACIGCSN.cjs → chunk-AQVJUXSG.cjs} +1 -1
  15. package/dist/{chunk-LTMMETAB.mjs → chunk-GZ4GQ5MC.mjs} +404 -110
  16. package/dist/{chunk-ZMT4ATHR.cjs → chunk-HAQOFI3D.cjs} +594 -41
  17. package/dist/{chunk-FZ5FZFIG.mjs → chunk-LMG46EP2.mjs} +1 -1
  18. package/dist/{chunk-2G2EIN4A.cjs → chunk-NQMC5VKQ.cjs} +1343 -682
  19. package/dist/{chunk-OLCD75JK.mjs → chunk-QACOOLOE.mjs} +451 -131
  20. package/dist/{chunk-XYJFEN5D.mjs → chunk-R5UQ3TN4.mjs} +1 -1
  21. package/dist/{chunk-EOMT5LKX.mjs → chunk-UX35GYLM.mjs} +556 -3
  22. package/dist/{chunk-YREVFB64.mjs → chunk-VALXN5IO.mjs} +16 -7
  23. package/dist/{chunk-COCBCQQC.mjs → chunk-XCTRKCNM.mjs} +51 -6
  24. package/dist/{chunk-5NUIKYSF.cjs → chunk-YP7QVKQ6.cjs} +458 -138
  25. package/dist/claim.cjs +6 -6
  26. package/dist/claim.d.cts +3 -3
  27. package/dist/claim.d.ts +3 -3
  28. package/dist/claim.mjs +5 -5
  29. package/dist/constants.cjs +2 -2
  30. package/dist/constants.d.cts +1 -1
  31. package/dist/constants.d.ts +1 -1
  32. package/dist/constants.mjs +1 -1
  33. package/dist/deposit.cjs +6 -6
  34. package/dist/deposit.d.cts +2 -2
  35. package/dist/deposit.d.ts +2 -2
  36. package/dist/deposit.mjs +5 -5
  37. package/dist/embed.cjs +310 -102
  38. package/dist/embed.d.cts +7 -1
  39. package/dist/embed.d.ts +7 -1
  40. package/dist/embed.mjs +285 -77
  41. package/dist/index.cjs +9 -9
  42. package/dist/index.d.cts +1 -1
  43. package/dist/index.d.ts +1 -1
  44. package/dist/index.mjs +8 -8
  45. package/dist/types-Bho4OA03.d.ts +982 -0
  46. package/dist/types-DP_3KwlD.d.cts +982 -0
  47. package/dist/withdraw.cjs +5 -5
  48. package/dist/withdraw.d.cts +3 -3
  49. package/dist/withdraw.d.ts +3 -3
  50. package/dist/withdraw.mjs +4 -4
  51. package/package.json +29 -7
  52. package/dist/ClaimModal-CREZO27I.mjs +0 -11
  53. package/dist/ClaimModal-JRIA32U2.cjs +0 -11
  54. package/dist/WithdrawModal-NVRX44IZ.mjs +0 -10
  55. package/dist/WithdrawModal-YYSBPCJJ.cjs +0 -10
  56. package/dist/types-B89I8_8H.d.ts +0 -638
  57. package/dist/types-nnDR4tqA.d.cts +0 -638
@@ -24,7 +24,7 @@ import {
24
24
  tokenAmountToNumber,
25
25
  useExplorerTxUrl,
26
26
  useLatestRef
27
- } from "./chunk-EOMT5LKX.mjs";
27
+ } from "./chunk-UX35GYLM.mjs";
28
28
  import {
29
29
  NATIVE_TOKEN_ADDRESS,
30
30
  SOLANA_MAINNET_CAIP2,
@@ -97,6 +97,32 @@ function warnRemovedProps(component, props) {
97
97
  }
98
98
  }
99
99
 
100
+ // src/core/analytics-target.ts
101
+ var HEX_TOKEN = /^0x(?:[0-9a-f]{32}|[0-9a-f]{40})$/i;
102
+ var BASE58_TOKEN = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
103
+ function analyticsTargetProperties(input) {
104
+ const properties = {};
105
+ const chain = resolveChain(input.targetChain);
106
+ const token = resolveToken(input.targetToken);
107
+ if (chain) properties.target_chain = chain;
108
+ if (token) properties.target_token = token;
109
+ return properties;
110
+ }
111
+ function resolveChain(targetChain) {
112
+ if (targetChain === void 0) return void 0;
113
+ if (typeof targetChain === "number" && !(targetChain > 0 && Number.isInteger(targetChain))) {
114
+ return void 0;
115
+ }
116
+ return targetChainToCaip2(targetChain);
117
+ }
118
+ function resolveToken(targetToken) {
119
+ const raw = targetToken?.trim();
120
+ if (!raw) return void 0;
121
+ if (HEX_TOKEN.test(raw)) return raw.toLowerCase();
122
+ if (BASE58_TOKEN.test(raw)) return raw;
123
+ return raw.toLowerCase() === "native" ? "native" : void 0;
124
+ }
125
+
100
126
  // src/core/submission-uncertainty.ts
101
127
  var MARKER = "__rhinestoneSubmissionUncertain";
102
128
  function markSubmissionUncertain(error) {
@@ -885,6 +911,7 @@ function ProcessingStep({
885
911
  onRetry,
886
912
  onDepositComplete,
887
913
  onDepositFailed,
914
+ onSourceTransactionObserved,
888
915
  onError
889
916
  }) {
890
917
  const startTimeRef = useRef2(Date.now());
@@ -905,6 +932,7 @@ function ProcessingStep({
905
932
  const onErrorRef = useLatestRef(onError);
906
933
  const explorerTxUrl = useExplorerTxUrl();
907
934
  const initialTerminalEventRef = useRef2(null);
935
+ const completedDirectTransferTxHashRef = useRef2(null);
908
936
  const [state, setState] = useState4(() => {
909
937
  if (directTransfer) return { type: "complete" };
910
938
  const initial = getInitialProcessingState(
@@ -940,7 +968,10 @@ function ProcessingStep({
940
968
  [txHash]
941
969
  );
942
970
  useEffect3(() => {
943
- if (!directTransfer) return;
971
+ if (!directTransfer || completedDirectTransferTxHashRef.current === txHash) {
972
+ return;
973
+ }
974
+ completedDirectTransferTxHashRef.current = txHash;
944
975
  const completedAt = Date.now();
945
976
  updatePhaseTimings(() => ({
946
977
  startedAt: startTimeRef.current,
@@ -1257,6 +1288,11 @@ function ProcessingStep({
1257
1288
  const targetChainId = targetChainToChainId(targetChain);
1258
1289
  const settledSourceTxHash = lastEvent?.data?.source?.transactionHash;
1259
1290
  const sourceExplorerHash = settledSourceTxHash ?? (sourceTxHashPending ? null : sourceTxHash);
1291
+ useEffect3(() => {
1292
+ if (sourceTxHashPending && settledSourceTxHash) {
1293
+ onSourceTransactionObserved?.(settledSourceTxHash);
1294
+ }
1295
+ }, [onSourceTransactionObserved, settledSourceTxHash, sourceTxHashPending]);
1260
1296
  const sourceExplorerUrl = sourceExplorerHash ? explorerTxUrl(displaySourceChain, sourceExplorerHash) : null;
1261
1297
  const destExplorerUrl = destinationTxHash ? explorerTxUrl(targetChainId, destinationTxHash) : null;
1262
1298
  const sourceDisplay = (() => {
@@ -1405,7 +1441,7 @@ function ProcessingStep({
1405
1441
  feesTooltip,
1406
1442
  newLabel: `New ${flowNoun}`,
1407
1443
  onNewDeposit,
1408
- onClose
1444
+ onClose: onClose ? () => onClose("success_done") : void 0
1409
1445
  }
1410
1446
  );
1411
1447
  }
@@ -1580,10 +1616,18 @@ function ProcessingStep({
1580
1616
  "New ",
1581
1617
  flowNoun
1582
1618
  ] }),
1583
- onClose && /* @__PURE__ */ jsx5(Button, { onClick: onClose, fullWidth: true, children: "Done" })
1619
+ onClose && /* @__PURE__ */ jsx5(Button, { onClick: () => onClose("success_done"), fullWidth: true, children: "Done" })
1584
1620
  ] }),
1585
1621
  isFailed && /* @__PURE__ */ jsxs4("div", { className: "rs-screen-button-row", children: [
1586
- onClose && /* @__PURE__ */ jsx5(Button, { variant: "outline", onClick: onClose, fullWidth: true, children: "Cancel" }),
1622
+ onClose && /* @__PURE__ */ jsx5(
1623
+ Button,
1624
+ {
1625
+ variant: "outline",
1626
+ onClick: () => onClose("failure_cancel"),
1627
+ fullWidth: true,
1628
+ children: "Cancel"
1629
+ }
1630
+ ),
1587
1631
  handleRetry && /* @__PURE__ */ jsx5(Button, { onClick: handleRetry, fullWidth: true, children: "Try again" })
1588
1632
  ] })
1589
1633
  ] }),
@@ -1799,5 +1843,6 @@ export {
1799
1843
  computeIsCacheable,
1800
1844
  readDedupedAccountSetupResult,
1801
1845
  runAccountSetupDeduped,
1802
- warnRemovedProps
1846
+ warnRemovedProps,
1847
+ analyticsTargetProperties
1803
1848
  };