uniport-sdk 0.0.1 → 0.0.2

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
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var oneClickSdkTypescript = require('@defuse-protocol/one-click-sdk-typescript');
4
- var React = require('react');
3
+ var react = require('react');
4
+ var ReactDOM = require('react-dom');
5
5
  var qrcode_react = require('qrcode.react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
 
8
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
9
 
10
- var React__default = /*#__PURE__*/_interopDefault(React);
10
+ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
11
11
 
12
12
  // src/core/tokens.ts
13
13
  var TOKEN_ICONS = {
14
14
  // Stablecoins
15
15
  USDC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
16
16
  USDT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
17
- DAI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EesdfdsfdC495271d0F/logo.png",
17
+ DAI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeEC495271d0F/logo.png",
18
18
  // Major tokens
19
19
  ETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
20
20
  WETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
@@ -47,16 +47,16 @@ var TOKEN_ICONS = {
47
47
  SHIB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE/logo.png",
48
48
  PEPE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6982508145454Ce325dDbE47a25d4ec3d2311933/logo.png",
49
49
  // Ecosystem tokens
50
- STRK: "https://assets.coingecko.com/coins/images/26433/standard/starknet.png",
51
- BERA: "https://assets.coingecko.com/coins/images/34286/standard/bera.png",
50
+ STRK: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
51
+ BERA: "https://s2.coinmarketcap.com/static/img/coins/64x64/31645.png",
52
52
  GNO: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6810e776880C02933D47DB1b9fc05908e5386b96/logo.png",
53
- MON: "https://assets.coingecko.com/coins/images/35887/standard/monad.png",
53
+ MON: "https://s2.coinmarketcap.com/static/img/coins/64x64/33868.png",
54
54
  ZEC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
55
55
  // Meme coins
56
- TRUMP: "https://assets.coingecko.com/coins/images/53746/standard/trump.jpg",
57
- WIF: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg",
58
- BRETT: "https://assets.coingecko.com/coins/images/35529/standard/brett.png",
59
- TURBO: "https://assets.coingecko.com/coins/images/30116/standard/turbo.png",
56
+ TRUMP: "https://s2.coinmarketcap.com/static/img/coins/64x64/35336.png",
57
+ WIF: "https://s2.coinmarketcap.com/static/img/coins/64x64/28752.png",
58
+ BRETT: "https://s2.coinmarketcap.com/static/img/coins/64x64/29743.png",
59
+ TURBO: "https://s2.coinmarketcap.com/static/img/coins/64x64/24911.png",
60
60
  // Default fallback
61
61
  DEFAULT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
62
62
  };
@@ -78,21 +78,29 @@ var CHAIN_ICONS = {
78
78
  cardano: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cardano/info/logo.png",
79
79
  aptos: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
80
80
  gnosis: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png",
81
- starknet: "https://assets.coingecko.com/coins/images/26433/standard/starknet.png",
82
- bera: "https://assets.coingecko.com/coins/images/34286/standard/bera.png",
83
- monad: "https://assets.coingecko.com/coins/images/35887/standard/monad.png",
81
+ starknet: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
82
+ bera: "https://s2.coinmarketcap.com/static/img/coins/64x64/31645.png",
83
+ monad: "https://s2.coinmarketcap.com/static/img/coins/64x64/33868.png",
84
84
  doge: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",
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
88
  zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png"
89
89
  };
90
- function createToken(chain, symbol, assetId, decimals, contractAddress) {
91
- const name = `${chain}${symbol.replace("$", "").replace(" ", "")}`;
90
+ function createToken(chain, symbol, assetId, decimals, contractAddress, options) {
91
+ const normalizedSymbol = symbol.replace("$", "").replace(" ", "");
92
+ const canonicalPrefix = TOKEN_NAME_PREFIXES[chain] || chain;
93
+ const legacyName = `${chain}${normalizedSymbol}`;
94
+ const name = options?.name || `${canonicalPrefix}${normalizedSymbol}`;
92
95
  const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS.DEFAULT;
93
96
  const chainIcon = CHAIN_ICONS[chain];
97
+ const aliases = new Set(options?.aliases || []);
98
+ if (legacyName !== name) {
99
+ aliases.add(legacyName);
100
+ }
94
101
  return {
95
102
  name,
103
+ aliases: aliases.size > 0 ? Array.from(aliases) : void 0,
96
104
  symbol,
97
105
  assetId,
98
106
  chain,
@@ -102,6 +110,19 @@ function createToken(chain, symbol, assetId, decimals, contractAddress) {
102
110
  contractAddress
103
111
  };
104
112
  }
113
+ var TOKEN_NAME_PREFIXES = {
114
+ eth: "ethereum",
115
+ arb: "arbitrum",
116
+ op: "optimism",
117
+ sol: "solana",
118
+ btc: "bitcoin",
119
+ avax: "avalanche",
120
+ doge: "dogecoin",
121
+ ltc: "litecoin",
122
+ bch: "bitcoinCash",
123
+ bera: "berachain",
124
+ zec: "zcash"
125
+ };
105
126
  var suiSUI = createToken("sui", "SUI", "nep141:sui.omft.near", 9);
106
127
  var suiUSDC = createToken("sui", "USDC", "nep141:sui-c1b81ecaf27933252d31a963bc5e9458f13c18ce.omft.near", 6, "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC");
107
128
  var ethereumETH = createToken("eth", "ETH", "nep141:eth.omft.near", 18);
@@ -123,7 +144,7 @@ var arbitrumARB = createToken("arb", "ARB", "nep141:arb-0x912ce59144191c1204e645
123
144
  var arbitrumGMX = createToken("arb", "GMX", "nep141:arb-0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a.omft.near", 18, "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a");
124
145
  var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
125
146
  var baseUSDC = createToken("base", "USDC", "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near", 6, "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913");
126
- var baseCbBTC = createToken("base", "cbBTC", "nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near", 8, "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf");
147
+ var baseCbBTC = createToken("base", "cbBTC", "nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near", 8, "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf", { name: "baseCbBTC" });
127
148
  var baseBRETT = createToken("base", "BRETT", "nep141:base-0x532f27101965dd16442e59d40670faf5ebb142e4.omft.near", 18, "0x532f27101965dd16442e59d40670faf5ebb142e4");
128
149
  var optimismETH = createToken("op", "ETH", "nep245:v2_1.omni.hot.tg:10_11111111111111111111", 18);
129
150
  var optimismUSDC = createToken("op", "USDC", "nep245:v2_1.omni.hot.tg:10_A2ewyUyDp6qsue1jqZsGypkCxRJ", 6, "0x0b2c639c533813f4aa9d7837caf62653d097ff85");
@@ -158,7 +179,10 @@ var aptosAPT = createToken("aptos", "APT", "nep141:aptos.omft.near", 8);
158
179
  var starknetSTRK = createToken("starknet", "STRK", "nep141:starknet.omft.near", 18);
159
180
  var berachainBERA = createToken("bera", "BERA", "nep141:bera.omft.near", 18);
160
181
  var zcashZEC = createToken("zec", "ZEC", "nep141:zec.omft.near", 8);
161
- var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near");
182
+ var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near", {
183
+ name: "nearNEAR",
184
+ aliases: ["nearwNEAR"]
185
+ });
162
186
  var nearUSDC = createToken("near", "USDC", "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", 6, "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1");
163
187
  var nearUSDT = createToken("near", "USDT", "nep141:usdt.tether-token.near", 6, "usdt.tether-token.near");
164
188
  var CHAINS = {
@@ -315,7 +339,9 @@ var CHAINS = {
315
339
  };
316
340
  var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
317
341
  function getToken(name) {
318
- return ALL_TOKENS.find((t) => t.name === name);
342
+ return ALL_TOKENS.find(
343
+ (token) => token.name === name || token.aliases?.includes(name)
344
+ );
319
345
  }
320
346
  function getTokensByChain(chainId) {
321
347
  return CHAINS[chainId]?.tokens || [];
@@ -326,31 +352,77 @@ function getTokenByAssetId(assetId) {
326
352
  function getSupportedChains() {
327
353
  return Object.values(CHAINS).filter((c) => c.tokens.length > 0);
328
354
  }
329
- function getSuiDestinationTokens() {
330
- return CHAINS.sui.tokens;
355
+
356
+ // src/core/config.ts
357
+ var DEFAULT_HOSTED_BACKEND_URL = "https://uniport-backend-production.up.railway.app";
358
+ var DEFAULT_REQUEST_TIMEOUT_MS = 2e4;
359
+ var configuredBackendUrl;
360
+ var configuredRequestTimeoutMs;
361
+ function normalizeBackendUrl(url) {
362
+ return url.replace(/\/+$/, "");
331
363
  }
332
- var _config = null;
333
- function initUniport(config) {
334
- _config = config;
335
- if (!config.apiKey) {
336
- throw new Error("Uniport SDK Error: apiKey is required. Pass your NEAR API key to initUniport().");
337
- }
338
- oneClickSdkTypescript.OpenAPI.BASE = config.baseUrl || "https://1click.chaindefuser.com";
339
- oneClickSdkTypescript.OpenAPI.TOKEN = config.apiKey;
364
+ function getLegacyBackendOverride() {
365
+ const envBackendUrl = typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_UNIPORT_BACKEND_URL : void 0;
366
+ const windowBackendUrl = typeof window !== "undefined" ? window.__UNIPORT_BACKEND_URL__ : void 0;
367
+ return envBackendUrl || windowBackendUrl;
340
368
  }
341
- function getConfig() {
342
- if (!_config) {
343
- throw new Error(
344
- "Uniport SDK not initialized. Call initUniport() first."
345
- );
369
+ function configureUniport(config) {
370
+ if (config.backendUrl !== void 0) {
371
+ configuredBackendUrl = config.backendUrl ? normalizeBackendUrl(config.backendUrl) : void 0;
372
+ }
373
+ if (config.requestTimeoutMs !== void 0) {
374
+ configuredRequestTimeoutMs = config.requestTimeoutMs > 0 ? config.requestTimeoutMs : DEFAULT_REQUEST_TIMEOUT_MS;
346
375
  }
347
- return _config;
348
376
  }
349
- function isInitialized() {
350
- return _config !== null;
377
+ function getUniportConfig() {
378
+ const backendUrl = configuredBackendUrl || getLegacyBackendOverride() || DEFAULT_HOSTED_BACKEND_URL;
379
+ return {
380
+ backendUrl: normalizeBackendUrl(backendUrl),
381
+ requestTimeoutMs: configuredRequestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS
382
+ };
351
383
  }
352
384
 
353
385
  // src/core/intents.ts
386
+ var UniportError = class extends Error {
387
+ constructor(params) {
388
+ super(params.message);
389
+ this.name = "UniportError";
390
+ this.code = params.code;
391
+ this.details = params.details;
392
+ this.status = params.status;
393
+ }
394
+ };
395
+ function isAbortError(error) {
396
+ return error instanceof Error && error.name === "AbortError";
397
+ }
398
+ function toUniportError(body, fallback) {
399
+ return new UniportError({
400
+ code: body.code || fallback.code,
401
+ message: body.message || fallback.message,
402
+ details: body.details,
403
+ status: fallback.status
404
+ });
405
+ }
406
+ function createTimeoutSignal(timeoutMs, externalSignal) {
407
+ const controller = new AbortController();
408
+ let timedOut = false;
409
+ const timeoutId = setTimeout(() => {
410
+ timedOut = true;
411
+ controller.abort();
412
+ }, timeoutMs);
413
+ const abortFromExternal = () => controller.abort();
414
+ externalSignal?.addEventListener("abort", abortFromExternal, {
415
+ once: true
416
+ });
417
+ return {
418
+ signal: controller.signal,
419
+ didTimeout: () => timedOut,
420
+ cleanup: () => {
421
+ clearTimeout(timeoutId);
422
+ externalSignal?.removeEventListener("abort", abortFromExternal);
423
+ }
424
+ };
425
+ }
354
426
  function toSmallestUnits(amount, decimals) {
355
427
  const [whole, fraction = ""] = amount.split(".");
356
428
  const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
@@ -366,16 +438,7 @@ function generateDeadline(hoursFromNow = 1) {
366
438
  const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
367
439
  return deadline.toISOString();
368
440
  }
369
- function ensureInitialized() {
370
- if (!isInitialized()) {
371
- throw new Error(
372
- "Uniport SDK not initialized. Call initUniport() first."
373
- );
374
- }
375
- }
376
441
  async function getQuote(options) {
377
- ensureInitialized();
378
- const config = getConfig();
379
442
  const {
380
443
  originToken,
381
444
  destinationToken,
@@ -387,97 +450,133 @@ async function getQuote(options) {
387
450
  swapType = "EXACT_INPUT",
388
451
  deadline,
389
452
  dry = false,
390
- referral = config.referral || "uniport"
453
+ referral = "uniport",
454
+ signal
391
455
  } = options;
392
456
  const amountInSmallestUnits = toSmallestUnits(amount, originToken.decimals);
393
- const quoteRequest = {
394
- dry,
395
- swapType: oneClickSdkTypescript.QuoteRequest.swapType[swapType],
396
- slippageTolerance,
397
- originAsset: originToken.assetId,
398
- depositType: oneClickSdkTypescript.QuoteRequest.depositType.ORIGIN_CHAIN,
399
- destinationAsset: destinationToken.assetId,
400
- amount: amountInSmallestUnits,
401
- refundTo,
402
- refundType: oneClickSdkTypescript.QuoteRequest.refundType.ORIGIN_CHAIN,
403
- recipient,
404
- recipientType: oneClickSdkTypescript.QuoteRequest.recipientType.DESTINATION_CHAIN,
405
- deadline: deadline?.toISOString() || generateDeadline(1),
406
- referral
407
- };
457
+ const { backendUrl, requestTimeoutMs } = getUniportConfig();
458
+ const { signal: requestSignal, cleanup, didTimeout } = createTimeoutSignal(
459
+ requestTimeoutMs,
460
+ signal
461
+ );
462
+ let response;
408
463
  try {
409
- const response = await oneClickSdkTypescript.OneClickService.getQuote(quoteRequest);
410
- const quote = response.quote;
411
- return {
412
- depositAddress: quote.depositAddress || "",
413
- memo: quote.depositMemo,
414
- amountIn: quote.amountIn,
415
- amountOut: quote.amountOut,
416
- amountOutFormatted: quote.amountOutFormatted,
417
- amountOutUsd: quote.amountOutUsd,
418
- deadline: quote.deadline,
419
- timeWhenInactive: quote.timeWhenInactive,
420
- correlationId: response.correlationId
421
- };
464
+ response = await fetch(`${backendUrl}/api/quote`, {
465
+ method: "POST",
466
+ headers: { "Content-Type": "application/json" },
467
+ signal: requestSignal,
468
+ body: JSON.stringify({
469
+ dry,
470
+ swapType,
471
+ slippageTolerance,
472
+ originAsset: originToken.assetId,
473
+ destinationAsset: destinationToken.assetId,
474
+ amount: amountInSmallestUnits,
475
+ refundTo,
476
+ recipient,
477
+ deadline: deadline?.toISOString() || generateDeadline(1),
478
+ referral
479
+ })
480
+ });
422
481
  } catch (error) {
423
- if (error instanceof oneClickSdkTypescript.ApiError) {
424
- throw new Error(
425
- `Quote failed (${error.status}): ${JSON.stringify(error.body)}`
426
- );
482
+ cleanup();
483
+ if (isAbortError(error)) {
484
+ if (signal?.aborted && !didTimeout()) {
485
+ throw error;
486
+ }
487
+ throw new UniportError({
488
+ code: "REQUEST_TIMEOUT",
489
+ message: "Quote request timed out"
490
+ });
427
491
  }
428
492
  throw error;
429
493
  }
494
+ cleanup();
495
+ if (!response.ok) {
496
+ const errorBody = await response.json().catch(() => ({}));
497
+ throw toUniportError(errorBody, {
498
+ code: "QUOTE_FAILED",
499
+ message: "Quote failed.",
500
+ status: response.status
501
+ });
502
+ }
503
+ const data = await response.json();
504
+ const quote = data.quote;
505
+ return {
506
+ depositAddress: quote.depositAddress || "",
507
+ memo: quote.depositMemo,
508
+ amountIn: quote.amountIn,
509
+ amountOut: quote.amountOut,
510
+ amountOutFormatted: quote.amountOutFormatted,
511
+ amountOutUsd: quote.amountOutUsd,
512
+ deadline: quote.deadline,
513
+ timeWhenInactive: quote.timeWhenInactive,
514
+ correlationId: data.correlationId
515
+ };
430
516
  }
431
517
  async function submitDepositTx(params) {
432
- ensureInitialized();
433
- const { txHash, depositAddress, memo, nearSenderAccount } = params;
518
+ const { backendUrl, requestTimeoutMs } = getUniportConfig();
519
+ const { signal, cleanup } = createTimeoutSignal(requestTimeoutMs);
520
+ let response;
434
521
  try {
435
- await oneClickSdkTypescript.OneClickService.submitDepositTx({
436
- txHash,
437
- depositAddress,
438
- memo,
439
- nearSenderAccount
522
+ response = await fetch(`${backendUrl}/api/deposit`, {
523
+ method: "POST",
524
+ headers: { "Content-Type": "application/json" },
525
+ signal,
526
+ body: JSON.stringify(params)
440
527
  });
441
528
  } catch (error) {
442
- if (error instanceof oneClickSdkTypescript.ApiError) {
443
- throw new Error(
444
- `Submit deposit failed (${error.status}): ${JSON.stringify(error.body)}`
445
- );
529
+ cleanup();
530
+ if (isAbortError(error)) {
531
+ throw new UniportError({
532
+ code: "REQUEST_TIMEOUT",
533
+ message: "Deposit submission timed out"
534
+ });
446
535
  }
447
536
  throw error;
448
537
  }
538
+ cleanup();
539
+ if (!response.ok) {
540
+ const errorBody = await response.json().catch(() => ({}));
541
+ throw toUniportError(errorBody, {
542
+ code: "DEPOSIT_SUBMISSION_FAILED",
543
+ message: "Submit deposit failed.",
544
+ status: response.status
545
+ });
546
+ }
449
547
  }
450
548
  async function getExecutionStatus(depositAddress, memo) {
451
- ensureInitialized();
549
+ const { backendUrl, requestTimeoutMs } = getUniportConfig();
550
+ const url = new URL(
551
+ `${backendUrl}/api/status/${encodeURIComponent(depositAddress)}`
552
+ );
553
+ if (memo) {
554
+ url.searchParams.set("memo", memo);
555
+ }
556
+ const { signal, cleanup } = createTimeoutSignal(requestTimeoutMs);
557
+ let response;
452
558
  try {
453
- const response = await oneClickSdkTypescript.OneClickService.getExecutionStatus(
454
- depositAddress,
455
- memo
456
- );
457
- const status = response.status;
458
- const isComplete = ["SUCCESS", "REFUNDED", "FAILED"].includes(status);
459
- const isSuccess = status === "SUCCESS";
460
- const swapDetails = response.swapDetails;
461
- const destinationTxHashes = swapDetails?.destinationChainTxHashes?.map((tx) => tx.hash);
462
- const originTxHashes = swapDetails?.originChainTxHashes?.map(
463
- (tx) => tx.hash
464
- );
465
- return {
466
- status,
467
- isComplete,
468
- isSuccess,
469
- correlationId: response.correlationId,
470
- destinationTxHashes,
471
- originTxHashes
472
- };
559
+ response = await fetch(url.toString(), { signal });
473
560
  } catch (error) {
474
- if (error instanceof oneClickSdkTypescript.ApiError) {
475
- throw new Error(
476
- `Status check failed (${error.status}): ${JSON.stringify(error.body)}`
477
- );
561
+ cleanup();
562
+ if (isAbortError(error)) {
563
+ throw new UniportError({
564
+ code: "REQUEST_TIMEOUT",
565
+ message: "Status check timed out"
566
+ });
478
567
  }
479
568
  throw error;
480
569
  }
570
+ cleanup();
571
+ if (!response.ok) {
572
+ const errorBody = await response.json().catch(() => ({}));
573
+ throw toUniportError(errorBody, {
574
+ code: "STATUS_CHECK_FAILED",
575
+ message: "Status check failed.",
576
+ status: response.status
577
+ });
578
+ }
579
+ return await response.json();
481
580
  }
482
581
  async function pollExecutionStatus(depositAddress, options) {
483
582
  const {
@@ -502,68 +601,109 @@ async function pollExecutionStatus(depositAddress, options) {
502
601
  throw new Error(`Timeout waiting for swap completion after ${timeout}ms`);
503
602
  }
504
603
  function useUniportPayment(options) {
505
- const { recipient, refundAddress, destinationToken, onSuccess, onError } = options;
506
- const destToken = destinationToken === "suiSUI" ? suiSUI : suiUSDC;
507
- const [paymentState, setPaymentState] = React.useState("idle");
508
- const [quote, setQuote] = React.useState(null);
509
- const [previewQuote, setPreviewQuote] = React.useState(null);
510
- const [isLoadingPreview, setIsLoadingPreview] = React.useState(false);
511
- const [status, setStatus] = React.useState(null);
512
- const [error, setError] = React.useState(null);
513
- const [selectedChain, setSelectedChain] = React.useState(null);
514
- const [selectedToken, setSelectedToken] = React.useState(null);
515
- const [amount, setAmountState] = React.useState("");
516
- const pollingRef = React.useRef(null);
517
- const lastStatusRef = React.useRef(null);
518
- const previewDebounceRef = React.useRef(null);
519
- const chains = getSupportedChains().filter((c) => c.id !== "sui");
604
+ const {
605
+ recipient,
606
+ refundAddress: initialRefundAddress,
607
+ destinationToken,
608
+ amount: initialAmount,
609
+ onSuccess,
610
+ onError
611
+ } = options;
612
+ const destToken = getToken(destinationToken);
613
+ if (!destToken) {
614
+ throw new Error(
615
+ `Invalid destinationToken: "${destinationToken}". Use a valid token name like "suiUSDC", "arbitrumUSDC", "ethereumUSDC", or "baseETH". See the supported tokens table in the README.`
616
+ );
617
+ }
618
+ const [paymentState, setPaymentState] = react.useState("idle");
619
+ const [quote, setQuote] = react.useState(null);
620
+ const [previewQuote, setPreviewQuote] = react.useState(null);
621
+ const [isLoadingPreview, setIsLoadingPreview] = react.useState(false);
622
+ const [status, setStatus] = react.useState(null);
623
+ const [error, setError] = react.useState(null);
624
+ const [selectedChain, setSelectedChain] = react.useState(null);
625
+ const [selectedToken, setSelectedToken] = react.useState(null);
626
+ const [amount, setAmountState] = react.useState(initialAmount ?? "");
627
+ const [refundAddress, setRefundAddressState] = react.useState(
628
+ initialRefundAddress ?? ""
629
+ );
630
+ const pollingRef = react.useRef(null);
631
+ const lastStatusRef = react.useRef(null);
632
+ const previewDebounceRef = react.useRef(null);
633
+ const previewAbortRef = react.useRef(null);
634
+ const chains = getSupportedChains().filter((c) => c.id !== destToken.chain);
520
635
  const tokens = selectedChain?.tokens || [];
521
- const destinationTokens = getSuiDestinationTokens();
522
- const setAmount = React.useCallback(
523
- (newAmount) => {
524
- setAmountState(newAmount);
636
+ const schedulePreviewQuote = react.useCallback(
637
+ (nextAmount, nextRefundAddress, nextSelectedToken) => {
525
638
  setPreviewQuote(null);
526
639
  if (previewDebounceRef.current) {
527
640
  clearTimeout(previewDebounceRef.current);
528
641
  }
529
- if (newAmount && selectedToken && refundAddress) {
530
- setIsLoadingPreview(true);
531
- previewDebounceRef.current = setTimeout(async () => {
532
- try {
533
- const result = await getQuote({
534
- originToken: selectedToken,
535
- destinationToken: destToken,
536
- amount: newAmount,
537
- recipient,
538
- refundTo: refundAddress,
539
- dry: true
540
- // Dry run for preview
541
- });
542
- setPreviewQuote(result);
543
- } catch (err) {
544
- console.warn("Preview quote failed:", err);
545
- } finally {
546
- setIsLoadingPreview(false);
547
- }
548
- }, 3e3);
549
- } else {
642
+ if (previewAbortRef.current) {
643
+ previewAbortRef.current.abort();
644
+ previewAbortRef.current = null;
645
+ }
646
+ if (!nextAmount || !nextSelectedToken || !nextRefundAddress) {
550
647
  setIsLoadingPreview(false);
648
+ return;
551
649
  }
650
+ setIsLoadingPreview(true);
651
+ previewDebounceRef.current = setTimeout(async () => {
652
+ const controller = new AbortController();
653
+ previewAbortRef.current = controller;
654
+ try {
655
+ const result = await getQuote({
656
+ originToken: nextSelectedToken,
657
+ destinationToken: destToken,
658
+ amount: nextAmount,
659
+ recipient,
660
+ refundTo: nextRefundAddress,
661
+ dry: true,
662
+ signal: controller.signal
663
+ });
664
+ setPreviewQuote(result);
665
+ } catch (err) {
666
+ if (err instanceof Error && err.name === "AbortError") {
667
+ return;
668
+ }
669
+ console.warn("Preview quote failed:", err);
670
+ } finally {
671
+ if (previewAbortRef.current === controller) {
672
+ previewAbortRef.current = null;
673
+ }
674
+ setIsLoadingPreview(false);
675
+ }
676
+ }, 250);
677
+ },
678
+ [destToken, recipient]
679
+ );
680
+ const setAmount = react.useCallback(
681
+ (newAmount) => {
682
+ setAmountState(newAmount);
683
+ schedulePreviewQuote(newAmount, refundAddress, selectedToken);
684
+ },
685
+ [refundAddress, schedulePreviewQuote, selectedToken]
686
+ );
687
+ const setRefundAddress = react.useCallback(
688
+ (newRefundAddress) => {
689
+ setRefundAddressState(newRefundAddress);
690
+ schedulePreviewQuote(amount, newRefundAddress, selectedToken);
552
691
  },
553
- [selectedToken, refundAddress, recipient, destToken]
692
+ [amount, schedulePreviewQuote, selectedToken]
554
693
  );
555
- const handleChainSelect = React.useCallback((chain) => {
694
+ const handleChainSelect = react.useCallback((chain) => {
695
+ const nextToken = chain.tokens[0] || null;
556
696
  setSelectedChain(chain);
557
- setSelectedToken(chain.tokens[0] || null);
697
+ setSelectedToken(nextToken);
558
698
  setPaymentState("selecting");
559
- setPreviewQuote(null);
560
- }, []);
561
- const handleTokenSelect = React.useCallback((token) => {
699
+ schedulePreviewQuote(amount, refundAddress, nextToken);
700
+ }, [amount, refundAddress, schedulePreviewQuote]);
701
+ const handleTokenSelect = react.useCallback((token) => {
562
702
  setSelectedToken(token);
563
703
  setPaymentState("selecting");
564
- setPreviewQuote(null);
565
- }, []);
566
- const fetchQuote = React.useCallback(async () => {
704
+ schedulePreviewQuote(amount, refundAddress, token);
705
+ }, [amount, refundAddress, schedulePreviewQuote]);
706
+ const fetchQuote = react.useCallback(async () => {
567
707
  if (!selectedToken || !amount || !refundAddress) {
568
708
  setError(new Error("Missing required fields"));
569
709
  return;
@@ -595,7 +735,13 @@ function useUniportPayment(options) {
595
735
  destToken,
596
736
  onError
597
737
  ]);
598
- const pollStatus = React.useCallback(async () => {
738
+ const stopPolling = react.useCallback(() => {
739
+ if (pollingRef.current) {
740
+ clearInterval(pollingRef.current);
741
+ pollingRef.current = null;
742
+ }
743
+ }, []);
744
+ const pollStatus = react.useCallback(async () => {
599
745
  if (!quote?.depositAddress) return;
600
746
  try {
601
747
  const result = await getExecutionStatus(
@@ -614,10 +760,12 @@ function useUniportPayment(options) {
614
760
  txHash: result.destinationTxHashes?.[0] || "",
615
761
  amount: quote.amountOut
616
762
  });
617
- } else if (result.status === "FAILED") {
763
+ } else if (result.isComplete) {
618
764
  setPaymentState("error");
619
765
  stopPolling();
620
- const err = new Error("Payment failed");
766
+ const err = new Error(
767
+ result.status === "REFUNDED" ? "Payment was refunded" : "Payment failed"
768
+ );
621
769
  setError(err);
622
770
  onError?.(err);
623
771
  }
@@ -625,19 +773,13 @@ function useUniportPayment(options) {
625
773
  } catch (err) {
626
774
  console.error("Status poll error:", err);
627
775
  }
628
- }, [quote, onSuccess, onError]);
629
- const startPolling = React.useCallback(() => {
776
+ }, [quote, onSuccess, onError, stopPolling]);
777
+ const startPolling = react.useCallback(() => {
630
778
  if (pollingRef.current) return;
631
779
  pollStatus();
632
780
  pollingRef.current = setInterval(pollStatus, 3e3);
633
781
  }, [pollStatus]);
634
- const stopPolling = React.useCallback(() => {
635
- if (pollingRef.current) {
636
- clearInterval(pollingRef.current);
637
- pollingRef.current = null;
638
- }
639
- }, []);
640
- const copyToClipboard = React.useCallback(async (text) => {
782
+ const copyToClipboard = react.useCallback(async (text) => {
641
783
  try {
642
784
  await navigator.clipboard.writeText(text);
643
785
  return true;
@@ -645,11 +787,15 @@ function useUniportPayment(options) {
645
787
  return false;
646
788
  }
647
789
  }, []);
648
- const reset = React.useCallback(() => {
790
+ const reset = react.useCallback(() => {
649
791
  stopPolling();
650
792
  if (previewDebounceRef.current) {
651
793
  clearTimeout(previewDebounceRef.current);
652
794
  }
795
+ if (previewAbortRef.current) {
796
+ previewAbortRef.current.abort();
797
+ previewAbortRef.current = null;
798
+ }
653
799
  setPaymentState("idle");
654
800
  setQuote(null);
655
801
  setPreviewQuote(null);
@@ -658,15 +804,28 @@ function useUniportPayment(options) {
658
804
  setError(null);
659
805
  setSelectedChain(null);
660
806
  setSelectedToken(null);
661
- setAmountState("");
807
+ setAmountState(initialAmount ?? "");
808
+ setRefundAddressState(initialRefundAddress ?? "");
809
+ lastStatusRef.current = null;
810
+ }, [initialAmount, initialRefundAddress, stopPolling]);
811
+ const cancelQuote = react.useCallback(() => {
812
+ stopPolling();
813
+ setPaymentState("selecting");
814
+ setQuote(null);
815
+ setStatus(null);
816
+ setError(null);
662
817
  lastStatusRef.current = null;
663
818
  }, [stopPolling]);
664
- React.useEffect(() => {
819
+ react.useEffect(() => {
665
820
  return () => {
666
821
  stopPolling();
667
822
  if (previewDebounceRef.current) {
668
823
  clearTimeout(previewDebounceRef.current);
669
824
  }
825
+ if (previewAbortRef.current) {
826
+ previewAbortRef.current.abort();
827
+ previewAbortRef.current = null;
828
+ }
670
829
  };
671
830
  }, [stopPolling]);
672
831
  return {
@@ -679,281 +838,73 @@ function useUniportPayment(options) {
679
838
  selectedChain,
680
839
  selectedToken,
681
840
  amount,
841
+ refundAddress,
682
842
  destinationToken: destToken,
683
843
  chains,
684
844
  tokens,
685
- destinationTokens,
686
845
  setSelectedChain: handleChainSelect,
687
846
  setSelectedToken: handleTokenSelect,
688
847
  setAmount,
848
+ setRefundAddress,
689
849
  fetchQuote,
690
850
  startPolling,
691
851
  stopPolling,
852
+ cancelQuote,
692
853
  reset,
693
854
  copyToClipboard
694
855
  };
695
856
  }
696
- var styles = {
697
- overlay: {
698
- position: "fixed",
699
- inset: 0,
700
- backgroundColor: "rgba(0, 0, 0, 0.8)",
701
- backdropFilter: "blur(8px)",
702
- display: "flex",
703
- alignItems: "center",
704
- justifyContent: "center",
705
- zIndex: 9999,
706
- padding: "16px",
707
- animation: "uniport-fade-in 0.2s ease"
708
- },
709
- modal: {
710
- position: "relative",
711
- width: "100%",
712
- maxWidth: "380px",
713
- background: "rgba(22, 22, 30, 0.95)",
714
- backdropFilter: "blur(24px)",
715
- border: "1px solid rgba(255, 255, 255, 0.08)",
716
- borderRadius: "24px",
717
- padding: "24px",
718
- boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05)",
719
- fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
720
- animation: "uniport-slide-up 0.3s ease"
721
- },
722
- header: {
723
- display: "flex",
724
- flexDirection: "column",
725
- alignItems: "center",
726
- marginBottom: "24px"
727
- },
728
- headerIcon: {
729
- width: "48px",
730
- height: "48px",
731
- borderRadius: "16px",
732
- background: "linear-gradient(135deg, rgba(255,255,255,0.1), transparent)",
733
- border: "1px solid rgba(255,255,255,0.05)",
734
- display: "flex",
735
- alignItems: "center",
736
- justifyContent: "center",
737
- marginBottom: "16px"
738
- },
739
- title: {
740
- fontSize: "18px",
741
- fontWeight: 500,
742
- color: "white",
743
- margin: 0,
744
- textShadow: "0 0 15px rgba(255,255,255,0.3)"
745
- },
746
- subtitle: {
747
- fontSize: "12px",
748
- color: "rgba(255,255,255,0.4)",
749
- marginTop: "4px",
750
- fontWeight: 300,
751
- letterSpacing: "0.5px"
752
- },
753
- closeButton: {
754
- position: "absolute",
755
- top: "16px",
756
- right: "16px",
757
- width: "32px",
758
- height: "32px",
759
- borderRadius: "8px",
760
- background: "rgba(255,255,255,0.05)",
761
- border: "1px solid rgba(255,255,255,0.1)",
762
- color: "rgba(255,255,255,0.6)",
763
- cursor: "pointer",
764
- display: "flex",
765
- alignItems: "center",
766
- justifyContent: "center",
767
- transition: "all 0.2s"
768
- },
769
- selectorsRow: {
770
- display: "grid",
771
- gridTemplateColumns: "1fr 1fr",
772
- gap: "12px",
773
- marginBottom: "24px"
774
- },
775
- selector: {
776
- display: "flex",
777
- alignItems: "center",
778
- justifyContent: "space-between",
779
- padding: "12px",
780
- background: "rgba(255,255,255,0.05)",
781
- border: "1px solid rgba(255,255,255,0.05)",
782
- borderRadius: "16px",
783
- cursor: "pointer",
784
- transition: "all 0.2s"
785
- },
786
- selectorIcon: {
787
- width: "32px",
788
- height: "32px",
789
- borderRadius: "50%",
790
- background: "#1c1c26",
791
- border: "1px solid rgba(255,255,255,0.1)",
792
- display: "flex",
793
- alignItems: "center",
794
- justifyContent: "center",
795
- overflow: "hidden"
796
- },
797
- selectorLabel: {
798
- fontSize: "10px",
799
- textTransform: "uppercase",
800
- letterSpacing: "1.5px",
801
- color: "rgba(255,255,255,0.3)",
802
- fontWeight: 500
803
- },
804
- selectorValue: {
805
- fontSize: "14px",
806
- color: "rgba(255,255,255,0.9)",
807
- fontWeight: 500
808
- },
809
- amountInput: {
810
- width: "100%",
811
- textAlign: "center",
812
- fontSize: "48px",
813
- fontWeight: 500,
814
- color: "white",
815
- background: "transparent",
816
- border: "none",
817
- outline: "none",
818
- marginBottom: "24px",
819
- caretColor: "#4F46E5"
820
- },
821
- details: {
822
- marginBottom: "20px",
823
- padding: "0 4px"
824
- },
825
- detailRow: {
826
- display: "flex",
827
- justifyContent: "space-between",
828
- alignItems: "center",
829
- fontSize: "12px",
830
- color: "rgba(255,255,255,0.4)",
831
- marginBottom: "8px"
832
- },
833
- detailValue: {
834
- fontWeight: 500,
835
- color: "rgba(255,255,255,0.7)",
836
- display: "flex",
837
- alignItems: "center",
838
- gap: "6px"
839
- },
840
- button: {
841
- width: "100%",
842
- position: "relative",
843
- overflow: "hidden",
844
- borderRadius: "16px",
845
- padding: "2px",
846
- background: "linear-gradient(90deg, #4F46E5, #7C3AED, #4F46E5)",
847
- backgroundSize: "200% 200%",
848
- animation: "uniport-gradient 3s ease infinite",
849
- border: "none",
850
- cursor: "pointer"
851
- },
852
- buttonInner: {
853
- display: "flex",
854
- alignItems: "center",
855
- justifyContent: "center",
856
- gap: "8px",
857
- height: "48px",
858
- borderRadius: "14px",
859
- background: "#0A0A0F",
860
- color: "white",
861
- fontSize: "14px",
862
- fontWeight: 500,
863
- transition: "background 0.3s"
864
- },
865
- buttonDisabled: {
866
- opacity: 0.5,
867
- cursor: "not-allowed"
868
- },
869
- // QR container - dark background, no white box
870
- qrContainer: {
871
- display: "flex",
872
- flexDirection: "column",
873
- alignItems: "center",
874
- padding: "24px",
875
- background: "transparent",
876
- marginBottom: "16px"
877
- },
878
- // Address with copy button
879
- addressContainer: {
880
- display: "flex",
881
- alignItems: "center",
882
- justifyContent: "center",
883
- gap: "8px",
884
- marginTop: "16px"
885
- },
886
- addressText: {
887
- fontSize: "12px",
888
- color: "rgba(255,255,255,0.6)",
889
- wordBreak: "break-all",
890
- textAlign: "center",
891
- fontFamily: "monospace"
892
- },
893
- copyButton: {
894
- display: "flex",
895
- alignItems: "center",
896
- justifyContent: "center",
897
- width: "32px",
898
- height: "32px",
899
- borderRadius: "8px",
900
- background: "rgba(255,255,255,0.1)",
901
- border: "1px solid rgba(255,255,255,0.15)",
902
- cursor: "pointer",
903
- transition: "all 0.2s",
904
- flexShrink: 0
905
- },
906
- statusBadge: {
907
- display: "inline-flex",
908
- alignItems: "center",
909
- gap: "6px",
910
- padding: "6px 12px",
911
- borderRadius: "20px",
912
- fontSize: "12px",
913
- fontWeight: 500
914
- },
915
- processingBadge: {
916
- background: "rgba(79, 70, 229, 0.2)",
917
- color: "#818CF8"
918
- },
919
- dropdown: {
920
- position: "absolute",
921
- top: "calc(100% + 8px)",
922
- left: 0,
923
- right: 0,
924
- background: "rgba(22, 22, 30, 0.98)",
925
- border: "1px solid rgba(255,255,255,0.1)",
926
- borderRadius: "16px",
927
- maxHeight: "200px",
928
- overflowY: "auto",
929
- zIndex: 10,
930
- boxShadow: "0 20px 40px rgba(0,0,0,0.5)"
931
- },
932
- dropdownItem: {
933
- display: "flex",
934
- alignItems: "center",
935
- gap: "12px",
936
- padding: "12px 16px",
937
- cursor: "pointer",
938
- transition: "background 0.2s"
939
- },
940
- loadingDot: {
941
- width: "8px",
942
- height: "8px",
943
- borderRadius: "50%",
944
- background: "#818CF8",
945
- animation: "uniport-pulse 1s ease infinite"
946
- },
947
- tokenBadge: {
948
- display: "inline-flex",
949
- alignItems: "center",
950
- gap: "4px",
951
- padding: "2px 8px",
952
- borderRadius: "12px",
953
- background: "rgba(255,255,255,0.08)",
954
- fontSize: "11px"
955
- }
857
+ var LIGHT = {
858
+ overlay: "rgba(0, 0, 0, 0.42)",
859
+ modalBg: "#ffffff",
860
+ rowHover: "#f5f5f7",
861
+ inputBg: "#f5f5f7",
862
+ warningBg: "#fffbeb",
863
+ warningBorder: "rgba(245, 158, 11, 0.25)",
864
+ text: "#1c1c1e",
865
+ textSecondary: "#3a3a3c",
866
+ textMuted: "#8e8e93",
867
+ border: "#e5e5ea",
868
+ accent: "#6366f1",
869
+ success: "#30d158",
870
+ error: "#ff3b30",
871
+ warning: "#d97706",
872
+ warningText: "#92400e",
873
+ btnBg: "#1c1c1e",
874
+ btnText: "#ffffff",
875
+ btnDisabledBg: "#e5e5ea",
876
+ btnDisabledText: "#8e8e93",
877
+ iconBtnBg: "#f5f5f7",
878
+ iconBtnHover: "#e5e5ea",
879
+ iconBtnColor: "#3a3a3c"
956
880
  };
881
+ var DARK = {
882
+ overlay: "rgba(0, 0, 0, 0.65)",
883
+ modalBg: "#1c1c1e",
884
+ rowHover: "#2c2c2e",
885
+ inputBg: "#2c2c2e",
886
+ warningBg: "rgba(245, 158, 11, 0.1)",
887
+ warningBorder: "rgba(245, 158, 11, 0.2)",
888
+ text: "#ffffff",
889
+ textSecondary: "rgba(235, 235, 245, 0.85)",
890
+ textMuted: "#8e8e93",
891
+ border: "#38383a",
892
+ accent: "#818cf8",
893
+ success: "#30d158",
894
+ error: "#ff453a",
895
+ warning: "#ffd60a",
896
+ warningText: "#ffd60a",
897
+ btnBg: "#6366f1",
898
+ btnText: "#ffffff",
899
+ btnDisabledBg: "#3a3a3c",
900
+ btnDisabledText: "#636366",
901
+ iconBtnBg: "#2c2c2e",
902
+ iconBtnHover: "#3a3a3c",
903
+ iconBtnColor: "rgba(235, 235, 245, 0.8)"
904
+ };
905
+ function getTheme(mode) {
906
+ return mode === "dark" ? DARK : LIGHT;
907
+ }
957
908
  var injectStyles = () => {
958
909
  if (typeof document === "undefined") return;
959
910
  if (document.getElementById("uniport-styles")) return;
@@ -962,643 +913,861 @@ var injectStyles = () => {
962
913
  style.textContent = `
963
914
  @keyframes uniport-fade-in {
964
915
  from { opacity: 0; }
965
- to { opacity: 1; }
916
+ to { opacity: 1; }
966
917
  }
967
918
  @keyframes uniport-slide-up {
968
- from { opacity: 0; transform: translateY(20px) scale(0.95); }
969
- to { opacity: 1; transform: translateY(0) scale(1); }
919
+ from { opacity: 0; transform: translateY(14px) scale(0.98); }
920
+ to { opacity: 1; transform: translateY(0) scale(1); }
970
921
  }
971
- @keyframes uniport-gradient {
972
- 0% { background-position: 0% 50%; }
973
- 50% { background-position: 100% 50%; }
974
- 100% { background-position: 0% 50%; }
922
+ @keyframes uniport-spin {
923
+ from { transform: rotate(0deg); }
924
+ to { transform: rotate(360deg); }
975
925
  }
976
926
  @keyframes uniport-pulse {
977
927
  0%, 100% { opacity: 1; }
978
- 50% { opacity: 0.3; }
928
+ 50% { opacity: 0.35; }
979
929
  }
980
930
  `;
981
931
  document.head.appendChild(style);
982
932
  };
933
+ var AVATAR_COLORS = [
934
+ "#6366f1",
935
+ "#8b5cf6",
936
+ "#06b6d4",
937
+ "#10b981",
938
+ "#f59e0b",
939
+ "#ef4444",
940
+ "#ec4899",
941
+ "#3b82f6",
942
+ "#14b8a6",
943
+ "#f97316"
944
+ ];
945
+ function charColor(name) {
946
+ let h = 0;
947
+ for (let i = 0; i < name.length; i++) {
948
+ h = name.charCodeAt(i) + ((h << 5) - h);
949
+ }
950
+ return AVATAR_COLORS[Math.abs(h) % AVATAR_COLORS.length];
951
+ }
952
+ function TokenAvatar({ src, name, size = 40 }) {
953
+ const [failed, setFailed] = react.useState(false);
954
+ if (failed || !src) {
955
+ return /* @__PURE__ */ jsxRuntime.jsx(
956
+ "div",
957
+ {
958
+ "aria-label": name,
959
+ style: {
960
+ width: size,
961
+ height: size,
962
+ borderRadius: "50%",
963
+ background: charColor(name),
964
+ display: "flex",
965
+ alignItems: "center",
966
+ justifyContent: "center",
967
+ fontSize: Math.round(size * 0.4),
968
+ fontWeight: 700,
969
+ color: "#fff",
970
+ flexShrink: 0,
971
+ userSelect: "none",
972
+ letterSpacing: "-0.01em"
973
+ },
974
+ children: name.charAt(0).toUpperCase()
975
+ }
976
+ );
977
+ }
978
+ return /* @__PURE__ */ jsxRuntime.jsx(
979
+ "img",
980
+ {
981
+ src,
982
+ alt: name,
983
+ width: size,
984
+ height: size,
985
+ style: { borderRadius: "50%", objectFit: "cover", flexShrink: 0, display: "block" },
986
+ onError: () => setFailed(true)
987
+ }
988
+ );
989
+ }
990
+ function BackArrow({ color }) {
991
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 12H5M5 12l7 7M5 12l7-7", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
992
+ }
993
+ function XMark({ color }) {
994
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12", stroke: color, strokeWidth: "2.5", strokeLinecap: "round" }) });
995
+ }
996
+ function ChevronRight({ color }) {
997
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 18l6-6-6-6", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
998
+ }
999
+ function Spinner({ color }) {
1000
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1001
+ "svg",
1002
+ {
1003
+ width: "18",
1004
+ height: "18",
1005
+ viewBox: "0 0 24 24",
1006
+ fill: "none",
1007
+ style: { animation: "uniport-spin 0.75s linear infinite", display: "block", flexShrink: 0 },
1008
+ children: [
1009
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10", stroke: color, strokeWidth: "3", strokeOpacity: "0.2" }),
1010
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2a10 10 0 019.95 9", stroke: color, strokeWidth: "3", strokeLinecap: "round" })
1011
+ ]
1012
+ }
1013
+ );
1014
+ }
1015
+ function CopyIcon({ color }) {
1016
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: [
1017
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", stroke: color, strokeWidth: "2" }),
1018
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1", stroke: color, strokeWidth: "2" })
1019
+ ] });
1020
+ }
1021
+ function CheckMark({ color }) {
1022
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6L9 17l-5-5", stroke: color, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1023
+ }
1024
+ function WarningTriangle({ color }) {
1025
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", style: { flexShrink: 0, marginTop: 1 }, children: [
1026
+ /* @__PURE__ */ jsxRuntime.jsx(
1027
+ "path",
1028
+ {
1029
+ d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",
1030
+ stroke: color,
1031
+ strokeWidth: "2",
1032
+ strokeLinecap: "round",
1033
+ strokeLinejoin: "round"
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13", stroke: color, strokeWidth: "2", strokeLinecap: "round" }),
1037
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17", stroke: color, strokeWidth: "2", strokeLinecap: "round" })
1038
+ ] });
1039
+ }
983
1040
  function UniportModal({
984
1041
  open,
985
1042
  onClose,
986
1043
  recipient,
987
1044
  refundAddress,
988
- destinationToken = "suiUSDC",
1045
+ destinationToken,
989
1046
  amount: initialAmount,
1047
+ theme: themeMode = "light",
990
1048
  onSuccess,
991
1049
  onError
992
1050
  }) {
1051
+ const t = getTheme(themeMode);
993
1052
  const payment = useUniportPayment({
994
1053
  recipient,
995
1054
  refundAddress,
996
1055
  destinationToken,
1056
+ amount: initialAmount,
997
1057
  onSuccess,
998
1058
  onError
999
1059
  });
1000
- const [chainDropdownOpen, setChainDropdownOpen] = React__default.default.useState(false);
1001
- const [tokenDropdownOpen, setTokenDropdownOpen] = React__default.default.useState(false);
1002
- const [copied, setCopied] = React.useState(false);
1003
- const [showReceipt, setShowReceipt] = React.useState(false);
1004
- React.useEffect(() => {
1060
+ const [modalStep, setModalStep] = react.useState("chain");
1061
+ const [copied, setCopied] = react.useState(false);
1062
+ const [showReceipt, setShowReceipt] = react.useState(false);
1063
+ const [portalRoot, setPortalRoot] = react.useState(null);
1064
+ react.useEffect(() => {
1065
+ setPortalRoot(document.body);
1005
1066
  injectStyles();
1006
1067
  }, []);
1007
- React.useEffect(() => {
1008
- if (payment.paymentState === "awaiting_deposit") {
1009
- payment.startPolling();
1010
- }
1068
+ react.useEffect(() => {
1069
+ if (payment.paymentState === "awaiting_deposit") payment.startPolling();
1011
1070
  }, [payment.paymentState]);
1012
- React.useEffect(() => {
1071
+ react.useEffect(() => {
1013
1072
  return () => payment.stopPolling();
1014
1073
  }, []);
1015
- const handleClose = React.useCallback(() => {
1074
+ const handleClose = react.useCallback(() => {
1016
1075
  payment.reset();
1076
+ setModalStep("chain");
1077
+ setShowReceipt(false);
1017
1078
  onClose();
1018
1079
  }, [payment, onClose]);
1019
- React.useEffect(() => {
1020
- const handleEscape = (e) => {
1080
+ react.useEffect(() => {
1081
+ const onKey = (e) => {
1021
1082
  if (e.key === "Escape") handleClose();
1022
1083
  };
1023
1084
  if (open) {
1024
- document.addEventListener("keydown", handleEscape);
1025
- return () => document.removeEventListener("keydown", handleEscape);
1085
+ document.addEventListener("keydown", onKey);
1086
+ document.body.style.overflow = "hidden";
1087
+ return () => {
1088
+ document.removeEventListener("keydown", onKey);
1089
+ document.body.style.overflow = "";
1090
+ };
1026
1091
  }
1027
1092
  }, [open, handleClose]);
1028
- const handleCopy = React.useCallback(async () => {
1093
+ const handleCopy = react.useCallback(async () => {
1029
1094
  if (payment.quote?.depositAddress) {
1030
- const success = await payment.copyToClipboard(payment.quote.depositAddress);
1031
- if (success) {
1095
+ const ok = await payment.copyToClipboard(payment.quote.depositAddress);
1096
+ if (ok) {
1032
1097
  setCopied(true);
1033
1098
  setTimeout(() => setCopied(false), 2e3);
1034
1099
  }
1035
1100
  }
1036
1101
  }, [payment]);
1037
- if (!open) return null;
1038
- const canSubmit = payment.selectedToken && payment.amount && refundAddress;
1039
- const isProcessing = payment.paymentState === "quoting" || payment.paymentState === "processing";
1040
- const showQR = payment.paymentState === "awaiting_deposit" || payment.paymentState === "processing";
1041
- const isSuccess = payment.paymentState === "success";
1042
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.overlay, onClick: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.modal, onClick: (e) => e.stopPropagation(), children: [
1043
- /* @__PURE__ */ jsxRuntime.jsx(
1044
- "button",
1045
- {
1046
- style: styles.closeButton,
1047
- onClick: handleClose,
1048
- onMouseEnter: (e) => {
1049
- e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1050
- },
1051
- onMouseLeave: (e) => {
1052
- e.currentTarget.style.background = "rgba(255,255,255,0.05)";
1053
- },
1054
- children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, {})
1055
- }
1056
- ),
1057
- isSuccess ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", paddingTop: "20px" }, children: [
1058
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { ...styles.title, marginBottom: "32px", fontSize: "20px" }, children: "Payment Successful" }),
1059
- /* @__PURE__ */ jsxRuntime.jsx(
1060
- "div",
1061
- {
1062
- style: {
1063
- width: "100px",
1064
- height: "100px",
1065
- borderRadius: "50%",
1066
- background: "rgba(22, 22, 30, 0.9)",
1067
- border: "3px solid #10B981",
1068
- display: "flex",
1069
- alignItems: "center",
1070
- justifyContent: "center",
1071
- margin: "0 auto 24px",
1072
- boxShadow: "0 0 30px rgba(16, 185, 129, 0.3)"
1073
- },
1074
- children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", stroke: "#10B981", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) })
1075
- }
1076
- ),
1077
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "white", fontSize: "18px", fontWeight: 500, marginBottom: "8px" }, children: "Payment Completed" }),
1078
- /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "14px", marginBottom: "32px" }, children: [
1079
- payment.amount,
1080
- " ",
1081
- payment.selectedToken?.symbol,
1082
- " \u2192 ~",
1083
- payment.quote?.amountOutFormatted || "",
1084
- " ",
1085
- payment.destinationToken.symbol,
1086
- " on Sui"
1087
- ] }),
1088
- /* @__PURE__ */ jsxRuntime.jsx(
1089
- "button",
1090
- {
1091
- onClick: () => setShowReceipt(!showReceipt),
1092
- style: { background: "transparent", border: "none", color: "rgba(255,255,255,0.6)", fontSize: "14px", cursor: "pointer", textDecoration: "underline", marginBottom: showReceipt ? "16px" : "0" },
1093
- children: showReceipt ? "Hide receipt" : "Show receipt"
1094
- }
1095
- ),
1096
- showReceipt && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { background: "rgba(255,255,255,0.05)", borderRadius: "12px", padding: "16px", textAlign: "left", marginTop: "8px" }, children: [
1097
- payment.status?.originTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "12px" }, children: [
1098
- /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "12px", marginBottom: "4px" }, children: [
1099
- "Source TX (",
1100
- payment.selectedChain?.name,
1101
- ")"
1102
+ if (!open || !portalRoot) return null;
1103
+ const { paymentState } = payment;
1104
+ const showQR = paymentState === "awaiting_deposit" || paymentState === "processing";
1105
+ const isSuccess = paymentState === "success";
1106
+ const isError = paymentState === "error";
1107
+ const isQuoting = paymentState === "quoting";
1108
+ const canSubmit = !!(payment.selectedToken && payment.amount && payment.refundAddress.trim());
1109
+ const showBack = !isSuccess && !isError && (showQR || modalStep !== "chain");
1110
+ const iconBtn = {
1111
+ width: 36,
1112
+ height: 36,
1113
+ borderRadius: "50%",
1114
+ background: t.iconBtnBg,
1115
+ border: "none",
1116
+ cursor: "pointer",
1117
+ display: "flex",
1118
+ alignItems: "center",
1119
+ justifyContent: "center",
1120
+ transition: "background 0.15s",
1121
+ flexShrink: 0,
1122
+ padding: 0
1123
+ };
1124
+ const primaryBtn = (disabled) => ({
1125
+ width: "100%",
1126
+ height: 52,
1127
+ borderRadius: "14px",
1128
+ border: "none",
1129
+ background: disabled ? t.btnDisabledBg : t.btnBg,
1130
+ color: disabled ? t.btnDisabledText : t.btnText,
1131
+ fontSize: "15px",
1132
+ fontWeight: 600,
1133
+ cursor: disabled ? "not-allowed" : "pointer",
1134
+ display: "flex",
1135
+ alignItems: "center",
1136
+ justifyContent: "center",
1137
+ gap: "8px",
1138
+ fontFamily: "inherit",
1139
+ letterSpacing: "-0.01em"
1140
+ });
1141
+ const warningBox = {
1142
+ display: "flex",
1143
+ gap: "9px",
1144
+ alignItems: "flex-start",
1145
+ padding: "11px 13px",
1146
+ background: t.warningBg,
1147
+ border: `1px solid ${t.warningBorder}`,
1148
+ borderRadius: "10px"
1149
+ };
1150
+ const renderHeader = (title) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1151
+ display: "flex",
1152
+ alignItems: "center",
1153
+ justifyContent: "space-between",
1154
+ padding: "18px 18px 0",
1155
+ marginBottom: "12px"
1156
+ }, children: [
1157
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { width: 36, display: "flex" }, children: showBack && /* @__PURE__ */ jsxRuntime.jsx(
1158
+ "button",
1159
+ {
1160
+ style: iconBtn,
1161
+ onClick: () => {
1162
+ if (showQR) {
1163
+ payment.cancelQuote();
1164
+ setModalStep("amount");
1165
+ } else if (modalStep === "token") setModalStep("chain");
1166
+ else if (modalStep === "amount") setModalStep("token");
1167
+ },
1168
+ onMouseEnter: (e) => {
1169
+ e.currentTarget.style.background = t.iconBtnHover;
1170
+ },
1171
+ onMouseLeave: (e) => {
1172
+ e.currentTarget.style.background = t.iconBtnBg;
1173
+ },
1174
+ children: /* @__PURE__ */ jsxRuntime.jsx(BackArrow, { color: t.iconBtnColor })
1175
+ }
1176
+ ) }),
1177
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { margin: 0, fontSize: "16px", fontWeight: 600, color: t.text, letterSpacing: "-0.015em" }, children: title }),
1178
+ /* @__PURE__ */ jsxRuntime.jsx(
1179
+ "button",
1180
+ {
1181
+ style: iconBtn,
1182
+ onClick: handleClose,
1183
+ onMouseEnter: (e) => {
1184
+ e.currentTarget.style.background = t.iconBtnHover;
1185
+ },
1186
+ onMouseLeave: (e) => {
1187
+ e.currentTarget.style.background = t.iconBtnBg;
1188
+ },
1189
+ children: /* @__PURE__ */ jsxRuntime.jsx(XMark, { color: t.iconBtnColor })
1190
+ }
1191
+ )
1192
+ ] });
1193
+ const renderChainStep = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1194
+ renderHeader("Select network"),
1195
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflowY: "auto", maxHeight: 420 }, children: payment.chains.map((chain, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1196
+ "button",
1197
+ {
1198
+ onClick: () => {
1199
+ payment.setSelectedChain(chain);
1200
+ setModalStep("token");
1201
+ },
1202
+ style: {
1203
+ display: "flex",
1204
+ alignItems: "center",
1205
+ gap: "14px",
1206
+ width: "100%",
1207
+ padding: "13px 20px",
1208
+ background: "transparent",
1209
+ border: "none",
1210
+ borderBottom: i < payment.chains.length - 1 ? `1px solid ${t.border}` : "none",
1211
+ cursor: "pointer",
1212
+ textAlign: "left",
1213
+ transition: "background 0.1s",
1214
+ fontFamily: "inherit"
1215
+ },
1216
+ onMouseEnter: (e) => {
1217
+ e.currentTarget.style.background = t.rowHover;
1218
+ },
1219
+ onMouseLeave: (e) => {
1220
+ e.currentTarget.style.background = "transparent";
1221
+ },
1222
+ children: [
1223
+ /* @__PURE__ */ jsxRuntime.jsx(TokenAvatar, { src: chain.icon, name: chain.name, size: 40 }),
1224
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1, fontSize: "15px", fontWeight: 500, color: t.text }, children: chain.name }),
1225
+ /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, { color: t.textMuted })
1226
+ ]
1227
+ },
1228
+ chain.id
1229
+ )) })
1230
+ ] });
1231
+ const renderTokenStep = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1232
+ renderHeader("Select token"),
1233
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { overflowY: "auto", maxHeight: 420 }, children: payment.tokens.map((token, i) => /* @__PURE__ */ jsxRuntime.jsxs(
1234
+ "button",
1235
+ {
1236
+ onClick: () => {
1237
+ payment.setSelectedToken(token);
1238
+ setModalStep("amount");
1239
+ },
1240
+ style: {
1241
+ display: "flex",
1242
+ alignItems: "center",
1243
+ gap: "14px",
1244
+ width: "100%",
1245
+ padding: "13px 20px",
1246
+ background: "transparent",
1247
+ border: "none",
1248
+ borderBottom: i < payment.tokens.length - 1 ? `1px solid ${t.border}` : "none",
1249
+ cursor: "pointer",
1250
+ textAlign: "left",
1251
+ transition: "background 0.1s",
1252
+ fontFamily: "inherit"
1253
+ },
1254
+ onMouseEnter: (e) => {
1255
+ e.currentTarget.style.background = t.rowHover;
1256
+ },
1257
+ onMouseLeave: (e) => {
1258
+ e.currentTarget.style.background = "transparent";
1259
+ },
1260
+ children: [
1261
+ /* @__PURE__ */ jsxRuntime.jsx(TokenAvatar, { src: token.icon, name: token.symbol, size: 40 }),
1262
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { flex: 1, fontSize: "15px", fontWeight: 500, color: t.text }, children: token.symbol }),
1263
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted, fontWeight: 500 }, children: payment.selectedChain?.name })
1264
+ ]
1265
+ },
1266
+ token.assetId
1267
+ )) })
1268
+ ] });
1269
+ const renderAmountStep = () => {
1270
+ const tok = payment.selectedToken;
1271
+ const ch = payment.selectedChain;
1272
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1273
+ renderHeader("Enter amount"),
1274
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "4px 20px 24px" }, children: [
1275
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1276
+ display: "flex",
1277
+ alignItems: "center",
1278
+ gap: "10px",
1279
+ padding: "10px 13px",
1280
+ background: t.inputBg,
1281
+ borderRadius: "12px",
1282
+ marginBottom: "24px"
1283
+ }, children: [
1284
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
1285
+ tok && /* @__PURE__ */ jsxRuntime.jsx(TokenAvatar, { src: tok.icon, name: tok.symbol, size: 30 }),
1286
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { marginLeft: -8, marginTop: 12 }, children: /* @__PURE__ */ jsxRuntime.jsx(TokenAvatar, { src: payment.destinationToken.icon, name: payment.destinationToken.symbol, size: 20 }) })
1102
1287
  ] }),
1103
- /* @__PURE__ */ jsxRuntime.jsxs("a", { href: payment.selectedChain?.id === "base" ? `https://basescan.org/tx/${hash}` : payment.selectedChain?.id === "arb" ? `https://arbiscan.io/tx/${hash}` : `https://etherscan.io/tx/${hash}`, target: "_blank", rel: "noopener noreferrer", style: { color: "#60A5FA", fontSize: "13px", textDecoration: "none", fontFamily: "monospace" }, children: [
1104
- hash.slice(0, 10),
1105
- "...",
1106
- hash.slice(-8),
1107
- " \u2197"
1288
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1289
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
1290
+ tok?.symbol,
1291
+ " on ",
1292
+ ch?.name
1293
+ ] }),
1294
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontSize: "12px", color: t.textMuted, marginTop: 1 }, children: [
1295
+ "\u2192 ",
1296
+ payment.destinationToken.symbol,
1297
+ " on ",
1298
+ payment.destinationToken.chain.toUpperCase()
1299
+ ] })
1108
1300
  ] })
1109
- ] }, `origin-${i}`)),
1110
- payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1111
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "12px", marginBottom: "4px" }, children: "Destination TX (Sui)" }),
1112
- /* @__PURE__ */ jsxRuntime.jsxs("a", { href: `https://suiscan.xyz/mainnet/tx/${hash}`, target: "_blank", rel: "noopener noreferrer", style: { color: "#60A5FA", fontSize: "13px", textDecoration: "none", fontFamily: "monospace" }, children: [
1113
- hash.slice(0, 10),
1114
- "...",
1115
- hash.slice(-8),
1116
- " \u2197"
1301
+ ] }),
1302
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { textAlign: "center", marginBottom: "6px" }, children: [
1303
+ /* @__PURE__ */ jsxRuntime.jsx(
1304
+ "input",
1305
+ {
1306
+ type: "text",
1307
+ inputMode: "decimal",
1308
+ placeholder: "0.00",
1309
+ value: payment.amount,
1310
+ onChange: (e) => payment.setAmount(e.target.value),
1311
+ style: {
1312
+ width: "100%",
1313
+ textAlign: "center",
1314
+ fontSize: "54px",
1315
+ fontWeight: 600,
1316
+ color: payment.amount ? t.text : t.textMuted,
1317
+ background: "transparent",
1318
+ border: "none",
1319
+ outline: "none",
1320
+ caretColor: t.accent,
1321
+ fontFamily: "inherit",
1322
+ letterSpacing: "-0.04em",
1323
+ lineHeight: 1,
1324
+ padding: 0
1325
+ },
1326
+ autoFocus: true
1327
+ }
1328
+ ),
1329
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: tok?.symbol })
1330
+ ] }),
1331
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "18px" }, children: [
1332
+ /* @__PURE__ */ jsxRuntime.jsxs(
1333
+ "label",
1334
+ {
1335
+ style: {
1336
+ display: "block",
1337
+ fontSize: "13px",
1338
+ fontWeight: 600,
1339
+ color: t.text,
1340
+ marginBottom: "8px"
1341
+ },
1342
+ children: [
1343
+ "Refund address on ",
1344
+ ch?.name || "the source chain"
1345
+ ]
1346
+ }
1347
+ ),
1348
+ /* @__PURE__ */ jsxRuntime.jsx(
1349
+ "input",
1350
+ {
1351
+ type: "text",
1352
+ value: payment.refundAddress,
1353
+ onChange: (e) => payment.setRefundAddress(e.target.value),
1354
+ placeholder: `Enter a ${ch?.name || "source chain"} refund address`,
1355
+ spellCheck: false,
1356
+ autoCapitalize: "off",
1357
+ autoCorrect: "off",
1358
+ style: {
1359
+ width: "100%",
1360
+ padding: "13px 14px",
1361
+ fontSize: "14px",
1362
+ color: payment.refundAddress ? t.text : t.textMuted,
1363
+ background: t.inputBg,
1364
+ border: `1px solid ${t.border}`,
1365
+ borderRadius: "12px",
1366
+ outline: "none",
1367
+ fontFamily: "inherit"
1368
+ }
1369
+ }
1370
+ ),
1371
+ /* @__PURE__ */ jsxRuntime.jsx(
1372
+ "p",
1373
+ {
1374
+ style: {
1375
+ margin: "8px 0 0",
1376
+ fontSize: "12px",
1377
+ color: t.textMuted,
1378
+ lineHeight: 1.5
1379
+ },
1380
+ children: "Used only if the swap fails. This address must live on the chain the payer is sending from."
1381
+ }
1382
+ )
1383
+ ] }),
1384
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1385
+ textAlign: "center",
1386
+ height: 32,
1387
+ display: "flex",
1388
+ alignItems: "center",
1389
+ justifyContent: "center",
1390
+ gap: 5,
1391
+ marginBottom: "20px"
1392
+ }, children: [
1393
+ payment.amount && payment.isLoadingPreview && [0, 0.2, 0.4].map((delay, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1394
+ width: 6,
1395
+ height: 6,
1396
+ borderRadius: "50%",
1397
+ background: t.accent,
1398
+ animation: `uniport-pulse 1s ease infinite ${delay}s`
1399
+ } }, i)),
1400
+ payment.amount && !payment.isLoadingPreview && payment.previewQuote && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "15px", color: t.textSecondary }, children: [
1401
+ "\u2248 ",
1402
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: t.text }, children: [
1403
+ payment.previewQuote.amountOutFormatted,
1404
+ " ",
1405
+ payment.destinationToken.symbol
1406
+ ] })
1407
+ ] }),
1408
+ payment.amount && !payment.isLoadingPreview && !payment.previewQuote && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "Fetching estimate\u2026" })
1409
+ ] }),
1410
+ !!payment.amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
1411
+ /* @__PURE__ */ jsxRuntime.jsx(WarningTriangle, { color: t.warning }),
1412
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
1413
+ "You must send",
1414
+ " ",
1415
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
1416
+ "exactly ",
1417
+ payment.amount,
1418
+ " ",
1419
+ tok?.symbol
1420
+ ] }),
1421
+ " ",
1422
+ "on ",
1423
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: ch?.name }),
1424
+ ". Sending a different amount or asset may result in loss of funds."
1117
1425
  ] })
