@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.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.10.1-rc.
|
|
1036
|
+
"0.10.1-rc.12"
|
|
1037
1037
|
] })
|
|
1038
1038
|
] })
|
|
1039
1039
|
] });
|
|
@@ -2798,7 +2798,7 @@ function RampWidgetTemplate({
|
|
|
2798
2798
|
] }),
|
|
2799
2799
|
/* @__PURE__ */ jsxs("div", { className: "pollar-ramp-field", children: [
|
|
2800
2800
|
/* @__PURE__ */ jsx("label", { className: "pollar-ramp-label", children: "Country" }),
|
|
2801
|
-
countriesLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-input pollar-
|
|
2801
|
+
countriesLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-input pollar-select-loading", children: [
|
|
2802
2802
|
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
2803
2803
|
/* @__PURE__ */ jsx("span", { children: "Loading countries\u2026" })
|
|
2804
2804
|
] }) : countries.length === 0 ? /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "No ramp providers available on this network yet." }) : /* @__PURE__ */ jsx("select", { className: "pollar-ramp-input", value: country, onChange: (e) => onCountryChange(e.target.value), children: countries.map((c) => /* @__PURE__ */ jsxs("option", { value: c.code, children: [
|
|
@@ -3769,6 +3769,7 @@ function SendModalTemplate({
|
|
|
3769
3769
|
label: "Asset",
|
|
3770
3770
|
value: selectedKey,
|
|
3771
3771
|
loading: isLoadingBalance,
|
|
3772
|
+
loadingLabel: "Loading assets\u2026",
|
|
3772
3773
|
options: assets.map((a) => ({
|
|
3773
3774
|
key: assetKey3(a),
|
|
3774
3775
|
code: a.code,
|
|
@@ -4227,14 +4228,17 @@ function SwapModalTemplate({
|
|
|
4227
4228
|
),
|
|
4228
4229
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
4229
4230
|
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Route" }),
|
|
4230
|
-
/* @__PURE__ */
|
|
4231
|
+
configLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-input pollar-select-loading", children: [
|
|
4232
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4233
|
+
/* @__PURE__ */ jsx("span", { children: "Loading routes\u2026" })
|
|
4234
|
+
] }) : /* @__PURE__ */ jsx(
|
|
4231
4235
|
"select",
|
|
4232
4236
|
{
|
|
4233
4237
|
className: "pollar-input pollar-send-select",
|
|
4234
4238
|
value: provider,
|
|
4235
|
-
disabled:
|
|
4239
|
+
disabled: providers.length === 0,
|
|
4236
4240
|
onChange: (e) => onProviderChange(e.target.value),
|
|
4237
|
-
children: providers.length === 0 ? /* @__PURE__ */ jsx("option", { value: provider, children:
|
|
4241
|
+
children: providers.length === 0 ? /* @__PURE__ */ jsx("option", { value: provider, children: PROVIDER_LABELS[provider] }) : providers.map((p) => /* @__PURE__ */ jsx("option", { value: p, children: PROVIDER_LABELS[p] }, p))
|
|
4238
4242
|
}
|
|
4239
4243
|
)
|
|
4240
4244
|
] }),
|
|
@@ -4598,6 +4602,9 @@ function EarnModal({ onClose }) {
|
|
|
4598
4602
|
wallet,
|
|
4599
4603
|
walletBalance,
|
|
4600
4604
|
refreshWalletBalance,
|
|
4605
|
+
enabledAssets,
|
|
4606
|
+
refreshAssets,
|
|
4607
|
+
setTrustline,
|
|
4601
4608
|
network,
|
|
4602
4609
|
styles
|
|
4603
4610
|
} = usePollar();
|
|
@@ -4631,7 +4638,8 @@ function EarnModal({ onClose }) {
|
|
|
4631
4638
|
}, [loadProviders]);
|
|
4632
4639
|
useEffect(() => {
|
|
4633
4640
|
void refreshWalletBalance();
|
|
4634
|
-
|
|
4641
|
+
void refreshAssets();
|
|
4642
|
+
}, [refreshWalletBalance, refreshAssets]);
|
|
4635
4643
|
useEffect(() => {
|
|
4636
4644
|
if (!provider) return;
|
|
4637
4645
|
let cancelled = false;
|
|
@@ -4684,6 +4692,13 @@ function EarnModal({ onClose }) {
|
|
|
4684
4692
|
);
|
|
4685
4693
|
return rec ? rec.available : null;
|
|
4686
4694
|
})();
|
|
4695
|
+
const depositAssetRecord = (() => {
|
|
4696
|
+
if (!selectedOpportunity?.asset.issuer || enabledAssets.step !== "loaded") return void 0;
|
|
4697
|
+
return enabledAssets.data.assets.find(
|
|
4698
|
+
(a) => a.code === assetCode && a.issuer === selectedOpportunity.asset.issuer
|
|
4699
|
+
);
|
|
4700
|
+
})();
|
|
4701
|
+
const depositNeedsTrustline = tab === "deposit" && !smartUnsupported && !!selectedOpportunity?.asset.issuer && !depositAssetRecord?.trustlineEstablished;
|
|
4687
4702
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
4688
4703
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
4689
4704
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
@@ -4735,6 +4750,18 @@ function EarnModal({ onClose }) {
|
|
|
4735
4750
|
return;
|
|
4736
4751
|
}
|
|
4737
4752
|
setStep("tx");
|
|
4753
|
+
if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
|
|
4754
|
+
const tl = await setTrustline(
|
|
4755
|
+
{ code: assetCode, issuer: selectedOpportunity.asset.issuer },
|
|
4756
|
+
depositAssetRecord?.sponsored ? { sponsored: true } : void 0
|
|
4757
|
+
);
|
|
4758
|
+
if (tl.status === "error") {
|
|
4759
|
+
setFormError(`Trustline for ${assetCode} failed: ${tl.details ?? "unknown error"}`);
|
|
4760
|
+
setStep("form");
|
|
4761
|
+
return;
|
|
4762
|
+
}
|
|
4763
|
+
await refreshAssets();
|
|
4764
|
+
}
|
|
4738
4765
|
const params = { provider, opportunity: opportunityId, amount };
|
|
4739
4766
|
const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
|
|
4740
4767
|
if (outcome.status === "success" || outcome.status === "pending") {
|
|
@@ -4828,10 +4855,6 @@ function EarnModal({ onClose }) {
|
|
|
4828
4855
|
!isInProgress && /* @__PURE__ */ jsx("button", { type: "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" }) }) })
|
|
4829
4856
|
] })
|
|
4830
4857
|
] }),
|
|
4831
|
-
step === "form" && providersLoading && /* @__PURE__ */ jsxs("div", { className: "pollar-loading-block", children: [
|
|
4832
|
-
/* @__PURE__ */ jsx("div", { className: "pollar-spinner" }),
|
|
4833
|
-
/* @__PURE__ */ jsx("span", { children: "Loading Earn options\u2026" })
|
|
4834
|
-
] }),
|
|
4835
4858
|
step === "form" && earnUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
|
|
4836
4859
|
step === "form" && !earnUnavailable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4837
4860
|
smartUnsupported && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
|
|
@@ -4876,18 +4899,18 @@ function EarnModal({ onClose }) {
|
|
|
4876
4899
|
)
|
|
4877
4900
|
] }),
|
|
4878
4901
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
|
|
4879
|
-
/* @__PURE__ */
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
/* @__PURE__ */ jsx(
|
|
4902
|
+
/* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: provider === "defindex" ? "Vault" : "Pool" }),
|
|
4903
|
+
loadingOpps || providersLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-input pollar-select-loading", children: [
|
|
4904
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
4905
|
+
/* @__PURE__ */ jsx("span", { children: "Loading options\u2026" })
|
|
4906
|
+
] }) : /* @__PURE__ */ jsx(
|
|
4884
4907
|
"select",
|
|
4885
4908
|
{
|
|
4886
4909
|
className: "pollar-input pollar-send-select",
|
|
4887
4910
|
value: opportunityId,
|
|
4888
|
-
disabled:
|
|
4911
|
+
disabled: opportunities.length === 0,
|
|
4889
4912
|
onChange: (e) => setOpportunityId(e.target.value),
|
|
4890
|
-
children: opportunities.length === 0 ? /* @__PURE__ */ jsx("option", { value: "", children:
|
|
4913
|
+
children: opportunities.length === 0 ? /* @__PURE__ */ jsx("option", { value: "", children: "None available" }) : opportunities.map((o) => /* @__PURE__ */ jsxs("option", { value: o.id, children: [
|
|
4891
4914
|
o.name,
|
|
4892
4915
|
" \xB7 ",
|
|
4893
4916
|
o.apy.toFixed(2),
|
|
@@ -4953,7 +4976,12 @@ function EarnModal({ onClose }) {
|
|
|
4953
4976
|
] })
|
|
4954
4977
|
] }),
|
|
4955
4978
|
formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
4956
|
-
|
|
4979
|
+
depositNeedsTrustline && selectedOpportunity && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-trustline-notice", children: [
|
|
4980
|
+
"To deposit ",
|
|
4981
|
+
assetCode,
|
|
4982
|
+
" 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."
|
|
4983
|
+
] }),
|
|
4984
|
+
/* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: () => void handleSubmit(), disabled: !canSubmit, children: tab === "deposit" ? depositNeedsTrustline ? "Enable trustline & deposit" : "Deposit" : "Withdraw" }) })
|
|
4957
4985
|
] }),
|
|
4958
4986
|
step === "tx" && /* @__PURE__ */ jsx(
|
|
4959
4987
|
TxStatusView,
|