@pollar/react 0.12.0-rc.2 → 0.12.0-rc.5
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/README.md +13 -3
- package/dist/index.css +363 -172
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +201 -162
- package/dist/index.d.ts +201 -162
- package/dist/index.js +1450 -1548
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1451 -1549
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1001,7 +1001,6 @@ var require_QRCode = __commonJS({
|
|
|
1001
1001
|
});
|
|
1002
1002
|
|
|
1003
1003
|
// src/constants.ts
|
|
1004
|
-
var LOGO_POLLAR = "https://pollar.xyz/assets/logo_pollar.png";
|
|
1005
1004
|
var LOGO_POLLAR_WORDMARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-logo-horizontal-on-light.png";
|
|
1006
1005
|
var LOGO_POLLAR_WORDMARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-logo-horizontal-on-dark.png";
|
|
1007
1006
|
var LOGO_POLLAR_MARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-mark-on-light.png";
|
|
@@ -1031,6 +1030,13 @@ var ModalErrorBoundary = class extends react.Component {
|
|
|
1031
1030
|
return this.props.children;
|
|
1032
1031
|
}
|
|
1033
1032
|
};
|
|
1033
|
+
function ModalLogo({ logoUrl }) {
|
|
1034
|
+
if (logoUrl) return /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoUrl, alt: "Logo", className: "pollar-logo" });
|
|
1035
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1036
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_MARK_ON_LIGHT, alt: "Pollar", className: "pollar-logo pollar-logo-on-light" }),
|
|
1037
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_MARK_ON_DARK, alt: "Pollar", className: "pollar-logo pollar-logo-on-dark" })
|
|
1038
|
+
] });
|
|
1039
|
+
}
|
|
1034
1040
|
var PollarModalFooter = () => {
|
|
1035
1041
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-footer", children: [
|
|
1036
1042
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-protected", children: "Protected by" }),
|
|
@@ -1038,7 +1044,7 @@ var PollarModalFooter = () => {
|
|
|
1038
1044
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1039
1045
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1040
1046
|
"v",
|
|
1041
|
-
"0.12.0-rc.
|
|
1047
|
+
"0.12.0-rc.5"
|
|
1042
1048
|
] })
|
|
1043
1049
|
] });
|
|
1044
1050
|
};
|
|
@@ -1220,42 +1226,75 @@ function readableTextOn(background) {
|
|
|
1220
1226
|
const [r, g, b] = rgb;
|
|
1221
1227
|
return (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255 > 0.6 ? "#111827" : "#ffffff";
|
|
1222
1228
|
}
|
|
1229
|
+
var PALETTES = {
|
|
1230
|
+
light: {
|
|
1231
|
+
bg: "#ffffff",
|
|
1232
|
+
border: "#e5e7eb",
|
|
1233
|
+
text: "#111827",
|
|
1234
|
+
muted: "#6b7280",
|
|
1235
|
+
"input-bg": "#f9fafb",
|
|
1236
|
+
"error-bg": "#fef2f2",
|
|
1237
|
+
"error-border": "#fecaca",
|
|
1238
|
+
"error-text": "#dc2626",
|
|
1239
|
+
"success-text": "#16a34a"
|
|
1240
|
+
},
|
|
1241
|
+
dark: {
|
|
1242
|
+
bg: "#1a1a1a",
|
|
1243
|
+
border: "#374151",
|
|
1244
|
+
text: "#ffffff",
|
|
1245
|
+
muted: "#9ca3af",
|
|
1246
|
+
"input-bg": "#374151",
|
|
1247
|
+
"error-bg": "#2a1515",
|
|
1248
|
+
"error-border": "#7f1d1d",
|
|
1249
|
+
"error-text": "#f87171",
|
|
1250
|
+
"success-text": "#4ade80"
|
|
1251
|
+
}
|
|
1252
|
+
};
|
|
1253
|
+
function mix(fg, percent, bg) {
|
|
1254
|
+
return `color-mix(in srgb, ${fg} ${percent}%, ${bg})`;
|
|
1255
|
+
}
|
|
1223
1256
|
function buildModalCssVars(theme, accentColor, overrides = {}, variant = "compact") {
|
|
1224
1257
|
const isDark = theme === "dark";
|
|
1225
|
-
const
|
|
1258
|
+
const palette = isDark ? PALETTES.dark : PALETTES.light;
|
|
1259
|
+
const bg = color(overrides.backgroundColor, "");
|
|
1260
|
+
const text = color(overrides.textColor, "");
|
|
1261
|
+
const pinned = isDark || bg !== "" || text !== "";
|
|
1226
1262
|
const secondaryBg = color(overrides.buttonColor, "");
|
|
1227
|
-
|
|
1228
|
-
"--pollar-accent": accentColor,
|
|
1229
|
-
"--pollar-bg": color(overrides.backgroundColor, isDark ? "#1a1a1a" : "#ffffff"),
|
|
1230
|
-
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
1231
|
-
"--pollar-text": textColor,
|
|
1232
|
-
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
1263
|
+
const vars = {
|
|
1264
|
+
"--pollar-brand-accent": accentColor,
|
|
1233
1265
|
// The primary button is the accent's, straight up; its label follows the
|
|
1234
1266
|
// accent's luminance so a pale accent doesn't render white-on-white.
|
|
1235
|
-
"--pollar-btn-primary-fg": readableTextOn(accentColor),
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
"--pollar-btn-secondary-fg": readableTextOn(secondaryBg)
|
|
1239
|
-
} : {},
|
|
1240
|
-
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
1241
|
-
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
1242
|
-
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
1243
|
-
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
1244
|
-
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
1245
|
-
"--pollar-logo-on-light-display": isDark ? "none" : "block",
|
|
1246
|
-
"--pollar-logo-on-dark-display": isDark ? "block" : "none",
|
|
1247
|
-
"--pollar-modal-border-radius": px(overrides.modalBorderRadius, DEFAULT_MODAL_BORDER_RADIUS),
|
|
1248
|
-
"--pollar-buttons-border-radius": px(overrides.buttonBorderRadius, DEFAULT_BUTTON_BORDER_RADIUS),
|
|
1249
|
-
"--pollar-buttons-height": "44px",
|
|
1250
|
-
"--pollar-input-height": "44px",
|
|
1251
|
-
"--pollar-input-border-radius": "0.5rem",
|
|
1252
|
-
"--pollar-card-border-radius": "10px",
|
|
1253
|
-
...variant === "hero" ? {
|
|
1254
|
-
"--pollar-modal-padding": "2rem",
|
|
1255
|
-
"--pollar-modal-heading-size": "1.375rem",
|
|
1256
|
-
"--pollar-modal-subtitle-size": "0.9rem"
|
|
1257
|
-
} : {}
|
|
1267
|
+
"--pollar-brand-btn-primary-fg": readableTextOn(accentColor),
|
|
1268
|
+
"--pollar-brand-modal-border-radius": px(overrides.modalBorderRadius, DEFAULT_MODAL_BORDER_RADIUS),
|
|
1269
|
+
"--pollar-brand-buttons-border-radius": px(overrides.buttonBorderRadius, DEFAULT_BUTTON_BORDER_RADIUS)
|
|
1258
1270
|
};
|
|
1271
|
+
if (secondaryBg) {
|
|
1272
|
+
vars["--pollar-brand-btn-secondary-bg"] = secondaryBg;
|
|
1273
|
+
vars["--pollar-brand-btn-secondary-fg"] = readableTextOn(secondaryBg);
|
|
1274
|
+
}
|
|
1275
|
+
if (pinned) {
|
|
1276
|
+
for (const [name, value] of Object.entries(palette)) vars[`--pollar-brand-${name}`] = value;
|
|
1277
|
+
vars["--pollar-brand-logo-on-light-display"] = isDark ? "none" : "block";
|
|
1278
|
+
vars["--pollar-brand-logo-on-dark-display"] = isDark ? "block" : "none";
|
|
1279
|
+
}
|
|
1280
|
+
if (bg || text) {
|
|
1281
|
+
const surface = bg || palette.bg;
|
|
1282
|
+
const ink = text || palette.text;
|
|
1283
|
+
vars["--pollar-brand-bg"] = surface;
|
|
1284
|
+
vars["--pollar-brand-text"] = ink;
|
|
1285
|
+
vars["--pollar-brand-border"] = mix(ink, 14, surface);
|
|
1286
|
+
vars["--pollar-brand-muted"] = mix(ink, 62, surface);
|
|
1287
|
+
vars["--pollar-brand-input-bg"] = mix(ink, 4, surface);
|
|
1288
|
+
const darkSurface = readableTextOn(surface) === "#ffffff";
|
|
1289
|
+
vars["--pollar-brand-logo-on-light-display"] = darkSurface ? "none" : "block";
|
|
1290
|
+
vars["--pollar-brand-logo-on-dark-display"] = darkSurface ? "block" : "none";
|
|
1291
|
+
}
|
|
1292
|
+
if (variant === "hero") {
|
|
1293
|
+
vars["--pollar-brand-modal-padding"] = "2rem";
|
|
1294
|
+
vars["--pollar-brand-modal-heading-size"] = "1.375rem";
|
|
1295
|
+
vars["--pollar-brand-modal-subtitle-size"] = "0.9rem";
|
|
1296
|
+
}
|
|
1297
|
+
return vars;
|
|
1259
1298
|
}
|
|
1260
1299
|
function modalChrome(styles) {
|
|
1261
1300
|
const zIndex = styles.modalZIndex;
|
|
@@ -1270,7 +1309,7 @@ function modalChrome(styles) {
|
|
|
1270
1309
|
buttonBorderRadius: styles.buttonBorderRadius
|
|
1271
1310
|
},
|
|
1272
1311
|
overlayStyle: {
|
|
1273
|
-
"--pollar-overlay-z-index": typeof zIndex === "number" && Number.isFinite(zIndex) ? zIndex : DEFAULT_OVERLAY_Z_INDEX
|
|
1312
|
+
"--pollar-brand-overlay-z-index": typeof zIndex === "number" && Number.isFinite(zIndex) ? zIndex : DEFAULT_OVERLAY_Z_INDEX
|
|
1274
1313
|
}
|
|
1275
1314
|
};
|
|
1276
1315
|
}
|
|
@@ -1955,6 +1994,8 @@ function KycModalTemplate({
|
|
|
1955
1994
|
reviewReason,
|
|
1956
1995
|
processing = false,
|
|
1957
1996
|
isLoading,
|
|
1997
|
+
startingProviderId = null,
|
|
1998
|
+
directOpen = false,
|
|
1958
1999
|
error,
|
|
1959
2000
|
onSelectProvider,
|
|
1960
2001
|
onDoneVerifying,
|
|
@@ -1963,6 +2004,7 @@ function KycModalTemplate({
|
|
|
1963
2004
|
onClose
|
|
1964
2005
|
}) {
|
|
1965
2006
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
|
|
2007
|
+
const busy = isLoading || startingProviderId !== null;
|
|
1966
2008
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1967
2009
|
"div",
|
|
1968
2010
|
{
|
|
@@ -1990,7 +2032,7 @@ function KycModalTemplate({
|
|
|
1990
2032
|
type: "button",
|
|
1991
2033
|
className: "pollar-modal-close",
|
|
1992
2034
|
onClick: onRefresh,
|
|
1993
|
-
disabled:
|
|
2035
|
+
disabled: busy,
|
|
1994
2036
|
"aria-label": "Refresh",
|
|
1995
2037
|
title: "Refresh providers",
|
|
1996
2038
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2020,7 +2062,14 @@ function KycModalTemplate({
|
|
|
2020
2062
|
] })
|
|
2021
2063
|
] }),
|
|
2022
2064
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-kyc-error", role: "alert", children: error }),
|
|
2023
|
-
step === "select_provider" && (
|
|
2065
|
+
step === "select_provider" && (startingProviderId !== null && directOpen ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", "aria-live": "polite", children: [
|
|
2066
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
2067
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2068
|
+
"Opening ",
|
|
2069
|
+
selectedProvider?.name ?? "verification",
|
|
2070
|
+
"\u2026"
|
|
2071
|
+
] })
|
|
2072
|
+
] }) : isLoading && providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
|
|
2024
2073
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
2025
2074
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading providers\u2026" })
|
|
2026
2075
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-providers", children: [
|
|
@@ -2030,11 +2079,15 @@ function KycModalTemplate({
|
|
|
2030
2079
|
{
|
|
2031
2080
|
type: "button",
|
|
2032
2081
|
className: "pollar-kyc-provider-btn",
|
|
2033
|
-
disabled:
|
|
2082
|
+
disabled: busy,
|
|
2083
|
+
"aria-busy": startingProviderId === p.id,
|
|
2034
2084
|
onClick: () => onSelectProvider(p),
|
|
2035
2085
|
children: [
|
|
2036
2086
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-name", children: p.name }),
|
|
2037
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-flow", children:
|
|
2087
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-kyc-provider-flow", children: startingProviderId === p.id ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2088
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
2089
|
+
"Opening\u2026"
|
|
2090
|
+
] }) : p.flow === "redirect" ? "Continue in a new tab" : "Continue here" })
|
|
2038
2091
|
]
|
|
2039
2092
|
},
|
|
2040
2093
|
p.id
|
|
@@ -2085,7 +2138,7 @@ function KycModalTemplate({
|
|
|
2085
2138
|
/* @__PURE__ */ jsxRuntime.jsx(KycStatus, { status: kycStatus, ...processing ? { label: "Approved" } : {} }),
|
|
2086
2139
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-kyc-result-text", children: kycStatus === "approved" ? "Your identity has been verified successfully." : kycStatus === "rejected" ? "Your verification was not approved. Contact support for the next steps." : kycStatus === "expired" ? "Your verification expired. Start again to verify your identity." : processing ? kycProcessingMessage() : kycReviewMessage(reviewReason) }),
|
|
2087
2140
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
|
|
2088
|
-
kycStatus === "expired" && onStartAgain && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onStartAgain, disabled:
|
|
2141
|
+
kycStatus === "expired" && onStartAgain && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onStartAgain, disabled: busy, children: "Start again" }),
|
|
2089
2142
|
kycStatus !== "approved" && kycStatus !== "rejected" && kycStatus !== "expired" && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onDoneVerifying, children: "Check again" }),
|
|
2090
2143
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: "Close" })
|
|
2091
2144
|
] })
|
|
@@ -2118,6 +2171,8 @@ function KycModal({
|
|
|
2118
2171
|
const [reviewReason, setReviewReason] = react.useState(null);
|
|
2119
2172
|
const [processing, setProcessing] = react.useState(false);
|
|
2120
2173
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
2174
|
+
const [startingProviderId, setStartingProviderId] = react.useState(null);
|
|
2175
|
+
const [directOpen, setDirectOpen] = react.useState(false);
|
|
2121
2176
|
const [error, setError] = react.useState(null);
|
|
2122
2177
|
const idempotencyKeys = react.useRef({});
|
|
2123
2178
|
const autoOpened = react.useRef(false);
|
|
@@ -2145,7 +2200,7 @@ function KycModal({
|
|
|
2145
2200
|
starting.current = true;
|
|
2146
2201
|
setSelectedProvider(provider);
|
|
2147
2202
|
setError(null);
|
|
2148
|
-
|
|
2203
|
+
setStartingProviderId(provider.id);
|
|
2149
2204
|
const key = (_a = idempotencyKeys.current)[_b = provider.id] ?? (_a[_b] = newIdempotencyKey());
|
|
2150
2205
|
try {
|
|
2151
2206
|
const result = await client.resolveKyc(
|
|
@@ -2183,7 +2238,7 @@ function KycModal({
|
|
|
2183
2238
|
setStep("select_provider");
|
|
2184
2239
|
} finally {
|
|
2185
2240
|
starting.current = false;
|
|
2186
|
-
|
|
2241
|
+
setStartingProviderId(null);
|
|
2187
2242
|
}
|
|
2188
2243
|
}
|
|
2189
2244
|
const loadProviders = react.useCallback(() => {
|
|
@@ -2202,6 +2257,7 @@ function KycModal({
|
|
|
2202
2257
|
void loadProviders().then((list) => {
|
|
2203
2258
|
if (!providerId || autoOpened.current) return;
|
|
2204
2259
|
autoOpened.current = true;
|
|
2260
|
+
setDirectOpen(true);
|
|
2205
2261
|
const target = list.find((p) => p.id === providerId);
|
|
2206
2262
|
if (target) void handleSelectProvider(target);
|
|
2207
2263
|
else
|
|
@@ -2251,6 +2307,8 @@ function KycModal({
|
|
|
2251
2307
|
reviewReason,
|
|
2252
2308
|
processing,
|
|
2253
2309
|
isLoading,
|
|
2310
|
+
startingProviderId,
|
|
2311
|
+
directOpen,
|
|
2254
2312
|
error,
|
|
2255
2313
|
onSelectProvider: handleSelectProvider,
|
|
2256
2314
|
onDoneVerifying: handleDoneVerifying,
|
|
@@ -2940,7 +2998,7 @@ function LoginModalTemplate({
|
|
|
2940
2998
|
}
|
|
2941
2999
|
) }),
|
|
2942
3000
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
2943
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3001
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
2944
3002
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
2945
3003
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: "Log in or sign up" })
|
|
2946
3004
|
] }),
|
|
@@ -3106,7 +3164,7 @@ function LoginModalStatus({
|
|
|
3106
3164
|
}
|
|
3107
3165
|
) }),
|
|
3108
3166
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
3109
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3167
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
3110
3168
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
3111
3169
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: "Log in or sign up" })
|
|
3112
3170
|
] }),
|
|
@@ -3208,7 +3266,7 @@ function PrivyLoginSubmodal({
|
|
|
3208
3266
|
}
|
|
3209
3267
|
) }),
|
|
3210
3268
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
|
|
3211
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3269
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx(ModalLogo, { logoUrl }) }),
|
|
3212
3270
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-title", children: appName }),
|
|
3213
3271
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-subtitle", children: adapter.meta.label })
|
|
3214
3272
|
] }),
|
|
@@ -3409,256 +3467,45 @@ function LoginModal({ onClose }) {
|
|
|
3409
3467
|
}
|
|
3410
3468
|
) });
|
|
3411
3469
|
}
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: bgD, fill: bgColor }),
|
|
3420
|
-
/* @__PURE__ */ jsxRuntime.jsx("path", { d: fgD, fill: fgColor })
|
|
3421
|
-
] });
|
|
3422
|
-
});
|
|
3423
|
-
QRCodeSvg.displayName = "QRCodeSvg";
|
|
3424
|
-
function bytesToBinaryString(bytes) {
|
|
3425
|
-
return bytes.map((b) => String.fromCharCode(b & 255)).join("");
|
|
3426
|
-
}
|
|
3427
|
-
function encodeStringToUtf8Bytes(input) {
|
|
3428
|
-
return Array.from(new TextEncoder().encode(input));
|
|
3429
|
-
}
|
|
3430
|
-
var QRCode = react.forwardRef(function QRCode2({ bgColor = "#FFFFFF", fgColor = "#000000", level = "L", size = 256, value, ...props }, ref) {
|
|
3431
|
-
const qrcode = new import_QRCode.default(-1, import_ErrorCorrectLevel.default[level]);
|
|
3432
|
-
const utf8Bytes = encodeStringToUtf8Bytes(value);
|
|
3433
|
-
const binaryString = bytesToBinaryString(utf8Bytes);
|
|
3434
|
-
qrcode.addData(binaryString, "Byte");
|
|
3435
|
-
qrcode.make();
|
|
3436
|
-
const cells = qrcode.modules;
|
|
3437
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3438
|
-
QRCodeSvg,
|
|
3439
|
-
{
|
|
3440
|
-
...props,
|
|
3441
|
-
bgColor,
|
|
3442
|
-
bgD: cells.map(
|
|
3443
|
-
(row, rowIndex) => row.map((cell, cellIndex) => !cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")
|
|
3444
|
-
).join(" "),
|
|
3445
|
-
fgColor,
|
|
3446
|
-
fgD: cells.map(
|
|
3447
|
-
(row, rowIndex) => row.map((cell, cellIndex) => cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")
|
|
3448
|
-
).join(" "),
|
|
3449
|
-
ref,
|
|
3450
|
-
size,
|
|
3451
|
-
viewBoxSize: cells.length
|
|
3452
|
-
}
|
|
3453
|
-
);
|
|
3454
|
-
});
|
|
3455
|
-
function RampWorkflow({
|
|
3456
|
-
client,
|
|
3457
|
-
snapshot,
|
|
3458
|
-
onChange,
|
|
3459
|
-
onBusyChange
|
|
3460
|
-
}) {
|
|
3461
|
-
const model = core.describeRampAction(snapshot);
|
|
3462
|
-
const locked = react.useRef(false);
|
|
3463
|
-
react.useEffect(() => {
|
|
3464
|
-
setFields({});
|
|
3465
|
-
setError(null);
|
|
3466
|
-
}, [model.action?.actionId]);
|
|
3467
|
-
const [busy, setBusy] = react.useState(false);
|
|
3468
|
-
const [error, setError] = react.useState(null);
|
|
3469
|
-
const [fields, setFields] = react.useState({});
|
|
3470
|
-
const fieldsComplete = model.action?.kind !== "collect_information" || model.action.fields.every((field) => {
|
|
3471
|
-
const value = (fields[field.key] ?? "").trim();
|
|
3472
|
-
if (!value) return field.optional;
|
|
3473
|
-
if (field.type === "email") return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
|
|
3474
|
-
return field.type !== "select" || field.options?.some((option) => option.value === value);
|
|
3470
|
+
function findWalletBalance(balances, asset) {
|
|
3471
|
+
const { issuer } = asset;
|
|
3472
|
+
return balances.find((b) => {
|
|
3473
|
+
if (resolveChain(b.chain) !== asset.chain) return false;
|
|
3474
|
+
if (issuer === null) return b.type === "native" || !b.issuer && b.code === asset.code;
|
|
3475
|
+
if (b.code !== asset.code) return false;
|
|
3476
|
+
return issuer === void 0 || !b.issuer || b.issuer.toLowerCase() === issuer.toLowerCase();
|
|
3475
3477
|
});
|
|
3476
|
-
async function continueAction() {
|
|
3477
|
-
if (!model.action || locked.current || !fieldsComplete) return;
|
|
3478
|
-
locked.current = true;
|
|
3479
|
-
setBusy(true);
|
|
3480
|
-
onBusyChange?.(true);
|
|
3481
|
-
setError(null);
|
|
3482
|
-
try {
|
|
3483
|
-
onChange(
|
|
3484
|
-
model.canSign ? await client.signRampAction(snapshot.txId, snapshot) : await client.continueRamp(snapshot.txId, {
|
|
3485
|
-
actionId: model.action.actionId,
|
|
3486
|
-
transactionVersion: snapshot.transactionVersion,
|
|
3487
|
-
...model.action.kind === "collect_information" ? { fields } : {}
|
|
3488
|
-
})
|
|
3489
|
-
);
|
|
3490
|
-
} catch (e) {
|
|
3491
|
-
setError(e instanceof Error ? e.message : "Unable to continue.");
|
|
3492
|
-
} finally {
|
|
3493
|
-
locked.current = false;
|
|
3494
|
-
setBusy(false);
|
|
3495
|
-
onBusyChange?.(false);
|
|
3496
|
-
}
|
|
3497
|
-
}
|
|
3498
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3499
|
-
"section",
|
|
3500
|
-
{
|
|
3501
|
-
className: "pollar-ramp-payment pollar-ramp-workflow",
|
|
3502
|
-
"aria-label": "Ramp progress",
|
|
3503
|
-
"aria-live": "polite",
|
|
3504
|
-
"aria-busy": busy,
|
|
3505
|
-
children: [
|
|
3506
|
-
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "pollar-ramp-payment-title", children: model.title }),
|
|
3507
|
-
snapshot.terms && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-terms", children: [
|
|
3508
|
-
snapshot.terms.fiatAmount,
|
|
3509
|
-
" ",
|
|
3510
|
-
snapshot.terms.fiatCurrency,
|
|
3511
|
-
" \xB7 ",
|
|
3512
|
-
snapshot.terms.cryptoAmount,
|
|
3513
|
-
" ",
|
|
3514
|
-
snapshot.terms.assetCode,
|
|
3515
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
3516
|
-
"Includes ",
|
|
3517
|
-
snapshot.terms.feeAmount,
|
|
3518
|
-
" ",
|
|
3519
|
-
snapshot.terms.feeCurrency,
|
|
3520
|
-
" fee"
|
|
3521
|
-
] }),
|
|
3522
|
-
model.details.map((item, index) => /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-workflow-detail", children: [
|
|
3523
|
-
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
3524
|
-
item.label,
|
|
3525
|
-
": "
|
|
3526
|
-
] }),
|
|
3527
|
-
item.value
|
|
3528
|
-
] }, index)),
|
|
3529
|
-
model.links.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx("a", { className: "pollar-btn-primary pollar-ramp-hosted-link", href: link.url, target: "_blank", rel: "noopener noreferrer", children: link.label }) }, index)),
|
|
3530
|
-
model.qr && /* @__PURE__ */ jsxRuntime.jsx(QRCode, { value: model.qr, size: 180 }),
|
|
3531
|
-
model.qr && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3532
|
-
"button",
|
|
3533
|
-
{
|
|
3534
|
-
className: "pollar-btn-secondary",
|
|
3535
|
-
type: "button",
|
|
3536
|
-
onClick: () => void navigator.clipboard.writeText(model.qr).catch(() => setError("Unable to copy. Select the payment code to copy it manually.")),
|
|
3537
|
-
children: "Copy payment code"
|
|
3538
|
-
}
|
|
3539
|
-
),
|
|
3540
|
-
model.action?.kind === "collect_information" && model.action.fields.map((field) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-ramp-field", children: [
|
|
3541
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-label", children: [
|
|
3542
|
-
field.label,
|
|
3543
|
-
field.optional ? " (optional)" : ""
|
|
3544
|
-
] }),
|
|
3545
|
-
field.type === "select" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3546
|
-
"select",
|
|
3547
|
-
{
|
|
3548
|
-
className: "pollar-ramp-input",
|
|
3549
|
-
disabled: busy,
|
|
3550
|
-
value: fields[field.key] ?? "",
|
|
3551
|
-
onChange: (e) => setFields((previous) => ({ ...previous, [field.key]: e.target.value })),
|
|
3552
|
-
children: [
|
|
3553
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "Choose" }),
|
|
3554
|
-
field.options?.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
|
|
3555
|
-
]
|
|
3556
|
-
}
|
|
3557
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3558
|
-
"input",
|
|
3559
|
-
{
|
|
3560
|
-
className: "pollar-ramp-input",
|
|
3561
|
-
disabled: busy,
|
|
3562
|
-
type: field.type,
|
|
3563
|
-
placeholder: field.placeholder,
|
|
3564
|
-
value: fields[field.key] ?? "",
|
|
3565
|
-
onChange: (e) => setFields((previous) => ({ ...previous, [field.key]: e.target.value }))
|
|
3566
|
-
}
|
|
3567
|
-
),
|
|
3568
|
-
field.hint && /* @__PURE__ */ jsxRuntime.jsx("small", { className: "pollar-ramp-field-hint", children: field.hint })
|
|
3569
|
-
] }, field.key)),
|
|
3570
|
-
(model.canContinue || model.canSign) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3571
|
-
"button",
|
|
3572
|
-
{
|
|
3573
|
-
className: "pollar-btn-primary",
|
|
3574
|
-
type: "button",
|
|
3575
|
-
disabled: busy || !fieldsComplete,
|
|
3576
|
-
onClick: () => void continueAction(),
|
|
3577
|
-
children: busy ? model.canSign ? "Waiting for your wallet\u2026" : "Continuing\u2026" : model.canSign ? "Authorize" : "Continue"
|
|
3578
|
-
}
|
|
3579
|
-
),
|
|
3580
|
-
snapshot.milestones?.map((milestone, index) => /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
3581
|
-
milestone.kind.replace(/_/g, " "),
|
|
3582
|
-
" \xB7 ",
|
|
3583
|
-
milestone.verifiedAt
|
|
3584
|
-
] }, index)),
|
|
3585
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-field-error", role: "alert", children: error }),
|
|
3586
|
-
/* @__PURE__ */ jsxRuntime.jsxs("small", { className: "pollar-ramp-reference", children: [
|
|
3587
|
-
"Reference: ",
|
|
3588
|
-
snapshot.txId
|
|
3589
|
-
] })
|
|
3590
|
-
]
|
|
3591
|
-
}
|
|
3592
|
-
);
|
|
3593
|
-
}
|
|
3594
|
-
|
|
3595
|
-
// src/components/ramp-widget/ramp-kyc.ts
|
|
3596
|
-
var nonEmpty = (value) => typeof value === "string" && !!value.trim();
|
|
3597
|
-
function requiredRampKyc(error) {
|
|
3598
|
-
if (!error || typeof error !== "object") return null;
|
|
3599
|
-
if (!("code" in error) || error.code !== "SDK_RAMPS_KYC_REQUIRED") return null;
|
|
3600
|
-
const body = "body" in error ? error.body : void 0;
|
|
3601
|
-
if (typeof body !== "object" || body === null) return null;
|
|
3602
|
-
const rampProviderId = "rampProviderId" in body ? body.rampProviderId : void 0;
|
|
3603
|
-
const corridorId = "corridorId" in body ? body.corridorId : void 0;
|
|
3604
|
-
const requirementType = "requirementType" in body ? body.requirementType : void 0;
|
|
3605
|
-
const optionId = "optionId" in body ? body.optionId : void 0;
|
|
3606
|
-
const kycProviderId = "kycProviderId" in body ? body.kycProviderId : void 0;
|
|
3607
|
-
if (!nonEmpty(rampProviderId) || !nonEmpty(corridorId)) return null;
|
|
3608
|
-
if ((requirementType === "FORM" || requirementType === "REGISTRY_CHECK" || requirementType === "PROVIDER_REGISTRATION") && nonEmpty(optionId)) {
|
|
3609
|
-
return { rampProviderId, corridorId, type: requirementType, optionId };
|
|
3610
|
-
}
|
|
3611
|
-
const kyc = nonEmpty(optionId) && requirementType === "KYC" ? optionId : kycProviderId;
|
|
3612
|
-
return nonEmpty(kyc) ? { rampProviderId, corridorId, type: "KYC", optionId: kyc } : null;
|
|
3613
|
-
}
|
|
3614
|
-
function pendingFromQuote(requirement) {
|
|
3615
|
-
return {
|
|
3616
|
-
rampProviderId: requirement.rampProviderId,
|
|
3617
|
-
corridorId: requirement.corridorId,
|
|
3618
|
-
type: requirement.type,
|
|
3619
|
-
optionId: requirement.optionId,
|
|
3620
|
-
progress: { position: requirement.completed + 1, total: requirement.total }
|
|
3621
|
-
};
|
|
3622
|
-
}
|
|
3623
|
-
function lockedRouteCopy(requirement) {
|
|
3624
|
-
if (requirement.type === "FORM") return { message: "Answer a few questions to see this route", action: "Continue" };
|
|
3625
|
-
if (requirement.type === "PROVIDER_REGISTRATION") {
|
|
3626
|
-
return { message: "Register with the provider to see this route", action: "Continue" };
|
|
3627
|
-
}
|
|
3628
|
-
if (requirement.type === "REGISTRY_CHECK") {
|
|
3629
|
-
return requirement.status === "pending" ? { message: "Your details are under review", action: null } : { message: "Confirm your details to see this route", action: "Confirm" };
|
|
3630
|
-
}
|
|
3631
|
-
switch (requirement.status) {
|
|
3632
|
-
case "expired":
|
|
3633
|
-
return { message: "Your verification expired", action: "Verify again" };
|
|
3634
|
-
case "pending":
|
|
3635
|
-
if (!requirement.reviewReason) return { message: "Verification in progress", action: "Continue" };
|
|
3636
|
-
return {
|
|
3637
|
-
message: requirement.reviewReason === "DUPLICATE_DOCUMENT" ? kycReviewMessage(requirement.reviewReason) : "Your verification is under review",
|
|
3638
|
-
action: null
|
|
3639
|
-
};
|
|
3640
|
-
case "rejected":
|
|
3641
|
-
return { message: "Verification was not approved", action: null };
|
|
3642
|
-
default:
|
|
3643
|
-
return { message: "Verify your identity to see this route", action: "Verify" };
|
|
3644
|
-
}
|
|
3645
3478
|
}
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
};
|
|
3652
|
-
|
|
3479
|
+
function useWalletAvailable(asset) {
|
|
3480
|
+
const { walletBalance, refreshWalletBalance } = usePollar();
|
|
3481
|
+
const wanted = !!asset;
|
|
3482
|
+
react.useEffect(() => {
|
|
3483
|
+
if (wanted && walletBalance.step === "idle") void refreshWalletBalance();
|
|
3484
|
+
}, [wanted, walletBalance.step, refreshWalletBalance]);
|
|
3485
|
+
if (!asset || walletBalance.step !== "loaded") return void 0;
|
|
3486
|
+
const record = findWalletBalance(walletBalance.data.balances, asset);
|
|
3487
|
+
return record ? record.available : "0";
|
|
3488
|
+
}
|
|
3489
|
+
var CUSTODY_LABEL = { COSIGNED: "co-signed", SELF_CUSTODY: "self-custody" };
|
|
3490
|
+
var assetOf = (node) => node.kind === "fiat" ? node.currency : node.code;
|
|
3491
|
+
function etaText(seconds) {
|
|
3492
|
+
if (seconds === null) return null;
|
|
3493
|
+
if (seconds < 90) return `~${Math.max(1, Math.round(seconds))} s`;
|
|
3494
|
+
if (seconds < 5400) return `~${Math.round(seconds / 60)} min`;
|
|
3495
|
+
return `~${Math.round(seconds / 3600)} h`;
|
|
3496
|
+
}
|
|
3497
|
+
function RouteDisplay({ quote, best = false, busy = false, disabled = false, onSelect }) {
|
|
3653
3498
|
const inert = busy || disabled;
|
|
3654
3499
|
const select = () => {
|
|
3655
3500
|
if (!inert) onSelect(quote);
|
|
3656
3501
|
};
|
|
3502
|
+
const first = quote.legs[0];
|
|
3503
|
+
const last = quote.legs[quote.legs.length - 1];
|
|
3657
3504
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3658
3505
|
"div",
|
|
3659
3506
|
{
|
|
3660
3507
|
className: "pollar-ramp-route-card",
|
|
3661
|
-
"data-recommended":
|
|
3508
|
+
"data-recommended": best,
|
|
3662
3509
|
"data-busy": busy || void 0,
|
|
3663
3510
|
"data-disabled": disabled || void 0,
|
|
3664
3511
|
role: "button",
|
|
@@ -3669,55 +3516,152 @@ function RouteDisplay({ quote, busy = false, disabled = false, onSelect }) {
|
|
|
3669
3516
|
onKeyDown: (e) => e.key === "Enter" && select(),
|
|
3670
3517
|
children: [
|
|
3671
3518
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-left", children: [
|
|
3672
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children: quote.
|
|
3673
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-meta", children: busy ? "Starting\u2026" : [
|
|
3674
|
-
quote.route ? `${quote.route.asset.code} on ${quote.route.asset.chain}` : null,
|
|
3675
|
-
RAIL_LABELS[quote.rail] ?? quote.rail,
|
|
3676
|
-
quote.estimatedTime
|
|
3677
|
-
].filter(Boolean).join(" \xB7 ") })
|
|
3519
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children: first && last ? `${quote.amountIn} ${assetOf(first.from)} \u2192 ~${quote.amountOut} ${assetOf(last.to)}` : `~${quote.amountOut}` }),
|
|
3520
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-meta", children: busy ? "Starting\u2026" : [quote.legs.map((leg) => core.rampLegTitle(leg)).join(" \xB7 "), etaText(quote.etaSeconds)].filter(Boolean).join(" \xB7 ") })
|
|
3678
3521
|
] }),
|
|
3679
3522
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-right", children: busy ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3680
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3681
|
-
|
|
3523
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-route-fee", children: [
|
|
3524
|
+
quote.legs.length === 1 ? "1 step" : `${quote.legs.length} steps`,
|
|
3525
|
+
" \xB7 fees included"
|
|
3526
|
+
] }),
|
|
3527
|
+
best && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-badge", children: "Best rate" })
|
|
3682
3528
|
] }) })
|
|
3683
3529
|
]
|
|
3684
3530
|
}
|
|
3685
3531
|
);
|
|
3686
3532
|
}
|
|
3687
|
-
function
|
|
3688
|
-
|
|
3533
|
+
function RejectedRouteDisplay({
|
|
3534
|
+
rejection,
|
|
3535
|
+
disabled = false,
|
|
3536
|
+
trusting = false,
|
|
3537
|
+
walletBusy = false,
|
|
3538
|
+
custodyChoice = false,
|
|
3539
|
+
onVerify,
|
|
3540
|
+
onTrust,
|
|
3541
|
+
onWalletStep
|
|
3542
|
+
}) {
|
|
3543
|
+
const requirement = rejection.requirement;
|
|
3544
|
+
const copy = requirement ? core.rampRequirementCopy(requirement) : null;
|
|
3545
|
+
const trustAsset = !requirement && onTrust ? core.rampTrustlineAsset(rejection) : null;
|
|
3546
|
+
const step = !requirement ? core.rampWalletStep(rejection) : null;
|
|
3547
|
+
const fromMenu = step?.action === "create_wallet" && custodyChoice;
|
|
3548
|
+
const walletStep = onWalletStep && !fromMenu ? step : null;
|
|
3549
|
+
const picks = custodyChoice && step?.action !== "set_up_recovery" ? ["COSIGNED", "SELF_CUSTODY"] : [void 0];
|
|
3550
|
+
const meta = copy ? copy.message : fromMenu ? "You need a wallet to receive this. Create it from the wallet menu, then find the route again." : core.rampResolutionText(rejection.failure);
|
|
3551
|
+
const busy = trusting || !!walletStep && walletBusy;
|
|
3689
3552
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3690
3553
|
"div",
|
|
3691
3554
|
{
|
|
3692
3555
|
className: "pollar-ramp-route-card",
|
|
3693
3556
|
"data-locked": true,
|
|
3694
|
-
"data-kyc-status": requirement
|
|
3695
|
-
"data-disabled": disabled || void 0,
|
|
3557
|
+
"data-kyc-status": requirement?.status,
|
|
3558
|
+
"data-disabled": !(copy?.action && onVerify) && !trustAsset && !walletStep || disabled && !busy || void 0,
|
|
3696
3559
|
children: [
|
|
3697
3560
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-left", children: [
|
|
3698
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children:
|
|
3699
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-meta", children:
|
|
3561
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-provider", children: rejection.legs.map((leg) => core.rampLegTitle(leg)).join(" \xB7 ") }),
|
|
3562
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-route-meta", children: meta })
|
|
3700
3563
|
] }),
|
|
3701
|
-
|
|
3564
|
+
trustAsset && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-right", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3565
|
+
"button",
|
|
3566
|
+
{
|
|
3567
|
+
type: "button",
|
|
3568
|
+
className: "pollar-btn-secondary pollar-ramp-route-verify",
|
|
3569
|
+
disabled,
|
|
3570
|
+
"aria-busy": trusting,
|
|
3571
|
+
onClick: () => onTrust(trustAsset),
|
|
3572
|
+
children: trusting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3573
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
3574
|
+
" Adding\u2026"
|
|
3575
|
+
] }) : `Add ${trustAsset.code} trustline`
|
|
3576
|
+
}
|
|
3577
|
+
) }),
|
|
3578
|
+
walletStep && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-right", children: walletBusy ? /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-btn-secondary pollar-ramp-route-verify", disabled: true, "aria-busy": true, children: [
|
|
3579
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
3580
|
+
" ",
|
|
3581
|
+
walletStep.busyLabel
|
|
3582
|
+
] }) : picks.map((custody) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3583
|
+
"button",
|
|
3584
|
+
{
|
|
3585
|
+
type: "button",
|
|
3586
|
+
className: "pollar-btn-secondary pollar-ramp-route-verify",
|
|
3587
|
+
disabled,
|
|
3588
|
+
onClick: () => onWalletStep(walletStep, custody),
|
|
3589
|
+
children: custody ? `${walletStep.label} (${CUSTODY_LABEL[custody]})` : walletStep.label
|
|
3590
|
+
},
|
|
3591
|
+
custody ?? "app"
|
|
3592
|
+
)) }),
|
|
3593
|
+
requirement && copy?.action && onVerify && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-route-right", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3702
3594
|
"button",
|
|
3703
3595
|
{
|
|
3704
3596
|
type: "button",
|
|
3705
3597
|
className: "pollar-btn-secondary pollar-ramp-route-verify",
|
|
3706
3598
|
disabled,
|
|
3707
3599
|
onClick: () => onVerify(requirement),
|
|
3708
|
-
children: action
|
|
3600
|
+
children: copy.action
|
|
3709
3601
|
}
|
|
3710
3602
|
) })
|
|
3711
3603
|
]
|
|
3712
3604
|
}
|
|
3713
3605
|
);
|
|
3714
3606
|
}
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
const
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3607
|
+
function formatAvailable(available) {
|
|
3608
|
+
if (available === null) return "\u2014";
|
|
3609
|
+
const n = parseFloat(available);
|
|
3610
|
+
return isNaN(n) ? available : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
3611
|
+
}
|
|
3612
|
+
function AmountField({
|
|
3613
|
+
id,
|
|
3614
|
+
label,
|
|
3615
|
+
value,
|
|
3616
|
+
onChange,
|
|
3617
|
+
unit,
|
|
3618
|
+
available,
|
|
3619
|
+
onMax,
|
|
3620
|
+
placeholder = "0.00",
|
|
3621
|
+
disabled = false
|
|
3622
|
+
}) {
|
|
3623
|
+
const showBalance = available !== void 0;
|
|
3624
|
+
const canMax = showBalance && available !== null && parseFloat(available) > 0 && !disabled;
|
|
3625
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
3626
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
|
|
3627
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", htmlFor: id, children: label }),
|
|
3628
|
+
showBalance && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-send-hint", children: [
|
|
3629
|
+
"Available: ",
|
|
3630
|
+
formatAvailable(available),
|
|
3631
|
+
" ",
|
|
3632
|
+
unit ?? ""
|
|
3633
|
+
] })
|
|
3634
|
+
] }),
|
|
3635
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-input-shell", children: [
|
|
3636
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3637
|
+
"input",
|
|
3638
|
+
{
|
|
3639
|
+
id,
|
|
3640
|
+
className: "pollar-input pollar-send-amount-input",
|
|
3641
|
+
type: "text",
|
|
3642
|
+
inputMode: "decimal",
|
|
3643
|
+
placeholder,
|
|
3644
|
+
value,
|
|
3645
|
+
disabled,
|
|
3646
|
+
onChange: (e) => onChange(e.target.value),
|
|
3647
|
+
"aria-label": id ? void 0 : label
|
|
3648
|
+
}
|
|
3649
|
+
),
|
|
3650
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-input-suffix", children: [
|
|
3651
|
+
showBalance && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3652
|
+
"button",
|
|
3653
|
+
{
|
|
3654
|
+
type: "button",
|
|
3655
|
+
className: "pollar-send-inline-action",
|
|
3656
|
+
disabled: !canMax,
|
|
3657
|
+
onClick: () => onMax ? onMax() : available && onChange(available),
|
|
3658
|
+
children: "Max"
|
|
3659
|
+
}
|
|
3660
|
+
),
|
|
3661
|
+
unit && /* @__PURE__ */ jsxRuntime.jsx("span", { children: unit })
|
|
3662
|
+
] })
|
|
3663
|
+
] })
|
|
3664
|
+
] });
|
|
3721
3665
|
}
|
|
3722
3666
|
function scannableImageSrc(image) {
|
|
3723
3667
|
return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
|
|
@@ -3736,109 +3680,143 @@ function placeholderFor(field, fields, values) {
|
|
|
3736
3680
|
}
|
|
3737
3681
|
return field.placeholder;
|
|
3738
3682
|
}
|
|
3739
|
-
var CHAIN_NAME = { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" };
|
|
3740
|
-
var EXPLORER_NAME = { STELLAR: "Stellar Expert", POLYGON: "Polygonscan", SOLANA: "Solana Explorer" };
|
|
3741
|
-
var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
|
|
3742
3683
|
function flagEmoji(code) {
|
|
3743
3684
|
const cc = code.trim().toUpperCase();
|
|
3744
3685
|
if (!/^[A-Z]{2}$/.test(cc)) return "";
|
|
3745
3686
|
const base = 127462;
|
|
3746
3687
|
return String.fromCodePoint(base + (cc.charCodeAt(0) - 65), base + (cc.charCodeAt(1) - 65));
|
|
3747
3688
|
}
|
|
3748
|
-
var
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
}
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
return
|
|
3689
|
+
var CHAIN_NAME = { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" };
|
|
3690
|
+
function explorerTxUrl2(chain, hash, network) {
|
|
3691
|
+
const testnet = network === "testnet";
|
|
3692
|
+
if (chain === "SOLANA") return `https://explorer.solana.com/tx/${hash}${testnet ? "?cluster=devnet" : ""}`;
|
|
3693
|
+
if (chain === "POLYGON") return `https://${testnet ? "amoy." : ""}polygonscan.com/tx/${hash}`;
|
|
3694
|
+
return `https://stellar.expert/explorer/${testnet ? "testnet" : "public"}/tx/${hash}`;
|
|
3695
|
+
}
|
|
3696
|
+
function legChain(leg) {
|
|
3697
|
+
if (leg.from.kind === "asset") return leg.from.chain;
|
|
3698
|
+
return leg.to.kind === "asset" ? leg.to.chain : "STELLAR";
|
|
3699
|
+
}
|
|
3700
|
+
function stepChain(kind, leg) {
|
|
3701
|
+
if (kind === "mint" && leg.to.kind === "asset") return leg.to.chain;
|
|
3702
|
+
return legChain(leg);
|
|
3703
|
+
}
|
|
3704
|
+
var timeLeftText = (seconds) => seconds <= 0 ? "Taking a little longer than usual" : seconds < 60 ? `About ${seconds}s left` : `About ${Math.ceil(seconds / 60)} min left`;
|
|
3705
|
+
function useNowEverySecond(running) {
|
|
3706
|
+
const [now, setNow] = react.useState(() => Date.now());
|
|
3707
|
+
react.useEffect(() => {
|
|
3708
|
+
if (!running) return;
|
|
3709
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
3710
|
+
return () => clearInterval(timer);
|
|
3711
|
+
}, [running]);
|
|
3712
|
+
return now;
|
|
3713
|
+
}
|
|
3714
|
+
var fiatKey = (fiat) => `${fiat.currency}:${fiat.rail}`;
|
|
3715
|
+
var assetKey3 = (asset) => `${asset.code}:${asset.chain}:${asset.identifier ?? ""}`;
|
|
3716
|
+
function trustKey(rejection) {
|
|
3717
|
+
const asset = core.rampTrustlineAsset(rejection);
|
|
3718
|
+
return asset ? `${asset.code}:${asset.issuer}` : null;
|
|
3719
|
+
}
|
|
3720
|
+
var LOADING_STEPS = ["Checking routes\u2026", "Quoting each step\u2026", "Route found!"];
|
|
3721
|
+
function useRenderAt(at) {
|
|
3722
|
+
const [, setTick] = react.useState(0);
|
|
3723
|
+
react.useEffect(() => {
|
|
3724
|
+
if (at === null) return;
|
|
3725
|
+
const timer = setTimeout(() => setTick((n) => n + 1), Math.max(0, at - Date.now()) + 50);
|
|
3726
|
+
return () => clearTimeout(timer);
|
|
3727
|
+
}, [at]);
|
|
3758
3728
|
}
|
|
3759
3729
|
function RampWidgetTemplate({
|
|
3760
|
-
workflowContent,
|
|
3761
|
-
routeSelector,
|
|
3762
3730
|
theme,
|
|
3763
3731
|
accentColor,
|
|
3764
3732
|
styleOverrides,
|
|
3733
|
+
network,
|
|
3765
3734
|
step,
|
|
3766
3735
|
flowSteps,
|
|
3767
3736
|
flowStepIndex,
|
|
3768
|
-
startingQuoteId,
|
|
3769
3737
|
direction,
|
|
3770
|
-
|
|
3771
|
-
currency,
|
|
3772
|
-
country,
|
|
3773
|
-
requiredFields,
|
|
3774
|
-
fieldValues,
|
|
3738
|
+
routesLoading,
|
|
3775
3739
|
countries,
|
|
3776
|
-
|
|
3777
|
-
|
|
3740
|
+
country,
|
|
3741
|
+
fiats,
|
|
3742
|
+
fiat,
|
|
3743
|
+
assets,
|
|
3744
|
+
asset,
|
|
3745
|
+
amount,
|
|
3746
|
+
sellAvailable,
|
|
3778
3747
|
quotes,
|
|
3779
|
-
|
|
3748
|
+
rejected,
|
|
3749
|
+
startingQuoteId,
|
|
3750
|
+
fields,
|
|
3751
|
+
fieldValues,
|
|
3752
|
+
order,
|
|
3753
|
+
pendingOrders,
|
|
3780
3754
|
isLoading,
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
kycUrl,
|
|
3784
|
-
tosUrl,
|
|
3785
|
-
kycBlocking,
|
|
3786
|
-
onboardingStatus,
|
|
3787
|
-
kycJustApproved,
|
|
3788
|
-
stellarTxHash,
|
|
3789
|
-
txHash,
|
|
3790
|
-
txChain,
|
|
3791
|
-
explorerUrl,
|
|
3792
|
-
fundsInTransit = false,
|
|
3793
|
-
retrying = false,
|
|
3794
|
-
onRetryTransit,
|
|
3795
|
-
depositInstructions,
|
|
3796
|
-
canComplete,
|
|
3797
|
-
completing,
|
|
3798
|
-
savedRamps = [],
|
|
3799
|
-
onResumeRamp,
|
|
3800
|
-
onDismissRamp,
|
|
3801
|
-
onDismissCurrentRamp,
|
|
3802
|
-
onExploreRoutes,
|
|
3755
|
+
refreshing,
|
|
3756
|
+
signing,
|
|
3803
3757
|
errorMsg,
|
|
3804
|
-
|
|
3758
|
+
notice = null,
|
|
3805
3759
|
onDirectionChange,
|
|
3806
|
-
onAmountChange,
|
|
3807
|
-
onFieldChange,
|
|
3808
3760
|
onCountryChange,
|
|
3761
|
+
onFiatChange,
|
|
3762
|
+
onAssetChange,
|
|
3763
|
+
onAmountChange,
|
|
3809
3764
|
onFindRoute,
|
|
3810
3765
|
onSelectQuote,
|
|
3811
3766
|
onVerifyRoute,
|
|
3767
|
+
trustingAsset = null,
|
|
3768
|
+
onTrustAsset,
|
|
3769
|
+
walletBusy = null,
|
|
3770
|
+
custodyChoice = false,
|
|
3771
|
+
onWalletStep,
|
|
3772
|
+
noChains = false,
|
|
3773
|
+
retrying = false,
|
|
3774
|
+
onRetryOrder,
|
|
3775
|
+
onSetUpRecovery,
|
|
3776
|
+
recoveryMissing = null,
|
|
3777
|
+
checkingPayment = false,
|
|
3778
|
+
onCheckPayment,
|
|
3779
|
+
pollTrouble = false,
|
|
3780
|
+
onFieldChange,
|
|
3812
3781
|
onContactContinue,
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3782
|
+
onSign,
|
|
3783
|
+
onApprove,
|
|
3784
|
+
onResumeOrder,
|
|
3785
|
+
onNewOrder,
|
|
3816
3786
|
onBack,
|
|
3787
|
+
onStepSelect,
|
|
3817
3788
|
onRetry,
|
|
3818
3789
|
onRefresh,
|
|
3819
3790
|
onClose
|
|
3820
3791
|
}) {
|
|
3821
|
-
const settledHash = txHash ?? stellarTxHash;
|
|
3822
|
-
const chainName = CHAIN_NAME[txChain ?? "STELLAR"];
|
|
3823
3792
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
|
|
3793
|
+
const onramp = direction === "ONRAMP";
|
|
3794
|
+
const sendUnit = onramp ? fiat?.currency : asset?.code;
|
|
3795
|
+
const view = order ? core.describeRampAction(order) : null;
|
|
3796
|
+
const settled = order ? ["completed", "failed", "refunded"].includes(order.state) : false;
|
|
3797
|
+
const running = order?.legs.find((leg) => core.rampLegStatus(leg) === "active" && order.pendingAction?.legIndex !== leg.index);
|
|
3798
|
+
const now = useNowEverySecond(step === "status" && !settled && !!running && running.etaSeconds !== null);
|
|
3799
|
+
const nextApproval = order && !settled ? core.rampNextApproval(order) : null;
|
|
3800
|
+
const stopped = order ? core.rampOrderStopped(order) : false;
|
|
3801
|
+
const receive = order ? core.rampOrderReceive(order) : null;
|
|
3802
|
+
const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
|
|
3803
|
+
const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
|
|
3804
|
+
useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
|
|
3805
|
+
const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
|
|
3824
3806
|
const stepTitle = {
|
|
3825
|
-
input:
|
|
3826
|
-
loading_quote: "Finding best route",
|
|
3827
|
-
select_route: "
|
|
3807
|
+
input: onramp ? "Buy crypto" : "Sell crypto",
|
|
3808
|
+
loading_quote: "Finding the best route",
|
|
3809
|
+
select_route: "Choose a route",
|
|
3828
3810
|
contact: "Your details",
|
|
3829
|
-
status:
|
|
3811
|
+
status: order?.state === "completed" ? "Transfer completed" : onramp ? "Your purchase" : "Your sale",
|
|
3830
3812
|
error: "Something went wrong"
|
|
3831
3813
|
};
|
|
3832
3814
|
const stepSubtitle = {
|
|
3833
|
-
input:
|
|
3834
|
-
loading_quote: "Comparing
|
|
3835
|
-
select_route: "All
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
// money, not who you are. Say which, rather than asserting the Bridge case
|
|
3839
|
-
// over every provider.
|
|
3840
|
-
contact: `${provider || "This provider"} needs ${listOf(requiredFields.filter((f) => !f.optional).map((f) => f.label.toLowerCase()))} to continue`,
|
|
3841
|
-
status: workflowContent ? "Follow the next step below to continue" : `Finish the flow at ${provider || "the provider"} to continue`,
|
|
3815
|
+
input: onramp ? "Pick what you receive and how much you pay" : "Pick what you sell and how much",
|
|
3816
|
+
loading_quote: "Comparing routes in real time\u2026",
|
|
3817
|
+
select_route: "All amounts include fees",
|
|
3818
|
+
contact: `This route needs ${listOf(fields.filter((f) => !f.optional).map((f) => f.label.toLowerCase()))} to continue`,
|
|
3819
|
+
status: view?.title ?? "Processing",
|
|
3842
3820
|
error: "Please try again"
|
|
3843
3821
|
};
|
|
3844
3822
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
@@ -3879,128 +3857,124 @@ function RampWidgetTemplate({
|
|
|
3879
3857
|
" of ",
|
|
3880
3858
|
flowSteps.length
|
|
3881
3859
|
] }),
|
|
3882
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3883
|
-
"
|
|
3860
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-steps-track", children: flowSteps.map((label, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "pollar-ramp-steps-item", "aria-current": i === flowStepIndex ? "step" : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3861
|
+
"button",
|
|
3884
3862
|
{
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
"
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3863
|
+
type: "button",
|
|
3864
|
+
className: "pollar-ramp-steps-step",
|
|
3865
|
+
"data-done": i <= flowStepIndex || void 0,
|
|
3866
|
+
disabled: !stepsOpen || i >= flowStepIndex,
|
|
3867
|
+
onClick: () => onStepSelect?.(label),
|
|
3868
|
+
children: [
|
|
3869
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-steps-segment" }),
|
|
3870
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-steps-name", children: label })
|
|
3871
|
+
]
|
|
3892
3872
|
}
|
|
3893
|
-
)
|
|
3873
|
+
) }, label)) })
|
|
3894
3874
|
] }),
|
|
3895
|
-
step === "input" &&
|
|
3896
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
),
|
|
3913
|
-
onDismissRamp && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3914
|
-
"button",
|
|
3915
|
-
{
|
|
3916
|
-
type: "button",
|
|
3917
|
-
className: "pollar-btn-secondary",
|
|
3918
|
-
disabled: isLoading,
|
|
3919
|
-
"aria-label": `Remove ${ramp.provider} ${ramp.txId.slice(-8)} from pending list`,
|
|
3920
|
-
onClick: () => onDismissRamp(ramp.txId),
|
|
3921
|
-
children: "Remove"
|
|
3922
|
-
}
|
|
3923
|
-
)
|
|
3924
|
-
] }, ramp.txId))
|
|
3875
|
+
step === "input" && pendingOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "pollar-ramp-payment pollar-ramp-saved", "aria-label": "Pending operations", children: [
|
|
3876
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "These operations are waiting for you. Starting another does not cancel them." }),
|
|
3877
|
+
pendingOrders.map((pending) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-saved-row", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3878
|
+
"button",
|
|
3879
|
+
{
|
|
3880
|
+
type: "button",
|
|
3881
|
+
className: "pollar-btn-secondary",
|
|
3882
|
+
disabled: isLoading,
|
|
3883
|
+
onClick: () => onResumeOrder(pending.id),
|
|
3884
|
+
children: [
|
|
3885
|
+
"Resume ",
|
|
3886
|
+
pending.direction === "ONRAMP" ? "purchase" : "sale",
|
|
3887
|
+
" \xB7 ",
|
|
3888
|
+
pending.id.slice(-8)
|
|
3889
|
+
]
|
|
3890
|
+
}
|
|
3891
|
+
) }, pending.id))
|
|
3925
3892
|
] }),
|
|
3926
3893
|
step === "input" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3927
|
-
noticeMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", role: "status", children: noticeMsg }),
|
|
3928
3894
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tabs", children: [
|
|
3929
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3930
|
-
|
|
3931
|
-
{
|
|
3932
|
-
type: "button",
|
|
3933
|
-
className: "pollar-tab",
|
|
3934
|
-
"data-active": direction === "onramp",
|
|
3935
|
-
onClick: () => onDirectionChange("onramp"),
|
|
3936
|
-
children: "Buy"
|
|
3937
|
-
}
|
|
3938
|
-
),
|
|
3939
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3940
|
-
"button",
|
|
3941
|
-
{
|
|
3942
|
-
type: "button",
|
|
3943
|
-
className: "pollar-tab",
|
|
3944
|
-
"data-active": direction === "offramp",
|
|
3945
|
-
onClick: () => onDirectionChange("offramp"),
|
|
3946
|
-
children: "Sell"
|
|
3947
|
-
}
|
|
3948
|
-
)
|
|
3895
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-tab", "data-active": onramp, onClick: () => onDirectionChange("ONRAMP"), children: "Buy" }),
|
|
3896
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-tab", "data-active": !onramp, onClick: () => onDirectionChange("OFFRAMP"), children: "Sell" })
|
|
3949
3897
|
] }),
|
|
3950
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-
|
|
3951
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
] }),
|
|
3971
|
-
routeSelector,
|
|
3972
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
3973
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-ramp-label", htmlFor: "pollar-ramp-amount", children: [
|
|
3974
|
-
"Amount",
|
|
3975
|
-
currency ? ` (${currency})` : ""
|
|
3898
|
+
routesLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input pollar-select-loading", children: [
|
|
3899
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
3900
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading routes\u2026" })
|
|
3901
|
+
] }) : countries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: noChains ? "This app has no chains enabled, so there is nothing to buy or sell yet." : "No ramp routes are available for this app yet." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3902
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
3903
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", htmlFor: "pollar-ramp-country", children: "Country" }),
|
|
3904
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3905
|
+
"select",
|
|
3906
|
+
{
|
|
3907
|
+
id: "pollar-ramp-country",
|
|
3908
|
+
className: "pollar-ramp-input",
|
|
3909
|
+
value: country,
|
|
3910
|
+
onChange: (e) => onCountryChange(e.target.value),
|
|
3911
|
+
children: countries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: c.country, children: [
|
|
3912
|
+
flagEmoji(c.country),
|
|
3913
|
+
" ",
|
|
3914
|
+
c.country
|
|
3915
|
+
] }, c.country))
|
|
3916
|
+
}
|
|
3917
|
+
)
|
|
3976
3918
|
] }),
|
|
3977
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3978
|
-
"
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3919
|
+
fiats.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
3920
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", htmlFor: "pollar-ramp-fiat", children: onramp ? "Pay with" : "Receive in" }),
|
|
3921
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3922
|
+
"select",
|
|
3923
|
+
{
|
|
3924
|
+
id: "pollar-ramp-fiat",
|
|
3925
|
+
className: "pollar-ramp-input",
|
|
3926
|
+
value: fiat ? fiatKey(fiat) : "",
|
|
3927
|
+
onChange: (e) => onFiatChange(e.target.value),
|
|
3928
|
+
children: fiats.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: fiatKey(f), children: [
|
|
3929
|
+
f.currency,
|
|
3930
|
+
" \xB7 ",
|
|
3931
|
+
core.rampRailLabel(f.rail, { language: formLanguage() })
|
|
3932
|
+
] }, fiatKey(f)))
|
|
3933
|
+
}
|
|
3934
|
+
)
|
|
3935
|
+
] }),
|
|
3936
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
3937
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", htmlFor: "pollar-ramp-asset", children: onramp ? "Receive" : "Sell" }),
|
|
3938
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3939
|
+
"select",
|
|
3940
|
+
{
|
|
3941
|
+
id: "pollar-ramp-asset",
|
|
3942
|
+
className: "pollar-ramp-input",
|
|
3943
|
+
value: asset ? assetKey3(asset) : "",
|
|
3944
|
+
onChange: (e) => onAssetChange(e.target.value),
|
|
3945
|
+
children: assets.map((a) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: assetKey3(a), children: [
|
|
3946
|
+
a.code,
|
|
3947
|
+
" on ",
|
|
3948
|
+
CHAIN_NAME[a.chain] ?? a.chain
|
|
3949
|
+
] }, assetKey3(a)))
|
|
3950
|
+
}
|
|
3951
|
+
)
|
|
3952
|
+
] }),
|
|
3953
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
3954
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3955
|
+
AmountField,
|
|
3956
|
+
{
|
|
3957
|
+
id: "pollar-ramp-amount",
|
|
3958
|
+
label: onramp ? "You pay" : "You sell",
|
|
3959
|
+
value: amount,
|
|
3960
|
+
onChange: onAmountChange,
|
|
3961
|
+
unit: sendUnit,
|
|
3962
|
+
available: onramp ? void 0 : sellAvailable
|
|
3963
|
+
}
|
|
3964
|
+
),
|
|
3965
|
+
errorMsg && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-field-error", children: errorMsg })
|
|
3966
|
+
] })
|
|
3990
3967
|
] }),
|
|
3991
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
"button",
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
}
|
|
4002
|
-
)
|
|
4003
|
-
] })
|
|
3968
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3969
|
+
"button",
|
|
3970
|
+
{
|
|
3971
|
+
type: "button",
|
|
3972
|
+
className: "pollar-btn-primary",
|
|
3973
|
+
disabled: !amount || !fiat || !asset || isLoading || routesLoading,
|
|
3974
|
+
onClick: onFindRoute,
|
|
3975
|
+
children: "Find best route"
|
|
3976
|
+
}
|
|
3977
|
+
) })
|
|
4004
3978
|
] }),
|
|
4005
3979
|
step === "loading_quote" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-loading", children: [
|
|
4006
3980
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner pollar-ramp-loading-spinner" }),
|
|
@@ -4010,33 +3984,44 @@ function RampWidgetTemplate({
|
|
|
4010
3984
|
] }, i))
|
|
4011
3985
|
] }),
|
|
4012
3986
|
step === "select_route" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4013
|
-
noticeMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: noticeMsg }),
|
|
4014
3987
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-route-list", children: [
|
|
4015
3988
|
quotes.map((q, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4016
3989
|
RouteDisplay,
|
|
4017
3990
|
{
|
|
4018
3991
|
quote: q,
|
|
4019
|
-
|
|
3992
|
+
best: i === 0,
|
|
3993
|
+
busy: startingQuoteId === q.quoteId,
|
|
4020
3994
|
disabled: startingQuoteId != null && q.quoteId !== startingQuoteId,
|
|
4021
3995
|
onSelect: onSelectQuote
|
|
4022
3996
|
},
|
|
4023
|
-
|
|
3997
|
+
q.quoteId
|
|
4024
3998
|
)),
|
|
4025
|
-
|
|
4026
|
-
|
|
3999
|
+
rejected.map((r, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4000
|
+
RejectedRouteDisplay,
|
|
4027
4001
|
{
|
|
4028
|
-
|
|
4029
|
-
disabled: startingQuoteId != null,
|
|
4030
|
-
|
|
4002
|
+
rejection: r,
|
|
4003
|
+
disabled: startingQuoteId != null || trustingAsset !== null || walletBusy !== null,
|
|
4004
|
+
trusting: trustKey(r) === trustingAsset,
|
|
4005
|
+
walletBusy: walletBusy === i,
|
|
4006
|
+
custodyChoice,
|
|
4007
|
+
onVerify: onVerifyRoute,
|
|
4008
|
+
onTrust: onTrustAsset,
|
|
4009
|
+
onWalletStep: onWalletStep && ((step2, custody) => onWalletStep(step2, i, custody))
|
|
4031
4010
|
},
|
|
4032
|
-
|
|
4011
|
+
i
|
|
4033
4012
|
))
|
|
4034
4013
|
] }),
|
|
4014
|
+
quotes.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampNoRouteText(rejected) }),
|
|
4015
|
+
notice && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
|
|
4016
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
4017
|
+
" ",
|
|
4018
|
+
notice
|
|
4019
|
+
] }),
|
|
4035
4020
|
errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: errorMsg }),
|
|
4036
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className:
|
|
4021
|
+
(errorMsg || !quotes.length) && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onBack, children: "Back" })
|
|
4037
4022
|
] }),
|
|
4038
4023
|
step === "contact" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4039
|
-
|
|
4024
|
+
fields.map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
4040
4025
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-ramp-label", children: [
|
|
4041
4026
|
f.label,
|
|
4042
4027
|
f.optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-field-optional", children: " (optional)" })
|
|
@@ -4058,184 +4043,178 @@ function RampWidgetTemplate({
|
|
|
4058
4043
|
type: f.type,
|
|
4059
4044
|
className: "pollar-ramp-input",
|
|
4060
4045
|
value: fieldValues[f.key] ?? "",
|
|
4061
|
-
placeholder: placeholderFor(f,
|
|
4046
|
+
placeholder: placeholderFor(f, fields, fieldValues),
|
|
4062
4047
|
autoComplete: f.type === "email" ? "email" : "off",
|
|
4063
4048
|
onChange: (e) => onFieldChange(f.key, e.target.value)
|
|
4064
4049
|
}
|
|
4065
4050
|
),
|
|
4066
4051
|
f.hint && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-field-hint", children: f.hint }),
|
|
4067
|
-
|
|
4052
|
+
core.rampFieldError(f, fieldValues[f.key]) && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-field-error", children: core.rampFieldError(f, fieldValues[f.key]) })
|
|
4068
4053
|
] }, f.key)),
|
|
4069
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4070
|
-
|
|
4071
|
-
|
|
4054
|
+
errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-field-error", children: errorMsg }),
|
|
4055
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4056
|
+
"button",
|
|
4057
|
+
{
|
|
4058
|
+
type: "button",
|
|
4059
|
+
className: "pollar-btn-primary",
|
|
4060
|
+
disabled: fields.some((f) => !core.rampFieldValid(f, fieldValues[f.key])) || isLoading,
|
|
4061
|
+
onClick: onContactContinue,
|
|
4062
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4063
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4064
|
+
"Starting\u2026"
|
|
4065
|
+
] }) : "Continue"
|
|
4066
|
+
}
|
|
4067
|
+
) })
|
|
4068
|
+
] }),
|
|
4069
|
+
step === "status" && order && view && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
|
|
4070
|
+
/* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-legs", "aria-label": "Progress", children: order.legs.map((leg) => {
|
|
4071
|
+
const status = core.rampLegStatus(leg);
|
|
4072
|
+
const hash = leg.onchainTxHash;
|
|
4073
|
+
const note = core.rampLegNote(leg);
|
|
4074
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-ramp-leg", "data-status": status, children: [
|
|
4075
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-dot", "aria-hidden": true }),
|
|
4076
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-title", children: core.rampLegTitle(leg) }),
|
|
4077
|
+
status === "active" && !settled && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": "In progress" }),
|
|
4078
|
+
hash && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4079
|
+
"a",
|
|
4080
|
+
{
|
|
4081
|
+
className: "pollar-ramp-leg-link",
|
|
4082
|
+
href: explorerTxUrl2(legChain(leg), hash, network),
|
|
4083
|
+
target: "_blank",
|
|
4084
|
+
rel: "noopener noreferrer",
|
|
4085
|
+
children: [
|
|
4086
|
+
hash.slice(0, 6),
|
|
4087
|
+
"\u2026",
|
|
4088
|
+
hash.slice(-4)
|
|
4089
|
+
]
|
|
4090
|
+
}
|
|
4091
|
+
),
|
|
4092
|
+
note && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-note", children: note }),
|
|
4093
|
+
status === "active" && !settled && !!leg.steps?.length && /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "pollar-ramp-steps", children: leg.steps.map((s) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
|
|
4094
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-step-title", children: core.rampStepTitle(s, leg) }),
|
|
4095
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-step-state", children: [
|
|
4096
|
+
s.status === "confirming" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
4097
|
+
s.hash ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4098
|
+
"a",
|
|
4099
|
+
{
|
|
4100
|
+
className: "pollar-ramp-leg-link",
|
|
4101
|
+
href: explorerTxUrl2(stepChain(s.kind, leg), s.hash, network),
|
|
4102
|
+
target: "_blank",
|
|
4103
|
+
rel: "noopener noreferrer",
|
|
4104
|
+
children: core.rampStepStatusText(s)
|
|
4105
|
+
}
|
|
4106
|
+
) : core.rampStepStatusText(s)
|
|
4107
|
+
] })
|
|
4108
|
+
] }, s.kind)) }),
|
|
4109
|
+
running === leg && !settled && core.rampLegTimeLeft(leg, now) !== null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-leg-eta", children: timeLeftText(core.rampLegTimeLeft(leg, now)) })
|
|
4110
|
+
] }, leg.index);
|
|
4111
|
+
}) }),
|
|
4112
|
+
nextApproval && !order.pendingAction && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-next", children: [
|
|
4113
|
+
"Next: ",
|
|
4114
|
+
nextApproval,
|
|
4115
|
+
". You approve it on this device when it comes up."
|
|
4116
|
+
] }),
|
|
4117
|
+
receive && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4118
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: order.state === "completed" ? "You received" : "You receive" }),
|
|
4119
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
|
|
4120
|
+
receive.estimated && "~",
|
|
4121
|
+
receive.amount,
|
|
4122
|
+
" ",
|
|
4123
|
+
receive.unit
|
|
4124
|
+
] })
|
|
4125
|
+
] }),
|
|
4126
|
+
order.failure && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4127
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "What to do" }),
|
|
4128
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampOrderResolutionText(order) }),
|
|
4129
|
+
stopped && !settled && waitsOnRecovery && recoveryMissing !== false && onSetUpRecovery && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onSetUpRecovery, children: "Set up recovery" }),
|
|
4130
|
+
stopped && !settled && waitsOnRecovery && recoveryMissing === true && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "Once it is set up, the order goes on by itself." }),
|
|
4131
|
+
stopped && !settled && order.failure.resolutionOwner === "END_USER" && onRetryOrder && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4072
4132
|
"button",
|
|
4073
4133
|
{
|
|
4074
4134
|
type: "button",
|
|
4075
4135
|
className: "pollar-btn-primary",
|
|
4076
|
-
disabled:
|
|
4077
|
-
onClick:
|
|
4078
|
-
children:
|
|
4136
|
+
disabled: retrying || waitsOnRecovery && recoveryMissing === true,
|
|
4137
|
+
onClick: onRetryOrder,
|
|
4138
|
+
children: retrying ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4079
4139
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4080
|
-
"
|
|
4081
|
-
] }) : "
|
|
4140
|
+
" Trying again\u2026"
|
|
4141
|
+
] }) : "Try again"
|
|
4082
4142
|
}
|
|
4083
|
-
)
|
|
4084
|
-
] })
|
|
4085
|
-
] }),
|
|
4086
|
-
step === "status" && workflowContent,
|
|
4087
|
-
step === "status" && onDismissCurrentRamp && txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-explore", children: [
|
|
4088
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", disabled: completing, onClick: onDismissCurrentRamp, children: "Remove from pending list" }),
|
|
4089
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "This only hides the operation in this tab. To request cancellation, open the provider link above when available or contact the provider\u2019s support. Payments and refunds must be confirmed by the provider." })
|
|
4090
|
-
] }),
|
|
4091
|
-
step === "status" && onExploreRoutes && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-explore", children: [
|
|
4092
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", disabled: completing, onClick: onExploreRoutes, children: txStatus === "completed" || txStatus === "failed" ? "Start another operation" : "Try another route" }),
|
|
4093
|
-
txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "Your current operation stays saved so you can resume it later." })
|
|
4094
|
-
] }),
|
|
4095
|
-
step === "status" && !workflowContent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment", children: [
|
|
4096
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4097
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Provider" }),
|
|
4098
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsx("code", { children: provider }) })
|
|
4099
|
-
] }),
|
|
4100
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4101
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Status" }),
|
|
4102
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", children: [
|
|
4103
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { style: { color: txStatus === "completed" ? "var(--pollar-success-text)" : void 0 }, children: txStatus ? STATUS_LABEL[txStatus] : "Processing" }),
|
|
4104
|
-
txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": "Checking status" })
|
|
4105
|
-
] })
|
|
4106
|
-
] }),
|
|
4107
|
-
fundsInTransit && txStatus !== "completed" && txStatus !== "failed" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4108
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Funds in transit" }),
|
|
4109
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "Your money is safe in your own wallet, waiting for the next step of the transfer." }),
|
|
4110
|
-
onRetryTransit && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onRetryTransit, disabled: retrying, children: retrying ? "Retrying..." : "Retry now" })
|
|
4111
|
-
] }),
|
|
4112
|
-
settledHash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4113
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-ramp-payment-label", children: [
|
|
4114
|
-
chainName,
|
|
4115
|
-
" tx"
|
|
4116
|
-
] }),
|
|
4143
|
+
),
|
|
4117
4144
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-value", style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4118
4145
|
/* @__PURE__ */ jsxRuntime.jsxs("code", { style: { flex: 1, wordBreak: "break-all" }, children: [
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
settledHash.slice(-8)
|
|
4146
|
+
"Order ",
|
|
4147
|
+
order.id
|
|
4122
4148
|
] }),
|
|
4123
|
-
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value:
|
|
4124
|
-
explorerUrl && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4125
|
-
"a",
|
|
4126
|
-
{
|
|
4127
|
-
href: explorerUrl,
|
|
4128
|
-
target: "_blank",
|
|
4129
|
-
rel: "noopener noreferrer",
|
|
4130
|
-
className: "pollar-copy-btn",
|
|
4131
|
-
"aria-label": `View on ${EXPLORER_NAME[txChain ?? "STELLAR"]}`,
|
|
4132
|
-
title: `View on ${EXPLORER_NAME[txChain ?? "STELLAR"]}`,
|
|
4133
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
4134
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4135
|
-
"path",
|
|
4136
|
-
{
|
|
4137
|
-
d: "M6 3H3v8h8V8",
|
|
4138
|
-
stroke: "currentColor",
|
|
4139
|
-
strokeWidth: "1.5",
|
|
4140
|
-
strokeLinecap: "round",
|
|
4141
|
-
strokeLinejoin: "round"
|
|
4142
|
-
}
|
|
4143
|
-
),
|
|
4144
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4145
|
-
"path",
|
|
4146
|
-
{
|
|
4147
|
-
d: "M8.5 2.5h3v3M11 3L6.5 7.5",
|
|
4148
|
-
stroke: "currentColor",
|
|
4149
|
-
strokeWidth: "1.5",
|
|
4150
|
-
strokeLinecap: "round",
|
|
4151
|
-
strokeLinejoin: "round"
|
|
4152
|
-
}
|
|
4153
|
-
)
|
|
4154
|
-
] })
|
|
4155
|
-
}
|
|
4156
|
-
)
|
|
4149
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: order.id, label: "Copy order id" })
|
|
4157
4150
|
] })
|
|
4158
4151
|
] }),
|
|
4159
|
-
|
|
4152
|
+
!settled && payBy !== null && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: payBy > Date.now() ? `Pay before ${new Date(payBy).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}.` : "This payment window has closed. If you have not paid, start a new operation." }),
|
|
4153
|
+
!settled && view.scannable && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4160
4154
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: "Payment QR" }),
|
|
4161
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children:
|
|
4155
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: view.scannable.image.inlineSafe ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4162
4156
|
"div",
|
|
4163
4157
|
{
|
|
4164
4158
|
className: "pollar-ramp-qr",
|
|
4165
4159
|
"aria-label": "Payment QR",
|
|
4166
|
-
dangerouslySetInnerHTML: { __html:
|
|
4160
|
+
dangerouslySetInnerHTML: { __html: view.scannable.image.data }
|
|
4167
4161
|
}
|
|
4168
4162
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4169
4163
|
"img",
|
|
4170
4164
|
{
|
|
4171
|
-
src: scannableImageSrc(
|
|
4165
|
+
src: scannableImageSrc(view.scannable.image),
|
|
4172
4166
|
alt: "Payment QR",
|
|
4173
4167
|
style: { width: "100%", maxWidth: 220, height: "auto", display: "block", margin: "0 auto" }
|
|
4174
4168
|
}
|
|
4175
4169
|
) })
|
|
4176
4170
|
] }),
|
|
4177
|
-
|
|
4178
|
-
|
|
4171
|
+
!settled && view.codeMissing && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: "The payment code could not be shown. Refresh; if it still does not appear, contact this app's support." }),
|
|
4172
|
+
!settled && view.scannable?.payload && view.scannable.payloadLabel && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4173
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: view.scannable.payloadLabel }),
|
|
4179
4174
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4180
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children:
|
|
4181
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4182
|
-
CopyButton,
|
|
4183
|
-
{
|
|
4184
|
-
value: depositInstructions.scannable.payload,
|
|
4185
|
-
label: `Copy ${depositInstructions.scannable.payloadLabel}`
|
|
4186
|
-
}
|
|
4187
|
-
)
|
|
4175
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: view.scannable.payload }),
|
|
4176
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: view.scannable.payload, label: `Copy ${view.scannable.payloadLabel}` })
|
|
4188
4177
|
] }) })
|
|
4189
4178
|
] }),
|
|
4190
|
-
|
|
4191
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children:
|
|
4192
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children:
|
|
4193
|
-
/* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children:
|
|
4194
|
-
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value:
|
|
4195
|
-
] })
|
|
4196
|
-
] },
|
|
4197
|
-
|
|
4198
|
-
"Accept terms at ",
|
|
4199
|
-
provider
|
|
4200
|
-
] }),
|
|
4201
|
-
kycUrl && !depositInstructions && txStatus !== "completed" && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-btn-primary", onClick: onOpenKyc, children: [
|
|
4202
|
-
"Continue at ",
|
|
4203
|
-
provider
|
|
4204
|
-
] }),
|
|
4205
|
-
kycBlocking && onboardingStatus === "awaiting_provider" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
|
|
4206
|
-
provider,
|
|
4207
|
-
" is still setting up your account for this payment method. Your verification is complete and there is nothing left for you to do \u2014 nothing has been sent, and this will update on its own once ",
|
|
4208
|
-
provider,
|
|
4209
|
-
" is ready."
|
|
4210
|
-
] }),
|
|
4211
|
-
kycBlocking && onboardingStatus !== "awaiting_provider" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
|
|
4212
|
-
provider,
|
|
4213
|
-
" needs to verify your identity before this payout. Nothing has been sent yet \u2014 complete verification with ",
|
|
4214
|
-
provider,
|
|
4215
|
-
", and this will update on its own."
|
|
4216
|
-
] }),
|
|
4217
|
-
kycJustApproved && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4218
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-ramp-payment-note", children: [
|
|
4219
|
-
provider,
|
|
4220
|
-
" approved your verification. Request a new quote to continue \u2014 the previous one was consumed."
|
|
4221
|
-
] }),
|
|
4222
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: "Request a new quote" })
|
|
4223
|
-
] }),
|
|
4224
|
-
canComplete && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: completing, onClick: onCompleteWithdraw, children: completing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4179
|
+
!settled && view.details.map((d) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
4180
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-ramp-payment-label", children: d.label }),
|
|
4181
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
4182
|
+
/* @__PURE__ */ jsxRuntime.jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: d.value }),
|
|
4183
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: d.value, label: `Copy ${d.label}` })
|
|
4184
|
+
] }) })
|
|
4185
|
+
] }, d.label)),
|
|
4186
|
+
!settled && view.action?.kind === "FIAT_PAYMENT" && onCheckPayment && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: checkingPayment, onClick: onCheckPayment, children: checkingPayment ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4225
4187
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4226
|
-
"
|
|
4227
|
-
] }) : "
|
|
4228
|
-
|
|
4229
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
4188
|
+
" Checking your payment..."
|
|
4189
|
+
] }) : "I've paid" }),
|
|
4190
|
+
!settled && view.canSign && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", disabled: signing, onClick: onSign, children: signing ? "Waiting for your wallet\u2026" : "Authorize" }),
|
|
4191
|
+
!settled && view.action?.kind === "SIGNATURE" && !view.canSign && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "Preparing a new signature request\u2026" }),
|
|
4192
|
+
!settled && view.canApprove && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onApprove, children: "Approve on this device" }),
|
|
4193
|
+
!settled && view.link && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4194
|
+
"a",
|
|
4195
|
+
{
|
|
4196
|
+
className: "pollar-btn-primary pollar-ramp-hosted-link",
|
|
4197
|
+
href: view.link,
|
|
4198
|
+
target: "_blank",
|
|
4199
|
+
rel: "noopener noreferrer",
|
|
4200
|
+
children: view.linkLabel
|
|
4201
|
+
}
|
|
4202
|
+
),
|
|
4203
|
+
!settled && order.pendingAction?.kind === "KYC" && !view.link && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: view.note ?? "The provider is reviewing your details. This updates on its own." }),
|
|
4204
|
+
pollTrouble && !settled && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "Having trouble reaching the server. Retrying\u2026" }),
|
|
4205
|
+
errorMsg && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-field-error", children: errorMsg }),
|
|
4206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-explore", children: [
|
|
4207
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onNewOrder, children: "Start another operation" }),
|
|
4208
|
+
!stopped && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: "This one keeps going; you can resume it later." })
|
|
4209
|
+
] })
|
|
4230
4210
|
] }),
|
|
4231
|
-
step === "error" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4232
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
4211
|
+
step === "error" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4212
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: errorMsg ?? "Something went wrong." }),
|
|
4233
4213
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-actions", children: [
|
|
4234
4214
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: "Close" }),
|
|
4235
4215
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRetry, children: "Try again" })
|
|
4236
4216
|
] })
|
|
4237
|
-
] })
|
|
4238
|
-
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
4217
|
+
] })
|
|
4239
4218
|
] });
|
|
4240
4219
|
}
|
|
4241
4220
|
|
|
@@ -4729,776 +4708,580 @@ function ProviderRegistrationModal({
|
|
|
4729
4708
|
}
|
|
4730
4709
|
) });
|
|
4731
4710
|
}
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
function unavailableRampMessage(country, unavailable) {
|
|
4735
|
-
if (!unavailable.length) return `No ramp providers available for ${country} yet.`;
|
|
4736
|
-
return unavailable.map(
|
|
4737
|
-
({ provider, code }) => code === "SDK_RAMPS_PROVIDER_NOT_CONFIGURED" ? `${provider} is not configured correctly. Contact the app administrator to enable this provider.` : `${provider} is temporarily unavailable. Please try again later.`
|
|
4738
|
-
).join(" ");
|
|
4739
|
-
}
|
|
4740
|
-
async function quoteRampOptions(client, query, routes) {
|
|
4741
|
-
const matching = routes.filter(
|
|
4742
|
-
(route) => route.country === query.country && route.direction === query.direction && route.fiatCurrency === query.currency
|
|
4743
|
-
);
|
|
4744
|
-
const responses = await Promise.allSettled([
|
|
4745
|
-
client.getRampsQuote(query),
|
|
4746
|
-
...matching.map((route) => client.getRampsQuote({ ...query, routeId: route.routeId, chain: route.asset.chain }))
|
|
4747
|
-
]);
|
|
4748
|
-
const results = responses.flatMap((response) => response.status === "fulfilled" ? [response.value] : []);
|
|
4749
|
-
if (!results.length) throw responses[0].reason;
|
|
4750
|
-
const quotes = /* @__PURE__ */ new Map();
|
|
4751
|
-
const requirements = /* @__PURE__ */ new Map();
|
|
4752
|
-
const unavailable = /* @__PURE__ */ new Map();
|
|
4753
|
-
for (const result of results) {
|
|
4754
|
-
for (const quote of result.quotes) {
|
|
4755
|
-
const key = JSON.stringify([quote.provider, quote.route?.routeId, quote.route?.asset.chain, quote.rail, quote.protocol]);
|
|
4756
|
-
if (!quotes.has(key)) quotes.set(key, quote);
|
|
4757
|
-
}
|
|
4758
|
-
for (const requirement of result.requirementsRequired ?? [])
|
|
4759
|
-
requirements.set(`${requirement.rampProviderId}:${requirement.corridorId}`, requirement);
|
|
4760
|
-
for (const item of result.unavailable ?? []) unavailable.set(item.provider, item);
|
|
4761
|
-
}
|
|
4762
|
-
const failed = responses.find((response) => response.status === "rejected");
|
|
4763
|
-
if (!quotes.size && !requirements.size && failed?.status === "rejected") throw failed.reason;
|
|
4764
|
-
return {
|
|
4765
|
-
quotes: [...quotes.values()],
|
|
4766
|
-
requirementsRequired: [...requirements.values()],
|
|
4767
|
-
unavailable: [...unavailable.values()]
|
|
4768
|
-
};
|
|
4769
|
-
}
|
|
4770
|
-
var TERMINAL = ["completed", "failed"];
|
|
4771
|
-
var BANK_TYPES = ["CLABE", "PIX", "PSE", "ACH", "BREB"];
|
|
4772
|
-
function isBankType(value) {
|
|
4773
|
-
return BANK_TYPES.some((type) => type === value);
|
|
4774
|
-
}
|
|
4775
|
-
function requiredFieldsOf(quote) {
|
|
4776
|
-
return "requiredFields" in quote ? quote.requiredFields : [];
|
|
4777
|
-
}
|
|
4778
|
-
function flowStepsOf(quotes, selected) {
|
|
4779
|
-
const needsDetails = selected != null ? requiredFieldsOf(selected).length > 0 : quotes.some((q) => requiredFieldsOf(q).length > 0);
|
|
4780
|
-
return needsDetails ? ["Amount", "Provider", "Details", "Complete"] : ["Amount", "Provider", "Complete"];
|
|
4781
|
-
}
|
|
4782
|
-
var STEP_LABEL = {
|
|
4783
|
-
input: "Amount",
|
|
4784
|
-
loading_quote: "Amount",
|
|
4785
|
-
select_route: "Provider",
|
|
4786
|
-
contact: "Details",
|
|
4787
|
-
status: "Complete"
|
|
4788
|
-
};
|
|
4789
|
-
function brokenLimitOf(amount, quote) {
|
|
4790
|
-
const minAmount = "minAmount" in quote ? quote.minAmount : void 0;
|
|
4791
|
-
const maxAmount = "maxAmount" in quote ? quote.maxAmount : void 0;
|
|
4792
|
-
if (!Number.isFinite(amount)) return null;
|
|
4793
|
-
if (minAmount != null && amount < minAmount) return { limit: "min", value: minAmount };
|
|
4794
|
-
if (maxAmount != null && amount > maxAmount) return { limit: "max", value: maxAmount };
|
|
4795
|
-
return null;
|
|
4796
|
-
}
|
|
4797
|
-
function limitMessage(limit, value, currency) {
|
|
4798
|
-
return `The ${limit === "min" ? "minimum" : "maximum"} amount for this route is ${value} ${currency}.`;
|
|
4799
|
-
}
|
|
4711
|
+
var PAYMENT_CHECK_EVERY_MS = 1e4;
|
|
4712
|
+
var PAYMENT_CHECK_WINDOW_MS = 2 * 6e4;
|
|
4800
4713
|
var RAMP_ERROR_MESSAGES = {
|
|
4801
|
-
SDK_RAMPS_QUOTE_EXPIRED: "This quote expired.
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
SDK_RAMPS_ANCHOR_ERROR: "The provider rejected the request. Please try again in a moment.",
|
|
4807
|
-
SDK_RAMPS_BRIDGE_ERROR: "The provider rejected the request. Please try again in a moment.",
|
|
4808
|
-
SDK_RAMPS_ETHERFUSE_ERROR: "The provider rejected the request. Please try again in a moment.",
|
|
4809
|
-
SDK_RAMPS_INSUFFICIENT_BALANCE: "This wallet does not hold enough to cover that amount. Try a smaller one.",
|
|
4810
|
-
// Nothing moved on-chain, so the balance is untouched. Almost always no XLM
|
|
4811
|
-
// for the network fee on a wallet the app does not sponsor.
|
|
4812
|
-
SDK_RAMPS_ONCHAIN_SUBMIT_FAILED: "The network rejected the transaction, so nothing was sent. The wallet may need XLM for the fee."
|
|
4714
|
+
SDK_RAMPS_QUOTE_EXPIRED: "This quote expired. Find a route again.",
|
|
4715
|
+
SDK_RAMPS_QUOTE_NOT_FOUND: "This quote is no longer available. Find a route again.",
|
|
4716
|
+
SDK_RAMPS_ACTION_STALE: "This step changed. It was refreshed; try again.",
|
|
4717
|
+
SDK_RAMPS_TX_NOT_FOUND: "This operation was not found.",
|
|
4718
|
+
SDK_RAMPS_WALLET_NOT_READY: "Approve the new wallet account on your device, then try again."
|
|
4813
4719
|
};
|
|
4814
|
-
function rampErrorMessage(
|
|
4815
|
-
const
|
|
4816
|
-
if (
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
if ((limit === "min" || limit === "max") && typeof value === "number" && typeof currency === "string") {
|
|
4823
|
-
return limitMessage(limit, value, currency);
|
|
4824
|
-
}
|
|
4825
|
-
return RAMP_ERROR_MESSAGES[code] ?? (e instanceof Error ? e.message : fallback);
|
|
4826
|
-
}
|
|
4827
|
-
function readRampStorage(key) {
|
|
4828
|
-
try {
|
|
4829
|
-
return typeof window === "undefined" ? null : window.sessionStorage.getItem(key);
|
|
4830
|
-
} catch {
|
|
4831
|
-
return null;
|
|
4832
|
-
}
|
|
4833
|
-
}
|
|
4834
|
-
function writeRampStorage(key, value) {
|
|
4835
|
-
try {
|
|
4836
|
-
if (typeof window === "undefined") return;
|
|
4837
|
-
if (value === null) window.sessionStorage.removeItem(key);
|
|
4838
|
-
else window.sessionStorage.setItem(key, value);
|
|
4839
|
-
} catch {
|
|
4720
|
+
function rampErrorMessage(error, fallback) {
|
|
4721
|
+
const unavailable = core.appUnavailableMessage(error);
|
|
4722
|
+
if (unavailable) return unavailable;
|
|
4723
|
+
if (core.isPollarApiError(error)) {
|
|
4724
|
+
const known = RAMP_ERROR_MESSAGES[error.code];
|
|
4725
|
+
if (known) return known;
|
|
4726
|
+
const message = error.body.message;
|
|
4727
|
+
if (typeof message === "string" && message && !/^[A-Z0-9_]+$/.test(message)) return message;
|
|
4840
4728
|
}
|
|
4729
|
+
return fallback;
|
|
4841
4730
|
}
|
|
4842
|
-
function
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
return Array.isArray(value) ? value.filter((item) => typeof item?.txId === "string" && typeof item?.provider === "string") : [];
|
|
4846
|
-
} catch {
|
|
4847
|
-
return [];
|
|
4848
|
-
}
|
|
4731
|
+
function routeKey(quote) {
|
|
4732
|
+
const node = (n) => n.kind === "asset" ? `${n.code}:${n.chain}` : `${n.currency}:${n.rail}`;
|
|
4733
|
+
return quote.legs.map((leg) => `${leg.kind}:${node(leg.from)}>${node(leg.to)}`).join("|");
|
|
4849
4734
|
}
|
|
4850
|
-
|
|
4735
|
+
var DECIMAL = /^\d+(\.\d+)?$/;
|
|
4736
|
+
async function signLegWithWallet(client, orderId, actionId) {
|
|
4737
|
+
const lent = [];
|
|
4738
|
+
const lend = (chain, encoding, handler) => {
|
|
4739
|
+
try {
|
|
4740
|
+
lent.push(client.registerRampSigningHandler(chain, encoding, handler));
|
|
4741
|
+
} catch {
|
|
4742
|
+
}
|
|
4743
|
+
};
|
|
4744
|
+
lend("STELLAR", "xdr", async (action) => {
|
|
4745
|
+
const wallet = client.getWallet();
|
|
4746
|
+
if (!wallet) throw new Error("Connect the Stellar wallet this step was built for.");
|
|
4747
|
+
core.assertRampStellarSigner(action, wallet.address);
|
|
4748
|
+
const outcome = await client.signTx(action.payload.value);
|
|
4749
|
+
if (client.getWallet()?.address !== wallet.address)
|
|
4750
|
+
throw new Error("The connected wallet changed. Refresh before signing.");
|
|
4751
|
+
if (outcome.status === "signed") return outcome.signedXdr;
|
|
4752
|
+
throw new Error(
|
|
4753
|
+
outcome.status === "error" ? outcome.message ?? outcome.details ?? "Signing was cancelled." : "Signing was cancelled."
|
|
4754
|
+
);
|
|
4755
|
+
});
|
|
4756
|
+
lend("SOLANA", "solana-v0-json", async (action) => {
|
|
4757
|
+
const payload = JSON.parse(action.payload.value);
|
|
4758
|
+
const solanaWallet = () => client.getWallets().find((w) => w.chain === "SOLANA" && w.custody === "external");
|
|
4759
|
+
const wallet = solanaWallet();
|
|
4760
|
+
if (!wallet || payload.from !== wallet.address || !payload.unsignedTransaction)
|
|
4761
|
+
throw new Error("This step must be signed by the Solana wallet it was built for. Reconnect that wallet.");
|
|
4762
|
+
const signed = await client.signSolanaTransaction(payload.unsignedTransaction);
|
|
4763
|
+
if (solanaWallet()?.address !== wallet.address) throw new Error("The connected wallet changed. Refresh before signing.");
|
|
4764
|
+
return signed;
|
|
4765
|
+
});
|
|
4851
4766
|
try {
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
return [];
|
|
4767
|
+
return await client.signRampLeg(orderId, actionId);
|
|
4768
|
+
} finally {
|
|
4769
|
+
for (const release of lent) release();
|
|
4856
4770
|
}
|
|
4857
4771
|
}
|
|
4858
|
-
function explorerTxUrl2(chain, hash, network) {
|
|
4859
|
-
if (!hash) return null;
|
|
4860
|
-
const testnet = network === "testnet";
|
|
4861
|
-
if (chain === "SOLANA") return `https://explorer.solana.com/tx/${hash}${testnet ? "?cluster=devnet" : ""}`;
|
|
4862
|
-
if (chain === "POLYGON") return `https://${testnet ? "amoy." : ""}polygonscan.com/tx/${hash}`;
|
|
4863
|
-
return `https://stellar.expert/explorer/${testnet ? "testnet" : "public"}/tx/${hash}`;
|
|
4864
|
-
}
|
|
4865
4772
|
function RampWidget({ onClose }) {
|
|
4866
|
-
const {
|
|
4867
|
-
|
|
4773
|
+
const {
|
|
4774
|
+
getClient,
|
|
4775
|
+
styles,
|
|
4776
|
+
network,
|
|
4777
|
+
openCosignModal,
|
|
4778
|
+
setCosignNextStep,
|
|
4779
|
+
openRecoveryModal,
|
|
4780
|
+
recovery,
|
|
4781
|
+
recoveryLocked,
|
|
4782
|
+
appConfig,
|
|
4783
|
+
cosign,
|
|
4784
|
+
refreshWalletBalance
|
|
4785
|
+
} = usePollar();
|
|
4868
4786
|
const client = getClient();
|
|
4869
4787
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
4870
4788
|
const [step, setStep] = react.useState("input");
|
|
4871
|
-
const [direction, setDirection] = react.useState("
|
|
4872
|
-
const [
|
|
4873
|
-
const [
|
|
4789
|
+
const [direction, setDirection] = react.useState("ONRAMP");
|
|
4790
|
+
const [routes, setRoutes] = react.useState([]);
|
|
4791
|
+
const [routesLoading, setRoutesLoading] = react.useState(true);
|
|
4874
4792
|
const [country, setCountry] = react.useState("");
|
|
4875
|
-
const [
|
|
4876
|
-
const
|
|
4877
|
-
const [
|
|
4878
|
-
const [countriesLoading, setCountriesLoading] = react.useState(true);
|
|
4879
|
-
const [refreshing, setRefreshing] = react.useState(false);
|
|
4793
|
+
const [fiatChoice, setFiatChoice] = react.useState("");
|
|
4794
|
+
const [assetChoice, setAssetChoice] = react.useState("");
|
|
4795
|
+
const [amount, setAmount] = react.useState("");
|
|
4880
4796
|
const [quotes, setQuotes] = react.useState([]);
|
|
4881
|
-
const [
|
|
4882
|
-
const [
|
|
4797
|
+
const [rejected, setRejected] = react.useState([]);
|
|
4798
|
+
const [selected, setSelected] = react.useState(null);
|
|
4799
|
+
const [startingQuoteId, setStartingQuoteId] = react.useState(null);
|
|
4800
|
+
const [fieldValues, setFieldValues] = react.useState({});
|
|
4801
|
+
const [order, setOrder] = react.useState(null);
|
|
4802
|
+
const [pendingOrders, setPendingOrders] = react.useState([]);
|
|
4883
4803
|
const [isLoading, setIsLoading] = react.useState(false);
|
|
4884
|
-
const [
|
|
4885
|
-
const [
|
|
4886
|
-
const kycAttempt = react.useRef(null);
|
|
4887
|
-
react.useEffect(
|
|
4888
|
-
() => () => {
|
|
4889
|
-
kycAttempt.current = null;
|
|
4890
|
-
},
|
|
4891
|
-
[]
|
|
4892
|
-
);
|
|
4893
|
-
const [txId, setTxId] = react.useState(null);
|
|
4894
|
-
const [provider, setProvider] = react.useState("");
|
|
4895
|
-
const [kycUrl, setKycUrl] = react.useState(null);
|
|
4896
|
-
const [tosUrl, setTosUrl] = react.useState(null);
|
|
4897
|
-
const [kycPending, setKycPending] = react.useState(false);
|
|
4898
|
-
const [kycApproved, setKycApproved] = react.useState(false);
|
|
4899
|
-
const [onboardingStatus, setOnboardingStatus] = react.useState(void 0);
|
|
4900
|
-
const [txStatus, setTxStatus] = react.useState(null);
|
|
4901
|
-
const [stellarTxHash, setStellarTxHash] = react.useState(null);
|
|
4902
|
-
const [txHash, setTxHash] = react.useState(null);
|
|
4903
|
-
const [txChain, setTxChain] = react.useState(null);
|
|
4904
|
-
const [fundsInTransit, setFundsInTransit] = react.useState(false);
|
|
4905
|
-
const [retrying, setRetrying] = react.useState(false);
|
|
4906
|
-
const [depositInstructions, setDepositInstructions] = react.useState(null);
|
|
4907
|
-
const [workflow, setWorkflow] = react.useState(null);
|
|
4908
|
-
const workflowRef = react.useRef(null);
|
|
4909
|
-
const storageKey = `pollar:ramp:${client.apiKey}:${walletAddress}`;
|
|
4910
|
-
const [savedRamps, setSavedRamps] = react.useState([]);
|
|
4911
|
-
const [legacySignature, setLegacySignature] = react.useState(void 0);
|
|
4912
|
-
function acceptWorkflow(incoming) {
|
|
4913
|
-
if (hiddenRampsOf(storageKey).includes(incoming.txId)) return false;
|
|
4914
|
-
const next = core.mergeRampSnapshot(workflowRef.current, incoming);
|
|
4915
|
-
workflowRef.current = next;
|
|
4916
|
-
setWorkflow(next);
|
|
4917
|
-
if (next === incoming) {
|
|
4918
|
-
const pending = savedRampsOf(storageKey).filter((item) => item.txId !== incoming.txId);
|
|
4919
|
-
if (!["completed", "failed", "refunded"].includes(incoming.lifecycleState ?? incoming.status))
|
|
4920
|
-
pending.push({
|
|
4921
|
-
txId: incoming.txId,
|
|
4922
|
-
provider: "provider" in incoming && typeof incoming.provider === "string" ? incoming.provider : provider || "Ramp"
|
|
4923
|
-
});
|
|
4924
|
-
writeRampStorage(`${storageKey}:saved`, JSON.stringify(pending));
|
|
4925
|
-
writeRampStorage(storageKey, incoming.txId);
|
|
4926
|
-
writeRampStorage(`${storageKey}:selection`, null);
|
|
4927
|
-
setSavedRamps(pending);
|
|
4928
|
-
}
|
|
4929
|
-
return next === incoming;
|
|
4930
|
-
}
|
|
4931
|
-
const [routes, setRoutes] = react.useState([]);
|
|
4932
|
-
const countries = core.mergeRampCountries(legacyCountries, routes);
|
|
4933
|
-
react.useEffect(() => {
|
|
4934
|
-
if (!country && countries[0]) {
|
|
4935
|
-
setCountry(countries[0].code);
|
|
4936
|
-
setCurrency(countries[0].currency ?? "");
|
|
4937
|
-
}
|
|
4938
|
-
}, [countries, country]);
|
|
4939
|
-
react.useEffect(() => {
|
|
4940
|
-
let active = true;
|
|
4941
|
-
void client.getRampRoutes().then((result) => {
|
|
4942
|
-
if (active) setRoutes(result.routes);
|
|
4943
|
-
}).catch(() => {
|
|
4944
|
-
});
|
|
4945
|
-
return () => {
|
|
4946
|
-
active = false;
|
|
4947
|
-
};
|
|
4948
|
-
}, [client]);
|
|
4949
|
-
const [completing, setCompleting] = react.useState(false);
|
|
4950
|
-
const completionLocked = react.useRef(false);
|
|
4804
|
+
const [refreshing, setRefreshing] = react.useState(false);
|
|
4805
|
+
const [signing, setSigning] = react.useState(false);
|
|
4951
4806
|
const [errorMsg, setErrorMsg] = react.useState(null);
|
|
4807
|
+
const [verifying, setVerifying] = react.useState(null);
|
|
4808
|
+
const [trustingAsset, setTrustingAsset] = react.useState(null);
|
|
4809
|
+
const [walletBusy, setWalletBusy] = react.useState(null);
|
|
4810
|
+
const [retrying, setRetrying] = react.useState(false);
|
|
4811
|
+
const [awaitingAccount, setAwaitingAccount] = react.useState(null);
|
|
4812
|
+
const [pollTrouble, setPollTrouble] = react.useState(false);
|
|
4813
|
+
const [pollKey, setPollKey] = react.useState(0);
|
|
4814
|
+
const [paymentCheckUntil, setPaymentCheckUntil] = react.useState(null);
|
|
4815
|
+
const promptedApproval = react.useRef(null);
|
|
4816
|
+
const custodyChoice = appConfig.application?.walletCustodyMode === "USER_CHOICE";
|
|
4817
|
+
const appChains = appConfig.application?.chains;
|
|
4818
|
+
const verifyAttempt = react.useRef(null);
|
|
4819
|
+
const countries = react.useMemo(() => core.rampCountries(routes), [routes]);
|
|
4820
|
+
const fiats = countries.find((c) => c.country === country)?.fiats ?? [];
|
|
4821
|
+
const fiat = fiats.find((f) => fiatKey(f) === fiatChoice) ?? fiats[0] ?? null;
|
|
4822
|
+
const assets = react.useMemo(() => {
|
|
4823
|
+
const seen = /* @__PURE__ */ new Map();
|
|
4824
|
+
for (const route of routes)
|
|
4825
|
+
if (fiat && route.fiat.country === country && fiatKey(route.fiat) === fiatKey(fiat))
|
|
4826
|
+
seen.set(assetKey3(route.asset), route.asset);
|
|
4827
|
+
return [...seen.values()];
|
|
4828
|
+
}, [routes, country, fiat]);
|
|
4829
|
+
const asset = assets.find((a) => assetKey3(a) === assetChoice) ?? assets[0] ?? null;
|
|
4830
|
+
const fields = selected ? core.rampQuoteFields(selected) : [];
|
|
4831
|
+
const sellAvailable = useWalletAvailable(
|
|
4832
|
+
direction === "OFFRAMP" && asset ? { chain: asset.chain, code: asset.code, issuer: asset.identifier } : null
|
|
4833
|
+
);
|
|
4952
4834
|
react.useEffect(() => {
|
|
4953
|
-
if (
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
const savedId = [new URLSearchParams(window.location.search).get("rampTxId"), readRampStorage(storageKey)].find(
|
|
4958
|
-
(id) => id && !hidden.includes(id)
|
|
4959
|
-
);
|
|
4960
|
-
if (!savedId) return;
|
|
4961
|
-
let active = true;
|
|
4962
|
-
void client.getRampTransaction(savedId).then(async (result) => {
|
|
4963
|
-
if (!active || result.transactionVersion === void 0) return;
|
|
4964
|
-
setDirection(result.direction);
|
|
4965
|
-
await applyResult(result);
|
|
4966
|
-
}).catch(() => {
|
|
4967
|
-
if (active)
|
|
4968
|
-
setErrorMsg("Could not restore the saved ramp. Retry opening the modal; do not create a replacement order.");
|
|
4969
|
-
});
|
|
4970
|
-
return () => {
|
|
4971
|
-
active = false;
|
|
4972
|
-
};
|
|
4973
|
-
}, [client, storageKey, walletAddress]);
|
|
4974
|
-
async function resumeSavedRamp(id) {
|
|
4975
|
-
if (completionLocked.current) return;
|
|
4976
|
-
setIsLoading(true);
|
|
4977
|
-
setErrorMsg(null);
|
|
4835
|
+
if (direction === "OFFRAMP") void refreshWalletBalance();
|
|
4836
|
+
}, [direction, refreshWalletBalance]);
|
|
4837
|
+
async function loadRoutes(next) {
|
|
4838
|
+
setRoutesLoading(true);
|
|
4978
4839
|
try {
|
|
4979
|
-
const
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4840
|
+
const { routes: found } = await client.getRampRoutes(next);
|
|
4841
|
+
setRoutes(found);
|
|
4842
|
+
const first = core.rampCountries(found)[0]?.country ?? "";
|
|
4843
|
+
setCountry((current) => found.some((r) => r.fiat.country === current) ? current : first);
|
|
4983
4844
|
} catch (error) {
|
|
4984
|
-
|
|
4845
|
+
setRoutes([]);
|
|
4846
|
+
setErrorMsg(rampErrorMessage(error, "Could not load the ramp routes."));
|
|
4985
4847
|
} finally {
|
|
4986
|
-
|
|
4848
|
+
setRoutesLoading(false);
|
|
4987
4849
|
}
|
|
4988
4850
|
}
|
|
4989
|
-
|
|
4990
|
-
directionRef.current = direction;
|
|
4991
|
-
function applySettlement(tx) {
|
|
4992
|
-
if (tx.stellarTxHash) setStellarTxHash(tx.stellarTxHash);
|
|
4993
|
-
if (tx.txHash) setTxHash(tx.txHash);
|
|
4994
|
-
if (tx.chain) setTxChain(tx.chain);
|
|
4995
|
-
setFundsInTransit(tx.fundsInTransit === true);
|
|
4996
|
-
}
|
|
4997
|
-
async function handleRetryTransit() {
|
|
4998
|
-
if (!txId || retrying) return;
|
|
4999
|
-
setRetrying(true);
|
|
5000
|
-
setErrorMsg(null);
|
|
4851
|
+
async function loadPendingOrders() {
|
|
5001
4852
|
try {
|
|
5002
|
-
const
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
setErrorMsg(e instanceof Error && e.message ? e.message : "Could not retry the transfer. Try again in a moment.");
|
|
5007
|
-
} finally {
|
|
5008
|
-
setRetrying(false);
|
|
4853
|
+
const page = await client.listRampOrders({ open: "true", limit: 5 });
|
|
4854
|
+
setPendingOrders(page.orders);
|
|
4855
|
+
} catch {
|
|
4856
|
+
setPendingOrders([]);
|
|
5009
4857
|
}
|
|
5010
4858
|
}
|
|
5011
|
-
const workflowTerminal = !!workflow && ["completed", "failed", "refunded"].includes(workflow.lifecycleState ?? workflow.status);
|
|
5012
4859
|
react.useEffect(() => {
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
let active = true;
|
|
5016
|
-
const id = setInterval(async () => {
|
|
5017
|
-
try {
|
|
5018
|
-
const tx = await client.getRampTransaction(txId);
|
|
5019
|
-
if (!active) return;
|
|
5020
|
-
if (tx.transactionVersion !== void 0 && !acceptWorkflow(tx)) return;
|
|
5021
|
-
setTxStatus(tx.status);
|
|
5022
|
-
applySettlement(tx);
|
|
5023
|
-
const pending = "pendingSignature" in tx ? tx.pendingSignature : void 0;
|
|
5024
|
-
if (pending) setLegacySignature(pending);
|
|
5025
|
-
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
5026
|
-
if (tx.depositInstructions) setDepositInstructions(tx.depositInstructions);
|
|
5027
|
-
if (TERMINAL.includes(tx.status)) clearInterval(id);
|
|
5028
|
-
} catch {
|
|
5029
|
-
}
|
|
5030
|
-
}, 5e3);
|
|
5031
|
-
return () => {
|
|
5032
|
-
active = false;
|
|
5033
|
-
clearInterval(id);
|
|
5034
|
-
};
|
|
5035
|
-
}, [step, txId, txStatus, workflowTerminal, client]);
|
|
4860
|
+
void loadRoutes(direction);
|
|
4861
|
+
}, [client, direction]);
|
|
5036
4862
|
react.useEffect(() => {
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
const check = async () => {
|
|
5041
|
-
try {
|
|
5042
|
-
const { hasApproved } = await client.getRampKycStatus();
|
|
5043
|
-
if (active && hasApproved) setKycApproved(true);
|
|
5044
|
-
} catch {
|
|
5045
|
-
}
|
|
5046
|
-
};
|
|
5047
|
-
void check();
|
|
5048
|
-
const id = setInterval(check, 1e4);
|
|
5049
|
-
return () => {
|
|
5050
|
-
active = false;
|
|
5051
|
-
clearInterval(id);
|
|
5052
|
-
};
|
|
5053
|
-
}, [step, kycPending, kycApproved, onboardingStatus, workflow, client, provider]);
|
|
5054
|
-
async function loadCountries(resetSelection) {
|
|
5055
|
-
setCountriesLoading(true);
|
|
5056
|
-
try {
|
|
5057
|
-
const { countries: list } = await client.getRampCountries();
|
|
5058
|
-
setCountries(list);
|
|
5059
|
-
const available = core.mergeRampCountries(list, routes);
|
|
5060
|
-
const first = available[0];
|
|
5061
|
-
const stillValid = available.some((c) => c.code === country);
|
|
5062
|
-
if (first && (resetSelection || !stillValid)) {
|
|
5063
|
-
setCountry(first.code);
|
|
5064
|
-
if (first.currency) setCurrency(first.currency);
|
|
5065
|
-
}
|
|
5066
|
-
} catch {
|
|
5067
|
-
setCountries([]);
|
|
5068
|
-
} finally {
|
|
5069
|
-
setCountriesLoading(false);
|
|
5070
|
-
}
|
|
5071
|
-
}
|
|
4863
|
+
void loadPendingOrders();
|
|
4864
|
+
}, [client]);
|
|
4865
|
+
const orderId = order?.id ?? null;
|
|
5072
4866
|
react.useEffect(() => {
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
direction
|
|
5094
|
-
},
|
|
5095
|
-
routes
|
|
5096
|
-
);
|
|
5097
|
-
setQuotes(result.quotes ?? []);
|
|
5098
|
-
setRequirementsRequired(result.requirementsRequired ?? []);
|
|
5099
|
-
} else if (step === "status" && txId) {
|
|
5100
|
-
const tx = await client.getRampTransaction(txId);
|
|
5101
|
-
if (tx.transactionVersion !== void 0 && !acceptWorkflow(tx)) return;
|
|
5102
|
-
setTxStatus(tx.status);
|
|
5103
|
-
applySettlement(tx);
|
|
5104
|
-
if (tx.kycUrl) setKycUrl(tx.kycUrl);
|
|
5105
|
-
if (tx.depositInstructions) setDepositInstructions(tx.depositInstructions);
|
|
5106
|
-
}
|
|
5107
|
-
} catch {
|
|
5108
|
-
} finally {
|
|
5109
|
-
setRefreshing(false);
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
function resetToInput({ keepMessage = false } = {}) {
|
|
5113
|
-
writeRampStorage(storageKey, null);
|
|
5114
|
-
writeRampStorage(`${storageKey}:selection`, "1");
|
|
5115
|
-
setStep("input");
|
|
5116
|
-
setQuotes([]);
|
|
5117
|
-
setRequirementsRequired([]);
|
|
5118
|
-
setSelectedQuote(null);
|
|
5119
|
-
setFieldValues({});
|
|
5120
|
-
setWorkflow(null);
|
|
5121
|
-
workflowRef.current = null;
|
|
5122
|
-
setLegacySignature(void 0);
|
|
5123
|
-
setTxId(null);
|
|
5124
|
-
setProvider("");
|
|
5125
|
-
setKycUrl(null);
|
|
5126
|
-
setTosUrl(null);
|
|
5127
|
-
setTxStatus(null);
|
|
5128
|
-
setStellarTxHash(null);
|
|
5129
|
-
setTxHash(null);
|
|
5130
|
-
setTxChain(null);
|
|
5131
|
-
setFundsInTransit(false);
|
|
5132
|
-
setDepositInstructions(null);
|
|
5133
|
-
setKycPending(false);
|
|
5134
|
-
setKycApproved(false);
|
|
5135
|
-
setNoticeMsg(null);
|
|
5136
|
-
if (!keepMessage) setErrorMsg(null);
|
|
5137
|
-
}
|
|
5138
|
-
function dismissSavedRamp(id) {
|
|
5139
|
-
if (completionLocked.current) return;
|
|
5140
|
-
const pending = savedRampsOf(storageKey).filter((ramp) => ramp.txId !== id);
|
|
5141
|
-
writeRampStorage(`${storageKey}:saved`, JSON.stringify(pending));
|
|
5142
|
-
writeRampStorage(`${storageKey}:hidden`, JSON.stringify([.../* @__PURE__ */ new Set([...hiddenRampsOf(storageKey), id])]));
|
|
5143
|
-
if (readRampStorage(storageKey) === id) writeRampStorage(storageKey, null);
|
|
5144
|
-
setSavedRamps(pending);
|
|
5145
|
-
if (txId === id) resetToInput();
|
|
5146
|
-
setNoticeMsg(
|
|
5147
|
-
"Removed from this tab\u2019s pending list. The operation may still be active at the provider; no payment was cancelled or refunded."
|
|
5148
|
-
);
|
|
5149
|
-
}
|
|
5150
|
-
async function resumeWithSignature(id, ps) {
|
|
5151
|
-
const outcome = await client.signTx(ps.unsignedXdr, { skipSponsorship: ps.action === "sep10" });
|
|
5152
|
-
if (outcome.status === "cosign_pending") {
|
|
5153
|
-
setErrorMsg("Approve the signature on your device, then resume.");
|
|
5154
|
-
setStep("error");
|
|
4867
|
+
if (step !== "status" || !orderId) return;
|
|
4868
|
+
const controller = new AbortController();
|
|
4869
|
+
client.pollRampOrder(orderId, {
|
|
4870
|
+
signal: controller.signal,
|
|
4871
|
+
onUpdate: (next) => {
|
|
4872
|
+
setOrder(next);
|
|
4873
|
+
setPollTrouble(false);
|
|
4874
|
+
},
|
|
4875
|
+
onError: () => setPollTrouble(true)
|
|
4876
|
+
}).catch((error) => {
|
|
4877
|
+
if (!controller.signal.aborted) setErrorMsg(rampErrorMessage(error, "This operation could not be read."));
|
|
4878
|
+
});
|
|
4879
|
+
return () => controller.abort();
|
|
4880
|
+
}, [client, step, orderId, pollKey]);
|
|
4881
|
+
const awaitingPayment = step === "status" && order?.pendingAction?.kind === "FIAT_PAYMENT";
|
|
4882
|
+
react.useEffect(() => {
|
|
4883
|
+
if (paymentCheckUntil === null || !orderId) return;
|
|
4884
|
+
if (!awaitingPayment) {
|
|
4885
|
+
setPaymentCheckUntil(null);
|
|
4886
|
+
setPollKey((key) => key + 1);
|
|
5155
4887
|
return;
|
|
5156
4888
|
}
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
4889
|
+
const timer = setInterval(() => {
|
|
4890
|
+
if (Date.now() >= paymentCheckUntil) {
|
|
4891
|
+
setPaymentCheckUntil(null);
|
|
4892
|
+
return;
|
|
4893
|
+
}
|
|
4894
|
+
client.checkRampOrder(orderId).then(setOrder).catch(() => void 0);
|
|
4895
|
+
}, PAYMENT_CHECK_EVERY_MS);
|
|
4896
|
+
return () => clearInterval(timer);
|
|
4897
|
+
}, [client, orderId, awaitingPayment, paymentCheckUntil]);
|
|
4898
|
+
const approval = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.actionId : null;
|
|
4899
|
+
react.useEffect(() => {
|
|
4900
|
+
if (!approval || promptedApproval.current === approval) return;
|
|
4901
|
+
promptedApproval.current = approval;
|
|
4902
|
+
void client.cosign.pending().catch(() => void 0).then(() => openCosignModal());
|
|
4903
|
+
}, [approval, client, openCosignModal]);
|
|
4904
|
+
const nextApproval = step === "status" && order ? core.rampNextApproval(order) : null;
|
|
4905
|
+
react.useEffect(() => {
|
|
4906
|
+
setCosignNextStep(nextApproval);
|
|
4907
|
+
}, [nextApproval, setCosignNextStep]);
|
|
4908
|
+
react.useEffect(() => () => setCosignNextStep(null), [setCosignNextStep]);
|
|
4909
|
+
const resolvedRequest = cosign.lastResolved;
|
|
4910
|
+
react.useEffect(() => {
|
|
4911
|
+
if (!awaitingAccount || resolvedRequest?.id !== awaitingAccount.requestId) return;
|
|
4912
|
+
setAwaitingAccount(null);
|
|
4913
|
+
if (resolvedRequest.status !== "APPROVED") {
|
|
4914
|
+
setErrorMsg("The new account was not approved, so this route cannot start.");
|
|
5160
4915
|
return;
|
|
5161
4916
|
}
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
async function applyResult(result) {
|
|
5169
|
-
if ("transactionVersion" in result && result.transactionVersion !== void 0 && !acceptWorkflow(result)) return;
|
|
5170
|
-
setTxId(result.txId);
|
|
5171
|
-
setProvider(result.provider);
|
|
5172
|
-
setLegacySignature(result.pendingSignature);
|
|
5173
|
-
setKycUrl(result.kycUrl ?? null);
|
|
5174
|
-
setTosUrl(result.tosUrl ?? null);
|
|
5175
|
-
setOnboardingStatus(result.onboardingStatus);
|
|
5176
|
-
setKycPending(result.kycRequired === true);
|
|
5177
|
-
if (result.kycRequired) setKycApproved(false);
|
|
5178
|
-
setTxStatus(result.status);
|
|
5179
|
-
setStellarTxHash(result.stellarTxHash ?? null);
|
|
5180
|
-
setDepositInstructions(result.depositInstructions ?? null);
|
|
5181
|
-
setStep("status");
|
|
5182
|
-
}
|
|
5183
|
-
async function loadQuotes() {
|
|
5184
|
-
const result = await quoteRampOptions(
|
|
5185
|
-
client,
|
|
5186
|
-
{
|
|
5187
|
-
country,
|
|
5188
|
-
amount: Number(amount),
|
|
5189
|
-
amountExact: amount,
|
|
5190
|
-
currency,
|
|
5191
|
-
direction
|
|
5192
|
-
},
|
|
5193
|
-
routes
|
|
5194
|
-
);
|
|
5195
|
-
const list = result.quotes ?? [];
|
|
5196
|
-
const locked = result.requirementsRequired ?? [];
|
|
5197
|
-
if (list.length === 0 && locked.length === 0) {
|
|
5198
|
-
setErrorMsg(unavailableRampMessage(country, result.unavailable ?? []));
|
|
5199
|
-
setStep("error");
|
|
5200
|
-
return false;
|
|
5201
|
-
}
|
|
5202
|
-
setQuotes(list);
|
|
5203
|
-
setRequirementsRequired(locked);
|
|
5204
|
-
return true;
|
|
4917
|
+
void resumeRoute(awaitingAccount.routeKey);
|
|
4918
|
+
}, [awaitingAccount, resolvedRequest]);
|
|
4919
|
+
function handleDirectionChange(next) {
|
|
4920
|
+
setDirection(next);
|
|
4921
|
+
setErrorMsg(null);
|
|
4922
|
+
setAwaitingAccount(null);
|
|
5205
4923
|
}
|
|
5206
4924
|
async function handleFindRoute() {
|
|
4925
|
+
if (!fiat || !asset) return [];
|
|
4926
|
+
if (!DECIMAL.test(amount.trim()) || Number(amount) <= 0) {
|
|
4927
|
+
setErrorMsg("Enter an amount greater than zero.");
|
|
4928
|
+
return [];
|
|
4929
|
+
}
|
|
5207
4930
|
setStep("loading_quote");
|
|
5208
|
-
setIsLoading(true);
|
|
5209
4931
|
setErrorMsg(null);
|
|
4932
|
+
setSelected(null);
|
|
5210
4933
|
try {
|
|
5211
|
-
|
|
4934
|
+
const result = await client.quoteRamp({
|
|
4935
|
+
direction,
|
|
4936
|
+
fiat: { currency: fiat.currency, rail: fiat.rail, country: fiat.country },
|
|
4937
|
+
asset: { code: asset.code, identifier: asset.identifier, chain: asset.chain },
|
|
4938
|
+
amount: { value: amount.trim(), denomination: "in" }
|
|
4939
|
+
});
|
|
4940
|
+
setQuotes(result.quotes);
|
|
4941
|
+
setRejected(result.rejected);
|
|
5212
4942
|
setStep("select_route");
|
|
5213
|
-
|
|
5214
|
-
|
|
4943
|
+
return result.quotes;
|
|
4944
|
+
} catch (error) {
|
|
4945
|
+
if (core.isPollarApiError(error) && error.code === "SDK_RAMPS_NO_ROUTE") {
|
|
4946
|
+
setQuotes([]);
|
|
4947
|
+
setRejected(Array.isArray(error.body.rejected) ? error.body.rejected : []);
|
|
4948
|
+
setStep("select_route");
|
|
4949
|
+
return [];
|
|
4950
|
+
}
|
|
4951
|
+
setErrorMsg(rampErrorMessage(error, "Could not find a route. Please try again."));
|
|
5215
4952
|
setStep("error");
|
|
4953
|
+
return [];
|
|
4954
|
+
}
|
|
4955
|
+
}
|
|
4956
|
+
function handleVerifyRoute(requirement) {
|
|
4957
|
+
setErrorMsg(null);
|
|
4958
|
+
verifyAttempt.current = requirement;
|
|
4959
|
+
setVerifying(requirement);
|
|
4960
|
+
}
|
|
4961
|
+
function closeVerification() {
|
|
4962
|
+
verifyAttempt.current = null;
|
|
4963
|
+
setVerifying(null);
|
|
4964
|
+
}
|
|
4965
|
+
function verificationDone(requirement) {
|
|
4966
|
+
if (verifyAttempt.current !== requirement) return;
|
|
4967
|
+
closeVerification();
|
|
4968
|
+
void handleFindRoute();
|
|
4969
|
+
}
|
|
4970
|
+
async function handleTrustAsset(asset2) {
|
|
4971
|
+
if (trustingAsset) return;
|
|
4972
|
+
setTrustingAsset(`${asset2.code}:${asset2.issuer}`);
|
|
4973
|
+
setErrorMsg(null);
|
|
4974
|
+
try {
|
|
4975
|
+
const outcome = await client.setTrustline(asset2);
|
|
4976
|
+
if (outcome.status === "error") {
|
|
4977
|
+
setErrorMsg(core.rampTrustlineErrorText(outcome, asset2.code));
|
|
4978
|
+
return;
|
|
4979
|
+
}
|
|
4980
|
+
if (outcome.status === "cosign_pending") {
|
|
4981
|
+
setErrorMsg(`Approve the ${asset2.code} trustline, then refresh the routes.`);
|
|
4982
|
+
openCosignModal();
|
|
4983
|
+
return;
|
|
4984
|
+
}
|
|
4985
|
+
await client.refreshAssets().catch(() => {
|
|
4986
|
+
});
|
|
4987
|
+
await handleFindRoute();
|
|
4988
|
+
} catch (error) {
|
|
4989
|
+
setErrorMsg(rampErrorMessage(error, `Could not add the ${asset2.code} trustline. Please try again.`));
|
|
5216
4990
|
} finally {
|
|
5217
|
-
|
|
4991
|
+
setTrustingAsset(null);
|
|
5218
4992
|
}
|
|
5219
4993
|
}
|
|
5220
|
-
function
|
|
5221
|
-
|
|
4994
|
+
async function handleWalletStep(walletStep, index, custody) {
|
|
4995
|
+
if (walletBusy !== null) return;
|
|
4996
|
+
setWalletBusy(index);
|
|
5222
4997
|
setErrorMsg(null);
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
4998
|
+
try {
|
|
4999
|
+
const { recoveryRequired } = await client.runRampWalletStep(walletStep, custody);
|
|
5000
|
+
if (recoveryRequired) {
|
|
5001
|
+
setErrorMsg("Add a way to recover your wallet, then find the route again.");
|
|
5002
|
+
openRecoveryModal();
|
|
5003
|
+
return;
|
|
5004
|
+
}
|
|
5005
|
+
await handleFindRoute();
|
|
5006
|
+
} catch (error) {
|
|
5007
|
+
const code = core.isPollarApiError(error) ? error.code : null;
|
|
5008
|
+
if (code === "SDK_RAMPS_WALLET_NOT_READY") {
|
|
5009
|
+
setErrorMsg("Approve the new account, then find the route again.");
|
|
5010
|
+
openCosignModal();
|
|
5011
|
+
return;
|
|
5012
|
+
}
|
|
5013
|
+
setErrorMsg(
|
|
5014
|
+
code === "SDK_WALLET_PROVISIONING_DISABLED" ? "This app does not create wallets." : rampErrorMessage(error, "Could not prepare the wallet. Please try again.")
|
|
5015
|
+
);
|
|
5016
|
+
} finally {
|
|
5017
|
+
setWalletBusy(null);
|
|
5228
5018
|
}
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5019
|
+
}
|
|
5020
|
+
async function resumeRoute(key) {
|
|
5021
|
+
const same = (await handleFindRoute()).find((q) => routeKey(q) === key);
|
|
5022
|
+
if (same) handleSelectQuote(same, true);
|
|
5023
|
+
else setErrorMsg("That route is no longer available. Pick another one.");
|
|
5024
|
+
}
|
|
5025
|
+
function handleSelectQuote(quote, fresh = false) {
|
|
5026
|
+
if (!fresh && Date.parse(quote.expiresAt) <= Date.now()) {
|
|
5027
|
+
void resumeRoute(routeKey(quote));
|
|
5233
5028
|
return;
|
|
5234
5029
|
}
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
if (
|
|
5030
|
+
setSelected(quote);
|
|
5031
|
+
setErrorMsg(null);
|
|
5032
|
+
const missing = core.rampQuoteFields(quote).some((f) => !f.optional && !(fieldValues[f.key] ?? "").trim());
|
|
5033
|
+
if (missing) setStep("contact");
|
|
5034
|
+
else void startOrder(quote, fresh);
|
|
5239
5035
|
}
|
|
5240
|
-
async function
|
|
5036
|
+
async function startOrder(quote, fresh = false) {
|
|
5241
5037
|
setIsLoading(true);
|
|
5038
|
+
setStartingQuoteId(quote.quoteId);
|
|
5242
5039
|
setErrorMsg(null);
|
|
5040
|
+
setAwaitingAccount(null);
|
|
5243
5041
|
try {
|
|
5244
|
-
const
|
|
5042
|
+
const payee = Object.fromEntries(
|
|
5043
|
+
core.rampQuoteFields(quote).map((f) => [f.key, (fieldValues[f.key] ?? "").trim()]).filter(([, value]) => value)
|
|
5044
|
+
);
|
|
5045
|
+
const created = await client.createRampOrder({
|
|
5245
5046
|
quoteId: quote.quoteId,
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
else extraFields[f.key] = val;
|
|
5047
|
+
...Object.keys(payee).length ? { payee } : {}
|
|
5048
|
+
});
|
|
5049
|
+
setOrder(created);
|
|
5050
|
+
setStep("status");
|
|
5051
|
+
} catch (error) {
|
|
5052
|
+
if (core.isPollarApiError(error) && error.code === "SDK_RAMPS_WALLET_NOT_READY") {
|
|
5053
|
+
const pending = await client.cosign.pending().catch(() => []);
|
|
5054
|
+
const request = pending.find((r) => r.intent === "add_accounts");
|
|
5055
|
+
if (request) setAwaitingAccount({ routeKey: routeKey(quote), requestId: request.id });
|
|
5056
|
+
else setErrorMsg(rampErrorMessage(error, "Could not start the operation. Please try again."));
|
|
5057
|
+
openCosignModal();
|
|
5058
|
+
setStep("select_route");
|
|
5059
|
+
return;
|
|
5260
5060
|
}
|
|
5261
|
-
if (
|
|
5262
|
-
|
|
5263
|
-
requiredFieldsOf(quote).map((field) => [field.key, (fieldValues[field.key] ?? "").trim()]).filter(([, value]) => value)
|
|
5264
|
-
);
|
|
5265
|
-
else if (Object.keys(extraFields).length > 0) body.fields = extraFields;
|
|
5266
|
-
const onrampBody = {
|
|
5267
|
-
quoteId: body.quoteId,
|
|
5268
|
-
amount: body.amount,
|
|
5269
|
-
currency: body.currency,
|
|
5270
|
-
country: body.country,
|
|
5271
|
-
...body.amountExact !== void 0 ? { amountExact: body.amountExact } : {},
|
|
5272
|
-
...body.walletAddress !== void 0 ? { walletAddress: body.walletAddress } : {},
|
|
5273
|
-
...body.email !== void 0 ? { email: body.email } : {},
|
|
5274
|
-
...body.fullName !== void 0 ? { fullName: body.fullName } : {},
|
|
5275
|
-
...body.fields !== void 0 ? { fields: body.fields } : {}
|
|
5276
|
-
};
|
|
5277
|
-
const result = direction === "onramp" ? await client.createOnRamp(onrampBody) : await client.createOffRamp(body);
|
|
5278
|
-
await applyResult(result);
|
|
5279
|
-
} catch (e) {
|
|
5280
|
-
const requirement = requiredRampKyc(e);
|
|
5281
|
-
if (requirement) {
|
|
5282
|
-
setStep(requiredFieldsOf(quote).length ? "contact" : "select_route");
|
|
5283
|
-
setErrorMsg(
|
|
5284
|
-
requirement.type === "KYC" ? "Identity verification is required before continuing." : "A few more details are required before continuing."
|
|
5285
|
-
);
|
|
5286
|
-
kycAttempt.current = requirement;
|
|
5287
|
-
setPendingKyc(requirement);
|
|
5061
|
+
if (core.isPollarApiError(error) && error.code === "SDK_RAMPS_QUOTE_EXPIRED" && !fresh) {
|
|
5062
|
+
void resumeRoute(routeKey(quote));
|
|
5288
5063
|
return;
|
|
5289
5064
|
}
|
|
5290
|
-
setErrorMsg(rampErrorMessage(
|
|
5291
|
-
setStep("
|
|
5065
|
+
setErrorMsg(rampErrorMessage(error, "Could not start the operation. Please try again."));
|
|
5066
|
+
if (core.isPollarApiError(error) && error.code === "VALIDATION_ERROR" && core.rampQuoteFields(quote).length) setStep("contact");
|
|
5067
|
+
else setStep("select_route");
|
|
5292
5068
|
} finally {
|
|
5293
5069
|
setIsLoading(false);
|
|
5070
|
+
setStartingQuoteId(null);
|
|
5294
5071
|
}
|
|
5295
5072
|
}
|
|
5296
|
-
async function
|
|
5297
|
-
|
|
5073
|
+
async function handleSign() {
|
|
5074
|
+
const action = order?.pendingAction;
|
|
5075
|
+
if (!order || action?.kind !== "SIGNATURE" || signing) return;
|
|
5076
|
+
setSigning(true);
|
|
5077
|
+
setErrorMsg(null);
|
|
5078
|
+
try {
|
|
5079
|
+
setOrder(await signLegWithWallet(client, order.id, action.actionId));
|
|
5080
|
+
} catch (error) {
|
|
5081
|
+
setErrorMsg(rampErrorMessage(error, error instanceof Error && error.message ? error.message : "Signing was cancelled."));
|
|
5082
|
+
setOrder(await client.getRampOrder(order.id).catch(() => order));
|
|
5083
|
+
} finally {
|
|
5084
|
+
setSigning(false);
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5087
|
+
async function handleResumeOrder(id) {
|
|
5298
5088
|
setIsLoading(true);
|
|
5299
5089
|
setErrorMsg(null);
|
|
5300
|
-
setSelectedQuote(null);
|
|
5301
5090
|
try {
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
);
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
setErrorMsg(rampErrorMessage(e, "Failed to fetch quotes."));
|
|
5309
|
-
setStep("error");
|
|
5091
|
+
const found = await client.getRampOrder(id);
|
|
5092
|
+
setDirection(found.direction);
|
|
5093
|
+
setOrder(found);
|
|
5094
|
+
setStep("status");
|
|
5095
|
+
} catch (error) {
|
|
5096
|
+
setErrorMsg(rampErrorMessage(error, "Could not resume the operation."));
|
|
5310
5097
|
} finally {
|
|
5311
5098
|
setIsLoading(false);
|
|
5312
5099
|
}
|
|
5313
5100
|
}
|
|
5314
|
-
function
|
|
5315
|
-
|
|
5101
|
+
function handleNewOrder() {
|
|
5102
|
+
setAwaitingAccount(null);
|
|
5103
|
+
setOrder(null);
|
|
5104
|
+
setSelected(null);
|
|
5105
|
+
setQuotes([]);
|
|
5106
|
+
setRejected([]);
|
|
5316
5107
|
setErrorMsg(null);
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
setPendingKyc(attempt);
|
|
5108
|
+
setStep("input");
|
|
5109
|
+
void loadPendingOrders();
|
|
5320
5110
|
}
|
|
5321
|
-
function
|
|
5322
|
-
|
|
5111
|
+
function handleBack() {
|
|
5112
|
+
setErrorMsg(null);
|
|
5113
|
+
setAwaitingAccount(null);
|
|
5114
|
+
setStep(step === "contact" ? "select_route" : "input");
|
|
5323
5115
|
}
|
|
5324
|
-
function
|
|
5325
|
-
|
|
5116
|
+
function handleStepSelect(target) {
|
|
5117
|
+
setErrorMsg(null);
|
|
5118
|
+
setAwaitingAccount(null);
|
|
5119
|
+
setStep(target === "Route" ? "select_route" : "input");
|
|
5326
5120
|
}
|
|
5327
|
-
async function
|
|
5328
|
-
if (!
|
|
5329
|
-
completionLocked.current = true;
|
|
5330
|
-
setCompleting(true);
|
|
5121
|
+
async function handleCheckPayment() {
|
|
5122
|
+
if (!order || paymentCheckUntil !== null) return;
|
|
5331
5123
|
setErrorMsg(null);
|
|
5124
|
+
setPaymentCheckUntil(Date.now() + PAYMENT_CHECK_WINDOW_MS);
|
|
5332
5125
|
try {
|
|
5333
|
-
await
|
|
5334
|
-
} catch (
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
} finally {
|
|
5338
|
-
completionLocked.current = false;
|
|
5339
|
-
setCompleting(false);
|
|
5126
|
+
setOrder(await client.checkRampOrder(order.id));
|
|
5127
|
+
} catch (error) {
|
|
5128
|
+
setPaymentCheckUntil(null);
|
|
5129
|
+
setErrorMsg(rampErrorMessage(error, "Could not check the payment. Please try again."));
|
|
5340
5130
|
}
|
|
5341
5131
|
}
|
|
5342
|
-
async function
|
|
5343
|
-
if (!
|
|
5344
|
-
|
|
5345
|
-
setCompleting(true);
|
|
5132
|
+
async function handleRetryOrder() {
|
|
5133
|
+
if (!order || retrying) return;
|
|
5134
|
+
setRetrying(true);
|
|
5346
5135
|
setErrorMsg(null);
|
|
5347
5136
|
try {
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
}
|
|
5353
|
-
setTxStatus(result.status);
|
|
5354
|
-
setStellarTxHash(result.stellarTxHash ?? null);
|
|
5355
|
-
} catch (e) {
|
|
5356
|
-
const msg = e instanceof Error ? e.message : "";
|
|
5357
|
-
setErrorMsg(
|
|
5358
|
-
msg.includes("KYC") ? "Finish KYC at the provider first, then try again." : msg || "Failed to complete the withdrawal."
|
|
5359
|
-
);
|
|
5137
|
+
setOrder(await client.retryRampOrder(order.id));
|
|
5138
|
+
setPollKey((key) => key + 1);
|
|
5139
|
+
} catch (error) {
|
|
5140
|
+
setErrorMsg(rampErrorMessage(error, "Could not try again. Please try again."));
|
|
5360
5141
|
} finally {
|
|
5361
|
-
|
|
5362
|
-
setCompleting(false);
|
|
5142
|
+
setRetrying(false);
|
|
5363
5143
|
}
|
|
5364
5144
|
}
|
|
5365
|
-
const
|
|
5366
|
-
const
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
void requoteAfterKyc("FORM");
|
|
5384
|
-
}
|
|
5145
|
+
const heldForRecovery = step === "status" && order?.failure?.resolutionAction === "set_up_recovery";
|
|
5146
|
+
const wasRecoveryLocked = react.useRef(recoveryLocked);
|
|
5147
|
+
react.useEffect(() => {
|
|
5148
|
+
if (heldForRecovery && wasRecoveryLocked.current && !recoveryLocked && recovery) void handleRetryOrder();
|
|
5149
|
+
wasRecoveryLocked.current = recoveryLocked;
|
|
5150
|
+
}, [heldForRecovery, recoveryLocked, recovery]);
|
|
5151
|
+
async function handleRefresh() {
|
|
5152
|
+
if (refreshing) return;
|
|
5153
|
+
setRefreshing(true);
|
|
5154
|
+
try {
|
|
5155
|
+
if (step === "status" && order) {
|
|
5156
|
+
setOrder(await client.getRampOrder(order.id));
|
|
5157
|
+
setPollKey((key) => key + 1);
|
|
5158
|
+
} else if (step === "select_route") await handleFindRoute();
|
|
5159
|
+
else {
|
|
5160
|
+
await loadRoutes(direction);
|
|
5161
|
+
await loadPendingOrders();
|
|
5162
|
+
if (direction === "OFFRAMP") await refreshWalletBalance();
|
|
5385
5163
|
}
|
|
5386
|
-
)
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
setPendingKyc(null);
|
|
5392
|
-
};
|
|
5393
|
-
const done = () => {
|
|
5394
|
-
if (kycAttempt.current !== pendingKyc) return;
|
|
5395
|
-
close();
|
|
5396
|
-
void requoteAfterKyc(pendingKyc.type);
|
|
5397
|
-
};
|
|
5398
|
-
const progress = pendingKyc.progress ? { progress: pendingKyc.progress } : {};
|
|
5399
|
-
return pendingKyc.type === "REGISTRY_CHECK" ? /* @__PURE__ */ jsxRuntime.jsx(RegistryCheckModal, { optionId: pendingKyc.optionId, ...progress, onClose: close, onApproved: done }) : /* @__PURE__ */ jsxRuntime.jsx(ProviderRegistrationModal, { corridorId: pendingKyc.corridorId, ...progress, onClose: close, onRegistered: done });
|
|
5164
|
+
} catch (error) {
|
|
5165
|
+
setErrorMsg(rampErrorMessage(error, "Could not refresh."));
|
|
5166
|
+
} finally {
|
|
5167
|
+
setRefreshing(false);
|
|
5168
|
+
}
|
|
5400
5169
|
}
|
|
5401
|
-
|
|
5170
|
+
const flowSteps = fields.length || quotes.some((q) => core.rampQuoteFields(q).length) ? ["Amount", "Route", "Details", "Complete"] : ["Amount", "Route", "Complete"];
|
|
5171
|
+
const stepLabel = {
|
|
5172
|
+
input: "Amount",
|
|
5173
|
+
loading_quote: "Amount",
|
|
5174
|
+
select_route: "Route",
|
|
5175
|
+
contact: "Details",
|
|
5176
|
+
status: "Complete"
|
|
5177
|
+
};
|
|
5178
|
+
const label = stepLabel[step];
|
|
5179
|
+
if (verifying) {
|
|
5180
|
+
const progress = { progress: { position: verifying.completed + 1, total: verifying.total } };
|
|
5181
|
+
const done = () => verificationDone(verifying);
|
|
5182
|
+
if (verifying.type === "FORM")
|
|
5183
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RequirementFormModal, { formId: verifying.optionId, ...progress, onClose: closeVerification, onSubmitted: done });
|
|
5184
|
+
if (verifying.type === "REGISTRY_CHECK")
|
|
5185
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RegistryCheckModal, { optionId: verifying.optionId, ...progress, onClose: closeVerification, onApproved: done });
|
|
5186
|
+
if (verifying.type === "PROVIDER_REGISTRATION")
|
|
5187
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5188
|
+
ProviderRegistrationModal,
|
|
5189
|
+
{
|
|
5190
|
+
corridorId: verifying.corridorId,
|
|
5191
|
+
...progress,
|
|
5192
|
+
onClose: closeVerification,
|
|
5193
|
+
onRegistered: done
|
|
5194
|
+
}
|
|
5195
|
+
);
|
|
5402
5196
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5403
5197
|
KycModal,
|
|
5404
5198
|
{
|
|
5405
5199
|
country,
|
|
5406
|
-
corridorId:
|
|
5407
|
-
providerId:
|
|
5408
|
-
onClose:
|
|
5409
|
-
|
|
5410
|
-
setPendingKyc(null);
|
|
5411
|
-
},
|
|
5412
|
-
onApproved: () => {
|
|
5413
|
-
if (kycAttempt.current !== pendingKyc) return;
|
|
5414
|
-
kycAttempt.current = null;
|
|
5415
|
-
setPendingKyc(null);
|
|
5416
|
-
void requoteAfterKyc();
|
|
5417
|
-
}
|
|
5200
|
+
corridorId: verifying.corridorId,
|
|
5201
|
+
providerId: verifying.optionId,
|
|
5202
|
+
onClose: closeVerification,
|
|
5203
|
+
onApproved: done
|
|
5418
5204
|
}
|
|
5419
5205
|
);
|
|
5420
5206
|
}
|
|
5421
5207
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-overlay", style: overlayStyle, onClick: onClose, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5422
5208
|
RampWidgetTemplate,
|
|
5423
5209
|
{
|
|
5424
|
-
workflowContent: workflow ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5425
|
-
RampWorkflow,
|
|
5426
|
-
{
|
|
5427
|
-
client,
|
|
5428
|
-
snapshot: workflow,
|
|
5429
|
-
onBusyChange: (busy) => {
|
|
5430
|
-
completionLocked.current = busy;
|
|
5431
|
-
setCompleting(busy);
|
|
5432
|
-
},
|
|
5433
|
-
onChange: (next) => {
|
|
5434
|
-
if (acceptWorkflow(next)) setTxStatus(next.status);
|
|
5435
|
-
}
|
|
5436
|
-
}
|
|
5437
|
-
) : legacySignature && step === "status" && txStatus !== "completed" && txStatus !== "failed" ? /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: completing, onClick: () => void handleLegacySignature(), children: "Authorize wallet request" }) : void 0,
|
|
5438
5210
|
theme,
|
|
5439
5211
|
accentColor,
|
|
5440
|
-
styleOverrides,
|
|
5212
|
+
...styleOverrides ? { styleOverrides } : {},
|
|
5213
|
+
network,
|
|
5441
5214
|
step,
|
|
5442
5215
|
flowSteps,
|
|
5443
|
-
flowStepIndex,
|
|
5444
|
-
startingQuoteId: isLoading && selectedQuote ? selectedQuote.quoteId : null,
|
|
5216
|
+
flowStepIndex: label ? flowSteps.indexOf(label) : -1,
|
|
5445
5217
|
direction,
|
|
5446
|
-
|
|
5447
|
-
currency,
|
|
5448
|
-
country,
|
|
5449
|
-
requiredFields: selectedQuote ? requiredFieldsOf(selectedQuote) : [],
|
|
5450
|
-
fieldValues,
|
|
5218
|
+
routesLoading,
|
|
5451
5219
|
countries,
|
|
5452
|
-
|
|
5453
|
-
|
|
5220
|
+
country,
|
|
5221
|
+
fiats,
|
|
5222
|
+
fiat,
|
|
5223
|
+
assets,
|
|
5224
|
+
asset,
|
|
5225
|
+
amount,
|
|
5226
|
+
sellAvailable,
|
|
5454
5227
|
quotes,
|
|
5455
|
-
|
|
5228
|
+
rejected,
|
|
5229
|
+
startingQuoteId,
|
|
5230
|
+
fields,
|
|
5231
|
+
fieldValues,
|
|
5232
|
+
order,
|
|
5233
|
+
pendingOrders,
|
|
5456
5234
|
isLoading,
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
kycUrl,
|
|
5460
|
-
tosUrl,
|
|
5461
|
-
kycBlocking,
|
|
5462
|
-
onboardingStatus: onboardingStatus ?? null,
|
|
5463
|
-
kycJustApproved: kycPending && kycApproved,
|
|
5464
|
-
stellarTxHash,
|
|
5465
|
-
txHash,
|
|
5466
|
-
txChain,
|
|
5467
|
-
explorerUrl: explorerTxUrl2(txChain ?? "STELLAR", txHash ?? stellarTxHash, network),
|
|
5468
|
-
fundsInTransit,
|
|
5469
|
-
retrying,
|
|
5470
|
-
onRetryTransit: handleRetryTransit,
|
|
5471
|
-
depositInstructions,
|
|
5472
|
-
canComplete,
|
|
5473
|
-
completing,
|
|
5474
|
-
savedRamps,
|
|
5475
|
-
onResumeRamp: resumeSavedRamp,
|
|
5476
|
-
onDismissRamp: dismissSavedRamp,
|
|
5477
|
-
onDismissCurrentRamp: workflow ? () => dismissSavedRamp(workflow.txId) : void 0,
|
|
5478
|
-
onExploreRoutes: workflow ? () => {
|
|
5479
|
-
if (!completionLocked.current) resetToInput();
|
|
5480
|
-
} : void 0,
|
|
5235
|
+
refreshing,
|
|
5236
|
+
signing,
|
|
5481
5237
|
errorMsg,
|
|
5482
|
-
|
|
5483
|
-
onDirectionChange:
|
|
5484
|
-
|
|
5238
|
+
notice: awaitingAccount ? "Approve the new account on your device. The order starts once it is approved." : null,
|
|
5239
|
+
onDirectionChange: handleDirectionChange,
|
|
5240
|
+
onCountryChange: (next) => {
|
|
5241
|
+
setCountry(next);
|
|
5242
|
+
setFiatChoice("");
|
|
5243
|
+
setAssetChoice("");
|
|
5244
|
+
},
|
|
5245
|
+
onFiatChange: (key) => {
|
|
5246
|
+
setFiatChoice(key);
|
|
5247
|
+
setAssetChoice("");
|
|
5485
5248
|
},
|
|
5486
|
-
|
|
5487
|
-
|
|
5249
|
+
onAssetChange: setAssetChoice,
|
|
5250
|
+
onAmountChange: (value) => {
|
|
5251
|
+
setAmount(value);
|
|
5488
5252
|
setErrorMsg(null);
|
|
5489
5253
|
},
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
onFindRoute: handleFindRoute,
|
|
5493
|
-
onSelectQuote: handleSelectQuote,
|
|
5254
|
+
onFindRoute: () => void handleFindRoute(),
|
|
5255
|
+
onSelectQuote: (quote) => handleSelectQuote(quote),
|
|
5494
5256
|
onVerifyRoute: handleVerifyRoute,
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5257
|
+
trustingAsset,
|
|
5258
|
+
onTrustAsset: (asset2) => void handleTrustAsset(asset2),
|
|
5259
|
+
walletBusy,
|
|
5260
|
+
custodyChoice,
|
|
5261
|
+
onWalletStep: (walletStep, index, custody) => void handleWalletStep(walletStep, index, custody),
|
|
5262
|
+
noChains: Array.isArray(appChains) && appChains.length === 0,
|
|
5263
|
+
onFieldChange: (key, value) => setFieldValues((current) => ({ ...current, [key]: value })),
|
|
5264
|
+
onContactContinue: () => {
|
|
5265
|
+
if (selected) void startOrder(selected);
|
|
5266
|
+
},
|
|
5267
|
+
onSign: () => void handleSign(),
|
|
5268
|
+
onApprove: openCosignModal,
|
|
5269
|
+
retrying,
|
|
5270
|
+
onRetryOrder: () => void handleRetryOrder(),
|
|
5271
|
+
onSetUpRecovery: openRecoveryModal,
|
|
5272
|
+
recoveryMissing: recovery === null ? null : recoveryLocked,
|
|
5273
|
+
pollTrouble,
|
|
5274
|
+
checkingPayment: paymentCheckUntil !== null,
|
|
5275
|
+
onCheckPayment: () => void handleCheckPayment(),
|
|
5276
|
+
onResumeOrder: (id) => void handleResumeOrder(id),
|
|
5277
|
+
onNewOrder: handleNewOrder,
|
|
5278
|
+
onBack: handleBack,
|
|
5279
|
+
onStepSelect: handleStepSelect,
|
|
5280
|
+
onRetry: () => {
|
|
5281
|
+
setErrorMsg(null);
|
|
5282
|
+
setStep("input");
|
|
5283
|
+
},
|
|
5284
|
+
onRefresh: () => void handleRefresh(),
|
|
5502
5285
|
onClose
|
|
5503
5286
|
}
|
|
5504
5287
|
) });
|
|
@@ -5515,6 +5298,49 @@ function walletNotReadyReason(wallet, chain) {
|
|
|
5515
5298
|
}
|
|
5516
5299
|
return null;
|
|
5517
5300
|
}
|
|
5301
|
+
|
|
5302
|
+
// src/lib/qr-code/index.tsx
|
|
5303
|
+
var import_ErrorCorrectLevel = __toESM(require_ErrorCorrectLevel());
|
|
5304
|
+
var import_QRCode = __toESM(require_QRCode());
|
|
5305
|
+
var QRCodeSvg = react.forwardRef(function QRCodeSvg2({ bgColor, bgD, fgD, fgColor, size, title, viewBoxSize, xmlns = "http://www.w3.org/2000/svg", ...props }, ref) {
|
|
5306
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { ...props, height: size, ref, viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, width: size, xmlns, children: [
|
|
5307
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }) : null,
|
|
5308
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: bgD, fill: bgColor }),
|
|
5309
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: fgD, fill: fgColor })
|
|
5310
|
+
] });
|
|
5311
|
+
});
|
|
5312
|
+
QRCodeSvg.displayName = "QRCodeSvg";
|
|
5313
|
+
function bytesToBinaryString(bytes) {
|
|
5314
|
+
return bytes.map((b) => String.fromCharCode(b & 255)).join("");
|
|
5315
|
+
}
|
|
5316
|
+
function encodeStringToUtf8Bytes(input) {
|
|
5317
|
+
return Array.from(new TextEncoder().encode(input));
|
|
5318
|
+
}
|
|
5319
|
+
var QRCode = react.forwardRef(function QRCode2({ bgColor = "#FFFFFF", fgColor = "#000000", level = "L", size = 256, value, ...props }, ref) {
|
|
5320
|
+
const qrcode = new import_QRCode.default(-1, import_ErrorCorrectLevel.default[level]);
|
|
5321
|
+
const utf8Bytes = encodeStringToUtf8Bytes(value);
|
|
5322
|
+
const binaryString = bytesToBinaryString(utf8Bytes);
|
|
5323
|
+
qrcode.addData(binaryString, "Byte");
|
|
5324
|
+
qrcode.make();
|
|
5325
|
+
const cells = qrcode.modules;
|
|
5326
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5327
|
+
QRCodeSvg,
|
|
5328
|
+
{
|
|
5329
|
+
...props,
|
|
5330
|
+
bgColor,
|
|
5331
|
+
bgD: cells.map(
|
|
5332
|
+
(row, rowIndex) => row.map((cell, cellIndex) => !cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")
|
|
5333
|
+
).join(" "),
|
|
5334
|
+
fgColor,
|
|
5335
|
+
fgD: cells.map(
|
|
5336
|
+
(row, rowIndex) => row.map((cell, cellIndex) => cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")
|
|
5337
|
+
).join(" "),
|
|
5338
|
+
ref,
|
|
5339
|
+
size,
|
|
5340
|
+
viewBoxSize: cells.length
|
|
5341
|
+
}
|
|
5342
|
+
);
|
|
5343
|
+
});
|
|
5518
5344
|
function PollarLogo(props) {
|
|
5519
5345
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "45", height: "48", viewBox: "0 0 45 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
5520
5346
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5914,7 +5740,7 @@ function formatBalance(balance) {
|
|
|
5914
5740
|
const n = parseFloat(balance);
|
|
5915
5741
|
return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
5916
5742
|
}
|
|
5917
|
-
function
|
|
5743
|
+
function assetKey4(record) {
|
|
5918
5744
|
return `${record.code}:${record.issuer ?? "native"}`;
|
|
5919
5745
|
}
|
|
5920
5746
|
function chainLabel(chain) {
|
|
@@ -5985,8 +5811,8 @@ function SendAssetSelector({ assets, selectedAsset, loading, onSelectAsset }) {
|
|
|
5985
5811
|
}
|
|
5986
5812
|
),
|
|
5987
5813
|
open && assets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-asset-menu", role: "listbox", "aria-label": "Assets", children: assets.map((asset) => {
|
|
5988
|
-
const key =
|
|
5989
|
-
const selected = selectedAsset ? key ===
|
|
5814
|
+
const key = assetKey4(asset);
|
|
5815
|
+
const selected = selectedAsset ? key === assetKey4(selectedAsset) : false;
|
|
5990
5816
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5991
5817
|
"button",
|
|
5992
5818
|
{
|
|
@@ -6030,6 +5856,9 @@ function SendModalTemplate({
|
|
|
6030
5856
|
destination,
|
|
6031
5857
|
formError,
|
|
6032
5858
|
isLoadingBalance,
|
|
5859
|
+
isCheckingDestination = false,
|
|
5860
|
+
minStartingBalance = 1,
|
|
5861
|
+
onCreateAccount,
|
|
6033
5862
|
transaction,
|
|
6034
5863
|
showXdr,
|
|
6035
5864
|
copied,
|
|
@@ -6059,8 +5888,10 @@ function SendModalTemplate({
|
|
|
6059
5888
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
6060
5889
|
const parsedAmount = amount ? Number(amount) : 0;
|
|
6061
5890
|
const availableAmount = selectedAsset?.available === null || selectedAsset?.available === void 0 ? 0 : Number(selectedAsset.available);
|
|
6062
|
-
const canSubmit = canSendOnChain && !notReadyReason && !!selectedAsset && Number.isFinite(parsedAmount) && parsedAmount > 0 && parsedAmount <= availableAmount && !!destination.trim() && !isLoadingBalance;
|
|
6063
|
-
const title = step === "form" ? "Send" : txTitle;
|
|
5891
|
+
const canSubmit = canSendOnChain && !notReadyReason && !!selectedAsset && Number.isFinite(parsedAmount) && parsedAmount > 0 && parsedAmount <= availableAmount && !!destination.trim() && !isLoadingBalance && !isCheckingDestination;
|
|
5892
|
+
const title = step === "form" ? "Send" : step === "create-account" ? "Create account?" : txTitle;
|
|
5893
|
+
const createsWithNative = selectedAsset?.type === "native";
|
|
5894
|
+
const meetsMinimum = Number.isFinite(parsedAmount) && parsedAmount >= minStartingBalance;
|
|
6064
5895
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6065
5896
|
"div",
|
|
6066
5897
|
{
|
|
@@ -6110,44 +5941,18 @@ function SendModalTemplate({
|
|
|
6110
5941
|
onSelectAsset
|
|
6111
5942
|
}
|
|
6112
5943
|
),
|
|
6113
|
-
/* @__PURE__ */ jsxRuntime.
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
"input",
|
|
6126
|
-
{
|
|
6127
|
-
className: "pollar-input pollar-send-amount-input",
|
|
6128
|
-
type: "text",
|
|
6129
|
-
inputMode: "decimal",
|
|
6130
|
-
placeholder: "0.00",
|
|
6131
|
-
value: amount,
|
|
6132
|
-
onChange: (e) => onAmountChange(e.target.value),
|
|
6133
|
-
"aria-label": "Amount"
|
|
6134
|
-
}
|
|
6135
|
-
),
|
|
6136
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-input-suffix", children: [
|
|
6137
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6138
|
-
"button",
|
|
6139
|
-
{
|
|
6140
|
-
type: "button",
|
|
6141
|
-
className: "pollar-send-inline-action",
|
|
6142
|
-
onClick: onMax,
|
|
6143
|
-
disabled: !selectedAsset?.available,
|
|
6144
|
-
children: "Max"
|
|
6145
|
-
}
|
|
6146
|
-
),
|
|
6147
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: selectedAsset?.code ?? "" })
|
|
6148
|
-
] })
|
|
6149
|
-
] })
|
|
6150
|
-
] }),
|
|
5944
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5945
|
+
AmountField,
|
|
5946
|
+
{
|
|
5947
|
+
id: "pollar-send-amount",
|
|
5948
|
+
label: "Amount",
|
|
5949
|
+
value: amount,
|
|
5950
|
+
onChange: onAmountChange,
|
|
5951
|
+
unit: selectedAsset?.code,
|
|
5952
|
+
available: selectedAsset ? selectedAsset.available : void 0,
|
|
5953
|
+
onMax
|
|
5954
|
+
}
|
|
5955
|
+
),
|
|
6151
5956
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
6152
5957
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Destination wallet" }),
|
|
6153
5958
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-input-shell", children: [
|
|
@@ -6199,7 +6004,41 @@ function SendModalTemplate({
|
|
|
6199
6004
|
] })
|
|
6200
6005
|
] }),
|
|
6201
6006
|
formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
6202
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary", onClick: onSubmit, disabled: !canSubmit, children: "Continue" }) })
|
|
6007
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary", onClick: onSubmit, disabled: !canSubmit, children: isCheckingDestination ? "Checking destination\u2026" : "Continue" }) })
|
|
6008
|
+
] }),
|
|
6009
|
+
step === "create-account" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6010
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-notice", children: [
|
|
6011
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-send-notice-title", children: "This account doesn't exist yet" }),
|
|
6012
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-send-notice-address", children: destination.trim() }),
|
|
6013
|
+
createsWithNative ? /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
6014
|
+
"A Stellar account has to be created and funded before it can receive payments. Instead of a payment, this will",
|
|
6015
|
+
" ",
|
|
6016
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "create the account" }),
|
|
6017
|
+
" with ",
|
|
6018
|
+
amount,
|
|
6019
|
+
" XLM as its starting balance."
|
|
6020
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
6021
|
+
"It can't receive ",
|
|
6022
|
+
selectedAsset?.code ?? "this asset",
|
|
6023
|
+
" yet: it has to be created and funded with XLM first, and then add a trustline for ",
|
|
6024
|
+
selectedAsset?.code ?? "the asset",
|
|
6025
|
+
"."
|
|
6026
|
+
] }),
|
|
6027
|
+
createsWithNative && !meetsMinimum && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-send-notice-warning", children: [
|
|
6028
|
+
"A new account needs a starting balance of at least ",
|
|
6029
|
+
minStartingBalance,
|
|
6030
|
+
" XLM. Go back and raise the amount to create it."
|
|
6031
|
+
] }),
|
|
6032
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { children: "Or wait until another wallet funds it, and send afterwards." })
|
|
6033
|
+
] }),
|
|
6034
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-account-actions", children: [
|
|
6035
|
+
createsWithNative && onCreateAccount && /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-btn-primary", onClick: onCreateAccount, disabled: !meetsMinimum, children: [
|
|
6036
|
+
"Create account with ",
|
|
6037
|
+
amount,
|
|
6038
|
+
" XLM"
|
|
6039
|
+
] }),
|
|
6040
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-secondary", onClick: onBack, children: "I'll wait until it's funded" })
|
|
6041
|
+
] })
|
|
6203
6042
|
] }),
|
|
6204
6043
|
step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6205
6044
|
TxStatusView,
|
|
@@ -6236,6 +6075,7 @@ function parseMemo(type, raw) {
|
|
|
6236
6075
|
if (!/^\d+$/.test(value) || BigInt(value) > MAX_MEMO_ID) return "The memo ID must be a whole number up to 2^64 - 1.";
|
|
6237
6076
|
return { type, value };
|
|
6238
6077
|
}
|
|
6078
|
+
var MIN_STARTING_BALANCE_XLM = 1;
|
|
6239
6079
|
function assetParam(record) {
|
|
6240
6080
|
if (record.type === "native") return { type: "native" };
|
|
6241
6081
|
if (record.type === "credit_alphanum4") {
|
|
@@ -6253,11 +6093,14 @@ function SendModal({ onClose }) {
|
|
|
6253
6093
|
tx: transaction,
|
|
6254
6094
|
wallet,
|
|
6255
6095
|
network,
|
|
6256
|
-
styles
|
|
6096
|
+
styles,
|
|
6097
|
+
getClient
|
|
6257
6098
|
} = usePollar();
|
|
6258
6099
|
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
6259
6100
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
6260
6101
|
const [step, setStep] = react.useState("form");
|
|
6102
|
+
const [createsAccount, setCreatesAccount] = react.useState(false);
|
|
6103
|
+
const [checkingDestination, setCheckingDestination] = react.useState(false);
|
|
6261
6104
|
const [amount, setAmount] = react.useState("");
|
|
6262
6105
|
const [destination, setDestination] = react.useState("");
|
|
6263
6106
|
const [memo, setMemo] = react.useState("");
|
|
@@ -6313,8 +6156,15 @@ function SendModal({ onClose }) {
|
|
|
6313
6156
|
"building-signing-submitting"
|
|
6314
6157
|
];
|
|
6315
6158
|
const isInProgress = IN_FLIGHT_STEPS3.includes(transaction.step);
|
|
6316
|
-
const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
6317
|
-
const txTitle = isInProgress ? "Sending\u2026" : transaction.step === "success" ? "Sent!" : transaction.step === "error" ? "Send failed" : "Confirm Send";
|
|
6159
|
+
const showBack = step === "create-account" || step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
6160
|
+
const txTitle = createsAccount ? isInProgress ? "Creating account\u2026" : transaction.step === "success" ? "Account created!" : transaction.step === "error" ? "Create account failed" : "Confirm Create Account" : isInProgress ? "Sending\u2026" : transaction.step === "success" ? "Sent!" : transaction.step === "error" ? "Send failed" : "Confirm Send";
|
|
6161
|
+
async function stellarAccountExists(address) {
|
|
6162
|
+
try {
|
|
6163
|
+
return (await getClient().getWalletBalance(address)).exists;
|
|
6164
|
+
} catch {
|
|
6165
|
+
return null;
|
|
6166
|
+
}
|
|
6167
|
+
}
|
|
6318
6168
|
async function handleSubmit() {
|
|
6319
6169
|
setFormError("");
|
|
6320
6170
|
if (!canSendOnChain) {
|
|
@@ -6361,6 +6211,16 @@ function SendModal({ onClose }) {
|
|
|
6361
6211
|
return;
|
|
6362
6212
|
}
|
|
6363
6213
|
}
|
|
6214
|
+
if (selectedChain === "STELLAR") {
|
|
6215
|
+
setCheckingDestination(true);
|
|
6216
|
+
const exists = await stellarAccountExists(destination.trim());
|
|
6217
|
+
setCheckingDestination(false);
|
|
6218
|
+
if (exists === false) {
|
|
6219
|
+
setStep("create-account");
|
|
6220
|
+
return;
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
setCreatesAccount(false);
|
|
6364
6224
|
setStep("tx");
|
|
6365
6225
|
if (selectedChain === "SOLANA" || selectedChain === "POLYGON") {
|
|
6366
6226
|
await sendPayment({
|
|
@@ -6379,6 +6239,17 @@ function SendModal({ onClose }) {
|
|
|
6379
6239
|
parsedMemo ? { memo: parsedMemo } : void 0
|
|
6380
6240
|
);
|
|
6381
6241
|
}
|
|
6242
|
+
async function handleCreateAccount() {
|
|
6243
|
+
const parsedMemo = parseMemo(memoType, memo);
|
|
6244
|
+
if (typeof parsedMemo === "string" || parseFloat(amount) < MIN_STARTING_BALANCE_XLM) return;
|
|
6245
|
+
setCreatesAccount(true);
|
|
6246
|
+
setStep("tx");
|
|
6247
|
+
await buildTx(
|
|
6248
|
+
"create_account",
|
|
6249
|
+
{ destination: destination.trim(), startingBalance: amount },
|
|
6250
|
+
parsedMemo ? { memo: parsedMemo } : void 0
|
|
6251
|
+
);
|
|
6252
|
+
}
|
|
6382
6253
|
function handleSignAndSend() {
|
|
6383
6254
|
if (transaction.step === "built") {
|
|
6384
6255
|
void signAndSubmitTx(transaction.buildData.unsignedXdr);
|
|
@@ -6433,6 +6304,7 @@ function SendModal({ onClose }) {
|
|
|
6433
6304
|
}
|
|
6434
6305
|
function handleBack() {
|
|
6435
6306
|
setStep("form");
|
|
6307
|
+
setCreatesAccount(false);
|
|
6436
6308
|
setShowXdr(false);
|
|
6437
6309
|
setCopied(false);
|
|
6438
6310
|
}
|
|
@@ -6455,6 +6327,9 @@ function SendModal({ onClose }) {
|
|
|
6455
6327
|
destination,
|
|
6456
6328
|
formError,
|
|
6457
6329
|
isLoadingBalance: walletBalance.step === "loading",
|
|
6330
|
+
isCheckingDestination: checkingDestination,
|
|
6331
|
+
minStartingBalance: MIN_STARTING_BALANCE_XLM,
|
|
6332
|
+
onCreateAccount: () => void handleCreateAccount(),
|
|
6458
6333
|
transaction,
|
|
6459
6334
|
showXdr,
|
|
6460
6335
|
copied,
|
|
@@ -6742,7 +6617,7 @@ function SwapModalTemplate({
|
|
|
6742
6617
|
] })
|
|
6743
6618
|
] }),
|
|
6744
6619
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-panel-main", children: [
|
|
6745
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `pollar-swap-output${quoteLoading ? " is-loading" : ""}`, "aria-live": "polite", children: quoteLoading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }) : formatAmount2(quote
|
|
6620
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `pollar-swap-output${quoteLoading ? " is-loading" : ""}`, "aria-live": "polite", children: quoteLoading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }) : quote ? `~${formatAmount2(quote.amountOut)}` : "\u2014" }),
|
|
6746
6621
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-panel-selector", children: [
|
|
6747
6622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6748
6623
|
AssetPill,
|
|
@@ -7206,7 +7081,6 @@ function EarnModal({ onClose }) {
|
|
|
7206
7081
|
earnWithdraw,
|
|
7207
7082
|
tx: transaction,
|
|
7208
7083
|
wallet,
|
|
7209
|
-
walletBalance,
|
|
7210
7084
|
refreshWalletBalance,
|
|
7211
7085
|
enabledAssets,
|
|
7212
7086
|
refreshAssets,
|
|
@@ -7288,13 +7162,9 @@ function EarnModal({ onClose }) {
|
|
|
7288
7162
|
const withdrawUnit = position?.withdrawUnit ?? "asset";
|
|
7289
7163
|
const assetCode = selectedOpportunity?.asset.code ?? "";
|
|
7290
7164
|
const amountUnitLabel = tab === "deposit" ? assetCode : withdrawUnit === "shares" ? "shares" : assetCode;
|
|
7291
|
-
const walletAvailable = (
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
const issuer = selectedOpportunity.asset.issuer;
|
|
7295
|
-
const rec = balances.find((b) => issuer === null ? b.type === "native" : b.code === assetCode && b.issuer === issuer);
|
|
7296
|
-
return rec ? rec.available : null;
|
|
7297
|
-
})();
|
|
7165
|
+
const walletAvailable = useWalletAvailable(
|
|
7166
|
+
selectedOpportunity ? { chain: "STELLAR", code: assetCode, issuer: selectedOpportunity.asset.issuer } : null
|
|
7167
|
+
);
|
|
7298
7168
|
const depositAssetRecord = (() => {
|
|
7299
7169
|
if (!selectedOpportunity?.asset.issuer || enabledAssets.step !== "loaded") return void 0;
|
|
7300
7170
|
return enabledAssets.data.assets.find(
|
|
@@ -7528,37 +7398,17 @@ function EarnModal({ onClose }) {
|
|
|
7528
7398
|
] })
|
|
7529
7399
|
] })
|
|
7530
7400
|
] }),
|
|
7531
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
formatAmount3(position.withdrawable),
|
|
7543
|
-
" ",
|
|
7544
|
-
amountUnitLabel
|
|
7545
|
-
] })
|
|
7546
|
-
] }),
|
|
7547
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-amount", children: [
|
|
7548
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7549
|
-
"input",
|
|
7550
|
-
{
|
|
7551
|
-
className: "pollar-input",
|
|
7552
|
-
type: "text",
|
|
7553
|
-
inputMode: "decimal",
|
|
7554
|
-
placeholder: "0.00",
|
|
7555
|
-
value: amount,
|
|
7556
|
-
onChange: (e) => setAmount(e.target.value)
|
|
7557
|
-
}
|
|
7558
|
-
),
|
|
7559
|
-
amountUnitLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-earn-amount-unit", children: amountUnitLabel })
|
|
7560
|
-
] })
|
|
7561
|
-
] }),
|
|
7401
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7402
|
+
AmountField,
|
|
7403
|
+
{
|
|
7404
|
+
id: "pollar-earn-amount",
|
|
7405
|
+
label: tab === "deposit" ? "Amount" : "Withdraw amount",
|
|
7406
|
+
value: amount,
|
|
7407
|
+
onChange: setAmount,
|
|
7408
|
+
unit: amountUnitLabel,
|
|
7409
|
+
available: tab === "deposit" ? walletAvailable : position ? position.withdrawable : void 0
|
|
7410
|
+
}
|
|
7411
|
+
),
|
|
7562
7412
|
formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
7563
7413
|
depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-trustline-notice", children: [
|
|
7564
7414
|
"To deposit ",
|
|
@@ -7590,7 +7440,7 @@ function EarnModal({ onClose }) {
|
|
|
7590
7440
|
}
|
|
7591
7441
|
|
|
7592
7442
|
// src/components/card-modal/card-kyc.ts
|
|
7593
|
-
var
|
|
7443
|
+
var nonEmpty = (value) => typeof value === "string" && !!value.trim();
|
|
7594
7444
|
function requiredCardStep(error) {
|
|
7595
7445
|
if (!error || typeof error !== "object") return null;
|
|
7596
7446
|
if (!("code" in error) || error.code !== "SDK_CARDS_REQUIREMENT_REQUIRED") return null;
|
|
@@ -7599,7 +7449,7 @@ function requiredCardStep(error) {
|
|
|
7599
7449
|
const cardProviderId = "cardProviderId" in body ? body.cardProviderId : void 0;
|
|
7600
7450
|
const requirementType = "requirementType" in body ? body.requirementType : void 0;
|
|
7601
7451
|
const optionId = "optionId" in body ? body.optionId : void 0;
|
|
7602
|
-
if (!
|
|
7452
|
+
if (!nonEmpty(cardProviderId) || !nonEmpty(optionId)) return null;
|
|
7603
7453
|
if (requirementType === "KYC" || requirementType === "FORM" || requirementType === "REGISTRY_CHECK" || requirementType === "PROVIDER_REGISTRATION") {
|
|
7604
7454
|
return { cardProviderId, type: requirementType, optionId };
|
|
7605
7455
|
}
|
|
@@ -7754,6 +7604,8 @@ function CardModal({ onClose }) {
|
|
|
7754
7604
|
const [error, setError] = react.useState("");
|
|
7755
7605
|
const revealTimer = react.useRef(null);
|
|
7756
7606
|
const provider = providers?.[0] ?? null;
|
|
7607
|
+
const fundingAsset = provider?.fundingAssets[0] ?? "USDC";
|
|
7608
|
+
const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: "STELLAR", code: fundingAsset } : null);
|
|
7757
7609
|
const card = cards?.[0] ?? null;
|
|
7758
7610
|
const loadHolder = react.useCallback(async () => {
|
|
7759
7611
|
const h = await getClient().getCardHolder();
|
|
@@ -8279,19 +8131,18 @@ function CardModal({ onClose }) {
|
|
|
8279
8131
|
provider.fundingAssets.join(" or ") || "USDC",
|
|
8280
8132
|
" from your wallet to your card. It takes a few minutes to cross to the card network."
|
|
8281
8133
|
] }),
|
|
8282
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
"
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
] }),
|
|
8134
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8135
|
+
AmountField,
|
|
8136
|
+
{
|
|
8137
|
+
id: "pollar-card-fund-amount",
|
|
8138
|
+
label: "Amount",
|
|
8139
|
+
value: fundAmount,
|
|
8140
|
+
onChange: (value) => setFundAmount(value.replace(/[^0-9.]/g, "")),
|
|
8141
|
+
unit: fundingAsset,
|
|
8142
|
+
available: fundAvailable,
|
|
8143
|
+
placeholder: "10"
|
|
8144
|
+
}
|
|
8145
|
+
),
|
|
8295
8146
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8296
8147
|
"button",
|
|
8297
8148
|
{
|
|
@@ -8713,6 +8564,12 @@ function detailRows(request) {
|
|
|
8713
8564
|
function CloseIcon2() {
|
|
8714
8565
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
8715
8566
|
}
|
|
8567
|
+
function VerifiedIcon() {
|
|
8568
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
8569
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
8570
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
8571
|
+
] });
|
|
8572
|
+
}
|
|
8716
8573
|
function CosignModalTemplate({
|
|
8717
8574
|
theme,
|
|
8718
8575
|
accentColor,
|
|
@@ -8725,6 +8582,8 @@ function CosignModalTemplate({
|
|
|
8725
8582
|
approveBlocked = false,
|
|
8726
8583
|
lastResolved,
|
|
8727
8584
|
explorerUrl,
|
|
8585
|
+
closesIn = null,
|
|
8586
|
+
nextStep = null,
|
|
8728
8587
|
onSelect,
|
|
8729
8588
|
onApprove,
|
|
8730
8589
|
onReject,
|
|
@@ -8733,6 +8592,8 @@ function CosignModalTemplate({
|
|
|
8733
8592
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
8734
8593
|
const verified = verification?.ok === true;
|
|
8735
8594
|
const canVote = !!current && verified && !busy && !approveBlocked;
|
|
8595
|
+
const [verifiedOpenFor, setVerifiedOpenFor] = react.useState(null);
|
|
8596
|
+
const verifiedOpen = !!current && verifiedOpenFor === current.id;
|
|
8736
8597
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8737
8598
|
"div",
|
|
8738
8599
|
{
|
|
@@ -8745,27 +8606,48 @@ function CosignModalTemplate({
|
|
|
8745
8606
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Confirm with your device" }),
|
|
8746
8607
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", title: "Close", children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon2, {}) }) })
|
|
8747
8608
|
] }),
|
|
8748
|
-
pending.length === 0 && /* @__PURE__ */ jsxRuntime.
|
|
8749
|
-
lastResolved
|
|
8750
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8609
|
+
pending.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-empty", children: [
|
|
8610
|
+
lastResolved ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8611
|
+
lastResolved.status === "APPROVED" && /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "pollar-cosign-approved-icon", width: "44", height: "44", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
8612
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
8613
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8614
|
+
"path",
|
|
8615
|
+
{
|
|
8616
|
+
d: "M3.5 7l2.5 2.5 4.5-5",
|
|
8617
|
+
stroke: "white",
|
|
8618
|
+
strokeWidth: "1.2",
|
|
8619
|
+
strokeLinecap: "round",
|
|
8620
|
+
strokeLinejoin: "round"
|
|
8621
|
+
}
|
|
8622
|
+
)
|
|
8623
|
+
] }),
|
|
8624
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-empty-title", children: lastResolved.status === "APPROVED" ? "Approved" : lastResolved.status === "REJECTED" ? "Rejected" : lastResolved.status.toLowerCase() }),
|
|
8625
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: lastResolved.submit?.hash ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8626
|
+
"Sent. Transaction",
|
|
8627
|
+
" ",
|
|
8628
|
+
explorerUrl ? /* @__PURE__ */ jsxRuntime.jsx("a", { className: "pollar-cosign-tx-link", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", children: cropAddress(lastResolved.submit.hash) }) : cropAddress(lastResolved.submit.hash),
|
|
8629
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8630
|
+
CopyButton,
|
|
8631
|
+
{
|
|
8632
|
+
value: lastResolved.submit.hash,
|
|
8633
|
+
label: "Copy transaction hash",
|
|
8634
|
+
className: "pollar-copy-btn-sm pollar-cosign-copy"
|
|
8635
|
+
}
|
|
8636
|
+
)
|
|
8637
|
+
] }) : lastResolved.signedXdr ? "Signed. The app will send it." : "Nothing was signed." })
|
|
8638
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: "Nothing waits for your approval." }),
|
|
8639
|
+
nextStep && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-cosign-next", children: [
|
|
8640
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
8641
|
+
" Next: ",
|
|
8642
|
+
nextStep,
|
|
8643
|
+
". It appears here in a few seconds."
|
|
8761
8644
|
] }),
|
|
8762
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
"
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: "Nothing waits for your approval." }) }),
|
|
8645
|
+
closesIn !== null && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-cosign-muted pollar-cosign-closing", children: [
|
|
8646
|
+
"Closing in ",
|
|
8647
|
+
closesIn,
|
|
8648
|
+
"s"
|
|
8649
|
+
] })
|
|
8650
|
+
] }),
|
|
8769
8651
|
pending.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pollar-cosign-list", children: pending.map((r) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8770
8652
|
"button",
|
|
8771
8653
|
{
|
|
@@ -8779,7 +8661,26 @@ function CosignModalTemplate({
|
|
|
8779
8661
|
}
|
|
8780
8662
|
) }, r.id)) }),
|
|
8781
8663
|
current && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail", children: [
|
|
8782
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8664
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail-head", children: [
|
|
8665
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: labelOf(current) }),
|
|
8666
|
+
!verification && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-cosign-chip", children: [
|
|
8667
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
8668
|
+
"Checking..."
|
|
8669
|
+
] }),
|
|
8670
|
+
verification?.ok && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8671
|
+
"button",
|
|
8672
|
+
{
|
|
8673
|
+
type: "button",
|
|
8674
|
+
className: "pollar-cosign-chip pollar-cosign-chip-ok",
|
|
8675
|
+
"aria-expanded": verifiedOpen,
|
|
8676
|
+
onClick: () => setVerifiedOpenFor(verifiedOpen ? null : current.id),
|
|
8677
|
+
children: [
|
|
8678
|
+
/* @__PURE__ */ jsxRuntime.jsx(VerifiedIcon, {}),
|
|
8679
|
+
"Verified"
|
|
8680
|
+
]
|
|
8681
|
+
}
|
|
8682
|
+
)
|
|
8683
|
+
] }),
|
|
8783
8684
|
current.summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: current.summary }),
|
|
8784
8685
|
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pollar-cosign-rows", children: [
|
|
8785
8686
|
detailRows(current).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
|
|
@@ -8791,17 +8692,11 @@ function CosignModalTemplate({
|
|
|
8791
8692
|
/* @__PURE__ */ jsxRuntime.jsx("dd", { children: expiresIn(current) })
|
|
8792
8693
|
] })
|
|
8793
8694
|
] }),
|
|
8794
|
-
/* @__PURE__ */ jsxRuntime.
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
!verification && "Checking the transaction against Turnkey...",
|
|
8800
|
-
verification?.ok && "Verified: this is exactly what will be signed.",
|
|
8801
|
-
verification && !verification.ok && `Not verified: ${verification.reason}`
|
|
8802
|
-
]
|
|
8803
|
-
}
|
|
8804
|
-
),
|
|
8695
|
+
verification?.ok && verifiedOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: "Checked against Turnkey: this is exactly what will be signed." }),
|
|
8696
|
+
verification && !verification.ok && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
|
|
8697
|
+
"Not verified: ",
|
|
8698
|
+
verification.reason
|
|
8699
|
+
] }),
|
|
8805
8700
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-error", children: error }),
|
|
8806
8701
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-actions", children: [
|
|
8807
8702
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8831,10 +8726,13 @@ function CosignModalTemplate({
|
|
|
8831
8726
|
}
|
|
8832
8727
|
);
|
|
8833
8728
|
}
|
|
8834
|
-
|
|
8729
|
+
var CLOSE_AFTER_SECONDS = 3;
|
|
8730
|
+
var CLOSE_AFTER_SENT_SECONDS = 5;
|
|
8731
|
+
var NEXT_REQUEST_EVERY_MS = 2e3;
|
|
8732
|
+
function CosignModal({ nextStep = null, onClose }) {
|
|
8835
8733
|
const { getClient, styles, network } = usePollar();
|
|
8836
8734
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
8837
|
-
const { pending, lastResolved, approve, reject, verify, inspectQuorum } = useCosign();
|
|
8735
|
+
const { pending, lastResolved, loaded, refresh, approve, reject, verify, inspectQuorum } = useCosign();
|
|
8838
8736
|
const [selectedId, setSelectedId] = react.useState(null);
|
|
8839
8737
|
const [verification, setVerification] = react.useState(null);
|
|
8840
8738
|
const [busy, setBusy] = react.useState(null);
|
|
@@ -8877,6 +8775,33 @@ function CosignModal({ onClose }) {
|
|
|
8877
8775
|
if (authState.step === "idle") onCloseRef.current();
|
|
8878
8776
|
});
|
|
8879
8777
|
}, [getClient]);
|
|
8778
|
+
const silent = pending.length === 0 && (lastResolved ? lastResolved.status === "APPROVED" && !lastResolved.submit?.hash && !lastResolved.signedXdr : loaded);
|
|
8779
|
+
const sent = pending.length === 0 && lastResolved?.status === "APPROVED" && !!lastResolved.submit?.hash;
|
|
8780
|
+
const awaitingNext = sent && !!nextStep;
|
|
8781
|
+
const closeAfter = awaitingNext ? null : sent ? CLOSE_AFTER_SENT_SECONDS : silent ? CLOSE_AFTER_SECONDS : null;
|
|
8782
|
+
react.useEffect(() => {
|
|
8783
|
+
if (!awaitingNext) return;
|
|
8784
|
+
const timer = setInterval(() => void refresh().catch(() => void 0), NEXT_REQUEST_EVERY_MS);
|
|
8785
|
+
return () => clearInterval(timer);
|
|
8786
|
+
}, [awaitingNext, refresh]);
|
|
8787
|
+
const [closesIn, setClosesIn] = react.useState(null);
|
|
8788
|
+
react.useEffect(() => {
|
|
8789
|
+
if (closeAfter === null) {
|
|
8790
|
+
setClosesIn(null);
|
|
8791
|
+
return;
|
|
8792
|
+
}
|
|
8793
|
+
let left = closeAfter;
|
|
8794
|
+
setClosesIn(left);
|
|
8795
|
+
const timer = setInterval(() => {
|
|
8796
|
+
left -= 1;
|
|
8797
|
+
if (left > 0) setClosesIn(left);
|
|
8798
|
+
else {
|
|
8799
|
+
clearInterval(timer);
|
|
8800
|
+
onCloseRef.current();
|
|
8801
|
+
}
|
|
8802
|
+
}, 1e3);
|
|
8803
|
+
return () => clearInterval(timer);
|
|
8804
|
+
}, [closeAfter, lastResolved?.id]);
|
|
8880
8805
|
const run = react.useCallback(
|
|
8881
8806
|
async (kind, request, action) => {
|
|
8882
8807
|
setBusy(kind);
|
|
@@ -8905,6 +8830,8 @@ function CosignModal({ onClose }) {
|
|
|
8905
8830
|
error,
|
|
8906
8831
|
approveBlocked: !!current && approveFailedFor === current.id,
|
|
8907
8832
|
...lastResolved ? { lastResolved } : {},
|
|
8833
|
+
closesIn,
|
|
8834
|
+
nextStep: awaitingNext ? nextStep : null,
|
|
8908
8835
|
explorerUrl: lastResolved?.submit?.hash ? explorerTxUrl(lastResolved.network, lastResolved.submit.hash, network) : null,
|
|
8909
8836
|
onSelect: (r) => setSelectedId(r.id),
|
|
8910
8837
|
onApprove: (r) => void run("approving", r, approve),
|
|
@@ -9284,7 +9211,7 @@ function RecoveryModalTemplate(p) {
|
|
|
9284
9211
|
);
|
|
9285
9212
|
}
|
|
9286
9213
|
function errorText2(err) {
|
|
9287
|
-
return core.transactionErrorMessage(core.isPollarApiError(err) ? err.code : null, err instanceof Error ? err.message : null);
|
|
9214
|
+
return core.cosignRefusalMessage(err) ?? core.transactionErrorMessage(core.isPollarApiError(err) ? err.code : null, err instanceof Error ? err.message : null);
|
|
9288
9215
|
}
|
|
9289
9216
|
function RecoveryModal({ onClose }) {
|
|
9290
9217
|
const { getClient, styles, refreshRecovery, appConfig } = usePollar();
|
|
@@ -10298,6 +10225,7 @@ function PollarProvider({
|
|
|
10298
10225
|
const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
|
|
10299
10226
|
const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
|
|
10300
10227
|
const [cosignModalOpen, setCosignModalOpen] = react.useState(false);
|
|
10228
|
+
const [cosignNextStep, setCosignNextStep] = react.useState(null);
|
|
10301
10229
|
const [recoveryModalOpen, setRecoveryModalOpen] = react.useState(false);
|
|
10302
10230
|
const cosignPendingCount = react.useRef(0);
|
|
10303
10231
|
react.useEffect(() => {
|
|
@@ -10448,6 +10376,7 @@ function PollarProvider({
|
|
|
10448
10376
|
// cosign
|
|
10449
10377
|
cosign,
|
|
10450
10378
|
openCosignModal: () => setCosignModalOpen(true),
|
|
10379
|
+
setCosignNextStep,
|
|
10451
10380
|
recovery,
|
|
10452
10381
|
recoveryLocked,
|
|
10453
10382
|
refreshRecovery,
|
|
@@ -10538,7 +10467,7 @@ function PollarProvider({
|
|
|
10538
10467
|
/* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setCardModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(CardModal, { onClose: () => setCardModalOpen(false) }) }, `${cardModalKey}:${walletAddress}`),
|
|
10539
10468
|
receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
|
|
10540
10469
|
sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
|
|
10541
|
-
cosignModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setCosignModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(CosignModal, { onClose: () => setCosignModalOpen(false) }) }),
|
|
10470
|
+
cosignModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setCosignModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(CosignModal, { nextStep: cosignNextStep, onClose: () => setCosignModalOpen(false) }) }),
|
|
10542
10471
|
custodyMigration?.required && !custodyMigrationLater && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: refreshCustodyMigration, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10543
10472
|
CustodyMigrationModal,
|
|
10544
10473
|
{
|
|
@@ -10555,7 +10484,15 @@ function PollarProvider({
|
|
|
10555
10484
|
}
|
|
10556
10485
|
}
|
|
10557
10486
|
) }),
|
|
10558
|
-
recoveryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setRecoveryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10487
|
+
recoveryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setRecoveryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10488
|
+
RecoveryModal,
|
|
10489
|
+
{
|
|
10490
|
+
onClose: () => {
|
|
10491
|
+
setRecoveryModalOpen(false);
|
|
10492
|
+
refreshRecovery();
|
|
10493
|
+
}
|
|
10494
|
+
}
|
|
10495
|
+
) }),
|
|
10559
10496
|
firstConfirmation && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: firstConfirmation.reject, children: /* @__PURE__ */ jsxRuntime.jsx(ConfirmModal, { confirmation: firstConfirmation }, firstConfirmation.id) }),
|
|
10560
10497
|
distributionRulesModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
|
|
10561
10498
|
] });
|
|
@@ -10587,8 +10524,9 @@ function createPollarAdapterHook(key) {
|
|
|
10587
10524
|
);
|
|
10588
10525
|
};
|
|
10589
10526
|
}
|
|
10590
|
-
function ButtonLogo() {
|
|
10591
|
-
|
|
10527
|
+
function ButtonLogo({ accentColor }) {
|
|
10528
|
+
const src = readableTextOn(accentColor) === "#ffffff" ? LOGO_POLLAR_MARK_ON_DARK : LOGO_POLLAR_MARK_ON_LIGHT;
|
|
10529
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: "Pollar", width: 22, height: 22, className: "pollar-wallet-btn-logo" });
|
|
10592
10530
|
}
|
|
10593
10531
|
function cropWallet(address) {
|
|
10594
10532
|
if (address.length <= 12) return address;
|
|
@@ -10596,12 +10534,11 @@ function cropWallet(address) {
|
|
|
10596
10534
|
}
|
|
10597
10535
|
function WalletButtonTemplate({
|
|
10598
10536
|
walletAddress,
|
|
10537
|
+
theme,
|
|
10599
10538
|
accentColor,
|
|
10539
|
+
styleOverrides,
|
|
10600
10540
|
open,
|
|
10601
10541
|
copied,
|
|
10602
|
-
dropdownBg,
|
|
10603
|
-
dropdownBorder,
|
|
10604
|
-
itemColor,
|
|
10605
10542
|
wrapperRef,
|
|
10606
10543
|
isInProgress,
|
|
10607
10544
|
showCreateAccount,
|
|
@@ -10630,9 +10567,10 @@ function WalletButtonTemplate({
|
|
|
10630
10567
|
}) {
|
|
10631
10568
|
const [selfCustodyNotice, setSelfCustodyNotice] = react.useState(false);
|
|
10632
10569
|
const [risksAccepted, setRisksAccepted] = react.useState(false);
|
|
10570
|
+
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
10633
10571
|
if (!walletAddress && signedIn) {
|
|
10634
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
|
|
10635
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-btn",
|
|
10572
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, style: cssVars, children: [
|
|
10573
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-btn", onClick: onToggleOpen, children: [
|
|
10636
10574
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-btn-label", children: onCreateWallet ? "No wallet" : "Signed in" }),
|
|
10637
10575
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10638
10576
|
"svg",
|
|
@@ -10648,22 +10586,13 @@ function WalletButtonTemplate({
|
|
|
10648
10586
|
}
|
|
10649
10587
|
)
|
|
10650
10588
|
] }),
|
|
10651
|
-
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown",
|
|
10589
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown", children: [
|
|
10652
10590
|
createWalletError && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10653
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice",
|
|
10591
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice", role: "status", children: createWalletError }),
|
|
10654
10592
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10655
10593
|
] }),
|
|
10656
10594
|
onCreateWallet && !custodyChoice && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10657
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10658
|
-
"button",
|
|
10659
|
-
{
|
|
10660
|
-
className: "pollar-wallet-dropdown-item",
|
|
10661
|
-
style: { color: itemColor },
|
|
10662
|
-
onClick: () => onCreateWallet(),
|
|
10663
|
-
disabled: creatingWallet,
|
|
10664
|
-
children: creatingWallet ? "Creating wallet\u2026" : "Create wallet"
|
|
10665
|
-
}
|
|
10666
|
-
),
|
|
10595
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-wallet-dropdown-item", onClick: () => onCreateWallet(), disabled: creatingWallet, children: creatingWallet ? "Creating wallet\u2026" : "Create wallet" }),
|
|
10667
10596
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10668
10597
|
] }),
|
|
10669
10598
|
onCreateWallet && custodyChoice && !selfCustodyNotice && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -10671,29 +10600,27 @@ function WalletButtonTemplate({
|
|
|
10671
10600
|
"button",
|
|
10672
10601
|
{
|
|
10673
10602
|
className: "pollar-wallet-dropdown-item",
|
|
10674
|
-
style: { color: itemColor },
|
|
10675
10603
|
onClick: () => onCreateWallet("COSIGNED"),
|
|
10676
10604
|
disabled: creatingWallet,
|
|
10677
10605
|
children: creatingWallet ? "Creating wallet\u2026" : "Create co-signed wallet"
|
|
10678
10606
|
}
|
|
10679
10607
|
),
|
|
10680
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice",
|
|
10608
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice", children: "You and the app approve every signature together. Your wallet can be recovered with help." }),
|
|
10681
10609
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10682
10610
|
"button",
|
|
10683
10611
|
{
|
|
10684
10612
|
className: "pollar-wallet-dropdown-item",
|
|
10685
|
-
style: { color: itemColor },
|
|
10686
10613
|
onClick: () => setSelfCustodyNotice(true),
|
|
10687
10614
|
disabled: creatingWallet,
|
|
10688
10615
|
children: "Create self-custody wallet"
|
|
10689
10616
|
}
|
|
10690
10617
|
),
|
|
10691
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice",
|
|
10618
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice", children: "Only your device signs. Nobody else can move or recover your funds." }),
|
|
10692
10619
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10693
10620
|
] }),
|
|
10694
10621
|
onCreateWallet && custodyChoice && selfCustodyNotice && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10695
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice",
|
|
10696
|
-
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-wallet-dropdown-notice",
|
|
10622
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice", role: "alert", children: "In a self-custody wallet only your device can sign. If you lose this device and every recovery method, nobody can recover the wallet or its funds, not the app and not Pollar. Nobody can undo or freeze a transaction you sign." }),
|
|
10623
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-wallet-dropdown-notice", children: [
|
|
10697
10624
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10698
10625
|
"input",
|
|
10699
10626
|
{
|
|
@@ -10710,7 +10637,6 @@ function WalletButtonTemplate({
|
|
|
10710
10637
|
"button",
|
|
10711
10638
|
{
|
|
10712
10639
|
className: "pollar-wallet-dropdown-item",
|
|
10713
|
-
style: { color: itemColor },
|
|
10714
10640
|
onClick: () => onCreateWallet("SELF_CUSTODY"),
|
|
10715
10641
|
disabled: creatingWallet || !risksAccepted,
|
|
10716
10642
|
children: creatingWallet ? "Creating wallet\u2026" : "Create self-custody wallet"
|
|
@@ -10720,7 +10646,6 @@ function WalletButtonTemplate({
|
|
|
10720
10646
|
"button",
|
|
10721
10647
|
{
|
|
10722
10648
|
className: "pollar-wallet-dropdown-item",
|
|
10723
|
-
style: { color: itemColor },
|
|
10724
10649
|
onClick: () => {
|
|
10725
10650
|
setSelfCustodyNotice(false);
|
|
10726
10651
|
setRisksAccepted(false);
|
|
@@ -10731,24 +10656,23 @@ function WalletButtonTemplate({
|
|
|
10731
10656
|
),
|
|
10732
10657
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10733
10658
|
] }),
|
|
10734
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-wallet-dropdown-item",
|
|
10659
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-wallet-dropdown-item", onClick: onSessions, children: "Active sessions" }),
|
|
10735
10660
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
|
|
10736
10661
|
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-wallet-dropdown-item pollar-danger", onClick: onLogout, children: "Log out" })
|
|
10737
10662
|
] })
|
|
10738
10663
|
] });
|
|
10739
10664
|
}
|
|
10740
10665
|
if (!walletAddress) {
|
|
10741
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-wallet-login-btn", style:
|
|
10742
|
-
/* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, {}),
|
|
10666
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-wallet-login-btn", style: cssVars, onClick: onLogin, children: [
|
|
10667
|
+
/* @__PURE__ */ jsxRuntime.jsx(ButtonLogo, { accentColor }),
|
|
10743
10668
|
"Login with Pollar"
|
|
10744
10669
|
] });
|
|
10745
10670
|
}
|
|
10746
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, children: [
|
|
10671
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-wrapper", ref: wrapperRef, style: cssVars, children: [
|
|
10747
10672
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10748
10673
|
"button",
|
|
10749
10674
|
{
|
|
10750
10675
|
className: "pollar-wallet-btn",
|
|
10751
|
-
style: { backgroundColor: accentColor },
|
|
10752
10676
|
onClick: isInProgress ? void 0 : onToggleOpen,
|
|
10753
10677
|
disabled: isInProgress,
|
|
10754
10678
|
"aria-busy": isInProgress,
|
|
@@ -10785,50 +10709,41 @@ function WalletButtonTemplate({
|
|
|
10785
10709
|
]
|
|
10786
10710
|
}
|
|
10787
10711
|
),
|
|
10788
|
-
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown",
|
|
10712
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-dropdown", children: [
|
|
10789
10713
|
recoveryLocked && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10790
10714
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice pollar-danger", role: "alert", children: "Locked: add a way to recover this wallet before sending or receiving. If you lose this device without one, the funds are lost." }),
|
|
10791
10715
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10792
10716
|
] }),
|
|
10793
10717
|
notReadyReason && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10794
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice",
|
|
10718
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-notice", role: "status", children: notReadyReason }),
|
|
10795
10719
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10796
10720
|
] }),
|
|
10797
10721
|
showCreateAccount && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10798
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "19", y1: "8", x2: "19", y2: "14" }),
|
|
10821
|
-
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "22", y1: "11", x2: "16", y2: "11" })
|
|
10822
|
-
]
|
|
10823
|
-
}
|
|
10824
|
-
),
|
|
10825
|
-
creatingAccount ? "Creating account\u2026" : "Create account"
|
|
10826
|
-
]
|
|
10827
|
-
}
|
|
10828
|
-
),
|
|
10722
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onCreateAccount, disabled: creatingAccount, children: [
|
|
10723
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10724
|
+
"svg",
|
|
10725
|
+
{
|
|
10726
|
+
width: "14",
|
|
10727
|
+
height: "14",
|
|
10728
|
+
viewBox: "0 0 24 24",
|
|
10729
|
+
fill: "none",
|
|
10730
|
+
stroke: "currentColor",
|
|
10731
|
+
strokeWidth: "2",
|
|
10732
|
+
strokeLinecap: "round",
|
|
10733
|
+
strokeLinejoin: "round",
|
|
10734
|
+
children: [
|
|
10735
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
|
|
10736
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "7", r: "4" }),
|
|
10737
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "19", y1: "8", x2: "19", y2: "14" }),
|
|
10738
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "22", y1: "11", x2: "16", y2: "11" })
|
|
10739
|
+
]
|
|
10740
|
+
}
|
|
10741
|
+
),
|
|
10742
|
+
creatingAccount ? "Creating account\u2026" : "Create account"
|
|
10743
|
+
] }),
|
|
10829
10744
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" })
|
|
10830
10745
|
] }),
|
|
10831
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10746
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onSend, children: [
|
|
10832
10747
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10833
10748
|
"svg",
|
|
10834
10749
|
{
|
|
@@ -10848,7 +10763,7 @@ function WalletButtonTemplate({
|
|
|
10848
10763
|
),
|
|
10849
10764
|
"Send"
|
|
10850
10765
|
] }),
|
|
10851
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10766
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onReceive, children: [
|
|
10852
10767
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10853
10768
|
"svg",
|
|
10854
10769
|
{
|
|
@@ -10870,7 +10785,7 @@ function WalletButtonTemplate({
|
|
|
10870
10785
|
"Receive"
|
|
10871
10786
|
] }),
|
|
10872
10787
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
|
|
10873
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10788
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onCopy, children: [
|
|
10874
10789
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10875
10790
|
"svg",
|
|
10876
10791
|
{
|
|
@@ -10890,7 +10805,7 @@ function WalletButtonTemplate({
|
|
|
10890
10805
|
),
|
|
10891
10806
|
copied ? "Copied!" : "Copy address"
|
|
10892
10807
|
] }),
|
|
10893
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10808
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onWalletBalance, children: [
|
|
10894
10809
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10895
10810
|
"svg",
|
|
10896
10811
|
{
|
|
@@ -10911,7 +10826,7 @@ function WalletButtonTemplate({
|
|
|
10911
10826
|
),
|
|
10912
10827
|
"Wallet balance"
|
|
10913
10828
|
] }),
|
|
10914
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10829
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onTxHistory, children: [
|
|
10915
10830
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10916
10831
|
"svg",
|
|
10917
10832
|
{
|
|
@@ -10935,7 +10850,7 @@ function WalletButtonTemplate({
|
|
|
10935
10850
|
"Transaction history"
|
|
10936
10851
|
] }),
|
|
10937
10852
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
|
|
10938
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10853
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onRamp, children: [
|
|
10939
10854
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10940
10855
|
"svg",
|
|
10941
10856
|
{
|
|
@@ -10957,7 +10872,7 @@ function WalletButtonTemplate({
|
|
|
10957
10872
|
),
|
|
10958
10873
|
"Buy / Sell"
|
|
10959
10874
|
] }),
|
|
10960
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10875
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onKyc, children: [
|
|
10961
10876
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10962
10877
|
"svg",
|
|
10963
10878
|
{
|
|
@@ -10978,7 +10893,7 @@ function WalletButtonTemplate({
|
|
|
10978
10893
|
),
|
|
10979
10894
|
"Identity verification"
|
|
10980
10895
|
] }),
|
|
10981
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10896
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onDistributionRules, children: [
|
|
10982
10897
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10983
10898
|
"svg",
|
|
10984
10899
|
{
|
|
@@ -11001,7 +10916,7 @@ function WalletButtonTemplate({
|
|
|
11001
10916
|
),
|
|
11002
10917
|
"Distribution rules"
|
|
11003
10918
|
] }),
|
|
11004
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item",
|
|
10919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item", onClick: onSessions, children: [
|
|
11005
10920
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
11006
10921
|
"svg",
|
|
11007
10922
|
{
|
|
@@ -11022,31 +10937,23 @@ function WalletButtonTemplate({
|
|
|
11022
10937
|
),
|
|
11023
10938
|
"Active sessions"
|
|
11024
10939
|
] }),
|
|
11025
|
-
onRecovery && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
strokeLinejoin: "round",
|
|
11043
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2 4 5v6c0 5 3.4 9.3 8 11 4.6-1.7 8-6 8-11V5l-8-3z" })
|
|
11044
|
-
}
|
|
11045
|
-
),
|
|
11046
|
-
recoveryLocked ? "Set up wallet recovery" : "Wallet recovery"
|
|
11047
|
-
]
|
|
11048
|
-
}
|
|
11049
|
-
),
|
|
10940
|
+
onRecovery && /* @__PURE__ */ jsxRuntime.jsxs("button", { className: `pollar-wallet-dropdown-item${recoveryLocked ? " pollar-danger" : ""}`, onClick: onRecovery, children: [
|
|
10941
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10942
|
+
"svg",
|
|
10943
|
+
{
|
|
10944
|
+
width: "14",
|
|
10945
|
+
height: "14",
|
|
10946
|
+
viewBox: "0 0 24 24",
|
|
10947
|
+
fill: "none",
|
|
10948
|
+
stroke: "currentColor",
|
|
10949
|
+
strokeWidth: "2",
|
|
10950
|
+
strokeLinecap: "round",
|
|
10951
|
+
strokeLinejoin: "round",
|
|
10952
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2 4 5v6c0 5 3.4 9.3 8 11 4.6-1.7 8-6 8-11V5l-8-3z" })
|
|
10953
|
+
}
|
|
10954
|
+
),
|
|
10955
|
+
recoveryLocked ? "Set up wallet recovery" : "Wallet recovery"
|
|
10956
|
+
] }),
|
|
11050
10957
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-dropdown-divider" }),
|
|
11051
10958
|
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-wallet-dropdown-item pollar-danger", onClick: onLogout, children: [
|
|
11052
10959
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -11107,11 +11014,7 @@ function WalletButton() {
|
|
|
11107
11014
|
const isInProgress = transaction.step === "building" || transaction.step === "signing";
|
|
11108
11015
|
const canCreateAccount = !created && wallet?.custody === "external" && wallet.existsOnStellar === false && wallet.fundingMode === "IMMEDIATE";
|
|
11109
11016
|
const notReadyReason = walletNotReadyReason(wallet, primaryChain);
|
|
11110
|
-
const { theme
|
|
11111
|
-
const isDark = theme === "dark";
|
|
11112
|
-
const dropdownBg = isDark ? "#18181b" : "#fff";
|
|
11113
|
-
const dropdownBorder = isDark ? "#3f3f46" : "#e4e4e7";
|
|
11114
|
-
const itemColor = isDark ? "#fafafa" : "#18181b";
|
|
11017
|
+
const { theme, accentColor, styleOverrides } = modalChrome(styles);
|
|
11115
11018
|
react.useEffect(() => {
|
|
11116
11019
|
function handleClickOutside(e) {
|
|
11117
11020
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
@@ -11210,12 +11113,11 @@ function WalletButton() {
|
|
|
11210
11113
|
WalletButtonTemplate,
|
|
11211
11114
|
{
|
|
11212
11115
|
walletAddress: walletAddress ?? null,
|
|
11116
|
+
theme,
|
|
11213
11117
|
accentColor,
|
|
11118
|
+
styleOverrides,
|
|
11214
11119
|
open,
|
|
11215
11120
|
copied,
|
|
11216
|
-
dropdownBg,
|
|
11217
|
-
dropdownBorder,
|
|
11218
|
-
itemColor,
|
|
11219
11121
|
wrapperRef,
|
|
11220
11122
|
isInProgress,
|
|
11221
11123
|
showCreateAccount: canCreateAccount,
|
|
@@ -11264,12 +11166,12 @@ exports.PollarProvider = PollarProvider;
|
|
|
11264
11166
|
exports.ProviderRegistrationModal = ProviderRegistrationModal;
|
|
11265
11167
|
exports.RampWidget = RampWidget;
|
|
11266
11168
|
exports.RampWidgetTemplate = RampWidgetTemplate;
|
|
11267
|
-
exports.RampWorkflow = RampWorkflow;
|
|
11268
11169
|
exports.ReceiveModal = ReceiveModal;
|
|
11269
11170
|
exports.ReceiveModalTemplate = ReceiveModalTemplate;
|
|
11270
11171
|
exports.RecoveryModal = RecoveryModal;
|
|
11271
11172
|
exports.RecoveryModalTemplate = RecoveryModalTemplate;
|
|
11272
11173
|
exports.RegistryCheckModal = RegistryCheckModal;
|
|
11174
|
+
exports.RejectedRouteDisplay = RejectedRouteDisplay;
|
|
11273
11175
|
exports.RequirementFormModal = RequirementFormModal;
|
|
11274
11176
|
exports.RouteDisplay = RouteDisplay;
|
|
11275
11177
|
exports.SendModal = SendModal;
|