1118
- ] }, `dest-${i}`)),
1119
- !payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "rgba(255,255,255,0.4)", fontSize: "13px" }, children: "Transaction details loading..." })
1120
- ] }),
1121
- /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleClose, style: { ...styles.button, marginTop: "24px", background: "linear-gradient(135deg, #10B981, #059669)" }, children: "Done" })
1122
- ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1123
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.header, children: [
1124
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.headerIcon, children: /* @__PURE__ */ jsxRuntime.jsx(CardIcon, {}) }),
1125
- /* @__PURE__ */ jsxRuntime.jsx("h2", { style: styles.title, children: showQR ? "Send Payment" : "Pay with any token" }),
1126
- /* @__PURE__ */ jsxRuntime.jsx("p", { style: styles.subtitle, children: showQR ? "Scan QR or copy address below" : "Secure, gasless transactions" })
1127
- ] }),
1128
- showQR && payment.quote && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1129
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.qrContainer, children: /* @__PURE__ */ jsxRuntime.jsx(
1426
+ ] }),
1427
+ /* @__PURE__ */ jsxRuntime.jsx(
1428
+ "button",
1429
+ {
1430
+ disabled: !canSubmit || isQuoting,
1431
+ onClick: () => payment.fetchQuote(),
1432
+ style: primaryBtn(!canSubmit || isQuoting),
1433
+ children: isQuoting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1434
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, { color: t.btnText }),
1435
+ " Getting quote\u2026"
1436
+ ] }) : "Confirm Payment"
1437
+ }
1438
+ ),
1439
+ !payment.refundAddress.trim() && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
1440
+ "Enter a refund address on ",
1441
+ ch?.name || "the source chain",
1442
+ " to continue."
1443
+ ] })
1444
+ ] })
1445
+ ] });
1446
+ };
1447
+ const renderPaymentStep = () => {
1448
+ const { quote } = payment;
1449
+ const isProcessing = paymentState === "processing";
1450
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1451
+ renderHeader(`Send ${payment.amount} ${payment.selectedToken?.symbol ?? ""} on ${payment.selectedChain?.name ?? ""}`),
1452
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "4px 20px 24px" }, children: quote && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1453
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1454
+ background: "#ffffff",
1455
+ borderRadius: "16px",
1456
+ padding: "20px",
1457
+ display: "flex",
1458
+ alignItems: "center",
1459
+ justifyContent: "center",
1460
+ border: `1px solid ${t.border}`,
1461
+ marginBottom: "14px"
1462
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(
1130
1463
  qrcode_react.QRCodeSVG,
1131
1464
  {
1132
- value: payment.quote.depositAddress,
1133
- size: 180,
1465
+ value: quote.depositAddress,
1466
+ size: 200,
1134
1467
  level: "M",
1135
- bgColor: "transparent",
1136
- fgColor: "white"
1468
+ bgColor: "#ffffff",
1469
+ fgColor: "#000000"
1137
1470
  }
1138
1471
  ) }),
