@pollar/react 0.9.0 → 0.10.0-rc.8
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 +3 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +24 -9
- package/dist/index.d.ts +24 -9
- package/dist/index.js +169 -179
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -179
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1035,7 +1035,7 @@ var PollarModalFooter = () => {
|
|
|
1035
1035
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
|
|
1036
1036
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1037
1037
|
"v",
|
|
1038
|
-
"0.
|
|
1038
|
+
"0.10.0-rc.8"
|
|
1039
1039
|
] })
|
|
1040
1040
|
] })
|
|
1041
1041
|
] });
|
|
@@ -1340,54 +1340,63 @@ function EnabledAssetsModalTemplate({
|
|
|
1340
1340
|
const isLoading = enabledAssets.step === "loading";
|
|
1341
1341
|
const data = enabledAssets.step === "loaded" ? enabledAssets.data : null;
|
|
1342
1342
|
const busy = busyKey !== null;
|
|
1343
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1343
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1344
|
+
"div",
|
|
1345
|
+
{
|
|
1346
|
+
className: "pollar-modal-card pollar-asset-modal",
|
|
1347
|
+
"data-theme": theme,
|
|
1348
|
+
style: cssVars,
|
|
1349
|
+
onClick: (e) => e.stopPropagation(),
|
|
1350
|
+
children: [
|
|
1351
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
|
|
1352
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Trustlines" }),
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
1354
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-modal-refresh-btn", onClick: onRefresh, disabled: isLoading || busy, children: [
|
|
1355
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1356
|
+
"svg",
|
|
1357
|
+
{
|
|
1358
|
+
className: `pollar-modal-refresh-icon${isLoading ? " spinning" : ""}`,
|
|
1359
|
+
width: "13",
|
|
1360
|
+
height: "13",
|
|
1361
|
+
viewBox: "0 0 13 13",
|
|
1362
|
+
fill: "none",
|
|
1363
|
+
"aria-hidden": true,
|
|
1364
|
+
children: [
|
|
1365
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M11.5 6.5a5 5 0 11-1.5-3.536", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
1366
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 1v3h-3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1367
|
+
]
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
"Refresh"
|
|
1371
|
+
] }),
|
|
1372
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
1373
|
+
] })
|
|
1364
1374
|
] }),
|
|
1365
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
] });
|
|
1375
|
+
walletAddress && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-asset-address", children: cropAddress(walletAddress) }),
|
|
1376
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
|
|
1377
|
+
enabledAssets.step === "error" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: enabledAssets.message }),
|
|
1378
|
+
actionError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-action-error", children: actionError }),
|
|
1379
|
+
data && !data.exists && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-empty", children: [
|
|
1380
|
+
"Account not found on ",
|
|
1381
|
+
data.network,
|
|
1382
|
+
"."
|
|
1383
|
+
] }),
|
|
1384
|
+
data && data.assets.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-empty", children: "No trustlines found." }),
|
|
1385
|
+
data && data.assets.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-asset-list", children: data.assets.map((a) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1386
|
+
AssetItem,
|
|
1387
|
+
{
|
|
1388
|
+
record: a,
|
|
1389
|
+
busy: busyKey === assetKey(a),
|
|
1390
|
+
disabled: busy && busyKey !== assetKey(a),
|
|
1391
|
+
onToggle: onToggleTrustline
|
|
1392
|
+
},
|
|
1393
|
+
assetKey(a)
|
|
1394
|
+
)) }),
|
|
1395
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-asset-add-custom", onClick: onAddCustom, disabled: busy, children: "+ Add custom trustline" }),
|
|
1396
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
);
|
|
1391
1400
|
}
|
|
1392
1401
|
function isValidIssuer(issuer) {
|
|
1393
1402
|
return issuer.length === 56 && issuer.startsWith("G");
|
|
@@ -1413,79 +1422,89 @@ function CustomTrustlineModalTemplate({
|
|
|
1413
1422
|
const trimmedLimit = limit.trim();
|
|
1414
1423
|
onSubmit({ code: code.trim(), issuer: issuer.trim(), ...trimmedLimit ? { limit: trimmedLimit } : {} });
|
|
1415
1424
|
};
|
|
1416
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
{
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1425
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1426
|
+
"div",
|
|
1427
|
+
{
|
|
1428
|
+
className: "pollar-modal-card pollar-asset-modal",
|
|
1429
|
+
"data-theme": theme,
|
|
1430
|
+
style: cssVars,
|
|
1431
|
+
onClick: (e) => e.stopPropagation(),
|
|
1432
|
+
children: [
|
|
1433
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header", children: [
|
|
1434
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-back", onClick: onBack, disabled: busy, "aria-label": "Back", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
1436
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "pollar-modal-title", children: "Add custom trustline" })
|
|
1437
|
+
] }),
|
|
1438
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
|
|
1439
|
+
] }),
|
|
1440
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-asset-custom-hint", children: "Custom trustlines aren't sponsored \u2014 your wallet pays the 0.5 XLM reserve and the transaction fee." }),
|
|
1441
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-field", children: [
|
|
1442
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-label", htmlFor: "pollar-trustline-code", children: "Asset code" }),
|
|
1443
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1444
|
+
"input",
|
|
1445
|
+
{
|
|
1446
|
+
id: "pollar-trustline-code",
|
|
1447
|
+
className: "pollar-input",
|
|
1448
|
+
value: code,
|
|
1449
|
+
onChange: (e) => setCode(e.target.value),
|
|
1450
|
+
placeholder: "USDC",
|
|
1451
|
+
maxLength: 12,
|
|
1452
|
+
autoComplete: "off",
|
|
1453
|
+
spellCheck: false,
|
|
1454
|
+
disabled: busy
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
] }),
|
|
1458
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-field", children: [
|
|
1459
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-label", htmlFor: "pollar-trustline-issuer", children: "Issuer" }),
|
|
1460
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1461
|
+
"input",
|
|
1462
|
+
{
|
|
1463
|
+
id: "pollar-trustline-issuer",
|
|
1464
|
+
className: "pollar-input",
|
|
1465
|
+
value: issuer,
|
|
1466
|
+
onChange: (e) => setIssuer(e.target.value),
|
|
1467
|
+
placeholder: "G\u2026",
|
|
1468
|
+
autoComplete: "off",
|
|
1469
|
+
spellCheck: false,
|
|
1470
|
+
disabled: busy
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
issuer.trim().length > 0 && !issuerOk && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-field-error", children: "Issuer must be a 56-character Stellar address starting with G." })
|
|
1474
|
+
] }),
|
|
1475
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-field", children: [
|
|
1476
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "pollar-label", htmlFor: "pollar-trustline-limit", children: [
|
|
1477
|
+
"Limit ",
|
|
1478
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-label-optional", children: "(optional)" })
|
|
1479
|
+
] }),
|
|
1480
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1481
|
+
"input",
|
|
1482
|
+
{
|
|
1483
|
+
id: "pollar-trustline-limit",
|
|
1484
|
+
className: "pollar-input",
|
|
1485
|
+
value: limit,
|
|
1486
|
+
onChange: (e) => setLimit(e.target.value),
|
|
1487
|
+
placeholder: "Maximum",
|
|
1488
|
+
inputMode: "decimal",
|
|
1489
|
+
autoComplete: "off",
|
|
1490
|
+
spellCheck: false,
|
|
1491
|
+
disabled: busy
|
|
1492
|
+
}
|
|
1493
|
+
)
|
|
1494
|
+
] }),
|
|
1495
|
+
actionError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-action-error", children: actionError }),
|
|
1496
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-asset-submit", onClick: submit, disabled: !canSubmit, children: busy ? "Enabling\u2026" : "Enable trustline" }),
|
|
1497
|
+
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
1498
|
+
]
|
|
1499
|
+
}
|
|
1500
|
+
);
|
|
1483
1501
|
}
|
|
1484
1502
|
function assetKey2(record) {
|
|
1485
1503
|
return record.code + (record.issuer ?? "");
|
|
1486
1504
|
}
|
|
1487
1505
|
function EnabledAssetsModal({ onClose }) {
|
|
1488
|
-
const { enabledAssets, refreshAssets, setTrustline,
|
|
1506
|
+
const { enabledAssets, refreshAssets, setTrustline, wallet, styles } = usePollar();
|
|
1507
|
+
const walletAddress = wallet?.address ?? "";
|
|
1489
1508
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
1490
1509
|
const [view, setView] = react.useState("list");
|
|
1491
1510
|
const [busyKey, setBusyKey] = react.useState(null);
|
|
@@ -1833,35 +1852,15 @@ var GoogleButton = ({ disabled, onClick }) => {
|
|
|
1833
1852
|
] })
|
|
1834
1853
|
] });
|
|
1835
1854
|
};
|
|
1836
|
-
function
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
children: [
|
|
1846
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_FREIGHTER, alt: "Freighter", className: "pollar-wallet-list-icon" }),
|
|
1847
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Freighter" })
|
|
1848
|
-
]
|
|
1849
|
-
}
|
|
1850
|
-
),
|
|
1851
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1852
|
-
"button",
|
|
1853
|
-
{
|
|
1854
|
-
type: "button",
|
|
1855
|
-
disabled: isLoading,
|
|
1856
|
-
className: "pollar-wallet-list-btn",
|
|
1857
|
-
onClick: () => onConnect(core.WalletType.ALBEDO),
|
|
1858
|
-
children: [
|
|
1859
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_ALBEDO, alt: "Albedo", className: "pollar-wallet-list-icon" }),
|
|
1860
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: "Albedo" })
|
|
1861
|
-
]
|
|
1862
|
-
}
|
|
1863
|
-
)
|
|
1864
|
-
] });
|
|
1855
|
+
function WalletAdapterButtons({
|
|
1856
|
+
walletAdapters,
|
|
1857
|
+
onConnect,
|
|
1858
|
+
isLoading
|
|
1859
|
+
}) {
|
|
1860
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-wallet-list", children: walletAdapters.map((a) => /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", disabled: isLoading, className: "pollar-wallet-list-btn", onClick: () => onConnect(a.id), children: [
|
|
1861
|
+
a.meta.iconUrl && /* @__PURE__ */ jsxRuntime.jsx("img", { src: a.meta.iconUrl, alt: a.meta.label, className: "pollar-wallet-list-icon" }),
|
|
1862
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-wallet-list-name", children: a.meta.label })
|
|
1863
|
+
] }, a.id)) });
|
|
1865
1864
|
}
|
|
1866
1865
|
var AUTH_STATE_MESSAGES = {
|
|
1867
1866
|
idle: "",
|
|
@@ -1872,6 +1871,7 @@ var AUTH_STATE_MESSAGES = {
|
|
|
1872
1871
|
verifying_email_code: "Verifying\u2026",
|
|
1873
1872
|
opening_oauth: "Redirecting\u2026",
|
|
1874
1873
|
connecting_wallet: "Connecting wallet\u2026",
|
|
1874
|
+
signing_wallet_challenge: "Confirm in your wallet\u2026",
|
|
1875
1875
|
wallet_not_installed: "Wallet not installed",
|
|
1876
1876
|
authenticating_wallet: "Signing in with wallet\u2026",
|
|
1877
1877
|
creating_passkey: "Waiting for passkey\u2026",
|
|
@@ -1887,6 +1887,7 @@ function authStateToStatus(step) {
|
|
|
1887
1887
|
"verifying_email_code",
|
|
1888
1888
|
"opening_oauth",
|
|
1889
1889
|
"connecting_wallet",
|
|
1890
|
+
"signing_wallet_challenge",
|
|
1890
1891
|
"authenticating_wallet",
|
|
1891
1892
|
"creating_passkey",
|
|
1892
1893
|
"deploying_smart_account",
|
|
@@ -1907,6 +1908,7 @@ function LoginModalTemplate({
|
|
|
1907
1908
|
embeddedWallets,
|
|
1908
1909
|
smartWallet = false,
|
|
1909
1910
|
providers,
|
|
1911
|
+
walletAdapters,
|
|
1910
1912
|
appName,
|
|
1911
1913
|
email = "",
|
|
1912
1914
|
onEmailChange,
|
|
@@ -1993,32 +1995,13 @@ function LoginModalTemplate({
|
|
|
1993
1995
|
] }) : showWalletPicker ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1994
1996
|
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowWalletPicker(false) }),
|
|
1995
1997
|
renderWallets ? renderWallets({ onConnect: onWalletConnect ?? (() => {
|
|
1996
|
-
}), authState }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1998
|
+
}), authState }) : /* @__PURE__ */ jsxRuntime.jsx(WalletAdapterButtons, { walletAdapters, onConnect: onWalletConnect ?? (() => {
|
|
1997
1999
|
}), isLoading })
|
|
1998
2000
|
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1999
2001
|
/* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
2000
2002
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-wallet-section", children: [
|
|
2001
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2002
|
-
|
|
2003
|
-
{
|
|
2004
|
-
type: "button",
|
|
2005
|
-
disabled: isLoading,
|
|
2006
|
-
className: "pollar-btn-primary",
|
|
2007
|
-
style: { width: "100%" },
|
|
2008
|
-
onClick: onCreateSmartWallet,
|
|
2009
|
-
children: "Create a new wallet"
|
|
2010
|
-
}
|
|
2011
|
-
),
|
|
2012
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2013
|
-
"button",
|
|
2014
|
-
{
|
|
2015
|
-
type: "button",
|
|
2016
|
-
disabled: isLoading,
|
|
2017
|
-
className: "pollar-wallet-entry-btn",
|
|
2018
|
-
onClick: onLoginSmartWallet,
|
|
2019
|
-
children: "Log in with an existing wallet"
|
|
2020
|
-
}
|
|
2021
|
-
)
|
|
2003
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: "Create a new wallet" }),
|
|
2004
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: "Log in with an existing wallet" })
|
|
2022
2005
|
] })
|
|
2023
2006
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2024
2007
|
emailEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-email-section", children: [
|
|
@@ -2040,7 +2023,7 @@ function LoginModalTemplate({
|
|
|
2040
2023
|
type: "button",
|
|
2041
2024
|
disabled: isLoading || !email,
|
|
2042
2025
|
className: "pollar-btn-primary",
|
|
2043
|
-
style: { marginTop: "0.75rem"
|
|
2026
|
+
style: { marginTop: "0.75rem" },
|
|
2044
2027
|
onClick: onEmailSubmit,
|
|
2045
2028
|
children: "Submit"
|
|
2046
2029
|
}
|
|
@@ -2125,6 +2108,7 @@ function LoginModal({ onClose }) {
|
|
|
2125
2108
|
const [email, setEmail] = react.useState("");
|
|
2126
2109
|
const { getClient, styles, appConfig: config, renderWallets } = usePollar();
|
|
2127
2110
|
const [authState, setAuthState] = react.useState(() => getClient().getAuthState());
|
|
2111
|
+
const walletAdapters = react.useMemo(() => getClient().listWalletAdapters(), [getClient]);
|
|
2128
2112
|
const [codeInputKey, setCodeInputKey] = react.useState(0);
|
|
2129
2113
|
const pendingEmail = react.useRef(null);
|
|
2130
2114
|
const onCloseRef = react.useRef(onClose);
|
|
@@ -2174,7 +2158,7 @@ function LoginModal({ onClose }) {
|
|
|
2174
2158
|
getClient().login({ provider });
|
|
2175
2159
|
}
|
|
2176
2160
|
function handleWalletConnect(type) {
|
|
2177
|
-
getClient().
|
|
2161
|
+
getClient().login({ provider: type });
|
|
2178
2162
|
}
|
|
2179
2163
|
function handleLoginSmartWallet() {
|
|
2180
2164
|
getClient().loginSmartWallet();
|
|
@@ -2211,6 +2195,7 @@ function LoginModal({ onClose }) {
|
|
|
2211
2195
|
github: !!providers?.github,
|
|
2212
2196
|
apple: !!providers?.apple
|
|
2213
2197
|
},
|
|
2198
|
+
walletAdapters,
|
|
2214
2199
|
appName: config.application?.name ?? "Pollar",
|
|
2215
2200
|
email,
|
|
2216
2201
|
onEmailChange: setEmail,
|
|
@@ -2544,7 +2529,8 @@ var MOCK_PAYMENT = {
|
|
|
2544
2529
|
expiresAt: new Date(Date.now() + 30 * 60 * 1e3).toISOString()
|
|
2545
2530
|
};
|
|
2546
2531
|
function RampWidget({ onClose }) {
|
|
2547
|
-
const { getClient,
|
|
2532
|
+
const { getClient, wallet, styles } = usePollar();
|
|
2533
|
+
const walletAddress = wallet?.address ?? "";
|
|
2548
2534
|
const [step, setStep] = react.useState("input");
|
|
2549
2535
|
const [direction, setDirection] = react.useState("onramp");
|
|
2550
2536
|
const [amount, setAmount] = react.useState("");
|
|
@@ -2747,7 +2733,8 @@ function ReceiveModalTemplate({
|
|
|
2747
2733
|
);
|
|
2748
2734
|
}
|
|
2749
2735
|
function ReceiveModal({ onClose }) {
|
|
2750
|
-
const {
|
|
2736
|
+
const { wallet, styles } = usePollar();
|
|
2737
|
+
const walletAddress = wallet?.address ?? "";
|
|
2751
2738
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
2752
2739
|
const [copied, setCopied] = react.useState(false);
|
|
2753
2740
|
const copyTimerRef = react.useRef(null);
|
|
@@ -3155,10 +3142,11 @@ function SendModal({ onClose }) {
|
|
|
3155
3142
|
buildTx,
|
|
3156
3143
|
signAndSubmitTx,
|
|
3157
3144
|
tx: transaction,
|
|
3158
|
-
|
|
3145
|
+
wallet,
|
|
3159
3146
|
network,
|
|
3160
3147
|
styles
|
|
3161
3148
|
} = usePollar();
|
|
3149
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
3162
3150
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3163
3151
|
const [step, setStep] = react.useState("form");
|
|
3164
3152
|
const [amount, setAmount] = react.useState("");
|
|
@@ -3567,7 +3555,8 @@ function TransactionModalTemplate({
|
|
|
3567
3555
|
] });
|
|
3568
3556
|
}
|
|
3569
3557
|
function TransactionModal({ onClose }) {
|
|
3570
|
-
const { getClient, styles, tx: transaction, network,
|
|
3558
|
+
const { getClient, styles, tx: transaction, network, wallet } = usePollar();
|
|
3559
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
3571
3560
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3572
3561
|
const [showXdr, setShowXdr] = react.useState(false);
|
|
3573
3562
|
const [copied, setCopied] = react.useState(false);
|
|
@@ -3889,7 +3878,8 @@ function WalletBalanceModalTemplate({
|
|
|
3889
3878
|
] });
|
|
3890
3879
|
}
|
|
3891
3880
|
function WalletBalanceModal({ onClose }) {
|
|
3892
|
-
const { walletBalance, refreshWalletBalance,
|
|
3881
|
+
const { walletBalance, refreshWalletBalance, wallet, styles } = usePollar();
|
|
3882
|
+
const walletAddress = wallet?.address ?? "";
|
|
3893
3883
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3894
3884
|
react.useEffect(() => {
|
|
3895
3885
|
void refreshWalletBalance();
|
|
@@ -4061,10 +4051,9 @@ function PollarProvider({
|
|
|
4061
4051
|
const styles = resolvedConfig.styles ?? {};
|
|
4062
4052
|
return {
|
|
4063
4053
|
// session
|
|
4064
|
-
|
|
4054
|
+
wallet: pollarClient.getWallet(),
|
|
4065
4055
|
isAuthenticated: !!walletAddress,
|
|
4066
4056
|
verified,
|
|
4067
|
-
walletType: pollarClient.getWalletType(),
|
|
4068
4057
|
// client
|
|
4069
4058
|
getClient,
|
|
4070
4059
|
// auth
|
|
@@ -4484,7 +4473,7 @@ function WalletButtonTemplate({
|
|
|
4484
4473
|
function WalletButton() {
|
|
4485
4474
|
const {
|
|
4486
4475
|
getClient,
|
|
4487
|
-
|
|
4476
|
+
wallet,
|
|
4488
4477
|
styles,
|
|
4489
4478
|
openLoginModal,
|
|
4490
4479
|
openTxHistoryModal,
|
|
@@ -4495,9 +4484,10 @@ function WalletButton() {
|
|
|
4495
4484
|
openKycModal,
|
|
4496
4485
|
openRampModal,
|
|
4497
4486
|
openDistributionRulesModal,
|
|
4498
|
-
tx: transaction
|
|
4499
|
-
walletType
|
|
4487
|
+
tx: transaction
|
|
4500
4488
|
} = usePollar();
|
|
4489
|
+
const walletAddress = wallet?.address ?? "";
|
|
4490
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
4501
4491
|
const [open, setOpen] = react.useState(false);
|
|
4502
4492
|
const [copied, setCopied] = react.useState(false);
|
|
4503
4493
|
const wrapperRef = react.useRef(null);
|