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

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.26"
1313
1313
  ] })
1314
1314
  ] });
1315
1315
  };
@@ -5511,6 +5511,7 @@ var RAMP_COPY = {
5511
5511
  SDK_RAMPS_QUOTE_EXPIRED: "This quote expired. Find a route again.",
5512
5512
  SDK_RAMPS_QUOTE_NOT_FOUND: "This quote is no longer available. Find a route again.",
5513
5513
  SDK_RAMPS_ACTION_STALE: "This step changed. It was refreshed; try again.",
5514
+ SDK_RAMPS_ORDER_NOT_CANCELLABLE: "This order can no longer be cancelled: its funds are already moving.",
5514
5515
  SDK_RAMPS_TX_NOT_FOUND: "This operation was not found.",
5515
5516
  SDK_RAMPS_WALLET_NOT_READY: "Approve the new wallet account on your device, then try again."
5516
5517
  },
@@ -5531,6 +5532,7 @@ var RAMP_COPY = {
5531
5532
  resumeOrderFailed: "Could not resume the operation.",
5532
5533
  checkPaymentFailed: "Could not check the payment. Please try again.",
5533
5534
  retryOrderFailed: "Could not try again. Please try again.",
5535
+ cancelOrderFailed: "Could not cancel the order. Please try again.",
5534
5536
  refreshFailed: "Could not refresh.",
5535
5537
  copyFailed: "Could not copy.",
5536
5538
  awaitingAccount: "Approve the new account on your device. The order starts once it is approved.",
@@ -5628,6 +5630,39 @@ var RAMP_COPY = {
5628
5630
  startAnother: "Start another operation",
5629
5631
  newQuote: "Get a new quote",
5630
5632
  keepsGoing: "This one keeps going; you can resume it later.",
5633
+ leave: {
5634
+ title: "Leave this purchase?",
5635
+ note: "Your order keeps going. You can come back to it from Buy.",
5636
+ stay: "Stay here",
5637
+ exit: "Leave, keep the order",
5638
+ cancel: "Cancel the order",
5639
+ cancelling: "Cancelling\u2026"
5640
+ },
5641
+ screens: {
5642
+ pay: (amount, currency) => `Pay ${amount} ${currency}`,
5643
+ send: (amount, code) => `Send ${amount} ${code}`,
5644
+ delivering: (code) => `Your ${code} is on its way`,
5645
+ payingOut: (currency) => `Your ${currency} is on its way to your account`,
5646
+ next: "Next step",
5647
+ paidDone: (amount, currency) => `You paid ${amount} ${currency}.`,
5648
+ sentDone: (amount, code) => `You sent ${amount} ${code}.`,
5649
+ receivedDone: (amount, code, chain) => `You received ${amount} ${code} on ${chain}.`,
5650
+ payoutDone: (amount, currency) => `${amount} ${currency} were sent to your account.`,
5651
+ signedDone: "You approved this step.",
5652
+ ranDone: "This step is complete.",
5653
+ updatesItself: "This screen updates on its own.",
5654
+ preparing: "Preparing your payment\u2026",
5655
+ saveQr: "Save QR",
5656
+ savingQr: "Saving\u2026",
5657
+ savedQr: "QR saved",
5658
+ saveQrFailed: "Could not save the QR",
5659
+ qrFile: "payment",
5660
+ received: (amount) => `+${amount}`,
5661
+ arrived: (chain) => `It reached your wallet on ${chain}.`,
5662
+ paidOut: "It was sent to your account.",
5663
+ finish: "Done",
5664
+ details: "Details"
5665
+ },
5631
5666
  somethingWrong: "Something went wrong.",
5632
5667
  routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
5633
5668
  feesIncluded: "fees included",
@@ -5642,6 +5677,7 @@ var RAMP_COPY = {
5642
5677
  SDK_RAMPS_QUOTE_EXPIRED: "Esta cotizaci\xF3n venci\xF3. Busca una ruta de nuevo.",
5643
5678
  SDK_RAMPS_QUOTE_NOT_FOUND: "Esta cotizaci\xF3n ya no est\xE1 disponible. Busca una ruta de nuevo.",
5644
5679
  SDK_RAMPS_ACTION_STALE: "Este paso cambi\xF3 y se actualiz\xF3. Intenta de nuevo.",
5680
+ SDK_RAMPS_ORDER_NOT_CANCELLABLE: "Esta orden ya no se puede cancelar: sus fondos ya est\xE1n en movimiento.",
5645
5681
  SDK_RAMPS_TX_NOT_FOUND: "No se encontr\xF3 esta operaci\xF3n.",
5646
5682
  SDK_RAMPS_WALLET_NOT_READY: "Aprueba la nueva cuenta de la billetera en tu dispositivo e intenta de nuevo."
5647
5683
  },
@@ -5662,6 +5698,7 @@ var RAMP_COPY = {
5662
5698
  resumeOrderFailed: "No se pudo retomar la operaci\xF3n.",
5663
5699
  checkPaymentFailed: "No se pudo verificar el pago. Intenta de nuevo.",
5664
5700
  retryOrderFailed: "No se pudo reintentar. Intenta de nuevo.",
5701
+ cancelOrderFailed: "No se pudo cancelar la orden. Intenta de nuevo.",
5665
5702
  refreshFailed: "No se pudo actualizar.",
5666
5703
  copyFailed: "No se pudo copiar.",
5667
5704
  awaitingAccount: "Aprueba la nueva cuenta en tu dispositivo. La orden comienza cuando la apruebes.",
@@ -5759,6 +5796,39 @@ var RAMP_COPY = {
5759
5796
  startAnother: "Iniciar otra operaci\xF3n",
5760
5797
  newQuote: "Pedir nueva cotizaci\xF3n",
5761
5798
  keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
5799
+ leave: {
5800
+ title: "\xBFSalir de esta compra?",
5801
+ note: "Tu orden sigue activa. Puedes retomarla desde Comprar.",
5802
+ stay: "Seguir aqu\xED",
5803
+ exit: "Salir, la orden sigue",
5804
+ cancel: "Cancelar la orden",
5805
+ cancelling: "Cancelando\u2026"
5806
+ },
5807
+ screens: {
5808
+ pay: (amount, currency) => `Paga ${amount} ${currency}`,
5809
+ send: (amount, code) => `Env\xEDa ${amount} ${code}`,
5810
+ delivering: (code) => `Tu ${code} est\xE1 en camino`,
5811
+ payingOut: (currency) => `Tus ${currency} van en camino a tu cuenta`,
5812
+ next: "Paso siguiente",
5813
+ paidDone: (amount, currency) => `Pagaste ${amount} ${currency}.`,
5814
+ sentDone: (amount, code) => `Enviaste ${amount} ${code}.`,
5815
+ receivedDone: (amount, code, chain) => `Recibiste ${amount} ${code} en ${chain}.`,
5816
+ payoutDone: (amount, currency) => `Se enviaron ${amount} ${currency} a tu cuenta.`,
5817
+ signedDone: "Aprobaste este paso.",
5818
+ ranDone: "Este paso est\xE1 completo.",
5819
+ updatesItself: "Esta pantalla se actualiza sola.",
5820
+ preparing: "Preparando tu pago\u2026",
5821
+ saveQr: "Guardar QR",
5822
+ savingQr: "Guardando\u2026",
5823
+ savedQr: "QR guardado",
5824
+ saveQrFailed: "No se pudo guardar el QR",
5825
+ qrFile: "pago",
5826
+ received: (amount) => `+${amount}`,
5827
+ arrived: (chain) => `Lleg\xF3 a tu wallet en ${chain}.`,
5828
+ paidOut: "Se envi\xF3 a tu cuenta.",
5829
+ finish: "Listo",
5830
+ details: "Detalles"
5831
+ },
5762
5832
  somethingWrong: "Algo sali\xF3 mal.",
5763
5833
  routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
5764
5834
  feesIncluded: "comisiones incluidas",
@@ -5773,6 +5843,7 @@ var RAMP_COPY = {
5773
5843
  SDK_RAMPS_QUOTE_EXPIRED: "Esta cota\xE7\xE3o expirou. Busque uma rota de novo.",
5774
5844
  SDK_RAMPS_QUOTE_NOT_FOUND: "Esta cota\xE7\xE3o n\xE3o est\xE1 mais dispon\xEDvel. Busque uma rota de novo.",
5775
5845
  SDK_RAMPS_ACTION_STALE: "Esta etapa mudou e foi atualizada. Tente de novo.",
5846
+ SDK_RAMPS_ORDER_NOT_CANCELLABLE: "Esta ordem n\xE3o pode mais ser cancelada: os fundos j\xE1 est\xE3o em movimento.",
5776
5847
  SDK_RAMPS_TX_NOT_FOUND: "Esta opera\xE7\xE3o n\xE3o foi encontrada.",
5777
5848
  SDK_RAMPS_WALLET_NOT_READY: "Aprove a nova conta da carteira no seu dispositivo e tente de novo."
5778
5849
  },
@@ -5793,6 +5864,7 @@ var RAMP_COPY = {
5793
5864
  resumeOrderFailed: "N\xE3o foi poss\xEDvel retomar a opera\xE7\xE3o.",
5794
5865
  checkPaymentFailed: "N\xE3o foi poss\xEDvel verificar o pagamento. Tente de novo.",
5795
5866
  retryOrderFailed: "N\xE3o foi poss\xEDvel tentar de novo. Tente de novo.",
5867
+ cancelOrderFailed: "N\xE3o foi poss\xEDvel cancelar a ordem. Tente de novo.",
5796
5868
  refreshFailed: "N\xE3o foi poss\xEDvel atualizar.",
5797
5869
  copyFailed: "N\xE3o foi poss\xEDvel copiar.",
5798
5870
  awaitingAccount: "Aprove a nova conta no seu dispositivo. A ordem come\xE7a assim que voc\xEA aprovar.",
@@ -5890,6 +5962,39 @@ var RAMP_COPY = {
5890
5962
  startAnother: "Iniciar outra opera\xE7\xE3o",
5891
5963
  newQuote: "Pedir nova cota\xE7\xE3o",
5892
5964
  keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
5965
+ leave: {
5966
+ title: "Sair desta compra?",
5967
+ note: "Sua ordem continua ativa. Voc\xEA pode retom\xE1-la em Comprar.",
5968
+ stay: "Ficar aqui",
5969
+ exit: "Sair, manter a ordem",
5970
+ cancel: "Cancelar a ordem",
5971
+ cancelling: "Cancelando\u2026"
5972
+ },
5973
+ screens: {
5974
+ pay: (amount, currency) => `Pague ${amount} ${currency}`,
5975
+ send: (amount, code) => `Envie ${amount} ${code}`,
5976
+ delivering: (code) => `Seu ${code} est\xE1 a caminho`,
5977
+ payingOut: (currency) => `Seus ${currency} est\xE3o a caminho da sua conta`,
5978
+ next: "Pr\xF3xima etapa",
5979
+ paidDone: (amount, currency) => `Voc\xEA pagou ${amount} ${currency}.`,
5980
+ sentDone: (amount, code) => `Voc\xEA enviou ${amount} ${code}.`,
5981
+ receivedDone: (amount, code, chain) => `Voc\xEA recebeu ${amount} ${code} na ${chain}.`,
5982
+ payoutDone: (amount, currency) => `${amount} ${currency} foram enviados para a sua conta.`,
5983
+ signedDone: "Voc\xEA aprovou esta etapa.",
5984
+ ranDone: "Esta etapa est\xE1 conclu\xEDda.",
5985
+ updatesItself: "Esta tela se atualiza sozinha.",
5986
+ preparing: "Preparando o seu pagamento\u2026",
5987
+ saveQr: "Salvar QR",
5988
+ savingQr: "Salvando\u2026",
5989
+ savedQr: "QR salvo",
5990
+ saveQrFailed: "N\xE3o foi poss\xEDvel salvar o QR",
5991
+ qrFile: "pagamento",
5992
+ received: (amount) => `+${amount}`,
5993
+ arrived: (chain) => `Chegou \xE0 sua carteira na ${chain}.`,
5994
+ paidOut: "Foi enviado para a sua conta.",
5995
+ finish: "Pronto",
5996
+ details: "Detalhes"
5997
+ },
5893
5998
  somethingWrong: "Algo deu errado.",
5894
5999
  routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
5895
6000
  feesIncluded: "taxas inclu\xEDdas",
@@ -6038,6 +6143,184 @@ function routeKey(quote) {
6038
6143
  const node = (n) => n.kind === "asset" ? `${n.code}:${n.chain}` : `${n.currency}:${n.rail}`;
6039
6144
  return quote.legs.map((leg) => `${leg.kind}:${node(leg.from)}>${node(leg.to)}`).join("|");
6040
6145
  }
6146
+ var amountText = (value, language) => {
6147
+ const n = Number(value);
6148
+ return Number.isFinite(n) ? n.toLocaleString(language, { maximumFractionDigits: 7 }) : value;
6149
+ };
6150
+ function rampOrderScreens(order, language) {
6151
+ const copy = RAMP_COPY[language].screens;
6152
+ const parts = [];
6153
+ const waitsOn = (leg) => order.pendingAction?.legIndex === leg.index && order.pendingAction.kind !== "NONE";
6154
+ for (const leg of order.legs) {
6155
+ const legStatus = rampLegStatus(leg);
6156
+ const legDone = legStatus === "done";
6157
+ if (leg.steps?.length) {
6158
+ let running = [];
6159
+ const flush = () => {
6160
+ if (!running.length) return;
6161
+ parts.push({
6162
+ key: `${leg.index}:${running[0].kind}`,
6163
+ kind: "wait",
6164
+ leg,
6165
+ steps: running,
6166
+ title: rampLegTitle(leg, language),
6167
+ done: legDone || running.every((s) => s.status === "done")
6168
+ });
6169
+ running = [];
6170
+ };
6171
+ for (const step of leg.steps) {
6172
+ if (!step.signs) {
6173
+ running.push(step);
6174
+ continue;
6175
+ }
6176
+ flush();
6177
+ parts.push({
6178
+ key: `${leg.index}:${step.kind}`,
6179
+ kind: "action",
6180
+ leg,
6181
+ steps: [step],
6182
+ title: rampStepTitle(step, leg, language),
6183
+ done: legDone || step.status === "done"
6184
+ });
6185
+ }
6186
+ flush();
6187
+ continue;
6188
+ }
6189
+ if (leg.kind === "PROVIDER_ONRAMP" || leg.kind === "PROVIDER_OFFRAMP") {
6190
+ const onramp = leg.kind === "PROVIDER_ONRAMP";
6191
+ const unitIn = leg.from.kind === "fiat" ? leg.from.currency : leg.from.code;
6192
+ const unitOut = leg.to.kind === "fiat" ? leg.to.currency : leg.to.code;
6193
+ const payment = leg.paymentStatus;
6194
+ const paid = payment === void 0 ? legStatus === "active" && !waitsOn(leg) : payment === "received";
6195
+ const amount = amountText(leg.amountInPlanned, language);
6196
+ parts.push({
6197
+ key: `${leg.index}:pay`,
6198
+ kind: "action",
6199
+ leg,
6200
+ steps: [],
6201
+ title: onramp ? copy.pay(amount, unitIn) : copy.send(amount, unitIn),
6202
+ done: legDone || paid,
6203
+ preparing: payment === "not_requested" && !waitsOn(leg)
6204
+ });
6205
+ parts.push({
6206
+ key: `${leg.index}:deliver`,
6207
+ kind: "wait",
6208
+ leg,
6209
+ steps: [],
6210
+ title: onramp ? copy.delivering(unitOut) : copy.payingOut(unitOut),
6211
+ done: legDone
6212
+ });
6213
+ continue;
6214
+ }
6215
+ parts.push({
6216
+ key: `${leg.index}`,
6217
+ kind: leg.signingMode ? "action" : "wait",
6218
+ leg,
6219
+ steps: [],
6220
+ title: rampLegTitle(leg, language),
6221
+ done: legDone
6222
+ });
6223
+ }
6224
+ const stopped = ["failed", "refunded"].includes(order.state);
6225
+ let currentFound = false;
6226
+ return parts.map(({ done, ...screen }) => {
6227
+ if (done) return { ...screen, status: "done" };
6228
+ if (currentFound) return { ...screen, status: "upcoming" };
6229
+ currentFound = true;
6230
+ return { ...screen, status: stopped || rampLegStatus(screen.leg) === "failed" ? "failed" : "current" };
6231
+ });
6232
+ }
6233
+ var SVG_SIDE = 1024;
6234
+ function imageSrc(image) {
6235
+ return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
6236
+ }
6237
+ function base64Blob(data, type) {
6238
+ const bytes = Uint8Array.from(atob(data), (c) => c.charCodeAt(0));
6239
+ return new Blob([bytes], { type });
6240
+ }
6241
+ async function scannableFile(image) {
6242
+ if (image.encoding === "base64" && (image.mediaType === "image/png" || image.mediaType === "image/jpeg"))
6243
+ return base64Blob(image.data, image.mediaType);
6244
+ const element = new Image();
6245
+ element.decoding = "async";
6246
+ element.src = imageSrc(image);
6247
+ await element.decode();
6248
+ const svg = image.mediaType === "image/svg+xml";
6249
+ const width = svg ? SVG_SIDE : element.naturalWidth;
6250
+ const height = svg ? Math.round(SVG_SIDE * (element.naturalHeight || 1) / (element.naturalWidth || 1)) : element.naturalHeight;
6251
+ const canvas = document.createElement("canvas");
6252
+ canvas.width = width;
6253
+ canvas.height = height;
6254
+ const context = canvas.getContext("2d");
6255
+ if (!context) throw new Error("canvas unavailable");
6256
+ context.fillStyle = "#ffffff";
6257
+ context.fillRect(0, 0, width, height);
6258
+ context.drawImage(element, 0, 0, width, height);
6259
+ return new Promise(
6260
+ (resolve, reject) => canvas.toBlob((blob) => blob ? resolve(blob) : reject(new Error("png encoding failed")), "image/png")
6261
+ );
6262
+ }
6263
+ async function saveFile(blob, name) {
6264
+ const file = new File([blob], name, { type: blob.type });
6265
+ const touch = typeof window.matchMedia === "function" && window.matchMedia("(pointer: coarse)").matches;
6266
+ if (touch && navigator.canShare?.({ files: [file] })) {
6267
+ try {
6268
+ await navigator.share({ files: [file] });
6269
+ return "saved";
6270
+ } catch (error) {
6271
+ if (error.name === "AbortError") return "dismissed";
6272
+ }
6273
+ }
6274
+ const url = URL.createObjectURL(blob);
6275
+ const link = document.createElement("a");
6276
+ link.href = url;
6277
+ link.download = name;
6278
+ document.body.appendChild(link);
6279
+ link.click();
6280
+ link.remove();
6281
+ setTimeout(() => URL.revokeObjectURL(url), 1e4);
6282
+ return "saved";
6283
+ }
6284
+ function SaveQrButton({
6285
+ image,
6286
+ fileName,
6287
+ labels
6288
+ }) {
6289
+ const [state, setState] = useState("idle");
6290
+ const timer = useRef(null);
6291
+ useEffect(
6292
+ () => () => {
6293
+ if (timer.current) clearTimeout(timer.current);
6294
+ },
6295
+ []
6296
+ );
6297
+ async function save() {
6298
+ setState("saving");
6299
+ try {
6300
+ const blob = await scannableFile(image);
6301
+ const extension = blob.type === "image/jpeg" ? "jpg" : "png";
6302
+ const outcome = await saveFile(blob, `${fileName}.${extension}`);
6303
+ setState(outcome === "saved" ? "saved" : "idle");
6304
+ } catch {
6305
+ setState("failed");
6306
+ }
6307
+ if (timer.current) clearTimeout(timer.current);
6308
+ timer.current = setTimeout(() => setState("idle"), 2500);
6309
+ }
6310
+ return /* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-btn-secondary pollar-ramp-save-qr", disabled: state === "saving", onClick: save, children: [
6311
+ /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx(
6312
+ "path",
6313
+ {
6314
+ d: "M8 2v8m0 0 3-3m-3 3L5 7M3 12.5h10",
6315
+ stroke: "currentColor",
6316
+ strokeWidth: "1.6",
6317
+ strokeLinecap: "round",
6318
+ strokeLinejoin: "round"
6319
+ }
6320
+ ) }),
6321
+ state === "saving" ? labels.saving : state === "saved" ? labels.saved : state === "failed" ? labels.failed : labels.save
6322
+ ] });
6323
+ }
6041
6324
  function scannableImageSrc(image) {
6042
6325
  return image.encoding === "base64" ? `data:${image.mediaType};base64,${image.data}` : `data:${image.mediaType};charset=utf-8,${encodeURIComponent(image.data)}`;
6043
6326
  }
@@ -6169,7 +6452,10 @@ function RampWidgetTemplate({
6169
6452
  onRefresh,
6170
6453
  onClose,
6171
6454
  language: languageProp,
6172
- confirmation = null
6455
+ confirmation = null,
6456
+ onCancelOrder,
6457
+ cancelling = false,
6458
+ cancelError = null
6173
6459
  }) {
6174
6460
  const language = useInheritedLanguage(languageProp);
6175
6461
  const cssVars = buildModalCssVars(theme, accentColor, styleOverrides, "hero");
@@ -6177,6 +6463,12 @@ function RampWidgetTemplate({
6177
6463
  const onramp = direction === "ONRAMP";
6178
6464
  const sendUnit = onramp ? fiat?.currency : asset?.code;
6179
6465
  const [detailsOpen, setDetailsOpen] = useState(false);
6466
+ const [viewing, setViewing] = useState(null);
6467
+ const [leaving, setLeaving] = useState(false);
6468
+ useEffect(() => {
6469
+ setViewing(null);
6470
+ setLeaving(false);
6471
+ }, [order?.id]);
6180
6472
  const routeName = (quote) => quote.legs.map((leg) => rampLegTitle(leg, language)).join(" \xB7 ");
6181
6473
  const rate = (() => {
6182
6474
  if (!chosenQuote) return null;
@@ -6248,7 +6540,6 @@ function RampWidgetTemplate({
6248
6540
  ] : [];
6249
6541
  const running = order?.legs.find((leg) => rampLegStatus(leg) === "active" && order.pendingAction?.legIndex !== leg.index);
6250
6542
  const now = useNowEverySecond(step === "status" && !settled && !!running && running.etaSeconds !== null);
6251
- const nextApproval = order && !settled ? rampNextApproval(order, language) : null;
6252
6543
  const stopped = order ? rampOrderStopped(order) : false;
6253
6544
  const receive = order ? rampOrderReceive(order) : null;
6254
6545
  const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
@@ -6256,12 +6547,56 @@ function RampWidgetTemplate({
6256
6547
  const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
6257
6548
  useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
6258
6549
  const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
6550
+ const screens = order ? rampOrderScreens(order, language) : [];
6551
+ const completed = order?.state === "completed";
6552
+ const firstOpen = screens.findIndex((s) => s.status !== "done");
6553
+ const currentScreen = completed ? screens.length : firstOpen === -1 ? Math.max(0, screens.length - 1) : firstOpen;
6554
+ const shownScreen = viewing !== null && viewing < currentScreen ? viewing : currentScreen;
6555
+ const shown = screens[shownScreen];
6556
+ const askedInstead = order?.pendingAction?.kind === "KYC" || !!shown?.key.endsWith(":pay") && order?.pendingAction?.legIndex === shown.leg.index && !["FIAT_PAYMENT", "NONE"].includes(order.pendingAction.kind);
6557
+ const firstLeg = order?.legs[0];
6558
+ const payment = order?.pendingAction?.kind === "FIAT_PAYMENT" ? order.pendingAction.instructions : null;
6559
+ const qrFileName = [copy.screens.qrFile, payment?.amount, payment?.currency, order?.id.slice(-8)].filter(Boolean).join("-");
6560
+ 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;
6561
+ const lastLeg = order?.legs[order.legs.length - 1];
6562
+ const arrivedText = lastLeg?.to.kind === "asset" ? copy.screens.arrived(CHAIN_NAME[lastLeg.to.chain] ?? lastLeg.to.chain) : copy.screens.paidOut;
6563
+ const requestClose = () => step === "status" && order && !settled ? setLeaving(true) : onClose();
6564
+ const cancellable = !!order && !settled && order.pendingAction?.kind !== "COSIGN_APPROVAL" && order.legs.every((leg) => leg.status !== "COMPLETED" && leg.status !== "HELD" && leg.paymentStatus !== "received");
6565
+ const doneText = (screen) => {
6566
+ const leg = screen.leg;
6567
+ const unit = (node) => node.kind === "fiat" ? node.currency : node.code;
6568
+ const inAmount = amountText(leg.amountInActual ?? leg.amountInPlanned, language);
6569
+ const outAmount = amountText(leg.amountOutActual ?? leg.amountOutPlanned, language);
6570
+ if (screen.key.endsWith(":pay"))
6571
+ return leg.kind === "PROVIDER_ONRAMP" ? copy.screens.paidDone(inAmount, unit(leg.from)) : copy.screens.sentDone(inAmount, unit(leg.from));
6572
+ if (screen.key.endsWith(":deliver"))
6573
+ return leg.to.kind === "asset" ? copy.screens.receivedDone(outAmount, leg.to.code, CHAIN_NAME[leg.to.chain] ?? leg.to.chain) : copy.screens.payoutDone(outAmount, leg.to.currency);
6574
+ return screen.kind === "action" ? copy.screens.signedDone : copy.screens.ranDone;
6575
+ };
6576
+ const finalNote = order?.legs.map((leg) => rampLegNote(leg, language)).find((note) => note !== null) ?? null;
6577
+ const screenRows = (screen) => screen.steps.length ? screen.steps.flatMap(
6578
+ (st) => st.hash ? [
6579
+ {
6580
+ label: rampStepTitle(st, screen.leg, language),
6581
+ value: shortHash(st.hash),
6582
+ href: explorerTxUrl2(stepChain(st.kind, screen.leg), st.hash, network),
6583
+ copyValue: st.hash
6584
+ }
6585
+ ] : []
6586
+ ) : screen.leg.onchainTxHash && !screen.key.endsWith(":pay") ? [
6587
+ {
6588
+ label: rampLegTitle(screen.leg, language),
6589
+ value: shortHash(screen.leg.onchainTxHash),
6590
+ href: explorerTxUrl2(legChain(screen.leg), screen.leg.onchainTxHash, network),
6591
+ copyValue: screen.leg.onchainTxHash
6592
+ }
6593
+ ] : [];
6259
6594
  const stepTitle = {
6260
6595
  input: onramp ? copy.title.buy : copy.title.sell,
6261
6596
  loading_quote: copy.title.finding,
6262
6597
  select_route: copy.title.chooseRoute,
6263
6598
  contact: copy.title.details,
6264
- status: order?.state === "completed" ? copy.title.completed : onramp ? copy.title.purchase : copy.title.sale,
6599
+ status: onramp ? copy.title.purchase : copy.title.sale,
6265
6600
  error: copy.title.error
6266
6601
  };
6267
6602
  const stepSubtitle = {
@@ -6274,7 +6609,7 @@ function RampWidgetTemplate({
6274
6609
  copy
6275
6610
  )
6276
6611
  ),
6277
- status: view?.title ?? copy.subtitle.processing,
6612
+ status: orderSummary ?? copy.subtitle.processing,
6278
6613
  error: copy.subtitle.error
6279
6614
  };
6280
6615
  return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
@@ -6325,7 +6660,7 @@ function RampWidgetTemplate({
6325
6660
  )
6326
6661
  }
6327
6662
  ),
6328
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
6663
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: requestClose, "aria-label": copy.close, children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })
6329
6664
  ] })
6330
6665
  ] }),
6331
6666
  flowStepIndex >= 0 && flowSteps.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-steps", children: [
@@ -6345,6 +6680,41 @@ function RampWidgetTemplate({
6345
6680
  }
6346
6681
  ) }, label)) })
6347
6682
  ] }),
6683
+ step === "status" && screens.length > 0 && !(leaving && !settled) && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-screens-nav", children: [
6684
+ /* @__PURE__ */ jsx(
6685
+ "button",
6686
+ {
6687
+ type: "button",
6688
+ className: "pollar-ramp-screens-arrow",
6689
+ "data-hidden": shownScreen === 0 || void 0,
6690
+ disabled: shownScreen === 0,
6691
+ onClick: () => setViewing(shownScreen - 1),
6692
+ "aria-label": copy.back,
6693
+ 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" }) })
6694
+ }
6695
+ ),
6696
+ /* @__PURE__ */ jsx("ol", { className: "pollar-ramp-screens-bar", "aria-label": copy.progress, children: [...screens.map((s) => s.key), "final"].map((key, i) => /* @__PURE__ */ jsx(
6697
+ "li",
6698
+ {
6699
+ "data-done": i < currentScreen || completed && i === screens.length || void 0,
6700
+ "data-shown": i === shownScreen || void 0,
6701
+ "data-failed": screens[i]?.status === "failed" || void 0
6702
+ },
6703
+ key
6704
+ )) }),
6705
+ /* @__PURE__ */ jsx(
6706
+ "button",
6707
+ {
6708
+ type: "button",
6709
+ className: "pollar-ramp-screens-arrow",
6710
+ "data-hidden": shownScreen >= currentScreen || void 0,
6711
+ disabled: shownScreen >= currentScreen,
6712
+ onClick: () => setViewing(shownScreen + 1 >= currentScreen ? null : shownScreen + 1),
6713
+ "aria-label": copy.screens.next,
6714
+ children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m6 3 5 5-5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
6715
+ }
6716
+ )
6717
+ ] }),
6348
6718
  step === "input" && pendingOrders.length > 0 && /* @__PURE__ */ jsxs("section", { className: "pollar-ramp-payment pollar-ramp-saved", "aria-label": copy.pendingAria, children: [
6349
6719
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.pendingNote }),
6350
6720
  pendingOrders.map((pending) => /* @__PURE__ */ jsx("div", { className: "pollar-ramp-saved-row", children: /* @__PURE__ */ jsx(
@@ -6632,37 +7002,84 @@ function RampWidgetTemplate({
6632
7002
  }
6633
7003
  ) })
6634
7004
  ] }),
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
- ] })
7005
+ step === "status" && order && view && /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment", children: leaving && !settled ? /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-leave", children: [
7006
+ /* @__PURE__ */ jsx("h3", { className: "pollar-ramp-screen-title", children: copy.leave.title }),
7007
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.leave.note }),
7008
+ cancelError && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-field-error", children: cancelError }),
7009
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: () => setLeaving(false), children: copy.leave.stay }),
7010
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onClose, children: copy.leave.exit }),
7011
+ /* @__PURE__ */ jsx(
7012
+ "button",
7013
+ {
7014
+ type: "button",
7015
+ className: "pollar-ramp-leave-link",
7016
+ onClick: () => {
7017
+ setLeaving(false);
7018
+ onNewOrder();
7019
+ },
7020
+ children: copy.startAnother
7021
+ }
7022
+ ),
7023
+ onCancelOrder && cancellable && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-ramp-leave-cancel", disabled: cancelling, onClick: onCancelOrder, children: cancelling ? /* @__PURE__ */ jsxs(Fragment, { children: [
7024
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm" }),
7025
+ " ",
7026
+ copy.leave.cancelling
7027
+ ] }) : copy.leave.cancel })
7028
+ ] }) : shownScreen === screens.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
7029
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-final", children: [
7030
+ /* @__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(
7031
+ "path",
7032
+ {
7033
+ d: "M3 8.5 6.5 12 13 4.5",
7034
+ stroke: "currentColor",
7035
+ strokeWidth: "2",
7036
+ strokeLinecap: "round",
7037
+ strokeLinejoin: "round"
7038
+ }
7039
+ ) }) }),
7040
+ receive && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-final-amount", children: copy.screens.received(`${amountText(receive.amount, language)} ${receive.unit}`) }),
7041
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: arrivedText }),
7042
+ finalNote && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: finalNote })
6665
7043
  ] }),
7044
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onClose, children: copy.screens.finish }),
7045
+ /* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: orderRows }, language })
7046
+ ] }) : shownScreen < currentScreen ? /* @__PURE__ */ jsxs(Fragment, { children: [
7047
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-done", children: [
7048
+ /* @__PURE__ */ jsx("span", { className: "pollar-ramp-done-mark", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { width: "30", height: "30", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
7049
+ "path",
7050
+ {
7051
+ d: "M3 8.5 6.5 12 13 4.5",
7052
+ stroke: "currentColor",
7053
+ strokeWidth: "2",
7054
+ strokeLinecap: "round",
7055
+ strokeLinejoin: "round"
7056
+ }
7057
+ ) }) }),
7058
+ /* @__PURE__ */ jsx("h3", { className: "pollar-ramp-done-title", children: screens[shownScreen].title }),
7059
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: doneText(screens[shownScreen]) })
7060
+ ] }),
7061
+ screenRows(screens[shownScreen]).length > 0 && /* @__PURE__ */ jsx(TxReview, { data: { title: "", kind: "other", rows: screenRows(screens[shownScreen]) }, language })
7062
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
7063
+ shown && /* @__PURE__ */ jsx("h3", { className: "pollar-ramp-screen-title", "data-status": shown.status, children: askedInstead ? view.title : shown.title }),
7064
+ shown?.status === "failed" && shown.leg.failure && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-field-error", children: rampFailureReason(shown.leg.failure, language) }),
7065
+ shown?.preparing && !settled && !order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-wait", children: [
7066
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
7067
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.preparing })
7068
+ ] }),
7069
+ shown?.kind === "wait" && !settled && !order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-wait", children: [
7070
+ /* @__PURE__ */ jsx("span", { className: "pollar-spinner", "aria-label": copy.inProgress }),
7071
+ rampLegTimeLeft(shown.leg, now) !== null && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-leg-eta", children: copy.timeLeft(rampLegTimeLeft(shown.leg, now)) }),
7072
+ rampLegNote(shown.leg, language) && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampLegNote(shown.leg, language) }),
7073
+ /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.screens.updatesItself })
7074
+ ] }),
7075
+ 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: [
7076
+ /* @__PURE__ */ jsx("span", { className: "pollar-ramp-step-title", children: rampStepTitle(s, shown.leg, language) }),
7077
+ /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-step-state", children: [
7078
+ s.status === "confirming" && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
7079
+ rampStepStatusText(s, language)
7080
+ ] })
7081
+ ] }, s.kind)) }),
7082
+ confirmation && /* @__PURE__ */ jsx(InlineConfirm, { confirmation, language, network }),
6666
7083
  order.failure && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
