@pollar/react 0.12.1-rc.13 → 0.12.1-rc.15

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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { AUTH_ERROR_CODES, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepTitle, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
2
+ import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, describeRampAction, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampRailLabel, rampNoRouteText, rampFieldError, rampFieldValid, rampLegNote, rampStepTitle, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampCountries, rampQuoteFields, isPollarApiError, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
3
3
  import { createContext, forwardRef, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore, Component } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { createPortal } from 'react-dom';
@@ -1284,7 +1284,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1284
1284
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1285
1285
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1286
1286
  "v",
1287
- "0.12.1-rc.13"
1287
+ "0.12.1-rc.15"
1288
1288
  ] })
1289
1289
  ] });
1290
1290
  };
@@ -3635,7 +3635,7 @@ function LoginModalTemplate({
3635
3635
  const isLoading = status === "LOADING";
3636
3636
  const isEmailCodeError = authState.step === "error" && (authState.errorCode === AUTH_ERROR_CODES.EMAIL_CODE_EXPIRED || authState.errorCode === AUTH_ERROR_CODES.EMAIL_CODE_INVALID);
3637
3637
  const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
3638
- const statusMessage = authState.step === "error" ? authState.message : copy.status[authState.step];
3638
+ const statusMessage = authState.step === "error" ? authErrorMessage(authState.code, language) ?? authState.message : copy.status[authState.step];
3639
3639
  const BackButton = ({ onClick }) => /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": copy.back, children: /* @__PURE__ */ jsx(
3640
3640
  "svg",
3641
3641
  {
@@ -4678,6 +4678,7 @@ function AmountField({
4678
4678
  value,
4679
4679
  onChange,
4680
4680
  unit,
4681
+ unitIcon,
4681
4682
  available,
4682
4683
  onMax,
4683
4684
  placeholder = "0.00",
@@ -4725,6 +4726,7 @@ function AmountField({
4725
4726
  children: copy.max
4726
4727
  }
4727
4728
  ),
4729
+ unitIcon,
4728
4730
  unit && /* @__PURE__ */ jsx("span", { children: unit })
4729
4731
  ] })
4730
4732
  ] })
@@ -5394,7 +5396,7 @@ var REGISTRATION_COPY = {
5394
5396
  fix: "Review my details",
5395
5397
  incomplete: "Your registration with the provider did not finish. Register again to complete it.",
5396
5398
  providerDown: "The provider is not responding right now. Please try again in a few minutes.",
5397
- ipNotSupported: "The provider cannot accept your current connection (IPv6). Please try again from another network, for example Wi-Fi.",
5399
+ ipNotSupported: "We could not verify your connection with the provider. Please try again in a few minutes.",
5398
5400
  emailTaken: "This email is already registered with the provider through another app. Use a different email to register here.",
5399
5401
  loadError: "Could not load the registration. Please try again.",
5400
5402
  submitError: "Could not register you. Please try again.",
@@ -5414,7 +5416,7 @@ var REGISTRATION_COPY = {
5414
5416
  fix: "Revisar mis datos",
5415
5417
  incomplete: "Tu registro con el proveedor no se complet\xF3. Reg\xEDstrate de nuevo para terminarlo.",
5416
5418
  providerDown: "El proveedor no responde en este momento. Intenta de nuevo en unos minutos.",
5417
- ipNotSupported: "El proveedor no acepta tu conexi\xF3n actual (IPv6). Intenta desde otra red, por ejemplo Wi-Fi.",
5419
+ ipNotSupported: "No pudimos verificar tu conexi\xF3n con el proveedor. Intenta de nuevo en unos minutos.",
5418
5420
  emailTaken: "Este email ya est\xE1 registrado con el proveedor desde otra app. Usa otro email para registrarte aqu\xED.",
5419
5421
  loadError: "No se pudo cargar el registro. Intenta de nuevo.",
5420
5422
  submitError: "No se pudo completar el registro. Intenta de nuevo.",
@@ -5434,7 +5436,7 @@ var REGISTRATION_COPY = {
5434
5436
  fix: "Revisar meus dados",
5435
5437
  incomplete: "Seu cadastro no provedor n\xE3o foi conclu\xEDdo. Cadastre-se novamente para termin\xE1-lo.",
5436
5438
  providerDown: "O provedor n\xE3o est\xE1 respondendo agora. Tente novamente em alguns minutos.",
5437
- ipNotSupported: "O provedor n\xE3o aceita sua conex\xE3o atual (IPv6). Tente de outra rede, por exemplo Wi-Fi.",
5439
+ ipNotSupported: "N\xE3o conseguimos verificar sua conex\xE3o com o provedor. Tente novamente em alguns minutos.",
5438
5440
  emailTaken: "Este email j\xE1 est\xE1 cadastrado no provedor por outro app. Use outro email para se cadastrar aqui.",
5439
5441
  loadError: "N\xE3o foi poss\xEDvel carregar o cadastro. Tente novamente.",
5440
5442
  submitError: "N\xE3o foi poss\xEDvel concluir o cadastro. Tente novamente.",
@@ -6100,11 +6102,16 @@ function RampWidget({ onClose, language: languageProp, initial }) {
6100
6102
  setErrorMsg((current) => current === shown ? null : current);
6101
6103
  }, [awaitingPayment]);
6102
6104
  const approval = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.actionId : null;
6105
+ const approvalRequest = order?.pendingAction?.kind === "COSIGN_APPROVAL" ? order.pendingAction.cosignRequestId : null;
6103
6106
  useEffect(() => {
6104
6107
  if (!approval || promptedApproval.current === approval) return;
6105
6108
  promptedApproval.current = approval;
6106
- void client.cosign.pending().catch(() => void 0).then(() => openCosignModal());
6107
- }, [approval, client, openCosignModal]);
6109
+ void client.cosign.pending().catch(() => []).then(async (requests) => {
6110
+ const request = requests.find((r) => r.id === approvalRequest);
6111
+ if (request && await client.autoApproveSignIn(request)) return;
6112
+ openCosignModal();
6113
+ });
6114
+ }, [approval, approvalRequest, client, openCosignModal]);
6108
6115
  const nextApproval = step === "status" && order ? rampNextApproval(order, language) : null;
