@pollar/react 0.10.1-rc.10 → 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 +6 -6
- package/dist/index.css.map +1 -1
- package/dist/index.js +111 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +111 -31
- 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: [
|
|
@@ -3429,6 +3429,7 @@ function AssetSelect({
|
|
|
3429
3429
|
options,
|
|
3430
3430
|
onChange,
|
|
3431
3431
|
loading = false,
|
|
3432
|
+
loadingLabel,
|
|
3432
3433
|
disabled = false,
|
|
3433
3434
|
appGroupLabel = "App assets",
|
|
3434
3435
|
otherGroupLabel = "Other assets",
|
|
@@ -3438,7 +3439,10 @@ function AssetSelect({
|
|
|
3438
3439
|
const otherAssets = options.filter((o) => !o.enabledInApp);
|
|
3439
3440
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
3440
3441
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: label }),
|
|
3441
|
-
loading ? /* @__PURE__ */ jsxRuntime.
|
|
3442
|
+
loading ? loadingLabel ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-input pollar-select-loading", children: [
|
|
3443
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
3444
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: loadingLabel })
|
|
3445
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3442
3446
|
"select",
|
|
3443
3447
|
{
|
|
3444
3448
|
className: "pollar-input pollar-send-select",
|
|
@@ -3767,6 +3771,7 @@ function SendModalTemplate({
|
|
|
3767
3771
|
label: "Asset",
|
|
3768
3772
|
value: selectedKey,
|
|
3769
3773
|
loading: isLoadingBalance,
|
|
3774
|
+
loadingLabel: "Loading assets\u2026",
|
|
3770
3775
|
options: assets.map((a) => ({
|
|
3771
3776
|
key: assetKey3(a),
|
|
3772
3777
|
code: a.code,
|
|
@@ -4111,10 +4116,6 @@ function SwapModalTemplate({
|
|
|
4111
4116
|
/* @__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" }) }) })
|
|
4112
4117
|
] })
|
|
4113
4118
|
] }),
|
|
4114
|
-
step === "form" && configLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
|
|
4115
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
4116
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading swap options\u2026" })
|
|
4117
|
-
] }),
|
|
4118
4119
|
step === "form" && !configLoading && swapUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swap is not available for this app." }),
|
|
4119
4120
|
step === "form" && !swapUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4120
4121
|
smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Swaps are not yet available for smart (passkey) wallets." }),
|
|
@@ -4123,7 +4124,8 @@ function SwapModalTemplate({
|
|
|
4123
4124
|
{
|
|
4124
4125
|
label: "You pay",
|
|
4125
4126
|
value: sellKey,
|
|
4126
|
-
loading: isLoadingData,
|
|
4127
|
+
loading: isLoadingData || configLoading,
|
|
4128
|
+
loadingLabel: "Loading assets\u2026",
|
|
4127
4129
|
disabled: configLoading,
|
|
4128
4130
|
options: sellOptions.map((o) => ({
|
|
4129
4131
|
key: assetOptionKey(o),
|
|
@@ -4165,7 +4167,8 @@ function SwapModalTemplate({
|
|
|
4165
4167
|
{
|
|
4166
4168
|
label: "You receive",
|
|
4167
4169
|
value: buyKey,
|
|
4168
|
-
loading: isLoadingData,
|
|
4170
|
+
loading: isLoadingData || configLoading,
|
|
4171
|
+
loadingLabel: "Loading assets\u2026",
|
|
4169
4172
|
disabled: configLoading,
|
|
4170
4173
|
options: buyOptions.map((o) => ({
|
|
4171
4174
|
key: assetOptionKey(o),
|
|
@@ -4227,14 +4230,17 @@ function SwapModalTemplate({
|
|
|
4227
4230
|
),
|
|
4228
4231
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
4229
4232
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: "Route" }),
|
|
4230
|
-
/* @__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(
|
|
4231
4237
|
"select",
|
|
4232
4238
|
{
|
|
4233
4239
|
className: "pollar-input pollar-send-select",
|
|
4234
4240
|
value: provider,
|
|
4235
|
-
disabled:
|
|
4241
|
+
disabled: providers.length === 0,
|
|
4236
4242
|
onChange: (e) => onProviderChange(e.target.value),
|
|
4237
|
-
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))
|
|
4238
4244
|
}
|
|
4239
4245
|
)
|
|
4240
4246
|
] }),
|
|
@@ -4596,6 +4602,11 @@ function EarnModal({ onClose }) {
|
|
|
4596
4602
|
earnWithdraw,
|
|
4597
4603
|
tx: transaction,
|
|
4598
4604
|
wallet,
|
|
4605
|
+
walletBalance,
|
|
4606
|
+
refreshWalletBalance,
|
|
4607
|
+
enabledAssets,
|
|
4608
|
+
refreshAssets,
|
|
4609
|
+
setTrustline,
|
|
4599
4610
|
network,
|
|
4600
4611
|
styles
|
|
4601
4612
|
} = usePollar();
|
|
@@ -4627,6 +4638,10 @@ function EarnModal({ onClose }) {
|
|
|
4627
4638
|
react.useEffect(() => {
|
|
4628
4639
|
void loadProviders();
|
|
4629
4640
|
}, [loadProviders]);
|
|
4641
|
+
react.useEffect(() => {
|
|
4642
|
+
void refreshWalletBalance();
|
|
4643
|
+
void refreshAssets();
|
|
4644
|
+
}, [refreshWalletBalance, refreshAssets]);
|
|
4630
4645
|
react.useEffect(() => {
|
|
4631
4646
|
if (!provider) return;
|
|
4632
4647
|
let cancelled = false;
|
|
@@ -4670,6 +4685,22 @@ function EarnModal({ onClose }) {
|
|
|
4670
4685
|
const withdrawUnit = position?.withdrawUnit ?? "asset";
|
|
4671
4686
|
const assetCode = selectedOpportunity?.asset.code ?? "";
|
|
4672
4687
|
const amountUnitLabel = tab === "deposit" ? assetCode : withdrawUnit === "shares" ? "shares" : assetCode;
|
|
4688
|
+
const walletAvailable = (() => {
|
|
4689
|
+
if (!selectedOpportunity) return null;
|
|
4690
|
+
const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
|
|
4691
|
+
const issuer = selectedOpportunity.asset.issuer;
|
|
4692
|
+
const rec = balances.find(
|
|
4693
|
+
(b) => issuer === null ? b.type === "native" : b.code === assetCode && b.issuer === issuer
|
|
4694
|
+
);
|
|
4695
|
+
return rec ? rec.available : null;
|
|
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;
|
|
4673
4704
|
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
4674
4705
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
4675
4706
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
@@ -4677,7 +4708,9 @@ function EarnModal({ onClose }) {
|
|
|
4677
4708
|
const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
|
|
4678
4709
|
const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
4679
4710
|
const txTitle = isInProgress ? tab === "deposit" ? "Depositing\u2026" : "Withdrawing\u2026" : transaction.step === "success" ? "Done!" : transaction.step === "error" ? tab === "deposit" ? "Deposit failed" : "Withdraw failed" : "Confirm";
|
|
4680
|
-
const
|
|
4711
|
+
const parsedAmount = parseFloat(amount);
|
|
4712
|
+
const exceedsAvailable = tab === "deposit" ? walletAvailable != null && parsedAmount > parseFloat(walletAvailable) : position != null && parsedAmount > parseFloat(position.withdrawable);
|
|
4713
|
+
const canSubmit = !smartUnsupported && !!provider && !!opportunityId && !!amount && parsedAmount > 0 && !exceedsAvailable && !providersLoading && !loadingOpps;
|
|
4681
4714
|
const cssVars = {
|
|
4682
4715
|
"--pollar-accent": accentColor,
|
|
4683
4716
|
"--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
|
|
@@ -4710,11 +4743,27 @@ function EarnModal({ onClose }) {
|
|
|
4710
4743
|
setFormError("Enter a valid amount");
|
|
4711
4744
|
return;
|
|
4712
4745
|
}
|
|
4746
|
+
if (tab === "deposit" && walletAvailable != null && parsed > parseFloat(walletAvailable)) {
|
|
4747
|
+
setFormError("Amount exceeds your wallet balance");
|
|
4748
|
+
return;
|
|
4749
|
+
}
|
|
4713
4750
|
if (tab === "withdraw" && position && parsed > parseFloat(position.withdrawable)) {
|
|
4714
4751
|
setFormError("Amount exceeds your position");
|
|
4715
4752
|
return;
|
|
4716
4753
|
}
|
|
4717
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
|
+
}
|
|
4718
4767
|
const params = { provider, opportunity: opportunityId, amount };
|
|
4719
4768
|
const outcome = tab === "deposit" ? await earnDeposit(params) : await earnWithdraw(params);
|
|
4720
4769
|
if (outcome.status === "success" || outcome.status === "pending") {
|
|
@@ -4749,6 +4798,7 @@ function EarnModal({ onClose }) {
|
|
|
4749
4798
|
if (refreshing || !provider) return;
|
|
4750
4799
|
setRefreshing(true);
|
|
4751
4800
|
try {
|
|
4801
|
+
void refreshWalletBalance();
|
|
4752
4802
|
const opps = await getEarnOpportunities(provider);
|
|
4753
4803
|
setOpportunities(opps);
|
|
4754
4804
|
setOpportunityId((cur) => opps.some((o) => o.id === cur) ? cur : opps[0]?.id ?? "");
|
|
@@ -4807,10 +4857,6 @@ function EarnModal({ onClose }) {
|
|
|
4807
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" }) }) })
|
|
4808
4858
|
] })
|
|
4809
4859
|
] }),
|
|
4810
|
-
step === "form" && providersLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-loading-block", children: [
|
|
4811
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-spinner" }),
|
|
4812
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Loading Earn options\u2026" })
|
|
4813
|
-
] }),
|
|
4814
4860
|
step === "form" && earnUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not available for this app." }),
|
|
4815
4861
|
step === "form" && !earnUnavailable && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4816
4862
|
smartUnsupported && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: "Earn is not yet available for smart (passkey) wallets." }),
|
|
@@ -4855,18 +4901,18 @@ function EarnModal({ onClose }) {
|
|
|
4855
4901
|
)
|
|
4856
4902
|
] }),
|
|
4857
4903
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
4858
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
/* @__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(
|
|
4863
4909
|
"select",
|
|
4864
4910
|
{
|
|
4865
4911
|
className: "pollar-input pollar-send-select",
|
|
4866
4912
|
value: opportunityId,
|
|
4867
|
-
disabled:
|
|
4913
|
+
disabled: opportunities.length === 0,
|
|
4868
4914
|
onChange: (e) => setOpportunityId(e.target.value),
|
|
4869
|
-
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: [
|
|
4870
4916
|
o.name,
|
|
4871
4917
|
" \xB7 ",
|
|
4872
4918
|
o.apy.toFixed(2),
|
|
@@ -4876,6 +4922,14 @@ function EarnModal({ onClose }) {
|
|
|
4876
4922
|
)
|
|
4877
4923
|
] }),
|
|
4878
4924
|
selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote", children: [
|
|
4925
|
+
tab === "deposit" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4926
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "In your wallet" }),
|
|
4927
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
4928
|
+
walletAvailable != null ? formatAmount4(walletAvailable) : "\u2026",
|
|
4929
|
+
" ",
|
|
4930
|
+
assetCode
|
|
4931
|
+
] })
|
|
4932
|
+
] }),
|
|
4879
4933
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
4880
4934
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "Your position" }),
|
|
4881
4935
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
@@ -4895,6 +4949,12 @@ function EarnModal({ onClose }) {
|
|
|
4895
4949
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
4896
4950
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-label-row", children: [
|
|
4897
4951
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: tab === "deposit" ? "Amount" : "Withdraw amount" }),
|
|
4952
|
+
tab === "deposit" && walletAvailable != null && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(walletAvailable), children: [
|
|
4953
|
+
"Max: ",
|
|
4954
|
+
formatAmount4(walletAvailable),
|
|
4955
|
+
" ",
|
|
4956
|
+
amountUnitLabel
|
|
4957
|
+
] }),
|
|
4898
4958
|
tab === "withdraw" && position && /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-swap-custom-toggle", onClick: () => setAmount(position.withdrawable), children: [
|
|
4899
4959
|
"Max: ",
|
|
4900
4960
|
formatAmount4(position.withdrawable),
|
|
@@ -4918,7 +4978,12 @@ function EarnModal({ onClose }) {
|
|
|
4918
4978
|
] })
|
|
4919
4979
|
] }),
|
|
4920
4980
|
formError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: formError }),
|
|
4921
|
-
|
|
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" }) })
|
|
4922
4987
|
] }),
|
|
4923
4988
|
step === "tx" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4924
4989
|
TxStatusView,
|
|
@@ -5870,6 +5935,9 @@ function PollarProvider({
|
|
|
5870
5935
|
const [sendModalOpen, setSendModalOpen] = react.useState(false);
|
|
5871
5936
|
const [swapModalOpen, setSwapModalOpen] = react.useState(false);
|
|
5872
5937
|
const [earnModalOpen, setEarnModalOpen] = react.useState(false);
|
|
5938
|
+
const [sendModalKey, setSendModalKey] = react.useState(0);
|
|
5939
|
+
const [swapModalKey, setSwapModalKey] = react.useState(0);
|
|
5940
|
+
const [earnModalKey, setEarnModalKey] = react.useState(0);
|
|
5873
5941
|
const [receiveModalOpen, setReceiveModalOpen] = react.useState(false);
|
|
5874
5942
|
const [sessionsModalOpen, setSessionsModalOpen] = react.useState(false);
|
|
5875
5943
|
const [distributionRulesModalOpen, setDistributionRulesModalOpen] = react.useState(false);
|
|
@@ -5912,21 +5980,33 @@ function PollarProvider({
|
|
|
5912
5980
|
setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
|
|
5913
5981
|
openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
|
|
5914
5982
|
// send / receive
|
|
5915
|
-
openSendModal: () =>
|
|
5983
|
+
openSendModal: () => {
|
|
5984
|
+
pollarClient.resetTransactionState();
|
|
5985
|
+
setSendModalKey((k) => k + 1);
|
|
5986
|
+
setSendModalOpen(true);
|
|
5987
|
+
},
|
|
5916
5988
|
openReceiveModal: () => setReceiveModalOpen(true),
|
|
5917
5989
|
// swap
|
|
5918
5990
|
getSwapConfig: () => pollarClient.getSwapConfig(),
|
|
5919
5991
|
getSwapTokens: () => pollarClient.getSwapTokens(),
|
|
5920
5992
|
getSwapQuote: (params) => pollarClient.getSwapQuote(params),
|
|
5921
5993
|
swap: (quote, opts) => pollarClient.swap(quote, opts),
|
|
5922
|
-
openSwapModal: () =>
|
|
5994
|
+
openSwapModal: () => {
|
|
5995
|
+
pollarClient.resetTransactionState();
|
|
5996
|
+
setSwapModalKey((k) => k + 1);
|
|
5997
|
+
setSwapModalOpen(true);
|
|
5998
|
+
},
|
|
5923
5999
|
// earn
|
|
5924
6000
|
getEarnProviders: () => pollarClient.getEarnProviders(),
|
|
5925
6001
|
getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
|
|
5926
6002
|
getEarnPosition: (params) => pollarClient.getEarnPosition(params),
|
|
5927
6003
|
earnDeposit: (params) => pollarClient.earnDeposit(params),
|
|
5928
6004
|
earnWithdraw: (params) => pollarClient.earnWithdraw(params),
|
|
5929
|
-
openEarnModal: () =>
|
|
6005
|
+
openEarnModal: () => {
|
|
6006
|
+
pollarClient.resetTransactionState();
|
|
6007
|
+
setEarnModalKey((k) => k + 1);
|
|
6008
|
+
setEarnModalOpen(true);
|
|
6009
|
+
},
|
|
5930
6010
|
// sessions
|
|
5931
6011
|
sessions,
|
|
5932
6012
|
openSessionsModal: () => setSessionsModalOpen(true),
|
|
@@ -5980,9 +6060,9 @@ function PollarProvider({
|
|
|
5980
6060
|
txHistoryModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
|
|
5981
6061
|
walletBalanceModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
|
|
5982
6062
|
enabledAssetsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEnabledAssetsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EnabledAssetsModal, { onClose: () => setEnabledAssetsModalOpen(false) }) }),
|
|
5983
|
-
sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
|
|
5984
|
-
swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }),
|
|
5985
|
-
earnModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }),
|
|
6063
|
+
sendModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }, sendModalKey),
|
|
6064
|
+
swapModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSwapModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SwapModal, { onClose: () => setSwapModalOpen(false) }) }, swapModalKey),
|
|
6065
|
+
earnModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setEarnModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(EarnModal, { onClose: () => setEarnModalOpen(false) }) }, earnModalKey),
|
|
5986
6066
|
receiveModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) }),
|
|
5987
6067
|
sessionsModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setSessionsModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(SessionsModal, { onClose: () => setSessionsModalOpen(false) }) }),
|
|
5988
6068
|
distributionRulesModalOpen && /* @__PURE__ */ jsxRuntime.jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
|