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