6667
7084
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: copy.whatToDo }),
6668
7085
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampOrderResolutionText(order, language) }),
@@ -6702,7 +7119,20 @@ function RampWidgetTemplate({
6702
7119
  alt: copy.paymentQr,
6703
7120
  style: { width: "100%", maxWidth: 220, height: "auto", display: "block", margin: "0 auto" }
6704
7121
  }
6705
- ) })
7122
+ ) }),
7123
+ /* @__PURE__ */ jsx(
7124
+ SaveQrButton,
7125
+ {
7126
+ image: view.scannable.image,
7127
+ fileName: qrFileName,
7128
+ labels: {
7129
+ save: copy.screens.saveQr,
7130
+ saving: copy.screens.savingQr,
7131
+ saved: copy.screens.savedQr,
7132
+ failed: copy.screens.saveQrFailed
7133
+ }
7134
+ }
7135
+ )
6706
7136
  ] }),
6707
7137
  !settled && view.codeMissing && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", style: { color: "var(--pollar-error-text)" }, children: copy.codeMissing }),
6708
7138
  !settled && view.scannable?.payload && view.scannable.payloadLabel && /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
@@ -6723,7 +7153,14 @@ function RampWidgetTemplate({
6723
7153
  /* @__PURE__ */ jsx("span", { className: "pollar-ramp-payment-label", children: view.pasteCode.label }),
6724
7154
  /* @__PURE__ */ jsx("div", { className: "pollar-ramp-payment-value", children: /* @__PURE__ */ jsxs("span", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
6725
7155
  /* @__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 })
7156
+ /* @__PURE__ */ jsx(
7157
+ CopyButton,
7158
+ {
7159
+ value: view.pasteCode.value,
7160
+ label: copy.copyLabel(view.pasteCode.label),
7161
+ language
7162
+ }
7163
+ )
6727
7164
  ] }) })
