@pollar/react 0.12.1-rc.2 → 0.12.1-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1221,6 +1221,19 @@ var LOGO_POLLAR_MARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-mark-on-
1221
1221
  var LOGO_POLLAR_MARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-mark-on-dark.png";
1222
1222
  var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
1223
1223
  var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
1224
+ var CHAIN_LOGOS = {
1225
+ STELLAR: "https://www.pollar.xyz/chains/stellar.png",
1226
+ POLYGON: "https://www.pollar.xyz/chains/polygon.png",
1227
+ SOLANA: "https://www.pollar.xyz/chains/solana.png"
1228
+ };
1229
+ var TOKEN_LOGOS = {
1230
+ USDC: "https://www.pollar.xyz/tokens/usdc.png",
1231
+ USDT: "https://www.pollar.xyz/tokens/usdt.png",
1232
+ EURC: "https://www.pollar.xyz/tokens/eurc.png",
1233
+ XLM: "https://www.pollar.xyz/tokens/xlm.png",
1234
+ SOL: "https://www.pollar.xyz/tokens/sol.png",
1235
+ POL: "https://www.pollar.xyz/tokens/pol.png"
1236
+ };
1224
1237
  var _modalLog = console;
1225
1238
  function setModalErrorLogger(logger) {
1226
1239
  _modalLog = logger;
@@ -1259,7 +1272,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1259
1272
  /* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1260
1273
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
1261
1274
  "v",
1262
- "0.12.1-rc.2"
1275
+ "0.12.1-rc.6"
1263
1276
  ] })
1264
1277
  ] });
1265
1278
  };
@@ -4237,6 +4250,7 @@ var RAMP_COPY = {
4237
4250
  providerReviewing: "The provider is reviewing your details. This updates on its own.",
4238
4251
  serverTrouble: "Having trouble reaching the server. Retrying\u2026",
4239
4252
  startAnother: "Start another operation",
4253
+ newQuote: "Get a new quote",
4240
4254
  keepsGoing: "This one keeps going; you can resume it later.",
4241
4255
  somethingWrong: "Something went wrong.",
4242
4256
  routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
@@ -4359,6 +4373,7 @@ var RAMP_COPY = {
4359
4373
  providerReviewing: "El proveedor est\xE1 revisando tus datos. Esto se actualiza solo.",
4360
4374
  serverTrouble: "Hay problemas para conectar con el servidor. Reintentando\u2026",
4361
4375
  startAnother: "Iniciar otra operaci\xF3n",
4376
+ newQuote: "Pedir nueva cotizaci\xF3n",
4362
4377
  keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
4363
4378
  somethingWrong: "Algo sali\xF3 mal.",
4364
4379
  routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
@@ -4481,6 +4496,7 @@ var RAMP_COPY = {
4481
4496
  providerReviewing: "O provedor est\xE1 analisando seus dados. Isto se atualiza sozinho.",
4482
4497
  serverTrouble: "Problemas para conectar ao servidor. Tentando de novo\u2026",
4483
4498
  startAnother: "Iniciar outra opera\xE7\xE3o",
4499
+ newQuote: "Pedir nova cota\xE7\xE3o",
4484
4500
  keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
4485
4501
  somethingWrong: "Algo deu errado.",
4486
4502
  routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
@@ -4793,6 +4809,7 @@ function RampWidgetTemplate({
4793
4809
  noChains = false,
4794
4810
  retrying = false,
4795
4811
  onRetryOrder,
4812
+ onRequote,
4796
4813
  onSetUpRecovery,
4797
4814
  recoveryMissing = null,
4798
4815
  checkingPayment = false,
@@ -4824,6 +4841,7 @@ function RampWidgetTemplate({
4824
4841
  const stopped = order ? core.rampOrderStopped(order) : false;
4825
4842
  const receive = order ? core.rampOrderReceive(order) : null;
4826
4843
  const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
4844
+ const asksNewQuote = order?.failure?.resolutionAction === "accept_new_quote";
4827
4845
  const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
4828
4846
  useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
4829
4847
  const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
@@ -5156,7 +5174,8 @@ function RampWidgetTemplate({
5156
5174
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampOrderResolutionText(order, language) }),
5157
5175
  stopped && !settled && waitsOnRecovery && recoveryMissing !== false && onSetUpRecovery && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onSetUpRecovery, children: copy.setUpRecovery }),
5158
5176
  stopped && !settled && waitsOnRecovery && recoveryMissing === true && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.recoveryNote }),
5159
- stopped && !settled && order.failure.resolutionOwner === "END_USER" && onRetryOrder && /* @__PURE__ */ jsxRuntime.jsx(
5177
+ stopped && !settled && asksNewQuote && onRequote && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRequote, children: copy.newQuote }),
5178
+ stopped && !settled && order.failure.resolutionOwner === "END_USER" && !asksNewQuote && onRetryOrder && /* @__PURE__ */ jsxRuntime.jsx(
5160
5179
  "button",
5161
5180
  {
5162
5181
  type: "button",
@@ -6270,6 +6289,10 @@ function RampWidget({ onClose, language: languageProp }) {
6270
6289
  setRetrying(false);
6271
6290
  }
6272
6291
  }
6292
+ async function handleRequote() {
6293
+ setOrder(null);
6294
+ await handleFindRoute();
6295
+ }
6273
6296
  const heldForRecovery = step === "status" && order?.failure?.resolutionAction === "set_up_recovery";
6274
6297
  const wasRecoveryLocked = react.useRef(recoveryLocked);
6275
6298
  react.useEffect(() => {
@@ -6417,6 +6440,7 @@ function RampWidget({ onClose, language: languageProp }) {
6417
6440
  onApprove: openCosignModal,
6418
6441
  retrying,
6419
6442
  onRetryOrder: () => void handleRetryOrder(),
6443
+ onRequote: () => void handleRequote(),
6420
6444
  onSetUpRecovery: openRecoveryModal,
6421
6445
  recoveryMissing: recovery === null ? null : recoveryLocked,
6422
6446
  pollTrouble,
@@ -6943,25 +6967,480 @@ var SEND_COPY = {
6943
6967
  }
6944
6968
  };
6945
6969
 
6970
+ // src/components/tx-review/tx-review-copy.ts
6971
+ var TX_REVIEW_COPY = {
6972
+ en: {
6973
+ titles: {
6974
+ send: (amount) => `Send ${amount}`,
6975
+ bridge: (amount, chain) => `Move ${amount} to ${chain}`,
6976
+ approve: (asset, spender) => `Allow ${spender} to use your ${asset}`,
6977
+ swap: (from, to) => `Swap ${from} for ${to}`,
6978
+ payment: (amount, to) => `Pay ${amount} to ${to}`,
6979
+ createAccount: "Create an account"
6980
+ },
6981
+ yourWallet: "Your wallet",
6982
+ newAccount: "New account",
6983
+ atLeast: "at least",
6984
+ approveNote: "This only gives permission. Nothing moves yet.",
6985
+ feeSponsored: "Fee covered by the app",
6986
+ feePaid: "You pay the network fee",
6987
+ showDetails: "Show details",
6988
+ hideDetails: "Hide details",
6989
+ chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
6990
+ rows: {
6991
+ description: "Description",
6992
+ network: "Network",
6993
+ from: "From",
6994
+ to: "To",
6995
+ amount: "Amount",
6996
+ receiveMin: "Receive at least",
6997
+ via: "Via",
6998
+ fee: "Network fee",
6999
+ feeCovered: "Covered by the app",
7000
+ contract: "Contract",
7001
+ method: "Method",
7002
+ asset: "Asset",
7003
+ expiresIn: "Expires in",
7004
+ rawTx: "Raw transaction",
7005
+ txHash: "Transaction hash"
7006
+ },
7007
+ viewOnExplorer: "View on explorer"
7008
+ },
7009
+ es: {
7010
+ titles: {
7011
+ send: (amount) => `Enviar ${amount}`,
7012
+ bridge: (amount, chain) => `Mover ${amount} a ${chain}`,
7013
+ approve: (asset, spender) => `Permitir que ${spender} use tu ${asset}`,
7014
+ swap: (from, to) => `Cambiar ${from} por ${to}`,
7015
+ payment: (amount, to) => `Pagar ${amount} a ${to}`,
7016
+ createAccount: "Crear una cuenta"
7017
+ },
7018
+ yourWallet: "Tu billetera",
7019
+ newAccount: "Cuenta nueva",
7020
+ atLeast: "al menos",
7021
+ approveNote: "Solo das permiso. Todav\xEDa no se mueve nada.",
7022
+ feeSponsored: "La app cubre la comisi\xF3n",
7023
+ feePaid: "T\xFA pagas la comisi\xF3n de red",
7024
+ showDetails: "Ver detalles",
7025
+ hideDetails: "Ocultar detalles",
7026
+ chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
7027
+ rows: {
7028
+ description: "Descripci\xF3n",
7029
+ network: "Red",
7030
+ from: "Desde",
7031
+ to: "Hacia",
7032
+ amount: "Monto",
7033
+ receiveMin: "Recibes al menos",
7034
+ via: "V\xEDa",
7035
+ fee: "Comisi\xF3n de red",
7036
+ feeCovered: "La cubre la app",
7037
+ contract: "Contrato",
7038
+ method: "M\xE9todo",
7039
+ asset: "Activo",
7040
+ expiresIn: "Vence en",
7041
+ rawTx: "Transacci\xF3n en bruto",
7042
+ txHash: "Hash de la transacci\xF3n"
7043
+ },
7044
+ viewOnExplorer: "Ver en el explorador"
7045
+ },
7046
+ pt: {
7047
+ titles: {
7048
+ send: (amount) => `Enviar ${amount}`,
7049
+ bridge: (amount, chain) => `Mover ${amount} para ${chain}`,
7050
+ approve: (asset, spender) => `Permitir que ${spender} use seu ${asset}`,
7051
+ swap: (from, to) => `Trocar ${from} por ${to}`,
7052
+ payment: (amount, to) => `Pagar ${amount} para ${to}`,
7053
+ createAccount: "Criar uma conta"
7054
+ },
7055
+ yourWallet: "Sua carteira",
7056
+ newAccount: "Conta nova",
7057
+ atLeast: "pelo menos",
7058
+ approveNote: "Isto s\xF3 d\xE1 permiss\xE3o. Nada se move ainda.",
7059
+ feeSponsored: "O app cobre a taxa",
7060
+ feePaid: "Voc\xEA paga a taxa de rede",
7061
+ showDetails: "Ver detalhes",
7062
+ hideDetails: "Ocultar detalhes",
7063
+ chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
7064
+ rows: {
7065
+ description: "Descri\xE7\xE3o",
7066
+ network: "Rede",
7067
+ from: "De",
7068
+ to: "Para",
7069
+ amount: "Valor",
7070
+ receiveMin: "Recebe pelo menos",
7071
+ via: "Via",
7072
+ fee: "Taxa de rede",
7073
+ feeCovered: "Coberta pelo app",
7074
+ contract: "Contrato",
7075
+ method: "M\xE9todo",
7076
+ asset: "Ativo",
7077
+ expiresIn: "Expira em",
7078
+ rawTx: "Transa\xE7\xE3o bruta",
7079
+ txHash: "Hash da transa\xE7\xE3o"
7080
+ },
7081
+ viewOnExplorer: "Ver no explorador"
7082
+ }
7083
+ };
7084
+ var CHAINS = /* @__PURE__ */ new Set(["STELLAR", "POLYGON", "SOLANA"]);
7085
+ var asChain = (value) => typeof value === "string" && CHAINS.has(value) ? value : void 0;
7086
+ var asString = (value) => typeof value === "string" && value !== "" ? value : typeof value === "number" ? String(value) : void 0;
7087
+ function shortAddress(address) {
7088
+ return address.length <= 12 ? address : `${address.slice(0, 4)}...${address.slice(-4)}`;
7089
+ }
7090
+ function displayName(label) {
7091
+ if (/[A-Z]/.test(label) && /[a-z]/.test(label)) return label;
7092
+ return label.toLowerCase().split(/[_\s-]+/).map((word) => word ? word[0].toUpperCase() + word.slice(1) : word).join(" ");
7093
+ }
7094
+ var withAsset = (party) => [party?.amount, party?.asset].filter(Boolean).join(" ");
7095
+ function partyRow(label, party, copy) {
7096
+ if (!party?.address && !party?.label) return null;
7097
+ const chain = party.chain ? `${copy.chains[party.chain]} ` : "";
7098
+ const name = party.label ? `${displayName(party.label)} ` : "";
7099
+ return party.address ? { label, value: `${chain}${name}${party.address}`.trim(), copyValue: party.address, mono: true } : { label, value: `${chain}${name}`.trim() };
7100
+ }
7101
+ function titleOf(data, fallback, copy) {
7102
+ const { from, to } = data;
7103
+ switch (data.kind) {
7104
+ case "send":
7105
+ return from?.amount ? copy.titles.send(withAsset(from)) : fallback;
7106
+ case "bridge":
7107
+ return from?.amount && to?.chain ? copy.titles.bridge(withAsset(from), copy.chains[to.chain]) : fallback;
7108
+ case "approve":
7109
+ return from?.asset && to?.label ? copy.titles.approve(from.asset, displayName(to.label)) : fallback;
7110
+ case "swap":
7111
+ return from?.asset && to?.asset ? copy.titles.swap(from.asset, to.asset) : fallback;
7112
+ case "payment":
7113
+ return from?.amount && to?.label ? copy.titles.payment(withAsset(from), displayName(to.label)) : fallback;
7114
+ case "create_account":
7115
+ return copy.titles.createAccount;
7116
+ default:
7117
+ return fallback;
7118
+ }
7119
+ }
7120
+ function rampFlow(details) {
7121
+ const flow = details.flow;
7122
+ if (!flow || typeof flow !== "object" || !flow.from || !flow.to) return null;
7123
+ const kind = flow.kind;
7124
+ if (kind !== "bridge" && kind !== "approve" && kind !== "swap" && kind !== "payment") return null;
7125
+ const party = (p) => {
7126
+ const out = {};
7127
+ const chain = asChain(p.chain);
7128
+ if (chain) out.chain = chain;
7129
+ for (const key of ["asset", "amount", "address", "label"]) {
7130
+ const value = asString(p[key]);
7131
+ if (value) out[key] = value;
7132
+ }
7133
+ if (p.minimum === true) out.minimum = true;
7134
+ return out;
7135
+ };
7136
+ const from = { ...party(flow.from), self: true };
7137
+ const to = { ...party(flow.to), self: kind === "bridge" || kind === "swap" };
7138
+ return { kind, from, to, via: asString(flow.via) };
7139
+ }
7140
+ function readableAmount(details) {
7141
+ const { amount, decimals, symbol } = details;
7142
+ if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
7143
+ try {
7144
+ return { amount: core.fromBaseUnits(amount, decimals), symbol };
7145
+ } catch {
7146
+ return null;
7147
+ }
7148
+ }
7149
+ function reviewFromRequest(parts, copy) {
7150
+ const details = parts.details ?? {};
7151
+ const flow = rampFlow(details);
7152
+ const rows = [];
7153
+ let data;
7154
+ let via;
7155
+ if (flow) {
7156
+ data = { kind: flow.kind, from: flow.from, to: flow.to };
7157
+ via = flow.via;
7158
+ } else {
7159
+ const destination = asString(details.destination) ?? asString(details.to);
7160
+ const readable = readableAmount(details);
7161
+ const asset = readable?.symbol ?? asString(details.asset) ?? asString(details.assetCode) ?? asString(details.symbol);
7162
+ const amount = readable?.amount ?? asString(details.amount);
7163
+ const isTransfer = parts.operation === "payment" || parts.operation === "transfer";
7164
+ if (isTransfer && destination) {
7165
+ data = {
7166
+ kind: "send",
7167
+ from: {
7168
+ chain: parts.chain,
7169
+ self: true,
7170
+ ...asset ? { asset } : {},
7171
+ ...amount ? { amount } : {},
7172
+ ...parts.signWith ? { address: parts.signWith } : {}
7173
+ },
7174
+ to: { chain: parts.chain, address: destination }
7175
+ };
7176
+ } else if (parts.operation === "create_account" && destination) {
7177
+ data = {
7178
+ kind: "create_account",
7179
+ from: { chain: parts.chain, self: true, ...parts.signWith ? { address: parts.signWith } : {} },
7180
+ to: { chain: parts.chain, address: destination, label: copy.newAccount }
7181
+ };
7182
+ } else {
7183
+ data = { kind: "other" };
7184
+ if (asset) rows.push({ label: copy.rows.asset, value: asset });
7185
+ if (amount) rows.push({ label: copy.rows.amount, value: amount });
7186
+ }
7187
+ }
7188
+ if (parts.summary) rows.unshift({ label: copy.rows.description, value: parts.summary });
7189
+ rows.push({
7190
+ label: copy.rows.network,
7191
+ value: [copy.chains[data.from?.chain ?? parts.chain], parts.network].filter(Boolean).join(" ")
7192
+ });
7193
+ const fromRow = partyRow(copy.rows.from, data.from ?? (parts.signWith ? { address: parts.signWith } : void 0), copy);
7194
+ if (fromRow) rows.push(fromRow);
7195
+ const toRow = partyRow(copy.rows.to, data.to, copy);
7196
+ if (toRow) rows.push(toRow);
7197
+ if (data.kind !== "other" && data.from?.amount) rows.push({ label: copy.rows.amount, value: withAsset(data.from) });
7198
+ if (data.kind === "swap" && data.to?.amount)
7199
+ rows.push({ label: data.to.minimum ? copy.rows.receiveMin : copy.rows.amount, value: withAsset(data.to) });
7200
+ if (via) rows.push({ label: copy.rows.via, value: displayName(via) });
7201
+ const contract = asString(details.contractId);
7202
+ if (contract) rows.push({ label: copy.rows.contract, value: contract, copyValue: contract, mono: true });
7203
+ const method = asString(details.method);
7204
+ if (method) rows.push({ label: copy.rows.method, value: method, mono: true });
7205
+ if (parts.appPaysFee) rows.push({ label: copy.rows.fee, value: copy.rows.feeCovered });
7206
+ rows.push(...parts.extraRows ?? []);
7207
+ return {
7208
+ ...data,
7209
+ title: titleOf(data, parts.fallbackTitle, copy),
7210
+ ...parts.appPaysFee ? { fee: { sponsored: true } } : {},
7211
+ rows,
7212
+ ...parts.raw ? { raw: parts.raw } : {},
7213
+ ...parts.hash ? { hash: parts.hash } : {}
7214
+ };
7215
+ }
7216
+ function splitAmount(text) {
7217
+ if (!text) return void 0;
7218
+ const [amount, ...rest] = text.trim().split(/\s+/);
7219
+ if (!amount) return void 0;
7220
+ return rest.length ? { amount, asset: rest.join(" ") } : { amount };
7221
+ }
7222
+ function buildLabel(label, copy) {
7223
+ const known = {
7224
+ From: copy.rows.from,
7225
+ To: copy.rows.to,
7226
+ Amount: copy.rows.amount,
7227
+ Asset: copy.rows.asset,
7228
+ Contract: copy.rows.contract,
7229
+ Method: copy.rows.method,
7230
+ "Receive min": copy.rows.receiveMin
7231
+ };
7232
+ return known[label] ?? label;
7233
+ }
7234
+ function reviewFromBuild(build, copy, fallbackTitle, hash, sponsored) {
7235
+ const lines = /* @__PURE__ */ new Map();
7236
+ for (const line of build.summary.lines) {
7237
+ const at = line.indexOf(": ");
7238
+ if (at > 0) lines.set(line.slice(0, at), line.slice(at + 2));
7239
+ }
7240
+ const chain = asChain(build.chain) ?? "STELLAR";
7241
+ let data = { kind: "other" };
7242
+ const from = lines.get("From") ?? lines.get("Funder");
7243
+ if (lines.has("Send") && lines.has("Receive min")) {
7244
+ const sent = splitAmount(lines.get("Send"));
7245
+ const received = splitAmount(lines.get("Receive min"));
7246
+ data = {
7247
+ kind: "swap",
7248
+ from: { chain, self: true, ...sent, ...from ? { address: from } : {} },
7249
+ to: { chain, minimum: true, ...received, ...lines.get("To") ? { address: lines.get("To") } : {} }
7250
+ };
7251
+ } else if (lines.has("To") && lines.has("Amount")) {
7252
+ data = {
7253
+ kind: "send",
7254
+ from: { chain, self: true, ...splitAmount(lines.get("Amount")), ...from ? { address: from } : {} },
7255
+ to: { chain, address: lines.get("To") }
7256
+ };
7257
+ } else if (lines.has("New account")) {
7258
+ data = {
7259
+ kind: "create_account",
7260
+ from: { chain, self: true, ...splitAmount(lines.get("Starting balance")), ...from ? { address: from } : {} },
7261
+ to: { chain, address: lines.get("New account"), label: copy.newAccount }
7262
+ };
7263
+ }
7264
+ const rows = [
7265
+ { label: copy.rows.network, value: `${copy.chains[chain]} ${build.summary.network}` },
7266
+ ...build.summary.lines.map((line) => {
7267
+ const at = line.indexOf(": ");
7268
+ if (at <= 0) return { label: "", value: line };
7269
+ const value = line.slice(at + 2);
7270
+ const label = line.slice(0, at);
7271
+ const isAddress = /^[GCM][A-Z2-7]{55,68}$/.test(value) || /^0x[0-9a-fA-F]{40}$/.test(value);
7272
+ return { label: buildLabel(label, copy), value, ...isAddress ? { copyValue: value, mono: true } : {} };
7273
+ }),
7274
+ { label: copy.rows.fee, value: sponsored ? copy.rows.feeCovered : build.summary.fee }
7275
+ ];
7276
+ return {
7277
+ ...data,
7278
+ title: titleOf(data, build.summary.title || fallbackTitle, copy),
7279
+ rows,
7280
+ ..."unsignedXdr" in build && build.unsignedXdr ? { raw: build.unsignedXdr } : {},
7281
+ ...hash ? { hash } : {},
7282
+ ...sponsored !== void 0 ? { fee: { sponsored } } : {}
7283
+ };
7284
+ }
7285
+ function ChainBadge({ chain, copy }) {
7286
+ if (!chain) return null;
7287
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-chain", src: CHAIN_LOGOS[chain], alt: copy.chains[chain], title: copy.chains[chain] });
7288
+ }
7289
+ function AssetLogo({ asset }) {
7290
+ const url = TOKEN_LOGOS[asset.toUpperCase()];
7291
+ const [failed, setFailed] = react.useState(false);
7292
+ if (url && !failed) return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-logo", src: url, alt: asset, onError: () => setFailed(true) });
7293
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-logo pollar-txr-logo-initial", "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
7294
+ }
7295
+ function AccountGlyph() {
7296
+ 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: [
7297
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "7", r: "3.25", stroke: "currentColor", strokeWidth: "1.6" }),
7298
+ /* @__PURE__ */ jsxRuntime.jsx(
7299
+ "path",
7300
+ {
7301
+ d: "M3.75 16.5c.9-3 3.3-4.5 6.25-4.5s5.35 1.5 6.25 4.5",
7302
+ stroke: "currentColor",
7303
+ strokeWidth: "1.6",
7304
+ strokeLinecap: "round"
7305
+ }
7306
+ )
7307
+ ] }) });
7308
+ }
7309
+ function ContractGlyph() {
7310
+ 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: [
7311
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "9", width: "11", height: "7.5", rx: "1.75", stroke: "currentColor", strokeWidth: "1.6" }),
7312
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 9V6.75a3 3 0 0 1 6 0V9", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
7313
+ ] }) });
7314
+ }
7315
+ function Node2({
7316
+ party,
7317
+ showAmount,
7318
+ glyph,
7319
+ copy
7320
+ }) {
7321
+ const caption = party.self ? copy.yourWallet : party.label ?? (party.address ? shortAddress(party.address) : party.chain ? copy.chains[party.chain] : "");
7322
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-node", children: [
7323
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-avatar", children: [
7324
+ glyph === "asset" && party.asset ? /* @__PURE__ */ jsxRuntime.jsx(AssetLogo, { asset: party.asset }, party.asset) : glyph === "contract" ? /* @__PURE__ */ jsxRuntime.jsx(ContractGlyph, {}) : /* @__PURE__ */ jsxRuntime.jsx(AccountGlyph, {}),
7325
+ /* @__PURE__ */ jsxRuntime.jsx(ChainBadge, { chain: party.chain, copy })
7326
+ ] }),
7327
+ showAmount && party.amount && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-amount", children: [
7328
+ party.minimum && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-min", children: [
7329
+ copy.atLeast,
7330
+ " "
7331
+ ] }),
7332
+ party.amount,
7333
+ " ",
7334
+ party.asset
7335
+ ] }),
7336
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-caption", title: party.address, children: caption })
7337
+ ] });
7338
+ }
7339
+ function Arrow() {
7340
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-arrow", "aria-hidden": true, children: [
7341
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height: "12", viewBox: "0 0 64 12", preserveAspectRatio: "none", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 6h60", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeDasharray: "3 4" }) }),
7342
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "pollar-txr-arrow-head", width: "10", height: "12", viewBox: "0 0 10 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 1.5 7.5 6 2 10.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) })
7343
+ ] });
7344
+ }
7345
+ function FeeBadge({ sponsored, copy }) {
7346
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `pollar-txr-fee${sponsored ? " pollar-txr-fee-sponsored" : ""}`, children: [
7347
+ sponsored ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: [
7348
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "6", width: "12", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.4" }),
7349
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1.5 4.25h13V6h-13zM8 4.25V14", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }),
7350
+ /* @__PURE__ */ jsxRuntime.jsx(
7351
+ "path",
7352
+ {
7353
+ d: "M8 4.25C6.5 4.25 5 3.5 5 2.4 5 1.2 7 1.2 8 4.25Zm0 0c1.5 0 3-.75 3-1.85 0-1.2-2-1.2-3 1.85Z",
7354
+ stroke: "currentColor",
7355
+ strokeWidth: "1.2",
7356
+ strokeLinejoin: "round"
7357
+ }
7358
+ )
7359
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 1.5 3.5 9H8l-.5 5.5 5-7.5H8l.5-5.5Z", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }) }),
7360
+ sponsored ? copy.feeSponsored : copy.feePaid
7361
+ ] });
7362
+ }
7363
+ function TxFeeBadge({
7364
+ sponsored,
7365
+ language: languageProp
7366
+ }) {
7367
+ const language = useInheritedLanguage(languageProp);
7368
+ return /* @__PURE__ */ jsxRuntime.jsx(FeeBadge, { sponsored, copy: TX_REVIEW_COPY[language] });
7369
+ }
7370
+ function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
7371
+ const language = useInheritedLanguage(languageProp);
7372
+ const copy = TX_REVIEW_COPY[language];
7373
+ const [openState, setOpenState] = react.useState(false);
7374
+ const open = openProp ?? openState;
7375
+ const toggle = onToggle ?? (() => setOpenState((v) => !v));
7376
+ const { from, to, kind } = data;
7377
+ const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
7378
+ const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" ? "asset" : "account";
7379
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr", children: [
7380
+ from && to && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-flow", children: [
7381
+ /* @__PURE__ */ jsxRuntime.jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
7382
+ /* @__PURE__ */ jsxRuntime.jsx(Arrow, {}),
7383
+ /* @__PURE__ */ jsxRuntime.jsx(Node2, { party: to, showAmount: kind !== "approve" && toShowsAmount, glyph: toGlyph, copy })
7384
+ ] }),
7385
+ kind === "approve" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-txr-note", children: copy.approveNote }),
7386
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-bar", children: [
7387
+ data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(FeeBadge, { sponsored: data.fee.sponsored, copy }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
7388
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
7389
+ open ? copy.hideDetails : copy.showDetails,
7390
+ /* @__PURE__ */ jsxRuntime.jsx(
7391
+ "svg",
7392
+ {
7393
+ width: "10",
7394
+ height: "10",
7395
+ viewBox: "0 0 12 12",
7396
+ fill: "none",
7397
+ "aria-hidden": true,
7398
+ style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 150ms" },
7399
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
7400
+ }
7401
+ )
7402
+ ] })
7403
+ ] }),
7404
+ open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-details", children: [
7405
+ /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pollar-txr-rows", children: [
7406
+ data.rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-row", children: [
7407
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: row.label }),
7408
+ /* @__PURE__ */ jsxRuntime.jsxs("dd", { className: row.mono ? "pollar-txr-mono" : void 0, children: [
7409
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: row.value }),
7410
+ row.copyValue && /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: row.copyValue, className: "pollar-copy-btn-sm", language })
7411
+ ] })
7412
+ ] }, `${row.label}-${i}`)),
7413
+ data.hash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-row", children: [
7414
+ /* @__PURE__ */ jsxRuntime.jsx("dt", { children: copy.rows.txHash }),
7415
+ /* @__PURE__ */ jsxRuntime.jsxs("dd", { className: "pollar-txr-mono", children: [
7416
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: data.hash.value }),
7417
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: data.hash.value, className: "pollar-copy-btn-sm", language })
7418
+ ] })
7419
+ ] })
7420
+ ] }),
7421
+ data.hash?.explorerUrl && /* @__PURE__ */ jsxRuntime.jsx("a", { className: "pollar-txr-link", href: data.hash.explorerUrl, target: "_blank", rel: "noopener noreferrer", children: copy.viewOnExplorer }),
7422
+ data.raw && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-raw", children: [
7423
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-raw-head", children: [
7424
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: copy.rows.rawTx }),
7425
+ /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: data.raw, className: "pollar-copy-btn-sm", language })
7426
+ ] }),
7427
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { children: data.raw })
7428
+ ] })
7429
+ ] })
7430
+ ] });
7431
+ }
7432
+
6946
7433
  // src/components/transaction-modal/transaction-copy.ts
