uniport-sdk 0.0.7 → 0.0.9
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/README.md +38 -16
- package/dist/components/index.cjs +238 -79
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +238 -79
- package/dist/components/index.js.map +1 -1
- package/dist/core/index.cjs +177 -23
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +80 -13
- package/dist/core/index.d.ts +80 -13
- package/dist/core/index.js +154 -22
- package/dist/core/index.js.map +1 -1
- package/dist/{index-Dg_m2bK3.d.cts → index-B6_1AJAS.d.cts} +1 -1
- package/dist/{index-Dg_m2bK3.d.ts → index-B6_1AJAS.d.ts} +1 -1
- package/dist/index.cjs +256 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +233 -80
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/components/index.js
CHANGED
|
@@ -10,16 +10,22 @@ var TOKEN_ICONS = {
|
|
|
10
10
|
// Stablecoins
|
|
11
11
|
USDC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
|
|
12
12
|
USDT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
|
|
13
|
-
DAI: "https://
|
|
13
|
+
DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png?1696509996",
|
|
14
|
+
USDT0: "https://coin-images.coingecko.com/coins/images/53705/large/usdt0.jpg?1737086183",
|
|
15
|
+
USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png?1730484111",
|
|
16
|
+
xDAI: "https://coin-images.coingecko.com/coins/images/11062/large/Identity-Primary-DarkBG.png?1696511004",
|
|
17
|
+
EURe: "https://coin-images.coingecko.com/coins/images/54303/large/eure.jpg?1739167959",
|
|
14
18
|
// Major tokens
|
|
15
19
|
ETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
|
|
16
20
|
WETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
|
|
17
21
|
BTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png",
|
|
18
22
|
WBTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",
|
|
23
|
+
cbBTC: "https://coin-images.coingecko.com/coins/images/40143/large/cbbtc.webp?1726136727",
|
|
19
24
|
// L1s & L2s
|
|
20
25
|
SUI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
|
|
21
26
|
SOL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",
|
|
22
27
|
NEAR: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
|
|
28
|
+
wNEAR: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
|
|
23
29
|
ARB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png",
|
|
24
30
|
OP: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/info/logo.png",
|
|
25
31
|
POL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png",
|
|
@@ -33,23 +39,30 @@ var TOKEN_ICONS = {
|
|
|
33
39
|
LTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
|
|
34
40
|
BCH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
|
|
35
41
|
TON: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ton/info/logo.png",
|
|
42
|
+
GRAM: "https://coin-images.coingecko.com/coins/images/17980/large/Gram_Circular_Badge.png?1781524778",
|
|
36
43
|
TRX: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png",
|
|
37
44
|
XLM: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png",
|
|
38
45
|
APT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
|
|
46
|
+
DASH: "https://coin-images.coingecko.com/coins/images/19/large/dash-logo.png?1696501423",
|
|
47
|
+
XPL: "https://coin-images.coingecko.com/coins/images/66489/large/Plasma-symbol-green-1.png?1755142558",
|
|
48
|
+
ADI: "https://coin-images.coingecko.com/coins/images/68846/large/ADI_Token-min.png?1765296433",
|
|
39
49
|
// DeFi & Others
|
|
40
|
-
AAVE: "https://
|
|
50
|
+
AAVE: "https://coin-images.coingecko.com/coins/images/12645/large/aave-token-round.png?1720472354",
|
|
51
|
+
GMX: "https://coin-images.coingecko.com/coins/images/18323/large/arbit.png?1696517814",
|
|
52
|
+
SAFE: "https://coin-images.coingecko.com/coins/images/27032/large/Artboard_1_copy_8circle-1.png?1696526084",
|
|
53
|
+
COW: "https://coin-images.coingecko.com/coins/images/24384/large/CoW-token_logo.png?1719524382",
|
|
41
54
|
UNI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/logo.png",
|
|
42
55
|
LINK: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x514910771AF9Ca656af840dff83E8264EcF986CA/logo.png",
|
|
43
56
|
SHIB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE/logo.png",
|
|
44
57
|
PEPE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6982508145454Ce325dDbE47a25d4ec3d2311933/logo.png",
|
|
45
58
|
// Ecosystem tokens
|
|
46
59
|
STRK: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
|
|
47
|
-
BERA: "https://
|
|
48
|
-
GNO: "https://
|
|
49
|
-
MON: "https://
|
|
60
|
+
BERA: "https://coin-images.coingecko.com/coins/images/25235/large/BERA.png?1738822008",
|
|
61
|
+
GNO: "https://coin-images.coingecko.com/coins/images/662/large/logo_square_simple_300px.png?1696501854",
|
|
62
|
+
MON: "https://coin-images.coingecko.com/coins/images/38927/large/mon.png?1766029057",
|
|
50
63
|
ZEC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
|
|
51
64
|
// Meme coins
|
|
52
|
-
|
|
65
|
+
CASHCAT: "https://coin-images.coingecko.com/coins/images/102174280/large/cashcat-logo.jpg?1782922765",
|
|
53
66
|
WIF: "https://s2.coinmarketcap.com/static/img/coins/64x64/28752.png",
|
|
54
67
|
BRETT: "https://s2.coinmarketcap.com/static/img/coins/64x64/29743.png",
|
|
55
68
|
TURBO: "https://s2.coinmarketcap.com/static/img/coins/64x64/24911.png",
|
|
@@ -75,14 +88,20 @@ var CHAIN_ICONS = {
|
|
|
75
88
|
aptos: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
|
|
76
89
|
gnosis: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png",
|
|
77
90
|
starknet: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
|
|
78
|
-
bera: "https://
|
|
79
|
-
monad: "https://
|
|
91
|
+
bera: "https://coin-images.coingecko.com/coins/images/25235/large/BERA.png?1738822008",
|
|
92
|
+
monad: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/monad/info/logo.png",
|
|
80
93
|
doge: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",
|
|
81
94
|
ltc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
|
|
82
95
|
bch: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
|
|
83
96
|
xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
|
|
84
97
|
zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
|
|
85
|
-
scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png"
|
|
98
|
+
scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png",
|
|
99
|
+
hypercore: "https://coin-images.coingecko.com/asset_platforms/images/243/large/hyperliquid.png?1713924434",
|
|
100
|
+
plasma: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/plasma/info/logo.png",
|
|
101
|
+
hood: "https://coin-images.coingecko.com/asset_platforms/images/102132299/large/robinhood.png?1782921203",
|
|
102
|
+
xlayer: "https://coin-images.coingecko.com/asset_platforms/images/238/large/x_logo.jpeg?1713243242",
|
|
103
|
+
dash: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/dash/info/logo.png",
|
|
104
|
+
adi: "https://coin-images.coingecko.com/asset_platforms/images/102132311/large/adi-chain.png?1788338099"
|
|
86
105
|
};
|
|
87
106
|
var EVM_CHAINS = [
|
|
88
107
|
"eth",
|
|
@@ -95,11 +114,18 @@ var EVM_CHAINS = [
|
|
|
95
114
|
"gnosis",
|
|
96
115
|
"bera",
|
|
97
116
|
"monad",
|
|
98
|
-
"scroll"
|
|
117
|
+
"scroll",
|
|
118
|
+
"plasma",
|
|
119
|
+
"hood",
|
|
120
|
+
"xlayer",
|
|
121
|
+
"adi"
|
|
99
122
|
];
|
|
100
123
|
function isEvmChain(chain) {
|
|
101
124
|
return EVM_CHAINS.includes(chain);
|
|
102
125
|
}
|
|
126
|
+
function usesEvmAddress(chain) {
|
|
127
|
+
return isEvmChain(chain) || chain === "hypercore";
|
|
128
|
+
}
|
|
103
129
|
var CHAINS_REQUIRING_MEMO = ["stellar"];
|
|
104
130
|
function needsMemoDeposit(chain) {
|
|
105
131
|
return CHAINS_REQUIRING_MEMO.includes(chain);
|
|
@@ -130,7 +156,13 @@ var EXPLORER_TX_URLS = {
|
|
|
130
156
|
bch: (h) => `https://blockchair.com/bitcoin-cash/transaction/${h}`,
|
|
131
157
|
xrp: (h) => `https://xrpscan.com/tx/${h}`,
|
|
132
158
|
zec: (h) => `https://blockchair.com/zcash/transaction/${h}`,
|
|
133
|
-
scroll: (h) => `https://scrollscan.com/tx/${h}
|
|
159
|
+
scroll: (h) => `https://scrollscan.com/tx/${h}`,
|
|
160
|
+
hypercore: (h) => `https://app.hyperliquid.xyz/explorer/tx/${h}`,
|
|
161
|
+
plasma: (h) => `https://plasmascan.to/tx/${h}`,
|
|
162
|
+
hood: (h) => `https://robinhoodchain.blockscout.com/tx/${h}`,
|
|
163
|
+
xlayer: (h) => `https://www.oklink.com/x-layer/tx/${h}`,
|
|
164
|
+
dash: (h) => `https://insight.dash.org/insight/tx/${h}`,
|
|
165
|
+
adi: (h) => `https://explorer.adifoundation.ai/tx/${h}`
|
|
134
166
|
};
|
|
135
167
|
function getExplorerTxUrl(chain, hash) {
|
|
136
168
|
return EXPLORER_TX_URLS[chain]?.(hash);
|
|
@@ -140,7 +172,7 @@ function createToken(chain, symbol, assetId, decimals, contractAddress, options)
|
|
|
140
172
|
const canonicalPrefix = TOKEN_NAME_PREFIXES[chain] || chain;
|
|
141
173
|
const legacyName = `${chain}${normalizedSymbol}`;
|
|
142
174
|
const name = options?.name || `${canonicalPrefix}${normalizedSymbol}`;
|
|
143
|
-
const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS.DEFAULT;
|
|
175
|
+
const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS[normalizedSymbol] || TOKEN_ICONS.DEFAULT;
|
|
144
176
|
const chainIcon = CHAIN_ICONS[chain];
|
|
145
177
|
const aliases = new Set(options?.aliases || []);
|
|
146
178
|
if (legacyName !== name) {
|
|
@@ -170,7 +202,9 @@ var TOKEN_NAME_PREFIXES = {
|
|
|
170
202
|
ltc: "litecoin",
|
|
171
203
|
bch: "bitcoinCash",
|
|
172
204
|
bera: "berachain",
|
|
173
|
-
zec: "zcash"
|
|
205
|
+
zec: "zcash",
|
|
206
|
+
hypercore: "hyperliquid",
|
|
207
|
+
hood: "robinhood"
|
|
174
208
|
};
|
|
175
209
|
var suiSUI = createToken("sui", "SUI", "nep141:sui.omft.near", 9);
|
|
176
210
|
var suiUSDC = createToken("sui", "USDC", "nep141:sui-c1b81ecaf27933252d31a963bc5e9458f13c18ce.omft.near", 6, "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC");
|
|
@@ -188,7 +222,10 @@ var ethereumTURBO = createToken("eth", "TURBO", "nep141:eth-0xa35923162c49cf95e6
|
|
|
188
222
|
var ethereumSAFE = createToken("eth", "SAFE", "nep141:eth-0x5afe3855358e112b5647b952709e6165e1c1eeee.omft.near", 18, "0x5afe3855358e112b5647b952709e6165e1c1eeee");
|
|
189
223
|
var arbitrumETH = createToken("arb", "ETH", "nep141:arb.omft.near", 18);
|
|
190
224
|
var arbitrumUSDC = createToken("arb", "USDC", "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near", 6, "0xaf88d065e77c8cc2239327c5edb3a432268e5831");
|
|
191
|
-
var arbitrumUSDT = createToken("arb", "
|
|
225
|
+
var arbitrumUSDT = createToken("arb", "USDT0", "nep141:arb-0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9.omft.near", 6, "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", {
|
|
226
|
+
name: "arbitrumUSDT",
|
|
227
|
+
aliases: ["arbUSDT", "arbitrumUSDT0"]
|
|
228
|
+
});
|
|
192
229
|
var arbitrumARB = createToken("arb", "ARB", "nep141:arb-0x912ce59144191c1204e64559fe8253a0e49e6548.omft.near", 18, "0x912ce59144191c1204e64559fe8253a0e49e6548");
|
|
193
230
|
var arbitrumGMX = createToken("arb", "GMX", "nep141:arb-0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a.omft.near", 18, "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a");
|
|
194
231
|
var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
|
|
@@ -204,9 +241,7 @@ var optimismOP = createToken("op", "OP", "nep245:v2_1.omni.hot.tg:10_vLAiSt9KfUG
|
|
|
204
241
|
var solanaSOL = createToken("sol", "SOL", "nep141:sol.omft.near", 9);
|
|
205
242
|
var solanaUSDC = createToken("sol", "USDC", "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near", 6, "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
206
243
|
var solanaUSDT = createToken("sol", "USDT", "nep141:sol-c800a4bd850783ccb82c2b2c7e84175443606352.omft.near", 6, "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
|
|
207
|
-
var solanaTRUMP = createToken("sol", "TRUMP", "nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near", 6, "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN");
|
|
208
244
|
var solanaWIF = createToken("sol", "$WIF", "nep141:sol-b9c68f94ec8fd160137af8cdfe5e61cd68e2afba.omft.near", 6, "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm");
|
|
209
|
-
var solanaMELANIA = createToken("sol", "MELANIA", "nep141:sol-d600e625449a4d9380eaf5e3265e54c90d34e260.omft.near", 6, "FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P");
|
|
210
245
|
var bitcoinBTC = createToken("btc", "BTC", "nep141:btc.omft.near", 8);
|
|
211
246
|
var polygonPOL = createToken("pol", "POL", "nep245:v2_1.omni.hot.tg:137_11111111111111111111", 18);
|
|
212
247
|
var polygonUSDC = createToken("pol", "USDC", "nep245:v2_1.omni.hot.tg:137_qiStmoQJDQPTebaPjgx5VBxZv6L", 6, "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359");
|
|
@@ -217,7 +252,10 @@ var avalancheUSDT = createToken("avax", "USDT", "nep245:v2_1.omni.hot.tg:43114_3
|
|
|
217
252
|
var bscBNB = createToken("bsc", "BNB", "nep245:v2_1.omni.hot.tg:56_11111111111111111111", 18);
|
|
218
253
|
var bscUSDC = createToken("bsc", "USDC", "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r", 18, "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d");
|
|
219
254
|
var bscUSDT = createToken("bsc", "USDT", "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g", 18, "0x55d398326f99059ff775485246999027b3197955");
|
|
220
|
-
var tonTON = createToken("ton", "
|
|
255
|
+
var tonTON = createToken("ton", "GRAM", "nep245:v2_1.omni.hot.tg:1117_", 9, void 0, {
|
|
256
|
+
name: "tonTON",
|
|
257
|
+
aliases: ["tonGRAM"]
|
|
258
|
+
});
|
|
221
259
|
var tonUSDT = createToken("ton", "USDT", "nep245:v2_1.omni.hot.tg:1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR", 6, "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs");
|
|
222
260
|
var tronTRX = createToken("tron", "TRX", "nep141:tron.omft.near", 6);
|
|
223
261
|
var tronUSDT = createToken("tron", "USDT", "nep141:tron-d28a265909efecdcee7c5028585214ea0b96f015.omft.near", 6, "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
|
|
@@ -238,6 +276,30 @@ var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near",
|
|
|
238
276
|
});
|
|
239
277
|
var nearUSDC = createToken("near", "USDC", "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", 6, "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1");
|
|
240
278
|
var nearUSDT = createToken("near", "USDT", "nep141:usdt.tether-token.near", 6, "usdt.tether-token.near");
|
|
279
|
+
var gnosisUSDC = createToken("gnosis", "USDC", "nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near", 6, "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0");
|
|
280
|
+
var gnosisUSDT = createToken("gnosis", "USDT", "nep141:gnosis-0x4ecaba5870353805a9f068101a40e0f32ed605c6.omft.near", 6, "0x4ecaba5870353805a9f068101a40e0f32ed605c6");
|
|
281
|
+
var gnosisXDAI = createToken("gnosis", "xDAI", "nep141:gnosis.omft.near", 18, void 0, { name: "gnosisXDAI" });
|
|
282
|
+
var gnosisEURe = createToken("gnosis", "EURe", "nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near", 18, "0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430");
|
|
283
|
+
var gnosisGNO = createToken("gnosis", "GNO", "nep141:gnosis-0x9c58bacc331c9aa871afd802db6379a98e80cedb.omft.near", 18, "0x9c58bacc331c9aa871afd802db6379a98e80cedb");
|
|
284
|
+
var gnosisCOW = createToken("gnosis", "COW", "nep141:gnosis-0x177127622c4a00f3d409b75571e12cb3c8973d3c.omft.near", 18, "0x177127622c4a00f3d409b75571e12cb3c8973d3c");
|
|
285
|
+
var gnosisWETH = createToken("gnosis", "WETH", "nep141:gnosis-0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1.omft.near", 18, "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1");
|
|
286
|
+
var hyperliquidUSDC = createToken("hypercore", "USDC", "1cs_v1:hypercore:hip1:0x6d1e7cde53ba9467b783cb7c530ce054", 8, "0x6d1e7cde53ba9467b783cb7c530ce054");
|
|
287
|
+
var hyperliquidNEAR = createToken("hypercore", "wNEAR", "1cs_v1:hypercore:hip1:0x20b8c9d2f022ffd2aea4f7962b7b1d8b", 8, "0x20b8c9d2f022ffd2aea4f7962b7b1d8b", {
|
|
288
|
+
name: "hyperliquidNEAR",
|
|
289
|
+
aliases: ["hyperliquidwNEAR"]
|
|
290
|
+
});
|
|
291
|
+
var plasmaUSDT0 = createToken("plasma", "USDT0", "nep141:plasma-0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb.omft.near", 6, "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb");
|
|
292
|
+
var plasmaXPL = createToken("plasma", "XPL", "nep141:plasma.omft.near", 18);
|
|
293
|
+
var monadMON = createToken("monad", "MON", "nep245:v2_1.omni.hot.tg:143_11111111111111111111", 18);
|
|
294
|
+
var monadUSDC = createToken("monad", "USDC", "nep245:v2_1.omni.hot.tg:143_2dmLwYWkCQKyTjeUPAsGJuiVLbFx", 6, "0x754704bc059f8c67012fed69bc8a327a5aafb603");
|
|
295
|
+
var monadUSDT0 = createToken("monad", "USDT0", "nep245:v2_1.omni.hot.tg:143_4EJiJxSALvGoTZbnc8K7Ft9533et", 6, "0xe7cd86e13ac4309349f30b3435a9d337750fc82d");
|
|
296
|
+
var robinhoodETH = createToken("hood", "ETH", "nep141:hood.omft.near", 18);
|
|
297
|
+
var robinhoodUSDG = createToken("hood", "USDG", "nep141:hood-0x5fc5360d0400a0fd4f2af552add042d716f1d168.omft.near", 6, "0x5fc5360d0400a0fd4f2af552add042d716f1d168");
|
|
298
|
+
var robinhoodCASHCAT = createToken("hood", "CASHCAT", "nep141:hood-0x020bfc650a365f8bb26819deaabf3e21291018b4.omft.near", 18, "0x020bfc650a365f8bb26819deaabf3e21291018b4");
|
|
299
|
+
var xlayerUSDC = createToken("xlayer", "USDC", "nep245:v2_1.omni.hot.tg:196_2dK9kLNR7Ekq7su8FxNGiUW3djTw", 6, "0x74b7f16337b8972027f6196a17a631ac6de26d22");
|
|
300
|
+
var xlayerUSDT0 = createToken("xlayer", "USDT0", "nep245:v2_1.omni.hot.tg:196_2fezDCvVYRsG8wrK6deJ2VRPiAS1", 6, "0x779ded0c9e1022225f8e0630b35a9b54be713736");
|
|
301
|
+
var dashDASH = createToken("dash", "DASH", "nep141:dash.omft.near", 8);
|
|
302
|
+
var adiADI = createToken("adi", "ADI", "nep245:v2_1.omni.hot.tg:36900_11111111111111111111", 18);
|
|
241
303
|
var CHAINS = {
|
|
242
304
|
stellar: {
|
|
243
305
|
id: "stellar",
|
|
@@ -279,7 +341,7 @@ var CHAINS = {
|
|
|
279
341
|
id: "sol",
|
|
280
342
|
name: "Solana",
|
|
281
343
|
icon: CHAIN_ICONS.sol,
|
|
282
|
-
tokens: [solanaSOL, solanaUSDC, solanaUSDT,
|
|
344
|
+
tokens: [solanaSOL, solanaUSDC, solanaUSDT, solanaWIF]
|
|
283
345
|
},
|
|
284
346
|
btc: {
|
|
285
347
|
id: "btc",
|
|
@@ -381,19 +443,55 @@ var CHAINS = {
|
|
|
381
443
|
id: "gnosis",
|
|
382
444
|
name: "Gnosis",
|
|
383
445
|
icon: CHAIN_ICONS.gnosis,
|
|
384
|
-
tokens: []
|
|
446
|
+
tokens: [gnosisUSDC, gnosisUSDT, gnosisXDAI, gnosisEURe, gnosisGNO, gnosisCOW, gnosisWETH]
|
|
385
447
|
},
|
|
386
448
|
monad: {
|
|
387
449
|
id: "monad",
|
|
388
450
|
name: "Monad",
|
|
389
451
|
icon: CHAIN_ICONS.monad,
|
|
390
|
-
tokens: []
|
|
452
|
+
tokens: [monadMON, monadUSDC, monadUSDT0]
|
|
391
453
|
},
|
|
392
454
|
scroll: {
|
|
393
455
|
id: "scroll",
|
|
394
456
|
name: "Scroll",
|
|
395
457
|
icon: CHAIN_ICONS.scroll,
|
|
396
458
|
tokens: [scrollETH, scrollUSDT]
|
|
459
|
+
},
|
|
460
|
+
hypercore: {
|
|
461
|
+
id: "hypercore",
|
|
462
|
+
name: "Hyperliquid",
|
|
463
|
+
icon: CHAIN_ICONS.hypercore,
|
|
464
|
+
tokens: [hyperliquidUSDC, hyperliquidNEAR]
|
|
465
|
+
},
|
|
466
|
+
plasma: {
|
|
467
|
+
id: "plasma",
|
|
468
|
+
name: "Plasma",
|
|
469
|
+
icon: CHAIN_ICONS.plasma,
|
|
470
|
+
tokens: [plasmaUSDT0, plasmaXPL]
|
|
471
|
+
},
|
|
472
|
+
hood: {
|
|
473
|
+
id: "hood",
|
|
474
|
+
name: "Robinhood Chain",
|
|
475
|
+
icon: CHAIN_ICONS.hood,
|
|
476
|
+
tokens: [robinhoodETH, robinhoodUSDG, robinhoodCASHCAT]
|
|
477
|
+
},
|
|
478
|
+
xlayer: {
|
|
479
|
+
id: "xlayer",
|
|
480
|
+
name: "X Layer",
|
|
481
|
+
icon: CHAIN_ICONS.xlayer,
|
|
482
|
+
tokens: [xlayerUSDC, xlayerUSDT0]
|
|
483
|
+
},
|
|
484
|
+
dash: {
|
|
485
|
+
id: "dash",
|
|
486
|
+
name: "Dash",
|
|
487
|
+
icon: CHAIN_ICONS.dash,
|
|
488
|
+
tokens: [dashDASH]
|
|
489
|
+
},
|
|
490
|
+
adi: {
|
|
491
|
+
id: "adi",
|
|
492
|
+
name: "ADI Chain",
|
|
493
|
+
icon: CHAIN_ICONS.adi,
|
|
494
|
+
tokens: [adiADI]
|
|
397
495
|
}
|
|
398
496
|
};
|
|
399
497
|
var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
|
|
@@ -483,6 +581,29 @@ function toSmallestUnits(amount, decimals) {
|
|
|
483
581
|
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
484
582
|
return `${whole}${paddedFraction}`.replace(/^0+/, "") || "0";
|
|
485
583
|
}
|
|
584
|
+
function fromSmallestUnits(amount, decimals) {
|
|
585
|
+
if (decimals === 0) return amount;
|
|
586
|
+
const padded = amount.padStart(decimals + 1, "0");
|
|
587
|
+
const whole = padded.slice(0, -decimals) || "0";
|
|
588
|
+
const fraction = padded.slice(-decimals).replace(/0+$/, "");
|
|
589
|
+
return fraction ? `${whole}.${fraction}` : whole;
|
|
590
|
+
}
|
|
591
|
+
var MAX_EXACT_OUTPUT_ROUNDING_BPS = 25;
|
|
592
|
+
function roundUpInputAmount(amount, decimals, maxIncreaseBps = MAX_EXACT_OUTPUT_ROUNDING_BPS) {
|
|
593
|
+
if (!/^[1-9]\d*$/.test(amount) || !Number.isInteger(decimals) || decimals < 0 || !Number.isInteger(maxIncreaseBps) || maxIncreaseBps < 0) {
|
|
594
|
+
return amount;
|
|
595
|
+
}
|
|
596
|
+
const value = BigInt(amount);
|
|
597
|
+
const maxBps = BigInt(maxIncreaseBps);
|
|
598
|
+
for (let displayDecimals = 0; displayDecimals <= decimals; displayDecimals++) {
|
|
599
|
+
const unit = 10n ** BigInt(decimals - displayDecimals);
|
|
600
|
+
const rounded = (value + unit - 1n) / unit * unit;
|
|
601
|
+
if ((rounded - value) * 10000n <= value * maxBps) {
|
|
602
|
+
return rounded.toString();
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
return amount;
|
|
606
|
+
}
|
|
486
607
|
function generateDeadline(hoursFromNow = 1) {
|
|
487
608
|
const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
|
|
488
609
|
return deadline.toISOString();
|
|
@@ -513,7 +634,10 @@ async function getQuote(options) {
|
|
|
513
634
|
referral = "uniport",
|
|
514
635
|
signal
|
|
515
636
|
} = options;
|
|
516
|
-
const amountInSmallestUnits = toSmallestUnits(
|
|
637
|
+
const amountInSmallestUnits = toSmallestUnits(
|
|
638
|
+
amount,
|
|
639
|
+
swapType === "EXACT_OUTPUT" ? destinationToken.decimals : originToken.decimals
|
|
640
|
+
);
|
|
517
641
|
const { backendUrl, requestTimeoutMs } = getUniportConfig();
|
|
518
642
|
const { signal: requestSignal, cleanup, didTimeout } = createTimeoutSignal(
|
|
519
643
|
requestTimeoutMs,
|
|
@@ -563,10 +687,24 @@ async function getQuote(options) {
|
|
|
563
687
|
}
|
|
564
688
|
const data = await response.json();
|
|
565
689
|
const quote = data.quote;
|
|
690
|
+
const paymentAmountIn = swapType === "EXACT_OUTPUT" ? roundUpInputAmount(quote.amountIn, originToken.decimals) : quote.amountIn;
|
|
691
|
+
const roundingRemainder = (BigInt(paymentAmountIn) - BigInt(quote.amountIn)).toString();
|
|
566
692
|
return {
|
|
567
693
|
depositAddress: quote.depositAddress || "",
|
|
568
694
|
memo: quote.depositMemo,
|
|
569
695
|
amountIn: quote.amountIn,
|
|
696
|
+
amountInFormatted: quote.amountInFormatted || fromSmallestUnits(quote.amountIn, originToken.decimals),
|
|
697
|
+
minAmountIn: quote.minAmountIn,
|
|
698
|
+
paymentAmountIn,
|
|
699
|
+
paymentAmountInFormatted: fromSmallestUnits(
|
|
700
|
+
paymentAmountIn,
|
|
701
|
+
originToken.decimals
|
|
702
|
+
),
|
|
703
|
+
roundingRemainder,
|
|
704
|
+
roundingRemainderFormatted: fromSmallestUnits(
|
|
705
|
+
roundingRemainder,
|
|
706
|
+
originToken.decimals
|
|
707
|
+
),
|
|
570
708
|
amountOut: quote.amountOut,
|
|
571
709
|
amountOutFormatted: quote.amountOutFormatted,
|
|
572
710
|
amountOutUsd: quote.amountOutUsd,
|
|
@@ -650,6 +788,13 @@ function getUniportDefaultRefundAddress() {
|
|
|
650
788
|
}
|
|
651
789
|
|
|
652
790
|
// src/hooks/useUniportPayment.ts
|
|
791
|
+
function normalizeError(error, fallback) {
|
|
792
|
+
if (error instanceof Error) return error;
|
|
793
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
794
|
+
return new Error(error.message);
|
|
795
|
+
}
|
|
796
|
+
return new Error(fallback);
|
|
797
|
+
}
|
|
653
798
|
function useUniportPayment(options) {
|
|
654
799
|
const {
|
|
655
800
|
recipient,
|
|
@@ -659,6 +804,7 @@ function useUniportPayment(options) {
|
|
|
659
804
|
onSuccess,
|
|
660
805
|
onError
|
|
661
806
|
} = options;
|
|
807
|
+
const swapType = initialAmount === void 0 ? "EXACT_INPUT" : "EXACT_OUTPUT";
|
|
662
808
|
const destToken = getToken(destinationToken);
|
|
663
809
|
if (!destToken) {
|
|
664
810
|
throw new Error(
|
|
@@ -678,6 +824,7 @@ function useUniportPayment(options) {
|
|
|
678
824
|
const [refundAddress, setRefundAddressState] = useState(
|
|
679
825
|
initialRefundAddress ?? ""
|
|
680
826
|
);
|
|
827
|
+
useEffect(() => setAmountState(initialAmount ?? ""), [initialAmount]);
|
|
681
828
|
const [evmDefaultRefundAddress, setEvmDefaultRefundAddress] = useState(
|
|
682
829
|
UNIPORT_FALLBACK_REFUND_ADDRESS
|
|
683
830
|
);
|
|
@@ -690,7 +837,7 @@ function useUniportPayment(options) {
|
|
|
690
837
|
cancelled = true;
|
|
691
838
|
};
|
|
692
839
|
}, []);
|
|
693
|
-
const effectiveRefundAddress = refundAddress.trim() || (selectedChain &&
|
|
840
|
+
const effectiveRefundAddress = swapType === "EXACT_OUTPUT" ? "" : refundAddress.trim() || (selectedChain && usesEvmAddress(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
694
841
|
const pollingRef = useRef(null);
|
|
695
842
|
const lastStatusRef = useRef(null);
|
|
696
843
|
const previewDebounceRef = useRef(null);
|
|
@@ -708,7 +855,7 @@ function useUniportPayment(options) {
|
|
|
708
855
|
previewAbortRef.current.abort();
|
|
709
856
|
previewAbortRef.current = null;
|
|
710
857
|
}
|
|
711
|
-
if (!nextAmount || !nextSelectedToken || !nextRefundAddress) {
|
|
858
|
+
if (!nextAmount || !nextSelectedToken || swapType !== "EXACT_OUTPUT" && !nextRefundAddress) {
|
|
712
859
|
setIsLoadingPreview(false);
|
|
713
860
|
return;
|
|
714
861
|
}
|
|
@@ -723,6 +870,7 @@ function useUniportPayment(options) {
|
|
|
723
870
|
amount: nextAmount,
|
|
724
871
|
recipient,
|
|
725
872
|
refundTo: nextRefundAddress,
|
|
873
|
+
swapType,
|
|
726
874
|
dry: true,
|
|
727
875
|
signal: controller.signal
|
|
728
876
|
});
|
|
@@ -731,7 +879,10 @@ function useUniportPayment(options) {
|
|
|
731
879
|
if (err instanceof Error && err.name === "AbortError") {
|
|
732
880
|
return;
|
|
733
881
|
}
|
|
734
|
-
const previewFailure =
|
|
882
|
+
const previewFailure = normalizeError(
|
|
883
|
+
err,
|
|
884
|
+
"Failed to fetch estimate"
|
|
885
|
+
);
|
|
735
886
|
setPreviewError(previewFailure);
|
|
736
887
|
console.warn("Preview quote failed:", previewFailure);
|
|
737
888
|
} finally {
|
|
@@ -742,7 +893,7 @@ function useUniportPayment(options) {
|
|
|
742
893
|
}
|
|
743
894
|
}, 250);
|
|
744
895
|
},
|
|
745
|
-
[destToken, recipient]
|
|
896
|
+
[destToken, recipient, swapType]
|
|
746
897
|
);
|
|
747
898
|
const setAmount = useCallback(
|
|
748
899
|
(newAmount) => {
|
|
@@ -754,7 +905,7 @@ function useUniportPayment(options) {
|
|
|
754
905
|
const setRefundAddress = useCallback(
|
|
755
906
|
(newRefundAddress) => {
|
|
756
907
|
setRefundAddressState(newRefundAddress);
|
|
757
|
-
const nextEffective = newRefundAddress.trim() || (selectedChain &&
|
|
908
|
+
const nextEffective = newRefundAddress.trim() || (selectedChain && usesEvmAddress(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
758
909
|
schedulePreviewQuote(amount, nextEffective, selectedToken);
|
|
759
910
|
},
|
|
760
911
|
[amount, evmDefaultRefundAddress, schedulePreviewQuote, selectedChain, selectedToken]
|
|
@@ -764,7 +915,7 @@ function useUniportPayment(options) {
|
|
|
764
915
|
setSelectedChain(chain);
|
|
765
916
|
setSelectedToken(nextToken);
|
|
766
917
|
setPaymentState("selecting");
|
|
767
|
-
const nextEffective = refundAddress.trim() || (
|
|
918
|
+
const nextEffective = refundAddress.trim() || (usesEvmAddress(chain.id) ? evmDefaultRefundAddress : "");
|
|
768
919
|
schedulePreviewQuote(amount, nextEffective, nextToken);
|
|
769
920
|
}, [amount, evmDefaultRefundAddress, refundAddress, schedulePreviewQuote]);
|
|
770
921
|
const handleTokenSelect = useCallback((token) => {
|
|
@@ -773,7 +924,7 @@ function useUniportPayment(options) {
|
|
|
773
924
|
schedulePreviewQuote(amount, effectiveRefundAddress, token);
|
|
774
925
|
}, [amount, effectiveRefundAddress, schedulePreviewQuote]);
|
|
775
926
|
const fetchQuote = useCallback(async () => {
|
|
776
|
-
if (!selectedToken || !amount || !effectiveRefundAddress) {
|
|
927
|
+
if (!selectedToken || !amount || swapType !== "EXACT_OUTPUT" && !effectiveRefundAddress) {
|
|
777
928
|
setError(new Error("Missing required fields"));
|
|
778
929
|
return;
|
|
779
930
|
}
|
|
@@ -786,12 +937,13 @@ function useUniportPayment(options) {
|
|
|
786
937
|
amount,
|
|
787
938
|
recipient,
|
|
788
939
|
refundTo: effectiveRefundAddress,
|
|
940
|
+
swapType,
|
|
789
941
|
dry: false
|
|
790
942
|
});
|
|
791
943
|
setQuote(result);
|
|
792
944
|
setPaymentState("awaiting_deposit");
|
|
793
945
|
} catch (err) {
|
|
794
|
-
const error2 = err
|
|
946
|
+
const error2 = normalizeError(err, "Failed to get quote");
|
|
795
947
|
setError(error2);
|
|
796
948
|
setPaymentState("error");
|
|
797
949
|
onError?.(error2);
|
|
@@ -802,6 +954,7 @@ function useUniportPayment(options) {
|
|
|
802
954
|
effectiveRefundAddress,
|
|
803
955
|
recipient,
|
|
804
956
|
destToken,
|
|
957
|
+
swapType,
|
|
805
958
|
onError
|
|
806
959
|
]);
|
|
807
960
|
const stopPolling = useCallback(() => {
|
|
@@ -911,7 +1064,7 @@ function useUniportPayment(options) {
|
|
|
911
1064
|
amount,
|
|
912
1065
|
refundAddress,
|
|
913
1066
|
effectiveRefundAddress,
|
|
914
|
-
isUsingDefaultRefundAddress: !refundAddress.trim() && !!effectiveRefundAddress,
|
|
1067
|
+
isUsingDefaultRefundAddress: swapType !== "EXACT_OUTPUT" && !refundAddress.trim() && !!effectiveRefundAddress,
|
|
915
1068
|
destinationToken: destToken,
|
|
916
1069
|
chains,
|
|
917
1070
|
tokens,
|
|
@@ -1118,6 +1271,9 @@ function formatPreviewError(error) {
|
|
|
1118
1271
|
return "Could not fetch estimate. Please try again.";
|
|
1119
1272
|
}
|
|
1120
1273
|
const normalized = error.message.toLowerCase();
|
|
1274
|
+
if (normalized.includes("trustline")) {
|
|
1275
|
+
return "This Stellar recipient must enable the selected asset before it can receive funds.";
|
|
1276
|
+
}
|
|
1121
1277
|
if (normalized.includes("recipient is not valid")) {
|
|
1122
1278
|
return "Recipient address does not match the selected destination chain.";
|
|
1123
1279
|
}
|
|
@@ -1130,34 +1286,7 @@ function formatPreviewError(error) {
|
|
|
1130
1286
|
return "Could not fetch estimate. Check the details and try again.";
|
|
1131
1287
|
}
|
|
1132
1288
|
function formatChainLabel(chainId) {
|
|
1133
|
-
|
|
1134
|
-
sui: "Sui",
|
|
1135
|
-
eth: "Ethereum",
|
|
1136
|
-
sol: "Solana",
|
|
1137
|
-
arb: "Arbitrum",
|
|
1138
|
-
base: "Base",
|
|
1139
|
-
op: "Optimism",
|
|
1140
|
-
pol: "Polygon",
|
|
1141
|
-
avax: "Avalanche",
|
|
1142
|
-
bsc: "BNB Chain",
|
|
1143
|
-
near: "NEAR",
|
|
1144
|
-
btc: "Bitcoin",
|
|
1145
|
-
ton: "TON",
|
|
1146
|
-
tron: "Tron",
|
|
1147
|
-
stellar: "Stellar",
|
|
1148
|
-
cardano: "Cardano",
|
|
1149
|
-
xrp: "XRP Ledger",
|
|
1150
|
-
doge: "Dogecoin",
|
|
1151
|
-
ltc: "Litecoin",
|
|
1152
|
-
bch: "Bitcoin Cash",
|
|
1153
|
-
aptos: "Aptos",
|
|
1154
|
-
starknet: "Starknet",
|
|
1155
|
-
bera: "Berachain",
|
|
1156
|
-
zec: "Zcash",
|
|
1157
|
-
gnosis: "Gnosis",
|
|
1158
|
-
monad: "Monad"
|
|
1159
|
-
};
|
|
1160
|
-
return labels[chainId] || chainId.toUpperCase();
|
|
1289
|
+
return CHAINS[chainId]?.name ?? chainId.toUpperCase();
|
|
1161
1290
|
}
|
|
1162
1291
|
function UniportModal({
|
|
1163
1292
|
open,
|
|
@@ -1225,8 +1354,9 @@ function UniportModal({
|
|
|
1225
1354
|
const isSuccess = paymentState === "success";
|
|
1226
1355
|
const isError = paymentState === "error";
|
|
1227
1356
|
const isQuoting = paymentState === "quoting";
|
|
1228
|
-
const
|
|
1229
|
-
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
|
|
1357
|
+
const isExactOutput = initialAmount !== void 0;
|
|
1358
|
+
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && (isExactOutput || payment.effectiveRefundAddress));
|
|
1359
|
+
const canSubmit = !!(canPreviewEstimate && payment.previewQuote && !payment.previewError && !payment.isLoadingPreview);
|
|
1230
1360
|
const showBack = !isSuccess && !isError && (showQR || modalStep !== "chain");
|
|
1231
1361
|
const iconBtn = {
|
|
1232
1362
|
width: 36,
|
|
@@ -1416,7 +1546,7 @@ function UniportModal({
|
|
|
1416
1546
|
"\u2192 ",
|
|
1417
1547
|
payment.destinationToken.symbol,
|
|
1418
1548
|
" on ",
|
|
1419
|
-
payment.destinationToken.chain
|
|
1549
|
+
formatChainLabel(payment.destinationToken.chain)
|
|
1420
1550
|
] })
|
|
1421
1551
|
] })
|
|
1422
1552
|
] }),
|
|
@@ -1447,9 +1577,9 @@ function UniportModal({
|
|
|
1447
1577
|
autoFocus: true
|
|
1448
1578
|
}
|
|
1449
1579
|
),
|
|
1450
|
-
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: tok?.symbol })
|
|
1580
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: isExactOutput ? payment.destinationToken.symbol : tok?.symbol })
|
|
1451
1581
|
] }),
|
|
1452
|
-
/* @__PURE__ */ jsxs("div", { style: { marginBottom: "18px" }, children: [
|
|
1582
|
+
!isExactOutput && /* @__PURE__ */ jsxs("div", { style: { marginBottom: "18px" }, children: [
|
|
1453
1583
|
/* @__PURE__ */ jsxs(
|
|
1454
1584
|
"label",
|
|
1455
1585
|
{
|
|
@@ -1463,7 +1593,7 @@ function UniportModal({
|
|
|
1463
1593
|
children: [
|
|
1464
1594
|
"Refund address on ",
|
|
1465
1595
|
ch?.name || "the source chain",
|
|
1466
|
-
ch &&
|
|
1596
|
+
ch && usesEvmAddress(ch.id) && /* @__PURE__ */ jsx("span", { style: { fontWeight: 400, color: t.textMuted }, children: " (optional)" })
|
|
1467
1597
|
]
|
|
1468
1598
|
}
|
|
1469
1599
|
),
|
|
@@ -1473,7 +1603,7 @@ function UniportModal({
|
|
|
1473
1603
|
type: "text",
|
|
1474
1604
|
value: payment.refundAddress,
|
|
1475
1605
|
onChange: (e) => payment.setRefundAddress(e.target.value),
|
|
1476
|
-
placeholder: ch &&
|
|
1606
|
+
placeholder: ch && usesEvmAddress(ch.id) ? `Optional \u2014 defaults to ${UNIPORT_ENS_NAME}` : `Enter a ${ch?.name || "source chain"} refund address`,
|
|
1477
1607
|
spellCheck: false,
|
|
1478
1608
|
autoCapitalize: "off",
|
|
1479
1609
|
autoCorrect: "off",
|
|
@@ -1536,22 +1666,21 @@ function UniportModal({
|
|
|
1536
1666
|
animation: `uniport-pulse 1s ease infinite ${delay}s`
|
|
1537
1667
|
} }, i)),
|
|
1538
1668
|
canPreviewEstimate && !payment.isLoadingPreview && payment.previewQuote && /* @__PURE__ */ jsxs("span", { style: { fontSize: "15px", color: t.textSecondary }, children: [
|
|
1539
|
-
"You will receive",
|
|
1540
|
-
" ",
|
|
1669
|
+
isExactOutput ? "You will send " : "You will receive ",
|
|
1541
1670
|
/* @__PURE__ */ jsxs("strong", { style: { color: t.text }, children: [
|
|
1542
|
-
formatDisplayAmount(payment.previewQuote.amountOutFormatted),
|
|
1671
|
+
isExactOutput ? payment.previewQuote.paymentAmountInFormatted : formatDisplayAmount(payment.previewQuote.amountOutFormatted),
|
|
1543
1672
|
" ",
|
|
1544
|
-
payment.destinationToken.symbol
|
|
1673
|
+
isExactOutput ? tok?.symbol : payment.destinationToken.symbol
|
|
1545
1674
|
] }),
|
|
1546
1675
|
" ",
|
|
1547
1676
|
"on",
|
|
1548
1677
|
" ",
|
|
1549
|
-
/* @__PURE__ */ jsx("strong", { style: { color: t.text }, children: formatChainLabel(payment.destinationToken.chain) })
|
|
1678
|
+
/* @__PURE__ */ jsx("strong", { style: { color: t.text }, children: isExactOutput ? ch?.name : formatChainLabel(payment.destinationToken.chain) })
|
|
1550
1679
|
] }),
|
|
1551
1680
|
canPreviewEstimate && !payment.isLoadingPreview && payment.previewError && /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: t.error }, children: formatPreviewError(payment.previewError) }),
|
|
1552
1681
|
canPreviewEstimate && !payment.isLoadingPreview && !payment.previewQuote && !payment.previewError && /* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "Fetching estimate\u2026" })
|
|
1553
1682
|
] }),
|
|
1554
|
-
!!payment.amount && /* @__PURE__ */ jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1683
|
+
!!payment.amount && !isExactOutput && /* @__PURE__ */ jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1555
1684
|
/* @__PURE__ */ jsx(WarningTriangle, { color: t.warning }),
|
|
1556
1685
|
/* @__PURE__ */ jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
|
|
1557
1686
|
"You must send",
|
|
@@ -1568,6 +1697,34 @@ function UniportModal({
|
|
|
1568
1697
|
". Sending a different amount or asset may result in loss of funds."
|
|
1569
1698
|
] })
|
|
1570
1699
|
] }),
|
|
1700
|
+
isExactOutput && payment.previewQuote && /* @__PURE__ */ jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1701
|
+
/* @__PURE__ */ jsx(WarningTriangle, { color: t.warning }),
|
|
1702
|
+
/* @__PURE__ */ jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
|
|
1703
|
+
"To receive ",
|
|
1704
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
1705
|
+
"exactly ",
|
|
1706
|
+
payment.amount,
|
|
1707
|
+
" ",
|
|
1708
|
+
payment.destinationToken.symbol
|
|
1709
|
+
] }),
|
|
1710
|
+
", send ",
|
|
1711
|
+
/* @__PURE__ */ jsxs("strong", { children: [
|
|
1712
|
+
payment.previewQuote.paymentAmountInFormatted,
|
|
1713
|
+
" ",
|
|
1714
|
+
tok?.symbol
|
|
1715
|
+
] }),
|
|
1716
|
+
" on ",
|
|
1717
|
+
/* @__PURE__ */ jsx("strong", { children: ch?.name }),
|
|
1718
|
+
".",
|
|
1719
|
+
payment.previewQuote.roundingRemainder !== "0" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1720
|
+
" The rounded surplus is ",
|
|
1721
|
+
payment.previewQuote.roundingRemainderFormatted,
|
|
1722
|
+
" ",
|
|
1723
|
+
tok?.symbol,
|
|
1724
|
+
"."
|
|
1725
|
+
] })
|
|
1726
|
+
] })
|
|
1727
|
+
] }),
|
|
1571
1728
|
/* @__PURE__ */ jsx(
|
|
1572
1729
|
"button",
|
|
1573
1730
|
{
|
|
@@ -1580,7 +1737,7 @@ function UniportModal({
|
|
|
1580
1737
|
] }) : "Confirm Payment"
|
|
1581
1738
|
}
|
|
1582
1739
|
),
|
|
1583
|
-
!payment.effectiveRefundAddress && /* @__PURE__ */ jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
|
|
1740
|
+
!isExactOutput && !payment.effectiveRefundAddress && /* @__PURE__ */ jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
|
|
1584
1741
|
"Enter a refund address on ",
|
|
1585
1742
|
ch?.name || "the source chain",
|
|
1586
1743
|
" to continue."
|
|
@@ -1591,8 +1748,9 @@ function UniportModal({
|
|
|
1591
1748
|
const renderPaymentStep = () => {
|
|
1592
1749
|
const { quote } = payment;
|
|
1593
1750
|
const isProcessing = paymentState === "processing";
|
|
1751
|
+
const sendAmount = quote?.paymentAmountInFormatted || payment.amount;
|
|
1594
1752
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1595
|
-
renderHeader(`Send ${
|
|
1753
|
+
renderHeader(`Send ${sendAmount} ${payment.selectedToken?.symbol ?? ""} on ${payment.selectedChain?.name ?? ""}`),
|
|
1596
1754
|
/* @__PURE__ */ jsx("div", { style: { padding: "4px 20px 24px" }, children: quote && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1597
1755
|
/* @__PURE__ */ jsx("div", { style: {
|
|
1598
1756
|
background: "#ffffff",
|
|
@@ -1701,7 +1859,7 @@ function UniportModal({
|
|
|
1701
1859
|
"Only send",
|
|
1702
1860
|
" ",
|
|
1703
1861
|
/* @__PURE__ */ jsxs("strong", { children: [
|
|
1704
|
-
|
|
1862
|
+
sendAmount,
|
|
1705
1863
|
" ",
|
|
1706
1864
|
payment.selectedToken?.symbol
|
|
1707
1865
|
] }),
|
|
@@ -1722,7 +1880,7 @@ function UniportModal({
|
|
|
1722
1880
|
/* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "10px" }, children: [
|
|
1723
1881
|
/* @__PURE__ */ jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "You'll receive" }),
|
|
1724
1882
|
/* @__PURE__ */ jsxs("span", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
|
|
1725
|
-
"\u2248",
|
|
1883
|
+
isExactOutput ? "" : "\u2248",
|
|
1726
1884
|
formatDisplayAmount(quote.amountOutFormatted),
|
|
1727
1885
|
" ",
|
|
1728
1886
|
payment.destinationToken.symbol
|
|
@@ -1755,6 +1913,7 @@ function UniportModal({
|
|
|
1755
1913
|
] }) })
|
|
1756
1914
|
] });
|
|
1757
1915
|
};
|
|
1916
|
+
const txUrl = (reported, chain, hash) => reported?.startsWith("https://") ? reported : chain ? getExplorerTxUrl(chain, hash) : void 0;
|
|
1758
1917
|
const renderTxHash = (hash, url) => url ? /* @__PURE__ */ jsxs(
|
|
1759
1918
|
"a",
|
|
1760
1919
|
{
|
|
@@ -1812,11 +1971,11 @@ function UniportModal({
|
|
|
1812
1971
|
) }) }),
|
|
1813
1972
|
/* @__PURE__ */ jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: t.text, letterSpacing: "-0.02em" }, children: "Payment sent!" }),
|
|
1814
1973
|
/* @__PURE__ */ jsxs("p", { style: { margin: "0 0 24px", fontSize: "14px", color: t.textMuted, lineHeight: 1.6 }, children: [
|
|
1815
|
-
payment.amount,
|
|
1974
|
+
payment.quote?.paymentAmountInFormatted || payment.amount,
|
|
1816
1975
|
" ",
|
|
1817
1976
|
payment.selectedToken?.symbol,
|
|
1818
1977
|
" \u2192 ",
|
|
1819
|
-
"\u2248",
|
|
1978
|
+
isExactOutput ? "" : "\u2248",
|
|
1820
1979
|
formatDisplayAmount(payment.quote?.amountOutFormatted),
|
|
1821
1980
|
" ",
|
|
1822
1981
|
payment.destinationToken.symbol
|
|
@@ -1844,14 +2003,14 @@ function UniportModal({
|
|
|
1844
2003
|
"Source TX \xB7 ",
|
|
1845
2004
|
payment.selectedChain?.name
|
|
1846
2005
|
] }),
|
|
1847
|
-
renderTxHash(hash, payment.
|
|
2006
|
+
renderTxHash(hash, txUrl(payment.status?.originTxExplorerUrls?.[i], payment.selectedChain?.id, hash))
|
|
1848
2007
|
] }, `o${i}`)),
|
|
1849
2008
|
payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxs("div", { children: [
|
|
1850
2009
|
/* @__PURE__ */ jsxs("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: [
|
|
1851
2010
|
"Destination TX \xB7 ",
|
|
1852
2011
|
CHAINS[payment.destinationToken.chain].name
|
|
1853
2012
|
] }),
|
|
1854
|
-
renderTxHash(hash,
|
|
2013
|
+
renderTxHash(hash, txUrl(payment.status?.destinationTxExplorerUrls?.[i], payment.destinationToken.chain, hash))
|
|
1855
2014
|
] }, `d${i}`)),
|
|
1856
2015
|
!payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsx("p", { style: { color: t.textMuted, fontSize: "13px", margin: 0 }, children: "Loading transaction details\u2026" })
|
|
1857
2016
|
] }),
|