6728
7165
  ] }),
6729
7166
  !settled && view.details.map((d) => /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-payment-field", children: [
@@ -6754,12 +7191,8 @@ function RampWidgetTemplate({
6754
7191
  ),
6755
7192
  !settled && order.pendingAction?.kind === "KYC" && !view.link && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: view.note ?? copy.providerReviewing }),
6756
7193
  pollTrouble && !settled && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.serverTrouble }),
6757
- 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
- ] }),
7194
+ errorMsg && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-field-error", children: errorMsg })
7195
+ ] }) }),
6763
7196
  step === "error" && /* @__PURE__ */ jsxs(Fragment, { children: [
6764
7197
  /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: errorMsg ?? copy.somethingWrong }),
6765
7198
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-actions", children: [
@@ -7481,6 +7914,8 @@ function RampWidget({ onClose, language: languageProp, initial }) {
7481
7914
  const [trustingAsset, setTrustingAsset] = useState(null);
7482
7915
  const [walletBusy, setWalletBusy] = useState(null);
7483
7916
  const [retrying, setRetrying] = useState(false);
7917
+ const [cancelling, setCancelling] = useState(false);
7918
+ const [cancelError, setCancelError] = useState(null);
7484
7919
  const [awaitingAccount, setAwaitingAccount] = useState(null);
7485
7920
  const [pollTrouble, setPollTrouble] = useState(false);
7486
7921
  const [pollKey, setPollKey] = useState(0);
@@ -7892,6 +8327,19 @@ function RampWidget({ onClose, language: languageProp, initial }) {
7892
8327
  setRetrying(false);
7893
8328
  }
7894
8329
  }
8330
+ async function handleCancelOrder() {
8331
+ if (!order || cancelling) return;
8332
+ setCancelling(true);
8333
+ setCancelError(null);
8334
+ try {
8335
+ setOrder(await client.cancelRampOrder(order.id));
8336
+ void loadPendingOrders();
8337
+ } catch (error) {
8338
+ setCancelError(rampErrorMessage(error, copy.cancelOrderFailed, copy, language));
8339
+ } finally {
8340
+ setCancelling(false);
8341
+ }
8342
+ }
7895
8343
  async function handleRequote() {
7896
8344
  setOrder(null);
7897
8345
  await handleFindRoute();
@@ -7924,8 +8372,7 @@ function RampWidget({ onClose, language: languageProp, initial }) {
7924
8372
  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
8373
  const stepLabel = {
7926
8374
  select_route: copy.steps.route,
7927
- contact: copy.steps.details,
7928
- status: copy.steps.complete
8375
+ contact: copy.steps.details
7929
8376
  };
7930
8377
  const label = stepLabel[step];
7931
8378
  if (verifying) {
@@ -8063,7 +8510,10 @@ function RampWidget({ onClose, language: languageProp, initial }) {
8063
8510
  },
8064
8511
  onRefresh: () => void handleRefresh(),
8065
8512
  onClose,
8066
- confirmation
8513
+ confirmation,
8514
+ onCancelOrder: () => void handleCancelOrder(),
8515
+ cancelling,
8516
+ cancelError
8067
8517
  }
8068
8518
  ) });