1139
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.addressContainer, children: [
1140
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.addressText, children: [
1141
- payment.quote.depositAddress.slice(0, 8),
1142
- "...",
1143
- payment.quote.depositAddress.slice(-8)
1144
- ] }),
1472
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
1473
+ display: "flex",
1474
+ alignItems: "center",
1475
+ gap: "10px",
1476
+ padding: "11px 13px",
1477
+ background: t.inputBg,
1478
+ borderRadius: "10px",
1479
+ marginBottom: "14px",
1480
+ border: `1px solid ${t.border}`
1481
+ }, children: [
1482
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
1483
+ flex: 1,
1484
+ fontSize: "11px",
1485
+ color: t.textSecondary,
1486
+ fontFamily: "monospace",
1487
+ wordBreak: "break-all",
1488
+ lineHeight: 1.5
1489
+ }, children: quote.depositAddress }),
1145
1490
  /* @__PURE__ */ jsxRuntime.jsx(
1146
1491
  "button",
1147
1492
  {
1148
- style: styles.copyButton,
1149
1493
  onClick: handleCopy,
1150
- onMouseEnter: (e) => {
1151
- e.currentTarget.style.background = "rgba(255,255,255,0.2)";
1494
+ title: "Copy address",
1495
+ style: {
1496
+ flexShrink: 0,
1497
+ width: 34,
1498
+ height: 34,
1499
+ borderRadius: "8px",
1500
+ background: copied ? `${t.success}18` : t.iconBtnBg,
1501
+ border: `1px solid ${copied ? t.success + "44" : t.border}`,
1502
+ cursor: "pointer",
1503
+ display: "flex",
1504
+ alignItems: "center",
1505
+ justifyContent: "center",
1506
+ transition: "all 0.2s"
1152
1507
  },
1153
- onMouseLeave: (e) => {
1154
- e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1155
- },
1156
- children: copied ? /* @__PURE__ */ jsxRuntime.jsx(CheckSmallIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, {})
1508
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx(CheckMark, { color: t.success }) : /* @__PURE__ */ jsxRuntime.jsx(CopyIcon, { color: t.textMuted })
1157
1509
  }
1158
1510
  )
1159
1511
  ] }),
