@pollar/react 0.12.1-rc.23 → 0.12.1-rc.25

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, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampNextApproval, rampOrderStopped, rampOrderReceive, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampFailureReason, rampLegNote, rampStepStatusText, rampLegTimeLeft, rampOrderResolutionText, rampFailureNeedsSupport, rampSupportCopy, rampCountries, rampQuoteFields, isPollarApiError, rampSupportContact, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, isKycSettled, rampTrustlineErrorText, isPollarNetworkError, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
2
+ import { AUTH_ERROR_CODES, authErrorMessage, rampLegTitle, rampRequirementCopy, rampTrustlineAsset, rampWalletStep, rampResolutionText, rampRailLabel, describeRampAction, rampStepTitle, rampLegStatus, rampOrderStopped, rampOrderReceive, rampLegNote, countryName, rampNoRouteText, rampFieldError, rampFieldValid, rampFailureReason, rampLegTimeLeft, rampStepStatusText, rampOrderResolutionText, rampFailureNeedsSupport, rampSupportCopy, rampCountries, rampQuoteFields, isPollarApiError, rampNextApproval, rampSupportContact, transactionErrorMessage, WalletType, bridgeSourceChains, bridgeTargetChains, isBridgeSettled, isPollarNetworkError, isPollarClient, PollarClient, isInteractiveAuthAdapter, isAuthEntryAdapterStep, completeAuthEntryStep, isKycSettled, rampTrustlineErrorText, toBaseUnits, resolveLanguage, languageFromTag, localizedText, appUnavailableMessage, fromBaseUnits, cosignRefusalMessage, assertRampStellarSigner } from '@pollar/core';
3
3
  import { createContext, forwardRef, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore, useId, useLayoutEffect, Component } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { createPortal } from 'react-dom';
@@ -1309,7 +1309,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
1309
1309
  /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
1310
1310
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1311
1311
  "v",
1312
- "0.12.1-rc.23"
1312
+ "0.12.1-rc.25"
1313
1313
  ] })
1314
1314
  ] });
1315
1315
  };
