uniport-sdk 0.0.4 → 0.0.6

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.cjs CHANGED
@@ -85,8 +85,60 @@ var CHAIN_ICONS = {
85
85
  ltc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
86
86
  bch: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
87
87
  xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
88
- zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png"
88
+ zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
89
+ scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png"
89
90
  };
91
+ var EVM_CHAINS = [
92
+ "eth",
93
+ "arb",
94
+ "base",
95
+ "op",
96
+ "pol",
97
+ "avax",
98
+ "bsc",
99
+ "gnosis",
100
+ "bera",
101
+ "monad",
102
+ "scroll"
103
+ ];
104
+ function isEvmChain(chain) {
105
+ return EVM_CHAINS.includes(chain);
106
+ }
107
+ var CHAINS_REQUIRING_MEMO = ["stellar"];
108
+ function needsMemoDeposit(chain) {
109
+ return CHAINS_REQUIRING_MEMO.includes(chain);
110
+ }
111
+ var EXPLORER_TX_URLS = {
112
+ eth: (h) => `https://etherscan.io/tx/${h}`,
113
+ arb: (h) => `https://arbiscan.io/tx/${h}`,
114
+ base: (h) => `https://basescan.org/tx/${h}`,
115
+ op: (h) => `https://optimistic.etherscan.io/tx/${h}`,
116
+ pol: (h) => `https://polygonscan.com/tx/${h}`,
117
+ avax: (h) => `https://snowtrace.io/tx/${h}`,
118
+ bsc: (h) => `https://bscscan.com/tx/${h}`,
119
+ gnosis: (h) => `https://gnosisscan.io/tx/${h}`,
120
+ bera: (h) => `https://berascan.com/tx/${h}`,
121
+ monad: (h) => `https://monadvision.com/tx/${h}`,
122
+ sui: (h) => `https://suivision.xyz/txblock/${h}`,
123
+ sol: (h) => `https://solscan.io/tx/${h}`,
124
+ btc: (h) => `https://mempool.space/tx/${h}`,
125
+ near: (h) => `https://nearblocks.io/txns/${h}`,
126
+ ton: (h) => `https://tonviewer.com/transaction/${h}`,
127
+ tron: (h) => `https://tronscan.org/#/transaction/${h}`,
128
+ stellar: (h) => `https://stellar.expert/explorer/public/tx/${h}`,
129
+ cardano: (h) => `https://cardanoscan.io/transaction/${h}`,
130
+ aptos: (h) => `https://explorer.aptoslabs.com/txn/${h}?network=mainnet`,
131
+ starknet: (h) => `https://voyager.online/tx/${h}`,
132
+ doge: (h) => `https://dogechain.info/tx/${h}`,
133
+ ltc: (h) => `https://litecoinspace.org/tx/${h}`,
134
+ bch: (h) => `https://blockchair.com/bitcoin-cash/transaction/${h}`,
135
+ xrp: (h) => `https://xrpscan.com/tx/${h}`,
136
+ zec: (h) => `https://blockchair.com/zcash/transaction/${h}`,
137
+ scroll: (h) => `https://scrollscan.com/tx/${h}`
138
+ };
139
+ function getExplorerTxUrl(chain, hash) {
140
+ return EXPLORER_TX_URLS[chain]?.(hash);
141
+ }
90
142
  function createToken(chain, symbol, assetId, decimals, contractAddress, options) {
91
143
  const normalizedSymbol = symbol.replace("$", "").replace(" ", "");
92
144
  const canonicalPrefix = TOKEN_NAME_PREFIXES[chain] || chain;
@@ -147,6 +199,8 @@ var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
147
199
  var baseUSDC = createToken("base", "USDC", "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near", 6, "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913");
148
200
  var baseCbBTC = createToken("base", "cbBTC", "nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near", 8, "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf", { name: "baseCbBTC" });
149
201
  var baseBRETT = createToken("base", "BRETT", "nep141:base-0x532f27101965dd16442e59d40670faf5ebb142e4.omft.near", 18, "0x532f27101965dd16442e59d40670faf5ebb142e4");
202
+ var scrollETH = createToken("scroll", "ETH", "nep245:v2_1.omni.hot.tg:534352_11111111111111111111", 18);
203
+ var scrollUSDT = createToken("scroll", "USDT", "nep245:v2_1.omni.hot.tg:534352_4RG3Q2wFsMQmd45m5m89RjsLfupA", 6, "0xf55bec9cafdbe8730f096aa55dad6d22d44099df");
150
204
  var optimismETH = createToken("op", "ETH", "nep245:v2_1.omni.hot.tg:10_11111111111111111111", 18);
151
205
  var optimismUSDC = createToken("op", "USDC", "nep245:v2_1.omni.hot.tg:10_A2ewyUyDp6qsue1jqZsGypkCxRJ", 6, "0x0b2c639c533813f4aa9d7837caf62653d097ff85");
152
206
  var optimismUSDT = createToken("op", "USDT", "nep245:v2_1.omni.hot.tg:10_359RPSJVdTxwTJT9TyGssr2rFoWo", 6, "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58");
@@ -180,6 +234,8 @@ var aptosAPT = createToken("aptos", "APT", "nep141:aptos.omft.near", 8);
180
234
  var starknetSTRK = createToken("starknet", "STRK", "nep141:starknet.omft.near", 18);
181
235
  var berachainBERA = createToken("bera", "BERA", "nep141:bera.omft.near", 18);
182
236
  var zcashZEC = createToken("zec", "ZEC", "nep141:zec.omft.near", 8);
237
+ var stellarXLM = createToken("stellar", "XLM", "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz", 7);
238
+ var stellarUSDC = createToken("stellar", "USDC", "nep245:v2_1.omni.hot.tg:1100_111bzQBB65GxAPAVoxqmMcgYo5oS3txhqs1Uh1cgahKQUeTUq1TJu", 7, "GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN");
183
239
  var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near", {
184
240
  name: "nearNEAR",
185
241
  aliases: ["nearwNEAR"]
@@ -211,6 +267,12 @@ var CHAINS = {
211
267
  icon: CHAIN_ICONS.base,
212
268
  tokens: [baseETH, baseUSDC, baseCbBTC, baseBRETT]
213
269
  },
270
+ scroll: {
271
+ id: "scroll",
272
+ name: "Scroll",
273
+ icon: CHAIN_ICONS.scroll,
274
+ tokens: [scrollETH, scrollUSDT]
275
+ },
214
276
  op: {
215
277
  id: "op",
216
278
  name: "Optimism",
@@ -335,7 +397,7 @@ var CHAINS = {
335
397
  id: "stellar",
336
398
  name: "Stellar",
337
399
  icon: CHAIN_ICONS.stellar,
338
- tokens: []
400
+ tokens: [stellarXLM, stellarUSDC]
339
401
  }
340
402
  };
341
403
  var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
@@ -451,6 +513,17 @@ function generateDeadline(hoursFromNow = 1) {
451
513
  const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
452
514
  return deadline.toISOString();
453
515
  }
516
+ function formatDisplayAmount(amount, significantDigits = 6) {
517
+ if (!amount) return amount ?? "";
518
+ const num = Number(amount);
519
+ if (!Number.isFinite(num) || num === 0) return amount;
520
+ const abs = Math.abs(num);
521
+ if (abs < 1e-6 || abs >= 1e21) return amount;
522
+ return new Intl.NumberFormat("en-US", {
523
+ maximumSignificantDigits: significantDigits,
524
+ useGrouping: false
525
+ }).format(num);
526
+ }
454
527
  async function getQuote(options) {
455
528
  const {
456
529
  originToken,
@@ -482,6 +555,7 @@ async function getQuote(options) {
482
555
  dry,
483
556
  swapType,
484
557
  slippageTolerance,
558
+ depositMode: needsMemoDeposit(originToken.chain) ? "MEMO" : void 0,
485
559
  originAsset: originToken.assetId,
486
560
  destinationAsset: destinationToken.assetId,
487
561
  amount: amountInSmallestUnits,
@@ -613,6 +687,49 @@ async function pollExecutionStatus(depositAddress, options) {
613
687
  }
614
688
  throw new Error(`Timeout waiting for swap completion after ${timeout}ms`);
615
689
  }
690
+
691
+ // src/core/ens.ts
692
+ var ENSIDEAS_BASE_URL = "https://api.ensideas.com/ens/resolve";
693
+ var UNIPORT_ENS_NAME = "uniport.eth";
694
+ var UNIPORT_FALLBACK_REFUND_ADDRESS = "0x2f43A54f931b95053c3DDa5f4637065AA0c3c494";
695
+ async function resolveEnsName(name, options) {
696
+ const controller = new AbortController();
697
+ const timeoutId = setTimeout(
698
+ () => controller.abort(),
699
+ options?.timeoutMs ?? 1e4
700
+ );
701
+ options?.signal?.addEventListener("abort", () => controller.abort(), {
702
+ once: true
703
+ });
704
+ try {
705
+ const response = await fetch(
706
+ `${ENSIDEAS_BASE_URL}/${encodeURIComponent(name)}`,
707
+ { signal: controller.signal }
708
+ );
709
+ if (!response.ok) return null;
710
+ const data = await response.json();
711
+ if (!data.address) return null;
712
+ return {
713
+ address: data.address,
714
+ name: data.name ?? name,
715
+ displayName: data.displayName ?? name,
716
+ avatar: data.avatar ?? null
717
+ };
718
+ } catch {
719
+ return null;
720
+ } finally {
721
+ clearTimeout(timeoutId);
722
+ }
723
+ }
724
+ var uniportRefundAddressPromise = null;
725
+ function getUniportDefaultRefundAddress() {
726
+ if (!uniportRefundAddressPromise) {
727
+ uniportRefundAddressPromise = resolveEnsName(UNIPORT_ENS_NAME).then(
728
+ (result) => result?.address ?? UNIPORT_FALLBACK_REFUND_ADDRESS
729
+ );
730
+ }
731
+ return uniportRefundAddressPromise;
732
+ }
616
733
  function useUniportPayment(options) {
617
734
  const {
618
735
  recipient,
@@ -641,6 +758,19 @@ function useUniportPayment(options) {
641
758
  const [refundAddress, setRefundAddressState] = react.useState(
642
759
  initialRefundAddress ?? ""
643
760
  );
761
+ const [evmDefaultRefundAddress, setEvmDefaultRefundAddress] = react.useState(
762
+ UNIPORT_FALLBACK_REFUND_ADDRESS
763
+ );
764
+ react.useEffect(() => {
765
+ let cancelled = false;
766
+ getUniportDefaultRefundAddress().then((address) => {
767
+ if (!cancelled) setEvmDefaultRefundAddress(address);
768
+ });
769
+ return () => {
770
+ cancelled = true;
771
+ };
772
+ }, []);
773
+ const effectiveRefundAddress = refundAddress.trim() || (selectedChain && isEvmChain(selectedChain.id) ? evmDefaultRefundAddress : "");
644
774
  const pollingRef = react.useRef(null);
645
775
  const lastStatusRef = react.useRef(null);
646
776
  const previewDebounceRef = react.useRef(null);
@@ -697,31 +827,33 @@ function useUniportPayment(options) {
697
827
  const setAmount = react.useCallback(
698
828
  (newAmount) => {
699
829
  setAmountState(newAmount);
700
- schedulePreviewQuote(newAmount, refundAddress, selectedToken);
830
+ schedulePreviewQuote(newAmount, effectiveRefundAddress, selectedToken);
701
831
  },
702
- [refundAddress, schedulePreviewQuote, selectedToken]
832
+ [effectiveRefundAddress, schedulePreviewQuote, selectedToken]
703
833
  );
704
834
  const setRefundAddress = react.useCallback(
705
835
  (newRefundAddress) => {
706
836
  setRefundAddressState(newRefundAddress);
707
- schedulePreviewQuote(amount, newRefundAddress, selectedToken);
837
+ const nextEffective = newRefundAddress.trim() || (selectedChain && isEvmChain(selectedChain.id) ? evmDefaultRefundAddress : "");
838
+ schedulePreviewQuote(amount, nextEffective, selectedToken);
708
839
  },
709
- [amount, schedulePreviewQuote, selectedToken]
840
+ [amount, evmDefaultRefundAddress, schedulePreviewQuote, selectedChain, selectedToken]
710
841
  );
711
842
  const handleChainSelect = react.useCallback((chain) => {
712
843
  const nextToken = chain.tokens[0] || null;
713
844
  setSelectedChain(chain);
714
845
  setSelectedToken(nextToken);
715
846
  setPaymentState("selecting");
716
- schedulePreviewQuote(amount, refundAddress, nextToken);
717
- }, [amount, refundAddress, schedulePreviewQuote]);
847
+ const nextEffective = refundAddress.trim() || (isEvmChain(chain.id) ? evmDefaultRefundAddress : "");
848
+ schedulePreviewQuote(amount, nextEffective, nextToken);
849
+ }, [amount, evmDefaultRefundAddress, refundAddress, schedulePreviewQuote]);
718
850
  const handleTokenSelect = react.useCallback((token) => {
719
851
  setSelectedToken(token);
720
852
  setPaymentState("selecting");
721
- schedulePreviewQuote(amount, refundAddress, token);
722
- }, [amount, refundAddress, schedulePreviewQuote]);
853
+ schedulePreviewQuote(amount, effectiveRefundAddress, token);
854
+ }, [amount, effectiveRefundAddress, schedulePreviewQuote]);
723
855
  const fetchQuote = react.useCallback(async () => {
724
- if (!selectedToken || !amount || !refundAddress) {
856
+ if (!selectedToken || !amount || !effectiveRefundAddress) {
725
857
  setError(new Error("Missing required fields"));
726
858
  return;
727
859
  }
@@ -733,7 +865,7 @@ function useUniportPayment(options) {
733
865
  destinationToken: destToken,
734
866
  amount,
735
867
  recipient,
736
- refundTo: refundAddress,
868
+ refundTo: effectiveRefundAddress,
737
869
  dry: false
738
870
  });
739
871
  setQuote(result);
@@ -747,7 +879,7 @@ function useUniportPayment(options) {
747
879
  }, [
748
880
  selectedToken,
749
881
  amount,
750
- refundAddress,
882
+ effectiveRefundAddress,
751
883
  recipient,
752
884
  destToken,
753
885
  onError
@@ -858,6 +990,8 @@ function useUniportPayment(options) {
858
990
  selectedToken,
859
991
  amount,
860
992
  refundAddress,
993
+ effectiveRefundAddress,
994
+ isUsingDefaultRefundAddress: !refundAddress.trim() && !!effectiveRefundAddress,
861
995
  destinationToken: destToken,
862
996
  chains,
863
997
  tokens,
@@ -1126,7 +1260,7 @@ function UniportModal({
1126
1260
  onError
1127
1261
  });
1128
1262
  const [modalStep, setModalStep] = react.useState("chain");
1129
- const [copied, setCopied] = react.useState(false);
1263
+ const [copiedField, setCopiedField] = react.useState(null);
1130
1264
  const [showReceipt, setShowReceipt] = react.useState(false);
1131
1265
  const [portalRoot, setPortalRoot] = react.useState(null);
1132
1266
  react.useEffect(() => {
@@ -1158,13 +1292,11 @@ function UniportModal({
1158
1292
  };
1159
1293
  }
1160
1294
  }, [open, handleClose]);
1161
- const handleCopy = react.useCallback(async () => {
1162
- if (payment.quote?.depositAddress) {
1163
- const ok = await payment.copyToClipboard(payment.quote.depositAddress);
1164
- if (ok) {
1165
- setCopied(true);
1166
- setTimeout(() => setCopied(false), 2e3);
1167
- }
1295
+ const handleCopy = react.useCallback(async (field, text) => {
1296
+ const ok = await payment.copyToClipboard(text);
1297
+ if (ok) {
1298
+ setCopiedField(field);
1299
+ setTimeout(() => setCopiedField(null), 2e3);
1168
1300
  }
1169
1301
  }, [payment]);
1170
1302
  if (!open || !portalRoot) return null;
@@ -1173,8 +1305,8 @@ function UniportModal({
1173
1305
  const isSuccess = paymentState === "success";
1174
1306
  const isError = paymentState === "error";
1175
1307
  const isQuoting = paymentState === "quoting";
1176
- const canSubmit = !!(payment.selectedToken && payment.amount && payment.refundAddress.trim());
1177
- const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.refundAddress.trim());
1308
+ const canSubmit = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
1309
+ const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
1178
1310
  const showBack = !isSuccess && !isError && (showQR || modalStep !== "chain");
1179
1311
  const iconBtn = {
1180
1312
  width: 36,
@@ -1410,7 +1542,8 @@ function UniportModal({
1410
1542
  },
1411
1543
  children: [
1412
1544
  "Refund address on ",
1413
- ch?.name || "the source chain"
1545
+ ch?.name || "the source chain",
1546
+ ch && isEvmChain(ch.id) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 400, color: t.textMuted }, children: " (optional)" })
1414
1547
  ]
1415
1548
  }
1416
1549
  ),
@@ -1420,7 +1553,7 @@ function UniportModal({
1420
1553
  type: "text",
1421
1554
  value: payment.refundAddress,
1422
1555
  onChange: (e) => payment.setRefundAddress(e.target.value),
1423
- placeholder: `Enter a ${ch?.name || "source chain"} refund address`,
1556
+ placeholder: ch && isEvmChain(ch.id) ? `Optional \u2014 defaults to ${UNIPORT_ENS_NAME}` : `Enter a ${ch?.name || "source chain"} refund address`,
1424
1557
  spellCheck: false,
1425
1558
  autoCapitalize: "off",
1426
1559
  autoCorrect: "off",
@@ -1446,7 +1579,23 @@ function UniportModal({
1446
1579
  color: t.textMuted,
1447
1580
  lineHeight: 1.5
1448
1581
  },
1449
- children: "Used only if the swap fails. This address must live on the chain the payer is sending from."
1582
+ 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."
1583
+ }
1584
+ ),
1585
+ ch?.id === "stellar" && tok?.symbol !== "XLM" && /* @__PURE__ */ jsxRuntime.jsxs(
1586
+ "p",
1587
+ {
1588
+ style: {
1589
+ margin: "6px 0 0",
1590
+ fontSize: "12px",
1591
+ color: t.warning,
1592
+ lineHeight: 1.5
1593
+ },
1594
+ children: [
1595
+ "This refund address must already have a trustline for ",
1596
+ tok?.symbol,
1597
+ " on Stellar, or a refund cannot be delivered to it."
1598
+ ]
1450
1599
  }
1451
1600
  )
1452
1601
  ] }),
@@ -1470,7 +1619,7 @@ function UniportModal({
1470
1619
  "You will receive",
1471
1620
  " ",
1472
1621
  /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: t.text }, children: [
1473
- payment.previewQuote.amountOutFormatted,
1622
+ formatDisplayAmount(payment.previewQuote.amountOutFormatted),
1474
1623
  " ",
1475
1624
  payment.destinationToken.symbol
1476
1625
  ] }),
@@ -1511,7 +1660,7 @@ function UniportModal({
1511
1660
  ] }) : "Confirm Payment"
1512
1661
  }
1513
1662
  ),
1514
- !payment.refundAddress.trim() && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
1663
+ !payment.effectiveRefundAddress && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
1515
1664
  "Enter a refund address on ",
1516
1665
  ch?.name || "the source chain",
1517
1666
  " to continue."
@@ -1551,7 +1700,7 @@ function UniportModal({
1551
1700
  padding: "11px 13px",
1552
1701
  background: t.inputBg,
1553
1702
  borderRadius: "10px",
1554
- marginBottom: "14px",
1703
+ marginBottom: quote.memo ? "10px" : "14px",
1555
1704
  border: `1px solid ${t.border}`
1556
1705
  }, children: [
1557
1706
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
@@ -1565,22 +1714,64 @@ function UniportModal({
1565
1714
  /* @__PURE__ */ jsxRuntime.jsx(
1566
1715
  "button",
1567
1716
  {
1568
- onClick: handleCopy,
1717
+ onClick: () => handleCopy("address", quote.depositAddress),
1569
1718
  title: "Copy address",
1570
1719
  style: {
1571
1720
  flexShrink: 0,
1572
1721
  width: 34,
1573
1722
  height: 34,
1574
1723
  borderRadius: "8px",
1575
- background: copied ? `${t.success}18` : t.iconBtnBg,
1576
- border: `1px solid ${copied ? t.success + "44" : t.border}`,
1724
+ background: copiedField === "address" ? `${t.success}18` : t.iconBtnBg,
1725
+ border: `1px solid ${copiedField === "address" ? t.success + "44" : t.border}`,
1577
1726
  cursor: "pointer",
1578
1727
  display: "flex",
1579
1728
  alignItems: "center",
1580
1729
  justifyContent: "center",
1581
1730
  transition: "all 0.2s"
1582
1731
  },
1583
- children: copied ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { color: t.textMuted })
1732
+ children: copiedField === "address" ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { color: t.textMuted })
1733
+ }
1734
+ )
1735
+ ] }),
1736
+ quote.memo && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1737
+ display: "flex",
1738
+ alignItems: "center",
1739
+ gap: "10px",
1740
+ padding: "11px 13px",
1741
+ background: `${t.warning}0f`,
1742
+ borderRadius: "10px",
1743
+ marginBottom: "14px",
1744
+ border: `1px solid ${t.warning}44`
1745
+ }, children: [
1746
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1 }, children: [
1747
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "0 0 3px", fontSize: "11px", color: t.warning, fontWeight: 600, textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Memo required" }),
1748
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
1749
+ fontSize: "13px",
1750
+ color: t.text,
1751
+ fontFamily: "monospace",
1752
+ wordBreak: "break-all",
1753
+ lineHeight: 1.4
1754
+ }, children: quote.memo })
1755
+ ] }),
1756
+ /* @__PURE__ */ jsxRuntime.jsx(
1757
+ "button",
1758
+ {
1759
+ onClick: () => handleCopy("memo", quote.memo),
1760
+ title: "Copy memo",
1761
+ style: {
1762
+ flexShrink: 0,
1763
+ width: 34,
1764
+ height: 34,
1765
+ borderRadius: "8px",
1766
+ background: copiedField === "memo" ? `${t.success}18` : t.iconBtnBg,
1767
+ border: `1px solid ${copiedField === "memo" ? t.success + "44" : t.border}`,
1768
+ cursor: "pointer",
1769
+ display: "flex",
1770
+ alignItems: "center",
1771
+ justifyContent: "center",
1772
+ transition: "all 0.2s"
1773
+ },
1774
+ children: copiedField === "memo" ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { color: t.textMuted })
1584
1775
  }