6109
6116
  useEffect(() => {
6110
6117
  setCosignNextStep(nextApproval);
@@ -7076,13 +7083,32 @@ var TX_REVIEW_COPY = {
7076
7083
  approve: (asset, spender) => `Allow ${spender} to use your ${asset}`,
7077
7084
  swap: (from, to) => `Swap ${from} for ${to}`,
7078
7085
  payment: (amount, to) => `Pay ${amount} to ${to}`,
7079
- createAccount: "Create an account"
7086
+ createAccount: "Create an account",
7087
+ signIn: "Confirm it's you"
7088
+ },
7089
+ signIn: {
7090
+ body: "The payment provider needs to confirm this account is yours before it can process your order.",
7091
+ noMoney: "No money moves",
7092
+ nothingSent: "Nothing is sent"
7093
+ },
7094
+ earn: {
7095
+ deposit: "Deposit",
7096
+ withdraw: "Withdraw",
7097
+ depositInto: (target) => `Deposit into ${target}`,
7098
+ withdrawFrom: (source) => `Withdraw from ${source}`,
7099
+ depositAmount: (amount) => `Deposit ${amount}`,
7100
+ withdrawAmount: (amount) => `Withdraw ${amount}`,
7101
+ fallbackName: "Earn",
7102
+ deposited: (amount, target, chain) => `Deposited ${amount} into the ${target} on ${chain}`,
7103
+ withdrew: (amount, source, chain) => `Withdrew ${amount} from the ${source} on ${chain}`,
7104
+ depositedOn: (amount, chain) => `Deposited ${amount} on ${chain}`,
7105
+ withdrewOn: (amount, chain) => `Withdrew ${amount} on ${chain}`
7080
7106
  },
7081
7107
  yourWallet: "Your wallet",
7082
7108
  newAccount: "New account",
7083
7109
  atLeast: "at least",
7084
7110
  approveNote: "This only gives permission. Nothing moves yet.",
7085
- feeSponsored: "Fee covered by the app",
7111
+ feeSponsored: "The app pays the network fee",
7086
7112
  feePaid: "You pay the network fee",
7087
7113
  showDetails: "Show details",
7088
7114
  hideDetails: "Hide details",
@@ -7097,6 +7123,9 @@ var TX_REVIEW_COPY = {
7097
7123
  via: "Via",
7098
7124
  fee: "Network fee",
7099
7125
  feeCovered: "Covered by the app",
7126
+ feeWallet: "Paid by your wallet",
7127
+ opportunity: "Opportunity",
7128
+ apy: "APY after fees",
7100
7129
  contract: "Contract",
7101
7130
  method: "Method",
7102
7131
  asset: "Asset",
@@ -7115,13 +7144,32 @@ var TX_REVIEW_COPY = {
7115
7144
  approve: (asset, spender) => `Permitir que ${spender} use tu ${asset}`,
7116
7145
  swap: (from, to) => `Cambiar ${from} por ${to}`,
7117
7146
  payment: (amount, to) => `Pagar ${amount} a ${to}`,
7118
- createAccount: "Crear una cuenta"
7147
+ createAccount: "Crear una cuenta",
7148
+ signIn: "Confirma que eres t\xFA"
7149
+ },
7150
+ signIn: {
7151
+ body: "El proveedor de pagos necesita confirmar que esta cuenta es tuya antes de procesar tu orden.",
7152
+ noMoney: "No se mueve dinero",
7153
+ nothingSent: "No se env\xEDa nada"
7154
+ },
7155
+ earn: {
7156
+ deposit: "Depositar",
7157
+ withdraw: "Retirar",
7158
+ depositInto: (target) => `Depositar en ${target}`,
7159
+ withdrawFrom: (source) => `Retirar de ${source}`,
7160
+ depositAmount: (amount) => `Depositar ${amount}`,
7161
+ withdrawAmount: (amount) => `Retirar ${amount}`,
7162
+ fallbackName: "Rendimientos",
7163
+ deposited: (amount, target, chain) => `Depositaste ${amount} en ${target}, en ${chain}`,
7164
+ withdrew: (amount, source, chain) => `Retiraste ${amount} de ${source}, en ${chain}`,
7165
+ depositedOn: (amount, chain) => `Depositaste ${amount} en ${chain}`,
7166
+ withdrewOn: (amount, chain) => `Retiraste ${amount} en ${chain}`
7119
7167
  },
7120
7168
  yourWallet: "Tu billetera",
7121
7169
  newAccount: "Cuenta nueva",
7122
7170
  atLeast: "al menos",
7123
7171
  approveNote: "Solo das permiso. Todav\xEDa no se mueve nada.",
7124
- feeSponsored: "La app cubre la comisi\xF3n",
7172
+ feeSponsored: "La app paga la comisi\xF3n de red",
7125
7173
  feePaid: "T\xFA pagas la comisi\xF3n de red",
7126
7174
  showDetails: "Ver detalles",
7127
7175
  hideDetails: "Ocultar detalles",
@@ -7136,6 +7184,9 @@ var TX_REVIEW_COPY = {
7136
7184
  via: "V\xEDa",
7137
7185
  fee: "Comisi\xF3n de red",
7138
7186
  feeCovered: "La cubre la app",
7187
+ feeWallet: "La paga tu billetera",
7188
+ opportunity: "Oportunidad",
7189
+ apy: "APY despu\xE9s de comisiones",
7139
7190
  contract: "Contrato",
7140
7191
  method: "M\xE9todo",
7141
7192
  asset: "Activo",
@@ -7154,13 +7205,32 @@ var TX_REVIEW_COPY = {
7154
7205
  approve: (asset, spender) => `Permitir que ${spender} use seu ${asset}`,
7155
7206
  swap: (from, to) => `Trocar ${from} por ${to}`,
7156
7207
  payment: (amount, to) => `Pagar ${amount} para ${to}`,
7157
- createAccount: "Criar uma conta"
7208
+ createAccount: "Criar uma conta",
7209
+ signIn: "Confirme que \xE9 voc\xEA"
7210
+ },
7211
+ signIn: {
7212
+ body: "O provedor de pagamentos precisa confirmar que esta conta \xE9 sua antes de processar seu pedido.",
7213
+ noMoney: "Nenhum dinheiro se move",
7214
+ nothingSent: "Nada \xE9 enviado"
7215
+ },
7216
+ earn: {
7217
+ deposit: "Depositar",
7218
+ withdraw: "Sacar",
7219
+ depositInto: (target) => `Depositar em ${target}`,
7220
+ withdrawFrom: (source) => `Sacar de ${source}`,
7221
+ depositAmount: (amount) => `Depositar ${amount}`,
7222
+ withdrawAmount: (amount) => `Sacar ${amount}`,
7223
+ fallbackName: "Rendimentos",
7224
+ deposited: (amount, target, chain) => `Voc\xEA depositou ${amount} em ${target}, na ${chain}`,
7225
+ withdrew: (amount, source, chain) => `Voc\xEA sacou ${amount} de ${source}, na ${chain}`,
7226
+ depositedOn: (amount, chain) => `Voc\xEA depositou ${amount} na ${chain}`,
7227
+ withdrewOn: (amount, chain) => `Voc\xEA sacou ${amount} na ${chain}`
7158
7228
  },
7159
7229
  yourWallet: "Sua carteira",
7160
7230
  newAccount: "Conta nova",
7161
7231
  atLeast: "pelo menos",
7162
7232
  approveNote: "Isto s\xF3 d\xE1 permiss\xE3o. Nada se move ainda.",
7163
- feeSponsored: "O app cobre a taxa",
7233
+ feeSponsored: "O app paga a taxa de rede",
7164
7234
  feePaid: "Voc\xEA paga a taxa de rede",
7165
7235
  showDetails: "Ver detalhes",
7166
7236
  hideDetails: "Ocultar detalhes",
@@ -7175,6 +7245,9 @@ var TX_REVIEW_COPY = {
7175
7245
  via: "Via",
7176
7246
  fee: "Taxa de rede",
7177
7247
  feeCovered: "Coberta pelo app",
7248
+ feeWallet: "Paga pela sua carteira",
7249
+ opportunity: "Oportunidade",
7250
+ apy: "APY ap\xF3s taxas",
7178
7251
  contract: "Contrato",
7179
7252
  method: "M\xE9todo",
7180
7253
  asset: "Ativo",
@@ -7219,6 +7292,8 @@ function titleOf(data, fallback, copy) {
7219
7292
  return from?.amount && to?.label ? copy.titles.payment(withAsset(from), displayName(to.label)) : fallback;
7220
7293
  case "create_account":
7221
7294
  return copy.titles.createAccount;
7295
+ case "sign_in":
7296
+ return copy.titles.signIn;
7222
7297
  default:
7223
7298
  return fallback;
7224
7299
  }
@@ -7240,7 +7315,7 @@ function rampFlow(details) {
7240
7315
  return out;
7241
7316
  };
7242
7317
  const from = { ...party(flow.from), self: true };
7243
- const to = { ...party(flow.to), self: kind === "bridge" || kind === "swap" };
7318
+ const to = { ...party(flow.to), self: (kind === "bridge" || kind === "swap") && !flow.to.label };
7244
7319
  return { kind, from, to, via: asString(flow.via) };
7245
7320
  }
7246
7321
  function readableAmount(details) {
@@ -7252,8 +7327,101 @@ function readableAmount(details) {
7252
7327
  return null;
7253
7328
  }
7254
7329
  }
7330
+ var earnOpportunities = /* @__PURE__ */ new Map();
7331
+ function rememberEarnOpportunities(list) {
7332
+ for (const o of list) {
7333
+ earnOpportunities.set(o.id, {
7334
+ name: o.name,
7335
+ ...o.asset?.code ? { asset: o.asset.code } : {},
7336
+ ...typeof o.apy === "number" ? { apy: o.apy } : {}
7337
+ });
7338
+ }
7339
+ }
7340
+ function earnOpportunityLabel(id) {
7341
+ return id ? earnOpportunities.get(id) : void 0;
7342
+ }
7343
+ function reviewForEarn(parts, copy) {
7344
+ const deposit = parts.action === "deposit";
7345
+ const asset = parts.asset ? { asset: parts.asset } : {};
7346
+ const wallet = { chain: parts.chain, self: true, ...asset, ...parts.wallet ? { address: parts.wallet } : {} };
7347
+ const opportunity = { chain: parts.chain, label: parts.name ?? copy.earn.fallbackName, ...asset };
7348
+ const amount = parts.amount ? { amount: parts.amount } : {};
7349
+ const from = deposit ? { ...wallet, ...amount } : { ...opportunity, ...amount };
7350
+ const to = deposit ? opportunity : wallet;
7351
+ const moved = withAsset(from);
7352
+ const rows = [];
7353
+ if (parts.name) rows.push({ label: copy.rows.opportunity, value: parts.name });
7354
+ if (typeof parts.apy === "number") rows.push({ label: copy.rows.apy, value: `${parts.apy.toFixed(2)}%` });
7355
+ if (parts.amount) rows.push({ label: copy.rows.amount, value: moved });
7356
+ rows.push({ label: copy.rows.network, value: [copy.chains[parts.chain], parts.network].filter(Boolean).join(" ") });
7357
+ const walletRow = partyRow(deposit ? copy.rows.from : copy.rows.to, wallet, copy);
7358
+ if (walletRow) rows.push(walletRow);
7359
+ if (parts.sponsored !== void 0)
7360
+ rows.push({ label: copy.rows.fee, value: parts.sponsored ? copy.rows.feeCovered : copy.rows.feeWallet });
7361
+ rows.push(...parts.extraRows ?? []);
7362
+ const title = parts.name ? deposit ? copy.earn.depositInto(parts.name) : copy.earn.withdrawFrom(parts.name) : parts.amount ? deposit ? copy.earn.depositAmount(moved) : copy.earn.withdrawAmount(moved) : deposit ? copy.earn.deposit : copy.earn.withdraw;
7363
+ return {
7364
+ title,
7365
+ kind: deposit ? "deposit" : "withdraw",
7366
+ from,
7367
+ to,
7368
+ ...parts.sponsored !== void 0 ? { fee: { sponsored: parts.sponsored } } : {},
7369
+ rows,
7370
+ ...parts.raw ? { raw: parts.raw } : {},
7371
+ ...parts.hash ? { hash: parts.hash } : {}
7372
+ };
7373
+ }
7374
+ function earnOutcome(parts, copy) {
7375
+ const moved = [parts.amount, parts.asset].filter(Boolean).join(" ");
7376
+ const chain = copy.chains[parts.chain];
7377
+ if (parts.action === "deposit") {
7378
+ return parts.name ? copy.earn.deposited(moved, parts.name, chain) : copy.earn.depositedOn(moved, chain);
7379
+ }
7380
+ return parts.name ? copy.earn.withdrew(moved, parts.name, chain) : copy.earn.withdrewOn(moved, chain);
7381
+ }
7382
+ function isSignIn(operation, details) {
7383
+ return operation === "provider_sign_in" || operation === "sep10" || details.purpose === "sign_in";
7384
+ }
7385
+ function reviewForSignIn(parts, copy) {
7386
+ const rows = [
7387
+ { label: copy.rows.network, value: [copy.chains[parts.chain], parts.network].filter(Boolean).join(" ") }
7388
+ ];
7389
+ if (parts.signWith) rows.push({ label: copy.yourWallet, value: shortAddress(parts.signWith), copyValue: parts.signWith });
7390
+ rows.push(...parts.extraRows ?? []);
7391
+ return {
7392
+ kind: "sign_in",
7393
+ title: copy.titles.signIn,
7394
+ rows,
7395
+ ...parts.raw ? { raw: parts.raw } : {},
7396
+ ...parts.hash ? { hash: parts.hash } : {}
7397
+ };
7398
+ }
7255
7399
  function reviewFromRequest(parts, copy) {
7256
7400
  const details = parts.details ?? {};
7401
+ const earnAction = parts.operation === "earn_deposit" ? "deposit" : parts.operation === "earn_withdraw" ? "withdraw" : null;
7402
+ if (earnAction) {
7403
+ const known = earnOpportunityLabel(asString(details.opportunityId) ?? asString(details.opportunity));
7404
+ const feePayer = asString(details.feePayer);
7405
+ const sponsored = typeof details.sponsored === "boolean" ? details.sponsored : feePayer && parts.signWith ? feePayer !== parts.signWith : parts.appPaysFee;
7406
+ return reviewForEarn(
7407
+ {
7408
+ action: earnAction,
7409
+ chain: parts.chain,
7410
+ network: parts.network,
7411
+ amount: asString(details.amount),
7412
+ asset: asString(details.assetCode) ?? known?.asset,
7413
+ name: known?.name,
7414
+ apy: known?.apy,
7415
+ wallet: parts.signWith,
7416
+ sponsored,
7417
+ raw: parts.raw,
7418
+ hash: parts.hash,
7419
+ ...parts.extraRows ? { extraRows: parts.extraRows } : {}
7420
+ },
7421
+ copy
7422
+ );
7423
+ }
7424
+ if (isSignIn(parts.operation, details)) return reviewForSignIn(parts, copy);
7257
7425
  const flow = rampFlow(details);
7258
7426
  const rows = [];
7259
7427
  let data;
@@ -7407,11 +7575,26 @@ function ChainBadge({ chain, copy }) {
7407
7575
  if (!chain) return null;
7408
7576
  return /* @__PURE__ */ jsx("img", { className: "pollar-txr-chain", src: CHAIN_LOGOS[chain], alt: copy.chains[chain], title: copy.chains[chain] });
7409
7577
  }
7410
- function AssetLogo({ asset }) {
7578
+ function AssetLogo({ asset, small = false }) {
7411
7579
  const url = TOKEN_LOGOS[asset.toUpperCase()];
7412
7580
  const [failed, setFailed] = useState(false);
7413
- if (url && !failed) return /* @__PURE__ */ jsx("img", { className: "pollar-txr-logo", src: url, alt: asset, onError: () => setFailed(true) });
7414
- return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-initial", "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
7581
+ const size = small ? " pollar-txr-logo-sm" : "";
7582
+ if (url && !failed) return /* @__PURE__ */ jsx("img", { className: `pollar-txr-logo${size}`, src: url, alt: asset, onError: () => setFailed(true) });
7583
+ return /* @__PURE__ */ jsx("span", { className: `pollar-txr-logo pollar-txr-logo-initial${size}`, "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
7584
+ }
7585
+ function ChainLogo({ chain }) {
7586
+ return /* @__PURE__ */ jsx("img", { className: "pollar-txr-chain-inline", src: CHAIN_LOGOS[chain], alt: "", "aria-hidden": true });
7587
+ }
7588
+ function TxExplorerLink({
7589
+ chain,
7590
+ url,
7591
+ language: languageProp
7592
+ }) {
7593
+ const copy = TX_REVIEW_COPY[useInheritedLanguage(languageProp)];
7594
+ return /* @__PURE__ */ jsxs("a", { className: "pollar-txr-link pollar-txr-explorer", href: url, target: "_blank", rel: "noopener noreferrer", children: [
7595
+ /* @__PURE__ */ jsx(ChainLogo, { chain }),
7596
+ copy.viewOnExplorer
7597
+ ] });
7415
7598
  }
7416
7599
  function AccountGlyph() {
7417
7600
  return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
@@ -7433,6 +7616,30 @@ function ContractGlyph() {
7433
7616
  /* @__PURE__ */ jsx("path", { d: "M7 9V6.75a3 3 0 0 1 6 0V9", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
7434
7617
  ] }) });
7435
7618
  }
7619
+ function SignInGlyph() {
7620
+ return /* @__PURE__ */ jsx("span", { className: "pollar-txr-signin-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { width: "26", height: "26", viewBox: "0 0 24 24", fill: "none", children: [
7621
+ /* @__PURE__ */ jsx(
7622
+ "path",
7623
+ {
7624
+ d: "M12 2.75 4.75 5.5v5.25c0 4.6 3.05 8.55 7.25 10 4.2-1.45 7.25-5.4 7.25-10V5.5L12 2.75Z",
7625
+ stroke: "currentColor",
7626
+ strokeWidth: "1.6",
7627
+ strokeLinejoin: "round"
7628
+ }
7629
+ ),
7630
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "2.25", stroke: "currentColor", strokeWidth: "1.6" }),
7631
+ /* @__PURE__ */ jsx("path", { d: "M12 12.25v3.5M12 14.25h1.75", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
7632
+ ] }) });
7633
+ }
7634
+ function Assurance({ text }) {
7635
+ return /* @__PURE__ */ jsxs("li", { className: "pollar-txr-assurance", children: [
7636
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
7637
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
7638
+ /* @__PURE__ */ jsx("path", { d: "M3.5 7l2.5 2.5 4.5-5", stroke: "white", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" })
7639
+ ] }),
7640
+ text
7641
+ ] });
7642
+ }
7436
7643
  function Node2({
7437
7644
  party,
7438
7645
  showAmount,
@@ -7496,7 +7703,7 @@ function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
7496
7703
  const toggle = onToggle ?? (() => setOpenState((v) => !v));
7497
7704
  const { from, to, kind } = data;
7498
7705
  const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
7499
- const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" ? "asset" : "account";
7706
+ const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" || kind === "deposit" || kind === "withdraw" ? "asset" : "account";
7500
7707
  return /* @__PURE__ */ jsxs("div", { className: "pollar-txr", children: [
7501
7708
  from && to && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-flow", children: [
7502
7709
  /* @__PURE__ */ jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
@@ -7504,6 +7711,14 @@ function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
7504
7711
  /* @__PURE__ */ jsx(Node2, { party: to, showAmount: kind !== "approve" && toShowsAmount, glyph: toGlyph, copy })
7505
7712
  ] }),
7506
7713
  kind === "approve" && /* @__PURE__ */ jsx("p", { className: "pollar-txr-note", children: copy.approveNote }),
7714
+ kind === "sign_in" && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-signin", children: [
7715
+ /* @__PURE__ */ jsx(SignInGlyph, {}),
7716
+ /* @__PURE__ */ jsx("p", { className: "pollar-txr-signin-body", children: copy.signIn.body }),
7717
+ /* @__PURE__ */ jsxs("ul", { className: "pollar-txr-assurances", children: [
7718
+ /* @__PURE__ */ jsx(Assurance, { text: copy.signIn.noMoney }),
7719
+ /* @__PURE__ */ jsx(Assurance, { text: copy.signIn.nothingSent })
7720
+ ] })
7721
+ ] }),
7507
7722
  /* @__PURE__ */ jsxs("div", { className: "pollar-txr-bar", children: [
7508
7723
  data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsx(FeeBadge, { sponsored: data.fee.sponsored, copy }) : /* @__PURE__ */ jsx("span", {}),
7509
7724
  /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
@@ -7657,7 +7872,10 @@ function TxStatusView({
7657
7872
  onToggleXdr,
7658
7873
  onRetry,
7659
7874
  onDone,
7660
- language: languageProp
7875
+ language: languageProp,
7876
+ review: reviewProp,
7877
+ successMessage,
7878
+ successExtra
7661
7879
  }) {
7662
7880
  const language = useInheritedLanguage(languageProp);
7663
7881
  const copy = TRANSACTION_COPY[language];
@@ -7672,19 +7890,23 @@ function TxStatusView({
7672
7890
  const reviewCopy = TX_REVIEW_COPY[language];
7673
7891
  const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
7674
7892
  const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
7675
- 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;
7893
+ const review = reviewProp ? {
7894
+ ...reviewProp,
7895
+ ...hashInfo && { hash: hashInfo },
7896
+ ...sponsored !== void 0 && { fee: { sponsored } }
7897
+ } : buildData ? reviewFromBuild(buildData, reviewCopy, copy.title, hashInfo, sponsored) : hashInfo ? { title: copy.title, kind: "other", rows: [], hash: hashInfo, ...sponsored !== void 0 && { fee: { sponsored } } } : null;
7676
7898
  const walletImg = walletType === WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === WalletType.ALBEDO ? LOGO_ALBEDO : null;
7677
7899
  const walletAlt = walletType === WalletType.FREIGHTER ? "Freighter" : walletType === WalletType.ALBEDO ? "Albedo" : "Pollar";
7678
7900
  const statusBanner = /* @__PURE__ */ jsx(
7679
7901
  ModalStatusBanner,
7680
7902
  {
7681
- message: copy.status[transaction.step],
7903
+ message: isSuccess && successMessage ? successMessage : copy.status[transaction.step],
7682
7904
  status: isError ? "ERROR" : isInFlight ? "LOADING" : isSuccess ? "SUCCESS" : "NONE"
7683
7905
  }
7684
7906
  );
7685
7907
  const showSpinner = isInFlight || isSuccess || isError;
7686
7908
  const reviewBlock = showDetails && review && /* @__PURE__ */ jsxs("div", { className: "pollar-tx-review", children: [
7687
- buildData && /* @__PURE__ */ jsx("p", { className: "pollar-tx-review-title", children: review.title }),
7909
+ (buildData || reviewProp) && /* @__PURE__ */ jsx("p", { className: "pollar-tx-review-title", children: review.title }),
7688
7910
  /* @__PURE__ */ jsx(TxReview, { data: review, open: showXdr, onToggle: onToggleXdr, language })
7689
7911
  ] });
7690
7912
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -7734,6 +7956,7 @@ function TxStatusView({
7734
7956
  isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain })
7735
7957
  ] }),
7736
7958
  isSuccess && reviewBlock,
7959
+ isSuccess && successExtra,
7737
7960
  isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done }),
7738
7961
  !showSpinner && statusBanner
7739
7962
  ] });