@@ -5628,6 +5628,21 @@ var RAMP_COPY = {
5628
5628
  startAnother: "Start another operation",
5629
5629
  newQuote: "Get a new quote",
5630
5630
  keepsGoing: "This one keeps going; you can resume it later.",
5631
+ screens: {
5632
+ pay: (amount, currency) => `Pay ${amount} ${currency}`,
5633
+ send: (amount, code) => `Send ${amount} ${code}`,
5634
+ delivering: (code) => `Your ${code} is on its way`,
5635
+ payingOut: (currency) => `Your ${currency} is on its way to your account`,
5636
+ done: "Done",
5637
+ toCurrent: "Go to the current step",
5638
+ updatesItself: "This screen updates on its own.",
5639
+ preparing: "Preparing your payment\u2026",
5640
+ received: (amount) => `+${amount}`,
5641
+ arrived: (chain) => `It reached your wallet on ${chain}.`,
5642
+ paidOut: "It was sent to your account.",
5643
+ finish: "Done",
5644
+ details: "Details"
5645
+ },
5631
5646
  somethingWrong: "Something went wrong.",
5632
5647
  routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
5633
5648
  feesIncluded: "fees included",
@@ -5759,6 +5774,21 @@ var RAMP_COPY = {
5759
5774
  startAnother: "Iniciar otra operaci\xF3n",
5760
5775
  newQuote: "Pedir nueva cotizaci\xF3n",
5761
5776
  keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
5777
+ screens: {
5778
+ pay: (amount, currency) => `Paga ${amount} ${currency}`,
5779
+ send: (amount, code) => `Env\xEDa ${amount} ${code}`,
5780
+ delivering: (code) => `Tu ${code} est\xE1 en camino`,
5781
+ payingOut: (currency) => `Tus ${currency} van en camino a tu cuenta`,
5782
+ done: "Hecho",
5783
+ toCurrent: "Ir al paso actual",
5784
+ updatesItself: "Esta pantalla se actualiza sola.",
5785
+ preparing: "Preparando tu pago\u2026",
5786
+ received: (amount) => `+${amount}`,
5787
+ arrived: (chain) => `Lleg\xF3 a tu wallet en ${chain}.`,
5788
+ paidOut: "Se envi\xF3 a tu cuenta.",
5789
+ finish: "Listo",
5790
+ details: "Detalles"
5791
+ },
5762
5792
  somethingWrong: "Algo sali\xF3 mal.",
5763
5793
  routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
5764
5794
  feesIncluded: "comisiones incluidas",
@@ -5890,6 +5920,21 @@ var RAMP_COPY = {
5890
5920
  startAnother: "Iniciar outra opera\xE7\xE3o",
5891
5921
  newQuote: "Pedir nova cota\xE7\xE3o",
5892
5922
  keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
5923
+ screens: {
5924
+ pay: (amount, currency) => `Pague ${amount} ${currency}`,
5925
+ send: (amount, code) => `Envie ${amount} ${code}`,
5926
+ delivering: (code) => `Seu ${code} est\xE1 a caminho`,
5927
+ payingOut: (currency) => `Seus ${currency} est\xE3o a caminho da sua conta`,
5928
+ done: "Conclu\xEDdo",
5929
+ toCurrent: "Ir para a etapa atual",
5930
+ updatesItself: "Esta tela se atualiza sozinha.",
5931
+ preparing: "Preparando o seu pagamento\u2026",
5932
+ received: (amount) => `+${amount}`,
5933
+ arrived: (chain) => `Chegou \xE0 sua carteira na ${chain}.`,
5934
+ paidOut: "Foi enviado para a sua conta.",
5935
+ finish: "Pronto",
5936
+ details: "Detalhes"
5937
+ },
5893
5938
  somethingWrong: "Algo deu errado.",
5894
5939
  routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
5895
5940
  feesIncluded: "taxas inclu\xEDdas",
@@ -6038,6 +6083,93 @@ function routeKey(quote) {
6038
6083
  const node = (n) => n.kind === "asset" ? `${n.code}:${n.chain}` : `${n.currency}:${n.rail}`;
6039
6084
  return quote.legs.map((leg) => `${leg.kind}:${node(leg.from)}>${node(leg.to)}`).join("|");
6040
6085
  }
6086
+ var amountText = (value, language) => {
6087
+ const n = Number(value);
6088
+ return Number.isFinite(n) ? n.toLocaleString(language, { maximumFractionDigits: 7 }) : value;
6089
+ };
6090
+ function rampOrderScreens(order, language) {
6091
+ const copy = RAMP_COPY[language].screens;
6092
+ const parts = [];
6093
+ const waitsOn = (leg) => order.pendingAction?.legIndex === leg.index && order.pendingAction.kind !== "NONE";
6094
+ for (const leg of order.legs) {
6095
+ const legStatus = rampLegStatus(leg);
6096
+ const legDone = legStatus === "done";
6097
+ if (leg.steps?.length) {
6098
+ let running = [];
6099
+ const flush = () => {
6100
+ if (!running.length) return;
6101
+ parts.push({
6102
+ key: `${leg.index}:${running[0].kind}`,
6103
+ kind: "wait",
6104
+ leg,
6105
+ steps: running,
6106
+ title: rampLegTitle(leg, language),
6107
+ done: legDone || running.every((s) => s.status === "done")
6108
+ });
6109
+ running = [];
6110
+ };
6111
+ for (const step of leg.steps) {
6112
+ if (!step.signs) {
6113
+ running.push(step);
6114
+ continue;
6115
+ }
6116
+ flush();
6117
+ parts.push({
6118
+ key: `${leg.index}:${step.kind}`,
6119
+ kind: "action",
6120
+ leg,
6121
+ steps: [step],
6122
+ title: rampStepTitle(step, leg, language),
6123
+ done: legDone || step.status === "done"
6124
+ });
6125
+ }
6126
+ flush();
6127
+ continue;
6128
+ }
6129
+ if (leg.kind === "PROVIDER_ONRAMP" || leg.kind === "PROVIDER_OFFRAMP") {
6130
+ const onramp = leg.kind === "PROVIDER_ONRAMP";
6131
+ const unitIn = leg.from.kind === "fiat" ? leg.from.currency : leg.from.code;
6132
+ const unitOut = leg.to.kind === "fiat" ? leg.to.currency : leg.to.code;
6133
+ const payment = leg.paymentStatus;
6134
+ const paid = payment === void 0 ? legStatus === "active" && !waitsOn(leg) : payment === "received";
6135
+ const amount = amountText(leg.amountInPlanned, language);
6136
+ parts.push({
6137
+ key: `${leg.index}:pay`,
6138
+ kind: "action",
6139
+ leg,
6140
+ steps: [],
6141
+ title: onramp ? copy.pay(amount, unitIn) : copy.send(amount, unitIn),
6142
+ done: legDone || paid,
6143
+ preparing: payment === "not_requested" && !waitsOn(leg)
6144
+ });
6145
+ parts.push({
6146
+ key: `${leg.index}:deliver`,
6147
+ kind: "wait",
6148
+ leg,
6149
+ steps: [],
6150
+ title: onramp ? copy.delivering(unitOut) : copy.payingOut(unitOut),
6151
+ done: legDone
6152
+ });
6153
+ continue;
6154
+ }
6155
+ parts.push({
6156
+ key: `${leg.index}`,
6157
+ kind: leg.signingMode ? "action" : "wait",
6158
+ leg,
6159
+ steps: [],
6160
+ title: rampLegTitle(leg, language),
6161
+ done: legDone
6162
+ });
6163
+ }
6164
+ const stopped = ["failed", "refunded"].includes(order.state);
6165
+ let currentFound = false;
6166
+ return parts.map(({ done, ...screen }) => {
6167
+ if (done) return { ...screen, status: "done" };
6168
+ if (currentFound) return { ...screen, status: "upcoming" };
6169
+ currentFound = true;
6170
+ return { ...screen, status: stopped || rampLegStatus(screen.leg) === "failed" ? "failed" : "current" };
6171
+ });
6172
+ }
6041
6173
  function scannableImageSrc(image) {
6042
6174
  return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
6043
6175
  }
@@ -6177,6 +6309,8 @@ function RampWidgetTemplate({
6177
6309
  const onramp = direction === "ONRAMP";
6178
6310
  const sendUnit = onramp ? fiat?.currency : asset?.code;
6179
6311
  const [detailsOpen, setDetailsOpen] = useState(false);
6312
+ const [viewing, setViewing] = useState(null);
6313
+ useEffect(() => setViewing(null), [order?.id]);
6180
6314
  const routeName = (quote) => quote.legs.map((leg) => rampLegTitle(leg, language)).join(" \xB7 ");
6181
6315
  const rate = (() => {
6182
6316
  if (!chosenQuote) return null;
@@ -6248,7 +6382,6 @@ function RampWidgetTemplate({
6248
6382
  ] : [];
6249
6383
  const running = order?.legs.find((leg) => rampLegStatus(leg) === "active" && order.pendingAction?.legIndex !== leg.index);
6250
6384
  const now = useNowEverySecond(step === "status" && !settled && !!running && running.etaSeconds !== null);
6251
- const nextApproval = order && !settled ? rampNextApproval(order, language) : null;
6252
6385
  const stopped = order ? rampOrderStopped(order) : false;
6253
6386
  const receive = order ? rampOrderReceive(order) : null;
6254
6387
  const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
@@ -6256,12 +6389,41 @@ function RampWidgetTemplate({
6256
6389
  const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
6257
6390
  useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
6258
6391
  const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
6392
+ const screens = order ? rampOrderScreens(order, language) : [];
6393
+ const completed = order?.state === "completed";
6394
+ const firstOpen = screens.findIndex((s) => s.status !== "done");
6395
+ const currentScreen = completed ? screens.length : firstOpen === -1 ? Math.max(0, screens.length - 1) : firstOpen;
6396
+ const shownScreen = viewing !== null && viewing < currentScreen ? viewing : currentScreen;
6397
+ const shown = screens[shownScreen];
6398
+ const askedInstead = order?.pendingAction?.kind === "KYC" || !!shown?.key.endsWith(":pay") && order?.pendingAction?.legIndex === shown.leg.index && !["FIAT_PAYMENT", "NONE"].includes(order.pendingAction.kind);
6399
+ const firstLeg = order?.legs[0];
6400
+ const orderSummary = firstLeg && receive ? `${amountText(firstLeg.amountInPlanned, language)} ${firstLeg.from.kind === "fiat" ? firstLeg.from.currency : firstLeg.from.code} \u2192 ${receive.estimated ? "~" : ""}${amountText(receive.amount, language)} ${receive.unit}` : null;
6401
+ const lastLeg = order?.legs[order.legs.length - 1];
6402
+ const arrivedText = lastLeg?.to.kind === "asset" ? copy.screens.arrived(CHAIN_NAME[lastLeg.to.chain] ?? lastLeg.to.chain) : copy.screens.paidOut;
6403
+ const finalNote = order?.legs.map((leg) => rampLegNote(leg, language)).find((note) => note !== null) ?? null;
6404
+ const screenRows = (screen) => screen.steps.length ? screen.steps.flatMap(
6405
+ (st) => st.hash ? [
6406
+ {
6407
+ label: rampStepTitle(st, screen.leg, language),
6408
+ value: shortHash(st.hash),
6409
+ href: explorerTxUrl2(stepChain(st.kind, screen.leg), st.hash, network),
6410
+ copyValue: st.hash
6411
+ }
6412
+ ] : []
6413
+ ) : screen.leg.onchainTxHash && !screen.key.endsWith(":pay") ? [
6414
+ {
6415
+ label: rampLegTitle(screen.leg, language),
6416
+ value: shortHash(screen.leg.onchainTxHash),
6417
+ href: explorerTxUrl2(legChain(screen.leg), screen.leg.onchainTxHash, network),
6418
+ copyValue: screen.leg.onchainTxHash
6419
+ }
6420
+ ] : [];
6259
6421
  const stepTitle = {
6260
6422
  input: onramp ? copy.title.buy : copy.title.sell,
6261
6423
  loading_quote: copy.title.finding,
6262
6424
  select_route: copy.title.chooseRoute,
6263
6425
  contact: copy.title.details,
6264
- status: order?.state === "completed" ? copy.title.completed : onramp ? copy.title.purchase : copy.title.sale,
6426
+ status: onramp ? copy.title.purchase : copy.title.sale,
6265
6427
  error: copy.title.error
6266
6428
  };
6267
6429
  const stepSubtitle = {
@@ -6274,7 +6436,7 @@ function RampWidgetTemplate({
6274
6436
  copy
6275
6437
  )
6276
6438
  ),
6277
- status: view?.title ?? copy.subtitle.processing,
6439
+ status: orderSummary ?? copy.subtitle.processing,
6278
6440
  error: copy.subtitle.error
6279
6441
  };
6280
6442
  return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
@@ -6289,6 +6451,16 @@ function RampWidgetTemplate({
6289
6451
  children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3 5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
6290
6452
  }
6291
6453
  ),
6454
+ step === "status" && shownScreen > 0 && shownScreen <= currentScreen && /* @__PURE__ */ jsx(
6455
+ "button",
6456
+ {
6457
+ type: "button",
6458
+ className: "pollar-back-btn pollar-ramp-back",
6459
+ onClick: () => setViewing(shownScreen - 1),
6460
+ "aria-label": copy.back,
6461
+ children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3 5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
6462
+ }
6463
+ ),
6292
6464
  /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-header-text", children: [
6293
6465
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: stepTitle[step] }),
6294
6466
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
@@ -6345,6 +6517,15 @@ function RampWidgetTemplate({
6345
6517
  }
6346
6518
  ) }, label)) })
6347
6519
  ] }),
