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