@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.js CHANGED
@@ -38,7 +38,7 @@ var PollarModalFooter = () => {
38
38
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
39
39
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
40
40
  "v",
41
- "0.5.2"
41
+ "0.5.3"
42
42
  ] })
43
43
  ] })
44
44
  ] });
@@ -98,15 +98,25 @@ function KycModalTemplate({
98
98
  const isDark = theme === "dark";
99
99
  const cssVars = {
100
100
  "--pollar-accent": accentColor,
101
- "--pollar-buttons-border-radius": "6px",
102
- "--pollar-buttons-height": "44px",
103
101
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
104
102
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
105
103
  "--pollar-text": isDark ? "#ffffff" : "#111827",
106
104
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
107
- "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
105
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
106
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
107
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
108
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
109
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
110
+ "--pollar-buttons-border-radius": "6px",
111
+ "--pollar-buttons-height": "44px",
112
+ "--pollar-input-height": "44px",
113
+ "--pollar-input-border-radius": "0.5rem",
114
+ "--pollar-card-border-radius": "10px",
115
+ "--pollar-modal-padding": "2rem",
116
+ "--pollar-modal-heading-size": "1.375rem",
117
+ "--pollar-modal-subtitle-size": "0.9rem"
108
118
  };
109
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
119
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
110
120
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-kyc-header", children: [
111
121
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
112
122
  /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-kyc-subtitle", children: [
@@ -376,16 +386,23 @@ function LoginModalTemplate({
376
386
  const enabledSocial = Object.entries(providers).filter(([, enabled]) => enabled);
377
387
  const cssVars = {
378
388
  "--pollar-accent": accentColor,
379
- "--pollar-buttons-border-radius": "6px",
380
- "--pollar-buttons-height": "44px",
381
389
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
382
390
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
383
391
  "--pollar-text": isDark ? "#ffffff" : "#111827",
384
392
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
385
- "--pollar-input-bg": isDark ? "#374151" : "#ffffff",
393
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
386
394
  "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
387
395
  "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
388
- "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
396
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
397
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
398
+ "--pollar-buttons-border-radius": "6px",
399
+ "--pollar-buttons-height": "44px",
400
+ "--pollar-input-height": "44px",
401
+ "--pollar-input-border-radius": "0.5rem",
402
+ "--pollar-card-border-radius": "10px",
403
+ "--pollar-modal-padding": "2rem",
404
+ "--pollar-modal-heading-size": "1.375rem",
405
+ "--pollar-modal-subtitle-size": "0.9rem"
389
406
  };
390
407
  const status = authStateToStatus(authState.step);
391
408
  const isLoading = status === "LOADING";
@@ -393,7 +410,7 @@ function LoginModalTemplate({
393
410
  const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
394
411
  const statusMessage = authState.step === "error" ? authState.message : AUTH_STATE_MESSAGES[authState.step];
395
412
  const BackButton = ({ onClick }) => /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M15 19l-7-7 7-7" }) }) });
396
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
413
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
397
414
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }),
398
415
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-header", children: [
399
416
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoUrl ?? LOGO_POLLAR, alt: "Logo", className: "pollar-logo" }) }),
@@ -448,7 +465,7 @@ function LoginModalTemplate({
448
465
  onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
449
466
  }
450
467
  ),
451
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-submit-btn", onClick: onEmailSubmit, children: "Submit" })
468
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-btn-primary", style: { marginTop: "0.75rem", width: "100%" }, onClick: onEmailSubmit, children: "Submit" })
452
469
  ] }),
453
470
  emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-divider", children: [