@@ -10293,7 +10516,11 @@ var EARN_COPY = {
10293
10516
  apyAfterFees: "APY after fees",
10294
10517
  profit: "Earned after fees",
10295
10518
  stale: "Last known figures; they refresh on their own.",
10296
- actionUnavailable: (action) => `This opportunity does not take ${action === "deposit" ? "deposits" : "withdrawals"} right now.`
10519
+ actionUnavailable: (action) => `This opportunity does not take ${action === "deposit" ? "deposits" : "withdrawals"} right now.`,
10520
+ deposited: "Deposited",
10521
+ depositDone: "Deposit complete",
10522
+ withdrawDone: "Withdrawal complete",
10523
+ positionNow: "Your position now"
10297
10524
  },
10298
10525
  es: {
10299
10526
  title: "Rendimientos",
@@ -10334,7 +10561,11 @@ var EARN_COPY = {
10334
10561
  apyAfterFees: "APY despu\xE9s de comisiones",
10335
10562
  profit: "Ganado despu\xE9s de comisiones",
10336
10563
  stale: "\xDAltimas cifras conocidas; se actualizan solas.",
10337
- actionUnavailable: (action) => `Esta oportunidad no acepta ${action === "deposit" ? "dep\xF3sitos" : "retiros"} en este momento.`
10564
+ actionUnavailable: (action) => `Esta oportunidad no acepta ${action === "deposit" ? "dep\xF3sitos" : "retiros"} en este momento.`,
10565
+ deposited: "Depositado",
10566
+ depositDone: "Dep\xF3sito completado",
10567
+ withdrawDone: "Retiro completado",
10568
+ positionNow: "Tu posici\xF3n ahora"
10338
10569
  },
10339
10570
  pt: {
10340
10571
  title: "Rendimentos",
@@ -10375,7 +10606,11 @@ var EARN_COPY = {
10375
10606
  apyAfterFees: "APY ap\xF3s taxas",
10376
10607
  profit: "Ganho ap\xF3s taxas",
10377
10608
  stale: "\xDAltimos valores conhecidos; eles se atualizam sozinhos.",
10378
- actionUnavailable: (action) => `Esta oportunidade n\xE3o aceita ${action === "deposit" ? "dep\xF3sitos" : "saques"} no momento.`
10609
+ actionUnavailable: (action) => `Esta oportunidade n\xE3o aceita ${action === "deposit" ? "dep\xF3sitos" : "saques"} no momento.`,
10610
+ deposited: "Depositado",
10611
+ depositDone: "Dep\xF3sito conclu\xEDdo",
10612
+ withdrawDone: "Saque conclu\xEDdo",
10613
+ positionNow: "Sua posi\xE7\xE3o agora"
10379
10614
  }
10380
10615
  };
10381
10616
  var POSITION_POLL_MS = 1e4;
@@ -10395,6 +10630,38 @@ function formatAmount3(value) {
10395
10630
  const n = parseFloat(value);
10396
10631
  return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
10397
10632
  }
10633
+ function PositionCard({
10634
+ copy,
10635
+ assetCode,
10636
+ name,
10637
+ apy,
10638
+ apyLabel,
10639
+ rows,
10640
+ stale
10641
+ }) {
10642
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote pollar-earn-card", children: [
10643
+ /* @__PURE__ */ jsxs("div", { className: "pollar-earn-card-head", children: [
10644
+ assetCode && /* @__PURE__ */ jsx(AssetLogo, { asset: assetCode, small: true }),
10645
+ /* @__PURE__ */ jsx("strong", { className: "pollar-earn-card-name", children: name }),
10646
+ typeof apy === "number" && /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
10647
+ apy.toFixed(2),
10648
+ "% APY"
10649
+ ] })
10650
+ ] }),
10651
+ rows.map((row) => /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10652
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: row.label }),
10653
+ /* @__PURE__ */ jsx("span", { children: row.value == null ? "..." : `${formatAmount3(row.value)} ${assetCode}`.trim() })
10654
+ ] }, row.label)),
10655
+ typeof apy === "number" && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10656
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: apyLabel }),
10657
+ /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
10658
+ apy.toFixed(2),
10659
+ "%"
10660
+ ] })
10661
+ ] }),
10662
+ stale && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: copy.stale })
10663
+ ] });
10664
+ }
10398
10665
  function EarnModal({ onClose, initial }) {
10399
10666
  const {
10400
10667
  getEarnProviders,
@@ -10409,6 +10676,7 @@ function EarnModal({ onClose, initial }) {
10409
10676
  earnSolanaWithdraw,
10410
10677
  tx: transaction,
10411
10678
  wallet,
10679
+ wallets,
10412
10680
  refreshWalletBalance,
10413
10681
  enabledAssets,
10414
10682
  refreshAssets,
@@ -10416,7 +10684,9 @@ function EarnModal({ onClose, initial }) {
10416
10684
  network,
10417
10685
  styles
10418
10686
  } = usePollar();
10419
- const copy = EARN_COPY[useModalLanguage()];
10687
+ const language = useModalLanguage();
10688
+ const copy = EARN_COPY[language];
10689
+ const reviewCopy = TX_REVIEW_COPY[language];
10420
10690
  const walletType = wallet?.custody === "external" ? wallet.provider : null;
10421
10691
  const [earnChain, setEarnChain] = useState(
10422
10692
  () => oneOf(["STELLAR", "SOLANA"], initial?.chain) ?? "STELLAR"
@@ -10441,6 +10711,7 @@ function EarnModal({ onClose, initial }) {
10441
10711
  const [formError, setFormError] = useState("");
10442
10712
  const [refreshing, setRefreshing] = useState(false);
10443
10713
  const [showXdr, setShowXdr] = useState(false);
10714
+ const [submission, setSubmission] = useState(null);
10444
10715
  const [copied, setCopied] = useState(false);
10445
10716
  const copyTimerRef = useRef(null);
10446
10717
  const loadProviders = useCallback(() => {
@@ -10552,7 +10823,7 @@ function EarnModal({ onClose, initial }) {
10552
10823
  const explorerUrl = !hash ? null : onSolana ? `https://solscan.io/tx/${hash}${network === "testnet" ? "?cluster=devnet" : ""}` : `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}`;
10553
10824
  const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
10554
10825
  const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
10555
- const txTitle = isInProgress ? tab === "deposit" ? copy.depositing : copy.withdrawing : transaction.step === "success" ? copy.done : transaction.step === "error" ? tab === "deposit" ? copy.depositFailed : copy.withdrawFailed : copy.confirm;
10826
+ 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;
10556
10827
  const parsedAmount = parseFloat(amount);
10557
10828
  const exceedsAvailable = tab === "deposit" ? walletAvailable != null && parsedAmount > parseFloat(walletAvailable) : withdrawable != null && parsedAmount > parseFloat(withdrawable);
10558
10829
  const canSubmit = !smartUnsupported && (onSolana || !!provider) && !actionUnavailable && !!opportunityId && !!amount && parsedAmount > 0 && !exceedsAvailable && !providersLoading && !loadingOpps;
@@ -10584,6 +10855,16 @@ function EarnModal({ onClose, initial }) {
10584
10855
  setFormError(copy.exceedsPosition);
10585
10856
  return;
10586
10857
  }
10858
+ const chosen = onSolana ? selectedSolana : selectedOpportunity;
10859
+ setSubmission({
10860
+ action: tab,
10861
+ chain: earnChain,
10862
+ amount,
10863
+ // A DeFindex withdrawal is counted in shares, not in the asset.
10864
+ asset: tab === "withdraw" && withdrawUnit === "shares" ? copy.shares : assetCode,
10865
+ name: chosen?.name,
10866
+ apy: onSolana ? solanaPosition?.apy ?? selectedSolana?.apy ?? void 0 : selectedOpportunity?.apy
10867
+ });
10587
10868
  setStep("tx");
10588
10869
  if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
10589
10870
  const tl = await setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer });
@@ -10597,6 +10878,8 @@ function EarnModal({ onClose, initial }) {
10597
10878
  const outcome = await runEarn();
10598
10879
  if (outcome && (outcome.status === "success" || outcome.status === "pending")) {
10599
10880
  setAmount("");
10881
+ setPosition(null);
10882
+ setSolanaPosition(null);
10600
10883
  refreshPosition();
10601
10884
  }
10602
10885
  }
@@ -10651,6 +10934,44 @@ function EarnModal({ onClose, initial }) {
10651
10934
  }
10652
10935
  }
10653
10936
  const title = step === "form" ? copy.title : txTitle;
10937
+ const submissionReview = submission ? reviewForEarn(
10938
+ {
10939
+ action: submission.action,
10940
+ chain: submission.chain,
10941
+ network,
10942
+ amount: submission.amount,
10943
+ asset: submission.asset,
10944
+ name: submission.name,
10945
+ apy: submission.apy,
10946
+ wallet: wallets.find((w) => (w.chain ?? "STELLAR") === submission.chain)?.address
10947
+ },
10948
+ reviewCopy
10949
+ ) : null;
10950
+ const resultPosition = submission?.chain === "SOLANA" && selectedSolana && solanaPosition ? /* @__PURE__ */ jsx(
10951
+ PositionCard,
10952
+ {
10953
+ copy,
10954
+ assetCode,
10955
+ name: copy.positionNow,
10956
+ apy: solanaPosition.apy ?? selectedSolana.apy,
10957
+ apyLabel: copy.apyAfterFees,
10958
+ rows: [
10959
+ { label: copy.deposited, value: solanaPosition.principal },
10960
+ ...solanaPosition.profit != null ? [{ label: copy.profit, value: solanaPosition.profit }] : [],
10961
+ { label: copy.yourPosition, value: solanaPosition.balance }
10962
+ ]
10963
+ }
10964
+ ) : submission?.chain === "STELLAR" && selectedOpportunity && position ? /* @__PURE__ */ jsx(
10965
+ PositionCard,
10966
+ {
10967
+ copy,
10968
+ assetCode,
10969
+ name: copy.positionNow,
10970
+ apy: selectedOpportunity.apy,
10971
+ apyLabel: "APY",
10972
+ rows: [{ label: copy.yourPosition, value: position.balance }]
10973
+ }
10974
+ ) : null;
10654
10975
  return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxs(
10655
10976
  "div",
10656
10977
  {
@@ -10731,21 +11052,30 @@ function EarnModal({ onClose, initial }) {
10731
11052
  )
10732
11053
  ] }),
10733
11054
  networks.length > 1 && /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
10734
- /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: copy.network }),
10735
- /* @__PURE__ */ jsx(
10736
- "select",
11055
+ /* @__PURE__ */ jsx("span", { className: "pollar-send-label", children: copy.network }),
11056
+ /* @__PURE__ */ jsx("div", { className: "pollar-tabs pollar-earn-networks", role: "radiogroup", "aria-label": copy.network, children: networks.map((n) => /* @__PURE__ */ jsxs(
11057
+ "button",
10737
11058
  {
10738
- className: "pollar-input pollar-send-select",
10739
- value: earnChain,
10740
- onChange: (e) => {
10741
- setEarnChain(e.target.value);
11059
+ type: "button",
11060
+ role: "radio",
11061
+ "aria-checked": earnChain === n,
11062
+ className: "pollar-tab pollar-earn-network",
11063
+ "data-active": earnChain === n,
11064
+ "data-chain": n,
11065
+ onClick: () => {
11066
+ if (n === earnChain) return;
11067
+ setEarnChain(n);
10742
11068
  setOpportunityId("");
10743
11069
  setAmount("");
10744
11070
  setFormError("");
10745
11071
  },
10746
- children: networks.map((n) => /* @__PURE__ */ jsx("option", { value: n, children: n === "SOLANA" ? "Solana" : "Stellar" }, n))
10747
- }
10748
- )
11072
+ children: [
11073
+ /* @__PURE__ */ jsx(ChainLogo, { chain: n }),
11074
+ reviewCopy.chains[n]
11075
+ ]
11076
+ },
11077
+ n
11078
+ )) })
10749
11079
  ] }),