6947
7434
  var TRANSACTION_COPY = {
6948
7435
  en: {
6949
7436
  title: "Transaction",
6950
7437
  close: "Close",
6951
- details: "Details",
6952
- network: "Network",
6953
- fee: "Fee",
6954
- rawXdr: "Raw transaction (XDR)",
6955
7438
  errorDetails: "Error details",
6956
7439
  signAndSend: "Sign & Send",
6957
7440
  waitingFreighter: "Waiting for Freighter\u2026",
6958
7441
  waitingAlbedo: "Waiting for Albedo\u2026",
6959
7442
  signingAndSending: "Signing and sending\u2026",
6960
7443
  tryAgain: "Try again",
6961
- txHash: "Transaction hash",
6962
- copied: "Copied!",
6963
- copyHash: "Copy hash",
6964
- viewOnExplorer: "View on Explorer",
6965
7444
  done: "Done",
6966
7445
  status: {
6967
7446
  idle: "",
@@ -6981,20 +7460,12 @@ var TRANSACTION_COPY = {
6981
7460
  es: {
6982
7461
  title: "Transacci\xF3n",
6983
7462
  close: "Cerrar",
6984
- details: "Detalles",
6985
- network: "Red",
6986
- fee: "Comisi\xF3n",
6987
- rawXdr: "Transacci\xF3n en bruto (XDR)",
6988
7463
  errorDetails: "Detalles del error",
6989
7464
  signAndSend: "Firmar y enviar",
6990
7465
  waitingFreighter: "Esperando a Freighter\u2026",
6991
7466
  waitingAlbedo: "Esperando a Albedo\u2026",
6992
7467
  signingAndSending: "Firmando y enviando\u2026",
6993
7468
  tryAgain: "Intenta de nuevo",
6994
- txHash: "Hash de la transacci\xF3n",
6995
- copied: "\xA1Copiado!",
6996
- copyHash: "Copiar hash",
6997
- viewOnExplorer: "Ver en el explorador",
6998
7469
  done: "Listo",
6999
7470
  status: {
7000
7471
  idle: "",
@@ -7014,20 +7485,12 @@ var TRANSACTION_COPY = {
7014
7485
  pt: {
7015
7486
  title: "Transa\xE7\xE3o",
7016
7487
  close: "Fechar",
7017
- details: "Detalhes",
7018
- network: "Rede",
7019
- fee: "Taxa",
7020
- rawXdr: "Transa\xE7\xE3o bruta (XDR)",
7021
7488
  errorDetails: "Detalhes do erro",
7022
7489
  signAndSend: "Assinar e enviar",
7023
7490
  waitingFreighter: "Aguardando o Freighter\u2026",
7024
7491
  waitingAlbedo: "Aguardando o Albedo\u2026",
7025
7492
  signingAndSending: "Assinando e enviando\u2026",
7026
7493
  tryAgain: "Tentar novamente",
7027
- txHash: "Hash da transa\xE7\xE3o",
7028
- copied: "Copiado!",
7029
- copyHash: "Copiar hash",
7030
- viewOnExplorer: "Ver no explorador",
7031
7494
  done: "Concluir",
7032
7495
  status: {
7033
7496
  idle: "",
@@ -7051,7 +7514,8 @@ var IN_FLIGHT_STEPS = /* @__PURE__ */ new Set([
7051
7514
  "submitting",
7052
7515
  "submitted",
7053
7516
  "signing-submitting",
7054
- "building-signing-submitting"
7517
+ "building-signing-submitting",
7518
+ "awaiting_cosign"
7055
7519
  ]);
7056
7520
  var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
7057
7521
  "built",
@@ -7060,17 +7524,16 @@ var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
7060
7524
  "submitting",
7061
7525
  "submitted",
7062
7526
  "signing-submitting",
7527
+ "awaiting_cosign",
7063
7528
  "success"
7064
7529
  ]);
7065
7530
  function TxStatusView({
7066
7531
  transaction,
7067
7532
  showXdr,
7068
- copied,
7069
7533
  explorerUrl,
7070
7534
  walletType,
7071
7535
  onSignAndSend,
7072
7536
  onToggleXdr,
7073
- onCopyHash,
7074
7537
  onRetry,
7075
7538
  onDone,
7076
7539
  language: languageProp
@@ -7084,7 +7547,11 @@ function TxStatusView({
7084
7547
  const isInFlight = IN_FLIGHT_STEPS.has(transaction.step);
7085
7548
  const isSuccess = transaction.step === "success";
7086
7549
  const isError = transaction.step === "error";
7087
- const showDetails = buildData !== null && SHOW_DETAILS_STEPS.has(transaction.step);
7550
+ const showDetails = SHOW_DETAILS_STEPS.has(transaction.step);
7551
+ const reviewCopy = TX_REVIEW_COPY[language];
7552
+ const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
7553
+ const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
7554
+ const review = buildData ? reviewFromBuild(buildData, reviewCopy, copy.title, hashInfo, sponsored) : hashInfo ? { title: copy.title, kind: "other", rows: [], hash: hashInfo, ...sponsored !== void 0 && { fee: { sponsored } } } : null;
7088
7555
  const walletImg = walletType === core.WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === core.WalletType.ALBEDO ? LOGO_ALBEDO : null;
7089
7556
  const walletAlt = walletType === core.WalletType.FREIGHTER ? "Freighter" : walletType === core.WalletType.ALBEDO ? "Albedo" : "Pollar";
7090
7557
  const statusBanner = /* @__PURE__ */ jsxRuntime.jsx(
@@ -7095,41 +7562,12 @@ function TxStatusView({
7095
7562
  }
7096
7563
  );
7097
7564
  const showSpinner = isInFlight || isSuccess || isError;
7565
+ const reviewBlock = showDetails && review && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-review", children: [
7566
+ buildData && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-review-title", children: review.title }),
7567
+ /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, open: showXdr, onToggle: onToggleXdr, language })
7568
+ ] });
7098
7569
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7099
- showDetails && buildData && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7100
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-summary", children: [
7101
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-summary-title", children: copy.details }),
7102
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pollar-tx-summary-lines", children: buildData.summary.lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "pollar-tx-summary-line", children: line }, i)) })
7103
- ] }),
7104
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta", children: [
7105
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
7106
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: copy.network }),
7107
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.network })
7108
- ] }),
7109
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
7110
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: copy.fee }),
7111
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.fee })
7112
- ] })
7113
- ] }),
7114
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-xdr", children: [
7115
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-tx-xdr-toggle", onClick: onToggleXdr, children: [
7116
- /* @__PURE__ */ jsxRuntime.jsx(
7117
- "svg",
7118
- {
7119
- width: "12",
7120
- height: "12",
7121
- viewBox: "0 0 12 12",
7122
- fill: "none",
7123
- "aria-hidden": true,
7124
- style: { transform: showXdr ? "rotate(90deg)" : "rotate(0deg)", transition: "transform 150ms" },
7125
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 2l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
7126
- }
7127
- ),
7128
- copy.rawXdr
7129
- ] }),
7130
- showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildData.unsignedXdr })
7131
- ] })
7132
- ] }),
7570
+ !isSuccess && reviewBlock,
7133
7571
  isError && errorDetails && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-error-details", children: [