1585
1776
  )
1586
1777
  ] }),
@@ -1597,7 +1788,14 @@ function UniportModal({
1597
1788
  " ",
1598
1789
  "on ",
1599
1790
  /* @__PURE__ */ jsxRuntime.jsx("strong", { children: payment.selectedChain?.name }),
1600
- " to this address. Other assets may be permanently lost."
1791
+ " to this address",
1792
+ quote.memo && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1793
+ " ",
1794
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "with the memo above" })
1795
+ ] }),
1796
+ ". Other assets may be permanently lost",
1797
+ quote.memo && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: ", and omitting the memo may make your deposit unrecoverable" }),
1798
+ "."
1601
1799
  ] })
1602
1800
  ] }),
1603
1801
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { borderTop: `1px solid ${t.border}`, paddingTop: "12px" }, children: [
@@ -1605,7 +1803,7 @@ function UniportModal({
1605
1803
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "You'll receive" }),
1606
1804
  /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
1607
1805
  "\u2248",
1608
- quote.amountOutFormatted,
1806
+ formatDisplayAmount(quote.amountOutFormatted),
1609
1807
  " ",
1610
1808
  payment.destinationToken.symbol
1611
1809
  ] })
@@ -1637,6 +1835,25 @@ function UniportModal({
1637
1835
  ] }) })