10750
11080
  !onSolana && providers && providers.length > 1 && /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
10751
11081
  /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: copy.provider }),
@@ -10780,66 +11110,34 @@ function EarnModal({ onClose, initial }) {
10780
11110
  }
10781
11111
  )
10782
11112
  ] }),
10783
- selectedSolana && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
10784
- tab === "deposit" && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10785
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.inYourWallet }),
10786
- /* @__PURE__ */ jsxs("span", { children: [
10787
- walletAvailable != null ? formatAmount3(walletAvailable) : "...",
10788
- " ",
10789
- assetCode
10790
- ] })
10791
- ] }),
10792
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10793
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.yourPosition }),
10794
- /* @__PURE__ */ jsxs("span", { children: [
10795
- solanaPosition ? formatAmount3(solanaPosition.balance) : "...",
10796
- " ",
10797
- assetCode
10798
- ] })
10799
- ] }),
10800
- solanaPosition?.profit != null && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10801
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.profit }),
10802
- /* @__PURE__ */ jsxs("span", { children: [
10803
- formatAmount3(solanaPosition.profit),
10804
- " ",
10805
- assetCode
10806
- ] })
10807
- ] }),
10808
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10809
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.apyAfterFees }),
10810
- /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
10811
- (solanaPosition?.apy ?? selectedSolana.apy).toFixed(2),
10812
- "%"
10813
- ] })
10814
- ] }),
10815
- solanaPosition?.stale && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: copy.stale })
10816
- ] }),
11113
+ selectedSolana && /* @__PURE__ */ jsx(
11114
+ PositionCard,
11115
+ {
11116
+ copy,
11117
+ assetCode,
11118
+ name: selectedSolana.name,
11119
+ apy: solanaPosition?.apy ?? selectedSolana.apy,
11120
+ apyLabel: copy.apyAfterFees,
11121
+ rows: [
11122
+ { label: copy.deposited, value: solanaPosition?.principal },
11123
+ ...solanaPosition?.profit != null ? [{ label: copy.profit, value: solanaPosition.profit }] : [],
11124
+ { label: copy.yourPosition, value: solanaPosition?.balance }
11125
+ ],
11126
+ stale: solanaPosition?.stale
11127
+ }
11128
+ ),
10817
11129
  actionUnavailable && /* @__PURE__ */ jsx("div", { className: "pollar-send-hint", children: copy.actionUnavailable(tab) }),
