@rhinestone/deposit-modal 0.14.1 → 0.15.0

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 (68) hide show
  1. package/README.md +6 -0
  2. package/bridge-transcript.json +14 -0
  3. package/dist/ClaimModal-GFDBVCN5.cjs +11 -0
  4. package/dist/ClaimModal-VQS3AKEL.mjs +11 -0
  5. package/dist/{DepositModalReown-2EVV64OA.mjs → DepositModalReown-KOJ7VEY7.mjs} +6 -7
  6. package/dist/{DepositModalReown-GAD45GIC.cjs → DepositModalReown-R37SSHUF.cjs} +21 -22
  7. package/dist/WithdrawModal-QVXHMH43.mjs +12 -0
  8. package/dist/WithdrawModal-RY2NMFLE.cjs +12 -0
  9. package/dist/{caip-D8aRWdEY.d.cts → caip-BMi-9t09.d.cts} +27 -3
  10. package/dist/{caip-D8aRWdEY.d.ts → caip-BMi-9t09.d.ts} +27 -3
  11. package/dist/{chunk-HAQOFI3D.cjs → chunk-3OOY67VJ.cjs} +1046 -226
  12. package/dist/{chunk-AQVJUXSG.cjs → chunk-5P2PVLS4.cjs} +1 -1
  13. package/dist/{chunk-UX35GYLM.mjs → chunk-5VONFVQN.mjs} +918 -98
  14. package/dist/chunk-6HUHVXCY.cjs +704 -0
  15. package/dist/{chunk-GZ4GQ5MC.mjs → chunk-7UQ6OUEE.mjs} +166 -45
  16. package/dist/{chunk-LMG46EP2.mjs → chunk-CXBMIZUF.mjs} +1 -1
  17. package/dist/{chunk-A6JPBMYY.cjs → chunk-DTVZUBHI.cjs} +236 -115
  18. package/dist/{chunk-VUATPOWJ.mjs → chunk-EAGMY3QE.mjs} +74 -17
  19. package/dist/{chunk-RN5VKWI6.mjs → chunk-FTWKAJGN.mjs} +1 -1
  20. package/dist/{chunk-5Q5CSVKF.mjs → chunk-IKUYZA7A.mjs} +195 -495
  21. package/dist/{chunk-DW2EQA2U.cjs → chunk-LVCD6RHF.cjs} +2 -2
  22. package/dist/{chunk-4KCSH4T3.cjs → chunk-OY5N3E6L.cjs} +86 -29
  23. package/dist/chunk-QJ7RCCU7.mjs +704 -0
  24. package/dist/{chunk-XCTRKCNM.mjs → chunk-UCBUCX2W.mjs} +1515 -194
  25. package/dist/{chunk-NQMC5VKQ.cjs → chunk-VPDCGD2D.cjs} +552 -852
  26. package/dist/{chunk-4J5ADVIN.cjs → chunk-X4D52IZK.cjs} +1496 -175
  27. package/dist/claim.cjs +5 -7
  28. package/dist/claim.d.cts +3 -3
  29. package/dist/claim.d.ts +3 -3
  30. package/dist/claim.mjs +4 -6
  31. package/dist/{constants-DBrWhJWE.d.cts → constants-BT4ctuHo.d.cts} +7 -6
  32. package/dist/{constants-DBrWhJWE.d.ts → constants-D21ZdNOP.d.ts} +7 -6
  33. package/dist/constants.cjs +3 -3
  34. package/dist/constants.d.cts +3 -3
  35. package/dist/constants.d.ts +3 -3
  36. package/dist/constants.mjs +2 -2
  37. package/dist/deposit.cjs +7 -8
  38. package/dist/deposit.d.cts +3 -3
  39. package/dist/deposit.d.ts +3 -3
  40. package/dist/deposit.mjs +6 -7
  41. package/dist/embed.cjs +135 -44
  42. package/dist/embed.d.cts +2 -2
  43. package/dist/embed.d.ts +2 -2
  44. package/dist/embed.mjs +116 -25
  45. package/dist/index.cjs +13 -11
  46. package/dist/index.d.cts +3 -3
  47. package/dist/index.d.ts +3 -3
  48. package/dist/index.mjs +12 -10
  49. package/dist/polymarket.cjs +6 -6
  50. package/dist/polymarket.mjs +2 -2
  51. package/dist/styles.css +132 -100
  52. package/dist/{types-DP_3KwlD.d.cts → types-CQ0NHqCy.d.ts} +146 -11
  53. package/dist/{types-Bho4OA03.d.ts → types-CxiLX5sv.d.cts} +146 -11
  54. package/dist/withdraw.cjs +6 -6
  55. package/dist/withdraw.d.cts +4 -4
  56. package/dist/withdraw.d.ts +4 -4
  57. package/dist/withdraw.mjs +5 -5
  58. package/package.json +6 -6
  59. package/dist/ClaimModal-GDFENSLV.mjs +0 -13
  60. package/dist/ClaimModal-L3FUBI5U.cjs +0 -13
  61. package/dist/WithdrawModal-FAQH35NG.cjs +0 -12
  62. package/dist/WithdrawModal-IKUHF5CF.mjs +0 -12
  63. package/dist/chunk-62UCV2LG.cjs +0 -81
  64. package/dist/chunk-7AZFT2MV.cjs +0 -163
  65. package/dist/chunk-QACOOLOE.mjs +0 -1062
  66. package/dist/chunk-R5UQ3TN4.mjs +0 -81
  67. package/dist/chunk-VALXN5IO.mjs +0 -163
  68. package/dist/chunk-YP7QVKQ6.cjs +0 -1062