1160
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...styles.details, marginTop: "20px" }, children: [
1161
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.detailRow, children: [
1162
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Status" }),
1163
- /* @__PURE__ */ jsxRuntime.jsxs(
1164
- "span",
1165
- {
1166
- style: {
1167
- ...styles.statusBadge,
1168
- ...styles.processingBadge
1169
- },
1170
- children: [
1171
- /* @__PURE__ */ jsxRuntime.jsx(PulseIcon, {}),
1172
- " ",
1173
- payment.paymentState === "processing" ? "Processing deposit..." : "Waiting for deposit"
1174
- ]
1175
- }
1176
- )
1177
- ] }),
1178
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.detailRow, children: [
1179
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Amount to send" }),
1180
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.detailValue, children: [
1512
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...warningBox, marginBottom: "14px" }, children: [
1513
+ /* @__PURE__ */ jsxRuntime.jsx(WarningTriangle, { color: t.warning }),
1514
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
1515
+ "Only send",
1516
+ " ",
1517
+ /* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
1181
1518
  payment.amount,
1182
1519
  " ",
1183
- payment.selectedToken?.symbol,
1184
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.tokenBadge, children: payment.selectedChain?.name })
1185
- ] })
1186
- ] }),
1187
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.detailRow, children: [
1188
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "You receive" }),
1189
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.detailValue, children: [
1190
- "~",
1191
- payment.quote.amountOutFormatted,
1192
- " ",
1193
- payment.destinationToken.symbol,
1194
- /* @__PURE__ */ jsxRuntime.jsx("span", { style: styles.tokenBadge, children: "Sui" })
1195
- ] })
1196
- ] })
1197
- ] })
1198
- ] }),
1199
- !showQR && !isSuccess && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1200
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.selectorsRow, children: [
1201
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
1202
- /* @__PURE__ */ jsxRuntime.jsxs(
1203
- "div",
1204
- {
1205
- style: styles.selector,
1206
- onClick: () => {
1207
- setChainDropdownOpen(!chainDropdownOpen);
1208
- setTokenDropdownOpen(false);
1209
- },
1210
- children: [
1211
- /* @__PURE__ */ jsxRuntime.jsxs(
1212
- "div",
1213
- {
1214
- style: {
1215
- display: "flex",
1216
- alignItems: "center",
1217
- gap: "12px"
1218
- },
1219
- children: [
1220
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorIcon, children: payment.selectedChain ? /* @__PURE__ */ jsxRuntime.jsx(
1221
- "img",
1222
- {
1223
- src: payment.selectedChain.icon,
1224
- alt: "",
1225
- style: {
1226
- width: "100%",
1227
- height: "100%"
1228
- }
1229
- }
1230
- ) : /* @__PURE__ */ jsxRuntime.jsx(GlobeIcon, {}) }),
1231
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1232
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorLabel, children: "Chain" }),
1233
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorValue, children: payment.selectedChain?.name || "Select" })
1234
- ] })
1235
- ]
1236
- }
1237
- ),
1238
- /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, {})
1239
- ]
1240
- }
1241
- ),
1242
- chainDropdownOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.dropdown, children: payment.chains.map((chain) => /* @__PURE__ */ jsxRuntime.jsxs(
1243
- "div",
1244
- {
1245
- style: styles.dropdownItem,
1246
- onClick: () => {
1247
- payment.setSelectedChain(chain);
1248
- setChainDropdownOpen(false);
1249
- },
1250
- onMouseEnter: (e) => {
1251
- e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1252
- },
1253
- onMouseLeave: (e) => {
1254
- e.currentTarget.style.background = "transparent";
1255
- },
1256
- children: [
1257
- /* @__PURE__ */ jsxRuntime.jsx(
1258
- "img",
1259
- {
1260
- src: chain.icon,
1261
- alt: "",
1262
- style: {
1263
- width: "24px",
1264
- height: "24px",
1265
- borderRadius: "50%"
1266
- }
1267
- }
1268
- ),
1269
- /* @__PURE__ */ jsxRuntime.jsx(
1270
- "span",
1271
- {
1272
- style: {
1273
- color: "white",
1274
- fontSize: "14px"
1275
- },
1276
- children: chain.name
1277
- }
1278
- )
1279
- ]
1280
- },
1281
- chain.id
1282
- )) })
1283
- ] }),
1284
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
1285
- /* @__PURE__ */ jsxRuntime.jsxs(
1286
- "div",
1287
- {
1288
- style: {
1289
- ...styles.selector,
1290
- opacity: payment.selectedChain ? 1 : 0.5,
1291
- pointerEvents: payment.selectedChain ? "auto" : "none"
1292
- },
1293
- onClick: () => {
1294
- if (payment.selectedChain) {
1295
- setTokenDropdownOpen(!tokenDropdownOpen);
1296
- setChainDropdownOpen(false);
1297
- }
1298
- },
1299
- children: [
1300
- /* @__PURE__ */ jsxRuntime.jsxs(
1301
- "div",
1302
- {
1303
- style: {
1304
- display: "flex",
1305
- alignItems: "center",
1306
- gap: "12px"
1307
- },
1308
- children: [
1309
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorIcon, children: payment.selectedToken ? /* @__PURE__ */ jsxRuntime.jsx(
1310
- "img",
1311
- {
1312
- src: payment.selectedToken.icon,
1313
- alt: "",
1314
- style: {
1315
- width: "100%",
1316
- height: "100%"
1317
- }
1318
- }
1319
- ) : /* @__PURE__ */ jsxRuntime.jsx(DollarIcon, {}) }),
1320
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1321
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorLabel, children: "Token" }),
1322
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.selectorValue, children: payment.selectedToken?.symbol || "Select" })
1323
- ] })
1324
- ]
1325
- }
1326
- ),
1327
- /* @__PURE__ */ jsxRuntime.jsx(ChevronIcon, {})
1328
- ]
1329
- }
1330
- ),
1331
- tokenDropdownOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.dropdown, children: payment.tokens.map((token) => /* @__PURE__ */ jsxRuntime.jsxs(
1332
- "div",
1333
- {
1334
- style: styles.dropdownItem,
1335
- onClick: () => {
1336
- payment.setSelectedToken(token);
1337
- setTokenDropdownOpen(false);
1338
- },
1339
- onMouseEnter: (e) => {
1340
- e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1341
- },
1342
- onMouseLeave: (e) => {
1343
- e.currentTarget.style.background = "transparent";
1344
- },
1345
- children: [
1346
- /* @__PURE__ */ jsxRuntime.jsx(
1347
- "img",
1348
- {
1349
- src: token.icon,
1350
- alt: "",
1351
- style: {
1352
- width: "24px",
1353
- height: "24px",
1354
- borderRadius: "50%"
1355
- }
1356
- }
1357
- ),
1358
- /* @__PURE__ */ jsxRuntime.jsx(
1359
- "span",
1360
- {
1361
- style: {
1362
- color: "white",
1363
- fontSize: "14px"
1364
- },
1365
- children: token.symbol
1366
- }
1367
- )
1368
- ]
1369
- },
1370
- token.assetId
1371
- )) })
1520
+ payment.selectedToken?.symbol
1521
+ ] }),
1522
+ " ",
1523
+ "on ",
1524
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: payment.selectedChain?.name }),
1525
+ " to this address. Other assets may be permanently lost."
1372
1526
  ] })