1638
1836
  ] });
1639
1837
  };
1838
+ const renderTxHash = (hash, url) => url ? /* @__PURE__ */ jsxRuntime.jsxs(
1839
+ "a",
1840
+ {
1841
+ href: url,
1842
+ target: "_blank",
1843
+ rel: "noopener noreferrer",
1844
+ style: { color: t.accent, fontSize: "12px", fontFamily: "monospace", textDecoration: "none" },
1845
+ children: [
1846
+ hash.slice(0, 12),
1847
+ "\u2026",
1848
+ hash.slice(-8),
1849
+ " \u2197"
1850
+ ]
1851
+ }
1852
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: t.textSecondary, fontSize: "12px", fontFamily: "monospace" }, children: [
1853
+ hash.slice(0, 12),
1854
+ "\u2026",
1855
+ hash.slice(-8)
1856
+ ] });
1640
1857
  const renderSuccessStep = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
1641
1858
  /* @__PURE__ */ jsxRuntime.jsx(
1642
1859
  "button",
@@ -1680,7 +1897,7 @@ function UniportModal({
1680
1897
  payment.selectedToken?.symbol,
1681
1898
  " \u2192 ",
1682
1899
  "\u2248",
1683
- payment.quote?.amountOutFormatted,
1900
+ formatDisplayAmount(payment.quote?.amountOutFormatted),
1684
1901
  " ",
1685
1902
  payment.destinationToken.symbol
1686
1903
  ] }),
