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