1373
1527
  ] }),
1374
- /* @__PURE__ */ jsxRuntime.jsx(
1375
- "input",
1376
- {
1377
- type: "text",
1378
- inputMode: "decimal",
1379
- placeholder: "0.00",
1380
- value: payment.amount,
1381
- onChange: (e) => payment.setAmount(e.target.value),
1382
- style: styles.amountInput
1383
- }
1384
- ),
1385
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.details, children: [
1386
- payment.amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.detailRow, children: [
1387
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "You receive" }),
1388
- payment.isLoadingPreview ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "4px" }, children: [
1389
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.loadingDot }),
1390
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...styles.loadingDot, animationDelay: "0.2s" } }),
1391
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...styles.loadingDot, animationDelay: "0.4s" } })
1392
- ] }) : payment.previewQuote ? /* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.detailValue, children: [
1393
- "~",
1394
- payment.previewQuote.amountOutFormatted,
1528
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { borderTop: `1px solid ${t.border}`, paddingTop: "12px" }, children: [
1529
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "10px" }, children: [
1530
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "You'll receive" }),
1531
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
1532
+ "\u2248",
1533
+ quote.amountOutFormatted,
1395
1534
  " ",
1396
1535
  payment.destinationToken.symbol
1397
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "rgba(255,255,255,0.3)" }, children: "Enter amount..." })
1398
- ] }),
1399
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: styles.detailRow, children: [
1400
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Destination" }),
1401
- /* @__PURE__ */ jsxRuntime.jsxs("span", { style: styles.detailValue, children: [
1402
- payment.destinationToken.symbol,
1403
- " on Sui"
1404
1536
  ] })