10818
- selectedOpportunity && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote", children: [
10819
- tab === "deposit" && /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10820
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.inYourWallet }),
10821
- /* @__PURE__ */ jsxs("span", { children: [
10822
- walletAvailable != null ? formatAmount3(walletAvailable) : "\u2026",
10823
- " ",
10824
- assetCode
10825
- ] })
10826
- ] }),
10827
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10828
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: copy.yourPosition }),
10829
- /* @__PURE__ */ jsxs("span", { children: [
10830
- position ? formatAmount3(position.balance) : "\u2026",
10831
- " ",
10832
- assetCode
10833
- ] })
10834
- ] }),
10835
- /* @__PURE__ */ jsxs("div", { className: "pollar-swap-quote-row", children: [
10836
- /* @__PURE__ */ jsx("span", { className: "pollar-send-hint", children: "APY" }),
10837
- /* @__PURE__ */ jsxs("span", { className: "pollar-earn-live", children: [
10838
- selectedOpportunity.apy.toFixed(2),
10839
- "%"
10840
- ] })
10841
- ] })
10842
- ] }),
11130
+ selectedOpportunity && /* @__PURE__ */ jsx(
11131
+ PositionCard,
11132
+ {
11133
+ copy,
11134
+ assetCode,
11135
+ name: selectedOpportunity.name,
11136
+ apy: selectedOpportunity.apy,
11137
+ apyLabel: "APY",
11138
+ rows: [{ label: copy.yourPosition, value: position?.balance }]
11139
+ }
11140
+ ),
10843
11141
  /* @__PURE__ */ jsx(
10844
11142
  AmountField,
10845
11143
  {
@@ -10848,6 +11146,7 @@ function EarnModal({ onClose, initial }) {
10848
11146
  value: amount,
10849
11147
  onChange: setAmount,
10850
11148
  unit: amountUnitLabel,
11149
+ unitIcon: amountUnitLabel === assetCode && assetCode ? /* @__PURE__ */ jsx(AssetLogo, { asset: assetCode, small: true }) : void 0,
10851
11150
  available: tab === "deposit" ? walletAvailable : withdrawable ?? void 0
10852
11151
  }
10853
11152
  ),
@@ -10868,7 +11167,14 @@ function EarnModal({ onClose, initial }) {
10868
11167
  onToggleXdr: () => setShowXdr((v) => !v),
10869
11168
  onCopyHash: handleCopyHash,
10870
11169
  onRetry: () => void handleRetry(),
10871
- onDone: onClose
11170
+ onDone: onClose,
11171
+ language,
11172
+ review: submissionReview,
11173
+ successMessage: submission ? earnOutcome(submission, reviewCopy) : void 0,
11174
+ successExtra: submission && /* @__PURE__ */ jsxs(Fragment, { children: [
11175
+ resultPosition,
11176
+ explorerUrl && /* @__PURE__ */ jsx(TxExplorerLink, { chain: submission.chain, url: explorerUrl, language })
11177
+ ] })
10872
11178
  }
10873
11179
  ),