454
471
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-divider-line" }),
@@ -636,13 +653,23 @@ function RampWidgetTemplate({
636
653
  const isDark = theme === "dark";
637
654
  const cssVars = {
638
655
  "--pollar-accent": accentColor,
639
- "--pollar-buttons-border-radius": "6px",
640
- "--pollar-buttons-height": "44px",
641
656
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
642
657
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
643
658
  "--pollar-text": isDark ? "#ffffff" : "#111827",
644
659
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
645
- "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
660
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
661
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
662
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
663
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
664
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
665
+ "--pollar-buttons-border-radius": "6px",
666
+ "--pollar-buttons-height": "44px",
667
+ "--pollar-input-height": "44px",
668
+ "--pollar-input-border-radius": "0.5rem",
669
+ "--pollar-card-border-radius": "10px",
670
+ "--pollar-modal-padding": "2rem",
671
+ "--pollar-modal-heading-size": "1.375rem",
672
+ "--pollar-modal-subtitle-size": "0.9rem"
646
673
  };
647
674
  const stepTitle = {
648
675
  input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
@@ -656,7 +683,7 @@ function RampWidgetTemplate({
656
683
  select_route: "All prices include fees",
657
684
  payment_instructions: "Send the exact amount to complete your transaction"
658
685
  };
659
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
686
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
660
687
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-header", children: [
661
688
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-ramp-title", children: stepTitle[step] }),
662
689
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
@@ -895,15 +922,20 @@ function TransactionModalTemplate({
895
922
  const isDark = theme === "dark";
896
923
  const cssVars = {
897
924
  "--pollar-accent": accentColor,
898
- "--pollar-buttons-border-radius": "8px",
899
- "--pollar-buttons-height": "44px",
900
925
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
901
926
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
902
927
  "--pollar-text": isDark ? "#ffffff" : "#111827",
903
928
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
904
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
929
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
930
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
931
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
905
932
  "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
906
- "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
933
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
934
+ "--pollar-buttons-border-radius": "6px",
935
+ "--pollar-buttons-height": "44px",
936
+ "--pollar-input-height": "44px",
937
+ "--pollar-input-border-radius": "0.5rem",
938
+ "--pollar-card-border-radius": "10px"
907
939
  };
908
940
  const buildData = "buildData" in transaction ? transaction.buildData : null;
909
941
  const hash = transaction.step === "success" ? transaction.hash : null;
@@ -913,7 +945,7 @@ function TransactionModalTemplate({
913
945
  const isSuccess = transaction.step === "success";
914
946
  const isError = transaction.step === "error";
915
947
  const showDetails = buildData !== null && (isBuilt || isSigning || isSuccess);
916
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
948
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
917
949
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction" }) }),
918
950
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx(
919
951
  "svg",
@@ -1089,7 +1121,7 @@ function TransactionModal({ onClose }) {
1089
1121
  const [copied, setCopied] = react.useState(false);
1090
1122
  const hash = transaction.step === "success" ? transaction.hash : null;
1091
1123
  const buildData = "buildData" in transaction ? transaction.buildData : null;
1092
- const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
1124
+ const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
1093
1125
  const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
1094
1126
  function handleSignAndSend() {
1095
1127
  if (transaction.step === "built") {
@@ -1146,15 +1178,20 @@ function TxHistoryModalTemplate({
1146
1178
  const isDark = theme === "dark";
1147
1179
  const cssVars = {
1148
1180
  "--pollar-accent": accentColor,
1149
- "--pollar-buttons-border-radius": "8px",
1150
- "--pollar-buttons-height": "44px",
1151
1181
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1152
1182
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1153
1183
  "--pollar-text": isDark ? "#ffffff" : "#111827",
1154
1184
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1155
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1185
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
1186
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
1187
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1156
1188
  "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1157
- "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
1189
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1190
+ "--pollar-buttons-border-radius": "6px",
1191
+ "--pollar-buttons-height": "44px",
1192
+ "--pollar-input-height": "44px",
1193
+ "--pollar-input-border-radius": "0.5rem",
1194
+ "--pollar-card-border-radius": "10px"
1158
1195
  };
1159
1196
  const isLoading = txHistory.step === "loading";
1160
1197
  const records = txHistory.step === "loaded" ? txHistory.data.records : [];
@@ -1162,7 +1199,7 @@ function TxHistoryModalTemplate({
1162
1199
  const hasPrev = offset > 0;
1163
1200
  const hasNext = offset + PAGE_SIZE < total;
1164
1201
  const showPagination = txHistory.step === "loaded" && total > PAGE_SIZE;
1165
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1202
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1166
1203
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1167
1204
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
1168
1205
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
@@ -1200,22 +1237,33 @@ function TxHistoryModalTemplate({
1200
1237
  isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1201
1238
  txHistory.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
1202
1239
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
1203
- records.map((record) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-item", children: [
1204
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
1205
- /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
1206
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-item-meta", children: [
1207
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: record.operation }),
1208
- record.feeXlm && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1209
- "\xB7 ",
1210
- record.feeXlm,
1211
- " XLM"
1212
- ] }),
1213
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1214
- "\xB7 ",
1215
- formatDate(record.createdAt)
1240
+ records.map((record) => {
1241
+ const explorerUrl = `https://stellar.expert/explorer/${record.network === "testnet" ? "testnet" : "public"}/tx/${record.hash}`;
1242
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-item", children: [
1243
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
1244
+ /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: record.status }),
1245
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-item-meta", children: [
1246
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: record.operation }),
1247
+ record.feeXlm && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1248
+ "\xB7 ",
1249
+ record.feeXlm,
1250
+ " XLM"
1251
+ ] }),
1252
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1253
+ "\xB7 ",
1254
+ formatDate(record.createdAt)
1255
+ ] }),
1256
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "\xB7" }),
1257
+ /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "pollar-hist-item-explorer", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": "View on Stellar Explorer", children: [
1258
+ /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "11", height: "11", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
1259
+ /* @__PURE__ */ jsxRuntime.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" }),
1260
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 1h4m0 0v4m0-4L6 7", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
1261
+ ] }),
1262
+ "Explorer"
1263
+ ] })
1216
1264
  ] })
