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