1405
- ] })
1406
- ] }),
1407
- /* @__PURE__ */ jsxRuntime.jsx(
1408
- "button",
1409
- {
1410
- style: {
1411
- ...styles.button,
1412
- ...!canSubmit || isProcessing ? styles.buttonDisabled : {}
1413
- },
1414
- disabled: !canSubmit || isProcessing,
1415
- onClick: () => payment.fetchQuote(),
1416
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: styles.buttonInner, children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1417
- /* @__PURE__ */ jsxRuntime.jsx(SpinnerIcon, {}),
1418
- " Processing..."
1537
+ ] }),
1538
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
1539
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "Status" }),
1540
+ /* @__PURE__ */ jsxRuntime.jsx("span", { style: {
1541
+ fontSize: "13px",
1542
+ fontWeight: 600,
1543
+ color: isProcessing ? t.accent : t.warning,
1544
+ display: "flex",
1545
+ alignItems: "center",
1546
+ gap: "6px"
1547
+ }, children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1548
+ /* @__PURE__ */ jsxRuntime.jsx(Spinner, { color: t.accent }),
1549
+ " Processing\u2026"
1419
1550
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1420
- "Confirm Payment",
1421
- /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, {})
1551
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1552
+ width: 8,
1553
+ height: 8,
1554
+ borderRadius: "50%",
1555
+ background: t.warning,
1556
+ animation: "uniport-pulse 1.5s ease infinite"
1557
+ } }),
1558
+ "Waiting for deposit"
1422
1559
  ] }) })