6520
+ step === "status" && screens.length > 0 && /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-screens-bar", "aria-label": copy.progress, children: [...screens.map((s) => s.key), "final"].map((key, i) => /* @__PURE__ */ jsx(
6521
+ "li",
6522
+ {
6523
+ "data-done": i < currentScreen || completed && i === screens.length || void 0,
6524
+ "data-shown": i === shownScreen || void 0,
6525
+ "data-failed": screens[i]?.status === "failed" || void 0
6526
+ },
6527
+ key
6528
+ )) }),
6348
6529
  step === "input" && pendingOrders.length > 0 && /* @__PURE__ */ jsxs("section", { className: "pollar-ramp-payment pollar-ramp-saved", "aria-label": copy.pendingAria, children: [
6349
6530
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.pendingNote }),
6350
6531
  pendingOrders.map((pending) => /* @__PURE__ */ jsx("div", { className: "pollar-ramp-saved-row", children: /* @__PURE__ */ jsx(
@@ -6632,37 +6813,62 @@ function RampWidgetTemplate({
6632
6813
  }
6633
6814
  ) })
6634
6815
  ] }),
6635
- step === "status" && order && view && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment", children: [
6636
- /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-legs", "aria-label": copy.progress, children: order.legs.map((leg) => {
6637
- const status = rampLegStatus(leg);
6638
- const note = (status === "failed" && leg.failure ? rampFailureReason(leg.failure, language) : null) ?? rampLegNote(leg, language);
6639
- return /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-leg", "data-status": status, children: [
6640
- /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-dot", "aria-hidden": true }),
6641
- /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-title", children: rampLegTitle(leg, language) }),
6642
- status === "active" && !settled && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-label": copy.inProgress }),
6643
- note && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-note", children: note }),
6644
- status === "active" && !settled && !!leg.steps?.length && /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-steps", children: leg.steps.map((s) => /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
6645
- /* @__PURE__ */ jsx("span", { className: "pollar-ramp-step-title", children: rampStepTitle(s, leg, language) }),
6646
- /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-step-state", children: [
6647
- s.status === "confirming" && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
6648
- rampStepStatusText(s, language)
6649
- ] })
6650
- ] }, s.kind)) }),
6651
- running === leg && !settled && rampLegTimeLeft(leg, now) !== null && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(rampLegTimeLeft(leg, now)) })
6652
- ] }, leg.index);
6653
- }) }),
6654
- confirmation && /* @__PURE__ */ jsx(InlineConfirm, { confirmation, language, network }),
6655
- /* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language }),
6656
- nextApproval && !order.pendingAction && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-next", children: copy.next(nextApproval) }),
6657
- receive && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
6658
- /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: order.state === "completed" ? copy.youReceived : copy.youReceive }),
6659
- /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-value", children: [
6660
- receive.estimated && "~",
6661
- receive.amount,
6662
- " ",
6663
- receive.unit
6664
- ] })
6816
+ step === "status" && order && view && /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment", children: shownScreen === screens.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
6817
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-final", children: [
6818
+ /* @__PURE__ */ jsx("span", { className: "pollar-ramp-final-mark", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { width: "28", height: "28", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
6819
+ "path",
6820
+ {
6821
+ d: "M3 8.5 6.5 12 13 4.5",
6822
+ stroke: "currentColor",
6823
+ strokeWidth: "2",
6824
+ strokeLinecap: "round",
6825
+ strokeLinejoin: "round"
6826
+ }
6827
+ ) }) }),
6828
+ receive && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-final-amount", children: copy.screens.received(`${amountText(receive.amount, language)} ${receive.unit}`) }),
6829
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: arrivedText }),
6830
+ finalNote && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: finalNote })
6831
+ ] }),
6832
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: copy.screens.finish }),
6833
+ /* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language })
6834
+ ] }) : shownScreen < currentScreen ? /* @__PURE__ */ jsxs(Fragment, { children: [
6835
+ /* @__PURE__ */ jsx("h3", { className: "pollar-ramp-screen-title", children: screens[shownScreen].title }),
6836
+ /* @__PURE__ */ jsxs("p", { className: "pollar-ramp-screen-state", children: [
6837
+ /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx(
6838
+ "path",
6839
+ {
6840
+ d: "M3 8.5 6.5 12 13 4.5",
6841
+ stroke: "currentColor",
6842
+ strokeWidth: "2",
6843
+ strokeLinecap: "round",
6844
+ strokeLinejoin: "round"
6845
+ }
6846
+ ) }),
6847
+ copy.screens.done
6848
+ ] }),
6849
+ screenRows(screens[shownScreen]).length > 0 && /* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: screenRows(screens[shownScreen]) }, language }),
6850
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: () => setViewing(null), children: copy.screens.toCurrent })
6851
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
6852
+ shown && /* @__PURE__ */ jsx("h3", { className: "pollar-ramp-screen-title", "data-status": shown.status, children: askedInstead ? view.title : shown.title }),
6853
+ shown?.status === "failed" && shown.leg.failure && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-field-error", children: rampFailureReason(shown.leg.failure, language) }),
6854
+ shown?.preparing && !settled && !order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-wait", children: [
6855
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
6856
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.preparing })
6665
6857
  ] }),
