uniport-sdk 0.0.1

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.js ADDED
@@ -0,0 +1,1760 @@
1
+ import { OpenAPI, QuoteRequest, OneClickService, ApiError } from '@defuse-protocol/one-click-sdk-typescript';
2
+ export { ApiError, OneClickService, OpenAPI } from '@defuse-protocol/one-click-sdk-typescript';
3
+ import React, { useState, useRef, useCallback, useEffect } from 'react';
4
+ import { QRCodeSVG } from 'qrcode.react';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+
7
+ // src/core/tokens.ts
8
+ var TOKEN_ICONS = {
9
+ // Stablecoins
10
+ USDC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
11
+ USDT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
12
+ DAI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EesdfdsfdC495271d0F/logo.png",
13
+ // Major tokens
14
+ ETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
15
+ WETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
16
+ BTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png",
17
+ WBTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",
18
+ // L1s & L2s
19
+ SUI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
20
+ SOL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",
21
+ NEAR: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
22
+ ARB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png",
23
+ OP: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/info/logo.png",
24
+ POL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png",
25
+ AVAX: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/info/logo.png",
26
+ BNB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/binance/info/logo.png",
27
+ BASE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png",
28
+ // Other L1s
29
+ ADA: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cardano/info/logo.png",
30
+ XRP: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
31
+ DOGE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",
32
+ LTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
33
+ BCH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
34
+ TON: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ton/info/logo.png",
35
+ TRX: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png",
36
+ XLM: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png",
37
+ APT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
38
+ // DeFi & Others
39
+ AAVE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7Fc66500c84A76Ad7e9c93437BFc5Ac33E2DDaE9/logo.png",
40
+ UNI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/logo.png",
41
+ LINK: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x514910771AF9Ca656af840dff83E8264EcF986CA/logo.png",
42
+ SHIB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE/logo.png",
43
+ PEPE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6982508145454Ce325dDbE47a25d4ec3d2311933/logo.png",
44
+ // Ecosystem tokens
45
+ STRK: "https://assets.coingecko.com/coins/images/26433/standard/starknet.png",
46
+ BERA: "https://assets.coingecko.com/coins/images/34286/standard/bera.png",
47
+ GNO: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6810e776880C02933D47DB1b9fc05908e5386b96/logo.png",
48
+ MON: "https://assets.coingecko.com/coins/images/35887/standard/monad.png",
49
+ ZEC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
50
+ // Meme coins
51
+ TRUMP: "https://assets.coingecko.com/coins/images/53746/standard/trump.jpg",
52
+ WIF: "https://assets.coingecko.com/coins/images/33566/standard/dogwifhat.jpg",
53
+ BRETT: "https://assets.coingecko.com/coins/images/35529/standard/brett.png",
54
+ TURBO: "https://assets.coingecko.com/coins/images/30116/standard/turbo.png",
55
+ // Default fallback
56
+ DEFAULT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
57
+ };
58
+ var CHAIN_ICONS = {
59
+ sui: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
60
+ eth: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
61
+ arb: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png",
62
+ base: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/base/info/logo.png",
63
+ op: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/info/logo.png",
64
+ sol: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",
65
+ btc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png",
66
+ near: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
67
+ pol: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png",
68
+ avax: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/info/logo.png",
69
+ bsc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/binance/info/logo.png",
70
+ ton: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ton/info/logo.png",
71
+ tron: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png",
72
+ stellar: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png",
73
+ cardano: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/cardano/info/logo.png",
74
+ aptos: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
75
+ gnosis: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png",
76
+ starknet: "https://assets.coingecko.com/coins/images/26433/standard/starknet.png",
77
+ bera: "https://assets.coingecko.com/coins/images/34286/standard/bera.png",
78
+ monad: "https://assets.coingecko.com/coins/images/35887/standard/monad.png",
79
+ doge: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",
80
+ ltc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
81
+ bch: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
82
+ xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
83
+ zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png"
84
+ };
85
+ function createToken(chain, symbol, assetId, decimals, contractAddress) {
86
+ const name = `${chain}${symbol.replace("$", "").replace(" ", "")}`;
87
+ const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS.DEFAULT;
88
+ const chainIcon = CHAIN_ICONS[chain];
89
+ return {
90
+ name,
91
+ symbol,
92
+ assetId,
93
+ chain,
94
+ decimals,
95
+ icon,
96
+ chainIcon,
97
+ contractAddress
98
+ };
99
+ }
100
+ var suiSUI = createToken("sui", "SUI", "nep141:sui.omft.near", 9);
101
+ var suiUSDC = createToken("sui", "USDC", "nep141:sui-c1b81ecaf27933252d31a963bc5e9458f13c18ce.omft.near", 6, "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC");
102
+ var ethereumETH = createToken("eth", "ETH", "nep141:eth.omft.near", 18);
103
+ var ethereumUSDC = createToken("eth", "USDC", "nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near", 6, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48");
104
+ var ethereumUSDT = createToken("eth", "USDT", "nep141:eth-0xdac17f958d2ee523a2206206994597c13d831ec7.omft.near", 6, "0xdac17f958d2ee523a2206206994597c13d831ec7");
105
+ var ethereumWBTC = createToken("eth", "WBTC", "nep141:eth-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599.omft.near", 8, "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599");
106
+ var ethereumDAI = createToken("eth", "DAI", "nep141:eth-0x6b175474e89094c44da98b954eedeac495271d0f.omft.near", 18, "0x6b175474e89094c44da98b954eedeac495271d0f");
107
+ var ethereumAAVE = createToken("eth", "AAVE", "nep141:eth-0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9.omft.near", 18, "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9");
108
+ var ethereumUNI = createToken("eth", "UNI", "nep141:eth-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984.omft.near", 18, "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984");
109
+ var ethereumLINK = createToken("eth", "LINK", "nep141:eth-0x514910771af9ca656af840dff83e8264ecf986ca.omft.near", 18, "0x514910771af9ca656af840dff83e8264ecf986ca");
110
+ var ethereumSHIB = createToken("eth", "SHIB", "nep141:eth-0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce.omft.near", 18, "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce");
111
+ var ethereumPEPE = createToken("eth", "PEPE", "nep141:eth-0x6982508145454ce325ddbe47a25d4ec3d2311933.omft.near", 18, "0x6982508145454ce325ddbe47a25d4ec3d2311933");
112
+ var ethereumTURBO = createToken("eth", "TURBO", "nep141:eth-0xa35923162c49cf95e6bf26623385eb431ad920d3.omft.near", 18, "0xa35923162c49cf95e6bf26623385eb431ad920d3");
113
+ var ethereumSAFE = createToken("eth", "SAFE", "nep141:eth-0x5afe3855358e112b5647b952709e6165e1c1eeee.omft.near", 18, "0x5afe3855358e112b5647b952709e6165e1c1eeee");
114
+ var arbitrumETH = createToken("arb", "ETH", "nep141:arb.omft.near", 18);
115
+ var arbitrumUSDC = createToken("arb", "USDC", "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near", 6, "0xaf88d065e77c8cc2239327c5edb3a432268e5831");
116
+ var arbitrumUSDT = createToken("arb", "USDT", "nep141:arb-0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9.omft.near", 6, "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9");
117
+ var arbitrumARB = createToken("arb", "ARB", "nep141:arb-0x912ce59144191c1204e64559fe8253a0e49e6548.omft.near", 18, "0x912ce59144191c1204e64559fe8253a0e49e6548");
118
+ var arbitrumGMX = createToken("arb", "GMX", "nep141:arb-0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a.omft.near", 18, "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a");
119
+ var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
120
+ var baseUSDC = createToken("base", "USDC", "nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near", 6, "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913");
121
+ var baseCbBTC = createToken("base", "cbBTC", "nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near", 8, "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf");
122
+ var baseBRETT = createToken("base", "BRETT", "nep141:base-0x532f27101965dd16442e59d40670faf5ebb142e4.omft.near", 18, "0x532f27101965dd16442e59d40670faf5ebb142e4");
123
+ var optimismETH = createToken("op", "ETH", "nep245:v2_1.omni.hot.tg:10_11111111111111111111", 18);
124
+ var optimismUSDC = createToken("op", "USDC", "nep245:v2_1.omni.hot.tg:10_A2ewyUyDp6qsue1jqZsGypkCxRJ", 6, "0x0b2c639c533813f4aa9d7837caf62653d097ff85");
125
+ var optimismUSDT = createToken("op", "USDT", "nep245:v2_1.omni.hot.tg:10_359RPSJVdTxwTJT9TyGssr2rFoWo", 6, "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58");
126
+ var optimismOP = createToken("op", "OP", "nep245:v2_1.omni.hot.tg:10_vLAiSt9KfUGKpw5cD3vsSyNYBo7", 18, "0x4200000000000000000000000000000000000042");
127
+ var solanaSOL = createToken("sol", "SOL", "nep141:sol.omft.near", 9);
128
+ var solanaUSDC = createToken("sol", "USDC", "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near", 6, "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
129
+ var solanaUSDT = createToken("sol", "USDT", "nep141:sol-c800a4bd850783ccb82c2b2c7e84175443606352.omft.near", 6, "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
130
+ var solanaTRUMP = createToken("sol", "TRUMP", "nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near", 6, "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN");
131
+ var solanaWIF = createToken("sol", "$WIF", "nep141:sol-b9c68f94ec8fd160137af8cdfe5e61cd68e2afba.omft.near", 6, "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm");
132
+ var solanaMELANIA = createToken("sol", "MELANIA", "nep141:sol-d600e625449a4d9380eaf5e3265e54c90d34e260.omft.near", 6, "FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P");
133
+ var bitcoinBTC = createToken("btc", "BTC", "nep141:btc.omft.near", 8);
134
+ var polygonPOL = createToken("pol", "POL", "nep245:v2_1.omni.hot.tg:137_11111111111111111111", 18);
135
+ var polygonUSDC = createToken("pol", "USDC", "nep245:v2_1.omni.hot.tg:137_qiStmoQJDQPTebaPjgx5VBxZv6L", 6, "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359");
136
+ var polygonUSDT = createToken("pol", "USDT", "nep245:v2_1.omni.hot.tg:137_3hpYoaLtt8MP1Z2GH1U473DMRKgr", 6, "0xc2132d05d31c914a87c6611c10748aeb04b58e8f");
137
+ var avalancheAVAX = createToken("avax", "AVAX", "nep245:v2_1.omni.hot.tg:43114_11111111111111111111", 18);
138
+ var avalancheUSDC = createToken("avax", "USDC", "nep245:v2_1.omni.hot.tg:43114_3atVJH3r5c4GqiSYmg9fECvjc47o", 6, "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e");
139
+ var avalancheUSDT = createToken("avax", "USDT", "nep245:v2_1.omni.hot.tg:43114_372BeH7ENZieCaabwkbWkBiTTgXp", 6, "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7");
140
+ var bscBNB = createToken("bsc", "BNB", "nep245:v2_1.omni.hot.tg:56_11111111111111111111", 18);
141
+ var bscUSDC = createToken("bsc", "USDC", "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r", 18, "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d");
142
+ var bscUSDT = createToken("bsc", "USDT", "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g", 18, "0x55d398326f99059ff775485246999027b3197955");
143
+ var tonTON = createToken("ton", "TON", "nep245:v2_1.omni.hot.tg:1117_", 9);
144
+ var tonUSDT = createToken("ton", "USDT", "nep245:v2_1.omni.hot.tg:1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR", 6, "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs");
145
+ var tronTRX = createToken("tron", "TRX", "nep141:tron.omft.near", 6);
146
+ var tronUSDT = createToken("tron", "USDT", "nep141:tron-d28a265909efecdcee7c5028585214ea0b96f015.omft.near", 6, "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
147
+ var cardanoADA = createToken("cardano", "ADA", "nep141:cardano.omft.near", 6);
148
+ var rippleXRP = createToken("xrp", "XRP", "nep141:xrp.omft.near", 6);
149
+ var dogecoinDOGE = createToken("doge", "DOGE", "nep141:doge.omft.near", 8);
150
+ var litecoinLTC = createToken("ltc", "LTC", "nep141:ltc.omft.near", 8);
151
+ var bitcoinCashBCH = createToken("bch", "BCH", "nep141:bch.omft.near", 8);
152
+ var aptosAPT = createToken("aptos", "APT", "nep141:aptos.omft.near", 8);
153
+ var starknetSTRK = createToken("starknet", "STRK", "nep141:starknet.omft.near", 18);
154
+ var berachainBERA = createToken("bera", "BERA", "nep141:bera.omft.near", 18);
155
+ var zcashZEC = createToken("zec", "ZEC", "nep141:zec.omft.near", 8);
156
+ var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near");
157
+ var nearUSDC = createToken("near", "USDC", "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", 6, "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1");
158
+ var nearUSDT = createToken("near", "USDT", "nep141:usdt.tether-token.near", 6, "usdt.tether-token.near");
159
+ var CHAINS = {
160
+ sui: {
161
+ id: "sui",
162
+ name: "Sui",
163
+ icon: CHAIN_ICONS.sui,
164
+ tokens: [suiSUI, suiUSDC]
165
+ },
166
+ eth: {
167
+ id: "eth",
168
+ name: "Ethereum",
169
+ icon: CHAIN_ICONS.eth,
170
+ tokens: [ethereumETH, ethereumUSDC, ethereumUSDT, ethereumWBTC, ethereumDAI, ethereumAAVE, ethereumUNI, ethereumLINK, ethereumSHIB, ethereumPEPE, ethereumTURBO, ethereumSAFE]
171
+ },
172
+ arb: {
173
+ id: "arb",
174
+ name: "Arbitrum",
175
+ icon: CHAIN_ICONS.arb,
176
+ tokens: [arbitrumETH, arbitrumUSDC, arbitrumUSDT, arbitrumARB, arbitrumGMX]
177
+ },
178
+ base: {
179
+ id: "base",
180
+ name: "Base",
181
+ icon: CHAIN_ICONS.base,
182
+ tokens: [baseETH, baseUSDC, baseCbBTC, baseBRETT]
183
+ },
184
+ op: {
185
+ id: "op",
186
+ name: "Optimism",
187
+ icon: CHAIN_ICONS.op,
188
+ tokens: [optimismETH, optimismUSDC, optimismUSDT, optimismOP]
189
+ },
190
+ sol: {
191
+ id: "sol",
192
+ name: "Solana",
193
+ icon: CHAIN_ICONS.sol,
194
+ tokens: [solanaSOL, solanaUSDC, solanaUSDT, solanaTRUMP, solanaWIF, solanaMELANIA]
195
+ },
196
+ btc: {
197
+ id: "btc",
198
+ name: "Bitcoin",
199
+ icon: CHAIN_ICONS.btc,
200
+ tokens: [bitcoinBTC]
201
+ },
202
+ pol: {
203
+ id: "pol",
204
+ name: "Polygon",
205
+ icon: CHAIN_ICONS.pol,
206
+ tokens: [polygonPOL, polygonUSDC, polygonUSDT]
207
+ },
208
+ avax: {
209
+ id: "avax",
210
+ name: "Avalanche",
211
+ icon: CHAIN_ICONS.avax,
212
+ tokens: [avalancheAVAX, avalancheUSDC, avalancheUSDT]
213
+ },
214
+ bsc: {
215
+ id: "bsc",
216
+ name: "BNB Chain",
217
+ icon: CHAIN_ICONS.bsc,
218
+ tokens: [bscBNB, bscUSDC, bscUSDT]
219
+ },
220
+ ton: {
221
+ id: "ton",
222
+ name: "TON",
223
+ icon: CHAIN_ICONS.ton,
224
+ tokens: [tonTON, tonUSDT]
225
+ },
226
+ tron: {
227
+ id: "tron",
228
+ name: "Tron",
229
+ icon: CHAIN_ICONS.tron,
230
+ tokens: [tronTRX, tronUSDT]
231
+ },
232
+ near: {
233
+ id: "near",
234
+ name: "NEAR",
235
+ icon: CHAIN_ICONS.near,
236
+ tokens: [nearNEAR, nearUSDC, nearUSDT]
237
+ },
238
+ cardano: {
239
+ id: "cardano",
240
+ name: "Cardano",
241
+ icon: CHAIN_ICONS.cardano,
242
+ tokens: [cardanoADA]
243
+ },
244
+ xrp: {
245
+ id: "xrp",
246
+ name: "XRP Ledger",
247
+ icon: CHAIN_ICONS.xrp,
248
+ tokens: [rippleXRP]
249
+ },
250
+ doge: {
251
+ id: "doge",
252
+ name: "Dogecoin",
253
+ icon: CHAIN_ICONS.doge,
254
+ tokens: [dogecoinDOGE]
255
+ },
256
+ ltc: {
257
+ id: "ltc",
258
+ name: "Litecoin",
259
+ icon: CHAIN_ICONS.ltc,
260
+ tokens: [litecoinLTC]
261
+ },
262
+ bch: {
263
+ id: "bch",
264
+ name: "Bitcoin Cash",
265
+ icon: CHAIN_ICONS.bch,
266
+ tokens: [bitcoinCashBCH]
267
+ },
268
+ aptos: {
269
+ id: "aptos",
270
+ name: "Aptos",
271
+ icon: CHAIN_ICONS.aptos,
272
+ tokens: [aptosAPT]
273
+ },
274
+ starknet: {
275
+ id: "starknet",
276
+ name: "Starknet",
277
+ icon: CHAIN_ICONS.starknet,
278
+ tokens: [starknetSTRK]
279
+ },
280
+ bera: {
281
+ id: "bera",
282
+ name: "Berachain",
283
+ icon: CHAIN_ICONS.bera,
284
+ tokens: [berachainBERA]
285
+ },
286
+ zec: {
287
+ id: "zec",
288
+ name: "Zcash",
289
+ icon: CHAIN_ICONS.zec,
290
+ tokens: [zcashZEC]
291
+ },
292
+ gnosis: {
293
+ id: "gnosis",
294
+ name: "Gnosis",
295
+ icon: CHAIN_ICONS.gnosis,
296
+ tokens: []
297
+ },
298
+ monad: {
299
+ id: "monad",
300
+ name: "Monad",
301
+ icon: CHAIN_ICONS.monad,
302
+ tokens: []
303
+ },
304
+ stellar: {
305
+ id: "stellar",
306
+ name: "Stellar",
307
+ icon: CHAIN_ICONS.stellar,
308
+ tokens: []
309
+ }
310
+ };
311
+ var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
312
+ function getToken(name) {
313
+ return ALL_TOKENS.find((t) => t.name === name);
314
+ }
315
+ function getTokensByChain(chainId) {
316
+ return CHAINS[chainId]?.tokens || [];
317
+ }
318
+ function getTokenByAssetId(assetId) {
319
+ return ALL_TOKENS.find((t) => t.assetId === assetId);
320
+ }
321
+ function getSupportedChains() {
322
+ return Object.values(CHAINS).filter((c) => c.tokens.length > 0);
323
+ }
324
+ function getSuiDestinationTokens() {
325
+ return CHAINS.sui.tokens;
326
+ }
327
+ var _config = null;
328
+ function initUniport(config) {
329
+ _config = config;
330
+ if (!config.apiKey) {
331
+ throw new Error("Uniport SDK Error: apiKey is required. Pass your NEAR API key to initUniport().");
332
+ }
333
+ OpenAPI.BASE = config.baseUrl || "https://1click.chaindefuser.com";
334
+ OpenAPI.TOKEN = config.apiKey;
335
+ }
336
+ function getConfig() {
337
+ if (!_config) {
338
+ throw new Error(
339
+ "Uniport SDK not initialized. Call initUniport() first."
340
+ );
341
+ }
342
+ return _config;
343
+ }
344
+ function isInitialized() {
345
+ return _config !== null;
346
+ }
347
+
348
+ // src/core/intents.ts
349
+ function toSmallestUnits(amount, decimals) {
350
+ const [whole, fraction = ""] = amount.split(".");
351
+ const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
352
+ return `${whole}${paddedFraction}`.replace(/^0+/, "") || "0";
353
+ }
354
+ function fromSmallestUnits(amount, decimals) {
355
+ const padded = amount.padStart(decimals + 1, "0");
356
+ const whole = padded.slice(0, -decimals) || "0";
357
+ const fraction = padded.slice(-decimals).replace(/0+$/, "");
358
+ return fraction ? `${whole}.${fraction}` : whole;
359
+ }
360
+ function generateDeadline(hoursFromNow = 1) {
361
+ const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
362
+ return deadline.toISOString();
363
+ }
364
+ function ensureInitialized() {
365
+ if (!isInitialized()) {
366
+ throw new Error(
367
+ "Uniport SDK not initialized. Call initUniport() first."
368
+ );
369
+ }
370
+ }
371
+ async function getQuote(options) {
372
+ ensureInitialized();
373
+ const config = getConfig();
374
+ const {
375
+ originToken,
376
+ destinationToken,
377
+ amount,
378
+ recipient,
379
+ refundTo,
380
+ slippageTolerance = 100,
381
+ // 1% default
382
+ swapType = "EXACT_INPUT",
383
+ deadline,
384
+ dry = false,
385
+ referral = config.referral || "uniport"
386
+ } = options;
387
+ const amountInSmallestUnits = toSmallestUnits(amount, originToken.decimals);
388
+ const quoteRequest = {
389
+ dry,
390
+ swapType: QuoteRequest.swapType[swapType],
391
+ slippageTolerance,
392
+ originAsset: originToken.assetId,
393
+ depositType: QuoteRequest.depositType.ORIGIN_CHAIN,
394
+ destinationAsset: destinationToken.assetId,
395
+ amount: amountInSmallestUnits,
396
+ refundTo,
397
+ refundType: QuoteRequest.refundType.ORIGIN_CHAIN,
398
+ recipient,
399
+ recipientType: QuoteRequest.recipientType.DESTINATION_CHAIN,
400
+ deadline: deadline?.toISOString() || generateDeadline(1),
401
+ referral
402
+ };
403
+ try {
404
+ const response = await OneClickService.getQuote(quoteRequest);
405
+ const quote = response.quote;
406
+ return {
407
+ depositAddress: quote.depositAddress || "",
408
+ memo: quote.depositMemo,
409
+ amountIn: quote.amountIn,
410
+ amountOut: quote.amountOut,
411
+ amountOutFormatted: quote.amountOutFormatted,
412
+ amountOutUsd: quote.amountOutUsd,
413
+ deadline: quote.deadline,
414
+ timeWhenInactive: quote.timeWhenInactive,
415
+ correlationId: response.correlationId
416
+ };
417
+ } catch (error) {
418
+ if (error instanceof ApiError) {
419
+ throw new Error(
420
+ `Quote failed (${error.status}): ${JSON.stringify(error.body)}`
421
+ );
422
+ }
423
+ throw error;
424
+ }
425
+ }
426
+ async function submitDepositTx(params) {
427
+ ensureInitialized();
428
+ const { txHash, depositAddress, memo, nearSenderAccount } = params;
429
+ try {
430
+ await OneClickService.submitDepositTx({
431
+ txHash,
432
+ depositAddress,
433
+ memo,
434
+ nearSenderAccount
435
+ });
436
+ } catch (error) {
437
+ if (error instanceof ApiError) {
438
+ throw new Error(
439
+ `Submit deposit failed (${error.status}): ${JSON.stringify(error.body)}`
440
+ );
441
+ }
442
+ throw error;
443
+ }
444
+ }
445
+ async function getExecutionStatus(depositAddress, memo) {
446
+ ensureInitialized();
447
+ try {
448
+ const response = await OneClickService.getExecutionStatus(
449
+ depositAddress,
450
+ memo
451
+ );
452
+ const status = response.status;
453
+ const isComplete = ["SUCCESS", "REFUNDED", "FAILED"].includes(status);
454
+ const isSuccess = status === "SUCCESS";
455
+ const swapDetails = response.swapDetails;
456
+ const destinationTxHashes = swapDetails?.destinationChainTxHashes?.map((tx) => tx.hash);
457
+ const originTxHashes = swapDetails?.originChainTxHashes?.map(
458
+ (tx) => tx.hash
459
+ );
460
+ return {
461
+ status,
462
+ isComplete,
463
+ isSuccess,
464
+ correlationId: response.correlationId,
465
+ destinationTxHashes,
466
+ originTxHashes
467
+ };
468
+ } catch (error) {
469
+ if (error instanceof ApiError) {
470
+ throw new Error(
471
+ `Status check failed (${error.status}): ${JSON.stringify(error.body)}`
472
+ );
473
+ }
474
+ throw error;
475
+ }
476
+ }
477
+ async function pollExecutionStatus(depositAddress, options) {
478
+ const {
479
+ memo,
480
+ interval = 5e3,
481
+ timeout = 6e5,
482
+ onStatusChange
483
+ } = options || {};
484
+ const startTime = Date.now();
485
+ let lastStatus = null;
486
+ while (Date.now() - startTime < timeout) {
487
+ const status = await getExecutionStatus(depositAddress, memo);
488
+ if (status.status !== lastStatus) {
489
+ lastStatus = status.status;
490
+ onStatusChange?.(status);
491
+ }
492
+ if (status.isComplete) {
493
+ return status;
494
+ }
495
+ await new Promise((resolve) => setTimeout(resolve, interval));
496
+ }
497
+ throw new Error(`Timeout waiting for swap completion after ${timeout}ms`);
498
+ }
499
+ function useUniportPayment(options) {
500
+ const { recipient, refundAddress, destinationToken, onSuccess, onError } = options;
501
+ const destToken = destinationToken === "suiSUI" ? suiSUI : suiUSDC;
502
+ const [paymentState, setPaymentState] = useState("idle");
503
+ const [quote, setQuote] = useState(null);
504
+ const [previewQuote, setPreviewQuote] = useState(null);
505
+ const [isLoadingPreview, setIsLoadingPreview] = useState(false);
506
+ const [status, setStatus] = useState(null);
507
+ const [error, setError] = useState(null);
508
+ const [selectedChain, setSelectedChain] = useState(null);
509
+ const [selectedToken, setSelectedToken] = useState(null);
510
+ const [amount, setAmountState] = useState("");
511
+ const pollingRef = useRef(null);
512
+ const lastStatusRef = useRef(null);
513
+ const previewDebounceRef = useRef(null);
514
+ const chains = getSupportedChains().filter((c) => c.id !== "sui");
515
+ const tokens = selectedChain?.tokens || [];
516
+ const destinationTokens = getSuiDestinationTokens();
517
+ const setAmount = useCallback(
518
+ (newAmount) => {
519
+ setAmountState(newAmount);
520
+ setPreviewQuote(null);
521
+ if (previewDebounceRef.current) {
522
+ clearTimeout(previewDebounceRef.current);
523
+ }
524
+ if (newAmount && selectedToken && refundAddress) {
525
+ setIsLoadingPreview(true);
526
+ previewDebounceRef.current = setTimeout(async () => {
527
+ try {
528
+ const result = await getQuote({
529
+ originToken: selectedToken,
530
+ destinationToken: destToken,
531
+ amount: newAmount,
532
+ recipient,
533
+ refundTo: refundAddress,
534
+ dry: true
535
+ // Dry run for preview
536
+ });
537
+ setPreviewQuote(result);
538
+ } catch (err) {
539
+ console.warn("Preview quote failed:", err);
540
+ } finally {
541
+ setIsLoadingPreview(false);
542
+ }
543
+ }, 3e3);
544
+ } else {
545
+ setIsLoadingPreview(false);
546
+ }
547
+ },
548
+ [selectedToken, refundAddress, recipient, destToken]
549
+ );
550
+ const handleChainSelect = useCallback((chain) => {
551
+ setSelectedChain(chain);
552
+ setSelectedToken(chain.tokens[0] || null);
553
+ setPaymentState("selecting");
554
+ setPreviewQuote(null);
555
+ }, []);
556
+ const handleTokenSelect = useCallback((token) => {
557
+ setSelectedToken(token);
558
+ setPaymentState("selecting");
559
+ setPreviewQuote(null);
560
+ }, []);
561
+ const fetchQuote = useCallback(async () => {
562
+ if (!selectedToken || !amount || !refundAddress) {
563
+ setError(new Error("Missing required fields"));
564
+ return;
565
+ }
566
+ setPaymentState("quoting");
567
+ setError(null);
568
+ try {
569
+ const result = await getQuote({
570
+ originToken: selectedToken,
571
+ destinationToken: destToken,
572
+ amount,
573
+ recipient,
574
+ refundTo: refundAddress,
575
+ dry: false
576
+ });
577
+ setQuote(result);
578
+ setPaymentState("awaiting_deposit");
579
+ } catch (err) {
580
+ const error2 = err instanceof Error ? err : new Error("Failed to get quote");
581
+ setError(error2);
582
+ setPaymentState("error");
583
+ onError?.(error2);
584
+ }
585
+ }, [
586
+ selectedToken,
587
+ amount,
588
+ refundAddress,
589
+ recipient,
590
+ destToken,
591
+ onError
592
+ ]);
593
+ const pollStatus = useCallback(async () => {
594
+ if (!quote?.depositAddress) return;
595
+ try {
596
+ const result = await getExecutionStatus(
597
+ quote.depositAddress,
598
+ quote.memo
599
+ );
600
+ setStatus(result);
601
+ if (result.status !== lastStatusRef.current) {
602
+ lastStatusRef.current = result.status;
603
+ if (result.status === "PROCESSING") {
604
+ setPaymentState("processing");
605
+ } else if (result.isSuccess) {
606
+ setPaymentState("success");
607
+ stopPolling();
608
+ onSuccess?.({
609
+ txHash: result.destinationTxHashes?.[0] || "",
610
+ amount: quote.amountOut
611
+ });
612
+ } else if (result.status === "FAILED") {
613
+ setPaymentState("error");
614
+ stopPolling();
615
+ const err = new Error("Payment failed");
616
+ setError(err);
617
+ onError?.(err);
618
+ }
619
+ }
620
+ } catch (err) {
621
+ console.error("Status poll error:", err);
622
+ }
623
+ }, [quote, onSuccess, onError]);
624
+ const startPolling = useCallback(() => {
625
+ if (pollingRef.current) return;
626
+ pollStatus();
627
+ pollingRef.current = setInterval(pollStatus, 3e3);
628
+ }, [pollStatus]);
629
+ const stopPolling = useCallback(() => {
630
+ if (pollingRef.current) {
631
+ clearInterval(pollingRef.current);
632
+ pollingRef.current = null;
633
+ }
634
+ }, []);
635
+ const copyToClipboard = useCallback(async (text) => {
636
+ try {
637
+ await navigator.clipboard.writeText(text);
638
+ return true;
639
+ } catch {
640
+ return false;
641
+ }
642
+ }, []);
643
+ const reset = useCallback(() => {
644
+ stopPolling();
645
+ if (previewDebounceRef.current) {
646
+ clearTimeout(previewDebounceRef.current);
647
+ }
648
+ setPaymentState("idle");
649
+ setQuote(null);
650
+ setPreviewQuote(null);
651
+ setIsLoadingPreview(false);
652
+ setStatus(null);
653
+ setError(null);
654
+ setSelectedChain(null);
655
+ setSelectedToken(null);
656
+ setAmountState("");
657
+ lastStatusRef.current = null;
658
+ }, [stopPolling]);
659
+ useEffect(() => {
660
+ return () => {
661
+ stopPolling();
662
+ if (previewDebounceRef.current) {
663
+ clearTimeout(previewDebounceRef.current);
664
+ }
665
+ };
666
+ }, [stopPolling]);
667
+ return {
668
+ paymentState,
669
+ quote,
670
+ previewQuote,
671
+ isLoadingPreview,
672
+ status,
673
+ error,
674
+ selectedChain,
675
+ selectedToken,
676
+ amount,
677
+ destinationToken: destToken,
678
+ chains,
679
+ tokens,
680
+ destinationTokens,
681
+ setSelectedChain: handleChainSelect,
682
+ setSelectedToken: handleTokenSelect,
683
+ setAmount,
684
+ fetchQuote,
685
+ startPolling,
686
+ stopPolling,
687
+ reset,
688
+ copyToClipboard
689
+ };
690
+ }
691
+ var styles = {
692
+ overlay: {
693
+ position: "fixed",
694
+ inset: 0,
695
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
696
+ backdropFilter: "blur(8px)",
697
+ display: "flex",
698
+ alignItems: "center",
699
+ justifyContent: "center",
700
+ zIndex: 9999,
701
+ padding: "16px",
702
+ animation: "uniport-fade-in 0.2s ease"
703
+ },
704
+ modal: {
705
+ position: "relative",
706
+ width: "100%",
707
+ maxWidth: "380px",
708
+ background: "rgba(22, 22, 30, 0.95)",
709
+ backdropFilter: "blur(24px)",
710
+ border: "1px solid rgba(255, 255, 255, 0.08)",
711
+ borderRadius: "24px",
712
+ padding: "24px",
713
+ boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.05)",
714
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
715
+ animation: "uniport-slide-up 0.3s ease"
716
+ },
717
+ header: {
718
+ display: "flex",
719
+ flexDirection: "column",
720
+ alignItems: "center",
721
+ marginBottom: "24px"
722
+ },
723
+ headerIcon: {
724
+ width: "48px",
725
+ height: "48px",
726
+ borderRadius: "16px",
727
+ background: "linear-gradient(135deg, rgba(255,255,255,0.1), transparent)",
728
+ border: "1px solid rgba(255,255,255,0.05)",
729
+ display: "flex",
730
+ alignItems: "center",
731
+ justifyContent: "center",
732
+ marginBottom: "16px"
733
+ },
734
+ title: {
735
+ fontSize: "18px",
736
+ fontWeight: 500,
737
+ color: "white",
738
+ margin: 0,
739
+ textShadow: "0 0 15px rgba(255,255,255,0.3)"
740
+ },
741
+ subtitle: {
742
+ fontSize: "12px",
743
+ color: "rgba(255,255,255,0.4)",
744
+ marginTop: "4px",
745
+ fontWeight: 300,
746
+ letterSpacing: "0.5px"
747
+ },
748
+ closeButton: {
749
+ position: "absolute",
750
+ top: "16px",
751
+ right: "16px",
752
+ width: "32px",
753
+ height: "32px",
754
+ borderRadius: "8px",
755
+ background: "rgba(255,255,255,0.05)",
756
+ border: "1px solid rgba(255,255,255,0.1)",
757
+ color: "rgba(255,255,255,0.6)",
758
+ cursor: "pointer",
759
+ display: "flex",
760
+ alignItems: "center",
761
+ justifyContent: "center",
762
+ transition: "all 0.2s"
763
+ },
764
+ selectorsRow: {
765
+ display: "grid",
766
+ gridTemplateColumns: "1fr 1fr",
767
+ gap: "12px",
768
+ marginBottom: "24px"
769
+ },
770
+ selector: {
771
+ display: "flex",
772
+ alignItems: "center",
773
+ justifyContent: "space-between",
774
+ padding: "12px",
775
+ background: "rgba(255,255,255,0.05)",
776
+ border: "1px solid rgba(255,255,255,0.05)",
777
+ borderRadius: "16px",
778
+ cursor: "pointer",
779
+ transition: "all 0.2s"
780
+ },
781
+ selectorIcon: {
782
+ width: "32px",
783
+ height: "32px",
784
+ borderRadius: "50%",
785
+ background: "#1c1c26",
786
+ border: "1px solid rgba(255,255,255,0.1)",
787
+ display: "flex",
788
+ alignItems: "center",
789
+ justifyContent: "center",
790
+ overflow: "hidden"
791
+ },
792
+ selectorLabel: {
793
+ fontSize: "10px",
794
+ textTransform: "uppercase",
795
+ letterSpacing: "1.5px",
796
+ color: "rgba(255,255,255,0.3)",
797
+ fontWeight: 500
798
+ },
799
+ selectorValue: {
800
+ fontSize: "14px",
801
+ color: "rgba(255,255,255,0.9)",
802
+ fontWeight: 500
803
+ },
804
+ amountInput: {
805
+ width: "100%",
806
+ textAlign: "center",
807
+ fontSize: "48px",
808
+ fontWeight: 500,
809
+ color: "white",
810
+ background: "transparent",
811
+ border: "none",
812
+ outline: "none",
813
+ marginBottom: "24px",
814
+ caretColor: "#4F46E5"
815
+ },
816
+ details: {
817
+ marginBottom: "20px",
818
+ padding: "0 4px"
819
+ },
820
+ detailRow: {
821
+ display: "flex",
822
+ justifyContent: "space-between",
823
+ alignItems: "center",
824
+ fontSize: "12px",
825
+ color: "rgba(255,255,255,0.4)",
826
+ marginBottom: "8px"
827
+ },
828
+ detailValue: {
829
+ fontWeight: 500,
830
+ color: "rgba(255,255,255,0.7)",
831
+ display: "flex",
832
+ alignItems: "center",
833
+ gap: "6px"
834
+ },
835
+ button: {
836
+ width: "100%",
837
+ position: "relative",
838
+ overflow: "hidden",
839
+ borderRadius: "16px",
840
+ padding: "2px",
841
+ background: "linear-gradient(90deg, #4F46E5, #7C3AED, #4F46E5)",
842
+ backgroundSize: "200% 200%",
843
+ animation: "uniport-gradient 3s ease infinite",
844
+ border: "none",
845
+ cursor: "pointer"
846
+ },
847
+ buttonInner: {
848
+ display: "flex",
849
+ alignItems: "center",
850
+ justifyContent: "center",
851
+ gap: "8px",
852
+ height: "48px",
853
+ borderRadius: "14px",
854
+ background: "#0A0A0F",
855
+ color: "white",
856
+ fontSize: "14px",
857
+ fontWeight: 500,
858
+ transition: "background 0.3s"
859
+ },
860
+ buttonDisabled: {
861
+ opacity: 0.5,
862
+ cursor: "not-allowed"
863
+ },
864
+ // QR container - dark background, no white box
865
+ qrContainer: {
866
+ display: "flex",
867
+ flexDirection: "column",
868
+ alignItems: "center",
869
+ padding: "24px",
870
+ background: "transparent",
871
+ marginBottom: "16px"
872
+ },
873
+ // Address with copy button
874
+ addressContainer: {
875
+ display: "flex",
876
+ alignItems: "center",
877
+ justifyContent: "center",
878
+ gap: "8px",
879
+ marginTop: "16px"
880
+ },
881
+ addressText: {
882
+ fontSize: "12px",
883
+ color: "rgba(255,255,255,0.6)",
884
+ wordBreak: "break-all",
885
+ textAlign: "center",
886
+ fontFamily: "monospace"
887
+ },
888
+ copyButton: {
889
+ display: "flex",
890
+ alignItems: "center",
891
+ justifyContent: "center",
892
+ width: "32px",
893
+ height: "32px",
894
+ borderRadius: "8px",
895
+ background: "rgba(255,255,255,0.1)",
896
+ border: "1px solid rgba(255,255,255,0.15)",
897
+ cursor: "pointer",
898
+ transition: "all 0.2s",
899
+ flexShrink: 0
900
+ },
901
+ statusBadge: {
902
+ display: "inline-flex",
903
+ alignItems: "center",
904
+ gap: "6px",
905
+ padding: "6px 12px",
906
+ borderRadius: "20px",
907
+ fontSize: "12px",
908
+ fontWeight: 500
909
+ },
910
+ processingBadge: {
911
+ background: "rgba(79, 70, 229, 0.2)",
912
+ color: "#818CF8"
913
+ },
914
+ dropdown: {
915
+ position: "absolute",
916
+ top: "calc(100% + 8px)",
917
+ left: 0,
918
+ right: 0,
919
+ background: "rgba(22, 22, 30, 0.98)",
920
+ border: "1px solid rgba(255,255,255,0.1)",
921
+ borderRadius: "16px",
922
+ maxHeight: "200px",
923
+ overflowY: "auto",
924
+ zIndex: 10,
925
+ boxShadow: "0 20px 40px rgba(0,0,0,0.5)"
926
+ },
927
+ dropdownItem: {
928
+ display: "flex",
929
+ alignItems: "center",
930
+ gap: "12px",
931
+ padding: "12px 16px",
932
+ cursor: "pointer",
933
+ transition: "background 0.2s"
934
+ },
935
+ loadingDot: {
936
+ width: "8px",
937
+ height: "8px",
938
+ borderRadius: "50%",
939
+ background: "#818CF8",
940
+ animation: "uniport-pulse 1s ease infinite"
941
+ },
942
+ tokenBadge: {
943
+ display: "inline-flex",
944
+ alignItems: "center",
945
+ gap: "4px",
946
+ padding: "2px 8px",
947
+ borderRadius: "12px",
948
+ background: "rgba(255,255,255,0.08)",
949
+ fontSize: "11px"
950
+ }
951
+ };
952
+ var injectStyles = () => {
953
+ if (typeof document === "undefined") return;
954
+ if (document.getElementById("uniport-styles")) return;
955
+ const style = document.createElement("style");
956
+ style.id = "uniport-styles";
957
+ style.textContent = `
958
+ @keyframes uniport-fade-in {
959
+ from { opacity: 0; }
960
+ to { opacity: 1; }
961
+ }
962
+ @keyframes uniport-slide-up {
963
+ from { opacity: 0; transform: translateY(20px) scale(0.95); }
964
+ to { opacity: 1; transform: translateY(0) scale(1); }
965
+ }
966
+ @keyframes uniport-gradient {
967
+ 0% { background-position: 0% 50%; }
968
+ 50% { background-position: 100% 50%; }
969
+ 100% { background-position: 0% 50%; }
970
+ }
971
+ @keyframes uniport-pulse {
972
+ 0%, 100% { opacity: 1; }
973
+ 50% { opacity: 0.3; }
974
+ }
975
+ `;
976
+ document.head.appendChild(style);
977
+ };
978
+ function UniportModal({
979
+ open,
980
+ onClose,
981
+ recipient,
982
+ refundAddress,
983
+ destinationToken = "suiUSDC",
984
+ amount: initialAmount,
985
+ onSuccess,
986
+ onError
987
+ }) {
988
+ const payment = useUniportPayment({
989
+ recipient,
990
+ refundAddress,
991
+ destinationToken,
992
+ onSuccess,
993
+ onError
994
+ });
995
+ const [chainDropdownOpen, setChainDropdownOpen] = React.useState(false);
996
+ const [tokenDropdownOpen, setTokenDropdownOpen] = React.useState(false);
997
+ const [copied, setCopied] = useState(false);
998
+ const [showReceipt, setShowReceipt] = useState(false);
999
+ useEffect(() => {
1000
+ injectStyles();
1001
+ }, []);
1002
+ useEffect(() => {
1003
+ if (payment.paymentState === "awaiting_deposit") {
1004
+ payment.startPolling();
1005
+ }
1006
+ }, [payment.paymentState]);
1007
+ useEffect(() => {
1008
+ return () => payment.stopPolling();
1009
+ }, []);
1010
+ const handleClose = useCallback(() => {
1011
+ payment.reset();
1012
+ onClose();
1013
+ }, [payment, onClose]);
1014
+ useEffect(() => {
1015
+ const handleEscape = (e) => {
1016
+ if (e.key === "Escape") handleClose();
1017
+ };
1018
+ if (open) {
1019
+ document.addEventListener("keydown", handleEscape);
1020
+ return () => document.removeEventListener("keydown", handleEscape);
1021
+ }
1022
+ }, [open, handleClose]);
1023
+ const handleCopy = useCallback(async () => {
1024
+ if (payment.quote?.depositAddress) {
1025
+ const success = await payment.copyToClipboard(payment.quote.depositAddress);
1026
+ if (success) {
1027
+ setCopied(true);
1028
+ setTimeout(() => setCopied(false), 2e3);
1029
+ }
1030
+ }
1031
+ }, [payment]);
1032
+ if (!open) return null;
1033
+ const canSubmit = payment.selectedToken && payment.amount && refundAddress;
1034
+ const isProcessing = payment.paymentState === "quoting" || payment.paymentState === "processing";
1035
+ const showQR = payment.paymentState === "awaiting_deposit" || payment.paymentState === "processing";
1036
+ const isSuccess = payment.paymentState === "success";
1037
+ return /* @__PURE__ */ jsx("div", { style: styles.overlay, onClick: handleClose, children: /* @__PURE__ */ jsxs("div", { style: styles.modal, onClick: (e) => e.stopPropagation(), children: [
1038
+ /* @__PURE__ */ jsx(
1039
+ "button",
1040
+ {
1041
+ style: styles.closeButton,
1042
+ onClick: handleClose,
1043
+ onMouseEnter: (e) => {
1044
+ e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1045
+ },
1046
+ onMouseLeave: (e) => {
1047
+ e.currentTarget.style.background = "rgba(255,255,255,0.05)";
1048
+ },
1049
+ children: /* @__PURE__ */ jsx(CloseIcon, {})
1050
+ }
1051
+ ),
1052
+ isSuccess ? /* @__PURE__ */ jsxs("div", { style: { textAlign: "center", paddingTop: "20px" }, children: [
1053
+ /* @__PURE__ */ jsx("h2", { style: { ...styles.title, marginBottom: "32px", fontSize: "20px" }, children: "Payment Successful" }),
1054
+ /* @__PURE__ */ jsx(
1055
+ "div",
1056
+ {
1057
+ style: {
1058
+ width: "100px",
1059
+ height: "100px",
1060
+ borderRadius: "50%",
1061
+ background: "rgba(22, 22, 30, 0.9)",
1062
+ border: "3px solid #10B981",
1063
+ display: "flex",
1064
+ alignItems: "center",
1065
+ justifyContent: "center",
1066
+ margin: "0 auto 24px",
1067
+ boxShadow: "0 0 30px rgba(16, 185, 129, 0.3)"
1068
+ },
1069
+ children: /* @__PURE__ */ jsx("svg", { width: "48", height: "48", viewBox: "0 0 24 24", fill: "none", stroke: "#10B981", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) })
1070
+ }
1071
+ ),
1072
+ /* @__PURE__ */ jsx("p", { style: { color: "white", fontSize: "18px", fontWeight: 500, marginBottom: "8px" }, children: "Payment Completed" }),
1073
+ /* @__PURE__ */ jsxs("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "14px", marginBottom: "32px" }, children: [
1074
+ payment.amount,
1075
+ " ",
1076
+ payment.selectedToken?.symbol,
1077
+ " \u2192 ~",
1078
+ payment.quote?.amountOutFormatted || "",
1079
+ " ",
1080
+ payment.destinationToken.symbol,
1081
+ " on Sui"
1082
+ ] }),
1083
+ /* @__PURE__ */ jsx(
1084
+ "button",
1085
+ {
1086
+ onClick: () => setShowReceipt(!showReceipt),
1087
+ style: { background: "transparent", border: "none", color: "rgba(255,255,255,0.6)", fontSize: "14px", cursor: "pointer", textDecoration: "underline", marginBottom: showReceipt ? "16px" : "0" },
1088
+ children: showReceipt ? "Hide receipt" : "Show receipt"
1089
+ }
1090
+ ),
1091
+ showReceipt && /* @__PURE__ */ jsxs("div", { style: { background: "rgba(255,255,255,0.05)", borderRadius: "12px", padding: "16px", textAlign: "left", marginTop: "8px" }, children: [
1092
+ payment.status?.originTxHashes?.map((hash, i) => /* @__PURE__ */ jsxs("div", { style: { marginBottom: "12px" }, children: [
1093
+ /* @__PURE__ */ jsxs("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "12px", marginBottom: "4px" }, children: [
1094
+ "Source TX (",
1095
+ payment.selectedChain?.name,
1096
+ ")"
1097
+ ] }),
1098
+ /* @__PURE__ */ 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: [
1099
+ hash.slice(0, 10),
1100
+ "...",
1101
+ hash.slice(-8),
1102
+ " \u2197"
1103
+ ] })
1104
+ ] }, `origin-${i}`)),
1105
+ payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxs("div", { children: [
1106
+ /* @__PURE__ */ jsx("p", { style: { color: "rgba(255,255,255,0.5)", fontSize: "12px", marginBottom: "4px" }, children: "Destination TX (Sui)" }),
1107
+ /* @__PURE__ */ jsxs("a", { href: `https://suiscan.xyz/mainnet/tx/${hash}`, target: "_blank", rel: "noopener noreferrer", style: { color: "#60A5FA", fontSize: "13px", textDecoration: "none", fontFamily: "monospace" }, children: [
1108
+ hash.slice(0, 10),
1109
+ "...",
1110
+ hash.slice(-8),
1111
+ " \u2197"
1112
+ ] })
1113
+ ] }, `dest-${i}`)),
1114
+ !payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsx("p", { style: { color: "rgba(255,255,255,0.4)", fontSize: "13px" }, children: "Transaction details loading..." })
1115
+ ] }),
1116
+ /* @__PURE__ */ jsx("button", { onClick: handleClose, style: { ...styles.button, marginTop: "24px", background: "linear-gradient(135deg, #10B981, #059669)" }, children: "Done" })
1117
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1118
+ /* @__PURE__ */ jsxs("div", { style: styles.header, children: [
1119
+ /* @__PURE__ */ jsx("div", { style: styles.headerIcon, children: /* @__PURE__ */ jsx(CardIcon, {}) }),
1120
+ /* @__PURE__ */ jsx("h2", { style: styles.title, children: showQR ? "Send Payment" : "Pay with any token" }),
1121
+ /* @__PURE__ */ jsx("p", { style: styles.subtitle, children: showQR ? "Scan QR or copy address below" : "Secure, gasless transactions" })
1122
+ ] }),
1123
+ showQR && payment.quote && /* @__PURE__ */ jsxs(Fragment, { children: [
1124
+ /* @__PURE__ */ jsx("div", { style: styles.qrContainer, children: /* @__PURE__ */ jsx(
1125
+ QRCodeSVG,
1126
+ {
1127
+ value: payment.quote.depositAddress,
1128
+ size: 180,
1129
+ level: "M",
1130
+ bgColor: "transparent",
1131
+ fgColor: "white"
1132
+ }
1133
+ ) }),
1134
+ /* @__PURE__ */ jsxs("div", { style: styles.addressContainer, children: [
1135
+ /* @__PURE__ */ jsxs("span", { style: styles.addressText, children: [
1136
+ payment.quote.depositAddress.slice(0, 8),
1137
+ "...",
1138
+ payment.quote.depositAddress.slice(-8)
1139
+ ] }),
1140
+ /* @__PURE__ */ jsx(
1141
+ "button",
1142
+ {
1143
+ style: styles.copyButton,
1144
+ onClick: handleCopy,
1145
+ onMouseEnter: (e) => {
1146
+ e.currentTarget.style.background = "rgba(255,255,255,0.2)";
1147
+ },
1148
+ onMouseLeave: (e) => {
1149
+ e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1150
+ },
1151
+ children: copied ? /* @__PURE__ */ jsx(CheckSmallIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {})
1152
+ }
1153
+ )
1154
+ ] }),
1155
+ /* @__PURE__ */ jsxs("div", { style: { ...styles.details, marginTop: "20px" }, children: [
1156
+ /* @__PURE__ */ jsxs("div", { style: styles.detailRow, children: [
1157
+ /* @__PURE__ */ jsx("span", { children: "Status" }),
1158
+ /* @__PURE__ */ jsxs(
1159
+ "span",
1160
+ {
1161
+ style: {
1162
+ ...styles.statusBadge,
1163
+ ...styles.processingBadge
1164
+ },
1165
+ children: [
1166
+ /* @__PURE__ */ jsx(PulseIcon, {}),
1167
+ " ",
1168
+ payment.paymentState === "processing" ? "Processing deposit..." : "Waiting for deposit"
1169
+ ]
1170
+ }
1171
+ )
1172
+ ] }),
1173
+ /* @__PURE__ */ jsxs("div", { style: styles.detailRow, children: [
1174
+ /* @__PURE__ */ jsx("span", { children: "Amount to send" }),
1175
+ /* @__PURE__ */ jsxs("span", { style: styles.detailValue, children: [
1176
+ payment.amount,
1177
+ " ",
1178
+ payment.selectedToken?.symbol,
1179
+ /* @__PURE__ */ jsx("span", { style: styles.tokenBadge, children: payment.selectedChain?.name })
1180
+ ] })
1181
+ ] }),
1182
+ /* @__PURE__ */ jsxs("div", { style: styles.detailRow, children: [
1183
+ /* @__PURE__ */ jsx("span", { children: "You receive" }),
1184
+ /* @__PURE__ */ jsxs("span", { style: styles.detailValue, children: [
1185
+ "~",
1186
+ payment.quote.amountOutFormatted,
1187
+ " ",
1188
+ payment.destinationToken.symbol,
1189
+ /* @__PURE__ */ jsx("span", { style: styles.tokenBadge, children: "Sui" })
1190
+ ] })
1191
+ ] })
1192
+ ] })
1193
+ ] }),
1194
+ !showQR && !isSuccess && /* @__PURE__ */ jsxs(Fragment, { children: [
1195
+ /* @__PURE__ */ jsxs("div", { style: styles.selectorsRow, children: [
1196
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
1197
+ /* @__PURE__ */ jsxs(
1198
+ "div",
1199
+ {
1200
+ style: styles.selector,
1201
+ onClick: () => {
1202
+ setChainDropdownOpen(!chainDropdownOpen);
1203
+ setTokenDropdownOpen(false);
1204
+ },
1205
+ children: [
1206
+ /* @__PURE__ */ jsxs(
1207
+ "div",
1208
+ {
1209
+ style: {
1210
+ display: "flex",
1211
+ alignItems: "center",
1212
+ gap: "12px"
1213
+ },
1214
+ children: [
1215
+ /* @__PURE__ */ jsx("div", { style: styles.selectorIcon, children: payment.selectedChain ? /* @__PURE__ */ jsx(
1216
+ "img",
1217
+ {
1218
+ src: payment.selectedChain.icon,
1219
+ alt: "",
1220
+ style: {
1221
+ width: "100%",
1222
+ height: "100%"
1223
+ }
1224
+ }
1225
+ ) : /* @__PURE__ */ jsx(GlobeIcon, {}) }),
1226
+ /* @__PURE__ */ jsxs("div", { children: [
1227
+ /* @__PURE__ */ jsx("div", { style: styles.selectorLabel, children: "Chain" }),
1228
+ /* @__PURE__ */ jsx("div", { style: styles.selectorValue, children: payment.selectedChain?.name || "Select" })
1229
+ ] })
1230
+ ]
1231
+ }
1232
+ ),
1233
+ /* @__PURE__ */ jsx(ChevronIcon, {})
1234
+ ]
1235
+ }
1236
+ ),
1237
+ chainDropdownOpen && /* @__PURE__ */ jsx("div", { style: styles.dropdown, children: payment.chains.map((chain) => /* @__PURE__ */ jsxs(
1238
+ "div",
1239
+ {
1240
+ style: styles.dropdownItem,
1241
+ onClick: () => {
1242
+ payment.setSelectedChain(chain);
1243
+ setChainDropdownOpen(false);
1244
+ },
1245
+ onMouseEnter: (e) => {
1246
+ e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1247
+ },
1248
+ onMouseLeave: (e) => {
1249
+ e.currentTarget.style.background = "transparent";
1250
+ },
1251
+ children: [
1252
+ /* @__PURE__ */ jsx(
1253
+ "img",
1254
+ {
1255
+ src: chain.icon,
1256
+ alt: "",
1257
+ style: {
1258
+ width: "24px",
1259
+ height: "24px",
1260
+ borderRadius: "50%"
1261
+ }
1262
+ }
1263
+ ),
1264
+ /* @__PURE__ */ jsx(
1265
+ "span",
1266
+ {
1267
+ style: {
1268
+ color: "white",
1269
+ fontSize: "14px"
1270
+ },
1271
+ children: chain.name
1272
+ }
1273
+ )
1274
+ ]
1275
+ },
1276
+ chain.id
1277
+ )) })
1278
+ ] }),
1279
+ /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
1280
+ /* @__PURE__ */ jsxs(
1281
+ "div",
1282
+ {
1283
+ style: {
1284
+ ...styles.selector,
1285
+ opacity: payment.selectedChain ? 1 : 0.5,
1286
+ pointerEvents: payment.selectedChain ? "auto" : "none"
1287
+ },
1288
+ onClick: () => {
1289
+ if (payment.selectedChain) {
1290
+ setTokenDropdownOpen(!tokenDropdownOpen);
1291
+ setChainDropdownOpen(false);
1292
+ }
1293
+ },
1294
+ children: [
1295
+ /* @__PURE__ */ jsxs(
1296
+ "div",
1297
+ {
1298
+ style: {
1299
+ display: "flex",
1300
+ alignItems: "center",
1301
+ gap: "12px"
1302
+ },
1303
+ children: [
1304
+ /* @__PURE__ */ jsx("div", { style: styles.selectorIcon, children: payment.selectedToken ? /* @__PURE__ */ jsx(
1305
+ "img",
1306
+ {
1307
+ src: payment.selectedToken.icon,
1308
+ alt: "",
1309
+ style: {
1310
+ width: "100%",
1311
+ height: "100%"
1312
+ }
1313
+ }
1314
+ ) : /* @__PURE__ */ jsx(DollarIcon, {}) }),
1315
+ /* @__PURE__ */ jsxs("div", { children: [
1316
+ /* @__PURE__ */ jsx("div", { style: styles.selectorLabel, children: "Token" }),
1317
+ /* @__PURE__ */ jsx("div", { style: styles.selectorValue, children: payment.selectedToken?.symbol || "Select" })
1318
+ ] })
1319
+ ]
1320
+ }
1321
+ ),
1322
+ /* @__PURE__ */ jsx(ChevronIcon, {})
1323
+ ]
1324
+ }
1325
+ ),
1326
+ tokenDropdownOpen && /* @__PURE__ */ jsx("div", { style: styles.dropdown, children: payment.tokens.map((token) => /* @__PURE__ */ jsxs(
1327
+ "div",
1328
+ {
1329
+ style: styles.dropdownItem,
1330
+ onClick: () => {
1331
+ payment.setSelectedToken(token);
1332
+ setTokenDropdownOpen(false);
1333
+ },
1334
+ onMouseEnter: (e) => {
1335
+ e.currentTarget.style.background = "rgba(255,255,255,0.1)";
1336
+ },
1337
+ onMouseLeave: (e) => {
1338
+ e.currentTarget.style.background = "transparent";
1339
+ },
1340
+ children: [
1341
+ /* @__PURE__ */ jsx(
1342
+ "img",
1343
+ {
1344
+ src: token.icon,
1345
+ alt: "",
1346
+ style: {
1347
+ width: "24px",
1348
+ height: "24px",
1349
+ borderRadius: "50%"
1350
+ }
1351
+ }
1352
+ ),
1353
+ /* @__PURE__ */ jsx(
1354
+ "span",
1355
+ {
1356
+ style: {
1357
+ color: "white",
1358
+ fontSize: "14px"
1359
+ },
1360
+ children: token.symbol
1361
+ }
1362
+ )
1363
+ ]
1364
+ },
1365
+ token.assetId
1366
+ )) })
1367
+ ] })
1368
+ ] }),
1369
+ /* @__PURE__ */ jsx(
1370
+ "input",
1371
+ {
1372
+ type: "text",
1373
+ inputMode: "decimal",
1374
+ placeholder: "0.00",
1375
+ value: payment.amount,
1376
+ onChange: (e) => payment.setAmount(e.target.value),
1377
+ style: styles.amountInput
1378
+ }
1379
+ ),
1380
+ /* @__PURE__ */ jsxs("div", { style: styles.details, children: [
1381
+ payment.amount && /* @__PURE__ */ jsxs("div", { style: styles.detailRow, children: [
1382
+ /* @__PURE__ */ jsx("span", { children: "You receive" }),
1383
+ payment.isLoadingPreview ? /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "4px" }, children: [
1384
+ /* @__PURE__ */ jsx("div", { style: styles.loadingDot }),
1385
+ /* @__PURE__ */ jsx("div", { style: { ...styles.loadingDot, animationDelay: "0.2s" } }),
1386
+ /* @__PURE__ */ jsx("div", { style: { ...styles.loadingDot, animationDelay: "0.4s" } })
1387
+ ] }) : payment.previewQuote ? /* @__PURE__ */ jsxs("span", { style: styles.detailValue, children: [
1388
+ "~",
1389
+ payment.previewQuote.amountOutFormatted,
1390
+ " ",
1391
+ payment.destinationToken.symbol
1392
+ ] }) : /* @__PURE__ */ jsx("span", { style: { color: "rgba(255,255,255,0.3)" }, children: "Enter amount..." })
1393
+ ] }),
1394
+ /* @__PURE__ */ jsxs("div", { style: styles.detailRow, children: [
1395
+ /* @__PURE__ */ jsx("span", { children: "Destination" }),
1396
+ /* @__PURE__ */ jsxs("span", { style: styles.detailValue, children: [
1397
+ payment.destinationToken.symbol,
1398
+ " on Sui"
1399
+ ] })
1400
+ ] })
1401
+ ] }),
1402
+ /* @__PURE__ */ jsx(
1403
+ "button",
1404
+ {
1405
+ style: {
1406
+ ...styles.button,
1407
+ ...!canSubmit || isProcessing ? styles.buttonDisabled : {}
1408
+ },
1409
+ disabled: !canSubmit || isProcessing,
1410
+ onClick: () => payment.fetchQuote(),
1411
+ children: /* @__PURE__ */ jsx("div", { style: styles.buttonInner, children: isProcessing ? /* @__PURE__ */ jsxs(Fragment, { children: [
1412
+ /* @__PURE__ */ jsx(SpinnerIcon, {}),
1413
+ " Processing..."
1414
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1415
+ "Confirm Payment",
1416
+ /* @__PURE__ */ jsx(ArrowIcon, {})
1417
+ ] }) })
1418
+ }
1419
+ )
1420
+ ] })
1421
+ ] }),
1422
+ /* @__PURE__ */ jsx(
1423
+ "p",
1424
+ {
1425
+ style: {
1426
+ textAlign: "center",
1427
+ fontSize: "10px",
1428
+ color: "rgba(255,255,255,0.3)",
1429
+ marginTop: "16px"
1430
+ },
1431
+ children: "Powered by Uniport \u2022 NEAR Intents"
1432
+ }
1433
+ )
1434
+ ] }) });
1435
+ }
1436
+ function CloseIcon() {
1437
+ return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
1438
+ "path",
1439
+ {
1440
+ d: "M18 6L6 18M6 6L18 18",
1441
+ stroke: "currentColor",
1442
+ strokeWidth: "2",
1443
+ strokeLinecap: "round"
1444
+ }
1445
+ ) });
1446
+ }
1447
+ function CardIcon() {
1448
+ return /* @__PURE__ */ jsx(
1449
+ "svg",
1450
+ {
1451
+ width: "24",
1452
+ height: "24",
1453
+ viewBox: "0 0 24 24",
1454
+ fill: "none",
1455
+ stroke: "rgba(255,255,255,0.9)",
1456
+ strokeWidth: "1.5",
1457
+ children: /* @__PURE__ */ 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" })
1458
+ }
1459
+ );
1460
+ }
1461
+ function GlobeIcon() {
1462
+ return /* @__PURE__ */ jsxs(
1463
+ "svg",
1464
+ {
1465
+ width: "18",
1466
+ height: "18",
1467
+ viewBox: "0 0 24 24",
1468
+ fill: "none",
1469
+ stroke: "#818CF8",
1470
+ strokeWidth: "1.5",
1471
+ children: [
1472
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
1473
+ /* @__PURE__ */ 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" })
1474
+ ]
1475
+ }
1476
+ );
1477
+ }
1478
+ function DollarIcon() {
1479
+ return /* @__PURE__ */ jsxs(
1480
+ "svg",
1481
+ {
1482
+ width: "18",
1483
+ height: "18",
1484
+ viewBox: "0 0 24 24",
1485
+ fill: "none",
1486
+ stroke: "#22D3EE",
1487
+ strokeWidth: "1.5",
1488
+ children: [
1489
+ /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
1490
+ /* @__PURE__ */ 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" })
1491
+ ]
1492
+ }
1493
+ );
1494
+ }
1495
+ function ChevronIcon() {
1496
+ return /* @__PURE__ */ jsx(
1497
+ "svg",
1498
+ {
1499
+ width: "16",
1500
+ height: "16",
1501
+ viewBox: "0 0 24 24",
1502
+ fill: "none",
1503
+ stroke: "rgba(255,255,255,0.4)",
1504
+ strokeWidth: "2",
1505
+ children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6" })
1506
+ }
1507
+ );
1508
+ }
1509
+ function CheckSmallIcon() {
1510
+ return /* @__PURE__ */ jsx(
1511
+ "svg",
1512
+ {
1513
+ width: "16",
1514
+ height: "16",
1515
+ viewBox: "0 0 24 24",
1516
+ fill: "none",
1517
+ stroke: "#10B981",
1518
+ strokeWidth: "2",
1519
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6L9 17l-5-5" })
1520
+ }
1521
+ );
1522
+ }
1523
+ function CopyIcon() {
1524
+ return /* @__PURE__ */ jsxs(
1525
+ "svg",
1526
+ {
1527
+ width: "16",
1528
+ height: "16",
1529
+ viewBox: "0 0 24 24",
1530
+ fill: "none",
1531
+ stroke: "rgba(255,255,255,0.7)",
1532
+ strokeWidth: "2",
1533
+ children: [
1534
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1535
+ /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
1536
+ ]
1537
+ }
1538
+ );
1539
+ }
1540
+ function PulseIcon() {
1541
+ return /* @__PURE__ */ jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx(
1542
+ "circle",
1543
+ {
1544
+ cx: "4",
1545
+ cy: "4",
1546
+ r: "4",
1547
+ fill: "#818CF8",
1548
+ style: { animation: "uniport-pulse 1s ease infinite" }
1549
+ }
1550
+ ) });
1551
+ }
1552
+ function SpinnerIcon() {
1553
+ return /* @__PURE__ */ jsxs(
1554
+ "svg",
1555
+ {
1556
+ width: "16",
1557
+ height: "16",
1558
+ viewBox: "0 0 24 24",
1559
+ fill: "none",
1560
+ style: { animation: "spin 1s linear infinite" },
1561
+ children: [
1562
+ /* @__PURE__ */ jsx(
1563
+ "circle",
1564
+ {
1565
+ cx: "12",
1566
+ cy: "12",
1567
+ r: "10",
1568
+ stroke: "rgba(255,255,255,0.2)",
1569
+ strokeWidth: "3"
1570
+ }
1571
+ ),
1572
+ /* @__PURE__ */ jsx(
1573
+ "path",
1574
+ {
1575
+ d: "M12 2a10 10 0 019.95 9",
1576
+ stroke: "white",
1577
+ strokeWidth: "3",
1578
+ strokeLinecap: "round"
1579
+ }
1580
+ )
1581
+ ]
1582
+ }
1583
+ );
1584
+ }
1585
+ function ArrowIcon() {
1586
+ return /* @__PURE__ */ jsx(
1587
+ "svg",
1588
+ {
1589
+ width: "16",
1590
+ height: "16",
1591
+ viewBox: "0 0 24 24",
1592
+ fill: "none",
1593
+ stroke: "currentColor",
1594
+ strokeWidth: "2",
1595
+ children: /* @__PURE__ */ jsx("path", { d: "M5 12h14M12 5l7 7-7 7" })
1596
+ }
1597
+ );
1598
+ }
1599
+ var buttonStyles = {
1600
+ default: {
1601
+ display: "inline-flex",
1602
+ alignItems: "center",
1603
+ justifyContent: "center",
1604
+ gap: "8px",
1605
+ padding: "12px 24px",
1606
+ fontSize: "14px",
1607
+ fontWeight: 500,
1608
+ color: "white",
1609
+ background: "linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%)",
1610
+ border: "none",
1611
+ borderRadius: "12px",
1612
+ cursor: "pointer",
1613
+ transition: "all 0.2s ease",
1614
+ boxShadow: "0 4px 14px rgba(79, 70, 229, 0.3)",
1615
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1616
+ },
1617
+ compact: {
1618
+ display: "inline-flex",
1619
+ alignItems: "center",
1620
+ justifyContent: "center",
1621
+ gap: "6px",
1622
+ padding: "8px 16px",
1623
+ fontSize: "13px",
1624
+ fontWeight: 500,
1625
+ color: "white",
1626
+ background: "linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%)",
1627
+ border: "none",
1628
+ borderRadius: "8px",
1629
+ cursor: "pointer",
1630
+ transition: "all 0.2s ease",
1631
+ boxShadow: "0 2px 8px rgba(79, 70, 229, 0.25)",
1632
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1633
+ },
1634
+ outline: {
1635
+ display: "inline-flex",
1636
+ alignItems: "center",
1637
+ justifyContent: "center",
1638
+ gap: "8px",
1639
+ padding: "12px 24px",
1640
+ fontSize: "14px",
1641
+ fontWeight: 500,
1642
+ color: "#4F46E5",
1643
+ background: "transparent",
1644
+ border: "2px solid #4F46E5",
1645
+ borderRadius: "12px",
1646
+ cursor: "pointer",
1647
+ transition: "all 0.2s ease",
1648
+ fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
1649
+ },
1650
+ disabled: {
1651
+ opacity: 0.5,
1652
+ cursor: "not-allowed"
1653
+ }
1654
+ };
1655
+ function UniportButton({
1656
+ recipient,
1657
+ refundAddress,
1658
+ destinationToken = "suiUSDC",
1659
+ amount,
1660
+ label = "Pay with Crypto",
1661
+ variant = "default",
1662
+ disabled = false,
1663
+ className,
1664
+ onSuccess,
1665
+ onError,
1666
+ onOpenChange
1667
+ }) {
1668
+ const [isOpen, setIsOpen] = useState(false);
1669
+ const handleOpen = () => {
1670
+ if (!disabled) {
1671
+ setIsOpen(true);
1672
+ onOpenChange?.(true);
1673
+ }
1674
+ };
1675
+ const handleClose = () => {
1676
+ setIsOpen(false);
1677
+ onOpenChange?.(false);
1678
+ };
1679
+ const style = {
1680
+ ...buttonStyles[variant],
1681
+ ...disabled ? buttonStyles.disabled : {}
1682
+ };
1683
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1684
+ /* @__PURE__ */ jsxs(
1685
+ "button",
1686
+ {
1687
+ type: "button",
1688
+ onClick: handleOpen,
1689
+ disabled,
1690
+ className,
1691
+ style,
1692
+ children: [
1693
+ /* @__PURE__ */ jsx(UniportIcon, {}),
1694
+ label
1695
+ ]
1696
+ }
1697
+ ),
1698
+ /* @__PURE__ */ jsx(
1699
+ UniportModal,
1700
+ {
1701
+ open: isOpen,
1702
+ onClose: handleClose,
1703
+ recipient,
1704
+ refundAddress,
1705
+ destinationToken,
1706
+ amount,
1707
+ onSuccess,
1708
+ onError
1709
+ }
1710
+ )
1711
+ ] });
1712
+ }
1713
+ function UniportIcon() {
1714
+ return /* @__PURE__ */ jsxs(
1715
+ "svg",
1716
+ {
1717
+ width: "18",
1718
+ height: "18",
1719
+ viewBox: "0 0 24 24",
1720
+ fill: "none",
1721
+ xmlns: "http://www.w3.org/2000/svg",
1722
+ children: [
1723
+ /* @__PURE__ */ jsx(
1724
+ "path",
1725
+ {
1726
+ d: "M12 2L2 7L12 12L22 7L12 2Z",
1727
+ stroke: "currentColor",
1728
+ strokeWidth: "2",
1729
+ strokeLinecap: "round",
1730
+ strokeLinejoin: "round"
1731
+ }
1732
+ ),
1733
+ /* @__PURE__ */ jsx(
1734
+ "path",
1735
+ {
1736
+ d: "M2 17L12 22L22 17",
1737
+ stroke: "currentColor",
1738
+ strokeWidth: "2",
1739
+ strokeLinecap: "round",
1740
+ strokeLinejoin: "round"
1741
+ }
1742
+ ),
1743
+ /* @__PURE__ */ jsx(
1744
+ "path",
1745
+ {
1746
+ d: "M2 12L12 17L22 12",
1747
+ stroke: "currentColor",
1748
+ strokeWidth: "2",
1749
+ strokeLinecap: "round",
1750
+ strokeLinejoin: "round"
1751
+ }
1752
+ )
1753
+ ]
1754
+ }
1755
+ );
1756
+ }
1757
+
1758
+ export { ALL_TOKENS, CHAINS, CHAIN_ICONS, TOKEN_ICONS, UniportButton, UniportModal, aptosAPT, arbitrumARB, arbitrumETH, arbitrumGMX, arbitrumUSDC, arbitrumUSDT, avalancheAVAX, avalancheUSDC, avalancheUSDT, baseBRETT, baseCbBTC, baseETH, baseUSDC, berachainBERA, bitcoinBTC, bitcoinCashBCH, bscBNB, bscUSDC, bscUSDT, cardanoADA, dogecoinDOGE, ethereumAAVE, ethereumDAI, ethereumETH, ethereumLINK, ethereumPEPE, ethereumSAFE, ethereumSHIB, ethereumTURBO, ethereumUNI, ethereumUSDC, ethereumUSDT, ethereumWBTC, fromSmallestUnits, generateDeadline, getConfig, getExecutionStatus, getQuote, getSuiDestinationTokens, getSupportedChains, getToken, getTokenByAssetId, getTokensByChain, initUniport, isInitialized, litecoinLTC, nearNEAR, nearUSDC, nearUSDT, optimismETH, optimismOP, optimismUSDC, optimismUSDT, pollExecutionStatus, polygonPOL, polygonUSDC, polygonUSDT, rippleXRP, solanaMELANIA, solanaSOL, solanaTRUMP, solanaUSDC, solanaUSDT, solanaWIF, starknetSTRK, submitDepositTx, suiSUI, suiUSDC, toSmallestUnits, tonTON, tonUSDT, tronTRX, tronUSDT, useUniportPayment, zcashZEC };
1759
+ //# sourceMappingURL=index.js.map
1760
+ //# sourceMappingURL=index.js.map