1423
- }
1424
- )
1425
- ] })
1426
- ] }),
1560
+ ] })
1561
+ ] })
1562
+ ] }) })
1563
+ ] });
1564
+ };
1565
+ const renderSuccessStep = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
1427
1566
  /* @__PURE__ */ jsxRuntime.jsx(
1428
- "p",
1567
+ "button",
1429
1568
  {
1430
- style: {
1431
- textAlign: "center",
1432
- fontSize: "10px",
1433
- color: "rgba(255,255,255,0.3)",
1434
- marginTop: "16px"
1569
+ style: { ...iconBtn, position: "absolute", top: 18, right: 18 },
1570
+ onClick: handleClose,
1571
+ onMouseEnter: (e) => {
1572
+ e.currentTarget.style.background = t.iconBtnHover;
1435
1573
  },
1436
- children: "Powered by Uniport \u2022 NEAR Intents"
1574
+ onMouseLeave: (e) => {
1575
+ e.currentTarget.style.background = t.iconBtnBg;
1576
+ },
1577
+ children: /* @__PURE__ */ jsxRuntime.jsx(XMark, { color: t.iconBtnColor })
1437
1578
  }
1438
- )
1439
- ] }) });
1440
- }
1441
- function CloseIcon() {
1442
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1443
- "path",
1444
- {
1445
- d: "M18 6L6 18M6 6L18 18",
1446
- stroke: "currentColor",
1447
- strokeWidth: "2",
1448
- strokeLinecap: "round"
1449
- }
1450
- ) });
1451
- }
1452
- function CardIcon() {
1453
- return /* @__PURE__ */ jsxRuntime.jsx(
1454
- "svg",
1455
- {
1456
- width: "24",
1457
- height: "24",
1458
- viewBox: "0 0 24 24",
1459
- fill: "none",
1460
- stroke: "rgba(255,255,255,0.9)",
1461
- strokeWidth: "1.5",
1462
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 10h18M7 15h2m4 0h4M6 19h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" })
1463
- }
1464
- );
1465
- }
1466
- function GlobeIcon() {
1467
- return /* @__PURE__ */ jsxRuntime.jsxs(
1468
- "svg",
1469
- {
1470
- width: "18",
1471
- height: "18",
1472
- viewBox: "0 0 24 24",
1473
- fill: "none",
1474
- stroke: "#818CF8",
1475
- strokeWidth: "1.5",
1476
- children: [
1477
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
1478
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12h20M12 2a15.3 15.3 0 014 10 15.3 15.3 0 01-4 10 15.3 15.3 0 01-4-10 15.3 15.3 0 014-10z" })
1479
- ]
1480
- }
1481
- );
1482
- }
1483
- function DollarIcon() {
1484
- return /* @__PURE__ */ jsxRuntime.jsxs(
1485
- "svg",
1486
- {
1487
- width: "18",
1488
- height: "18",
1489
- viewBox: "0 0 24 24",
1490
- fill: "none",
1491
- stroke: "#22D3EE",
1492
- strokeWidth: "1.5",
1493
- children: [
1494
- /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
1495
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 6v12M15 9.5a3 3 0 00-3-2.5h-1a2.5 2.5 0 000 5h2a2.5 2.5 0 010 5H12a3 3 0 01-3-2.5" })
1496
- ]
1497
- }
1498
- );
1499
- }
1500
- function ChevronIcon() {
1501
- return /* @__PURE__ */ jsxRuntime.jsx(
1502
- "svg",
1503
- {
1504
- width: "16",
1505
- height: "16",
1506
- viewBox: "0 0 24 24",
1507
- fill: "none",
1508
- stroke: "rgba(255,255,255,0.4)",
1509
- strokeWidth: "2",
1510
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9l6 6 6-6" })
1511
- }
1512
- );
1513
- }
1514
- function CheckSmallIcon() {
1515
- return /* @__PURE__ */ jsxRuntime.jsx(
1516
- "svg",
1517
- {
1518
- width: "16",
1519
- height: "16",
1520
- viewBox: "0 0 24 24",
1521
- fill: "none",
1522
- stroke: "#10B981",
1523
- strokeWidth: "2",
1524
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 6L9 17l-5-5" })
1525
- }
1526
- );
1527
- }
1528
- function CopyIcon() {
1529
- return /* @__PURE__ */ jsxRuntime.jsxs(
1530
- "svg",
1531
- {
1532
- width: "16",
1533
- height: "16",
1534
- viewBox: "0 0 24 24",
1535
- fill: "none",
1536
- stroke: "rgba(255,255,255,0.7)",
1537
- strokeWidth: "2",
1538
- children: [
1539
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1540
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
1541
- ]
1542
- }
1543
- );
1544
- }
1545
- function PulseIcon() {
1546
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", children: /* @__PURE__ */ jsxRuntime.jsx(
1547
- "circle",
1548
- {
1549
- cx: "4",
1550
- cy: "4",
1551
- r: "4",
1552
- fill: "#818CF8",
1553
- style: { animation: "uniport-pulse 1s ease infinite" }
1554
- }
1555
- ) });
1556
- }
1557
- function SpinnerIcon() {
1558
- return /* @__PURE__ */ jsxRuntime.jsxs(
1559
- "svg",
1560
- {
1561
- width: "16",
1562
- height: "16",
1563
- viewBox: "0 0 24 24",
1564
- fill: "none",
1565
- style: { animation: "spin 1s linear infinite" },
1566
- children: [
1567
- /* @__PURE__ */ jsxRuntime.jsx(
1568
- "circle",
1569
- {
1570
- cx: "12",
1571
- cy: "12",
1572
- r: "10",
1573
- stroke: "rgba(255,255,255,0.2)",
1574
- strokeWidth: "3"
1575
- }
1576
- ),
1577
- /* @__PURE__ */ jsxRuntime.jsx(
1578
- "path",
1579
+ ),
1580
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "44px 24px 28px", textAlign: "center" }, children: [
1581
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1582
+ width: 72,
1583
+ height: 72,
1584
+ borderRadius: "50%",
1585
+ background: `${t.success}18`,
1586
+ border: `2px solid ${t.success}55`,
1587
+ display: "flex",
1588
+ alignItems: "center",
1589
+ justifyContent: "center",
1590
+ margin: "0 auto 20px"
1591
+ }, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1592
+ "path",
1593
+ {
1594
+ d: "M20 6L9 17l-5-5",
1595
+ stroke: t.success,
1596
+ strokeWidth: "2.5",
1597
+ strokeLinecap: "round",
1598
+ strokeLinejoin: "round"
1599
+ }
1600
+ ) }) }),
1601
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: t.text, letterSpacing: "-0.02em" }, children: "Payment sent!" }),
1602
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: "0 0 24px", fontSize: "14px", color: t.textMuted, lineHeight: 1.6 }, children: [
1603
+ payment.amount,
1604
+ " ",
1605
+ payment.selectedToken?.symbol,
1606
+ " \u2192 ",
1607
+ "\u2248",
1608
+ payment.quote?.amountOutFormatted,
1609
+ " ",
1610
+ payment.destinationToken.symbol
1611
+ ] }),
1612
+ /* @__PURE__ */ jsxRuntime.jsx(
1613
+ "button",
1614
+ {
1615
+ onClick: () => setShowReceipt((p) => !p),
1616
+ style: {
1617
+ background: "transparent",
1618
+ border: "none",
1619
+ color: t.accent,
1620
+ fontSize: "14px",
1621
+ cursor: "pointer",
1622
+ textDecoration: "underline",
1623
+ marginBottom: showReceipt ? 14 : 0,
1624
+ fontFamily: "inherit"
1625
+ },
1626
+ children: showReceipt ? "Hide receipt" : "View receipt"
1627
+ }
1628
+ ),
1629
+ showReceipt && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { background: t.inputBg, borderRadius: "12px", padding: "14px", textAlign: "left", marginBottom: "20px" }, children: [
1630
+ payment.status?.originTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: 10 }, children: [
1631
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: [
1632
+ "Source TX \xB7 ",
1633
+ payment.selectedChain?.name
1634
+ ] }),
1635
+ /* @__PURE__ */ jsxRuntime.jsxs(
1636
+ "a",
1637
+ {
1638
+ href: `https://etherscan.io/tx/${hash}`,
1639
+ target: "_blank",
1640
+ rel: "noopener noreferrer",
1641
+ style: { color: t.accent, fontSize: "12px", fontFamily: "monospace", textDecoration: "none" },
1642
+ children: [
1643
+ hash.slice(0, 12),
1644
+ "\u2026",
1645
+ hash.slice(-8),
1646
+ " \u2197"
1647
+ ]
1648
+ }
1649
+ )
1650
+ ] }, `o${i}`)),
1651
+ payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1652
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: "Destination TX" }),
1653
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: t.textSecondary, fontSize: "12px", fontFamily: "monospace" }, children: [
1654
+ hash.slice(0, 12),
1655
+ "\u2026",
1656
+ hash.slice(-8)
1657
+ ] })
1658
+ ] }, `d${i}`)),
1659
+ !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" })
1660
+ ] }),
1661
+ /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleClose, style: primaryBtn(false), children: "Done" })
1662
+ ] })
1663
+ ] });
1664
+ const renderErrorStep = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
1665
+ /* @__PURE__ */ jsxRuntime.jsx(
1666
+ "button",
1667
+ {
1668
+ style: { ...iconBtn, position: "absolute", top: 18, right: 18 },
1669
+ onClick: handleClose,
1670
+ onMouseEnter: (e) => {
1671
+ e.currentTarget.style.background = t.iconBtnHover;
1672
+ },
1673
+ onMouseLeave: (e) => {
1674
+ e.currentTarget.style.background = t.iconBtnBg;
1675
+ },
1676
+ children: /* @__PURE__ */ jsxRuntime.jsx(XMark, { color: t.iconBtnColor })
1677
+ }
1678
+ ),
1679
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "44px 24px 28px", textAlign: "center" }, children: [
1680
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
1681
+ width: 72,
1682
+ height: 72,
1683
+ borderRadius: "50%",
1684
+ background: `${t.error}18`,
1685
+ border: `2px solid ${t.error}44`,
1686
+ display: "flex",
1687
+ alignItems: "center",
1688
+ justifyContent: "center",
1689
+ margin: "0 auto 20px"
1690
+ }, children: /* @__PURE__ */ jsxRuntime.jsx(XMark, { color: t.error }) }),
1691
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: t.text, letterSpacing: "-0.02em" }, children: "Payment failed" }),
1692
+ /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: "0 0 28px", fontSize: "14px", color: t.textMuted, lineHeight: 1.6 }, children: payment.error?.message || "Something went wrong. Please try again." }),
1693
+ /* @__PURE__ */ jsxRuntime.jsx(
1694
+ "button",
1695
+ {
1696
+ onClick: () => {
1697
+ payment.reset();
1698
+ setModalStep("chain");
1699
+ },
1700
+ style: { ...primaryBtn(false), background: "transparent", border: `1.5px solid ${t.border}`, color: t.text },
1701
+ children: "Try again"
1702
+ }
1703
+ )
1704
+ ] })
1705
+ ] });
1706
+ const renderContent = () => {
1707
+ if (isSuccess) return renderSuccessStep();
1708
+ if (isError) return renderErrorStep();
1709
+ if (showQR) return renderPaymentStep();
1710
+ if (modalStep === "chain") return renderChainStep();
1711
+ if (modalStep === "token") return renderTokenStep();
1712
+ return renderAmountStep();
1713
+ };
1714
+ return ReactDOM__default.default.createPortal(
1715
+ /* @__PURE__ */ jsxRuntime.jsx(
1716
+ "div",
1717
+ {
1718
+ style: {
1719
+ // This overlay must live at the top of the DOM stacking order.
1720
+ // By portaling into document.body we escape any parent element that
1721
+ // has transform, filter, or backdrop-filter (all of which would
1722
+ // otherwise break position:fixed, making it relative to that element
1723
+ // rather than the viewport).
1724
+ position: "fixed",
1725
+ top: 0,
1726
+ left: 0,
1727
+ right: 0,
1728
+ bottom: 0,
1729
+ zIndex: 2147483647,
1730
+ // max z-index
1731
+ display: "flex",
1732
+ alignItems: "center",
1733
+ justifyContent: "center",
1734
+ padding: "16px",
1735
+ // Overlay colour + frosted effect applied here (on the backdrop),
1736
+ // NOT on the modal card itself.
1737
+ backgroundColor: t.overlay,
1738
+ backdropFilter: "blur(18px) saturate(180%)",
1739
+ WebkitBackdropFilter: "blur(18px) saturate(180%)",
1740
+ animation: "uniport-fade-in 0.18s ease"
1741
+ },
1742
+ onClick: handleClose,
1743
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1744
+ "div",
1579
1745
  {
1580
- d: "M12 2a10 10 0 019.95 9",
1581
- stroke: "white",
1582
- strokeWidth: "3",
1583
- strokeLinecap: "round"
1746
+ onClick: (e) => e.stopPropagation(),
1747
+ style: {
1748
+ position: "relative",
1749
+ width: "100%",
1750
+ maxWidth: "440px",
1751
+ // Solid card — no glassmorphism on the card itself
1752
+ background: t.modalBg,
1753
+ borderRadius: "20px",
1754
+ boxShadow: themeMode === "light" ? "0 24px 64px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.06)" : "0 24px 64px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.06)",
1755
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
1756
+ // Only the initial modal mount gets the slide-up animation.
1757
+ // Content transitions (chain→token→amount) use plain renders,
1758
+ // not component remounts, so polling re-renders don't re-trigger it.
1759
+ animation: "uniport-slide-up 0.22s ease",
1760
+ overflow: "hidden",
1761
+ maxHeight: "90vh",
1762
+ display: "flex",
1763
+ flexDirection: "column"
1764
+ },
1765
+ children: renderContent()
1584
1766
  }
1585
1767
  )
1586
- ]
1587
- }
1588
- );
1589
- }
1590
- function ArrowIcon() {
1591
- return /* @__PURE__ */ jsxRuntime.jsx(
1592
- "svg",
1593
- {
1594
- width: "16",
1595
- height: "16",
1596
- viewBox: "0 0 24 24",
1597
- fill: "none",
1598
- stroke: "currentColor",
1599
- strokeWidth: "2",
1600
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14M12 5l7 7-7 7" })
1601
- }
1768
+ }
1769
+ ),
1770
+ portalRoot
1602
1771
  );