@@ -1707,29 +1924,14 @@ function UniportModal({
1707
1924
  "Source TX \xB7 ",
1708
1925
  payment.selectedChain?.name
1709
1926
  ] }),
1710
- /* @__PURE__ */ jsxRuntime.jsxs(
1711
- "a",
1712
- {
1713
- href: `https://etherscan.io/tx/${hash}`,
1714
- target: "_blank",
1715
- rel: "noopener noreferrer",
1716
- style: { color: t.accent, fontSize: "12px", fontFamily: "monospace", textDecoration: "none" },
1717
- children: [
1718
- hash.slice(0, 12),
1719
- "\u2026",
1720
- hash.slice(-8),
1721
- " \u2197"
1722
- ]
1723
- }
1724
- )
1927
+ renderTxHash(hash, payment.selectedChain ? getExplorerTxUrl(payment.selectedChain.id, hash) : void 0)
1725
1928
  ] }, `o${i}`)),
1726
1929
  payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1727
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Destination TX" }),
1728
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: t.textSecondary, fontSize: "12px", fontFamily: "monospace" }, children: [
1729
- hash.slice(0, 12),
1730
- "\u2026",
1731
- hash.slice(-8)
1732
- ] })
1930
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: [
1931
+ "Destination TX \xB7 ",
1932
+ CHAINS[payment.destinationToken.chain].name
1933
+ ] }),
1934
+ renderTxHash(hash, getExplorerTxUrl(payment.destinationToken.chain, hash))
1733
1935
  ] }, `d${i}`)),