8069
8519
  }
@@ -10330,8 +10780,6 @@ function SwapModal({ onClose, initial }) {
10330
10780
  void refreshAssets();
10331
10781
  }, [refreshWalletBalance, refreshAssets]);
10332
10782
  const loadConfig = useCallback(() => {
10333
- setVenues(null);
10334
- setSolanaVenues(null);
10335
10783
  return Promise.all([
10336
10784
  getSwapConfig().then(setVenues).catch(() => setVenues([])),
10337
10785
  // treat a failed config as "unavailable"
@@ -10469,10 +10917,12 @@ function SwapModal({ onClose, initial }) {
10469
10917
  setSelectedBuy(seeded);
10470
10918
  return;
10471
10919
  }
10472
- if (!selectedBuy || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10473
- setSelectedBuy(buyOptions[0]);
10920
+ const sellKey = selectedSell ? optKey(selectedSell) : "";
10921
+ if (!selectedBuy || optKey(selectedBuy) === sellKey || !buyOptions.some((o) => optKey(o) === optKey(selectedBuy))) {
10922
+ const next = buyOptions.find((o) => optKey(o) !== sellKey) ?? null;
10923
+ if (next !== selectedBuy) setSelectedBuy(next);
10474
10924
  }
10475
- }, [buyOptions, selectedBuy, isLoadingData]);
10925
+ }, [buyOptions, selectedBuy, selectedSell, isLoadingData]);
10476
10926
  function addCustomToken(code, issuer) {
10477
10927
  const c = code.trim().toUpperCase();
10478
10928
  const i = issuer.trim();
@@ -10532,8 +10982,13 @@ function SwapModal({ onClose, initial }) {
10532
10982
  };
10533
10983
  }, [quotedSolana, step]);