1603
1772
  }
1604
1773
  var buttonStyles = {
@@ -1660,17 +1829,18 @@ var buttonStyles = {
1660
1829
  function UniportButton({
1661
1830
  recipient,
1662
1831
  refundAddress,
1663
- destinationToken = "suiUSDC",
1832
+ destinationToken,
1664
1833
  amount,
1665
1834
  label = "Pay with Crypto",
1666
1835
  variant = "default",
1667
1836
  disabled = false,
1668
1837
  className,
1838
+ theme = "light",
1669
1839
  onSuccess,
1670
1840
  onError,
1671
1841
  onOpenChange
1672
1842
  }) {
1673
- const [isOpen, setIsOpen] = React.useState(false);
1843
+ const [isOpen, setIsOpen] = react.useState(false);
1674
1844
  const handleOpen = () => {
1675
1845
  if (!disabled) {
1676
1846
  setIsOpen(true);
@@ -1709,6 +1879,7 @@ function UniportButton({
1709
1879
  refundAddress,
1710
1880
  destinationToken,
1711
1881
  amount,
1882
+ theme,
1712
1883
  onSuccess,
1713
1884
  onError
1714
1885
  }
@@ -1760,23 +1931,14 @@ function UniportIcon() {
1760
1931
  );
1761
1932
  }
1762
1933
 
1763
- Object.defineProperty(exports, "ApiError", {
1764
- enumerable: true,
1765
- get: function () { return oneClickSdkTypescript.ApiError; }
1766
- });
1767
- Object.defineProperty(exports, "OneClickService", {
1768
- enumerable: true,
1769
- get: function () { return oneClickSdkTypescript.OneClickService; }
1770
- });
1771
- Object.defineProperty(exports, "OpenAPI", {
1772
- enumerable: true,
1773
- get: function () { return oneClickSdkTypescript.OpenAPI; }
1774
- });
1775
1934
  exports.ALL_TOKENS = ALL_TOKENS;
1776
1935
  exports.CHAINS = CHAINS;
1777
1936
  exports.CHAIN_ICONS = CHAIN_ICONS;
1937
+ exports.DEFAULT_HOSTED_BACKEND_URL = DEFAULT_HOSTED_BACKEND_URL;
1938
+ exports.DEFAULT_REQUEST_TIMEOUT_MS = DEFAULT_REQUEST_TIMEOUT_MS;
1778
1939
  exports.TOKEN_ICONS = TOKEN_ICONS;
1779
1940
  exports.UniportButton = UniportButton;
1941
+ exports.UniportError = UniportError;
1780
1942
  exports.UniportModal = UniportModal;
1781
1943
  exports.aptosAPT = aptosAPT;
1782
1944
  exports.arbitrumARB = arbitrumARB;
@@ -1798,6 +1960,7 @@ exports.bscBNB = bscBNB;
1798
1960
  exports.bscUSDC = bscUSDC;
1799
1961
  exports.bscUSDT = bscUSDT;
1800
1962
  exports.cardanoADA = cardanoADA;
1963
+ exports.configureUniport = configureUniport;
1801
1964
  exports.dogecoinDOGE = dogecoinDOGE;
1802
1965
  exports.ethereumAAVE = ethereumAAVE;
1803
1966
  exports.ethereumDAI = ethereumDAI;
@@ -1813,16 +1976,13 @@ exports.ethereumUSDT = ethereumUSDT;
1813
1976
  exports.ethereumWBTC = ethereumWBTC;
1814
1977
  exports.fromSmallestUnits = fromSmallestUnits;
1815
1978
  exports.generateDeadline = generateDeadline;
1816
- exports.getConfig = getConfig;
1817
1979
  exports.getExecutionStatus = getExecutionStatus;
1818
1980
  exports.getQuote = getQuote;
1819
- exports.getSuiDestinationTokens = getSuiDestinationTokens;
1820
1981
  exports.getSupportedChains = getSupportedChains;
1821
1982
  exports.getToken = getToken;
1822
1983
  exports.getTokenByAssetId = getTokenByAssetId;
1823
1984
  exports.getTokensByChain = getTokensByChain;
1824
- exports.initUniport = initUniport;
1825
- exports.isInitialized = isInitialized;
1985
+ exports.getUniportConfig = getUniportConfig;
1826
1986
  exports.litecoinLTC = litecoinLTC;
1827
1987
  exports.nearNEAR = nearNEAR;
1828
1988
  exports.nearUSDC = nearUSDC;