@pollar/react 0.9.0 → 0.10.0-rc.0
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 +42 -6
- package/dist/index.d.ts +42 -6
- package/dist/index.js +182 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +182 -151
- 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.0"
|
|
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);
|
|
@@ -1870,6 +1889,7 @@ var AUTH_STATE_MESSAGES = {
|
|
|
1870
1889
|
verifying_email_code: "Verifying\u2026",
|
|
1871
1890
|
opening_oauth: "Redirecting\u2026",
|
|
1872
1891
|
connecting_wallet: "Connecting wallet\u2026",
|
|
1892
|
+
signing_wallet_challenge: "Confirm in your wallet\u2026",
|
|
1873
1893
|
wallet_not_installed: "Wallet not installed",
|
|
1874
1894
|
authenticating_wallet: "Signing in with wallet\u2026",
|
|
1875
1895
|
creating_passkey: "Waiting for passkey\u2026",
|
|
@@ -1885,6 +1905,7 @@ function authStateToStatus(step) {
|
|
|
1885
1905
|
"verifying_email_code",
|
|
1886
1906
|
"opening_oauth",
|
|
1887
1907
|
"connecting_wallet",
|
|
1908
|
+
"signing_wallet_challenge",
|
|
1888
1909
|
"authenticating_wallet",
|
|
1889
1910
|
"creating_passkey",
|
|
1890
1911
|
"deploying_smart_account",
|
|
@@ -1905,11 +1926,13 @@ function LoginModalTemplate({
|
|
|
1905
1926
|
embeddedWallets,
|
|
1906
1927
|
smartWallet = false,
|
|
1907
1928
|
providers,
|
|
1929
|
+
customProviders = [],
|
|
1908
1930
|
appName,
|
|
1909
1931
|
email = "",
|
|
1910
1932
|
onEmailChange,
|
|
1911
1933
|
onEmailSubmit,
|
|
1912
1934
|
onSocialLogin,
|
|
1935
|
+
onCustomLogin,
|
|
1913
1936
|
onWalletConnect,
|
|
1914
1937
|
onLoginSmartWallet,
|
|
1915
1938
|
onCreateSmartWallet,
|
|
@@ -1996,27 +2019,8 @@ function LoginModalTemplate({
|
|
|
1996
2019
|
] }) : showPasskeyChooser ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1997
2020
|
/* @__PURE__ */ jsx(BackButton, { onClick: () => setShowPasskeyChooser(false) }),
|
|
1998
2021
|
/* @__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
|
-
)
|
|
2022
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-btn-primary", onClick: onCreateSmartWallet, children: "Create a new wallet" }),
|
|
2023
|
+
/* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading, className: "pollar-wallet-entry-btn", onClick: onLoginSmartWallet, children: "Log in with an existing wallet" })
|
|
2020
2024
|
] })
|
|
2021
2025
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2022
2026
|
emailEnabled && /* @__PURE__ */ jsxs("div", { className: "pollar-email-section", children: [
|
|
@@ -2038,13 +2042,13 @@ function LoginModalTemplate({
|
|
|
2038
2042
|
type: "button",
|
|
2039
2043
|
disabled: isLoading || !email,
|
|
2040
2044
|
className: "pollar-btn-primary",
|
|
2041
|
-
style: { marginTop: "0.75rem"
|
|
2045
|
+
style: { marginTop: "0.75rem" },
|
|
2042
2046
|
onClick: onEmailSubmit,
|
|
2043
2047
|
children: "Submit"
|
|
2044
2048
|
}
|
|
2045
2049
|
)
|
|
2046
2050
|
] }),
|
|
2047
|
-
emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
|
|
2051
|
+
emailEnabled && (enabledSocial.length > 0 || customProviders.length > 0) && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
|
|
2048
2052
|
/* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
|
|
2049
2053
|
/* @__PURE__ */ jsx("div", { className: "pollar-divider-label", children: /* @__PURE__ */ jsx("span", { className: "pollar-divider-text", children: "or continue with" }) })
|
|
2050
2054
|
] }),
|
|
@@ -2052,6 +2056,20 @@ function LoginModalTemplate({
|
|
|
2052
2056
|
enabledSocial.some(([key]) => key === "google") && /* @__PURE__ */ jsx(GoogleButton, { disabled: isLoading, onClick: () => onSocialLogin?.("google") }),
|
|
2053
2057
|
enabledSocial.some(([key]) => key === "github") && /* @__PURE__ */ jsx(GithubButton, { disabled: isLoading, onClick: () => onSocialLogin?.("github") })
|
|
2054
2058
|
] }),
|
|
2059
|
+
customProviders.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-social-list", children: customProviders.map((p) => /* @__PURE__ */ jsxs(
|
|
2060
|
+
"button",
|
|
2061
|
+
{
|
|
2062
|
+
type: "button",
|
|
2063
|
+
disabled: isLoading,
|
|
2064
|
+
className: "pollar-wallet-entry-btn",
|
|
2065
|
+
onClick: () => onCustomLogin?.(p.id),
|
|
2066
|
+
children: [
|
|
2067
|
+
p.iconUrl && /* @__PURE__ */ jsx("img", { src: p.iconUrl, alt: "", className: "pollar-wallet-list-icon" }),
|
|
2068
|
+
p.label
|
|
2069
|
+
]
|
|
2070
|
+
},
|
|
2071
|
+
p.id
|
|
2072
|
+
)) }),
|
|
2055
2073
|
(embeddedWallets || smartWallet) && /* @__PURE__ */ jsxs("div", { className: "pollar-wallet-section", children: [
|
|
2056
2074
|
embeddedWallets && /* @__PURE__ */ jsxs(
|
|
2057
2075
|
"button",
|
|
@@ -2121,7 +2139,7 @@ function LoginModalTemplate({
|
|
|
2121
2139
|
}
|
|
2122
2140
|
function LoginModal({ onClose }) {
|
|
2123
2141
|
const [email, setEmail] = useState("");
|
|
2124
|
-
const { getClient, styles, appConfig: config, renderWallets } = usePollar();
|
|
2142
|
+
const { getClient, styles, appConfig: config, renderWallets, customProviders } = usePollar();
|
|
2125
2143
|
const [authState, setAuthState] = useState(() => getClient().getAuthState());
|
|
2126
2144
|
const [codeInputKey, setCodeInputKey] = useState(0);
|
|
2127
2145
|
const pendingEmail = useRef(null);
|
|
@@ -2171,6 +2189,9 @@ function LoginModal({ onClose }) {
|
|
|
2171
2189
|
function handleSocialLogin(provider) {
|
|
2172
2190
|
getClient().login({ provider });
|
|
2173
2191
|
}
|
|
2192
|
+
function handleCustomLogin(id) {
|
|
2193
|
+
getClient().login({ provider: id });
|
|
2194
|
+
}
|
|
2174
2195
|
function handleWalletConnect(type) {
|
|
2175
2196
|
getClient().loginWallet(type);
|
|
2176
2197
|
}
|
|
@@ -2209,11 +2230,13 @@ function LoginModal({ onClose }) {
|
|
|
2209
2230
|
github: !!providers?.github,
|
|
2210
2231
|
apple: !!providers?.apple
|
|
2211
2232
|
},
|
|
2233
|
+
...customProviders !== void 0 && { customProviders },
|
|
2212
2234
|
appName: config.application?.name ?? "Pollar",
|
|
2213
2235
|
email,
|
|
2214
2236
|
onEmailChange: setEmail,
|
|
2215
2237
|
onEmailSubmit: handleEmailSubmit,
|
|
2216
2238
|
onSocialLogin: handleSocialLogin,
|
|
2239
|
+
onCustomLogin: handleCustomLogin,
|
|
2217
2240
|
onWalletConnect: handleWalletConnect,
|
|
2218
2241
|
onLoginSmartWallet: handleLoginSmartWallet,
|
|
2219
2242
|
onCreateSmartWallet: handleCreateSmartWallet,
|
|
@@ -2542,7 +2565,8 @@ var MOCK_PAYMENT = {
|
|
|
2542
2565
|
expiresAt: new Date(Date.now() + 30 * 60 * 1e3).toISOString()
|
|
2543
2566
|
};
|
|
2544
2567
|
function RampWidget({ onClose }) {
|
|
2545
|
-
const { getClient,
|
|
2568
|
+
const { getClient, wallet, styles } = usePollar();
|
|
2569
|
+
const walletAddress = wallet?.address ?? "";
|
|
2546
2570
|
const [step, setStep] = useState("input");
|
|
2547
2571
|
const [direction, setDirection] = useState("onramp");
|
|
2548
2572
|
const [amount, setAmount] = useState("");
|
|
@@ -2745,7 +2769,8 @@ function ReceiveModalTemplate({
|
|
|
2745
2769
|
);
|
|
2746
2770
|
}
|
|
2747
2771
|
function ReceiveModal({ onClose }) {
|
|
2748
|
-
const {
|
|
2772
|
+
const { wallet, styles } = usePollar();
|
|
2773
|
+
const walletAddress = wallet?.address ?? "";
|
|
2749
2774
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
2750
2775
|
const [copied, setCopied] = useState(false);
|
|
2751
2776
|
const copyTimerRef = useRef(null);
|
|
@@ -3153,10 +3178,11 @@ function SendModal({ onClose }) {
|
|
|
3153
3178
|
buildTx,
|
|
3154
3179
|
signAndSubmitTx,
|
|
3155
3180
|
tx: transaction,
|
|
3156
|
-
|
|
3181
|
+
wallet,
|
|
3157
3182
|
network,
|
|
3158
3183
|
styles
|
|
3159
3184
|
} = usePollar();
|
|
3185
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
3160
3186
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3161
3187
|
const [step, setStep] = useState("form");
|
|
3162
3188
|
const [amount, setAmount] = useState("");
|
|
@@ -3565,7 +3591,8 @@ function TransactionModalTemplate({
|
|
|
3565
3591
|
] });
|
|
3566
3592
|
}
|
|
3567
3593
|
function TransactionModal({ onClose }) {
|
|
3568
|
-
const { getClient, styles, tx: transaction, network,
|
|
3594
|
+
const { getClient, styles, tx: transaction, network, wallet } = usePollar();
|
|
3595
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
3569
3596
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3570
3597
|
const [showXdr, setShowXdr] = useState(false);
|
|
3571
3598
|
const [copied, setCopied] = useState(false);
|
|
@@ -3887,7 +3914,8 @@ function WalletBalanceModalTemplate({
|
|
|
3887
3914
|
] });
|
|
3888
3915
|
}
|
|
3889
3916
|
function WalletBalanceModal({ onClose }) {
|
|
3890
|
-
const { walletBalance, refreshWalletBalance,
|
|
3917
|
+
const { walletBalance, refreshWalletBalance, wallet, styles } = usePollar();
|
|
3918
|
+
const walletAddress = wallet?.address ?? "";
|
|
3891
3919
|
const { theme = "light", accentColor = "#005DB4" } = styles;
|
|
3892
3920
|
useEffect(() => {
|
|
3893
3921
|
void refreshWalletBalance();
|
|
@@ -4055,14 +4083,14 @@ function PollarProvider({
|
|
|
4055
4083
|
const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
|
|
4056
4084
|
const refreshAssets = useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
|
|
4057
4085
|
const renderWallets = ui?.renderWallets;
|
|
4086
|
+
const customProviders = ui?.customProviders;
|
|
4058
4087
|
const contextValue = useMemo(() => {
|
|
4059
4088
|
const styles = resolvedConfig.styles ?? {};
|
|
4060
4089
|
return {
|
|
4061
4090
|
// session
|
|
4062
|
-
|
|
4091
|
+
wallet: pollarClient.getWallet(),
|
|
4063
4092
|
isAuthenticated: !!walletAddress,
|
|
4064
4093
|
verified,
|
|
4065
|
-
walletType: pollarClient.getWalletType(),
|
|
4066
4094
|
// client
|
|
4067
4095
|
getClient,
|
|
4068
4096
|
// auth
|
|
@@ -4112,6 +4140,7 @@ function PollarProvider({
|
|
|
4112
4140
|
appConfig: resolvedConfig,
|
|
4113
4141
|
styles,
|
|
4114
4142
|
renderWallets,
|
|
4143
|
+
customProviders,
|
|
4115
4144
|
adapters
|
|
4116
4145
|
};
|
|
4117
4146
|
}, [
|
|
@@ -4129,7 +4158,8 @@ function PollarProvider({
|
|
|
4129
4158
|
networkState,
|
|
4130
4159
|
resolvedConfig,
|
|
4131
4160
|
adapters,
|
|
4132
|
-
renderWallets
|
|
4161
|
+
renderWallets,
|
|
4162
|
+
customProviders
|
|
4133
4163
|
]);
|
|
4134
4164
|
return /* @__PURE__ */ jsxs(PollarContext.Provider, { value: contextValue, children: [
|
|
4135
4165
|
children,
|
|
@@ -4482,7 +4512,7 @@ function WalletButtonTemplate({
|
|
|
4482
4512
|
function WalletButton() {
|
|
4483
4513
|
const {
|
|
4484
4514
|
getClient,
|
|
4485
|
-
|
|
4515
|
+
wallet,
|
|
4486
4516
|
styles,
|
|
4487
4517
|
openLoginModal,
|
|
4488
4518
|
openTxHistoryModal,
|
|
@@ -4493,9 +4523,10 @@ function WalletButton() {
|
|
|
4493
4523
|
openKycModal,
|
|
4494
4524
|
openRampModal,
|
|
4495
4525
|
openDistributionRulesModal,
|
|
4496
|
-
tx: transaction
|
|
4497
|
-
walletType
|
|
4526
|
+
tx: transaction
|
|
4498
4527
|
} = usePollar();
|
|
4528
|
+
const walletAddress = wallet?.address ?? "";
|
|
4529
|
+
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
4499
4530
|
const [open, setOpen] = useState(false);
|
|
4500
4531
|
const [copied, setCopied] = useState(false);
|
|
4501
4532
|
const wrapperRef = useRef(null);
|