6858
+ shown?.kind === "wait" && !settled && !order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-wait", children: [
6859
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
6860
+ rampLegTimeLeft(shown.leg, now) !== null && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(rampLegTimeLeft(shown.leg, now)) }),
6861
+ rampLegNote(shown.leg, language) && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampLegNote(shown.leg, language) }),
6862
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.updatesItself })
6863
+ ] }),
6864
+ shown && shown.steps.length > 1 && !settled && /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-screen-steps", children: shown.steps.map((s) => /* @__PURE__ */ jsxs("li", { className: "pollar-ramp-step", "data-status": s.status, children: [
6865
+ /* @__PURE__ */ jsx("span", { className: "pollar-ramp-step-title", children: rampStepTitle(s, shown.leg, language) }),
6866
+ /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-step-state", children: [
6867
+ s.status === "confirming" && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
6868
+ rampStepStatusText(s, language)
6869
+ ] })
6870
+ ] }, s.kind)) }),
6871
+ confirmation && /* @__PURE__ */ jsx(InlineConfirm, { confirmation, language, network }),
6666
6872
  order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
6667
6873
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: copy.whatToDo }),
6668
6874
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampOrderResolutionText(order, language) }),
@@ -6723,7 +6929,14 @@ function RampWidgetTemplate({
6723
6929
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: view.pasteCode.label }),
6724
6930
  /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6725
6931
  /* @__PURE__ */ jsx("code", { style: { flex: 1, wordBreak: "break-all" }, children: view.pasteCode.value }),
6726
- /* @__PURE__ */ jsx(CopyButton, { value: view.pasteCode.value, label: copy.copyLabel(view.pasteCode.label), language })
6932
+ /* @__PURE__ */ jsx(
6933
+ CopyButton,
6934
+ {
6935
+ value: view.pasteCode.value,
6936
+ label: copy.copyLabel(view.pasteCode.label),
6937
+ language
6938
+ }
6939
+ )
6727
6940
  ] }) })
