uniport-sdk 0.0.5 → 0.0.7

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.
@@ -5,197 +5,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
 
6
6
  // src/components/UniportButton.tsx
7
7
 
8
- // src/core/config.ts
9
- var DEFAULT_HOSTED_BACKEND_URL = "https://uniport-backend-production.up.railway.app";
10
- var DEFAULT_REQUEST_TIMEOUT_MS = 2e4;
11
- function normalizeBackendUrl(url) {
12
- return url.replace(/\/+$/, "");
13
- }
14
- function getUniportConfig() {
15
- const backendUrl = DEFAULT_HOSTED_BACKEND_URL;
16
- return {
17
- backendUrl: normalizeBackendUrl(backendUrl),
18
- requestTimeoutMs: DEFAULT_REQUEST_TIMEOUT_MS
19
- };
20
- }
21
-
22
- // src/core/intents.ts
23
- var UniportError = class extends Error {
24
- constructor(params) {
25
- super(params.message);
26
- this.name = "UniportError";
27
- this.code = params.code;
28
- this.details = params.details;
29
- this.status = params.status;
30
- }
31
- };
32
- function isAbortError(error) {
33
- return error instanceof Error && error.name === "AbortError";
34
- }
35
- function extractDetailMessage(details) {
36
- if (typeof details === "string" && details.trim()) {
37
- return details;
38
- }
39
- if (Array.isArray(details)) {
40
- const firstString = details.find(
41
- (detail) => typeof detail === "string" && detail.trim().length > 0
42
- );
43
- return firstString;
44
- }
45
- if (typeof details === "object" && details !== null && "message" in details && typeof details.message === "string") {
46
- const message = details.message.trim();
47
- return message || void 0;
48
- }
49
- return void 0;
50
- }
51
- function toUniportError(body, fallback) {
52
- const detailMessage = extractDetailMessage(body.details);
53
- return new UniportError({
54
- code: body.code || fallback.code,
55
- message: detailMessage || body.message || fallback.message,
56
- details: body.details,
57
- status: fallback.status
58
- });
59
- }
60
- function createTimeoutSignal(timeoutMs, externalSignal) {
61
- const controller = new AbortController();
62
- let timedOut = false;
63
- const timeoutId = setTimeout(() => {
64
- timedOut = true;
65
- controller.abort();
66
- }, timeoutMs);
67
- const abortFromExternal = () => controller.abort();
68
- externalSignal?.addEventListener("abort", abortFromExternal, {
69
- once: true
70
- });
71
- return {
72
- signal: controller.signal,
73
- didTimeout: () => timedOut,
74
- cleanup: () => {
75
- clearTimeout(timeoutId);
76
- externalSignal?.removeEventListener("abort", abortFromExternal);
77
- }
78
- };
79
- }
80
- function toSmallestUnits(amount, decimals) {
81
- const [whole, fraction = ""] = amount.split(".");
82
- const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
83
- return `${whole}${paddedFraction}`.replace(/^0+/, "") || "0";
84
- }
85
- function generateDeadline(hoursFromNow = 1) {
86
- const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
87
- return deadline.toISOString();
88
- }
89
- async function getQuote(options) {
90
- const {
91
- originToken,
92
- destinationToken,
93
- amount,
94
- recipient,
95
- refundTo,
96
- slippageTolerance = 100,
97
- // 1% default
98
- swapType = "EXACT_INPUT",
99
- deadline,
100
- dry = false,
101
- referral = "uniport",
102
- signal
103
- } = options;
104
- const amountInSmallestUnits = toSmallestUnits(amount, originToken.decimals);
105
- const { backendUrl, requestTimeoutMs } = getUniportConfig();
106
- const { signal: requestSignal, cleanup, didTimeout } = createTimeoutSignal(
107
- requestTimeoutMs,
108
- signal
109
- );
110
- let response;
111
- try {
112
- response = await fetch(`${backendUrl}/api/quote`, {
113
- method: "POST",
114
- headers: { "Content-Type": "application/json" },
115
- signal: requestSignal,
116
- body: JSON.stringify({
117
- dry,
118
- swapType,
119
- slippageTolerance,
120
- originAsset: originToken.assetId,
121
- destinationAsset: destinationToken.assetId,
122
- amount: amountInSmallestUnits,
123
- refundTo,
124
- recipient,
125
- deadline: deadline?.toISOString() || generateDeadline(1),
126
- referral
127
- })
128
- });
129
- } catch (error) {
130
- cleanup();
131
- if (isAbortError(error)) {
132
- if (signal?.aborted && !didTimeout()) {
133
- throw error;
134
- }
135
- throw new UniportError({
136
- code: "REQUEST_TIMEOUT",
137
- message: "Quote request timed out"
138
- });
139
- }
140
- throw error;
141
- }
142
- cleanup();
143
- if (!response.ok) {
144
- const errorBody = await response.json().catch(() => ({}));
145
- throw toUniportError(errorBody, {
146
- code: "QUOTE_FAILED",
147
- message: "Quote failed.",
148
- status: response.status
149
- });
150
- }
151
- const data = await response.json();
152
- const quote = data.quote;
153
- return {
154
- depositAddress: quote.depositAddress || "",
155
- memo: quote.depositMemo,
156
- amountIn: quote.amountIn,
157
- amountOut: quote.amountOut,
158
- amountOutFormatted: quote.amountOutFormatted,
159
- amountOutUsd: quote.amountOutUsd,
160
- deadline: quote.deadline,
161
- timeWhenInactive: quote.timeWhenInactive,
162
- correlationId: data.correlationId
163
- };
164
- }
165
- async function getExecutionStatus(depositAddress, memo) {
166
- const { backendUrl, requestTimeoutMs } = getUniportConfig();
167
- const url = new URL(
168
- `${backendUrl}/api/status/${encodeURIComponent(depositAddress)}`
169
- );
170
- if (memo) {
171
- url.searchParams.set("memo", memo);
172
- }
173
- const { signal, cleanup } = createTimeoutSignal(requestTimeoutMs);
174
- let response;
175
- try {
176
- response = await fetch(url.toString(), { signal });
177
- } catch (error) {
178
- cleanup();
179
- if (isAbortError(error)) {
180
- throw new UniportError({
181
- code: "REQUEST_TIMEOUT",
182
- message: "Status check timed out"
183
- });
184
- }
185
- throw error;
186
- }
187
- cleanup();
188
- if (!response.ok) {
189
- const errorBody = await response.json().catch(() => ({}));
190
- throw toUniportError(errorBody, {
191
- code: "STATUS_CHECK_FAILED",
192
- message: "Status check failed.",
193
- status: response.status
194
- });
195
- }
196
- return await response.json();
197
- }
198
-
199
8
  // src/core/tokens.ts