10874
11180
  /* @__PURE__ */ jsx(PollarModalFooter, {})
@@ -10938,7 +11244,7 @@ var CARD_COPY = {
10938
11244
  },
10939
11245
  errors: {
10940
11246
  SDK_CARDS_PROVIDER_ERROR: "The card provider is not responding right now. Please try again in a few minutes.",
10941
- SDK_CARDS_IP_NOT_SUPPORTED: "The card provider cannot accept your current connection (IPv6). Please try again from another network, for example Wi-Fi.",
11247
+ SDK_CARDS_IP_NOT_SUPPORTED: "We could not verify your connection with the card provider. Please try again in a few minutes.",
10942
11248
  SDK_CARDS_PROVIDER_USER_TAKEN: "This email is already registered with the card provider through another app. Use a different email to get a card here."
10943
11249
  },
10944
11250
  blocked: {
@@ -11045,7 +11351,9 @@ var CARD_COPY = {
11045
11351
  delayed: "Taking longer than usual. We are following up with the card provider.",
11046
11352
  crossing: "Your USDC crosses to the card network. It takes a few minutes, and the network fees are covered.",
11047
11353
  noRoute: "Your wallets cannot fund this card right now."
11048
- }
11354
+ },
11355
+ networkError: "We could not reach the card service. Check your connection and try again.",
11356
+ retry: "Try again"
11049
11357
  },
