@pollar/react 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +100 -156
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +124 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -36,7 +36,7 @@ var PollarModalFooter = () => {
|
|
|
36
36
|
/* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
37
37
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
38
38
|
"v",
|
|
39
|
-
"0.5.
|
|
39
|
+
"0.5.3"
|
|
40
40
|
] })
|
|
41
41
|
] })
|
|
42
42
|
] });
|
|
@@ -96,15 +96,25 @@ function KycModalTemplate({
|
|
|
96
96
|
const isDark = theme === "dark";
|
|
97
97
|
const cssVars = {
|
|
98
98
|
"--pollar-accent": accentColor,
|
|
99
|
-
"--pollar-buttons-border-radius": "6px",
|
|
100
|
-
"--pollar-buttons-height": "44px",
|
|
101
99
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
102
100
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
103
101
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
104
102
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
105
|
-
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
|
|
103
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
104
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
105
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
106
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
107
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
108
|
+
"--pollar-buttons-border-radius": "6px",
|
|
109
|
+
"--pollar-buttons-height": "44px",
|
|
110
|
+
"--pollar-input-height": "44px",
|
|
111
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
112
|
+
"--pollar-card-border-radius": "10px",
|
|
113
|
+
"--pollar-modal-padding": "2rem",
|
|
114
|
+
"--pollar-modal-heading-size": "1.375rem",
|
|
115
|
+
"--pollar-modal-subtitle-size": "0.9rem"
|
|
106
116
|
};
|
|
107
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
117
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
108
118
|
/* @__PURE__ */ jsxs("div", { className: "pollar-kyc-header", children: [
|
|
109
119
|
/* @__PURE__ */ jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
|
|
110
120
|
/* @__PURE__ */ jsxs("p", { className: "pollar-kyc-subtitle", children: [
|
|
@@ -374,16 +384,23 @@ function LoginModalTemplate({
|
|
|
374
384
|
const enabledSocial = Object.entries(providers).filter(([, enabled]) => enabled);
|
|
375
385
|
const cssVars = {
|
|
376
386
|
"--pollar-accent": accentColor,
|
|
377
|
-
"--pollar-buttons-border-radius": "6px",
|
|
378
|
-
"--pollar-buttons-height": "44px",
|
|
379
387
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
380
388
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
381
389
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
382
390
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
383
|
-
"--pollar-input-bg": isDark ? "#374151" : "#
|
|
391
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
384
392
|
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
385
393
|
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
386
|
-
"--pollar-error-text": isDark ? "#f87171" : "#dc2626"
|
|
394
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
395
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
396
|
+
"--pollar-buttons-border-radius": "6px",
|
|
397
|
+
"--pollar-buttons-height": "44px",
|
|
398
|
+
"--pollar-input-height": "44px",
|
|
399
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
400
|
+
"--pollar-card-border-radius": "10px",
|
|
401
|
+
"--pollar-modal-padding": "2rem",
|
|
402
|
+
"--pollar-modal-heading-size": "1.375rem",
|
|
403
|
+
"--pollar-modal-subtitle-size": "0.9rem"
|
|
387
404
|
};
|
|
388
405
|
const status = authStateToStatus(authState.step);
|
|
389
406
|
const isLoading = status === "LOADING";
|
|
@@ -391,7 +408,7 @@ function LoginModalTemplate({
|
|
|
391
408
|
const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
|
|
392
409
|
const statusMessage = authState.step === "error" ? authState.message : AUTH_STATE_MESSAGES[authState.step];
|
|
393
410
|
const BackButton = ({ onClick }) => /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M15 19l-7-7 7-7" }) }) });
|
|
394
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
411
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
395
412
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }),
|
|
396
413
|
/* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
|
|
397
414
|
/* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx("img", { src: logoUrl ?? LOGO_POLLAR, alt: "Logo", className: "pollar-logo" }) }),
|
|
@@ -446,7 +463,7 @@ function LoginModalTemplate({
|
|
|
446
463
|
onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
|
|
447
464
|
}
|
|
448
465
|
),
|
|
449
|
-
/* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-
|
|
466
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-btn-primary", style: { marginTop: "0.75rem", width: "100%" }, onClick: onEmailSubmit, children: "Submit" })
|
|
450
467
|
] }),
|
|
451
468
|
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
|
|
452
469
|
/* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
|
|
@@ -634,13 +651,23 @@ function RampWidgetTemplate({
|
|
|
634
651
|
const isDark = theme === "dark";
|
|
635
652
|
const cssVars = {
|
|
636
653
|
"--pollar-accent": accentColor,
|
|
637
|
-
"--pollar-buttons-border-radius": "6px",
|
|
638
|
-
"--pollar-buttons-height": "44px",
|
|
639
654
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
640
655
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
641
656
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
642
657
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
643
|
-
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
|
|
658
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
659
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
660
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
661
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
662
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
663
|
+
"--pollar-buttons-border-radius": "6px",
|
|
664
|
+
"--pollar-buttons-height": "44px",
|
|
665
|
+
"--pollar-input-height": "44px",
|
|
666
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
667
|
+
"--pollar-card-border-radius": "10px",
|
|
668
|
+
"--pollar-modal-padding": "2rem",
|
|
669
|
+
"--pollar-modal-heading-size": "1.375rem",
|
|
670
|
+
"--pollar-modal-subtitle-size": "0.9rem"
|
|
644
671
|
};
|
|
645
672
|
const stepTitle = {
|
|
646
673
|
input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
|
|
@@ -654,7 +681,7 @@ function RampWidgetTemplate({
|
|
|
654
681
|
select_route: "All prices include fees",
|
|
655
682
|
payment_instructions: "Send the exact amount to complete your transaction"
|
|
656
683
|
};
|
|
657
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
684
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
658
685
|
/* @__PURE__ */ jsxs("div", { className: "pollar-ramp-header", children: [
|
|
659
686
|
/* @__PURE__ */ jsx("h2", { className: "pollar-ramp-title", children: stepTitle[step] }),
|
|
660
687
|
/* @__PURE__ */ jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
|
|
@@ -893,15 +920,20 @@ function TransactionModalTemplate({
|
|
|
893
920
|
const isDark = theme === "dark";
|
|
894
921
|
const cssVars = {
|
|
895
922
|
"--pollar-accent": accentColor,
|
|
896
|
-
"--pollar-buttons-border-radius": "8px",
|
|
897
|
-
"--pollar-buttons-height": "44px",
|
|
898
923
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
899
924
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
900
925
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
901
926
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
902
|
-
"--pollar-input-bg": isDark ? "#374151" : "
|
|
927
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
928
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
929
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
903
930
|
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
904
|
-
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
|
|
931
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
932
|
+
"--pollar-buttons-border-radius": "6px",
|
|
933
|
+
"--pollar-buttons-height": "44px",
|
|
934
|
+
"--pollar-input-height": "44px",
|
|
935
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
936
|
+
"--pollar-card-border-radius": "10px"
|
|
905
937
|
};
|
|
906
938
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
907
939
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
@@ -911,7 +943,7 @@ function TransactionModalTemplate({
|
|
|
911
943
|
const isSuccess = transaction.step === "success";
|
|
912
944
|
const isError = transaction.step === "error";
|
|
913
945
|
const showDetails = buildData !== null && (isBuilt || isSigning || isSuccess);
|
|
914
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
946
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
915
947
|
/* @__PURE__ */ jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction" }) }),
|
|
916
948
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx(
|
|
917
949
|
"svg",
|
|
@@ -1087,7 +1119,7 @@ function TransactionModal({ onClose }) {
|
|
|
1087
1119
|
const [copied, setCopied] = useState(false);
|
|
1088
1120
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
1089
1121
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
1090
|
-
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
|
|
1122
|
+
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
1091
1123
|
const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
|
|
1092
1124
|
function handleSignAndSend() {
|
|
1093
1125
|
if (transaction.step === "built") {
|
|
@@ -1144,15 +1176,20 @@ function TxHistoryModalTemplate({
|
|
|
1144
1176
|
const isDark = theme === "dark";
|
|
1145
1177
|
const cssVars = {
|
|
1146
1178
|
"--pollar-accent": accentColor,
|
|
1147
|
-
"--pollar-buttons-border-radius": "8px",
|
|
1148
|
-
"--pollar-buttons-height": "44px",
|
|
1149
1179
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
1150
1180
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
1151
1181
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
1152
1182
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
1153
|
-
"--pollar-input-bg": isDark ? "#374151" : "
|
|
1183
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
1184
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
1185
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
1154
1186
|
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
1155
|
-
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
|
|
1187
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
1188
|
+
"--pollar-buttons-border-radius": "6px",
|
|
1189
|
+
"--pollar-buttons-height": "44px",
|
|
1190
|
+
"--pollar-input-height": "44px",
|
|
1191
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
1192
|
+
"--pollar-card-border-radius": "10px"
|
|
1156
1193
|
};
|
|
1157
1194
|
const isLoading = txHistory.step === "loading";
|
|
1158
1195
|
const records = txHistory.step === "loaded" ? txHistory.data.records : [];
|
|
@@ -1160,7 +1197,7 @@ function TxHistoryModalTemplate({
|
|
|
1160
1197
|
const hasPrev = offset > 0;
|
|
1161
1198
|
const hasNext = offset + PAGE_SIZE < total;
|
|
1162
1199
|
const showPagination = txHistory.step === "loaded" && total > PAGE_SIZE;
|
|
1163
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1200
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1164
1201
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
1165
1202
|
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
|
|
1166
1203
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
@@ -1198,22 +1235,33 @@ function TxHistoryModalTemplate({
|
|
|
1198
1235
|
isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
1199
1236
|
txHistory.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
|
|
1200
1237
|
txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
|
|
1201
|
-
records.map((record) =>
|
|
1202
|
-
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
|
|
1205
|
-
/* @__PURE__ */ jsx(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
record.feeXlm,
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1238
|
+
records.map((record) => {
|
|
1239
|
+
const explorerUrl = `https://stellar.expert/explorer/${record.network === "testnet" ? "testnet" : "public"}/tx/${record.hash}`;
|
|
1240
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-hist-item", children: [
|
|
1241
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
|
|
1242
|
+
/* @__PURE__ */ jsx(StatusBadge, { status: record.status }),
|
|
1243
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-meta", children: [
|
|
1244
|
+
/* @__PURE__ */ jsx("span", { children: record.operation }),
|
|
1245
|
+
record.feeXlm && /* @__PURE__ */ jsxs("span", { children: [
|
|
1246
|
+
"\xB7 ",
|
|
1247
|
+
record.feeXlm,
|
|
1248
|
+
" XLM"
|
|
1249
|
+
] }),
|
|
1250
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1251
|
+
"\xB7 ",
|
|
1252
|
+
formatDate(record.createdAt)
|
|
1253
|
+
] }),
|
|
1254
|
+
/* @__PURE__ */ jsx("span", { children: "\xB7" }),
|
|
1255
|
+
/* @__PURE__ */ jsxs("a", { className: "pollar-hist-item-explorer", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": "View on Stellar Explorer", children: [
|
|
1256
|
+
/* @__PURE__ */ jsxs("svg", { width: "11", height: "11", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
1257
|
+
/* @__PURE__ */ jsx("path", { d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
1258
|
+
/* @__PURE__ */ jsx("path", { d: "M8 1h4m0 0v4m0-4L6 7", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1259
|
+
] }),
|
|
1260
|
+
"Explorer"
|
|
1261
|
+
] })
|
|
1214
1262
|
] })
|
|
1215
|
-
] })
|
|
1216
|
-
|
|
1263
|
+
] }, record.id);
|
|
1264
|
+
})
|
|
1217
1265
|
] }),
|
|
1218
1266
|
showPagination && /* @__PURE__ */ jsxs("div", { className: "pollar-hist-pagination", children: [
|
|
1219
1267
|
/* @__PURE__ */ jsxs("span", { className: "pollar-hist-pagination-info", children: [
|
|
@@ -1290,12 +1338,20 @@ function WalletBalanceModalTemplate({
|
|
|
1290
1338
|
"--pollar-border": isDark ? "#374151" : "#e5e7eb",
|
|
1291
1339
|
"--pollar-text": isDark ? "#ffffff" : "#111827",
|
|
1292
1340
|
"--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
|
|
1293
|
-
"--pollar-input-bg": isDark ? "#374151" : "
|
|
1294
|
-
"--pollar-error-
|
|
1341
|
+
"--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
|
|
1342
|
+
"--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
|
|
1343
|
+
"--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
|
|
1344
|
+
"--pollar-error-text": isDark ? "#f87171" : "#dc2626",
|
|
1345
|
+
"--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
|
|
1346
|
+
"--pollar-buttons-border-radius": "6px",
|
|
1347
|
+
"--pollar-buttons-height": "44px",
|
|
1348
|
+
"--pollar-input-height": "44px",
|
|
1349
|
+
"--pollar-input-border-radius": "0.5rem",
|
|
1350
|
+
"--pollar-card-border-radius": "10px"
|
|
1295
1351
|
};
|
|
1296
1352
|
const isLoading = walletBalance.step === "loading";
|
|
1297
1353
|
const data = walletBalance.step === "loaded" ? walletBalance.data : null;
|
|
1298
|
-
return /* @__PURE__ */ jsxs("div", { className: "pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1354
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
1299
1355
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
1300
1356
|
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
|
|
1301
1357
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
@@ -1362,7 +1418,7 @@ async function fetchRemoteConfig(client) {
|
|
|
1362
1418
|
return content ?? emptyResponse;
|
|
1363
1419
|
}
|
|
1364
1420
|
var PollarContext = createContext(null);
|
|
1365
|
-
function PollarProvider({ config, styles: propStyles, children }) {
|
|
1421
|
+
function PollarProvider({ config, styles: propStyles, adapters, children }) {
|
|
1366
1422
|
const [pollarClient] = useState(() => new PollarClient(config));
|
|
1367
1423
|
const [networkState, setNetworkState] = useState(() => pollarClient.getNetworkState());
|
|
1368
1424
|
const [sessionState, setSessionState] = useState(null);
|
|
@@ -1444,7 +1500,8 @@ function PollarProvider({ config, styles: propStyles, children }) {
|
|
|
1444
1500
|
network: networkState.step === "connected" ? networkState.network : "testnet",
|
|
1445
1501
|
setNetwork: (network) => pollarClient.setNetwork(network),
|
|
1446
1502
|
config: remoteConfig,
|
|
1447
|
-
styles
|
|
1503
|
+
styles,
|
|
1504
|
+
adapters
|
|
1448
1505
|
}),
|
|
1449
1506
|
[sessionState, remoteConfig, styles, pollarClient, transaction, txHistory, networkState, walletBalance]
|
|
1450
1507
|
);
|
|
@@ -1473,6 +1530,26 @@ function usePollar() {
|
|
|
1473
1530
|
}
|
|
1474
1531
|
return ctx;
|
|
1475
1532
|
}
|
|
1533
|
+
|
|
1534
|
+
// src/usePollarAdapter.ts
|
|
1535
|
+
function createPollarAdapterHook(key) {
|
|
1536
|
+
return function usePollarAdapter() {
|
|
1537
|
+
const { adapters, signAndSubmitTx } = usePollar();
|
|
1538
|
+
const adapter = adapters?.[key];
|
|
1539
|
+
if (!adapter) {
|
|
1540
|
+
throw new Error(`No adapter "${key}" provided to PollarProvider`);
|
|
1541
|
+
}
|
|
1542
|
+
return Object.fromEntries(
|
|
1543
|
+
Object.entries(adapter).map(([name, fn]) => [
|
|
1544
|
+
name,
|
|
1545
|
+
async (params) => {
|
|
1546
|
+
const { unsignedTransaction } = await fn(params);
|
|
1547
|
+
await signAndSubmitTx(unsignedTransaction);
|
|
1548
|
+
}
|
|
1549
|
+
])
|
|
1550
|
+
);
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1476
1553
|
function ButtonLogo() {
|
|
1477
1554
|
return /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
|
|
1478
1555
|
}
|
|
@@ -1682,6 +1759,6 @@ function WalletButton() {
|
|
|
1682
1759
|
);
|
|
1683
1760
|
}
|
|
1684
1761
|
|
|
1685
|
-
export { KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, RouteDisplay, TransactionModalTemplate, TxHistoryModalTemplate, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, usePollar };
|
|
1762
|
+
export { KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, RouteDisplay, TransactionModalTemplate, TxHistoryModalTemplate, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, createPollarAdapterHook, usePollar };
|
|
1686
1763
|
//# sourceMappingURL=index.mjs.map
|
|
1687
1764
|
//# sourceMappingURL=index.mjs.map
|