@pollar/react 0.12.1-rc.16 → 0.12.1-rc.17
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/README.md +50 -34
- package/dist/index.css +120 -163
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +51 -9
- package/dist/index.d.ts +51 -9
- package/dist/index.js +679 -511
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +680 -512
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote,
|
|
2
|
+
import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
|
|
3
3
|
import { createContext, forwardRef, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore, useId, useLayoutEffect, Component } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
import { createPortal } from 'react-dom';
|
|
@@ -1231,8 +1231,6 @@ var LOGO_POLLAR_WORDMARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-logo
|
|
|
1231
1231
|
var LOGO_POLLAR_WORDMARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-logo-horizontal-on-dark.png";
|
|
1232
1232
|
var LOGO_POLLAR_MARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-mark-on-light.png";
|
|
1233
1233
|
var LOGO_POLLAR_MARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-mark-on-dark.png";
|
|
1234
|
-
var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
|
|
1235
|
-
var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
|
|
1236
1234
|
var CHAIN_LOGOS = {
|
|
1237
1235
|
STELLAR: "https://www.pollar.xyz/chains/stellar.png",
|
|
1238
1236
|
POLYGON: "https://www.pollar.xyz/chains/polygon.png",
|
|
@@ -1284,7 +1282,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1284
1282
|
/* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1285
1283
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1286
1284
|
"v",
|
|
1287
|
-
"0.12.1-rc.
|
|
1285
|
+
"0.12.1-rc.17"
|
|
1288
1286
|
] })
|
|
1289
1287
|
] });
|
|
1290
1288
|
};
|
|
@@ -5517,17 +5515,6 @@ function AssetLogo({ asset, small = false }) {
|
|
|
5517
5515
|
function ChainLogo({ chain }) {
|
|
5518
5516
|
return /* @__PURE__ */ jsx("img", { className: "pollar-txr-chain-inline", src: CHAIN_LOGOS[chain], alt: "", "aria-hidden": true });
|
|
5519
5517
|
}
|
|
5520
|
-
function TxExplorerLink({
|
|
5521
|
-
chain,
|
|
5522
|
-
url,
|
|
5523
|
-
language: languageProp
|
|
5524
|
-
}) {
|
|
5525
|
-
const copy = TX_REVIEW_COPY[useInheritedLanguage(languageProp)];
|
|
5526
|
-
return /* @__PURE__ */ jsxs("a", { className: "pollar-txr-link pollar-txr-explorer", href: url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
5527
|
-
/* @__PURE__ */ jsx(ChainLogo, { chain }),
|
|
5528
|
-
copy.viewOnExplorer
|
|
5529
|
-
] });
|
|
5530
|
-
}
|
|
5531
5518
|
function AccountGlyph() {
|
|
5532
5519
|
return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
|
|
5533
5520
|
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "7", r: "3.25", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
@@ -5614,60 +5601,56 @@ function FeeBadge({ sponsored, free = false, copy }) {
|
|
|
5614
5601
|
free ? copy.feeFree : sponsored ? copy.feeSponsored : copy.feePaid
|
|
5615
5602
|
] });
|
|
5616
5603
|
}
|
|
5617
|
-
function TxFeeBadge({
|
|
5618
|
-
sponsored,
|
|
5619
|
-
language: languageProp
|
|
5620
|
-
}) {
|
|
5621
|
-
const language = useInheritedLanguage(languageProp);
|
|
5622
|
-
return /* @__PURE__ */ jsx(FeeBadge, { sponsored, copy: TX_REVIEW_COPY[language] });
|
|
5623
|
-
}
|
|
5624
5604
|
function TxReview({
|
|
5625
5605
|
data,
|
|
5626
5606
|
open: openProp,
|
|
5627
5607
|
onToggle,
|
|
5628
5608
|
detailsIntro,
|
|
5629
5609
|
detailsAction,
|
|
5610
|
+
detailsOnly = false,
|
|
5630
5611
|
language: languageProp
|
|
5631
5612
|
}) {
|
|
5632
5613
|
const language = useInheritedLanguage(languageProp);
|
|
5633
5614
|
const copy = TX_REVIEW_COPY[language];
|
|
5634
5615
|
const [openState, setOpenState] = useState(false);
|
|
5635
|
-
const open = openProp ?? openState;
|
|
5616
|
+
const open = detailsOnly || (openProp ?? openState);
|
|
5636
5617
|
const toggle = onToggle ?? (() => setOpenState((v) => !v));
|
|
5637
5618
|
const { from, to, kind } = data;
|
|
5638
5619
|
const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
|
|
5639
5620
|
const toGlyph = kind === "bridge" || kind === "swap" || kind === "deposit" || kind === "withdraw" ? "asset" : "account";
|
|
5640
5621
|
return /* @__PURE__ */ jsxs("div", { className: "pollar-txr", children: [
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
/* @__PURE__ */
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
/* @__PURE__ */
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
open
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5622
|
+
!detailsOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5623
|
+
data.lead && /* @__PURE__ */ jsx("p", { className: "pollar-txr-lead", children: data.lead }),
|
|
5624
|
+
from && to && kind !== "approve" && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-flow", children: [
|
|
5625
|
+
/* @__PURE__ */ jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
|
|
5626
|
+
/* @__PURE__ */ jsx(Arrow, {}),
|
|
5627
|
+
/* @__PURE__ */ jsx(Node2, { party: to, showAmount: toShowsAmount, glyph: toGlyph, copy })
|
|
5628
|
+
] }),
|
|
5629
|
+
kind === "sign_in" && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-signin", children: [
|
|
5630
|
+
/* @__PURE__ */ jsx(SignInGlyph, {}),
|
|
5631
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-txr-signin-body", children: copy.signIn.body }),
|
|
5632
|
+
/* @__PURE__ */ jsxs("ul", { className: "pollar-txr-assurances", children: [
|
|
5633
|
+
/* @__PURE__ */ jsx(Assurance, { text: copy.signIn.noMoney }),
|
|
5634
|
+
/* @__PURE__ */ jsx(Assurance, { text: copy.signIn.nothingSent })
|
|
5635
|
+
] })
|
|
5636
|
+
] }),
|
|
5637
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-txr-bar", children: [
|
|
5638
|
+
data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsx(FeeBadge, { sponsored: data.fee.sponsored, free: data.fee.free === true, copy }) : /* @__PURE__ */ jsx("span", {}),
|
|
5639
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
|
|
5640
|
+
open ? copy.hideDetails : copy.showDetails,
|
|
5641
|
+
/* @__PURE__ */ jsx(
|
|
5642
|
+
"svg",
|
|
5643
|
+
{
|
|
5644
|
+
width: "10",
|
|
5645
|
+
height: "10",
|
|
5646
|
+
viewBox: "0 0 12 12",
|
|
5647
|
+
fill: "none",
|
|
5648
|
+
"aria-hidden": true,
|
|
5649
|
+
style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 150ms" },
|
|
5650
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
5651
|
+
}
|
|
5652
|
+
)
|
|
5653
|
+
] })
|
|
5671
5654
|
] })
|
|
5672
5655
|
] }),
|
|
5673
5656
|
open && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-details", children: [
|
|
@@ -5679,7 +5662,7 @@ function TxReview({
|
|
|
5679
5662
|
data.rows.map((row, i) => /* @__PURE__ */ jsxs("div", { className: "pollar-txr-row", children: [
|
|
5680
5663
|
/* @__PURE__ */ jsx("dt", { children: row.label }),
|
|
5681
5664
|
/* @__PURE__ */ jsxs("dd", { className: row.mono ? "pollar-txr-mono" : void 0, children: [
|
|
5682
|
-
/* @__PURE__ */ jsx("span", { children: row.value }),
|
|
5665
|
+
row.href ? /* @__PURE__ */ jsx("a", { className: "pollar-txr-link", href: row.href, target: "_blank", rel: "noopener noreferrer", children: row.value }) : /* @__PURE__ */ jsx("span", { children: row.value }),
|
|
5683
5666
|
row.copyValue && /* @__PURE__ */ jsx(CopyButton, { value: row.copyValue, className: "pollar-copy-btn-sm", language })
|
|
5684
5667
|
] })
|
|
5685
5668
|
] }, `${row.label}-${i}`)),
|
|
@@ -5712,6 +5695,125 @@ function TxReview({
|
|
|
5712
5695
|
] })
|
|
5713
5696
|
] });
|
|
5714
5697
|
}
|
|
5698
|
+
|
|
5699
|
+
// src/components/confirm-modal/confirm-copy.ts
|
|
5700
|
+
var CONFIRM_COPY = {
|
|
5701
|
+
en: {
|
|
5702
|
+
whyTitle: "Why am I seeing this?",
|
|
5703
|
+
whyBody: "The app asks you to sign this with your wallet. Nothing is signed until you confirm.",
|
|
5704
|
+
cancelAction: "Cancel this action",
|
|
5705
|
+
confirm: "Confirm",
|
|
5706
|
+
activateWallet: "Activate wallet",
|
|
5707
|
+
close: "Close",
|
|
5708
|
+
closeTitle: "Close without signing?",
|
|
5709
|
+
closeBody: "If you close, the app's action is canceled.",
|
|
5710
|
+
backToSign: "Go back and sign",
|
|
5711
|
+
closeAndCancel: "Close and cancel",
|
|
5712
|
+
transaction: "Transaction",
|
|
5713
|
+
operations: {
|
|
5714
|
+
payment: "Send",
|
|
5715
|
+
path_payment_strict_send: "Swap",
|
|
5716
|
+
change_trust: "Add asset",
|
|
5717
|
+
create_account: "Create account",
|
|
5718
|
+
invoke_contract: "Contract call",
|
|
5719
|
+
transfer: "Authorize payment",
|
|
5720
|
+
manage_data: "Manage data",
|
|
5721
|
+
earn_deposit: "Deposit",
|
|
5722
|
+
earn_withdraw: "Withdraw"
|
|
5723
|
+
}
|
|
5724
|
+
},
|
|
5725
|
+
es: {
|
|
5726
|
+
whyTitle: "\xBFPor qu\xE9 ves esto?",
|
|
5727
|
+
whyBody: "La app te pide firmar esto con tu billetera. No se firma nada hasta que confirmes.",
|
|
5728
|
+
cancelAction: "Cancelar esta acci\xF3n",
|
|
5729
|
+
confirm: "Confirmar",
|
|
5730
|
+
activateWallet: "Activar billetera",
|
|
5731
|
+
close: "Cerrar",
|
|
5732
|
+
closeTitle: "\xBFCerrar sin firmar?",
|
|
5733
|
+
closeBody: "Si cierras, la acci\xF3n de la app se cancela.",
|
|
5734
|
+
backToSign: "Volver y firmar",
|
|
5735
|
+
closeAndCancel: "Cerrar y cancelar",
|
|
5736
|
+
transaction: "Transacci\xF3n",
|
|
5737
|
+
operations: {
|
|
5738
|
+
payment: "Enviar",
|
|
5739
|
+
path_payment_strict_send: "Intercambiar",
|
|
5740
|
+
change_trust: "Agregar activo",
|
|
5741
|
+
create_account: "Crear cuenta",
|
|
5742
|
+
invoke_contract: "Llamada a contrato",
|
|
5743
|
+
transfer: "Autorizar pago",
|
|
5744
|
+
manage_data: "Gestionar datos",
|
|
5745
|
+
earn_deposit: "Depositar",
|
|
5746
|
+
earn_withdraw: "Retirar"
|
|
5747
|
+
}
|
|
5748
|
+
},
|
|
5749
|
+
pt: {
|
|
5750
|
+
whyTitle: "Por que estou vendo isto?",
|
|
5751
|
+
whyBody: "O app pede que voc\xEA assine isto com sua carteira. Nada \xE9 assinado at\xE9 voc\xEA confirmar.",
|
|
5752
|
+
cancelAction: "Cancelar esta a\xE7\xE3o",
|
|
5753
|
+
confirm: "Confirmar",
|
|
5754
|
+
activateWallet: "Ativar carteira",
|
|
5755
|
+
close: "Fechar",
|
|
5756
|
+
closeTitle: "Fechar sem assinar?",
|
|
5757
|
+
closeBody: "Se voc\xEA fechar, a a\xE7\xE3o do app \xE9 cancelada.",
|
|
5758
|
+
backToSign: "Voltar e assinar",
|
|
5759
|
+
closeAndCancel: "Fechar e cancelar",
|
|
5760
|
+
transaction: "Transa\xE7\xE3o",
|
|
5761
|
+
operations: {
|
|
5762
|
+
payment: "Enviar",
|
|
5763
|
+
path_payment_strict_send: "Trocar",
|
|
5764
|
+
change_trust: "Adicionar ativo",
|
|
5765
|
+
create_account: "Criar conta",
|
|
5766
|
+
invoke_contract: "Chamada de contrato",
|
|
5767
|
+
transfer: "Autorizar pagamento",
|
|
5768
|
+
manage_data: "Gerenciar dados",
|
|
5769
|
+
earn_deposit: "Depositar",
|
|
5770
|
+
earn_withdraw: "Sacar"
|
|
5771
|
+
}
|
|
5772
|
+
}
|
|
5773
|
+
};
|
|
5774
|
+
|
|
5775
|
+
// src/components/confirm-modal/confirmation-review.ts
|
|
5776
|
+
function labelOf(confirmation, copy) {
|
|
5777
|
+
const op = confirmation.operation ?? "";
|
|
5778
|
+
return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
|
|
5779
|
+
}
|
|
5780
|
+
function confirmationReview(confirmation, language, network) {
|
|
5781
|
+
const copy = CONFIRM_COPY[language];
|
|
5782
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
5783
|
+
return confirmation.buildData ? reviewFromBuild(confirmation.buildData, reviewCopy, labelOf(confirmation, copy)) : reviewFromRequest(
|
|
5784
|
+
{
|
|
5785
|
+
chain: confirmation.network,
|
|
5786
|
+
network,
|
|
5787
|
+
operation: confirmation.operation,
|
|
5788
|
+
details: confirmation.details,
|
|
5789
|
+
raw: confirmation.unsignedXdr ?? confirmation.authEntryXdr,
|
|
5790
|
+
fallbackTitle: labelOf(confirmation, copy)
|
|
5791
|
+
},
|
|
5792
|
+
reviewCopy
|
|
5793
|
+
);
|
|
5794
|
+
}
|
|
5795
|
+
function InlineConfirm({
|
|
5796
|
+
confirmation,
|
|
5797
|
+
language,
|
|
5798
|
+
network
|
|
5799
|
+
}) {
|
|
5800
|
+
const copy = CONFIRM_COPY[language];
|
|
5801
|
+
const review = confirmationReview(confirmation, language, network);
|
|
5802
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-inline-confirm", children: [
|
|
5803
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-inline-confirm-title", children: review.title }),
|
|
5804
|
+
/* @__PURE__ */ jsx(
|
|
5805
|
+
TxReview,
|
|
5806
|
+
{
|
|
5807
|
+
data: review,
|
|
5808
|
+
language,
|
|
5809
|
+
detailsIntro: { title: copy.whyTitle, body: copy.whyBody },
|
|
5810
|
+
detailsAction: { label: copy.cancelAction, onClick: confirmation.reject }
|
|
5811
|
+
},
|
|
5812
|
+
confirmation.id
|
|
5813
|
+
),
|
|
5814
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary pollar-tx-sign-btn", onClick: confirmation.confirm, children: review.kind === "activate_wallet" ? copy.activateWallet : copy.confirm })
|
|
5815
|
+
] });
|
|
5816
|
+
}
|
|
5715
5817
|
function scannableImageSrc(image) {
|
|
5716
5818
|
return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
|
|
5717
5819
|
}
|
|
@@ -5836,7 +5938,8 @@ function RampWidgetTemplate({
|
|
|
5836
5938
|
onRetry,
|
|
5837
5939
|
onRefresh,
|
|
5838
5940
|
onClose,
|
|
5839
|
-
language: languageProp
|
|
5941
|
+
language: languageProp,
|
|
5942
|
+
confirmation = null
|
|
5840
5943
|
}) {
|
|
5841
5944
|
const language = useInheritedLanguage(languageProp);
|
|
5842
5945
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
|
|
@@ -5845,6 +5948,30 @@ function RampWidgetTemplate({
|
|
|
5845
5948
|
const sendUnit = onramp ? fiat?.currency : asset?.code;
|
|
5846
5949
|
const view = order ? describeRampAction(order, language) : null;
|
|
5847
5950
|
const settled = order ? ["completed", "failed", "refunded"].includes(order.state) : false;
|
|
5951
|
+
const shortHash = (hash) => `${hash.slice(0, 8)}\u2026${hash.slice(-6)}`;
|
|
5952
|
+
const orderRows = order ? [
|
|
5953
|
+
...order.legs.flatMap((leg) => [
|
|
5954
|
+
...leg.onchainTxHash ? [
|
|
5955
|
+
{
|
|
5956
|
+
label: rampLegTitle(leg, language),
|
|
5957
|
+
value: shortHash(leg.onchainTxHash),
|
|
5958
|
+
href: explorerTxUrl2(legChain(leg), leg.onchainTxHash, network),
|
|
5959
|
+
copyValue: leg.onchainTxHash
|
|
5960
|
+
}
|
|
5961
|
+
] : [],
|
|
5962
|
+
...(leg.steps ?? []).flatMap(
|
|
5963
|
+
(st) => st.hash ? [
|
|
5964
|
+
{
|
|
5965
|
+
label: rampStepTitle(st, leg, language),
|
|
5966
|
+
value: shortHash(st.hash),
|
|
5967
|
+
href: explorerTxUrl2(stepChain(st.kind, leg), st.hash, network),
|
|
5968
|
+
copyValue: st.hash
|
|
5969
|
+
}
|
|
5970
|
+
] : []
|
|
5971
|
+
)
|
|
5972
|
+
]),
|
|
5973
|
+
{ label: copy.order, value: order.id, copyValue: order.id, mono: true }
|
|
5974
|
+
] : [];
|
|
5848
5975
|
const running = order?.legs.find((leg) => rampLegStatus(leg) === "active" && order.pendingAction?.legIndex !== leg.index);
|
|
5849
5976
|
const now = useNowEverySecond(step === "status" && !settled && !!running && running.etaSeconds !== null);
|
|
5850
5977
|
const nextApproval = order && !settled ? rampNextApproval(order, language) : null;
|
|
@@ -6142,46 +6269,24 @@ function RampWidgetTemplate({
|
|
|
6142
6269
|
step === "status" && order && view && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment", children: [
|
|
6143
6270
|
/* @__PURE__ */ jsx("ol", { className: "pollar-ramp-legs", "aria-label": copy.progress, children: order.legs.map((leg) => {
|
|
6144
6271
|
const status = rampLegStatus(leg);
|
|
6145
|
-
const hash = leg.onchainTxHash;
|
|
6146
6272
|
const note = rampLegNote(leg, language);
|
|
6147
6273
|
return /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-leg", "data-status": status, children: [
|
|
6148
6274
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-dot", "aria-hidden": true }),
|
|
6149
6275
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-title", children: rampLegTitle(leg, language) }),
|
|
6150
6276
|
status === "active" && !settled && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": copy.inProgress }),
|
|
6151
|
-
hash && /* @__PURE__ */ jsxs(
|
|
6152
|
-
"a",
|
|
6153
|
-
{
|
|
6154
|
-
className: "pollar-ramp-leg-link",
|
|
6155
|
-
href: explorerTxUrl2(legChain(leg), hash, network),
|
|
6156
|
-
target: "_blank",
|
|
6157
|
-
rel: "noopener noreferrer",
|
|
6158
|
-
children: [
|
|
6159
|
-
hash.slice(0, 6),
|
|
6160
|
-
"\u2026",
|
|
6161
|
-
hash.slice(-4)
|
|
6162
|
-
]
|
|
6163
|
-
}
|
|
6164
|
-
),
|
|
6165
6277
|
note && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-note", children: note }),
|
|
6166
6278
|
status === "active" && !settled && !!leg.steps?.length && /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-steps", children: leg.steps.map((s) => /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
|
|
6167
6279
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-step-title", children: rampStepTitle(s, leg, language) }),
|
|
6168
6280
|
/* @__PURE__ */ jsxs("span", { className: "pollar-ramp-step-state", children: [
|
|
6169
6281
|
s.status === "confirming" && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
6170
|
-
s
|
|
6171
|
-
"a",
|
|
6172
|
-
{
|
|
6173
|
-
className: "pollar-ramp-leg-link",
|
|
6174
|
-
href: explorerTxUrl2(stepChain(s.kind, leg), s.hash, network),
|
|
6175
|
-
target: "_blank",
|
|
6176
|
-
rel: "noopener noreferrer",
|
|
6177
|
-
children: rampStepStatusText(s, language)
|
|
6178
|
-
}
|
|
6179
|
-
) : rampStepStatusText(s, language)
|
|
6282
|
+
rampStepStatusText(s, language)
|
|
6180
6283
|
] })
|
|
6181
6284
|
] }, s.kind)) }),
|
|
6182
6285
|
running === leg && !settled && rampLegTimeLeft(leg, now) !== null && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(rampLegTimeLeft(leg, now)) })
|
|
6183
6286
|
] }, leg.index);
|
|
6184
6287
|
}) }),
|
|
6288
|
+
confirmation && /* @__PURE__ */ jsx(InlineConfirm, { confirmation, language, network }),
|
|
6289
|
+
/* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language }),
|
|
6185
6290
|
nextApproval && !order.pendingAction && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-next", children: copy.next(nextApproval) }),
|
|
6186
6291
|
receive && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
6187
6292
|
/* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: order.state === "completed" ? copy.youReceived : copy.youReceive }),
|
|
@@ -6211,15 +6316,7 @@ function RampWidgetTemplate({
|
|
|
6211
6316
|
copy.tryingAgain
|
|
6212
6317
|
] }) : copy.tryAgain
|
|
6213
6318
|
}
|
|
6214
|
-
)
|
|
6215
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-value", style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
6216
|
-
/* @__PURE__ */ jsxs("code", { style: { flex: 1, wordBreak: "break-all" }, children: [
|
|
6217
|
-
copy.order,
|
|
6218
|
-
" ",
|
|
6219
|
-
order.id
|
|
6220
|
-
] }),
|
|
6221
|
-
/* @__PURE__ */ jsx(CopyButton, { value: order.id, label: copy.copyOrderId, language })
|
|
6222
|
-
] })
|
|
6319
|
+
)
|
|
6223
6320
|
] }),
|
|
6224
6321
|
!settled && payBy !== null && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: payBy > Date.now() ? copy.payBefore(new Date(payBy).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })) : copy.windowClosed }),
|
|
6225
6322
|
!settled && view.scannable && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
|
|
@@ -6877,6 +6974,11 @@ function ProviderRegistrationModal({
|
|
|
6877
6974
|
}
|
|
6878
6975
|
) });
|
|
6879
6976
|
}
|
|
6977
|
+
function useInlineConfirmation(active) {
|
|
6978
|
+
const { confirmations, registerConfirmationHost } = usePollar();
|
|
6979
|
+
useEffect(() => active ? registerConfirmationHost() : void 0, [active, registerConfirmationHost]);
|
|
6980
|
+
return active ? confirmations[0] ?? null : null;
|
|
6981
|
+
}
|
|
6880
6982
|
var PAYMENT_CHECK_EVERY_MS = 1e4;
|
|
6881
6983
|
var PAYMENT_CHECK_WINDOW_MS = 2 * 6e4;
|
|
6882
6984
|
function rampErrorMessage(error, fallback, copy, language) {
|
|
@@ -6966,6 +7068,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
|
|
|
6966
7068
|
const copy = RAMP_COPY[language];
|
|
6967
7069
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
6968
7070
|
const [step, setStep] = useState("input");
|
|
7071
|
+
const confirmation = useInlineConfirmation(step === "status");
|
|
6969
7072
|
const [direction, setDirection] = useState(initial?.direction === "sell" ? "OFFRAMP" : "ONRAMP");
|
|
6970
7073
|
const seedRef = useRef(
|
|
6971
7074
|
initial ? { direction: initial.direction === "sell" ? "OFFRAMP" : "ONRAMP", options: initial } : null
|
|
@@ -7443,7 +7546,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
|
|
|
7443
7546
|
}
|
|
7444
7547
|
);
|
|
7445
7548
|
}
|
|
7446
|
-
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: onClose, children: /* @__PURE__ */ jsx(
|
|
7549
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step === "status" ? void 0 : onClose, children: /* @__PURE__ */ jsx(
|
|
7447
7550
|
RampWidgetTemplate,
|
|
7448
7551
|
{
|
|
7449
7552
|
language,
|
|
@@ -7523,7 +7626,8 @@ function RampWidget({ onClose, language: languageProp, initial }) {
|
|
|
7523
7626
|
setStep("input");
|
|
7524
7627
|
},
|
|
7525
7628
|
onRefresh: () => void handleRefresh(),
|
|
7526
|
-
onClose
|
|
7629
|
+
onClose,
|
|
7630
|
+
confirmation
|
|
7527
7631
|
}
|
|
7528
7632
|
) });
|
|
7529
7633
|
}
|
|
@@ -8065,6 +8169,20 @@ var SEND_COPY = {
|
|
|
8065
8169
|
}
|
|
8066
8170
|
}
|
|
8067
8171
|
};
|
|
8172
|
+
function TitleMark({ chain, asset }) {
|
|
8173
|
+
const src = chain ? CHAIN_LOGOS[chain] : void 0;
|
|
8174
|
+
if (!asset) return src ? /* @__PURE__ */ jsx("img", { className: "pollar-cosign-chain", src, alt: "", "aria-hidden": true }) : null;
|
|
8175
|
+
return /* @__PURE__ */ jsxs("span", { className: "pollar-cosign-mark", "aria-hidden": true, children: [
|
|
8176
|
+
/* @__PURE__ */ jsx(AssetLogo, { asset, small: true }, asset),
|
|
8177
|
+
src && /* @__PURE__ */ jsx("img", { className: "pollar-cosign-mark-chain", src, alt: "" })
|
|
8178
|
+
] });
|
|
8179
|
+
}
|
|
8180
|
+
function OutcomeIcon({ ok }) {
|
|
8181
|
+
return /* @__PURE__ */ jsxs("svg", { className: "pollar-outcome-icon", width: "16", height: "16", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
8182
|
+
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
8183
|
+
ok ? /* @__PURE__ */ jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) : /* @__PURE__ */ jsx("path", { d: "m4.5 4.5 5 5m0-5-5 5", stroke: "white", strokeWidth: "1.4", strokeLinecap: "round" })
|
|
8184
|
+
] });
|
|
8185
|
+
}
|
|
8068
8186
|
|
|
8069
8187
|
// src/components/transaction-modal/transaction-copy.ts
|
|
8070
8188
|
var TRANSACTION_COPY = {
|
|
@@ -8075,6 +8193,7 @@ var TRANSACTION_COPY = {
|
|
|
8075
8193
|
signAndSend: "Sign & Send",
|
|
8076
8194
|
waitingFreighter: "Waiting for Freighter\u2026",
|
|
8077
8195
|
waitingAlbedo: "Waiting for Albedo\u2026",
|
|
8196
|
+
slowNote: "It's taking longer than usual. You can close this; it keeps checking and updates here.",
|
|
8078
8197
|
signingAndSending: "Signing and sending\u2026",
|
|
8079
8198
|
tryAgain: "Try again",
|
|
8080
8199
|
done: "Done",
|
|
@@ -8100,6 +8219,7 @@ var TRANSACTION_COPY = {
|
|
|
8100
8219
|
signAndSend: "Firmar y enviar",
|
|
8101
8220
|
waitingFreighter: "Esperando a Freighter\u2026",
|
|
8102
8221
|
waitingAlbedo: "Esperando a Albedo\u2026",
|
|
8222
|
+
slowNote: "Est\xE1 tardando m\xE1s de lo normal. Puedes cerrar; se sigue verificando y se actualiza aqu\xED.",
|
|
8103
8223
|
signingAndSending: "Firmando y enviando\u2026",
|
|
8104
8224
|
tryAgain: "Intenta de nuevo",
|
|
8105
8225
|
done: "Listo",
|
|
@@ -8125,6 +8245,7 @@ var TRANSACTION_COPY = {
|
|
|
8125
8245
|
signAndSend: "Assinar e enviar",
|
|
8126
8246
|
waitingFreighter: "Aguardando o Freighter\u2026",
|
|
8127
8247
|
waitingAlbedo: "Aguardando o Albedo\u2026",
|
|
8248
|
+
slowNote: "Est\xE1 demorando mais que o normal. Voc\xEA pode fechar; a verifica\xE7\xE3o continua e atualiza aqui.",
|
|
8128
8249
|
signingAndSending: "Assinando e enviando\u2026",
|
|
8129
8250
|
tryAgain: "Tentar novamente",
|
|
8130
8251
|
done: "Concluir",
|
|
@@ -8153,16 +8274,42 @@ var IN_FLIGHT_STEPS = /* @__PURE__ */ new Set([
|
|
|
8153
8274
|
"building-signing-submitting",
|
|
8154
8275
|
"awaiting_cosign"
|
|
8155
8276
|
]);
|
|
8156
|
-
var
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8277
|
+
var SPINNER = /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true });
|
|
8278
|
+
function txStatusReview({
|
|
8279
|
+
transaction,
|
|
8280
|
+
review: reviewProp,
|
|
8281
|
+
explorerUrl,
|
|
8282
|
+
confirmation,
|
|
8283
|
+
network,
|
|
8284
|
+
extraRows,
|
|
8285
|
+
language
|
|
8286
|
+
}) {
|
|
8287
|
+
const copy = TRANSACTION_COPY[language];
|
|
8288
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
8289
|
+
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
8290
|
+
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
8291
|
+
const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
|
|
8292
|
+
const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
|
|
8293
|
+
const review = reviewProp ? {
|
|
8294
|
+
...reviewProp,
|
|
8295
|
+
...hashInfo && { hash: hashInfo },
|
|
8296
|
+
...sponsored !== void 0 && { fee: { sponsored } }
|
|
8297
|
+
} : buildData ? reviewFromBuild(buildData, reviewCopy, copy.title, hashInfo, sponsored) : confirmation ? confirmationReview(confirmation, language, network) : hashInfo ? {
|
|
8298
|
+
title: copy.title,
|
|
8299
|
+
kind: "other",
|
|
8300
|
+
rows: [],
|
|
8301
|
+
hash: hashInfo,
|
|
8302
|
+
...sponsored !== void 0 && { fee: { sponsored } }
|
|
8303
|
+
} : null;
|
|
8304
|
+
return review && extraRows?.length ? { ...review, rows: [...review.rows, ...extraRows] } : review;
|
|
8305
|
+
}
|
|
8306
|
+
function TxStatusHeading({ review, fallback }) {
|
|
8307
|
+
const chain = review?.from?.chain ?? review?.to?.chain;
|
|
8308
|
+
return /* @__PURE__ */ jsxs("h2", { className: "pollar-modal-title pollar-cosign-heading", children: [
|
|
8309
|
+
review && /* @__PURE__ */ jsx(TitleMark, { chain, asset: headlineAsset(review) }),
|
|
8310
|
+
/* @__PURE__ */ jsx("span", { children: review?.title ?? fallback })
|
|
8311
|
+
] });
|
|
8312
|
+
}
|
|
8166
8313
|
function TxStatusView({
|
|
8167
8314
|
transaction,
|
|
8168
8315
|
showXdr,
|
|
@@ -8175,90 +8322,62 @@ function TxStatusView({
|
|
|
8175
8322
|
language: languageProp,
|
|
8176
8323
|
review: reviewProp,
|
|
8177
8324
|
successMessage,
|
|
8178
|
-
successExtra
|
|
8325
|
+
successExtra,
|
|
8326
|
+
confirmation,
|
|
8327
|
+
network,
|
|
8328
|
+
extraRows,
|
|
8329
|
+
outcomeNote
|
|
8179
8330
|
}) {
|
|
8180
8331
|
const language = useInheritedLanguage(languageProp);
|
|
8181
8332
|
const copy = TRANSACTION_COPY[language];
|
|
8182
|
-
const
|
|
8183
|
-
const hash = transaction.step === "success" ? transaction.hash : null;
|
|
8333
|
+
const confirmCopy = CONFIRM_COPY[language];
|
|
8184
8334
|
const errorDetails = transaction.step === "error" ? transactionErrorMessage(transaction.code, transaction.details, language) : null;
|
|
8185
8335
|
const isBuilt = transaction.step === "built";
|
|
8186
8336
|
const isInFlight = IN_FLIGHT_STEPS.has(transaction.step);
|
|
8187
8337
|
const isSuccess = transaction.step === "success";
|
|
8188
8338
|
const isError = transaction.step === "error";
|
|
8189
|
-
const
|
|
8190
|
-
const
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
const
|
|
8200
|
-
const
|
|
8201
|
-
|
|
8202
|
-
{
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
/* @__PURE__ */
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
showSpinner && /* @__PURE__ */ jsxs("div", { className: "pollar-tx-wallet-spinner", children: [
|
|
8220
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-spinner-ring", children: [
|
|
8221
|
-
/* @__PURE__ */ jsxs(
|
|
8222
|
-
"svg",
|
|
8223
|
-
{
|
|
8224
|
-
viewBox: "0 0 88 88",
|
|
8225
|
-
width: "88",
|
|
8226
|
-
height: "88",
|
|
8227
|
-
className: `pollar-tx-spinner-svg${isInFlight ? " pollar-tx-spinner-rotating" : ""}`,
|
|
8228
|
-
"aria-hidden": true,
|
|
8229
|
-
children: [
|
|
8230
|
-
/* @__PURE__ */ jsx("circle", { cx: "44", cy: "44", r: "36", fill: "none", stroke: "var(--pollar-border)", strokeWidth: "3" }),
|
|
8231
|
-
/* @__PURE__ */ jsx(
|
|
8232
|
-
"circle",
|
|
8233
|
-
{
|
|
8234
|
-
cx: "44",
|
|
8235
|
-
cy: "44",
|
|
8236
|
-
r: "36",
|
|
8237
|
-
fill: "none",
|
|
8238
|
-
stroke: isSuccess ? "var(--pollar-success-text)" : isError ? "var(--pollar-error-text)" : "var(--pollar-accent)",
|
|
8239
|
-
strokeWidth: "3",
|
|
8240
|
-
strokeLinecap: "round",
|
|
8241
|
-
strokeDasharray: isInFlight ? "169.6 56.6" : "999 0",
|
|
8242
|
-
transform: "rotate(-90 44 44)",
|
|
8243
|
-
style: { transition: isInFlight ? "none" : "stroke 400ms, stroke-dasharray 400ms" }
|
|
8244
|
-
}
|
|
8245
|
-
)
|
|
8246
|
-
]
|
|
8247
|
-
}
|
|
8248
|
-
),
|
|
8249
|
-
/* @__PURE__ */ jsx("div", { className: "pollar-tx-wallet-icon", children: walletImg ? /* @__PURE__ */ jsx("img", { src: walletImg, alt: walletAlt, className: "pollar-tx-wallet-img" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8250
|
-
/* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_MARK_ON_LIGHT, alt: walletAlt, className: "pollar-tx-wallet-img pollar-logo-on-light" }),
|
|
8251
|
-
/* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_MARK_ON_DARK, alt: walletAlt, className: "pollar-tx-wallet-img pollar-logo-on-dark" })
|
|
8252
|
-
] }) })
|
|
8339
|
+
const asking = !!confirmation && !isSuccess && !isError;
|
|
8340
|
+
const review = txStatusReview({
|
|
8341
|
+
transaction,
|
|
8342
|
+
review: reviewProp,
|
|
8343
|
+
explorerUrl,
|
|
8344
|
+
confirmation,
|
|
8345
|
+
network,
|
|
8346
|
+
extraRows,
|
|
8347
|
+
language
|
|
8348
|
+
});
|
|
8349
|
+
const waitingOn = walletType === WalletType.FREIGHTER ? copy.waitingFreighter : walletType === WalletType.ALBEDO ? copy.waitingAlbedo : null;
|
|
8350
|
+
const failed = isError || outcomeNote?.failed === true;
|
|
8351
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-tx-status-view", children: [
|
|
8352
|
+
review && /* @__PURE__ */ jsx("div", { className: "pollar-tx-review", children: /* @__PURE__ */ jsx(
|
|
8353
|
+
TxReview,
|
|
8354
|
+
{
|
|
8355
|
+
data: review,
|
|
8356
|
+
open: showXdr,
|
|
8357
|
+
onToggle: onToggleXdr,
|
|
8358
|
+
language,
|
|
8359
|
+
...asking ? {
|
|
8360
|
+
detailsIntro: { title: confirmCopy.whyTitle, body: confirmCopy.whyBody },
|
|
8361
|
+
detailsAction: { label: confirmCopy.cancelAction, onClick: confirmation.reject }
|
|
8362
|
+
} : {}
|
|
8363
|
+
}
|
|
8364
|
+
) }),
|
|
8365
|
+
asking ? /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: confirmation.confirm, children: review?.kind === "activate_wallet" ? confirmCopy.activateWallet : confirmCopy.confirm }) : isBuilt ? /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onSignAndSend, children: copy.signAndSend }) : (isInFlight || isSuccess || isError) && /* @__PURE__ */ jsxs("div", { className: `pollar-outcome${failed ? " pollar-outcome-bad" : ""}${isInFlight ? " pollar-outcome-busy" : ""}`, children: [
|
|
8366
|
+
/* @__PURE__ */ jsxs("p", { className: "pollar-outcome-main", children: [
|
|
8367
|
+
isInFlight ? SPINNER : /* @__PURE__ */ jsx(OutcomeIcon, { ok: !failed }),
|
|
8368
|
+
isSuccess && successMessage ? successMessage : copy.status[transaction.step]
|
|
8253
8369
|
] }),
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
isError &&
|
|
8370
|
+
isInFlight && waitingOn && transaction.step !== "awaiting_cosign" && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: waitingOn }),
|
|
8371
|
+
transaction.step === "submitted" && transaction.slow && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: copy.slowNote }),
|
|
8372
|
+
isError && errorDetails && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: errorDetails }),
|
|
8373
|
+
outcomeNote && /* @__PURE__ */ jsxs("p", { className: "pollar-outcome-note", children: [
|
|
8374
|
+
!outcomeNote.failed && !isError && SPINNER,
|
|
8375
|
+
outcomeNote.text
|
|
8376
|
+
] })
|
|
8257
8377
|
] }),
|
|
8258
|
-
|
|
8378
|
+
isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain }),
|
|
8259
8379
|
isSuccess && successExtra,
|
|
8260
|
-
isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done })
|
|
8261
|
-
!showSpinner && statusBanner
|
|
8380
|
+
isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done })
|
|
8262
8381
|
] });
|
|
8263
8382
|
}
|
|
8264
8383
|
function formatBalance(balance) {
|
|
@@ -8413,11 +8532,14 @@ function SendModalTemplate({
|
|
|
8413
8532
|
onCopyHash,
|
|
8414
8533
|
onRetry,
|
|
8415
8534
|
onDone,
|
|
8416
|
-
language: languageProp
|
|
8535
|
+
language: languageProp,
|
|
8536
|
+
confirmation = null,
|
|
8537
|
+
network
|
|
8417
8538
|
}) {
|
|
8418
8539
|
const language = useInheritedLanguage(languageProp);
|
|
8419
8540
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
8420
8541
|
const copy = SEND_COPY[language];
|
|
8542
|
+
const txReview = step === "tx" ? txStatusReview({ transaction, explorerUrl, confirmation, network, language }) : null;
|
|
8421
8543
|
const parsedAmount = amount ? Number(amount) : 0;
|
|
8422
8544
|
const availableAmount = selectedAsset?.available === null || selectedAsset?.available === void 0 ? 0 : Number(selectedAsset.available);
|
|
8423
8545
|
const canSubmit = canSendOnChain && !notReadyReason && !!selectedAsset && Number.isFinite(parsedAmount) && parsedAmount > 0 && parsedAmount <= availableAmount && !!destination.trim() && !isLoadingBalance && !isCheckingDestination;
|
|
@@ -8436,7 +8558,7 @@ function SendModalTemplate({
|
|
|
8436
8558
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
|
|
8437
8559
|
showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onBack, "aria-label": copy.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" }) }) }),
|
|
8438
8560
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-title-copy", children: [
|
|
8439
|
-
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title }),
|
|
8561
|
+
step === "tx" ? /* @__PURE__ */ jsx(TxStatusHeading, { review: txReview, fallback: title }) : /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title }),
|
|
8440
8562
|
step === "form" && /* @__PURE__ */ jsx("p", { className: "pollar-send-subtitle", children: copy.subtitle.replace("{chain}", chainLabel(selectedChain, copy)) })
|
|
8441
8563
|
] })
|
|
8442
8564
|
] }),
|
|
@@ -8577,6 +8699,8 @@ function SendModalTemplate({
|
|
|
8577
8699
|
onCopyHash,
|
|
8578
8700
|
onRetry,
|
|
8579
8701
|
onDone,
|
|
8702
|
+
confirmation,
|
|
8703
|
+
network,
|
|
8580
8704
|
language
|
|
8581
8705
|
}
|
|
8582
8706
|
),
|
|
@@ -8629,6 +8753,7 @@ function SendModal({ onClose, initial }) {
|
|
|
8629
8753
|
const language = useModalLanguage();
|
|
8630
8754
|
const copy = SEND_COPY[language];
|
|
8631
8755
|
const [step, setStep] = useState("form");
|
|
8756
|
+
const confirmation = useInlineConfirmation(step === "tx");
|
|
8632
8757
|
const [createsAccount, setCreatesAccount] = useState(false);
|
|
8633
8758
|
const [checkingDestination, setCheckingDestination] = useState(false);
|
|
8634
8759
|
const [amount, setAmount] = useState(() => seededAmount(initial?.amount));
|
|
@@ -8692,7 +8817,7 @@ function SendModal({ onClose, initial }) {
|
|
|
8692
8817
|
"signing-submitting",
|
|
8693
8818
|
"building-signing-submitting"
|
|
8694
8819
|
];
|
|
8695
|
-
const isInProgress = IN_FLIGHT_STEPS3.includes(transaction.step);
|
|
8820
|
+
const isInProgress = IN_FLIGHT_STEPS3.includes(transaction.step) && !(transaction.step === "submitted" && transaction.slow);
|
|
8696
8821
|
const showBack = step === "create-account" || step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
8697
8822
|
const txTitle = createsAccount ? isInProgress ? copy.tx.creatingAccount : transaction.step === "success" ? copy.tx.accountCreated : transaction.step === "error" ? copy.tx.createAccountFailed : copy.tx.confirmCreateAccount : isInProgress ? copy.tx.sending : transaction.step === "success" ? copy.tx.sent : transaction.step === "error" ? copy.tx.sendFailed : copy.tx.confirmSend;
|
|
8698
8823
|
async function stellarAccountExists(address) {
|
|
@@ -8845,7 +8970,7 @@ function SendModal({ onClose, initial }) {
|
|
|
8845
8970
|
setShowXdr(false);
|
|
8846
8971
|
setCopied(false);
|
|
8847
8972
|
}
|
|
8848
|
-
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
|
|
8973
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
|
|
8849
8974
|
SendModalTemplate,
|
|
8850
8975
|
{
|
|
8851
8976
|
theme,
|
|
@@ -8892,7 +9017,9 @@ function SendModal({ onClose, initial }) {
|
|
|
8892
9017
|
onCopyHash: handleCopyHash,
|
|
8893
9018
|
onRetry: () => void handleRetry(),
|
|
8894
9019
|
onDone: onClose,
|
|
8895
|
-
language
|
|
9020
|
+
language,
|
|
9021
|
+
confirmation,
|
|
9022
|
+
network
|
|
8896
9023
|
}
|
|
8897
9024
|
) });
|
|
8898
9025
|
}
|
|
@@ -8916,7 +9043,6 @@ var SWAP_COPY = {
|
|
|
8916
9043
|
assetToReceive: "Asset to receive",
|
|
8917
9044
|
max: "Max",
|
|
8918
9045
|
reverse: "Swap pay and receive assets",
|
|
8919
|
-
quotedAmount: "Quoted amount",
|
|
8920
9046
|
customCodePlaceholder: "Code (e.g. USDC)",
|
|
8921
9047
|
customIssuerPlaceholder: "Issuer (G...)",
|
|
8922
9048
|
addToken: "Add token",
|
|
@@ -8985,7 +9111,6 @@ var SWAP_COPY = {
|
|
|
8985
9111
|
assetToReceive: "Activo a recibir",
|
|
8986
9112
|
max: "M\xE1x.",
|
|
8987
9113
|
reverse: "Invertir activos a pagar y recibir",
|
|
8988
|
-
quotedAmount: "Monto cotizado",
|
|
8989
9114
|
customCodePlaceholder: "C\xF3digo (p. ej. USDC)",
|
|
8990
9115
|
customIssuerPlaceholder: "Emisor (G...)",
|
|
8991
9116
|
addToken: "Agregar token",
|
|
@@ -9054,7 +9179,6 @@ var SWAP_COPY = {
|
|
|
9054
9179
|
assetToReceive: "Ativo a receber",
|
|
9055
9180
|
max: "M\xE1x.",
|
|
9056
9181
|
reverse: "Inverter ativos a pagar e receber",
|
|
9057
|
-
quotedAmount: "Valor cotado",
|
|
9058
9182
|
customCodePlaceholder: "C\xF3digo (ex.: USDC)",
|
|
9059
9183
|
customIssuerPlaceholder: "Emissor (G...)",
|
|
9060
9184
|
addToken: "Adicionar token",
|
|
@@ -9202,6 +9326,8 @@ function SwapModalTemplate({
|
|
|
9202
9326
|
destination = "SOLANA",
|
|
9203
9327
|
usdcAcross = false,
|
|
9204
9328
|
settlement = null,
|
|
9329
|
+
confirmation = null,
|
|
9330
|
+
network,
|
|
9205
9331
|
provider,
|
|
9206
9332
|
providers,
|
|
9207
9333
|
quote,
|
|
@@ -9241,6 +9367,19 @@ function SwapModalTemplate({
|
|
|
9241
9367
|
}) {
|
|
9242
9368
|
const language = useInheritedLanguage(languageProp);
|
|
9243
9369
|
const copy = SWAP_COPY[language];
|
|
9370
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
9371
|
+
const [detailsOpen, setDetailsOpen] = useState(false);
|
|
9372
|
+
const settlementRows = settlement ? [
|
|
9373
|
+
...settlement.address ? [{ label: copy.deliveredTo, value: settlement.address, copyValue: settlement.address, mono: true }] : [],
|
|
9374
|
+
...settlement.explorerUrl ? [
|
|
9375
|
+
{
|
|
9376
|
+
label: TX_REVIEW_COPY[language].viewOnExplorer,
|
|
9377
|
+
value: settlement.explorerUrl.replace(/^https:\/\//, "").split("/")[0] ?? settlement.explorerUrl,
|
|
9378
|
+
href: settlement.explorerUrl
|
|
9379
|
+
}
|
|
9380
|
+
] : []
|
|
9381
|
+
] : [];
|
|
9382
|
+
const txReview = step === "tx" ? txStatusReview({ transaction, explorerUrl, confirmation, network, extraRows: settlementRows, language }) : null;
|
|
9244
9383
|
const [customOpen, setCustomOpen] = useState(false);
|
|
9245
9384
|
const [customCode, setCustomCode] = useState("");
|
|
9246
9385
|
const [customIssuer, setCustomIssuer] = useState("");
|
|
@@ -9282,7 +9421,7 @@ function SwapModalTemplate({
|
|
|
9282
9421
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
9283
9422
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
|
|
9284
9423
|
showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onBack, "aria-label": copy.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 3 5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
|
|
9285
|
-
/* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
|
|
9424
|
+
step === "tx" ? /* @__PURE__ */ jsx(TxStatusHeading, { review: txReview, fallback: title }) : /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
|
|
9286
9425
|
] }),
|
|
9287
9426
|
!isInProgress && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
9288
9427
|
step === "form" && /* @__PURE__ */ jsx(
|
|
@@ -9333,14 +9472,7 @@ function SwapModalTemplate({
|
|
|
9333
9472
|
smartUnsupported && chain === "STELLAR" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: copy.smartUnavailable }),
|
|
9334
9473
|
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-panels", children: [
|
|
9335
9474
|
/* @__PURE__ */ jsxs("section", { className: "pollar-swap-panel", "aria-labelledby": "pollar-swap-pay-label", children: [
|
|
9336
|
-
/* @__PURE__ */
|
|
9337
|
-
/* @__PURE__ */ jsx("span", { id: "pollar-swap-pay-label", className: "pollar-swap-panel-label", children: copy.youPay }),
|
|
9338
|
-
/* @__PURE__ */ jsxs("span", { className: "pollar-swap-balance", children: [
|
|
9339
|
-
copy.balance,
|
|
9340
|
-
" ",
|
|
9341
|
-
formatAmount2(selectedSell?.available)
|
|
9342
|
-
] })
|
|
9343
|
-
] }),
|
|
9475
|
+
/* @__PURE__ */ jsx("span", { id: "pollar-swap-pay-label", className: "pollar-swap-panel-label", children: copy.youPay }),
|
|
9344
9476
|
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-panel-main", children: [
|
|
9345
9477
|
/* @__PURE__ */ jsx(
|
|
9346
9478
|
"input",
|
|
@@ -9355,29 +9487,35 @@ function SwapModalTemplate({
|
|
|
9355
9487
|
onChange: (event) => onAmountChange(event.target.value)
|
|
9356
9488
|
}
|
|
9357
9489
|
),
|
|
9358
|
-
/* @__PURE__ */
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9490
|
+
/* @__PURE__ */ jsx(
|
|
9491
|
+
AssetPill,
|
|
9492
|
+
{
|
|
9493
|
+
label: copy.assetToPay,
|
|
9494
|
+
value: sellKey,
|
|
9495
|
+
options: sellOptions,
|
|
9496
|
+
disabled: configLoading || isLoadingData,
|
|
9497
|
+
copy,
|
|
9498
|
+
onChange: selectSell
|
|
9499
|
+
}
|
|
9500
|
+
)
|
|
9501
|
+
] }),
|
|
9502
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-panel-foot", children: [
|
|
9503
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-swap-balance", children: [
|
|
9504
|
+
copy.balance,
|
|
9505
|
+
" ",
|
|
9506
|
+
formatAmount2(selectedSell?.available)
|
|
9507
|
+
] }),
|
|
9508
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, children: "\xB7" }),
|
|
9509
|
+
/* @__PURE__ */ jsx(
|
|
9510
|
+
"button",
|
|
9511
|
+
{
|
|
9512
|
+
type: "button",
|
|
9513
|
+
className: "pollar-swap-max",
|
|
9514
|
+
onClick: onMax,
|
|
9515
|
+
disabled: !selectedSell?.available || configLoading || isLoadingData,
|
|
9516
|
+
children: copy.max
|
|
9517
|
+
}
|
|
9518
|
+
)
|
|
9381
9519
|
] })
|
|
9382
9520
|
] }),
|
|
9383
9521
|
/* @__PURE__ */ jsx(
|
|
@@ -9402,31 +9540,26 @@ function SwapModalTemplate({
|
|
|
9402
9540
|
}
|
|
9403
9541
|
),
|
|
9404
9542
|
/* @__PURE__ */ jsxs("section", { className: "pollar-swap-panel", "aria-labelledby": "pollar-swap-receive-label", children: [
|
|
9405
|
-
/* @__PURE__ */
|
|
9406
|
-
/* @__PURE__ */ jsx("span", { id: "pollar-swap-receive-label", className: "pollar-swap-panel-label", children: copy.youReceive }),
|
|
9407
|
-
/* @__PURE__ */ jsxs("span", { className: "pollar-swap-balance", children: [
|
|
9408
|
-
copy.balance,
|
|
9409
|
-
" ",
|
|
9410
|
-
formatAmount2(selectedBuy?.available)
|
|
9411
|
-
] })
|
|
9412
|
-
] }),
|
|
9543
|
+
/* @__PURE__ */ jsx("span", { id: "pollar-swap-receive-label", className: "pollar-swap-panel-label", children: copy.youReceive }),
|
|
9413
9544
|
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-panel-main", children: [
|
|
9414
9545
|
/* @__PURE__ */ jsx("div", { className: `pollar-swap-output${quoteLoading ? " is-loading" : ""}`, "aria-live": "polite", children: quoteLoading ? /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }) : quote ? `~${formatAmount2(quote.amountOut)}` : "\u2014" }),
|
|
9415
|
-
/* @__PURE__ */
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9546
|
+
/* @__PURE__ */ jsx(
|
|
9547
|
+
AssetPill,
|
|
9548
|
+
{
|
|
9549
|
+
label: copy.assetToReceive,
|
|
9550
|
+
value: buyKey,
|
|
9551
|
+
options: buyOptions,
|
|
9552
|
+
disabled: configLoading || isLoadingData,
|
|
9553
|
+
copy,
|
|
9554
|
+
onChange: selectBuy
|
|
9555
|
+
}
|
|
9556
|
+
)
|
|
9557
|
+
] }),
|
|
9558
|
+
/* @__PURE__ */ jsx("div", { className: "pollar-swap-panel-foot", children: /* @__PURE__ */ jsxs("span", { className: "pollar-swap-balance", children: [
|
|
9559
|
+
copy.balance,
|
|
9560
|
+
" ",
|
|
9561
|
+
formatAmount2(selectedBuy?.available)
|
|
9562
|
+
] }) })
|
|
9430
9563
|
] })
|
|
9431
9564
|
] }),
|
|
9432
9565
|
chain === "STELLAR" && /* @__PURE__ */ jsx("div", { className: "pollar-swap-custom-area", children: customOpen ? /* @__PURE__ */ jsxs("div", { className: "pollar-swap-custom", children: [
|
|
@@ -9485,60 +9618,89 @@ function SwapModalTemplate({
|
|
|
9485
9618
|
" ",
|
|
9486
9619
|
selectedBuy.code
|
|
9487
9620
|
] }) : quoteLoading ? copy.updatingRate : copy.rateUnavailable }),
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9621
|
+
/* @__PURE__ */ jsxs(
|
|
9622
|
+
"button",
|
|
9623
|
+
{
|
|
9624
|
+
type: "button",
|
|
9625
|
+
className: "pollar-txr-toggle",
|
|
9626
|
+
"aria-expanded": detailsOpen,
|
|
9627
|
+
onClick: () => setDetailsOpen((open) => !open),
|
|
9628
|
+
children: [
|
|
9629
|
+
detailsOpen ? reviewCopy.hideDetails : reviewCopy.showDetails,
|
|
9630
|
+
/* @__PURE__ */ jsx(
|
|
9631
|
+
"svg",
|
|
9632
|
+
{
|
|
9633
|
+
width: "10",
|
|
9634
|
+
height: "10",
|
|
9635
|
+
viewBox: "0 0 12 12",
|
|
9636
|
+
fill: "none",
|
|
9637
|
+
"aria-hidden": true,
|
|
9638
|
+
style: { transform: detailsOpen ? "rotate(180deg)" : "none", transition: "transform 150ms" },
|
|
9639
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
9640
|
+
}
|
|
9641
|
+
)
|
|
9642
|
+
]
|
|
9643
|
+
}
|
|
9644
|
+
)
|
|
9509
9645
|
] }),
|
|
9510
9646
|
!quoteLoading && quoteError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: quoteError }),
|
|
9511
9647
|
usdcAcross && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: copy.useTransferForUsdc }),
|
|
9512
9648
|
!usdcAcross && !quoteLoading && !quoteError && !quote && selectedSell && selectedBuy && !!amount && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: copy.noRoute }),
|
|
9513
|
-
|
|
9514
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9515
|
-
/* @__PURE__ */ jsx("span", { children: copy.minimumReceived }),
|
|
9516
|
-
/* @__PURE__ */ jsxs("strong", { children: [
|
|
9517
|
-
formatAmount2(quote.minReceived),
|
|
9518
|
-
" ",
|
|
9519
|
-
selectedBuy?.code
|
|
9520
|
-
] })
|
|
9521
|
-
] }),
|
|
9522
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9523
|
-
/* @__PURE__ */ jsx("span", { children: copy.priceImpact }),
|
|
9524
|
-
/* @__PURE__ */ jsx("strong", { children: quote.priceImpactPct === null ? "\u2014" : `${quote.priceImpactPct}%` })
|
|
9525
|
-
] }),
|
|
9649
|
+
detailsOpen && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
|
|
9526
9650
|
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9527
9651
|
/* @__PURE__ */ jsx("span", { children: copy.route }),
|
|
9528
|
-
/* @__PURE__ */
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
/* @__PURE__ */
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
|
|
9536
|
-
|
|
9537
|
-
|
|
9538
|
-
|
|
9652
|
+
configLoading ? /* @__PURE__ */ jsxs("div", { className: "pollar-swap-route-pill", children: [
|
|
9653
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
|
|
9654
|
+
" ",
|
|
9655
|
+
copy.loading
|
|
9656
|
+
] }) : /* @__PURE__ */ jsxs("label", { className: "pollar-swap-route-wrap", children: [
|
|
9657
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: copy.route }),
|
|
9658
|
+
/* @__PURE__ */ jsx(
|
|
9659
|
+
PollarSelect,
|
|
9660
|
+
{
|
|
9661
|
+
className: "pollar-swap-route-pill",
|
|
9662
|
+
"aria-label": copy.route,
|
|
9663
|
+
value: provider,
|
|
9664
|
+
disabled: providers.length === 0,
|
|
9665
|
+
onChange: onProviderChange,
|
|
9666
|
+
options: (providers.length === 0 ? [provider] : providers).map((p) => ({
|
|
9667
|
+
value: p,
|
|
9668
|
+
label: providerLabel(p, copy)
|
|
9669
|
+
}))
|
|
9670
|
+
}
|
|
9671
|
+
)
|
|
9539
9672
|
] })
|
|
9540
9673
|
] }),
|
|
9541
|
-
quote
|
|
9674
|
+
quote && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9675
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9676
|
+
/* @__PURE__ */ jsx("span", { children: copy.minimumReceived }),
|
|
9677
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
9678
|
+
formatAmount2(quote.minReceived),
|
|
9679
|
+
" ",
|
|
9680
|
+
selectedBuy?.code
|
|
9681
|
+
] })
|
|
9682
|
+
] }),
|
|
9683
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9684
|
+
/* @__PURE__ */ jsx("span", { children: copy.priceImpact }),
|
|
9685
|
+
/* @__PURE__ */ jsx("strong", { children: quote.priceImpactPct === null ? "\u2014" : `${quote.priceImpactPct}%` })
|
|
9686
|
+
] }),
|
|
9687
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9688
|
+
/* @__PURE__ */ jsx("span", { children: copy.route }),
|
|
9689
|
+
/* @__PURE__ */ jsx("strong", { children: providerLabel(quote.provider, copy) })
|
|
9690
|
+
] }),
|
|
9691
|
+
(quote.fees ?? []).map((fee) => /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9692
|
+
/* @__PURE__ */ jsx("span", { children: fee.label }),
|
|
9693
|
+
/* @__PURE__ */ jsx("strong", { children: fee.value })
|
|
9694
|
+
] }, fee.label)),
|
|
9695
|
+
quote.totalFeesUsd != null && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9696
|
+
/* @__PURE__ */ jsx("span", { children: copy.totalFees }),
|
|
9697
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
9698
|
+
"$",
|
|
9699
|
+
quote.totalFeesUsd.toFixed(2)
|
|
9700
|
+
] })
|
|
9701
|
+
] }),
|
|
9702
|
+
quote.expiresInSeconds != null && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", "aria-live": "off", children: copy.priceRefreshesIn(quote.expiresInSeconds) })
|
|
9703
|
+
] })
|
|
9542
9704
|
] }),
|
|
9543
9705
|
buyNeedsTrustline && selectedBuy && /* @__PURE__ */ jsx("div", { className: "pollar-swap-trustline-notice", children: copy.trustlineNotice(selectedBuy.code) }),
|
|
9544
9706
|
sameAsset && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: copy.sameAsset }),
|
|
@@ -9558,23 +9720,11 @@ function SwapModalTemplate({
|
|
|
9558
9720
|
onToggleXdr,
|
|
9559
9721
|
onCopyHash,
|
|
9560
9722
|
onRetry,
|
|
9561
|
-
onDone
|
|
9562
|
-
|
|
9563
|
-
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
{
|
|
9567
|
-
className: settlement.kind === "failed" ? "pollar-modal-error" : "pollar-swap-quote",
|
|
9568
|
-
role: "status",
|
|
9569
|
-
"aria-live": "polite",
|
|
9570
|
-
children: [
|
|
9571
|
-
/* @__PURE__ */ jsx("div", { children: settlement.text }),
|
|
9572
|
-
settlement.address && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
9573
|
-
/* @__PURE__ */ jsx("span", { children: copy.deliveredTo }),
|
|
9574
|
-
/* @__PURE__ */ jsx("code", { style: { wordBreak: "break-all" }, children: settlement.address })
|
|
9575
|
-
] }),
|
|
9576
|
-
settlement.explorerUrl && /* @__PURE__ */ jsx("a", { href: settlement.explorerUrl, target: "_blank", rel: "noopener noreferrer", children: settlement.explorerUrl.replace(/^https:\/\//, "").split("/")[0] })
|
|
9577
|
-
]
|
|
9723
|
+
onDone,
|
|
9724
|
+
confirmation,
|
|
9725
|
+
network,
|
|
9726
|
+
extraRows: settlementRows,
|
|
9727
|
+
...settlement ? { outcomeNote: { text: settlement.text, failed: settlement.kind === "failed" } } : {}
|
|
9578
9728
|
}
|
|
9579
9729
|
),
|
|
9580
9730
|
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
@@ -9649,6 +9799,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
9649
9799
|
const smartUnsupported = chain === "STELLAR" && wallet?.custody === "smart";
|
|
9650
9800
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
9651
9801
|
const [step, setStep] = useState("form");
|
|
9802
|
+
const confirmation = useInlineConfirmation(step === "tx");
|
|
9652
9803
|
const [selectedSell, setSelectedSell] = useState(null);
|
|
9653
9804
|
const [selectedBuy, setSelectedBuy] = useState(null);
|
|
9654
9805
|
const [amount, setAmount] = useState(() => seededAmount(initial?.amount));
|
|
@@ -10007,7 +10158,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10007
10158
|
"signing-submitting",
|
|
10008
10159
|
"building-signing-submitting"
|
|
10009
10160
|
];
|
|
10010
|
-
const isInProgress = IN_FLIGHT_STEPS3.includes(transaction.step);
|
|
10161
|
+
const isInProgress = IN_FLIGHT_STEPS3.includes(transaction.step) && !(transaction.step === "submitted" && transaction.slow);
|
|
10011
10162
|
const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
10012
10163
|
const txTitle = isInProgress ? copy.swapping : transaction.step === "success" ? copy.swapped : transaction.step === "error" ? copy.swapFailed : copy.confirmSwap;
|
|
10013
10164
|
async function handleSwap() {
|
|
@@ -10088,7 +10239,7 @@ function SwapModal({ onClose, initial }) {
|
|
|
10088
10239
|
setShowXdr(false);
|
|
10089
10240
|
setCopied(false);
|
|
10090
10241
|
}
|
|
10091
|
-
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
|
|
10242
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
|
|
10092
10243
|
SwapModalTemplate,
|
|
10093
10244
|
{
|
|
10094
10245
|
theme,
|
|
@@ -10107,6 +10258,8 @@ function SwapModal({ onClose, initial }) {
|
|
|
10107
10258
|
destination,
|
|
10108
10259
|
usdcAcross,
|
|
10109
10260
|
settlement: settlementView,
|
|
10261
|
+
confirmation,
|
|
10262
|
+
network,
|
|
10110
10263
|
provider,
|
|
10111
10264
|
providers,
|
|
10112
10265
|
quote: quoteView,
|
|
@@ -10398,8 +10551,10 @@ function Progress({ transfer, labels }) {
|
|
|
10398
10551
|
attest: transfer.status === "ATTESTED" || transfer.status === "COMPLETED" || !!transfer.mintTxHash,
|
|
10399
10552
|
mint: transfer.status === "COMPLETED"
|
|
10400
10553
|
};
|
|
10401
|
-
|
|
10402
|
-
|
|
10554
|
+
const order = ["burn", "attest", "mint"];
|
|
10555
|
+
const current = order.find((key) => !reached[key]);
|
|
10556
|
+
return /* @__PURE__ */ jsx("ol", { className: "pollar-bridge-steps", children: order.map((key) => /* @__PURE__ */ jsxs("li", { className: reached[key] ? "pollar-bridge-step pollar-bridge-step-done" : "pollar-bridge-step", children: [
|
|
10557
|
+
reached[key] ? /* @__PURE__ */ jsx(OutcomeIcon, { ok: true }) : key === current && transfer.status !== "FAILED" ? /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }) : /* @__PURE__ */ jsx("span", { className: "pollar-bridge-step-dot", "aria-hidden": true }),
|
|
10403
10558
|
labels[key]
|
|
10404
10559
|
] }, key)) });
|
|
10405
10560
|
}
|
|
@@ -10408,6 +10563,32 @@ function BridgeModalTemplate(props) {
|
|
|
10408
10563
|
const copy = BRIDGE_COPY[language];
|
|
10409
10564
|
const cssVars = buildModalCssVars(props.theme, props.accentColor, props.styleOverrides);
|
|
10410
10565
|
const { transfer, quote } = props;
|
|
10566
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
10567
|
+
const transferReview = transfer ? {
|
|
10568
|
+
kind: "bridge",
|
|
10569
|
+
title: reviewCopy.titles.bridge(`${transfer.amount} USDC`, BRIDGE_CHAIN_LABEL[transfer.toChain]),
|
|
10570
|
+
from: { chain: transfer.fromChain, asset: "USDC", amount: transfer.amount, self: true },
|
|
10571
|
+
to: { chain: transfer.toChain, asset: "USDC", amount: transfer.amountOut ?? transfer.amount, self: true },
|
|
10572
|
+
rows: [
|
|
10573
|
+
...transfer.burnTxHash ? [
|
|
10574
|
+
{
|
|
10575
|
+
label: fill(copy.viewBurn, { chain: BRIDGE_CHAIN_LABEL[transfer.fromChain] }),
|
|
10576
|
+
value: `${transfer.burnTxHash.slice(0, 8)}\u2026${transfer.burnTxHash.slice(-6)}`,
|
|
10577
|
+
href: EXPLORER[transfer.fromChain](transfer.burnTxHash),
|
|
10578
|
+
copyValue: transfer.burnTxHash
|
|
10579
|
+
}
|
|
10580
|
+
] : [],
|
|
10581
|
+
...transfer.mintTxHash ? [
|
|
10582
|
+
{
|
|
10583
|
+
label: fill(copy.viewMint, { chain: BRIDGE_CHAIN_LABEL[transfer.toChain] }),
|
|
10584
|
+
value: `${transfer.mintTxHash.slice(0, 8)}\u2026${transfer.mintTxHash.slice(-6)}`,
|
|
10585
|
+
href: EXPLORER[transfer.toChain](transfer.mintTxHash),
|
|
10586
|
+
copyValue: transfer.mintTxHash
|
|
10587
|
+
}
|
|
10588
|
+
] : []
|
|
10589
|
+
]
|
|
10590
|
+
} : null;
|
|
10591
|
+
const inTransfer = props.step === "transfer" && !!transfer;
|
|
10411
10592
|
const busy = props.submitting || props.quoting;
|
|
10412
10593
|
const toName = props.toChain ? BRIDGE_CHAIN_LABEL[props.toChain] : "";
|
|
10413
10594
|
const signingNote = quote?.signing === "EXTERNAL" ? copy.signingExternal : quote?.signing === "COSIGNED" || quote?.signing === "SELF_CUSTODY" ? copy.signingCosigned : copy.signingInternal;
|
|
@@ -10420,7 +10601,10 @@ function BridgeModalTemplate(props) {
|
|
|
10420
10601
|
onClick: (event) => event.stopPropagation(),
|
|
10421
10602
|
children: [
|
|
10422
10603
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
10423
|
-
/* @__PURE__ */
|
|
10604
|
+
inTransfer && transferReview ? /* @__PURE__ */ jsxs("h2", { className: "pollar-modal-title pollar-cosign-heading", children: [
|
|
10605
|
+
/* @__PURE__ */ jsx(TitleMark, { chain: transfer.fromChain, asset: "USDC" }),
|
|
10606
|
+
/* @__PURE__ */ jsx("span", { children: transferReview.title })
|
|
10607
|
+
] }) : /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: copy.title }),
|
|
10424
10608
|
/* @__PURE__ */ jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: props.onClose, "aria-label": copy.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" }) }) }) })
|
|
10425
10609
|
] }),
|
|
10426
10610
|
props.step === "loading" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: copy.loading }),
|
|
@@ -10504,34 +10688,40 @@ function BridgeModalTemplate(props) {
|
|
|
10504
10688
|
}
|
|
10505
10689
|
) })
|
|
10506
10690
|
] }),
|
|
10507
|
-
|
|
10508
|
-
/* @__PURE__ */
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
from: BRIDGE_CHAIN_LABEL[transfer.fromChain],
|
|
10512
|
-
to: BRIDGE_CHAIN_LABEL[transfer.toChain],
|
|
10513
|
-
amount: transfer.amountOut ?? transfer.amount
|
|
10514
|
-
}) })
|
|
10515
|
-
] }),
|
|
10516
|
-
/* @__PURE__ */ jsx(
|
|
10517
|
-
Progress,
|
|
10691
|
+
inTransfer && transfer && transferReview && /* @__PURE__ */ jsxs("div", { className: "pollar-bridge-transfer", children: [
|
|
10692
|
+
/* @__PURE__ */ jsx(TxReview, { data: transferReview, language }),
|
|
10693
|
+
props.confirmation ? /* @__PURE__ */ jsx(InlineConfirm, { confirmation: props.confirmation, language }) : /* @__PURE__ */ jsxs(
|
|
10694
|
+
"div",
|
|
10518
10695
|
{
|
|
10519
|
-
transfer
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10696
|
+
className: `pollar-outcome${transfer.status === "FAILED" ? " pollar-outcome-bad" : ""}${transfer.status === "COMPLETED" || transfer.status === "FAILED" ? "" : " pollar-outcome-busy"}`,
|
|
10697
|
+
children: [
|
|
10698
|
+
/* @__PURE__ */ jsxs("p", { className: "pollar-outcome-main", children: [
|
|
10699
|
+
transfer.status === "COMPLETED" || transfer.status === "FAILED" ? /* @__PURE__ */ jsx(OutcomeIcon, { ok: transfer.status === "COMPLETED" }) : /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
10700
|
+
copy.statusTitle[transfer.status]
|
|
10701
|
+
] }),
|
|
10702
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: fill(copy.statusBody[transfer.status], {
|
|
10703
|
+
from: BRIDGE_CHAIN_LABEL[transfer.fromChain],
|
|
10704
|
+
to: BRIDGE_CHAIN_LABEL[transfer.toChain],
|
|
10705
|
+
amount: transfer.amountOut ?? transfer.amount
|
|
10706
|
+
}) }),
|
|
10707
|
+
/* @__PURE__ */ jsx(
|
|
10708
|
+
Progress,
|
|
10709
|
+
{
|
|
10710
|
+
transfer,
|
|
10711
|
+
labels: {
|
|
10712
|
+
burn: fill(copy.steps.burn, { from: BRIDGE_CHAIN_LABEL[transfer.fromChain] }),
|
|
10713
|
+
attest: copy.steps.attest,
|
|
10714
|
+
mint: fill(copy.steps.mint, { to: BRIDGE_CHAIN_LABEL[transfer.toChain] })
|
|
10715
|
+
}
|
|
10716
|
+
}
|
|
10717
|
+
),
|
|
10718
|
+
props.pollTrouble && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: copy.pollTrouble })
|
|
10719
|
+
]
|
|
10525
10720
|
}
|
|
10526
10721
|
),
|
|
10527
|
-
transfer.pendingAction?.kind === "SIGNATURE" && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", disabled: props.signing, onClick: props.onAuthorize, children: props.signing ? copy.waitingWallet : copy.authorize }),
|
|
10722
|
+
!props.confirmation && transfer.pendingAction?.kind === "SIGNATURE" && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", disabled: props.signing, onClick: props.onAuthorize, children: props.signing ? copy.waitingWallet : copy.authorize }),
|
|
10528
10723
|
transfer.pendingAction?.kind === "COSIGN_APPROVAL" && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: props.onApprove, children: copy.approveOnDevice }),
|
|
10529
10724
|
props.actionError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: props.actionError }),
|
|
10530
|
-
props.pollTrouble && /* @__PURE__ */ jsx("div", { className: "pollar-bridge-note", children: copy.pollTrouble }),
|
|
10531
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-bridge-links", children: [
|
|
10532
|
-
transfer.burnTxHash && /* @__PURE__ */ jsx("a", { href: EXPLORER[transfer.fromChain](transfer.burnTxHash), target: "_blank", rel: "noopener noreferrer", children: fill(copy.viewBurn, { chain: BRIDGE_CHAIN_LABEL[transfer.fromChain] }) }),
|
|
10533
|
-
transfer.mintTxHash && /* @__PURE__ */ jsx("a", { href: EXPLORER[transfer.toChain](transfer.mintTxHash), target: "_blank", rel: "noopener noreferrer", children: fill(copy.viewMint, { chain: BRIDGE_CHAIN_LABEL[transfer.toChain] }) })
|
|
10534
|
-
] }),
|
|
10535
10725
|
(transfer.status === "COMPLETED" || transfer.status === "FAILED") && /* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
|
|
10536
10726
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: props.onNewBridge, children: copy.newBridge }),
|
|
10537
10727
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: props.onClose, children: copy.done })
|
|
@@ -10727,7 +10917,8 @@ function BridgeModal({ onClose, initial }) {
|
|
|
10727
10917
|
void refreshWalletBalance();
|
|
10728
10918
|
}
|
|
10729
10919
|
const step = transfer ? "transfer" : !config && !configError ? "loading" : config && (!config.available || sources.length === 0) ? "unavailable" : "form";
|
|
10730
|
-
|
|
10920
|
+
const confirmation = useInlineConfirmation(step === "transfer");
|
|
10921
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step === "transfer" ? void 0 : onClose, children: /* @__PURE__ */ jsx(
|
|
10731
10922
|
BridgeModalTemplate,
|
|
10732
10923
|
{
|
|
10733
10924
|
theme,
|
|
@@ -10763,7 +10954,8 @@ function BridgeModal({ onClose, initial }) {
|
|
|
10763
10954
|
pollTrouble,
|
|
10764
10955
|
onNewBridge: newBridge,
|
|
10765
10956
|
onClose,
|
|
10766
|
-
language
|
|
10957
|
+
language,
|
|
10958
|
+
confirmation
|
|
10767
10959
|
}
|
|
10768
10960
|
) });
|
|
10769
10961
|
}
|
|
@@ -10988,6 +11180,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
10988
11180
|
const smartUnsupported = !onSolana && wallet?.custody === "smart";
|
|
10989
11181
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
10990
11182
|
const [step, setStep] = useState("form");
|
|
11183
|
+
const confirmation = useInlineConfirmation(step === "tx");
|
|
10991
11184
|
const [tab, setTab] = useState(
|
|
10992
11185
|
() => oneOf(["deposit", "withdraw"], initial?.tab) ?? "deposit"
|
|
10993
11186
|
);
|
|
@@ -11114,7 +11307,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
11114
11307
|
const buildData = "buildData" in transaction ? transaction.buildData : null;
|
|
11115
11308
|
const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
|
|
11116
11309
|
const explorerUrl = !hash ? null : onSolana ? `https://solscan.io/tx/${hash}${network === "testnet" ? "?cluster=devnet" : ""}` : `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}`;
|
|
11117
|
-
const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
|
|
11310
|
+
const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step) && !(transaction.step === "submitted" && transaction.slow);
|
|
11118
11311
|
const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
11119
11312
|
const txTitle = isInProgress ? tab === "deposit" ? copy.depositing : copy.withdrawing : transaction.step === "success" ? tab === "deposit" ? copy.depositDone : copy.withdrawDone : transaction.step === "error" ? tab === "deposit" ? copy.depositFailed : copy.withdrawFailed : copy.confirm;
|
|
11120
11313
|
const parsedAmount = parseFloat(amount);
|
|
@@ -11265,7 +11458,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
11265
11458
|
rows: [{ label: copy.yourPosition, value: position.balance }]
|
|
11266
11459
|
}
|
|
11267
11460
|
) : null;
|
|
11268
|
-
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxs(
|
|
11461
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: step !== "tx" && !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxs(
|
|
11269
11462
|
"div",
|
|
11270
11463
|
{
|
|
11271
11464
|
className: "pollar-modal-card pollar-send-modal",
|
|
@@ -11276,7 +11469,20 @@ function EarnModal({ onClose, initial }) {
|
|
|
11276
11469
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
|
|
11277
11470
|
/* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
|
|
11278
11471
|
showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: handleBack, "aria-label": copy.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" }) }) }),
|
|
11279
|
-
/* @__PURE__ */ jsx(
|
|
11472
|
+
step === "tx" ? /* @__PURE__ */ jsx(
|
|
11473
|
+
TxStatusHeading,
|
|
11474
|
+
{
|
|
11475
|
+
review: txStatusReview({
|
|
11476
|
+
transaction,
|
|
11477
|
+
review: submissionReview,
|
|
11478
|
+
explorerUrl,
|
|
11479
|
+
confirmation,
|
|
11480
|
+
network,
|
|
11481
|
+
language
|
|
11482
|
+
}),
|
|
11483
|
+
fallback: title
|
|
11484
|
+
}
|
|
11485
|
+
) : /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
|
|
11280
11486
|
] }),
|
|
11281
11487
|
/* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
|
|
11282
11488
|
step === "form" && !earnUnavailable && !smartUnsupported && /* @__PURE__ */ jsx(
|
|
@@ -11462,11 +11668,10 @@ function EarnModal({ onClose, initial }) {
|
|
|
11462
11668
|
onDone: onClose,
|
|
11463
11669
|
language,
|
|
11464
11670
|
review: submissionReview,
|
|
11671
|
+
confirmation,
|
|
11672
|
+
network,
|
|
11465
11673
|
successMessage: submission ? earnOutcome(submission, reviewCopy) : void 0,
|
|
11466
|
-
successExtra: submission && /* @__PURE__ */
|
|
11467
|
-
resultPosition,
|
|
11468
|
-
explorerUrl && /* @__PURE__ */ jsx(TxExplorerLink, { chain: submission.chain, url: explorerUrl, language })
|
|
11469
|
-
] })
|
|
11674
|
+
successExtra: submission && /* @__PURE__ */ jsx(Fragment, { children: resultPosition })
|
|
11470
11675
|
}
|
|
11471
11676
|
),
|
|
11472
11677
|
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
@@ -12135,6 +12340,8 @@ function CardModal({ onClose, initial }) {
|
|
|
12135
12340
|
const [secrets, setSecrets] = useState(null);
|
|
12136
12341
|
const [panel, setPanel] = useState("card");
|
|
12137
12342
|
const [busy, setBusy] = useState(null);
|
|
12343
|
+
const confirmation = useInlineConfirmation(busy === "fund-send");
|
|
12344
|
+
const [sentFundingId, setSentFundingId] = useState(null);
|
|
12138
12345
|
const [error, setError] = useState("");
|
|
12139
12346
|
const revealTimer = useRef(null);
|
|
12140
12347
|
const provider = providers?.[0] ?? null;
|
|
@@ -12342,6 +12549,7 @@ function CardModal({ onClose, initial }) {
|
|
|
12342
12549
|
return;
|
|
12343
12550
|
}
|
|
12344
12551
|
setFundings((cur) => [outcome.funding, ...(cur ?? []).filter((f) => f.id !== outcome.funding.id)]);
|
|
12552
|
+
setSentFundingId(outcome.funding.id);
|
|
12345
12553
|
setFundAmount("");
|
|
12346
12554
|
initial?.onFunded?.(outcome.funding);
|
|
12347
12555
|
},
|
|
@@ -12452,7 +12660,9 @@ function CardModal({ onClose, initial }) {
|
|
|
12452
12660
|
const blocked = requirements?.next ? blockedStepMessage(requirements.next, copy.blocked) : null;
|
|
12453
12661
|
const stepsPending = !!requirements?.next;
|
|
12454
12662
|
const title = panel === "fund" ? copy.title.addFunds : card ? card.nickname ?? copy.title.yourCard : copy.title.getCard;
|
|
12455
|
-
|
|
12663
|
+
const sentFunding = fundings?.find((f) => f.id === sentFundingId) ?? null;
|
|
12664
|
+
const earlierFundings = (fundings ?? []).filter((f) => f.id !== sentFundingId);
|
|
12665
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: busy === "fund-send" ? void 0 : onClose, children: /* @__PURE__ */ jsxs(
|
|
12456
12666
|
"div",
|
|
12457
12667
|
{
|
|
12458
12668
|
className: "pollar-modal-card pollar-card-modal",
|
|
@@ -12745,9 +12955,40 @@ function CardModal({ onClose, initial }) {
|
|
|
12745
12955
|
children: busy === "fund-send" ? copy.sending : copy.fundFromWallet
|
|
12746
12956
|
}
|
|
12747
12957
|
) }),
|
|
12748
|
-
|
|
12958
|
+
confirmation && /* @__PURE__ */ jsx(InlineConfirm, { confirmation, language }),
|
|
12959
|
+
!confirmation && sentFunding && (() => {
|
|
12960
|
+
const f = sentFunding;
|
|
12961
|
+
const state = (f.route === "DIRECT" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
|
|
12962
|
+
const steps = FUNDING_STEPS[f.route];
|
|
12963
|
+
const step = steps.indexOf(f.status) + 1;
|
|
12964
|
+
const inflight = FUNDING_INFLIGHT.has(f.status);
|
|
12965
|
+
const failed = f.status === "FAILED";
|
|
12966
|
+
return /* @__PURE__ */ jsxs(
|
|
12967
|
+
"div",
|
|
12968
|
+
{
|
|
12969
|
+
className: `pollar-outcome${failed ? " pollar-outcome-bad" : ""}${inflight ? " pollar-outcome-busy" : ""}`,
|
|
12970
|
+
role: "status",
|
|
12971
|
+
children: [
|
|
12972
|
+
/* @__PURE__ */ jsxs("p", { className: "pollar-outcome-main", children: [
|
|
12973
|
+
inflight ? /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }) : /* @__PURE__ */ jsx(OutcomeIcon, { ok: !failed }),
|
|
12974
|
+
state?.title ?? f.status,
|
|
12975
|
+
" \xB7 ",
|
|
12976
|
+
money(f.amount, "USD", language)
|
|
12977
|
+
] }),
|
|
12978
|
+
inflight && step > 0 && /* @__PURE__ */ jsxs("p", { className: "pollar-outcome-note", children: [
|
|
12979
|
+
copy.stepOf(step, steps.length),
|
|
12980
|
+
" \xB7",
|
|
12981
|
+
" ",
|
|
12982
|
+
f.error === CREDIT_DELAYED ? copy.fundingProblem.delayed : state?.hint
|
|
12983
|
+
] }),
|
|
12984
|
+
failed && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: fundingProblemText(f.error, copy) })
|
|
12985
|
+
]
|
|
12986
|
+
}
|
|
12987
|
+
);
|
|
12988
|
+
})(),
|
|
12989
|
+
earlierFundings.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12749
12990
|
/* @__PURE__ */ jsx("p", { className: "pollar-card-section-title", children: copy.yourFundings }),
|
|
12750
|
-
|
|
12991
|
+
earlierFundings.map((f) => {
|
|
12751
12992
|
const state = (f.route === "DIRECT" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
|
|
12752
12993
|
const steps = FUNDING_STEPS[f.route];
|
|
12753
12994
|
const step = steps.indexOf(f.status) + 1;
|
|
@@ -13196,12 +13437,9 @@ var COSIGN_COPY = {
|
|
|
13196
13437
|
closeAnyway: "Close anyway",
|
|
13197
13438
|
activateWallet: "Activate wallet",
|
|
13198
13439
|
status: { APPROVED: "Approved", REJECTED: "Rejected", EXPIRED: "Expired", FAILED: "Failed", PENDING: "Pending" },
|
|
13199
|
-
sentTransaction: "Sent. Transaction",
|
|
13200
|
-
copy: "Copy",
|
|
13201
|
-
copied: "Copied",
|
|
13202
|
-
copyHash: "Copy transaction hash",
|
|
13203
|
-
copyFailed: "Copy failed",
|
|
13204
13440
|
signedAppSends: "Signed. The app will send it.",
|
|
13441
|
+
signedSent: "Signed and sent",
|
|
13442
|
+
signed: "Signed",
|
|
13205
13443
|
nothingSigned: "Nothing was signed.",
|
|
13206
13444
|
nothingWaiting: "Nothing waits for your approval.",
|
|
13207
13445
|
next: (step) => `Next: ${step}. It appears here in a few seconds.`,
|
|
@@ -13252,12 +13490,9 @@ var COSIGN_COPY = {
|
|
|
13252
13490
|
closeAnyway: "Cerrar igual",
|
|
13253
13491
|
activateWallet: "Activar billetera",
|
|
13254
13492
|
status: { APPROVED: "Aprobada", REJECTED: "Rechazada", EXPIRED: "Vencida", FAILED: "Fallida", PENDING: "Pendiente" },
|
|
13255
|
-
sentTransaction: "Enviada. Transacci\xF3n",
|
|
13256
|
-
copy: "Copiar",
|
|
13257
|
-
copied: "Copiado",
|
|
13258
|
-
copyHash: "Copiar hash de la transacci\xF3n",
|
|
13259
|
-
copyFailed: "No se pudo copiar",
|
|
13260
13493
|
signedAppSends: "Firmada. La app la enviar\xE1.",
|
|
13494
|
+
signedSent: "Firmada y enviada",
|
|
13495
|
+
signed: "Firmada",
|
|
13261
13496
|
nothingSigned: "No se firm\xF3 nada.",
|
|
13262
13497
|
nothingWaiting: "No hay nada esperando tu aprobaci\xF3n.",
|
|
13263
13498
|
next: (step) => `Siguiente: ${step}. Aparecer\xE1 aqu\xED en unos segundos.`,
|
|
@@ -13308,12 +13543,9 @@ var COSIGN_COPY = {
|
|
|
13308
13543
|
closeAnyway: "Fechar mesmo assim",
|
|
13309
13544
|
activateWallet: "Ativar carteira",
|
|
13310
13545
|
status: { APPROVED: "Aprovada", REJECTED: "Rejeitada", EXPIRED: "Expirada", FAILED: "Falhou", PENDING: "Pendente" },
|
|
13311
|
-
sentTransaction: "Enviada. Transa\xE7\xE3o",
|
|
13312
|
-
copy: "Copiar",
|
|
13313
|
-
copied: "Copiado",
|
|
13314
|
-
copyHash: "Copiar hash da transa\xE7\xE3o",
|
|
13315
|
-
copyFailed: "N\xE3o foi poss\xEDvel copiar",
|
|
13316
13546
|
signedAppSends: "Assinada. O app vai envi\xE1-la.",
|
|
13547
|
+
signedSent: "Assinada e enviada",
|
|
13548
|
+
signed: "Assinada",
|
|
13317
13549
|
nothingSigned: "Nada foi assinado.",
|
|
13318
13550
|
nothingWaiting: "Nada aguarda a sua aprova\xE7\xE3o.",
|
|
13319
13551
|
next: (step) => `Pr\xF3ximo: ${step}. Aparece aqui em alguns segundos.`,
|
|
@@ -13352,7 +13584,7 @@ var COSIGN_COPY = {
|
|
|
13352
13584
|
}
|
|
13353
13585
|
}
|
|
13354
13586
|
};
|
|
13355
|
-
function
|
|
13587
|
+
function labelOf2(request, copy) {
|
|
13356
13588
|
const op = request.operation ?? "";
|
|
13357
13589
|
return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
|
|
13358
13590
|
}
|
|
@@ -13363,12 +13595,40 @@ function expiresIn(request, copy) {
|
|
|
13363
13595
|
const m = Math.floor(ms % 36e5 / 6e4);
|
|
13364
13596
|
return h > 0 ? `${h}h ${m}m` : `${m}m`;
|
|
13365
13597
|
}
|
|
13366
|
-
function
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13598
|
+
function outcomeText(request, copy) {
|
|
13599
|
+
if (request.status !== "APPROVED")
|
|
13600
|
+
return `${copy.status[request.status] ?? request.status.toLowerCase()}. ${copy.nothingSigned}`;
|
|
13601
|
+
if (request.submit?.hash) return copy.signedSent;
|
|
13602
|
+
if (request.signedXdr) return copy.signedAppSends;
|
|
13603
|
+
return copy.status.APPROVED ?? "Approved";
|
|
13604
|
+
}
|
|
13605
|
+
function StepRow({
|
|
13606
|
+
request,
|
|
13607
|
+
review,
|
|
13608
|
+
copy,
|
|
13609
|
+
language
|
|
13610
|
+
}) {
|
|
13611
|
+
const [open, setOpen] = useState(false);
|
|
13612
|
+
const ok = request.status === "APPROVED";
|
|
13613
|
+
return /* @__PURE__ */ jsxs("div", { className: `pollar-cosign-step${ok ? "" : " pollar-cosign-step-bad"}`, children: [
|
|
13614
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-cosign-step-head", "aria-expanded": open, onClick: () => setOpen((v) => !v), children: [
|
|
13615
|
+
/* @__PURE__ */ jsx(OutcomeIcon, { ok }),
|
|
13616
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-cosign-step-title", children: review.title }),
|
|
13617
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-cosign-step-status", children: ok ? copy.signed : copy.status[request.status] ?? request.status }),
|
|
13618
|
+
/* @__PURE__ */ jsx(
|
|
13619
|
+
"svg",
|
|
13620
|
+
{
|
|
13621
|
+
width: "10",
|
|
13622
|
+
height: "10",
|
|
13623
|
+
viewBox: "0 0 12 12",
|
|
13624
|
+
fill: "none",
|
|
13625
|
+
"aria-hidden": true,
|
|
13626
|
+
style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 150ms" },
|
|
13627
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
13628
|
+
}
|
|
13629
|
+
)
|
|
13630
|
+
] }),
|
|
13631
|
+
open && /* @__PURE__ */ jsx(TxReview, { data: review, language, detailsOnly: true })
|
|
13372
13632
|
] });
|
|
13373
13633
|
}
|
|
13374
13634
|
function CloseIcon2() {
|
|
@@ -13393,7 +13653,8 @@ function CosignModalTemplate({
|
|
|
13393
13653
|
deviceNotLinked = false,
|
|
13394
13654
|
onLinkDevice,
|
|
13395
13655
|
lastResolved,
|
|
13396
|
-
|
|
13656
|
+
history = [],
|
|
13657
|
+
explorerUrlOf,
|
|
13397
13658
|
closesIn = null,
|
|
13398
13659
|
nextStep = null,
|
|
13399
13660
|
language: languageProp,
|
|
@@ -13422,9 +13683,10 @@ function CosignModalTemplate({
|
|
|
13422
13683
|
details: request.details,
|
|
13423
13684
|
signWith: request.account ?? request.signWith,
|
|
13424
13685
|
raw: request.unsignedPayload,
|
|
13425
|
-
fallbackTitle:
|
|
13426
|
-
extraRows: [{ label: copy.expiresIn, value: expiresIn(request, copy) }],
|
|
13427
|
-
appPaysFee: request.appPaysFee
|
|
13686
|
+
fallbackTitle: labelOf2(request, copy),
|
|
13687
|
+
...request.status === "PENDING" ? { extraRows: [{ label: copy.expiresIn, value: expiresIn(request, copy) }] } : {},
|
|
13688
|
+
appPaysFee: request.submit?.sponsored ?? request.appPaysFee,
|
|
13689
|
+
...request.submit?.hash ? { hash: { value: request.submit.hash, explorerUrl: explorerUrlOf?.(request) ?? null } } : {}
|
|
13428
13690
|
},
|
|
13429
13691
|
TX_REVIEW_COPY[language]
|
|
13430
13692
|
);
|
|
@@ -13432,6 +13694,7 @@ function CosignModalTemplate({
|
|
|
13432
13694
|
const grouped = pending.length > 1;
|
|
13433
13695
|
const shown = grouped ? null : current ?? (pending.length === 0 ? lastResolved : void 0) ?? null;
|
|
13434
13696
|
const shownReview = shown ? shown === current ? review : reviewOf(shown) : null;
|
|
13697
|
+
const doneSteps = history.filter((r) => !(pending.length === 0 && r.id === lastResolved?.id));
|
|
13435
13698
|
const heading = confirmingClose ? copy.closeTitle : grouped ? copy.manyPending(pending.length) : shownReview?.title ?? copy.title;
|
|
13436
13699
|
const chip = current && !confirmingClose && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13437
13700
|
!verification && !deviceNotLinked && /* @__PURE__ */ jsxs("span", { className: "pollar-cosign-chip", children: [
|
|
@@ -13475,55 +13738,25 @@ function CosignModalTemplate({
|
|
|
13475
13738
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: onKeepOpen, children: copy.backToSign }),
|
|
13476
13739
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-text-btn", onClick: onCloseAnyway, children: copy.closeAnyway })
|
|
13477
13740
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
"aria-hidden": true,
|
|
13489
|
-
children: [
|
|
13490
|
-
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
13491
|
-
/* @__PURE__ */ jsx(
|
|
13492
|
-
"path",
|
|
13493
|
-
{
|
|
13494
|
-
d: "M3.5 7l2.5 2.5 4.5-5",
|
|
13495
|
-
stroke: "white",
|
|
13496
|
-
strokeWidth: "1.2",
|
|
13497
|
-
strokeLinecap: "round",
|
|
13498
|
-
strokeLinejoin: "round"
|
|
13499
|
-
}
|
|
13500
|
-
)
|
|
13501
|
-
]
|
|
13502
|
-
}
|
|
13503
|
-
),
|
|
13504
|
-
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-empty-title", children: copy.status[lastResolved.status] ?? lastResolved.status.toLowerCase() }),
|
|
13505
|
-
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted", children: lastResolved.submit?.hash ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13506
|
-
copy.sentTransaction,
|
|
13741
|
+
doneSteps.map((r) => /* @__PURE__ */ jsx(StepRow, { request: r, review: reviewOf(r), copy, language }, r.id)),
|
|
13742
|
+
pending.length === 0 && (lastResolved && shownReview ? /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-detail", children: [
|
|
13743
|
+
/* @__PURE__ */ jsx(TxReview, { data: shownReview, language }, lastResolved.id),
|
|
13744
|
+
/* @__PURE__ */ jsxs("div", { className: `pollar-outcome${lastResolved.status === "APPROVED" ? "" : " pollar-outcome-bad"}`, children: [
|
|
13745
|
+
/* @__PURE__ */ jsxs("p", { className: "pollar-outcome-main", children: [
|
|
13746
|
+
/* @__PURE__ */ jsx(OutcomeIcon, { ok: lastResolved.status === "APPROVED" }),
|
|
13747
|
+
outcomeText(lastResolved, copy)
|
|
13748
|
+
] }),
|
|
13749
|
+
nextStep && /* @__PURE__ */ jsxs("p", { className: "pollar-outcome-note", children: [
|
|
13750
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
13507
13751
|
" ",
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
className: "pollar-copy-btn-sm pollar-cosign-copy"
|
|
13515
|
-
}
|
|
13516
|
-
)
|
|
13517
|
-
] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned }),
|
|
13518
|
-
lastResolved.submit?.sponsored !== void 0 && /* @__PURE__ */ jsx("p", { className: "pollar-cosign-fee", children: /* @__PURE__ */ jsx(TxFeeBadge, { sponsored: lastResolved.submit.sponsored, language }) })
|
|
13519
|
-
] }) : /* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted", children: copy.nothingWaiting }),
|
|
13520
|
-
nextStep && /* @__PURE__ */ jsxs("p", { className: "pollar-cosign-next", children: [
|
|
13521
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
13522
|
-
" ",
|
|
13523
|
-
copy.next(nextStep)
|
|
13524
|
-
] }),
|
|
13752
|
+
copy.next(nextStep)
|
|
13753
|
+
] }),
|
|
13754
|
+
closesIn !== null && /* @__PURE__ */ jsx("p", { className: "pollar-outcome-note", children: copy.closingIn(closesIn) })
|
|
13755
|
+
] })
|
|
13756
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-empty", children: [
|
|
13757
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted", children: copy.nothingWaiting }),
|
|
13525
13758
|
closesIn !== null && /* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted pollar-cosign-closing", children: copy.closingIn(closesIn) })
|
|
13526
|
-
] }),
|
|
13759
|
+
] })),
|
|
13527
13760
|
grouped && /* @__PURE__ */ jsx("ul", { className: "pollar-cosign-list", children: pending.map((r) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
13528
13761
|
"button",
|
|
13529
13762
|
{
|
|
@@ -13612,6 +13845,12 @@ function CosignModal({ nextStep = null, onClose }) {
|
|
|
13612
13845
|
};
|
|
13613
13846
|
}, [inspectQuorum]);
|
|
13614
13847
|
const current = pending.find((r) => r.id === selectedId) ?? pending[0] ?? null;
|
|
13848
|
+
const [history, setHistory] = useState([]);
|
|
13849
|
+
const resolvedBeforeOpen = useRef(lastResolved?.id);
|
|
13850
|
+
useEffect(() => {
|
|
13851
|
+
if (!lastResolved || lastResolved.id === resolvedBeforeOpen.current) return;
|
|
13852
|
+
setHistory((list) => [...list.filter((r) => r.id !== lastResolved.id), lastResolved]);
|
|
13853
|
+
}, [lastResolved]);
|
|
13615
13854
|
const [askedToClose, setAskedToClose] = useState(false);
|
|
13616
13855
|
const confirmingClose = askedToClose && pending.length > 0;
|
|
13617
13856
|
const requestClose = () => pending.length > 0 ? setAskedToClose(true) : onClose();
|
|
@@ -13708,7 +13947,8 @@ function CosignModal({ nextStep = null, onClose }) {
|
|
|
13708
13947
|
nextStep: awaitingNext ? nextStep : null,
|
|
13709
13948
|
language,
|
|
13710
13949
|
network,
|
|
13711
|
-
|
|
13950
|
+
history,
|
|
13951
|
+
explorerUrlOf: (r) => r.submit?.hash ? explorerTxUrl(r.network, r.submit.hash, network) : null,
|
|
13712
13952
|
onSelect: (r) => setSelectedId(r.id),
|
|
13713
13953
|
onApprove: (r) => void run("approving", r, approve),
|
|
13714
13954
|
onReject: (r) => void run("rejecting", r, reject),
|
|
@@ -14481,86 +14721,6 @@ function RecoveryModal({ onClose }) {
|
|
|
14481
14721
|
}
|
|
14482
14722
|
) });
|
|
14483
14723
|
}
|
|
14484
|
-
|
|
14485
|
-
// src/components/confirm-modal/confirm-copy.ts
|
|
14486
|
-
var CONFIRM_COPY = {
|
|
14487
|
-
en: {
|
|
14488
|
-
whyTitle: "Why am I seeing this?",
|
|
14489
|
-
whyBody: "The app asks you to sign this with your wallet. Nothing is signed until you confirm.",
|
|
14490
|
-
cancelAction: "Cancel this action",
|
|
14491
|
-
confirm: "Confirm",
|
|
14492
|
-
activateWallet: "Activate wallet",
|
|
14493
|
-
close: "Close",
|
|
14494
|
-
closeTitle: "Close without signing?",
|
|
14495
|
-
closeBody: "If you close, the app's action is canceled.",
|
|
14496
|
-
backToSign: "Go back and sign",
|
|
14497
|
-
closeAndCancel: "Close and cancel",
|
|
14498
|
-
transaction: "Transaction",
|
|
14499
|
-
operations: {
|
|
14500
|
-
payment: "Send",
|
|
14501
|
-
path_payment_strict_send: "Swap",
|
|
14502
|
-
change_trust: "Add asset",
|
|
14503
|
-
create_account: "Create account",
|
|
14504
|
-
invoke_contract: "Contract call",
|
|
14505
|
-
transfer: "Authorize payment",
|
|
14506
|
-
manage_data: "Manage data",
|
|
14507
|
-
earn_deposit: "Deposit",
|
|
14508
|
-
earn_withdraw: "Withdraw"
|
|
14509
|
-
}
|
|
14510
|
-
},
|
|
14511
|
-
es: {
|
|
14512
|
-
whyTitle: "\xBFPor qu\xE9 ves esto?",
|
|
14513
|
-
whyBody: "La app te pide firmar esto con tu billetera. No se firma nada hasta que confirmes.",
|
|
14514
|
-
cancelAction: "Cancelar esta acci\xF3n",
|
|
14515
|
-
confirm: "Confirmar",
|
|
14516
|
-
activateWallet: "Activar billetera",
|
|
14517
|
-
close: "Cerrar",
|
|
14518
|
-
closeTitle: "\xBFCerrar sin firmar?",
|
|
14519
|
-
closeBody: "Si cierras, la acci\xF3n de la app se cancela.",
|
|
14520
|
-
backToSign: "Volver y firmar",
|
|
14521
|
-
closeAndCancel: "Cerrar y cancelar",
|
|
14522
|
-
transaction: "Transacci\xF3n",
|
|
14523
|
-
operations: {
|
|
14524
|
-
payment: "Enviar",
|
|
14525
|
-
path_payment_strict_send: "Intercambiar",
|
|
14526
|
-
change_trust: "Agregar activo",
|
|
14527
|
-
create_account: "Crear cuenta",
|
|
14528
|
-
invoke_contract: "Llamada a contrato",
|
|
14529
|
-
transfer: "Autorizar pago",
|
|
14530
|
-
manage_data: "Gestionar datos",
|
|
14531
|
-
earn_deposit: "Depositar",
|
|
14532
|
-
earn_withdraw: "Retirar"
|
|
14533
|
-
}
|
|
14534
|
-
},
|
|
14535
|
-
pt: {
|
|
14536
|
-
whyTitle: "Por que estou vendo isto?",
|
|
14537
|
-
whyBody: "O app pede que voc\xEA assine isto com sua carteira. Nada \xE9 assinado at\xE9 voc\xEA confirmar.",
|
|
14538
|
-
cancelAction: "Cancelar esta a\xE7\xE3o",
|
|
14539
|
-
confirm: "Confirmar",
|
|
14540
|
-
activateWallet: "Ativar carteira",
|
|
14541
|
-
close: "Fechar",
|
|
14542
|
-
closeTitle: "Fechar sem assinar?",
|
|
14543
|
-
closeBody: "Se voc\xEA fechar, a a\xE7\xE3o do app \xE9 cancelada.",
|
|
14544
|
-
backToSign: "Voltar e assinar",
|
|
14545
|
-
closeAndCancel: "Fechar e cancelar",
|
|
14546
|
-
transaction: "Transa\xE7\xE3o",
|
|
14547
|
-
operations: {
|
|
14548
|
-
payment: "Enviar",
|
|
14549
|
-
path_payment_strict_send: "Trocar",
|
|
14550
|
-
change_trust: "Adicionar ativo",
|
|
14551
|
-
create_account: "Criar conta",
|
|
14552
|
-
invoke_contract: "Chamada de contrato",
|
|
14553
|
-
transfer: "Autorizar pagamento",
|
|
14554
|
-
manage_data: "Gerenciar dados",
|
|
14555
|
-
earn_deposit: "Depositar",
|
|
14556
|
-
earn_withdraw: "Sacar"
|
|
14557
|
-
}
|
|
14558
|
-
}
|
|
14559
|
-
};
|
|
14560
|
-
function labelOf2(confirmation, copy) {
|
|
14561
|
-
const op = confirmation.operation ?? "";
|
|
14562
|
-
return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
|
|
14563
|
-
}
|
|
14564
14724
|
function CloseIcon4() {
|
|
14565
14725
|
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
14566
14726
|
}
|
|
@@ -14568,19 +14728,7 @@ function ConfirmModal({ confirmation }) {
|
|
|
14568
14728
|
const { getClient, styles, network } = usePollar();
|
|
14569
14729
|
const language = useModalLanguage();
|
|
14570
14730
|
const copy = CONFIRM_COPY[language];
|
|
14571
|
-
const
|
|
14572
|
-
const raw = confirmation.unsignedXdr ?? confirmation.authEntryXdr;
|
|
14573
|
-
const review = confirmation.buildData ? reviewFromBuild(confirmation.buildData, reviewCopy, labelOf2(confirmation, copy)) : reviewFromRequest(
|
|
14574
|
-
{
|
|
14575
|
-
chain: confirmation.network,
|
|
14576
|
-
network,
|
|
14577
|
-
operation: confirmation.operation,
|
|
14578
|
-
details: confirmation.details,
|
|
14579
|
-
raw,
|
|
14580
|
-
fallbackTitle: labelOf2(confirmation, copy)
|
|
14581
|
-
},
|
|
14582
|
-
reviewCopy
|
|
14583
|
-
);
|
|
14731
|
+
const review = confirmationReview(confirmation, language, network);
|
|
14584
14732
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
14585
14733
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
14586
14734
|
const rejectRef = useRef(confirmation.reject);
|
|
@@ -14659,13 +14807,21 @@ function TransactionModalTemplate({
|
|
|
14659
14807
|
onToggleXdr,
|
|
14660
14808
|
onCopyHash,
|
|
14661
14809
|
onRetry,
|
|
14662
|
-
language: languageProp
|
|
14810
|
+
language: languageProp,
|
|
14811
|
+
confirmation = null,
|
|
14812
|
+
network
|
|
14663
14813
|
}) {
|
|
14664
14814
|
const language = useInheritedLanguage(languageProp);
|
|
14665
14815
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
14666
14816
|
const copy = TRANSACTION_COPY[language];
|
|
14667
14817
|
return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
|
|
14668
|
-
/* @__PURE__ */ jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsx(
|
|
14818
|
+
/* @__PURE__ */ jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsx(
|
|
14819
|
+
TxStatusHeading,
|
|
14820
|
+
{
|
|
14821
|
+
review: txStatusReview({ transaction, explorerUrl, confirmation, network, language }),
|
|
14822
|
+
fallback: copy.title
|
|
14823
|
+
}
|
|
14824
|
+
) }),
|
|
14669
14825
|
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx(
|
|
14670
14826
|
"svg",
|
|
14671
14827
|
{
|
|
@@ -14694,7 +14850,9 @@ function TransactionModalTemplate({
|
|
|
14694
14850
|
onCopyHash,
|
|
14695
14851
|
onRetry,
|
|
14696
14852
|
onDone: onClose,
|
|
14697
|
-
language
|
|
14853
|
+
language,
|
|
14854
|
+
confirmation,
|
|
14855
|
+
network
|
|
14698
14856
|
}
|
|
14699
14857
|
),
|
|
14700
14858
|
/* @__PURE__ */ jsx(PollarModalFooter, {})
|
|
@@ -14705,6 +14863,7 @@ function TransactionModal({ onClose }) {
|
|
|
14705
14863
|
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
14706
14864
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
14707
14865
|
const language = useModalLanguage();
|
|
14866
|
+
const confirmation = useInlineConfirmation(true);
|
|
14708
14867
|
const [showXdr, setShowXdr] = useState(false);
|
|
14709
14868
|
const [copied, setCopied] = useState(false);
|
|
14710
14869
|
const copyTimerRef = useRef(null);
|
|
@@ -14739,12 +14898,14 @@ function TransactionModal({ onClose }) {
|
|
|
14739
14898
|
await getClient().signAndSubmitTx(transaction.buildData.unsignedXdr);
|
|
14740
14899
|
}
|
|
14741
14900
|
}
|
|
14742
|
-
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle,
|
|
14901
|
+
return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, children: /* @__PURE__ */ jsx(
|
|
14743
14902
|
TransactionModalTemplate,
|
|
14744
14903
|
{
|
|
14745
14904
|
theme,
|
|
14746
14905
|
accentColor,
|
|
14747
14906
|
styleOverrides,
|
|
14907
|
+
confirmation,
|
|
14908
|
+
network,
|
|
14748
14909
|
transaction,
|
|
14749
14910
|
showXdr,
|
|
14750
14911
|
copied,
|
|
@@ -15558,6 +15719,11 @@ function PollarProvider({
|
|
|
15558
15719
|
const [cosign, setCosign] = useState({ pending: [] });
|
|
15559
15720
|
const [confirmations, setConfirmations] = useState([]);
|
|
15560
15721
|
const firstConfirmation = confirmations[0] ?? null;
|
|
15722
|
+
const [confirmationHosts, setConfirmationHosts] = useState(0);
|
|
15723
|
+
const registerConfirmationHost = useCallback(() => {
|
|
15724
|
+
setConfirmationHosts((n) => n + 1);
|
|
15725
|
+
return () => setConfirmationHosts((n) => n - 1);
|
|
15726
|
+
}, []);
|
|
15561
15727
|
const [walletBalance, setWalletBalance] = useState({ step: "idle" });
|
|
15562
15728
|
const [enabledAssets, setEnabledAssets] = useState({ step: "idle" });
|
|
15563
15729
|
const [resolvedConfig, setResolvedConfig] = useState(() => appConfigProp ?? DEFAULT_APP_CONFIG);
|
|
@@ -15879,6 +16045,7 @@ function PollarProvider({
|
|
|
15879
16045
|
custodyMigration,
|
|
15880
16046
|
refreshCustodyMigration,
|
|
15881
16047
|
confirmations,
|
|
16048
|
+
registerConfirmationHost,
|
|
15882
16049
|
// distribution
|
|
15883
16050
|
openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
|
|
15884
16051
|
// network
|
|
@@ -15918,6 +16085,7 @@ function PollarProvider({
|
|
|
15918
16085
|
sessions,
|
|
15919
16086
|
cosign,
|
|
15920
16087
|
confirmations,
|
|
16088
|
+
registerConfirmationHost,
|
|
15921
16089
|
walletBalance,
|
|
15922
16090
|
refreshWalletBalance,
|
|
15923
16091
|
enabledAssets,
|
|
@@ -15993,7 +16161,7 @@ function PollarProvider({
|
|
|
15993
16161
|
}
|
|
15994
16162
|
}
|
|
15995
16163
|
) }),
|
|
15996
|
-
firstConfirmation && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: firstConfirmation.reject, children: /* @__PURE__ */ jsx(ConfirmModal, { confirmation: firstConfirmation }, firstConfirmation.id) }),
|
|
16164
|
+
firstConfirmation && confirmationHosts === 0 && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: firstConfirmation.reject, children: /* @__PURE__ */ jsx(ConfirmModal, { confirmation: firstConfirmation }, firstConfirmation.id) }),
|
|
15997
16165
|
distributionRulesModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setDistributionRulesModalOpen(false), children: /* @__PURE__ */ jsx(DistributionRulesModal, { onClose: () => setDistributionRulesModalOpen(false) }) })
|
|
15998
16166
|
] }) });
|
|
15999
16167
|
}
|