11050
11358
  es: {
11051
11359
  funding: {
@@ -11106,7 +11414,7 @@ var CARD_COPY = {
11106
11414
  },
11107
11415
  errors: {
11108
11416
  SDK_CARDS_PROVIDER_ERROR: "El proveedor de la tarjeta no responde en este momento. Intenta de nuevo en unos minutos.",
11109
- SDK_CARDS_IP_NOT_SUPPORTED: "El proveedor de la tarjeta no acepta tu conexi\xF3n actual (IPv6). Intenta de nuevo desde otra red, por ejemplo Wi-Fi.",
11417
+ SDK_CARDS_IP_NOT_SUPPORTED: "No pudimos verificar tu conexi\xF3n con el proveedor de la tarjeta. Intenta de nuevo en unos minutos.",
11110
11418
  SDK_CARDS_PROVIDER_USER_TAKEN: "Este correo ya est\xE1 registrado con el proveedor de la tarjeta a trav\xE9s de otra app. Usa otro correo para obtener una tarjeta aqu\xED."
11111
11419
  },
11112
11420
  blocked: {
@@ -11213,7 +11521,9 @@ var CARD_COPY = {
11213
11521
  delayed: "Est\xE1 tardando m\xE1s de lo normal. Estamos haciendo seguimiento con el emisor de la tarjeta.",
11214
11522
  crossing: "Tus USDC cruzan a la red de la tarjeta. Toma unos minutos y las comisiones de red est\xE1n cubiertas.",
11215
11523
  noRoute: "Tus wallets no pueden fondear esta tarjeta por ahora."
11216
- }
11524
+ },
11525
+ networkError: "No pudimos conectar con el servicio de la tarjeta. Revisa tu conexi\xF3n e intenta de nuevo.",
11526
+ retry: "Intentar de nuevo"
11217
11527
  },
11218
11528
  pt: {
11219
11529
  funding: {
@@ -11274,7 +11584,7 @@ var CARD_COPY = {
11274
11584
  },
11275
11585
  errors: {
11276
11586
  SDK_CARDS_PROVIDER_ERROR: "O provedor do cart\xE3o n\xE3o est\xE1 respondendo agora. Tente de novo em alguns minutos.",
11277
- SDK_CARDS_IP_NOT_SUPPORTED: "O provedor do cart\xE3o n\xE3o aceita sua conex\xE3o atual (IPv6). Tente de novo a partir de outra rede, por exemplo Wi-Fi.",
11587
+ SDK_CARDS_IP_NOT_SUPPORTED: "N\xE3o conseguimos verificar sua conex\xE3o com o provedor do cart\xE3o. Tente de novo em alguns minutos.",
11278
11588
  SDK_CARDS_PROVIDER_USER_TAKEN: "Este e-mail j\xE1 est\xE1 cadastrado no provedor do cart\xE3o por meio de outro app. Use outro e-mail para obter um cart\xE3o aqui."
11279
11589
  },
11280
11590
  blocked: {
@@ -11381,7 +11691,9 @@ var CARD_COPY = {
11381
11691
  delayed: "Est\xE1 demorando mais que o normal. Estamos acompanhando com o emissor do cart\xE3o.",
11382
11692
  crossing: "Seus USDC atravessam para a rede do cart\xE3o. Leva alguns minutos, e as taxas de rede est\xE3o cobertas.",
11383
11693
  noRoute: "Suas carteiras n\xE3o podem recarregar este cart\xE3o por enquanto."
11384
- }
11694
+ },
11695
+ networkError: "N\xE3o conseguimos conectar ao servi\xE7o do cart\xE3o. Verifique sua conex\xE3o e tente novamente.",
11696
+ retry: "Tentar novamente"
11385
11697
  }
11386
11698
  };
11387
11699
  var CREDIT_DELAYED = "provider_credit_delayed";
@@ -11392,7 +11704,7 @@ function fundingProblemText(error, copy) {
11392
11704
  return /token balance/i.test(raw) ? copy.fundingProblem.noBalance : copy.fundingProblem.noGas;
11393
11705
  }
11394
11706
  if (/insufficient_usdc/.test(raw)) return copy.fundingProblem.noBalance;
11395
- if (/^(payment_not_received|cosign_rejected|cosign_expired)/.test(raw)) return copy.fundingProblem.notPaid;
11707
+ if (/^(payment_not_received|cosign_rejected|cosign_expired)/i.test(raw)) return copy.fundingProblem.notPaid;
11396
11708
  return copy.fundingProblem.failed;
11397
11709
  }
11398
11710
 
@@ -11497,6 +11809,7 @@ function errorText2(e, fallback, copy) {
11497
11809
  if (typeof message === "string" && message) return message;
11498
11810
  return e.code;
11499
11811
  }
11812
+ if (isPollarNetworkError(e)) return copy.networkError;
11500
11813
  return e instanceof Error && e.message ? e.message : fallback;
11501
11814
  }
11502
11815
  function CardModal({ onClose, initial }) {
@@ -11516,6 +11829,8 @@ function CardModal({ onClose, initial }) {
11516
11829
  const [deposit, setDeposit] = useState(null);
11517
11830
  const [fundings, setFundings] = useState(null);
11518
11831
  const [fundAmount, setFundAmount] = useState(() => seededAmount(initial?.amount));
11832
+ const [loadAttempt, setLoadAttempt] = useState(0);
11833
+ const [loadFailed, setLoadFailed] = useState(false);
11519
11834
  const fundKey = useRef(null);
11520
11835
  const [fundChain, setFundChain] = useState(initial?.chain ?? null);
11521
11836
  const [fundRoutes, setFundRoutes] = useState(null);
@@ -11584,13 +11899,19 @@ function CardModal({ onClose, initial }) {
11584
11899
  if (!cancelled) {
11585
11900
  setProviders((cur) => cur ?? []);
11586
11901
  setError(errorText2(e, copy.failed.load, copy));
11902
+ setLoadFailed(true);
11587
11903
  }
11588
11904
  }
11589
11905
  })();
11590
11906
  return () => {
11591
11907
  cancelled = true;
11592
11908
  };