1734
1936
  !payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: t.textMuted, fontSize: "13px", margin: 0 }, children: "Loading transaction details\u2026" })
1735
1937
  ] }),
@@ -2044,10 +2246,14 @@ function UniportIcon() {
2044
2246
 
2045
2247
  exports.ALL_TOKENS = ALL_TOKENS;
2046
2248
  exports.CHAINS = CHAINS;
2249
+ exports.CHAINS_REQUIRING_MEMO = CHAINS_REQUIRING_MEMO;
2047
2250
  exports.CHAIN_ICONS = CHAIN_ICONS;
2048
2251
  exports.DEFAULT_HOSTED_BACKEND_URL = DEFAULT_HOSTED_BACKEND_URL;
2049
2252
  exports.DEFAULT_REQUEST_TIMEOUT_MS = DEFAULT_REQUEST_TIMEOUT_MS;
2253
+ exports.EVM_CHAINS = EVM_CHAINS;
2050
2254
  exports.TOKEN_ICONS = TOKEN_ICONS;
2255
+ exports.UNIPORT_ENS_NAME = UNIPORT_ENS_NAME;
2256
+ exports.UNIPORT_FALLBACK_REFUND_ADDRESS = UNIPORT_FALLBACK_REFUND_ADDRESS;
2051
2257
  exports.UniportButton = UniportButton;
2052
2258
  exports.UniportError = UniportError;
2053
2259
  exports.UniportModal = UniportModal;
@@ -2085,19 +2291,24 @@ exports.ethereumUNI = ethereumUNI;
2085
2291
  exports.ethereumUSDC = ethereumUSDC;
2086
2292
  exports.ethereumUSDT = ethereumUSDT;
2087
2293
  exports.ethereumWBTC = ethereumWBTC;
2294
+ exports.formatDisplayAmount = formatDisplayAmount;
2088
2295
  exports.fromSmallestUnits = fromSmallestUnits;
2089
2296
  exports.generateDeadline = generateDeadline;
2090
2297
  exports.getExecutionStatus = getExecutionStatus;
2298
+ exports.getExplorerTxUrl = getExplorerTxUrl;
2091
2299
  exports.getQuote = getQuote;
2092
2300
  exports.getSupportedChains = getSupportedChains;
2093
2301
  exports.getToken = getToken;
2094
2302
  exports.getTokenByAssetId = getTokenByAssetId;
2095
2303
  exports.getTokensByChain = getTokensByChain;
2096
2304
  exports.getUniportConfig = getUniportConfig;
2305
+ exports.getUniportDefaultRefundAddress = getUniportDefaultRefundAddress;
2306
+ exports.isEvmChain = isEvmChain;
2097
2307
  exports.litecoinLTC = litecoinLTC;
2098
2308
  exports.nearNEAR = nearNEAR;
2099
2309
  exports.nearUSDC = nearUSDC;
2100
2310
  exports.nearUSDT = nearUSDT;
2311
+ exports.needsMemoDeposit = needsMemoDeposit;
2101
2312
  exports.optimismETH = optimismETH;
2102
2313
  exports.optimismOP = optimismOP;
2103
2314
  exports.optimismUSDC = optimismUSDC;
@@ -2106,7 +2317,10 @@ exports.pollExecutionStatus = pollExecutionStatus;
2106
2317
  exports.polygonPOL = polygonPOL;
2107
2318
  exports.polygonUSDC = polygonUSDC;
2108
2319
  exports.polygonUSDT = polygonUSDT;
2320
+ exports.resolveEnsName = resolveEnsName;
2109
2321
  exports.rippleXRP = rippleXRP;
2322
+ exports.scrollETH = scrollETH;
2323
+ exports.scrollUSDT = scrollUSDT;
2110
2324
  exports.solanaMELANIA = solanaMELANIA;
2111
2325
  exports.solanaSOL = solanaSOL;
2112
2326
  exports.solanaTRUMP = solanaTRUMP;
@@ -2114,6 +2328,8 @@ exports.solanaUSDC = solanaUSDC;
2114
2328
  exports.solanaUSDT = solanaUSDT;
2115
2329
  exports.solanaWIF = solanaWIF;
2116
2330
  exports.starknetSTRK = starknetSTRK;
2331
+ exports.stellarUSDC = stellarUSDC;
2332
+ exports.stellarXLM = stellarXLM;
2117
2333
  exports.submitDepositTx = submitDepositTx;
2118
2334
  exports.suiSUI = suiSUI;
2119
2335
  exports.suiUSDC = suiUSDC;