6728
6941
  ] }),
6729
6942
  !settled && view.details.map((d) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
@@ -6755,11 +6968,8 @@ function RampWidgetTemplate({
6755
6968
  !settled && order.pendingAction?.kind === "KYC" && !view.link && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: view.note ?? copy.providerReviewing }),
6756
6969
  pollTrouble && !settled && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.serverTrouble }),
6757
6970
  errorMsg && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-field-error", children: errorMsg }),
6758
- /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-explore", children: [
6759
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onNewOrder, children: copy.startAnother }),
6760
- !stopped && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.keepsGoing })
6761
- ] })
6762
- ] }),
6971
+ !settled && /* @__PURE__ */ jsx("div", { className: "pollar-ramp-explore", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onNewOrder, children: copy.startAnother }) })
6972
+ ] }) }),
6763
6973
  step === "error" && /* @__PURE__ */ jsxs(Fragment, { children: [
6764
6974
  /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: errorMsg ?? copy.somethingWrong }),
6765
6975
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
@@ -7924,8 +8134,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
7924
8134
  const flowSteps = fields.length || quotes.some((q) => rampQuoteFields(q).length) ? [copy.steps.route, copy.steps.details, copy.steps.complete] : [copy.steps.route, copy.steps.complete];
7925
8135
  const stepLabel = {
7926
8136
  select_route: copy.steps.route,
7927
- contact: copy.steps.details,
7928
- status: copy.steps.complete
8137
+ contact: copy.steps.details
7929
8138
  };
7930
8139
  const label = stepLabel[step];
7931
8140
  if (verifying) {
@@ -10330,8 +10539,6 @@ function SwapModal({ onClose, initial }) {
10330
10539
  void refreshAssets();
10331
10540
  }, [refreshWalletBalance, refreshAssets]);
10332
10541
  const loadConfig = useCallback(() => {
10333
- setVenues(null);
10334
- setSolanaVenues(null);
10335
10542
  return Promise.all([
10336
10543
  getSwapConfig().then(setVenues).catch(() => setVenues([])),
10337
10544
  // treat a failed config as "unavailable"
@@ -10469,10 +10676,12 @@ function SwapModal({ onClose, initial }) {
10469
10676
  setSelectedBuy(seeded);
10470
10677
  return;
10471
10678
  }
10472
- if (!selectedBuy || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10473
- setSelectedBuy(buyOptions[0]);
10679
+ const sellKey = selectedSell ? optKey(selectedSell) : "";
10680
+ if (!selectedBuy || optKey(selectedBuy) === sellKey || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10681
+ const next = buyOptions.find((o) => optKey(o) !== sellKey) ?? null;
10682
+ if (next !== selectedBuy) setSelectedBuy(next);
10474
10683
  }
10475
- }, [buyOptions, selectedBuy, isLoadingData]);
10684
+ }, [buyOptions, selectedBuy, selectedSell, isLoadingData]);
10476
10685
  function addCustomToken(code, issuer) {
10477
10686
  const c = code.trim().toUpperCase();
10478
10687
  const i = issuer.trim();
@@ -10532,8 +10741,13 @@ function SwapModal({ onClose, initial }) {
10532
10741
  };
10533
10742
  }, [quotedSolana, step]);
10534
10743
  useEffect(() => {
10535
- if (chains.length > 0 && !chains.includes(chain)) setChain(chains[0]);
10536
- }, [chains, chain]);
10744
+ if (configLoading) return;
10745
+ if (chains.length === 0 || chains.includes(chain)) return;
10746
+ setChain(chains[0]);
10747
+ setProvider("auto");
10748
+ setQuotes([]);
10749
+ setSolanaQuotes([]);
10750
+ }, [chains, chain, configLoading]);
10537
10751
  function handleChainChange(next) {
10538
10752
  sellSeed.current = void 0;
10539
10753
  buySeed.current = void 0;
@@ -13995,6 +14209,7 @@ var COSIGN_COPY = {
13995
14209
  approve: "Approve",
13996
14210
  approving: "Approving...",
13997
14211
  genericError: "Something went wrong. Please try again.",
14212
+ unreachable: "We could not reach Pollar, so nothing was approved. Check your connection and approve again.",
13998
14213
  deviceNotLinked: "This device isn't linked to your wallet yet, so it can't approve. Add it with a device that already is, your passkey or your email.",
13999
14214
  linkDevice: "Link this device",
14000
14215
  transaction: "Transaction",
@@ -14048,6 +14263,7 @@ var COSIGN_COPY = {
14048
14263
  approve: "Aprobar",
14049
14264
  approving: "Aprobando...",
14050
14265
  genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
14266
+ unreachable: "No pudimos conectar con Pollar, as\xED que no se aprob\xF3 nada. Revisa tu conexi\xF3n y aprueba de nuevo.",
14051
14267
  deviceNotLinked: "Este dispositivo a\xFAn no est\xE1 vinculado a tu billetera, as\xED que no puede aprobar. Agr\xE9galo con un dispositivo que ya lo est\xE9, tu passkey o tu email.",
14052
14268
  linkDevice: "Vincular este dispositivo",
14053
14269
  transaction: "Transacci\xF3n",
@@ -14101,6 +14317,7 @@ var COSIGN_COPY = {
14101
14317
  approve: "Aprovar",
14102
14318
  approving: "Aprovando...",
14103
14319
  genericError: "Algo deu errado. Tente novamente.",
14320
+ unreachable: "N\xE3o conseguimos conectar \xE0 Pollar, ent\xE3o nada foi aprovado. Verifique sua conex\xE3o e aprove novamente.",
14104
14321
  deviceNotLinked: "Este dispositivo ainda n\xE3o est\xE1 vinculado \xE0 sua carteira, ent\xE3o n\xE3o pode aprovar. Adicione-o com um dispositivo que j\xE1 esteja, sua passkey ou seu email.",
14105
14322
  linkDevice: "Vincular este dispositivo",
14106
14323
  transaction: "Transa\xE7\xE3o",
@@ -14454,6 +14671,11 @@ function CosignModal({ nextStep = null, onClose }) {
14454
14671
  try {
14455
14672
  await action(request);
14456
14673
  } catch (err) {
14674
+ if (isPollarNetworkError(err) || err instanceof TypeError) {
14675
+ setError(COSIGN_COPY[language].unreachable);
14676
+ void refresh().catch(() => void 0);
14677
+ return;
14678
+ }
14457
14679
  setError(
14458
14680
  transactionErrorMessage(isPollarApiError(err) ? err.code : null, err instanceof Error ? err.message : null, language)
14459
14681
  );
@@ -14463,7 +14685,7 @@ function CosignModal({ nextStep = null, onClose }) {
14463
14685
  setBusy(null);
14464
14686
  }
14465
14687
  },
14466
- []
14688
+ [language, refresh]
14467
14689
  );
14468
14690
  return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, children: /* @__PURE__ */ jsx(
14469
14691
  CosignModalTemplate,
@@ -14694,6 +14916,9 @@ var RECOVERY_COPY = {
14694
14916
  acceptRisks: "I understand and accept these risks",
14695
14917
  recoverEmailIntro: (address) => `We'll email a code to ${address}. The code goes straight to the wallet provider, encrypted on this device.`,
14696
14918
  sendCode: "Send code",
14919
+ sendCodeIn: (seconds) => `Send code in ${seconds}s`,
14920
+ resendCode: "Send a new code",
14921
+ resendCodeIn: (seconds) => `Send a new code in ${seconds}s`,
14697
14922
  recover: "Recover",
14698
14923
  back: "Back",
14699
14924
  emailIntro: "Confirm an email you control. If you lose this device, a code sent there lets you add a new one. Anyone who controls this inbox could do the same, so use one that is well protected.",
@@ -14746,6 +14971,9 @@ var RECOVERY_COPY = {
14746
14971
  acceptRisks: "Entiendo y acepto estos riesgos",
14747
14972
  recoverEmailIntro: (address) => `Te enviaremos un c\xF3digo a ${address}. El c\xF3digo va directo al proveedor de la billetera, cifrado en este dispositivo.`,
14748
14973
  sendCode: "Enviar c\xF3digo",
14974
+ sendCodeIn: (seconds) => `Enviar c\xF3digo en ${seconds} s`,
14975
+ resendCode: "Enviar otro c\xF3digo",
14976
+ resendCodeIn: (seconds) => `Enviar otro c\xF3digo en ${seconds} s`,
14749
14977
  recover: "Recuperar",
14750
14978
  back: "Atr\xE1s",
14751
14979
  emailIntro: "Confirma un correo que controles. Si pierdes este dispositivo, un c\xF3digo enviado ah\xED te permite agregar uno nuevo. Cualquiera que controle esa bandeja de entrada podr\xEDa hacer lo mismo, as\xED que usa una que est\xE9 bien protegida.",
@@ -14798,6 +15026,9 @@ var RECOVERY_COPY = {
14798
15026
  acceptRisks: "Entendo e aceito esses riscos",
14799
15027
  recoverEmailIntro: (address) => `Vamos enviar um c\xF3digo para ${address}. O c\xF3digo vai direto para o provedor da carteira, criptografado neste dispositivo.`,
14800
15028
  sendCode: "Enviar c\xF3digo",
15029
+ sendCodeIn: (seconds) => `Enviar c\xF3digo em ${seconds} s`,
15030
+ resendCode: "Enviar outro c\xF3digo",
15031
+ resendCodeIn: (seconds) => `Enviar outro c\xF3digo em ${seconds} s`,
14801
15032
  recover: "Recuperar",
14802
15033
  back: "Voltar",
14803
15034
  emailIntro: "Confirme um e-mail que voc\xEA controla. Se voc\xEA perder este dispositivo, um c\xF3digo enviado para ele permite adicionar um novo. Qualquer pessoa que controle essa caixa de entrada poderia fazer o mesmo, ent\xE3o use uma que esteja bem protegida.",
@@ -14953,11 +15184,25 @@ function RecoveryModalTemplate(p) {
14953
15184
  copy,
14954
15185
  busy: p.busy,
14955
15186
  id: "recover-send",
14956
- label: copy.sendCode,
15187
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14957
15188
  kind: "primary",
14958
- onClick: p.onSendRecoveryCode
15189
+ onClick: p.onSendRecoveryCode,
15190
+ disabled: p.sendWaitSeconds > 0
14959
15191
  }
14960
- ) : /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15192
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
15193
+ /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15194
+ /* @__PURE__ */ jsx(
15195
+ Button,
15196
+ {
15197
+ copy,
15198
+ busy: p.busy,
15199
+ id: "recover-send",
15200
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15201
+ onClick: p.onSendRecoveryCode,
15202
+ disabled: p.sendWaitSeconds > 0
15203
+ }
15204
+ )
15205
+ ] }),
14961
15206
  /* @__PURE__ */ jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
14962
15207
  ] });
14963
15208
  } else if (p.view === "email") {
@@ -14969,7 +15214,7 @@ function RecoveryModalTemplate(p) {
14969
15214
  className: "pollar-recovery-row",
14970
15215
  onSubmit: (e) => {
14971
15216
  e.preventDefault();
14972
- p.onSendEmailCode();
15217
+ if (!p.sendWaitSeconds) p.onSendEmailCode();
14973
15218
  },
14974
15219
  children: [
14975
15220
  /* @__PURE__ */ jsx(
@@ -14989,15 +15234,28 @@ function RecoveryModalTemplate(p) {
14989
15234
  copy,
14990
15235
  busy: p.busy,
14991
15236
  id: "email-send",
14992
- label: copy.sendCode,
15237
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14993
15238
  kind: "primary",
14994
15239
  onClick: p.onSendEmailCode,
14995
- disabled: !p.emailDraft.trim()
15240
+ disabled: !p.emailDraft.trim() || p.sendWaitSeconds > 0
14996
15241
  }
14997
15242
  )
14998
15243
  ]
14999
15244
  }
15000
- ) : /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15245
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
15246
+ /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15247
+ /* @__PURE__ */ jsx(
15248
+ Button,
15249
+ {
15250
+ copy,
15251
+ busy: p.busy,
15252
+ id: "email-send",
15253
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15254
+ onClick: p.onSendEmailCode,
15255
+ disabled: p.sendWaitSeconds > 0
15256
+ }
15257
+ )
15258
+ ] }),
15001
15259
  /* @__PURE__ */ jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