200
9
  var TOKEN_ICONS = {
201
10
  // Stablecoins
@@ -272,7 +81,8 @@ var CHAIN_ICONS = {
272
81
  ltc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
273
82
  bch: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
274
83
  xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
275
- zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png"
84
+ zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
85
+ scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png"
276
86
  };
277
87
  var EVM_CHAINS = [
278
88
  "eth",
@@ -284,11 +94,16 @@ var EVM_CHAINS = [
284
94
  "bsc",
285
95
  "gnosis",
286
96
  "bera",
287
- "monad"
97
+ "monad",
98
+ "scroll"
288
99
  ];
289
100
  function isEvmChain(chain) {
290
101
  return EVM_CHAINS.includes(chain);
291
102
  }
103
+ var CHAINS_REQUIRING_MEMO = ["stellar"];
104
+ function needsMemoDeposit(chain) {
105
+ return CHAINS_REQUIRING_MEMO.includes(chain);
106
+ }
292
107
  var EXPLORER_TX_URLS = {
293
108
  eth: (h) => `https://etherscan.io/tx/${h}`,
294
109
  arb: (h) => `https://arbiscan.io/tx/${h}`,
@@ -314,7 +129,8 @@ var EXPLORER_TX_URLS = {
314
129
  ltc: (h) => `https://litecoinspace.org/tx/${h}`,
315
130
  bch: (h) => `https://blockchair.com/bitcoin-cash/transaction/${h}`,
316
131
  xrp: (h) => `https://xrpscan.com/tx/${h}`,
317
- zec: (h) => `https://blockchair.com/zcash/transaction/${h}`
132
+ zec: (h) => `https://blockchair.com/zcash/transaction/${h}`,
133
+ scroll: (h) => `https://scrollscan.com/tx/${h}`
318
134
  };
319
135
  function getExplorerTxUrl(chain, hash) {
320
136
  return EXPLORER_TX_URLS[chain]?.(hash);
@@ -379,6 +195,8 @@ var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
379
195
  var baseUSDC = createToken("base", "USDC", "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near", 6, "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913");
380
196
  var baseCbBTC = createToken("base", "cbBTC", "nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near", 8, "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf", { name: "baseCbBTC" });
381
197
  var baseBRETT = createToken("base", "BRETT", "nep141:base-0x532f27101965dd16442e59d40670faf5ebb142e4.omft.near", 18, "0x532f27101965dd16442e59d40670faf5ebb142e4");
198
+ var scrollETH = createToken("scroll", "ETH", "nep245:v2_1.omni.hot.tg:534352_11111111111111111111", 18);
199
+ var scrollUSDT = createToken("scroll", "USDT", "nep245:v2_1.omni.hot.tg:534352_4RG3Q2wFsMQmd45m5m89RjsLfupA", 6, "0xf55bec9cafdbe8730f096aa55dad6d22d44099df");
382
200
  var optimismETH = createToken("op", "ETH", "nep245:v2_1.omni.hot.tg:10_11111111111111111111", 18);
383
201
  var optimismUSDC = createToken("op", "USDC", "nep245:v2_1.omni.hot.tg:10_A2ewyUyDp6qsue1jqZsGypkCxRJ", 6, "0x0b2c639c533813f4aa9d7837caf62653d097ff85");
384
202
  var optimismUSDT = createToken("op", "USDT", "nep245:v2_1.omni.hot.tg:10_359RPSJVdTxwTJT9TyGssr2rFoWo", 6, "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58");
@@ -412,6 +230,8 @@ var aptosAPT = createToken("aptos", "APT", "nep141:aptos.omft.near", 8);
412
230
  var starknetSTRK = createToken("starknet", "STRK", "nep141:starknet.omft.near", 18);
413
231
  var berachainBERA = createToken("bera", "BERA", "nep141:bera.omft.near", 18);
414
232
  var zcashZEC = createToken("zec", "ZEC", "nep141:zec.omft.near", 8);
233
+ var stellarXLM = createToken("stellar", "XLM", "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz", 7);
234
+ var stellarUSDC = createToken("stellar", "USDC", "nep245:v2_1.omni.hot.tg:1100_111bzQBB65GxAPAVoxqmMcgYo5oS3txhqs1Uh1cgahKQUeTUq1TJu", 7, "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN");
415
235
  var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near", {
416
236
  name: "nearNEAR",
417
237
  aliases: ["nearwNEAR"]
@@ -419,11 +239,11 @@ var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near",
419
239
  var nearUSDC = createToken("near", "USDC", "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", 6, "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1");
420
240
  var nearUSDT = createToken("near", "USDT", "nep141:usdt.tether-token.near", 6, "usdt.tether-token.near");
421
241
  var CHAINS = {
422
- sui: {
423
- id: "sui",
424
- name: "Sui",
425
- icon: CHAIN_ICONS.sui,
426
- tokens: [suiSUI, suiUSDC]
242
+ stellar: {
243
+ id: "stellar",
244
+ name: "Stellar",
245
+ icon: CHAIN_ICONS.stellar,
246
+ tokens: [stellarXLM, stellarUSDC]
427
247
  },
428
248
  eth: {
429
249
  id: "eth",
@@ -443,6 +263,12 @@ var CHAINS = {
443
263
  icon: CHAIN_ICONS.base,
444
264
  tokens: [baseETH, baseUSDC, baseCbBTC, baseBRETT]
445
265
  },
266
+ sui: {
267
+ id: "sui",
268
+ name: "Sui",
269
+ icon: CHAIN_ICONS.sui,
270
+ tokens: [suiSUI, suiUSDC]
271
+ },
446
272
  op: {
447
273
  id: "op",
448
274
  name: "Optimism",
@@ -563,11 +389,11 @@ var CHAINS = {
563
389
  icon: CHAIN_ICONS.monad,
564
390
  tokens: []
565
391
  },
566
- stellar: {
567
- id: "stellar",
568
- name: "Stellar",
569
- icon: CHAIN_ICONS.stellar,
570
- tokens: []
392
+ scroll: {
393
+ id: "scroll",
394
+ name: "Scroll",
395
+ icon: CHAIN_ICONS.scroll,
396
+ tokens: [scrollETH, scrollUSDT]
571
397
  }
572
398
  };
573
399
  var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
@@ -580,6 +406,209 @@ function getSupportedChains() {
580
406
  return Object.values(CHAINS).filter((c) => c.tokens.length > 0);
581
407
  }
582
408
 
409
+ // src/core/config.ts
410
+ var DEFAULT_HOSTED_BACKEND_URL = "https://uniport-backend-production.up.railway.app";
411
+ var DEFAULT_REQUEST_TIMEOUT_MS = 2e4;
412
+ function normalizeBackendUrl(url) {
413
+ return url.replace(/\/+$/, "");
414
+ }
415
+ function getUniportConfig() {
416
+ const backendUrl = DEFAULT_HOSTED_BACKEND_URL;
417
+ return {
418
+ backendUrl: normalizeBackendUrl(backendUrl),
419
+ requestTimeoutMs: DEFAULT_REQUEST_TIMEOUT_MS
420
+ };
421
+ }
422
+
423
+ // src/core/intents.ts
424
+ var UniportError = class extends Error {
425
+ constructor(params) {
426
+ super(params.message);
427
+ this.name = "UniportError";
428
+ this.code = params.code;
429
+ this.details = params.details;
430
+ this.status = params.status;
431
+ }
432
+ };
433
+ function isAbortError(error) {
434
+ return error instanceof Error && error.name === "AbortError";
435
+ }
436
+ function extractDetailMessage(details) {
437
+ if (typeof details === "string" && details.trim()) {
438
+ return details;
439
+ }
440
+ if (Array.isArray(details)) {
441
+ const firstString = details.find(
442
+ (detail) => typeof detail === "string" && detail.trim().length > 0
443
+ );
444
+ return firstString;
445
+ }
446
+ if (typeof details === "object" && details !== null && "message" in details && typeof details.message === "string") {
447
+ const message = details.message.trim();
448
+ return message || void 0;
449
+ }
450
+ return void 0;
451
+ }
452
+ function toUniportError(body, fallback) {
453
+ const detailMessage = extractDetailMessage(body.details);
454
+ return new UniportError({
455
+ code: body.code || fallback.code,
456
+ message: detailMessage || body.message || fallback.message,
457
+ details: body.details,
458
+ status: fallback.status
459
+ });
460
+ }
461
+ function createTimeoutSignal(timeoutMs, externalSignal) {
462
+ const controller = new AbortController();
463
+ let timedOut = false;
464
+ const timeoutId = setTimeout(() => {
465
+ timedOut = true;
466
+ controller.abort();
467
+ }, timeoutMs);
468
+ const abortFromExternal = () => controller.abort();
469
+ externalSignal?.addEventListener("abort", abortFromExternal, {
470
+ once: true
471
+ });
472
+ return {
473
+ signal: controller.signal,
474
+ didTimeout: () => timedOut,
475
+ cleanup: () => {
476
+ clearTimeout(timeoutId);
477
+ externalSignal?.removeEventListener("abort", abortFromExternal);
478
+ }
479
+ };
480
+ }
481
+ function toSmallestUnits(amount, decimals) {
482
+ const [whole, fraction = ""] = amount.split(".");
483
+ const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
484
+ return `${whole}${paddedFraction}`.replace(/^0+/, "") || "0";
485
+ }
486
+ function generateDeadline(hoursFromNow = 1) {
487
+ const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
488
+ return deadline.toISOString();
489
+ }
490
+ function formatDisplayAmount(amount, significantDigits = 6) {
491
+ if (!amount) return amount ?? "";
492
+ const num = Number(amount);
493
+ if (!Number.isFinite(num) || num === 0) return amount;
494
+ const abs = Math.abs(num);
495
+ if (abs < 1e-6 || abs >= 1e21) return amount;
496
+ return new Intl.NumberFormat("en-US", {
497
+ maximumSignificantDigits: significantDigits,
498
+ useGrouping: false
499
+ }).format(num);
500
+ }
501
+ async function getQuote(options) {
502
+ const {
503
+ originToken,
504
+ destinationToken,
505
+ amount,
506
+ recipient,
507
+ refundTo,
508
+ slippageTolerance = 100,
509
+ // 1% default
510
+ swapType = "EXACT_INPUT",
511
+ deadline,
512
+ dry = false,
513
+ referral = "uniport",
514
+ signal
515
+ } = options;
516
+ const amountInSmallestUnits = toSmallestUnits(amount, originToken.decimals);
517
+ const { backendUrl, requestTimeoutMs } = getUniportConfig();
518
+ const { signal: requestSignal, cleanup, didTimeout } = createTimeoutSignal(
519
+ requestTimeoutMs,
520
+ signal
521
+ );
522
+ let response;
523
+ try {
524
+ response = await fetch(`${backendUrl}/api/quote`, {
525
+ method: "POST",
526
+ headers: { "Content-Type": "application/json" },
527
+ signal: requestSignal,
528
+ body: JSON.stringify({
529
+ dry,
530
+ swapType,
531
+ slippageTolerance,
532
+ depositMode: needsMemoDeposit(originToken.chain) ? "MEMO" : void 0,
533
+ originAsset: originToken.assetId,
534
+ destinationAsset: destinationToken.assetId,
535
+ amount: amountInSmallestUnits,
536
+ refundTo,
537
+ recipient,
538
+ deadline: deadline?.toISOString() || generateDeadline(1),
539
+ referral
540
+ })
541
+ });
542
+ } catch (error) {
543
+ cleanup();
544
+ if (isAbortError(error)) {
545
+ if (signal?.aborted && !didTimeout()) {
546
+ throw error;
547
+ }
548
+ throw new UniportError({
549
+ code: "REQUEST_TIMEOUT",
550
+ message: "Quote request timed out"
551
+ });
552
+ }
553
+ throw error;
554
+ }
555
+ cleanup();
556
+ if (!response.ok) {
557
+ const errorBody = await response.json().catch(() => ({}));
558
+ throw toUniportError(errorBody, {
559
+ code: "QUOTE_FAILED",
560
+ message: "Quote failed.",
561
+ status: response.status
562
+ });
563
+ }
564
+ const data = await response.json();
565
+ const quote = data.quote;
566
+ return {
567
+ depositAddress: quote.depositAddress || "",
568
+ memo: quote.depositMemo,
569
+ amountIn: quote.amountIn,
570
+ amountOut: quote.amountOut,
571
+ amountOutFormatted: quote.amountOutFormatted,
572
+ amountOutUsd: quote.amountOutUsd,
573
+ deadline: quote.deadline,
574
+ timeWhenInactive: quote.timeWhenInactive,
575
+ correlationId: data.correlationId
576
+ };
577
+ }
578
+ async function getExecutionStatus(depositAddress, memo) {
579
+ const { backendUrl, requestTimeoutMs } = getUniportConfig();
580
+ const url = new URL(
581
+ `${backendUrl}/api/status/${encodeURIComponent(depositAddress)}`
582
+ );
583
+ if (memo) {
584
+ url.searchParams.set("memo", memo);
585
+ }
586
+ const { signal, cleanup } = createTimeoutSignal(requestTimeoutMs);
587
+ let response;
588
+ try {
589
+ response = await fetch(url.toString(), { signal });
590
+ } catch (error) {
591
+ cleanup();
592
+ if (isAbortError(error)) {
593
+ throw new UniportError({
594
+ code: "REQUEST_TIMEOUT",
595
+ message: "Status check timed out"
596
+ });
597
+ }
598
+ throw error;
599
+ }
600
+ cleanup();
601
+ if (!response.ok) {
602
+ const errorBody = await response.json().catch(() => ({}));
603
+ throw toUniportError(errorBody, {
604
+ code: "STATUS_CHECK_FAILED",
605
+ message: "Status check failed.",
606
+ status: response.status
607
+ });
608
+ }
609
+ return await response.json();
610
+ }
611
+
583
612
  // src/core/ens.ts
584
613
  var ENSIDEAS_BASE_URL = "https://api.ensideas.com/ens/resolve";
585
614
  var UNIPORT_ENS_NAME = "uniport.eth";
@@ -1151,7 +1180,7 @@ function UniportModal({
1151
1180
  onError
1152
1181
  });
1153
1182
  const [modalStep, setModalStep] = useState("chain");
1154
- const [copied, setCopied] = useState(false);
1183
+ const [copiedField, setCopiedField] = useState(null);
1155
1184
  const [showReceipt, setShowReceipt] = useState(false);
1156
1185
  const [portalRoot, setPortalRoot] = useState(null);
1157
1186
  useEffect(() => {
@@ -1183,13 +1212,11 @@ function UniportModal({
1183
1212
  };
1184
1213
  }
1185
1214
  }, [open, handleClose]);
1186
- const handleCopy = useCallback(async () => {
1187
- if (payment.quote?.depositAddress) {
1188
- const ok = await payment.copyToClipboard(payment.quote.depositAddress);
1189
- if (ok) {
1190
- setCopied(true);
1191
- setTimeout(() => setCopied(false), 2e3);
1192
- }
1215
+ const handleCopy = useCallback(async (field, text) => {
1216
+ const ok = await payment.copyToClipboard(text);
1217
+ if (ok) {
1218
+ setCopiedField(field);
1219
+ setTimeout(() => setCopiedField(null), 2e3);
1193
1220
  }
1194
1221
  }, [payment]);
1195
1222
  if (!open || !portalRoot) return null;
@@ -1474,6 +1501,22 @@ function UniportModal({
1474
1501
  },
1475
1502
  children: payment.isUsingDefaultRefundAddress ? `Used only if the swap fails. You can enter your own address, or leave blank to use Uniport's default (${UNIPORT_ENS_NAME}).` : "Used only if the swap fails. This address must live on the chain the payer is sending from."
1476
1503
  }
1504
+ ),
1505
+ ch?.id === "stellar" && tok?.symbol !== "XLM" && /* @__PURE__ */ jsxs(
1506
+ "p",
1507
+ {
1508
+ style: {
1509
+ margin: "6px 0 0",
1510
+ fontSize: "12px",
1511
+ color: t.warning,
1512
+ lineHeight: 1.5
1513
+ },
1514
+ children: [
1515
+ "This refund address must already have a trustline for ",
1516
+ tok?.symbol,
1517
+ " on Stellar, or a refund cannot be delivered to it."
1518
+ ]
1519
+ }
1477
1520
  )
1478
1521
  ] }),
1479
1522
  /* @__PURE__ */ jsxs("div", { style: {
@@ -1496,7 +1539,7 @@ function UniportModal({
1496
1539
  "You will receive",
1497
1540
  " ",
1498
1541
  /* @__PURE__ */ jsxs("strong", { style: { color: t.text }, children: [
1499
- payment.previewQuote.amountOutFormatted,
1542
+ formatDisplayAmount(payment.previewQuote.amountOutFormatted),
1500
1543
  " ",
1501
1544
  payment.destinationToken.symbol
1502
1545
  ] }),
@@ -1577,7 +1620,7 @@ function UniportModal({
1577
1620
  padding: "11px 13px",
1578
1621
  background: t.inputBg,
1579
1622
  borderRadius: "10px",
1580
- marginBottom: "14px",
1623
+ marginBottom: quote.memo ? "10px" : "14px",
1581
1624
  border: `1px solid ${t.border}`
1582
1625
  }, children: [
1583
1626
  /* @__PURE__ */ jsx("span", { style: {
@@ -1591,22 +1634,64 @@ function UniportModal({
1591
1634
  /* @__PURE__ */ jsx(
1592
1635
  "button",
1593
1636
  {
1594
- onClick: handleCopy,
1637
+ onClick: () => handleCopy("address", quote.depositAddress),
1595
1638
  title: "Copy address",
1596
1639
  style: {
1597
1640
  flexShrink: 0,
1598
1641
  width: 34,
1599
1642
  height: 34,
1600
1643
  borderRadius: "8px",
1601
- background: copied ? `${t.success}18` : t.iconBtnBg,
1602
- border: `1px solid ${copied ? t.success + "44" : t.border}`,
1644
+ background: copiedField === "address" ? `${t.success}18` : t.iconBtnBg,
1645
+ border: `1px solid ${copiedField === "address" ? t.success + "44" : t.border}`,
1603
1646
  cursor: "pointer",
1604
1647
  display: "flex",
1605
1648
  alignItems: "center",
1606
1649
  justifyContent: "center",
1607
1650
  transition: "all 0.2s"
1608
1651
  },
1609
- children: copied ? /* @__PURE__ */ jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsx(CopyIcon, { color: t.textMuted })
1652
+ children: copiedField === "address" ? /* @__PURE__ */ jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsx(CopyIcon, { color: t.textMuted })
1653
+ }
1654
+ )
1655
+ ] }),
1656
+ quote.memo && /* @__PURE__ */ jsxs("div", { style: {
1657
+ display: "flex",
1658
+ alignItems: "center",
1659
+ gap: "10px",
1660
+ padding: "11px 13px",
1661
+ background: `${t.warning}0f`,
1662
+ borderRadius: "10px",
1663
+ marginBottom: "14px",
1664
+ border: `1px solid ${t.warning}44`
1665
+ }, children: [
1666
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
1667
+ /* @__PURE__ */ jsx("p", { style: { margin: "0 0 3px", fontSize: "11px", color: t.warning, fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Memo required" }),
1668
+ /* @__PURE__ */ jsx("span", { style: {
1669
+ fontSize: "13px",
1670
+ color: t.text,
1671
+ fontFamily: "monospace",
1672
+ wordBreak: "break-all",
1673
+ lineHeight: 1.4
1674
+ }, children: quote.memo })
1675
+ ] }),
1676
+ /* @__PURE__ */ jsx(
1677
+ "button",
1678
+ {
1679
+ onClick: () => handleCopy("memo", quote.memo),
1680
+ title: "Copy memo",
1681
+ style: {
1682
+ flexShrink: 0,
1683
+ width: 34,
1684
+ height: 34,
1685
+ borderRadius: "8px",
1686
+ background: copiedField === "memo" ? `${t.success}18` : t.iconBtnBg,
1687
+ border: `1px solid ${copiedField === "memo" ? t.success + "44" : t.border}`,
1688
+ cursor: "pointer",
1689
+ display: "flex",
1690
+ alignItems: "center",
1691
+ justifyContent: "center",
1692
+ transition: "all 0.2s"
1693
+ },
1694
+ children: copiedField === "memo" ? /* @__PURE__ */ jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsx(CopyIcon, { color: t.textMuted })
1610
1695
  }
1611
1696
  )
1612
1697
  ] }),
@@ -1623,7 +1708,14 @@ function UniportModal({
1623
1708
  " ",
1624
1709
  "on ",
1625
1710
  /* @__PURE__ */ jsx("strong", { children: payment.selectedChain?.name }),
1626
- " to this address. Other assets may be permanently lost."
1711
+ " to this address",
1712
+ quote.memo && /* @__PURE__ */ jsxs(Fragment, { children: [
1713
+ " ",
1714
+ /* @__PURE__ */ jsx("strong", { children: "with the memo above" })
1715
+ ] }),
1716
+ ". Other assets may be permanently lost",
1717
+ quote.memo && /* @__PURE__ */ jsx(Fragment, { children: ", and omitting the memo may make your deposit unrecoverable" }),
1718
+ "."
1627
1719
  ] })
1628
1720
  ] }),
1629
1721
  /* @__PURE__ */ jsxs("div", { style: { borderTop: `1px solid ${t.border}`, paddingTop: "12px" }, children: [
@@ -1631,7 +1723,7 @@ function UniportModal({
1631
1723
  /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "You'll receive" }),
1632
1724
  /* @__PURE__ */ jsxs("span", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
1633
1725
  "\u2248",
1634
- quote.amountOutFormatted,
1726
+ formatDisplayAmount(quote.amountOutFormatted),
1635
1727
  " ",
1636
1728
  payment.destinationToken.symbol
1637
1729
  ] })
@@ -1725,7 +1817,7 @@ function UniportModal({
1725
1817
  payment.selectedToken?.symbol,
1726
1818
  " \u2192 ",
1727
1819
  "\u2248",
1728
- payment.quote?.amountOutFormatted,
1820
+ formatDisplayAmount(payment.quote?.amountOutFormatted),
1729
1821
  " ",
1730
1822
  payment.destinationToken.symbol
1731
1823
  ] }),