@@ -1,81 +0,0 @@
1
- import {
2
- CdnIcon,
3
- ChevronRightIcon
4
- } from "./chunk-UX35GYLM.mjs";
5
-
6
- // src/components/ui/ListRow.tsx
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- function ListRow({
9
- leading,
10
- leadingMedia,
11
- title,
12
- subtitle,
13
- meta,
14
- trailing,
15
- action,
16
- className = "",
17
- onClick,
18
- disabled,
19
- ...props
20
- }) {
21
- const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
22
- leadingMedia ? /* @__PURE__ */ jsx("span", { className: "rs-list-row-leading rs-list-row-leading--media", children: /* @__PURE__ */ jsx(CdnIcon, { src: leadingMedia }) }) : leading ? /* @__PURE__ */ jsx("span", { className: "rs-list-row-leading", children: leading }) : null,
23
- /* @__PURE__ */ jsxs("div", { className: "rs-list-row-body", children: [
24
- /* @__PURE__ */ jsxs("div", { className: "rs-list-row-text", children: [
25
- /* @__PURE__ */ jsx("span", { className: "rs-list-row-title", children: title }),
26
- subtitle && /* @__PURE__ */ jsx("span", { className: "rs-list-row-subtitle", children: subtitle })
27
- ] }),
28
- action ? /* @__PURE__ */ jsx(
29
- "button",
30
- {
31
- type: "button",
32
- className: "rs-list-row-action",
33
- disabled,
34
- onClick: (e) => {
35
- e.stopPropagation();
36
- action.onClick();
37
- },
38
- children: action.label
39
- }
40
- ) : meta && /* @__PURE__ */ jsx("div", { className: "rs-list-row-meta", children: meta })
41
- ] }),
42
- /* @__PURE__ */ jsx("span", { className: "rs-list-row-chevron", children: trailing ?? (disabled ? null : /* @__PURE__ */ jsx(ChevronRightIcon, {})) })
43
- ] });
44
- if (action) {
45
- const handleKey = (e) => {
46
- if (disabled) return;
47
- if (e.key === "Enter" || e.key === " ") {
48
- e.preventDefault();
49
- onClick?.(e);
50
- }
51
- };
52
- return /* @__PURE__ */ jsx(
53
- "div",
54
- {
55
- className: `rs-list-row ${className}`.trim(),
56
- role: "button",
57
- tabIndex: disabled ? -1 : 0,
58
- "aria-disabled": disabled || void 0,
59
- onClick: disabled ? void 0 : (e) => onClick?.(e),
60
- onKeyDown: handleKey,
61
- children: inner
62
- }
63
- );
64
- }
65
- return /* @__PURE__ */ jsx(
66
- "button",
67
- {
68
- type: "button",
69
- className: `rs-list-row ${className}`.trim(),
70
- onClick,
71
- disabled,
72
- ...props,
73
- children: inner
74
- }
75
- );
76
- }
77
- ListRow.displayName = "ListRow";
78
-
79
- export {
80
- ListRow
81
- };
@@ -1,163 +0,0 @@
1
- import {
2
- debugError,
3
- debugLog
4
- } from "./chunk-UX35GYLM.mjs";
5
- import {
6
- serviceHeaders
7
- } from "./chunk-LMG46EP2.mjs";
8
-
9
- // src/core/recovery.ts
10
- var RECOVER_DOMAIN = {
11
- name: "Rhinestone Deposit Recovery",
12
- version: "1"
13
- };
14
- var RECOVER_TYPES = {
15
- RecoverDeposit: [
16
- { name: "depositId", type: "uint256" },
17
- { name: "destination", type: "address" }
18
- ]
19
- };
20
- var RecoveryError = class extends Error {
21
- constructor(message, status, code, retryable = false, phase = "response") {
22
- super(message);
23
- this.name = "RecoveryError";
24
- this.status = status;
25
- this.code = code;
26
- this.retryable = retryable;
27
- this.phase = phase;
28
- }
29
- };
30
- function formatRecoveryError(status, code, serverMessage) {
31
- switch (code) {
32
- case "DEPOSIT_NOT_RECOVERABLE":
33
- return {
34
- message: "This deposit can't be recovered \u2014 it may already have been claimed.",
35
- retryable: false
36
- };
37
- case "RECOVERY_UNSUPPORTED":
38
- return {
39
- message: "This deposit can't be recovered automatically. Contact support to get your funds back.",
40
- retryable: false
41
- };
42
- case "SIGNATURE_INVALID":
43
- return {
44
- message: "That signature wasn't accepted for this wallet. Contact support to recover this deposit.",
45
- retryable: false
46
- };
47
- case "VERIFICATION_UNAVAILABLE":
48
- return {
49
- message: "Couldn't verify your signature just now. Try again shortly.",
50
- retryable: true
51
- };
52
- case "REFUND_RECONCILIATION_REQUIRED":
53
- return {
54
- message: "Your recovery is being reviewed. Contact support with this deposit if it doesn't arrive.",
55
- retryable: false
56
- };
57
- case "REFUND_FAILED":
58
- return {
59
- message: serverMessage ?? "The recovery couldn't be completed. Please try again or contact support.",
60
- retryable: true
61
- };
62
- default:
63
- if (status === 0) {
64
- return {
65
- message: "Couldn't reach the recovery service. Check your connection and try again.",
66
- retryable: true
67
- };
68
- }
69
- return {
70
- message: serverMessage ?? "The recovery couldn't be completed. Please try again or contact support.",
71
- retryable: true
72
- };
73
- }
74
- }
75
- async function submitSignedRecovery(params) {
76
- const { backendUrl, chainId, depositId, signer, destination, signRecovery, debug } = params;
77
- const scope = "service:recovery";
78
- const typedData = {
79
- domain: RECOVER_DOMAIN,
80
- types: RECOVER_TYPES,
81
- primaryType: "RecoverDeposit",
82
- message: { depositId: BigInt(depositId), destination }
83
- };
84
- let signature;
85
- try {
86
- signature = await signRecovery({
87
- typedData,
88
- chainId,
89
- signer,
90
- depositId,
91
- destination
92
- });
93
- } catch (error) {
94
- debugError(debug, scope, "signRecovery:failed", error);
95
- throw new RecoveryError(
96
- "Signature request was declined. Approve it in your wallet to recover this deposit.",
97
- 0,
98
- void 0,
99
- true,
100
- "signature"
101
- );
102
- }
103
- if (!signature) {
104
- throw new RecoveryError(
105
- "Signature request was declined. Approve it in your wallet to recover this deposit.",
106
- 0,
107
- void 0,
108
- true,
109
- "signature"
110
- );
111
- }
112
- const url = `${backendUrl.replace(/\/$/, "")}/deposits/recover`;
113
- debugLog(debug, scope, "submitSignedRecovery:request", {
114
- url,
115
- depositId,
116
- signer
117
- });
118
- let response;
119
- try {
120
- response = await fetch(url, {
121
- method: "POST",
122
- // The shared const, so recovery carries `x-deposit-modal-version` like
123
- // every other backend call. Without it this path would be invisible in the
124
- // per-client version telemetry the processor records.
125
- headers: serviceHeaders(),
126
- // `depositId` as a string: it is a uint256 upstream and JSON numbers lose
127
- // precision well before that range.
128
- body: JSON.stringify({ depositId, destination, signature })
129
- });
130
- } catch (error) {
131
- debugError(debug, scope, "submitSignedRecovery:network", error);
132
- const { message, retryable } = formatRecoveryError(0);
133
- throw new RecoveryError(message, 0, void 0, retryable, "request");
134
- }
135
- if (!response.ok) {
136
- const body = await response.json().catch(() => ({}));
137
- debugError(debug, scope, "submitSignedRecovery:failed", body, {
138
- status: response.status
139
- });
140
- const { message, retryable } = formatRecoveryError(
141
- response.status,
142
- body.code,
143
- body.error
144
- );
145
- throw new RecoveryError(
146
- message,
147
- response.status,
148
- body.code,
149
- retryable,
150
- "response"
151
- );
152
- }
153
- const result = await response.json();
154
- debugLog(debug, scope, "submitSignedRecovery:success", {
155
- transactionHash: result.transactionHash
156
- });
157
- return result;
158
- }
159
-
160
- export {
161
- RecoveryError,
162
- submitSignedRecovery
163
- };