7134
7572
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-error-details-label", children: copy.errorDetails }),
7135
7573
  /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-error-details-content", children: errorDetails })
@@ -7171,69 +7609,10 @@ function TxStatusView({
7171
7609
  ] }) })
7172
7610
  ] }),
7173
7611
  statusBanner,
7174
- isInFlight && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-spinner-label", children: walletType === core.WalletType.FREIGHTER ? copy.waitingFreighter : walletType === core.WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
7612
+ isInFlight && transaction.step !== "awaiting_cosign" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-spinner-label", children: walletType === core.WalletType.FREIGHTER ? copy.waitingFreighter : walletType === core.WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
7175
7613
  isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain })
7176
7614
  ] }),
7177
- isSuccess && hash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result", children: [
7178
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-label", children: copy.txHash }),
7179
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-hash", children: hash }),
7180
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result-actions", children: [
7181
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-result-btn", onClick: onCopyHash, children: copied ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7182
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
7183
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
7184
- /* @__PURE__ */ jsxRuntime.jsx(
7185
- "path",
7186
- {
7187
- d: "M3.5 7l2.5 2.5 4.5-5",
7188
- stroke: "white",
7189
- strokeWidth: "1.5",
7190
- strokeLinecap: "round",
7191
- strokeLinejoin: "round"
7192
- }
7193
- )
7194
- ] }),
7195
- copy.copied
7196
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7197
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
7198
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
7199
- /* @__PURE__ */ jsxRuntime.jsx(
7200
- "path",
7201
- {
7202
- d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
7203
- stroke: "currentColor",
7204
- strokeWidth: "1.5",
7205
- strokeLinecap: "round"
7206
- }
7207
- )
7208
- ] }),
7209
- copy.copyHash
7210
- ] }) }),
7211
- explorerUrl && /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "pollar-tx-result-btn", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", children: [
7212
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
7213
- /* @__PURE__ */ jsxRuntime.jsx(
7214
- "path",
7215
- {
7216
- d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8",
7217
- stroke: "currentColor",
7218
- strokeWidth: "1.5",
7219
- strokeLinecap: "round"
7220
- }
7221
- ),
7222
- /* @__PURE__ */ jsxRuntime.jsx(
7223
- "path",
7224
- {
7225
- d: "M8 1h4m0 0v4m0-4L6 7",
7226
- stroke: "currentColor",
7227
- strokeWidth: "1.5",
7228
- strokeLinecap: "round",
7229
- strokeLinejoin: "round"
7230
- }
7231
- )
7232
- ] }),
7233
- copy.viewOnExplorer
7234
- ] })
7235
- ] })
7236
- ] }),
7615
+ isSuccess && reviewBlock,
7237
7616
  isSuccess && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done }),