15002
15260
  ] });
15003
15261
  } else if (p.view === "export") {
@@ -15140,6 +15398,7 @@ function RecoveryModal({ onClose }) {
15140
15398
  const [emailDraft, setEmailDraft] = useState("");
15141
15399
  const [codeSent, setCodeSent] = useState(false);
15142
15400
  const [phrase, setPhrase] = useState(null);
15401
+ const [now, setNow] = useState(() => Date.now());
15143
15402
  const load = useCallback(async () => {
15144
15403
  const client = getClient();
15145
15404
  const [nextState, nextDevices, key] = await Promise.all([
@@ -15182,6 +15441,14 @@ function RecoveryModal({ onClose }) {
15182
15441
  },
15183
15442
  [load]
15184
15443
  );
15444
+ const codeEmail = view === "recover-email" ? state?.email.address ?? "" : emailDraft.trim();
15445
+ const codeAvailableAt = codeEmail ? recovery.codeAvailableAt(codeEmail) : 0;
15446
+ const sendWaitSeconds = codeAvailableAt > now ? Math.ceil((codeAvailableAt - now) / 1e3) : 0;
15447
+ useEffect(() => {
15448
+ if (!codeAvailableAt) return;
15449
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
15450
+ return () => clearInterval(timer);
15451
+ }, [codeAvailableAt]);
15185
15452
  const enrolled = !!thisDeviceKey && !!devices?.devices.some((d) => d.publicKey.toLowerCase() === thisDeviceKey);
15186
15453
  const [awaitingApproval, setAwaitingApproval] = useState(false);
15187
15454
  useEffect(() => {
@@ -15216,6 +15483,7 @@ function RecoveryModal({ onClose }) {
15216
15483
  notice,
15217
15484
  emailDraft,
15218
15485
  codeSent,
15486
+ sendWaitSeconds,
15219
15487
  phrase,
15220
15488
  onView: (next) => {
15221
15489
  setError(null);
@@ -15228,8 +15496,12 @@ function RecoveryModal({ onClose }) {
15228
15496
  onAddPasskey: () => void run("passkey", () => recovery.addPasskey(), { notice: copy.passkeyAdded }),
15229
15497
  onRemovePasskey: (id) => void run(`passkey:${id}`, () => recovery.removePasskey(id)),
15230
15498
  onSendEmailCode: () => void run("email-send", async () => {
15231
- await recovery.startEmail(emailDraft.trim());
15232
- setCodeSent(true);
15499
+ try {
15500
+ await recovery.startEmail(emailDraft.trim());
15501
+ setCodeSent(true);
15502
+ } finally {
15503
+ setNow(Date.now());
15504
+ }
15233
15505
  }),
15234
15506
  onConfirmEmail: (code) => void run("email-confirm", () => recovery.confirmEmail(code.trim()), { notice: copy.emailConfirmed, view: "overview" }),
15235
15507
  onApproveDevice: (id) => void run(`approve:${id}`, () => recovery.approveDevice(id), { notice: copy.deviceAdded }),
@@ -15246,8 +15518,12 @@ function RecoveryModal({ onClose }) {
15246
15518
  notice: copy.recovered
15247
15519
  }),
15248
15520
  onSendRecoveryCode: () => void run("recover-send", async () => {
15249
- await recovery.startEmailRecovery();
15250
- setCodeSent(true);
15521
+ try {
15522
+ await recovery.startEmailRecovery();
15523
+ setCodeSent(true);
15524
+ } finally {
15525
+ setNow(Date.now());
15526
+ }
15251
15527
  }),
15252
15528
  onRecoverWithCode: (code) => void run("recover-code", () => recovery.recoverWithEmailCode(code.trim()), {
15253
15529
  notice: copy.recovered,
@@ -16470,31 +16746,58 @@ function PollarProvider({
16470
16746
  }, [pollarClient, hasSession, walletAddress, custodyMigrationTick]);
16471
16747
  const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
16472
16748
  const refreshAssets = useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
16749
+ const clientMethods = useMemo(
16750
+ () => ({
16751
+ createWallet: (options) => pollarClient.createWallet(options),
16752
+ login: (options) => pollarClient.login(options),
16753
+ logout: () => pollarClient.logout(),
16754
+ buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
16755
+ signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
16756
+ signTx: (unsignedXdr) => pollarClient.signTx(unsignedXdr),
16757
+ submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
16758
+ buildAndSignAndSubmitTx: (operation, params, options) => pollarClient.buildAndSignAndSubmitTx(operation, params, options),
16759
+ runTx: (operation, params, options) => pollarClient.runTx(operation, params, options),
16760
+ sendPayment: (params) => pollarClient.sendPayment(params),
16761
+ setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
16762
+ getSwapConfig: () => pollarClient.getSwapConfig(),
16763
+ getSwapTokens: () => pollarClient.getSwapTokens(),
16764
+ getSwapQuote: (params) => pollarClient.getSwapQuote(params),
16765
+ swap: (quote, opts) => pollarClient.swap(quote, opts),
16766
+ getSolanaSwapConfig: () => pollarClient.getSolanaSwapConfig(),
16767
+ getSolanaSwapQuote: (params) => pollarClient.getSolanaSwapQuote(params),
16768
+ swapSolana: (quote, opts) => pollarClient.swapSolana(quote, opts),
16769
+ getSolanaSwapOptions: () => pollarClient.getSolanaSwapOptions(),
16770
+ getSwapStatus: (idempotencyKey) => pollarClient.getSwapStatus(idempotencyKey),
16771
+ getEarnProviders: () => pollarClient.getEarnProviders(),
16772
+ getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
16773
+ getEarnPosition: (params) => pollarClient.getEarnPosition(params),
16774
+ earnDeposit: (params) => pollarClient.earnDeposit(params),
16775
+ earnWithdraw: (params) => pollarClient.earnWithdraw(params),
16776
+ getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
16777
+ getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
16778
+ getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
16779
+ earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
16780
+ earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
16781
+ setNetwork: (network) => pollarClient.setNetwork(network)
16782
+ }),
16783
+ [pollarClient]
16784
+ );
16473
16785
  const contextValue = useMemo(() => {
16474
16786
  const styles = resolvedConfig.styles ?? {};
16475
16787
  return {
16788
+ ...clientMethods,
16476
16789
  // session
16477
16790
  wallet: pollarClient.getWallet(),
16478
16791
  wallets: pollarClient.getWallets(),
16479
16792
  isAuthenticated: hasSession,
16480
16793
  hasWallet: pollarClient.hasWallet(),
16481
- createWallet: (options) => pollarClient.createWallet(options),
16482
16794
  verified,
16483
16795
  // client
16484
16796
  getClient,
16485
16797
  // auth
16486
- login: (options) => pollarClient.login(options),
16487
- logout: () => pollarClient.logout(),
16488
16798
  openLoginModal: () => setLoginModalOpen(true),
16489
16799
  // transactions
16490
16800
  tx: transaction,
16491
- buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
16492
- signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
16493
- signTx: (unsignedXdr) => pollarClient.signTx(unsignedXdr),
16494
- submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
16495
- buildAndSignAndSubmitTx: (operation, params, options) => pollarClient.buildAndSignAndSubmitTx(operation, params, options),
16496
- runTx: (operation, params, options) => pollarClient.runTx(operation, params, options),
16497
- sendPayment: (params) => pollarClient.sendPayment(params),
16498
16801
  openTxModal: () => setTransactionModalOpen(true),
16499
16802
  // tx history
16500
16803
  txHistory,
@@ -16509,7 +16812,6 @@ function PollarProvider({
16509
16812
  // enabled assets
16510
16813
  enabledAssets,
16511
16814
  refreshAssets,
16512
- setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
16513
16815
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
16514
16816
  // send / receive
16515
16817
  openSendModal: (options) => {
@@ -16523,15 +16825,6 @@ function PollarProvider({
16523
16825
  setReceiveModalOpen(true);
16524
16826
  },
16525
16827
  // swap
16526
- getSwapConfig: () => pollarClient.getSwapConfig(),
16527
- getSwapTokens: () => pollarClient.getSwapTokens(),
16528
- getSwapQuote: (params) => pollarClient.getSwapQuote(params),
16529
- swap: (quote, opts) => pollarClient.swap(quote, opts),
16530
- getSolanaSwapConfig: () => pollarClient.getSolanaSwapConfig(),
16531
- getSolanaSwapQuote: (params) => pollarClient.getSolanaSwapQuote(params),
16532
- swapSolana: (quote, opts) => pollarClient.swapSolana(quote, opts),
16533
- getSolanaSwapOptions: () => pollarClient.getSolanaSwapOptions(),
16534
- getSwapStatus: (idempotencyKey) => pollarClient.getSwapStatus(idempotencyKey),
16535
16828
  openSwapModal: (options) => {
16536
16829
  setSwapModalOptions(options);
16537
16830
  pollarClient.resetTransactionState();
@@ -16544,16 +16837,6 @@ function PollarProvider({
16544
16837
  setBridgeModalOpen(true);
16545
16838
  },
16546
16839
  // earn
16547
- getEarnProviders: () => pollarClient.getEarnProviders(),
16548
- getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
16549
- getEarnPosition: (params) => pollarClient.getEarnPosition(params),
16550
- earnDeposit: (params) => pollarClient.earnDeposit(params),
16551
- earnWithdraw: (params) => pollarClient.earnWithdraw(params),
16552
- getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
16553
- getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
16554
- getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
16555
- earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
16556
- earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
16557
16840
  openEarnModal: (options) => {
16558
16841
  setEarnModalOptions(options);
16559
16842
  pollarClient.resetTransactionState();
@@ -16585,7 +16868,6 @@ function PollarProvider({
16585
16868
  openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
16586
16869
  // network
16587
16870
  network: networkState.step === "connected" ? networkState.network : "testnet",
16588
- setNetwork: (network) => pollarClient.setNetwork(network),
16589
16871
  // kyc
16590
16872
  openKycModal: (options = {}) => {
16591
16873
  setKycModalOptions(options);
@@ -16604,6 +16886,7 @@ function PollarProvider({
16604
16886
  adapters
16605
16887
  };
16606
16888
  }, [
16889
+ clientMethods,
16607
16890
  walletAddress,
16608
16891
  walletProvisioning,
16609
16892
  recovery,