10534
10984
  useEffect(() => {
10535
- if (chains.length > 0 && !chains.includes(chain)) setChain(chains[0]);
10536
- }, [chains, chain]);
10985
+ if (configLoading) return;
10986
+ if (chains.length === 0 || chains.includes(chain)) return;
10987
+ setChain(chains[0]);
10988
+ setProvider("auto");
10989
+ setQuotes([]);
10990
+ setSolanaQuotes([]);
10991
+ }, [chains, chain, configLoading]);
10537
10992
  function handleChainChange(next) {
10538
10993
  sellSeed.current = void 0;
10539
10994
  buySeed.current = void 0;
@@ -13995,6 +14450,7 @@ var COSIGN_COPY = {
13995
14450
  approve: "Approve",
13996
14451
  approving: "Approving...",
13997
14452
  genericError: "Something went wrong. Please try again.",
14453
+ unreachable: "We could not reach Pollar, so nothing was approved. Check your connection and approve again.",
13998
14454
  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
14455
  linkDevice: "Link this device",
14000
14456
  transaction: "Transaction",
@@ -14048,6 +14504,7 @@ var COSIGN_COPY = {
14048
14504
  approve: "Aprobar",
14049
14505
  approving: "Aprobando...",
14050
14506
  genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
14507
+ unreachable: "No pudimos conectar con Pollar, as\xED que no se aprob\xF3 nada. Revisa tu conexi\xF3n y aprueba de nuevo.",
14051
14508
  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
14509
  linkDevice: "Vincular este dispositivo",
14053
14510
  transaction: "Transacci\xF3n",
@@ -14101,6 +14558,7 @@ var COSIGN_COPY = {
14101
14558
  approve: "Aprovar",
14102
14559
  approving: "Aprovando...",
14103
14560
  genericError: "Algo deu errado. Tente novamente.",
14561
+ unreachable: "N\xE3o conseguimos conectar \xE0 Pollar, ent\xE3o nada foi aprovado. Verifique sua conex\xE3o e aprove novamente.",
14104
14562
  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
14563
  linkDevice: "Vincular este dispositivo",
14106
14564
  transaction: "Transa\xE7\xE3o",
@@ -14454,6 +14912,11 @@ function CosignModal({ nextStep = null, onClose }) {
14454
14912
  try {
14455
14913
  await action(request);
14456
14914
  } catch (err) {
14915
+ if (isPollarNetworkError(err) || err instanceof TypeError) {
14916
+ setError(COSIGN_COPY[language].unreachable);
14917
+ void refresh().catch(() => void 0);
14918
+ return;
14919
+ }
14457
14920
  setError(
14458
14921
  transactionErrorMessage(isPollarApiError(err) ? err.code : null, err instanceof Error ? err.message : null, language)
14459
14922
  );
@@ -14463,7 +14926,7 @@ function CosignModal({ nextStep = null, onClose }) {
14463
14926
  setBusy(null);
14464
14927
  }
14465
14928
  },
14466
- []
14929
+ [language, refresh]
14467
14930
  );
14468
14931
  return /* @__PURE__ */ jsx(PollarOverlay, { style: overlayStyle, children: /* @__PURE__ */ jsx(
14469
14932
  CosignModalTemplate,
@@ -14694,6 +15157,9 @@ var RECOVERY_COPY = {
14694
15157
  acceptRisks: "I understand and accept these risks",
14695
15158
  recoverEmailIntro: (address) => `We'll email a code to ${address}. The code goes straight to the wallet provider, encrypted on this device.`,
14696
15159
  sendCode: "Send code",
15160
+ sendCodeIn: (seconds) => `Send code in ${seconds}s`,
15161
+ resendCode: "Send a new code",
15162
+ resendCodeIn: (seconds) => `Send a new code in ${seconds}s`,
14697
15163
  recover: "Recover",
14698
15164
  back: "Back",
14699
15165
  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 +15212,9 @@ var RECOVERY_COPY = {
14746
15212
  acceptRisks: "Entiendo y acepto estos riesgos",
14747
15213
  recoverEmailIntro: (address) => `Te enviaremos un c\xF3digo a ${address}. El c\xF3digo va directo al proveedor de la billetera, cifrado en este dispositivo.`,
14748
15214
  sendCode: "Enviar c\xF3digo",
15215
+ sendCodeIn: (seconds) => `Enviar c\xF3digo en ${seconds} s`,
15216
+ resendCode: "Enviar otro c\xF3digo",
15217
+ resendCodeIn: (seconds) => `Enviar otro c\xF3digo en ${seconds} s`,
14749
15218
  recover: "Recuperar",
14750
15219
  back: "Atr\xE1s",
14751
15220
  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 +15267,9 @@ var RECOVERY_COPY = {
14798
15267
  acceptRisks: "Entendo e aceito esses riscos",
14799
15268
  recoverEmailIntro: (address) => `Vamos enviar um c\xF3digo para ${address}. O c\xF3digo vai direto para o provedor da carteira, criptografado neste dispositivo.`,
14800
15269
  sendCode: "Enviar c\xF3digo",
15270
+ sendCodeIn: (seconds) => `Enviar c\xF3digo em ${seconds} s`,
15271
+ resendCode: "Enviar outro c\xF3digo",
15272
+ resendCodeIn: (seconds) => `Enviar outro c\xF3digo em ${seconds} s`,
14801
15273
  recover: "Recuperar",
14802
15274
  back: "Voltar",
14803
15275
  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 +15425,25 @@ function RecoveryModalTemplate(p) {
14953
15425
  copy,
14954
15426
  busy: p.busy,
14955
15427
  id: "recover-send",
14956
- label: copy.sendCode,
15428
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14957
15429
  kind: "primary",
14958
- onClick: p.onSendRecoveryCode
15430
+ onClick: p.onSendRecoveryCode,
15431
+ disabled: p.sendWaitSeconds > 0
14959
15432
  }
14960
- ) : /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15433
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
15434
+ /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "recover-code", label: copy.recover, onSubmit: p.onRecoverWithCode }),
15435
+ /* @__PURE__ */ jsx(
15436
+ Button,
15437
+ {
15438
+ copy,
15439
+ busy: p.busy,
15440
+ id: "recover-send",
15441
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15442
+ onClick: p.onSendRecoveryCode,
15443
+ disabled: p.sendWaitSeconds > 0
15444
+ }
15445
+ )
15446
+ ] }),
14961
15447
  /* @__PURE__ */ jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
14962
15448
  ] });
14963
15449
  } else if (p.view === "email") {
@@ -14969,7 +15455,7 @@ function RecoveryModalTemplate(p) {
14969
15455
  className: "pollar-recovery-row",
14970
15456
  onSubmit: (e) => {
14971
15457
  e.preventDefault();
14972
- p.onSendEmailCode();
15458
+ if (!p.sendWaitSeconds) p.onSendEmailCode();
14973
15459
  },
14974
15460
  children: [
14975
15461
  /* @__PURE__ */ jsx(
@@ -14989,15 +15475,28 @@ function RecoveryModalTemplate(p) {
14989
15475
  copy,
14990
15476
  busy: p.busy,
14991
15477
  id: "email-send",
14992
- label: copy.sendCode,
15478
+ label: p.sendWaitSeconds ? copy.sendCodeIn(p.sendWaitSeconds) : copy.sendCode,
14993
15479
  kind: "primary",
14994
15480
  onClick: p.onSendEmailCode,
14995
- disabled: !p.emailDraft.trim()
15481
+ disabled: !p.emailDraft.trim() || p.sendWaitSeconds > 0
14996
15482
  }
14997
15483
  )
14998
15484
  ]
14999
15485
  }
15000
- ) : /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15486
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
15487
+ /* @__PURE__ */ jsx(CodeForm, { copy, busy: p.busy, id: "email-confirm", label: copy.confirm, onSubmit: p.onConfirmEmail }),
15488
+ /* @__PURE__ */ jsx(
15489
+ Button,
15490
+ {
15491
+ copy,
15492
+ busy: p.busy,
15493
+ id: "email-send",
15494
+ label: p.sendWaitSeconds ? copy.resendCodeIn(p.sendWaitSeconds) : copy.resendCode,
15495
+ onClick: p.onSendEmailCode,
15496
+ disabled: p.sendWaitSeconds > 0
15497
+ }
15498
+ )
15499
+ ] }),
15001
15500
  /* @__PURE__ */ jsx(Button, { copy, busy: p.busy, id: "back", label: copy.back, onClick: () => p.onView("overview") })