1217
- ] })
1218
- ] }, record.id))
1265
+ ] }, record.id);
1266
+ })
1219
1267
  ] }),
1220
1268
  showPagination && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-hist-pagination", children: [
1221
1269
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-hist-pagination-info", children: [
@@ -1292,12 +1340,20 @@ function WalletBalanceModalTemplate({
1292
1340
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1293
1341
  "--pollar-text": isDark ? "#ffffff" : "#111827",
1294
1342
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1295
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1296
- "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
1343
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
1344
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
1345
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1346
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1347
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1348
+ "--pollar-buttons-border-radius": "6px",
1349
+ "--pollar-buttons-height": "44px",
1350
+ "--pollar-input-height": "44px",
1351
+ "--pollar-input-border-radius": "0.5rem",
1352
+ "--pollar-card-border-radius": "10px"
1297
1353
  };
1298
1354
  const isLoading = walletBalance.step === "loading";
1299
1355
  const data = walletBalance.step === "loaded" ? walletBalance.data : null;
1300
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1356
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-card pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1301
1357
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
1302
1358
  /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
1303
1359
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
@@ -1364,7 +1420,7 @@ async function fetchRemoteConfig(client) {
1364
1420
  return content ?? emptyResponse;
1365
1421
  }
1366
1422
  var PollarContext = react.createContext(null);
1367
- function PollarProvider({ config, styles: propStyles, children }) {
1423
+ function PollarProvider({ config, styles: propStyles, adapters, children }) {
1368
1424
  const [pollarClient] = react.useState(() => new core.PollarClient(config));
1369
1425
  const [networkState, setNetworkState] = react.useState(() => pollarClient.getNetworkState());
1370
1426
  const [sessionState, setSessionState] = react.useState(null);
@@ -1446,7 +1502,8 @@ function PollarProvider({ config, styles: propStyles, children }) {
1446
1502
  network: networkState.step === "connected" ? networkState.network : "testnet",
1447
1503
  setNetwork: (network) => pollarClient.setNetwork(network),
1448
1504
  config: remoteConfig,
1449
- styles
1505
+ styles,
1506
+ adapters
1450
1507
  }),
1451
1508
  [sessionState, remoteConfig, styles, pollarClient, transaction, txHistory, networkState, walletBalance]
1452
1509
  );
@@ -1475,6 +1532,26 @@ function usePollar() {
1475
1532
  }
1476
1533
  return ctx;
1477
1534
  }
1535
+
1536
+ // src/usePollarAdapter.ts
1537
+ function createPollarAdapterHook(key) {
1538
+ return function usePollarAdapter() {
1539
+ const { adapters, signAndSubmitTx } = usePollar();
1540
+ const adapter = adapters?.[key];
1541
+ if (!adapter) {
1542
+ throw new Error(`No adapter "${key}" provided to PollarProvider`);
1543
+ }
1544
+ return Object.fromEntries(
1545
+ Object.entries(adapter).map(([name, fn]) => [
1546
+ name,
1547
+ async (params) => {
1548
+ const { unsignedTransaction } = await fn(params);
1549
+ await signAndSubmitTx(unsignedTransaction);
1550
+ }
1551
+ ])
1552
+ );
1553
+ };
1554
+ }
1478
1555
  function ButtonLogo() {
1479
1556
  return /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
1480
1557
  }
@@ -1697,6 +1774,7 @@ exports.TxHistoryModalTemplate = TxHistoryModalTemplate;
1697
1774
  exports.WalletBalanceModal = WalletBalanceModal;
1698
1775
  exports.WalletBalanceModalTemplate = WalletBalanceModalTemplate;
1699
1776
  exports.WalletButton = WalletButton;
1777
+ exports.createPollarAdapterHook = createPollarAdapterHook;
1700
1778
  exports.usePollar = usePollar;
1701
1779
  //# sourceMappingURL=index.js.map
1702
1780
  //# sourceMappingURL=index.js.map