11593
- }, [getClient, loadHolder, loadRequirements, loadCardData]);
11909
+ }, [getClient, loadHolder, loadRequirements, loadCardData, loadAttempt]);
11910
+ const retryLoad = () => {
11911
+ setLoadFailed(false);
11912
+ setError("");
11913
+ setLoadAttempt((n) => n + 1);
11914
+ };
11594
11915
  const stage = cardStage(holder, requirements);
11595
11916
  useEffect(() => {
11596
11917
  if (stage !== "provider-form") return;
@@ -12190,6 +12511,7 @@ function CardModal({ onClose, initial }) {
12190
12511
  showManual && /* @__PURE__ */ jsx("p", { className: "pollar-card-note", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-card-link", onClick: () => setShowManual(false), children: copy.hideDeposit }) })
12191
12512
  ] }),
12192
12513
  error && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: error }),
12514
+ loadFailed && /* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: retryLoad, children: copy.retry }) }),
12193
12515
  /* @__PURE__ */ jsx(PollarModalFooter, { language })
12194
12516
  ]
12195
12517
  }
@@ -12588,8 +12910,8 @@ var COSIGN_COPY = {
12588
12910
  expired: "expired",
12589
12911
  expiresIn: "Expires in",
12590
12912
  checking: "Checking...",
12591
- verified: "Verified",
12592
- checkedAgainstTurnkey: "Checked against Turnkey: this is exactly what will be signed.",
12913
+ verified: "Checked",
12914
+ checkedExact: "We checked this is exactly what you're approving.",
12593
12915
  notVerified: "Not verified:",
12594
12916
  reject: "Reject",
12595
12917
  rejecting: "Rejecting...",
@@ -12613,7 +12935,9 @@ var COSIGN_COPY = {
12613
12935
  swap: "Swap",
12614
12936
  earn_deposit: "Deposit",
12615
12937
  earn_withdraw: "Withdraw",
12616
- evm_delegation: "Enable atomic transactions"
12938
+ evm_delegation: "Enable atomic transactions",
12939
+ provider_sign_in: "Confirm it's you",
12940
+ sep10: "Confirm it's you"
12617
12941
  }
12618
12942
  },
12619
12943
  es: {
@@ -12633,8 +12957,8 @@ var COSIGN_COPY = {
12633
12957
  expired: "vencida",
12634
12958
  expiresIn: "Vence en",
12635
12959
  checking: "Verificando...",
12636
- verified: "Verificada",
12637
- checkedAgainstTurnkey: "Verificada con Turnkey: esto es exactamente lo que se firmar\xE1.",
12960
+ verified: "Comprobada",
12961
+ checkedExact: "Comprobamos que esto es exactamente lo que est\xE1s aprobando.",
12638
12962
  notVerified: "Sin verificar:",
12639
12963
  reject: "Rechazar",
12640
12964
  rejecting: "Rechazando...",
@@ -12658,7 +12982,9 @@ var COSIGN_COPY = {
12658
12982
  swap: "Intercambiar",
12659
12983
  earn_deposit: "Depositar",
12660
12984
  earn_withdraw: "Retirar",
12661
- evm_delegation: "Activar transacciones at\xF3micas"
12985
+ evm_delegation: "Activar transacciones at\xF3micas",
12986
+ provider_sign_in: "Confirma que eres t\xFA",
12987
+ sep10: "Confirma que eres t\xFA"
12662
12988
  }
12663
12989
  },
12664
12990
  pt: {
@@ -12678,8 +13004,8 @@ var COSIGN_COPY = {
12678
13004
  expired: "expirada",
12679
13005
  expiresIn: "Expira em",
12680
13006
  checking: "Verificando...",
12681
- verified: "Verificada",
12682
- checkedAgainstTurnkey: "Conferida com a Turnkey: isto \xE9 exatamente o que ser\xE1 assinado.",
13007
+ verified: "Conferida",
13008
+ checkedExact: "Conferimos que isto \xE9 exatamente o que voc\xEA est\xE1 aprovando.",
12683
13009
  notVerified: "N\xE3o verificada:",
12684
13010
  reject: "Rejeitar",
12685
13011
  rejecting: "Rejeitando...",
@@ -12703,7 +13029,9 @@ var COSIGN_COPY = {
12703
13029
  swap: "Trocar",
12704
13030
  earn_deposit: "Depositar",
12705
13031
  earn_withdraw: "Sacar",
12706
- evm_delegation: "Ativar transa\xE7\xF5es at\xF4micas"
13032
+ evm_delegation: "Ativar transa\xE7\xF5es at\xF4micas",
13033
+ provider_sign_in: "Confirme que \xE9 voc\xEA",
13034
+ sep10: "Confirme que \xE9 voc\xEA"
12707
13035
  }
12708
13036
  }
12709
13037
  };
@@ -12857,7 +13185,7 @@ function CosignModalTemplate({
12857
13185
  )
12858
13186
  ] }),
12859
13187
  /* @__PURE__ */ jsx(TxReview, { data: review, language }, current.id),
12860
- verified && verifiedOpen && /* @__PURE__ */ jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedAgainstTurnkey }),
13188
+ verified && verifiedOpen && /* @__PURE__ */ jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedExact }),
12861
13189
  deviceNotLinked ? /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
12862
13190
  copy.deviceNotLinked,
12863
13191
  onLinkDevice && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-link", onClick: onLinkDevice, children: copy.linkDevice })
@@ -13802,7 +14130,9 @@ var CONFIRM_COPY = {
13802
14130
  create_account: "Create account",
13803
14131
  invoke_contract: "Contract call",
13804
14132
  transfer: "Authorize payment",
13805
- manage_data: "Manage data"
14133
+ manage_data: "Manage data",
14134
+ earn_deposit: "Deposit",
14135
+ earn_withdraw: "Withdraw"
13806
14136
  }
13807
14137
  },
13808
14138
  es: {
@@ -13819,7 +14149,9 @@ var CONFIRM_COPY = {
13819
14149
  create_account: "Crear cuenta",
13820
14150
  invoke_contract: "Llamada a contrato",
13821
14151
  transfer: "Autorizar pago",
13822
- manage_data: "Gestionar datos"
14152
+ manage_data: "Gestionar datos",
14153
+ earn_deposit: "Depositar",
14154
+ earn_withdraw: "Retirar"
13823
14155
  }
13824
14156
  },
13825
14157
  pt: {
@@ -13836,7 +14168,9 @@ var CONFIRM_COPY = {
13836
14168
  create_account: "Criar conta",
13837
14169
  invoke_contract: "Chamada de contrato",
13838
14170
  transfer: "Autorizar pagamento",
13839
- manage_data: "Gerenciar dados"
14171
+ manage_data: "Gerenciar dados",
14172
+ earn_deposit: "Depositar",
14173
+ earn_withdraw: "Sacar"
13840
14174
  }
13841
14175
  }
13842
14176
  };
@@ -14730,6 +15064,10 @@ var browserRecoveryPasskey = {
14730
15064
  };
14731
15065
  }
14732
15066
  };
15067
+ function remembered(list) {
15068
+ rememberEarnOpportunities(list);
15069
+ return list;
15070
+ }
14733
15071
  var DEFAULT_APP_CONFIG = {
14734
15072
  application: { name: "", network: "testnet", chains: [] },
14735
15073
  styles: {}
@@ -15085,12 +15423,12 @@ function PollarProvider({
15085
15423
  },
15086
15424
  // earn
15087
15425
  getEarnProviders: () => pollarClient.getEarnProviders(),
15088
- getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
15426
+ getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
15089
15427
  getEarnPosition: (params) => pollarClient.getEarnPosition(params),
15090
15428
  earnDeposit: (params) => pollarClient.earnDeposit(params),
15091
15429
  earnWithdraw: (params) => pollarClient.earnWithdraw(params),
15092
15430
  getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
15093
- getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities(),
15431
+ getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
15094
15432
  getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
15095
15433
  earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
15096
15434
  earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),