15002
15501
  ] });
15003
15502
  } else if (p.view === "export") {
@@ -15140,6 +15639,7 @@ function RecoveryModal({ onClose }) {
15140
15639
  const [emailDraft, setEmailDraft] = useState("");
15141
15640
  const [codeSent, setCodeSent] = useState(false);
15142
15641
  const [phrase, setPhrase] = useState(null);
15642
+ const [now, setNow] = useState(() => Date.now());
15143
15643
  const load = useCallback(async () => {
15144
15644
  const client = getClient();
15145
15645
  const [nextState, nextDevices, key] = await Promise.all([
@@ -15182,6 +15682,14 @@ function RecoveryModal({ onClose }) {
15182
15682
  },
15183
15683
  [load]
15184
15684
  );
15685
+ const codeEmail = view === "recover-email" ? state?.email.address ?? "" : emailDraft.trim();
15686
+ const codeAvailableAt = codeEmail ? recovery.codeAvailableAt(codeEmail) : 0;
15687
+ const sendWaitSeconds = codeAvailableAt > now ? Math.ceil((codeAvailableAt - now) / 1e3) : 0;
15688
+ useEffect(() => {
15689
+ if (!codeAvailableAt) return;
15690
+ const timer = setInterval(() => setNow(Date.now()), 1e3);
15691
+ return () => clearInterval(timer);
15692
+ }, [codeAvailableAt]);
15185
15693
  const enrolled = !!thisDeviceKey && !!devices?.devices.some((d) => d.publicKey.toLowerCase() === thisDeviceKey);
15186
15694
  const [awaitingApproval, setAwaitingApproval] = useState(false);
15187
15695
  useEffect(() => {
@@ -15216,6 +15724,7 @@ function RecoveryModal({ onClose }) {
15216
15724
  notice,
15217
15725
  emailDraft,
15218
15726
  codeSent,
15727
+ sendWaitSeconds,
15219
15728
  phrase,
15220
15729
  onView: (next) => {
15221
15730
  setError(null);
@@ -15228,8 +15737,12 @@ function RecoveryModal({ onClose }) {
15228
15737
  onAddPasskey: () => void run("passkey", () => recovery.addPasskey(), { notice: copy.passkeyAdded }),
15229
15738
  onRemovePasskey: (id) => void run(`passkey:${id}`, () => recovery.removePasskey(id)),
15230
15739
  onSendEmailCode: () => void run("email-send", async () => {
15231
- await recovery.startEmail(emailDraft.trim());
15232
- setCodeSent(true);
15740
+ try {
15741
+ await recovery.startEmail(emailDraft.trim());
15742
+ setCodeSent(true);
15743
+ } finally {
15744
+ setNow(Date.now());
15745
+ }
15233
15746
  }),
15234
15747
  onConfirmEmail: (code) => void run("email-confirm", () => recovery.confirmEmail(code.trim()), { notice: copy.emailConfirmed, view: "overview" }),
15235
15748
  onApproveDevice: (id) => void run(`approve:${id}`, () => recovery.approveDevice(id), { notice: copy.deviceAdded }),
@@ -15246,8 +15759,12 @@ function RecoveryModal({ onClose }) {
15246
15759
  notice: copy.recovered
15247
15760
  }),
15248
15761
  onSendRecoveryCode: () => void run("recover-send", async () => {
15249
- await recovery.startEmailRecovery();
15250
- setCodeSent(true);
15762
+ try {
15763
+ await recovery.startEmailRecovery();
15764
+ setCodeSent(true);
15765
+ } finally {
15766
+ setNow(Date.now());
15767
+ }
15251
15768
  }),
15252
15769
  onRecoverWithCode: (code) => void run("recover-code", () => recovery.recoverWithEmailCode(code.trim()), {
15253
15770
  notice: copy.recovered,
@@ -16470,31 +16987,58 @@ function PollarProvider({
16470
16987
  }, [pollarClient, hasSession, walletAddress, custodyMigrationTick]);
16471
16988
  const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(), [pollarClient, walletAddress]);
16472
16989
  const refreshAssets = useCallback(() => pollarClient.refreshAssets(), [pollarClient, walletAddress]);
16990
+ const clientMethods = useMemo(
16991
+ () => ({
16992
+ createWallet: (options) => pollarClient.createWallet(options),
16993
+ login: (options) => pollarClient.login(options),
16994
+ logout: () => pollarClient.logout(),
16995
+ buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
16996
+ signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
16997
+ signTx: (unsignedXdr) => pollarClient.signTx(unsignedXdr),
16998
+ submitTx: (signedXdr) => pollarClient.submitTx(signedXdr),
16999
+ buildAndSignAndSubmitTx: (operation, params, options) => pollarClient.buildAndSignAndSubmitTx(operation, params, options),
17000
+ runTx: (operation, params, options) => pollarClient.runTx(operation, params, options),
17001
+ sendPayment: (params) => pollarClient.sendPayment(params),
17002
+ setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
17003
+ getSwapConfig: () => pollarClient.getSwapConfig(),
17004
+ getSwapTokens: () => pollarClient.getSwapTokens(),
17005
+ getSwapQuote: (params) => pollarClient.getSwapQuote(params),
17006
+ swap: (quote, opts) => pollarClient.swap(quote, opts),
17007
+ getSolanaSwapConfig: () => pollarClient.getSolanaSwapConfig(),
17008
+ getSolanaSwapQuote: (params) => pollarClient.getSolanaSwapQuote(params),
17009
+ swapSolana: (quote, opts) => pollarClient.swapSolana(quote, opts),
17010
+ getSolanaSwapOptions: () => pollarClient.getSolanaSwapOptions(),
17011
+ getSwapStatus: (idempotencyKey) => pollarClient.getSwapStatus(idempotencyKey),
17012
+ getEarnProviders: () => pollarClient.getEarnProviders(),
17013
+ getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
17014
+ getEarnPosition: (params) => pollarClient.getEarnPosition(params),
17015
+ earnDeposit: (params) => pollarClient.earnDeposit(params),
17016
+ earnWithdraw: (params) => pollarClient.earnWithdraw(params),
17017
+ getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
17018
+ getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
17019
+ getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
17020
+ earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
17021
+ earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
17022
+ setNetwork: (network) => pollarClient.setNetwork(network)
17023
+ }),
17024
+ [pollarClient]
17025
+ );
16473
17026
  const contextValue = useMemo(() => {
16474
17027
  const styles = resolvedConfig.styles ?? {};
16475
17028
  return {
17029
+ ...clientMethods,
16476
17030
  // session
16477
17031
  wallet: pollarClient.getWallet(),
16478
17032
  wallets: pollarClient.getWallets(),
16479
17033
  isAuthenticated: hasSession,
16480
17034
  hasWallet: pollarClient.hasWallet(),
16481
- createWallet: (options) => pollarClient.createWallet(options),
16482
17035
  verified,
16483
17036
  // client
16484
17037
  getClient,
16485
17038
  // auth
16486
- login: (options) => pollarClient.login(options),
16487
- logout: () => pollarClient.logout(),
16488
17039
  openLoginModal: () => setLoginModalOpen(true),
16489
17040
  // transactions
16490
17041
  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
17042
  openTxModal: () => setTransactionModalOpen(true),
16499
17043
  // tx history
16500
17044
  txHistory,
@@ -16509,7 +17053,6 @@ function PollarProvider({
16509
17053
  // enabled assets
16510
17054
  enabledAssets,
16511
17055
  refreshAssets,
16512
- setTrustline: (asset, opts) => pollarClient.setTrustline(asset, opts),
16513
17056
  openEnabledAssetsModal: () => setEnabledAssetsModalOpen(true),
16514
17057
  // send / receive
16515
17058
  openSendModal: (options) => {
@@ -16523,15 +17066,6 @@ function PollarProvider({
16523
17066
  setReceiveModalOpen(true);
16524
17067
  },
16525
17068
  // 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
17069
  openSwapModal: (options) => {
16536
17070
  setSwapModalOptions(options);
16537
17071
  pollarClient.resetTransactionState();
@@ -16544,16 +17078,6 @@ function PollarProvider({
16544
17078
  setBridgeModalOpen(true);
16545
17079
  },
16546
17080
  // 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
17081
  openEarnModal: (options) => {
16558
17082
  setEarnModalOptions(options);
16559
17083
  pollarClient.resetTransactionState();
@@ -16585,7 +17109,6 @@ function PollarProvider({
16585
17109
  openDistributionRulesModal: () => setDistributionRulesModalOpen(true),
16586
17110
  // network
16587
17111
  network: networkState.step === "connected" ? networkState.network : "testnet",
16588
- setNetwork: (network) => pollarClient.setNetwork(network),
16589
17112
  // kyc
16590
17113
  openKycModal: (options = {}) => {
16591
17114
  setKycModalOptions(options);
@@ -16604,6 +17127,7 @@ function PollarProvider({
16604
17127
  adapters
16605
17128
  };
16606
17129
  }, [
17130
+ clientMethods,
16607
17131
  walletAddress,
16608
17132
  walletProvisioning,
16609
17133
  recovery,