@pollar/react 0.10.1-rc.11 → 0.10.1-rc.12
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 +0 -7
- package/dist/index.css.map +1 -1
- package/dist/index.js +46 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.10.1-rc.
|
|
1038
|
+
"0.10.1-rc.12"
|
|
1039
1039
|
] })
|
|
1040
1040
|
] })
|
|
1041
1041
|
] });
|
|
@@ -2800,7 +2800,7 @@ function RampWidgetTemplate({
|
|
|
2800
2800
|
] }),
|
|
2801
2801
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2802
2802
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-ramp-label", children: "Country" }),
|
|
2803
|
-
countriesLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input pollar-
|
|
2803
|
+
countriesLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-ramp-input pollar-select-loading", children: [
|
|
2804
2804
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
2805
2805
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading countries\u2026" })
|
|
2806
2806
|
] }) : countries.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsxRuntime.jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: c.code, children: [
|
|
@@ -3771,6 +3771,7 @@ function SendModalTemplate({
|
|
|
3771
3771
|
label: "Asset",
|
|
3772
3772
|
value: selectedKey,
|
|
3773
3773
|
loading: isLoadingBalance,
|
|
3774
|
+
loadingLabel: "Loading assets\u2026",
|
|
3774
3775
|
options: assets.map((a) => ({
|
|
3775
3776
|
key: assetKey3(a),
|
|
3776
3777
|
code: a.code,
|
|
@@ -4229,14 +4230,17 @@ function SwapModalTemplate({
|
|
|
4229
4230
|
),
|
|
4230
4231
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
4231
4232
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Route" }),
|
|
4232
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4233
|
+
configLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
|
|
4234
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4235
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading routes\u2026" })
|
|
4236
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4233
4237
|
"select",
|
|
4234
4238
|
{
|
|
4235
4239
|
className: "pollar-input pollar-send-select",
|
|
4236
4240
|
value: provider,
|
|
4237
|
-
disabled:
|
|
4241
|
+
disabled: providers.length === 0,
|
|
4238
4242
|
onChange: (e) => onProviderChange(e.target.value),
|
|
4239
|
-
children: providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: provider, children:
|
|
4243
|
+
children: providers.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: provider, children: PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
|
|
4240
4244
|
}
|
|
4241
4245
|
)
|
|
4242
4246
|
] }),
|
|
@@ -4600,6 +4604,9 @@ function EarnModal({ onClose }) {
|
|
|
4600
4604
|
wallet,
|
|
4601
4605
|
walletBalance,
|
|
4602
4606
|
refreshWalletBalance,
|
|
4607
|
+
enabledAssets,
|
|
4608
|
+
refreshAssets,
|
|
4609
|
+
setTrustline,
|
|
4603
4610
|
network,
|
|
4604
4611
|
styles
|
|
4605
4612
|
} = usePollar();
|
|
@@ -4633,7 +4640,8 @@ function EarnModal({ onClose }) {
|
|
|
4633
4640
|
}, [loadProviders]);
|
|
4634
4641
|
react.useEffect(() => {
|
|
4635
4642
|
void refreshWalletBalance();
|
|
4636
|
-
|
|
4643
|
+
void refreshAssets();
|
|
4644
|
+
}, [refreshWalletBalance, refreshAssets]);
|
|
4637
4645
|
react.useEffect(() => {
|
|
4638
4646
|
if (!provider) return;
|
|
4639
4647
|
let cancelled = false;
|
|
@@ -4686,6 +4694,13 @@ function EarnModal({ onClose }) {
|
|
|
4686
4694
|
);
|
|
4687
4695
|
return rec ? rec.available : null;
|
|
4688
4696
|
})();
|
|
4697
|
+
const depositAssetRecord = (() => {
|
|
4698
|
+
if (!selectedOpportunity?.asset.issuer || enabledAssets.step !== "loaded") return void 0;
|
|
4699
|
+
return enabledAssets.data.assets.find(
|
|
4700
|
+
(a) => a.code === assetCode && a.issuer === selectedOpportunity.asset.issuer
|
|
4701
|
+
);
|
|
4702
|
+
})();
|
|
4703
|
+
const depositNeedsTrustline = tab === "deposit" && !smartUnsupported && !!selectedOpportunity?.asset.issuer && !depositAssetRecord?.trustlineEstablished;
|
|
4689
4704
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
4690
4705
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
4691
4706
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
@@ -4737,6 +4752,18 @@ function EarnModal({ onClose }) {
|
|
|
4737
4752
|
return;
|
|
4738
4753
|
}
|
|
4739
4754
|
setStep("tx");
|
|
4755
|
+
if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
|
|
4756
|
+
const tl = await setTrustline(
|
|
4757
|
+
{ code: assetCode, issuer: selectedOpportunity.asset.issuer },
|
|
4758
|
+
depositAssetRecord?.sponsored ? { sponsored: true } : void 0
|
|
4759
|
+
);
|
|
4760
|
+
if (tl.status === "error") {
|
|
4761
|
+
setFormError(`Trustline for ${assetCode} failed: ${tl.details ?? "unknown error"}`);
|
|
4762
|
+
setStep("form");
|
|
4763
|
+
return;
|
|
4764
|
+
}
|
|
4765
|
+
await refreshAssets();
|
|
4766
|
+
}
|
|
4740
4767
|
const params = { provider, opportunity: opportunityId, amount };
|
|
4741
4768
|
const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
|
|
4742
4769
|
if (outcome.status === "success" || outcome.status === "pending") {
|
|
@@ -4830,10 +4857,6 @@ function EarnModal({ onClose }) {
|
|
|
4830
4857
|
!isInProgress && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "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" }) }) })
|
|
4831
4858
|
] })
|
|
4832
4859
|
] }),
|
|
4833
|
-
step === "form" && providersLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
|
|
4834
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
4835
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading Earn options\u2026" })
|
|
4836
|
-
] }),
|
|
4837
4860
|
step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
|
|
4838
4861
|
step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4839
4862
|
smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
|
|
@@ -4878,18 +4901,18 @@ function EarnModal({ onClose }) {
|
|
|
4878
4901
|
)
|
|
4879
4902
|
] }),
|
|
4880
4903
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
4881
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4904
|
+
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
|
|
4905
|
+
loadingOpps || providersLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
|
|
4906
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4907
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading options\u2026" })
|
|
4908
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4886
4909
|
"select",
|
|
4887
4910
|
{
|
|
4888
4911
|
className: "pollar-input pollar-send-select",
|
|
4889
4912
|
value: opportunityId,
|
|
4890
|
-
disabled:
|
|
4913
|
+
disabled: opportunities.length === 0,
|
|
4891
4914
|
onChange: (e) => setOpportunityId(e.target.value),
|
|
4892
|
-
children: opportunities.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children:
|
|
4915
|
+
children: opportunities.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: o.id, children: [
|
|
4893
4916
|
o.name,
|
|
4894
4917
|
" \xB7 ",
|
|
4895
4918
|
o.apy.toFixed(2),
|
|
@@ -4955,7 +4978,12 @@ function EarnModal({ onClose }) {
|
|
|
4955
4978
|
] })
|
|
4956
4979
|
] }),
|
|
4957
4980
|
formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
4958
|
-
|
|
4981
|
+
depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-trustline-notice", children: [
|
|
4982
|
+
"To deposit ",
|
|
4983
|
+
assetCode,
|
|
4984
|
+
" your wallet needs a trustline. This will create it first (~0.5 XLM reserve, refundable if you later remove it), then deposit \u2014 two signatures."
|
|
4985
|
+
] }),
|
|
4986
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? depositNeedsTrustline ? "Enable trustline & deposit" : "Deposit" : "Withdraw" }) })
|
|
4959
4987
|
] }),
|
|
4960
4988
|
step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4961
4989
|
TxStatusView,
|