7238
7617
  !showSpinner && statusBanner
7239
7618
  ] });
@@ -8462,7 +8841,7 @@ function toBaseUnits2(amount, decimals) {
8462
8841
  const units = BigInt(`${whole}${fraction.padEnd(decimals, "0")}`);
8463
8842
  return units > 0n ? units.toString() : null;
8464
8843
  }
8465
- function fromBaseUnits2(units, decimals) {
8844
+ function fromBaseUnits3(units, decimals) {
8466
8845
  if (decimals === 0) return units;
8467
8846
  const padded = units.padStart(decimals + 1, "0");
8468
8847
  const fraction = padded.slice(-decimals).replace(/0+$/, "");
@@ -8654,8 +9033,8 @@ function SwapModal({ onClose }) {
8654
9033
  const solanaQuote = solanaQuotes[0] ?? null;
8655
9034
  const quoteView = chain === "SOLANA" ? solanaQuote && selectedBuy?.decimals !== void 0 ? {
8656
9035
  provider: solanaQuote.provider,
8657
- amountOut: fromBaseUnits2(solanaQuote.outAmount, selectedBuy.decimals),
8658
- minReceived: fromBaseUnits2(solanaQuote.minOut, selectedBuy.decimals),
9036
+ amountOut: fromBaseUnits3(solanaQuote.outAmount, selectedBuy.decimals),
9037
+ minReceived: fromBaseUnits3(solanaQuote.minOut, selectedBuy.decimals),
8659
9038
  priceImpactPct: solanaQuote.priceImpactPct
8660
9039
  } : null : quote;
8661
9040
  react.useEffect(() => {
@@ -9382,6 +9761,16 @@ var CARD_COPY = {
9382
9761
  CREDITED: { title: "Credited to your card" },
9383
9762
  FAILED: { title: "Failed" }
9384
9763
  },
9764
+ fundingSolana: {
9765
+ CREATED: {
9766
+ title: "Confirming your payment",
9767
+ hint: "Your USDC payment is being confirmed on Solana. This takes a few seconds."
9768
+ },
9769
+ SENT: {
9770
+ title: "Arrived, crediting your card",
9771
+ hint: "The USDC reached the card provider, which is adding it to your card. This can take a few minutes."
9772
+ }
9773
+ },
9385
9774
  incomeRanges: {
9386
9775
  "0-1000": "Up to 1,000 USD",
9387
9776
  "1000-5000": "1,000 to 5,000 USD",
@@ -9530,6 +9919,16 @@ var CARD_COPY = {
9530
9919
  CREDITED: { title: "Acreditado en tu tarjeta" },
9531
9920
  FAILED: { title: "Fall\xF3" }
9532
9921
  },
9922
+ fundingSolana: {
9923
+ CREATED: {
9924
+ title: "Confirmando tu pago",
9925
+ hint: "Tu pago en USDC se est\xE1 confirmando en Solana. Esto toma unos segundos."
9926
+ },
9927
+ SENT: {
9928
+ title: "Lleg\xF3, acreditando tu tarjeta",
9929
+ hint: "Los USDC llegaron al proveedor de la tarjeta, que los est\xE1 sumando a tu tarjeta. Esto puede tardar unos minutos."
9930
+ }
9931
+ },
9533
9932
  incomeRanges: {
9534
9933
  "0-1000": "Hasta 1,000 USD",
9535
9934
  "1000-5000": "De 1,000 a 5,000 USD",
@@ -9678,6 +10077,16 @@ var CARD_COPY = {
9678
10077
  CREDITED: { title: "Creditado no seu cart\xE3o" },
9679
10078
  FAILED: { title: "Falhou" }
9680
10079
  },
10080
+ fundingSolana: {
10081
+ CREATED: {
10082
+ title: "Confirmando seu pagamento",
10083
+ hint: "Seu pagamento em USDC est\xE1 sendo confirmado na Solana. Isso leva alguns segundos."
10084
+ },
10085
+ SENT: {
10086
+ title: "Chegou, creditando seu cart\xE3o",
10087
+ hint: "Os USDC chegaram ao provedor do cart\xE3o, que est\xE1 adicionando ao seu cart\xE3o. Isso pode levar alguns minutos."
10088
+ }
10089
+ },
9681
10090
  incomeRanges: {
9682
10091
  "0-1000": "At\xE9 1.000 USD",
9683
10092
  "1000-5000": "De 1.000 a 5.000 USD",
@@ -9848,9 +10257,16 @@ var KYC_POLL_MS = 5e3;
9848
10257
  var REVEAL_MS = 3e4;
9849
10258
  var TX_LIMIT = 10;
9850
10259
  var FUNDING_POLL_MS = 5e3;
9851
- var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "BURNED", "ATTESTED", "MINTED"]);
9852
- var FUNDING_STEP = { CREATED: 1, BURNED: 2, ATTESTED: 3, MINTED: 4 };
9853
- var FUNDING_STEPS = 4;
10260
+ var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "SENT", "BURNED", "ATTESTED", "MINTED"]);
10261
+ function newFundingKey() {
10262
+ return `fund-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
10263
+ }
10264
+ var FUNDING_STEPS = {
10265
+ STELLAR: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
10266
+ SOLANA: ["CREATED", "SENT"]
10267
+ };
10268
+ var FUNDING_CHAINS = ["STELLAR", "SOLANA"];
10269
+ var isFundingChain = (chain) => FUNDING_CHAINS.includes(chain);
9854
10270
  var INCOME_RANGES = ["0-1000", "1000-5000", "5000-10000", "10000+"];
9855
10271
  var KYC_PENDING = /* @__PURE__ */ new Set(["PENDING", "NEEDS_ACTION", "IN_REVIEW"]);
9856
10272
  var KYC_FINAL = /* @__PURE__ */ new Set(["DENIED", "LOCKED", "CANCELED"]);
@@ -9912,6 +10328,8 @@ function CardModal({ onClose }) {
9912
10328
  const [deposit, setDeposit] = react.useState(null);
9913
10329
  const [fundings, setFundings] = react.useState(null);
9914
10330
  const [fundAmount, setFundAmount] = react.useState("");
10331
+ const fundKey = react.useRef(null);
10332
+ const [fundChain, setFundChain] = react.useState(null);
9915
10333
  const [showManual, setShowManual] = react.useState(false);
9916
10334
  const [occupations, setOccupations] = react.useState([]);
9917
10335
  const [kyc, setKyc] = react.useState(emptyKyc);
@@ -9924,7 +10342,9 @@ function CardModal({ onClose }) {
9924
10342
  const revealTimer = react.useRef(null);
9925
10343
  const provider = providers?.[0] ?? null;
9926
10344
  const fundingAsset = provider?.fundingAssets[0] ?? "USDC";
9927
- const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: "STELLAR", code: fundingAsset } : null);
10345
+ const fundChains = useChains().chains.filter(isFundingChain);
10346
+ const selectedFundChain = fundChain ?? fundChains[0] ?? "STELLAR";
10347
+ const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: selectedFundChain, code: fundingAsset } : null);
9928
10348
  const card = cards?.[0] ?? null;
9929
10349
  const expiry = card?.expMonth && card.expYear ? `${card.expMonth}/${card.expYear.slice(-2)}` : null;
9930
10350
  const loadHolder = react.useCallback(async () => {
@@ -10090,7 +10510,19 @@ function CardModal({ onClose }) {
10090
10510
  const fund = () => run(
10091
10511
  "fund-send",
10092
10512
  async () => {
10093
- const outcome = await getClient().fundCard({ amount: fundAmount.trim() });
10513
+ fundKey.current ?? (fundKey.current = newFundingKey());
10514
+ let outcome;
10515
+ try {
10516
+ outcome = await getClient().fundCard({
10517
+ amount: fundAmount.trim(),
10518
+ chain: selectedFundChain,
10519
+ idempotencyKey: fundKey.current
10520
+ });
10521
+ } catch (e) {
10522
+ if (core.isPollarApiError(e)) fundKey.current = null;
10523
+ throw e;
10524
+ }
10525
+ fundKey.current = null;
10094
10526
  if (outcome.status === "cancelled") {
10095
10527
  setError(copy.notSigned);
10096
10528
  return;
@@ -10465,6 +10897,16 @@ function CardModal({ onClose }) {
10465
10897
  ] }),
10466
10898
  !loading && provider && card && panel === "fund" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10467
10899
  /* @__PURE__ */ jsxRuntime.jsx("p", { children: copy.fundIntro(provider.fundingAssets.join(` ${copy.or} `) || "USDC") }),
10900
+ /* @__PURE__ */ jsxRuntime.jsx(
10901
+ ChainSelect,
10902
+ {
10903
+ value: selectedFundChain,
10904
+ options: fundChains,
10905
+ onChange: (chain) => setFundChain(chain),
10906
+ disabled: busy !== null,
10907
+ language
10908
+ }
10909
+ ),
10468
10910
  /* @__PURE__ */ jsxRuntime.jsx(
10469
10911
  AmountField,
10470
10912
  {
@@ -10491,8 +10933,9 @@ function CardModal({ onClose }) {
10491
10933
  fundings && fundings.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10492
10934
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-card-section-title", children: copy.yourFundings }),
10493
10935
  fundings.map((f) => {
10494
- const state = copy.funding[f.status];
10495
- const step = FUNDING_STEP[f.status];
10936
+ const state = (f.chain === "SOLANA" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
10937
+ const steps = FUNDING_STEPS[isFundingChain(f.chain) ? f.chain : "STELLAR"];
10938
+ const step = steps.indexOf(f.status) + 1;
10496
10939
  const inflight = FUNDING_INFLIGHT.has(f.status);
10497
10940
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-card-tx", "aria-busy": inflight, children: [
10498
10941
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
@@ -10500,8 +10943,8 @@ function CardModal({ onClose }) {
10500
10943
  inflight && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
10501
10944
  state?.title ?? f.status
10502
10945
  ] }),
10503
- inflight && step && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
10504
- copy.stepOf(step, FUNDING_STEPS),
10946
+ inflight && step > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
10947
+ copy.stepOf(step, steps.length),
10505
10948
  " \xB7 ",
10506
10949
  state?.hint
10507
10950
  ] }),
@@ -10949,7 +11392,6 @@ var COSIGN_COPY = {
10949
11392
  approving: "Approving...",
10950
11393
  genericError: "Something went wrong. Please try again.",
10951
11394
  transaction: "Transaction",
10952
- rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
10953
11395
  operations: {
10954
11396
  payment: "Send",
10955
11397
  path_payment_strict_send: "Swap",
@@ -10957,7 +11399,10 @@ var COSIGN_COPY = {
10957
11399
  create_account: "Create account",
10958
11400
  invoke_contract: "Contract call",
10959
11401
  soroban_auth: "Authorize a contract call",
10960
- manage_data: "Manage data"
11402
+ manage_data: "Manage data",
11403
+ transfer: "Send",
11404
+ ramp_payment: "Ramp payment",
11405
+ cctp_burn: "Move USDC"
10961
11406
  }
10962
11407
  },
10963
11408
  es: {
@@ -10986,7 +11431,6 @@ var COSIGN_COPY = {
10986
11431
  approving: "Aprobando...",
10987
11432
  genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
10988
11433
  transaction: "Transacci\xF3n",
10989
- rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
10990
11434
  operations: {
10991
11435
  payment: "Enviar",
10992
11436
  path_payment_strict_send: "Intercambiar",
@@ -10994,7 +11438,10 @@ var COSIGN_COPY = {
10994
11438
  create_account: "Crear cuenta",
10995
11439
  invoke_contract: "Llamada a contrato",
10996
11440
  soroban_auth: "Autorizar una llamada a contrato",
10997
- manage_data: "Gestionar datos"
11441
+ manage_data: "Gestionar datos",
11442
+ transfer: "Enviar",
11443
+ ramp_payment: "Pago de rampa",
11444
+ cctp_burn: "Mover USDC"
10998
11445
  }
10999
11446
  },
11000
11447
  pt: {
@@ -11023,7 +11470,6 @@ var COSIGN_COPY = {
11023
11470
  approving: "Aprovando...",
11024
11471
  genericError: "Algo deu errado. Tente novamente.",
11025
11472
  transaction: "Transa\xE7\xE3o",
11026
- rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
11027
11473
  operations: {
11028
11474
  payment: "Enviar",
11029
11475
  path_payment_strict_send: "Trocar",
@@ -11031,7 +11477,10 @@ var COSIGN_COPY = {
11031
11477
  create_account: "Criar conta",
11032
11478
  invoke_contract: "Chamada de contrato",
11033
11479
  soroban_auth: "Autorizar uma chamada de contrato",
11034
- manage_data: "Gerenciar dados"
11480
+ manage_data: "Gerenciar dados",
11481
+ transfer: "Enviar",
11482
+ ramp_payment: "Pagamento de rampa",
11483
+ cctp_burn: "Mover USDC"
11035
11484
  }
11036
11485
  }
11037
11486
  };
@@ -11046,32 +11495,6 @@ function expiresIn(request, copy) {
11046
11495
  const m = Math.floor(ms % 36e5 / 6e4);
11047
11496
  return h > 0 ? `${h}h ${m}m` : `${m}m`;
11048
11497
  }
11049
- function readableAmount(details) {
11050
- const { amount, decimals, symbol } = details;
11051
- if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
11052
- try {
11053
- return { amount: core.fromBaseUnits(amount, decimals), symbol };
11054
- } catch {
11055
- return null;
11056
- }
11057
- }
11058
- function detailRows(request, copy) {
11059
- const details = request.details ?? {};
11060
- const rows = [];
11061
- const push = (label, value) => {
11062
- if (value === void 0 || value === null || value === "") return;
11063
- rows.push([
11064
- label,
11065
- typeof value === "string" && value.length > 24 && /^[GC][A-Z2-7]{55}$/.test(value) ? cropAddress(value) : String(value)
11066
- ]);
11067
- };
11068
- push(copy.rows.destination, details.destination);
11069
- const readable = readableAmount(details);
11070
- push(copy.rows.amount, readable ? `${readable.amount} ${readable.symbol}` : details.amount);
11071
- push(copy.rows.asset, details.asset ?? details.assetCode ?? readable?.symbol);
11072
- push(copy.rows.network, request.network);
11073
- return rows;
11074
- }
11075
11498
  function CloseIcon2() {
11076
11499
  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" }) });
11077
11500
  }
@@ -11096,6 +11519,7 @@ function CosignModalTemplate({
11096
11519
  closesIn = null,
11097
11520
  nextStep = null,
11098
11521
  language: languageProp,
11522
+ network,
11099
11523
  onSelect,
11100
11524
  onApprove,
11101
11525
  onReject,
@@ -11108,6 +11532,22 @@ function CosignModalTemplate({
11108
11532
  const canVote = !!current && verified && !busy && !approveBlocked;
11109
11533
  const [verifiedOpenFor, setVerifiedOpenFor] = react.useState(null);
11110
11534
  const verifiedOpen = !!current && verifiedOpenFor === current.id;
11535
+ const reviewOf = (request) => reviewFromRequest(
11536
+ {
11537
+ chain: request.network,
11538
+ network,
11539
+ operation: request.operation,
11540
+ summary: request.summary,
11541
+ details: request.details,
11542
+ signWith: request.account ?? request.signWith,
11543
+ raw: request.unsignedPayload,
11544
+ fallbackTitle: labelOf(request, copy),
11545
+ extraRows: [{ label: copy.expiresIn, value: expiresIn(request, copy) }],
11546
+ appPaysFee: request.appPaysFee
11547
+ },
11548
+ TX_REVIEW_COPY[language]
11549
+ );
11550
+ const review = current ? reviewOf(current) : null;
11111
11551
  return /* @__PURE__ */ jsxRuntime.jsxs(
11112
11552
  "div",
11113
11553
  {
@@ -11148,7 +11588,8 @@ function CosignModalTemplate({
11148
11588
  className: "pollar-copy-btn-sm pollar-cosign-copy"
11149
11589
  }
11150
11590
  )
11151
- ] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned })
11591
+ ] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned }),
11592
+ lastResolved.submit?.sponsored !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-fee", children: /* @__PURE__ */ jsxRuntime.jsx(TxFeeBadge, { sponsored: lastResolved.submit.sponsored, language }) })
11152
11593
  ] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: copy.nothingWaiting }),
11153
11594
  nextStep && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-cosign-next", children: [
11154
11595
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
@@ -11164,14 +11605,14 @@ function CosignModalTemplate({
11164
11605
  className: `pollar-cosign-item${current?.id === r.id ? " pollar-cosign-item-active" : ""}`,
11165
11606
  onClick: () => onSelect(r),
11166
11607
  children: [
11167
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: labelOf(r, copy) }),
11608
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: reviewOf(r).title }),
11168
11609
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-cosign-muted", children: expiresIn(r, copy) })
11169
11610
  ]
11170
11611
  }
11171
11612
  ) }, r.id)) }),
11172
- current && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail", children: [
11613
+ current && review && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `pollar-cosign-detail${pending.length > 1 ? " pollar-cosign-detail-grouped" : ""}`, children: [
11173
11614
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail-head", children: [
11174
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: labelOf(current, copy) }),
11615
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
11175
11616
  !verification && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-cosign-chip", children: [
11176
11617
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
11177
11618
  copy.checking
@@ -11190,17 +11631,7 @@ function CosignModalTemplate({
11190
11631
  }
11191
11632
  )
11192
11633
  ] }),
11193
- current.summary && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: current.summary }),
11194
- /* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pollar-cosign-rows", children: [
11195
- detailRows(current, copy).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
11196
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: k }),
11197
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: v })
11198
- ] }, k)),
11199
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
11200
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: copy.expiresIn }),
11201
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: expiresIn(current, copy) })
11202
- ] })
11203
- ] }),
11634
+ /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, language }, current.id),
11204
11635
  verification?.ok && verifiedOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedAgainstTurnkey }),
11205
11636
  verification && !verification.ok && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
11206
11637
  copy.notVerified,
@@ -11346,6 +11777,7 @@ function CosignModal({ nextStep = null, onClose }) {
11346
11777
  closesIn,
11347
11778
  nextStep: awaitingNext ? nextStep : null,
11348
11779
  language,
11780
+ network,
11349
11781
  explorerUrl: lastResolved?.submit?.hash ? explorerTxUrl(lastResolved.network, lastResolved.submit.hash, network) : null,
11350
11782
  onSelect: (r) => setSelectedId(r.id),
11351
11783
  onApprove: (r) => void run("approving", r, approve),
@@ -12104,7 +12536,6 @@ var CONFIRM_COPY = {
12104
12536
  confirm: "Confirm",
12105
12537
  close: "Close",
12106
12538
  transaction: "Transaction",
12107
- rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
12108
12539
  operations: {
12109
12540
  payment: "Send",
12110
12541
  path_payment_strict_send: "Swap",
@@ -12122,7 +12553,6 @@ var CONFIRM_COPY = {
12122
12553
  confirm: "Confirmar",
12123
12554
  close: "Cerrar",
12124
12555
  transaction: "Transacci\xF3n",
12125
- rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
12126
12556
  operations: {
12127
12557
  payment: "Enviar",
12128
12558
  path_payment_strict_send: "Intercambiar",
@@ -12140,7 +12570,6 @@ var CONFIRM_COPY = {
12140
12570
  confirm: "Confirmar",
12141
12571
  close: "Fechar",
12142
12572
  transaction: "Transa\xE7\xE3o",
12143
- rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
12144
12573
  operations: {
12145
12574
  payment: "Enviar",
12146
12575
  path_payment_strict_send: "Trocar",
@@ -12156,26 +12585,26 @@ function labelOf2(confirmation, copy) {
12156
12585
  const op = confirmation.operation ?? "";
12157
12586
  return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
12158
12587
  }
12159
- function detailRows2(confirmation, copy) {
12160
- const details = confirmation.details ?? {};
12161
- const rows = [];
12162
- const push = (label, value) => {
12163
- if (value === void 0 || value === null || value === "") return;
12164
- const text = typeof value === "object" ? JSON.stringify(value) : String(value);
12165
- rows.push([label, /^[GC][A-Z2-7]{55}$/.test(text) ? cropAddress(text) : text]);
12166
- };
12167
- push(copy.rows.destination, details.destination);
12168
- push(copy.rows.amount, details.amount);
12169
- push(copy.rows.asset, details.asset ?? details.assetCode ?? details.mint);
12170
- push(copy.rows.network, confirmation.network);
12171
- return rows;
12172
- }
12173
12588
  function CloseIcon4() {
12174
12589
  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" }) });
12175
12590
  }
12176
12591
  function ConfirmModal({ confirmation }) {
12177
- const { getClient, styles } = usePollar();
12178
- const copy = CONFIRM_COPY[useModalLanguage()];
12592
+ const { getClient, styles, network } = usePollar();
12593
+ const language = useModalLanguage();
12594
+ const copy = CONFIRM_COPY[language];
12595
+ const reviewCopy = TX_REVIEW_COPY[language];
12596
+ const raw = confirmation.unsignedXdr ?? confirmation.authEntryXdr;
12597
+ const review = confirmation.buildData ? reviewFromBuild(confirmation.buildData, reviewCopy, labelOf2(confirmation, copy)) : reviewFromRequest(
12598
+ {
12599
+ chain: confirmation.network,
12600
+ network,
12601
+ operation: confirmation.operation,
12602
+ details: confirmation.details,
12603
+ raw,
12604
+ fallbackTitle: labelOf2(confirmation, copy)
12605
+ },
12606
+ reviewCopy
12607
+ );
12179
12608
  const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
12180
12609
  const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
12181
12610
  const rejectRef = react.useRef(confirmation.reject);
@@ -12208,15 +12637,12 @@ function ConfirmModal({ confirmation }) {
12208
12637
  ) })
12209
12638
  ] }),
12210
12639
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail", children: [
12211
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: labelOf2(confirmation, copy) }),
12640
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
12212
12641
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: copy.intro }),
12213
- /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "pollar-cosign-rows", children: detailRows2(confirmation, copy).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
12214
- /* @__PURE__ */ jsxRuntime.jsx("dt", { children: k }),
12215
- /* @__PURE__ */ jsxRuntime.jsx("dd", { children: v })
12216
- ] }, k)) }),
12642
+ /* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, language }),
12217
12643
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-actions", children: [
12218
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children: "Cancel" }),
12219
- /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children: "Confirm" })
12644
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children: copy.cancel }),
12645
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children: copy.confirm })
12220
12646
  ] })
12221
12647
  ] }),
12222
12648
  /* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})