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
|
@@ -16,16 +16,22 @@ var TOKEN_ICONS = {
|
|
|
16
16
|
// Stablecoins
|
|
17
17
|
USDC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",
|
|
18
18
|
USDT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",
|
|
19
|
-
DAI: "https://
|
|
19
|
+
DAI: "https://coin-images.coingecko.com/coins/images/9956/large/Badge_Dai.png?1696509996",
|
|
20
|
+
USDT0: "https://coin-images.coingecko.com/coins/images/53705/large/usdt0.jpg?1737086183",
|
|
21
|
+
USDG: "https://coin-images.coingecko.com/coins/images/51281/large/GDN_USDG_Token_200x200.png?1730484111",
|
|
22
|
+
xDAI: "https://coin-images.coingecko.com/coins/images/11062/large/Identity-Primary-DarkBG.png?1696511004",
|
|
23
|
+
EURe: "https://coin-images.coingecko.com/coins/images/54303/large/eure.jpg?1739167959",
|
|
20
24
|
// Major tokens
|
|
21
25
|
ETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png",
|
|
22
26
|
WETH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
|
|
23
27
|
BTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoin/info/logo.png",
|
|
24
28
|
WBTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",
|
|
29
|
+
cbBTC: "https://coin-images.coingecko.com/coins/images/40143/large/cbbtc.webp?1726136727",
|
|
25
30
|
// L1s & L2s
|
|
26
31
|
SUI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/sui/info/logo.png",
|
|
27
32
|
SOL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/solana/info/logo.png",
|
|
28
33
|
NEAR: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
|
|
34
|
+
wNEAR: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/near/info/logo.png",
|
|
29
35
|
ARB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/info/logo.png",
|
|
30
36
|
OP: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/info/logo.png",
|
|
31
37
|
POL: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/info/logo.png",
|
|
@@ -39,23 +45,30 @@ var TOKEN_ICONS = {
|
|
|
39
45
|
LTC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
|
|
40
46
|
BCH: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
|
|
41
47
|
TON: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ton/info/logo.png",
|
|
48
|
+
GRAM: "https://coin-images.coingecko.com/coins/images/17980/large/Gram_Circular_Badge.png?1781524778",
|
|
42
49
|
TRX: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/tron/info/logo.png",
|
|
43
50
|
XLM: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/stellar/info/logo.png",
|
|
44
51
|
APT: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
|
|
52
|
+
DASH: "https://coin-images.coingecko.com/coins/images/19/large/dash-logo.png?1696501423",
|
|
53
|
+
XPL: "https://coin-images.coingecko.com/coins/images/66489/large/Plasma-symbol-green-1.png?1755142558",
|
|
54
|
+
ADI: "https://coin-images.coingecko.com/coins/images/68846/large/ADI_Token-min.png?1765296433",
|
|
45
55
|
// DeFi & Others
|
|
46
|
-
AAVE: "https://
|
|
56
|
+
AAVE: "https://coin-images.coingecko.com/coins/images/12645/large/aave-token-round.png?1720472354",
|
|
57
|
+
GMX: "https://coin-images.coingecko.com/coins/images/18323/large/arbit.png?1696517814",
|
|
58
|
+
SAFE: "https://coin-images.coingecko.com/coins/images/27032/large/Artboard_1_copy_8circle-1.png?1696526084",
|
|
59
|
+
COW: "https://coin-images.coingecko.com/coins/images/24384/large/CoW-token_logo.png?1719524382",
|
|
47
60
|
UNI: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984/logo.png",
|
|
48
61
|
LINK: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x514910771AF9Ca656af840dff83E8264EcF986CA/logo.png",
|
|
49
62
|
SHIB: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE/logo.png",
|
|
50
63
|
PEPE: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6982508145454Ce325dDbE47a25d4ec3d2311933/logo.png",
|
|
51
64
|
// Ecosystem tokens
|
|
52
65
|
STRK: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
|
|
53
|
-
BERA: "https://
|
|
54
|
-
GNO: "https://
|
|
55
|
-
MON: "https://
|
|
66
|
+
BERA: "https://coin-images.coingecko.com/coins/images/25235/large/BERA.png?1738822008",
|
|
67
|
+
GNO: "https://coin-images.coingecko.com/coins/images/662/large/logo_square_simple_300px.png?1696501854",
|
|
68
|
+
MON: "https://coin-images.coingecko.com/coins/images/38927/large/mon.png?1766029057",
|
|
56
69
|
ZEC: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
|
|
57
70
|
// Meme coins
|
|
58
|
-
|
|
71
|
+
CASHCAT: "https://coin-images.coingecko.com/coins/images/102174280/large/cashcat-logo.jpg?1782922765",
|
|
59
72
|
WIF: "https://s2.coinmarketcap.com/static/img/coins/64x64/28752.png",
|
|
60
73
|
BRETT: "https://s2.coinmarketcap.com/static/img/coins/64x64/29743.png",
|
|
61
74
|
TURBO: "https://s2.coinmarketcap.com/static/img/coins/64x64/24911.png",
|
|
@@ -81,14 +94,20 @@ var CHAIN_ICONS = {
|
|
|
81
94
|
aptos: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/aptos/info/logo.png",
|
|
82
95
|
gnosis: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/xdai/info/logo.png",
|
|
83
96
|
starknet: "https://coin-images.coingecko.com/coins/images/26433/large/starknet.png",
|
|
84
|
-
bera: "https://
|
|
85
|
-
monad: "https://
|
|
97
|
+
bera: "https://coin-images.coingecko.com/coins/images/25235/large/BERA.png?1738822008",
|
|
98
|
+
monad: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/monad/info/logo.png",
|
|
86
99
|
doge: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/doge/info/logo.png",
|
|
87
100
|
ltc: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/litecoin/info/logo.png",
|
|
88
101
|
bch: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/bitcoincash/info/logo.png",
|
|
89
102
|
xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
|
|
90
103
|
zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png",
|
|
91
|
-
scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png"
|
|
104
|
+
scroll: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/scroll/info/logo.png",
|
|
105
|
+
hypercore: "https://coin-images.coingecko.com/asset_platforms/images/243/large/hyperliquid.png?1713924434",
|
|
106
|
+
plasma: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/plasma/info/logo.png",
|
|
107
|
+
hood: "https://coin-images.coingecko.com/asset_platforms/images/102132299/large/robinhood.png?1782921203",
|
|
108
|
+
xlayer: "https://coin-images.coingecko.com/asset_platforms/images/238/large/x_logo.jpeg?1713243242",
|
|
109
|
+
dash: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/dash/info/logo.png",
|
|
110
|
+
adi: "https://coin-images.coingecko.com/asset_platforms/images/102132311/large/adi-chain.png?1788338099"
|
|
92
111
|
};
|
|
93
112
|
var EVM_CHAINS = [
|
|
94
113
|
"eth",
|
|
@@ -101,11 +120,18 @@ var EVM_CHAINS = [
|
|
|
101
120
|
"gnosis",
|
|
102
121
|
"bera",
|
|
103
122
|
"monad",
|
|
104
|
-
"scroll"
|
|
123
|
+
"scroll",
|
|
124
|
+
"plasma",
|
|
125
|
+
"hood",
|
|
126
|
+
"xlayer",
|
|
127
|
+
"adi"
|
|
105
128
|
];
|
|
106
129
|
function isEvmChain(chain) {
|
|
107
130
|
return EVM_CHAINS.includes(chain);
|
|
108
131
|
}
|
|
132
|
+
function usesEvmAddress(chain) {
|
|
133
|
+
return isEvmChain(chain) || chain === "hypercore";
|
|
134
|
+
}
|
|
109
135
|
var CHAINS_REQUIRING_MEMO = ["stellar"];
|
|
110
136
|
function needsMemoDeposit(chain) {
|
|
111
137
|
return CHAINS_REQUIRING_MEMO.includes(chain);
|
|
@@ -136,7 +162,13 @@ var EXPLORER_TX_URLS = {
|
|
|
136
162
|
bch: (h) => `https://blockchair.com/bitcoin-cash/transaction/${h}`,
|
|
137
163
|
xrp: (h) => `https://xrpscan.com/tx/${h}`,
|
|
138
164
|
zec: (h) => `https://blockchair.com/zcash/transaction/${h}`,
|
|
139
|
-
scroll: (h) => `https://scrollscan.com/tx/${h}
|
|
165
|
+
scroll: (h) => `https://scrollscan.com/tx/${h}`,
|
|
166
|
+
hypercore: (h) => `https://app.hyperliquid.xyz/explorer/tx/${h}`,
|
|
167
|
+
plasma: (h) => `https://plasmascan.to/tx/${h}`,
|
|
168
|
+
hood: (h) => `https://robinhoodchain.blockscout.com/tx/${h}`,
|
|
169
|
+
xlayer: (h) => `https://www.oklink.com/x-layer/tx/${h}`,
|
|
170
|
+
dash: (h) => `https://insight.dash.org/insight/tx/${h}`,
|
|
171
|
+
adi: (h) => `https://explorer.adifoundation.ai/tx/${h}`
|
|
140
172
|
};
|
|
141
173
|
function getExplorerTxUrl(chain, hash) {
|
|
142
174
|
return EXPLORER_TX_URLS[chain]?.(hash);
|
|
@@ -146,7 +178,7 @@ function createToken(chain, symbol, assetId, decimals, contractAddress, options)
|
|
|
146
178
|
const canonicalPrefix = TOKEN_NAME_PREFIXES[chain] || chain;
|
|
147
179
|
const legacyName = `${chain}${normalizedSymbol}`;
|
|
148
180
|
const name = options?.name || `${canonicalPrefix}${normalizedSymbol}`;
|
|
149
|
-
const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS.DEFAULT;
|
|
181
|
+
const icon = TOKEN_ICONS[symbol] || TOKEN_ICONS[normalizedSymbol] || TOKEN_ICONS.DEFAULT;
|
|
150
182
|
const chainIcon = CHAIN_ICONS[chain];
|
|
151
183
|
const aliases = new Set(options?.aliases || []);
|
|
152
184
|
if (legacyName !== name) {
|
|
@@ -176,7 +208,9 @@ var TOKEN_NAME_PREFIXES = {
|
|
|
176
208
|
ltc: "litecoin",
|
|
177
209
|
bch: "bitcoinCash",
|
|
178
210
|
bera: "berachain",
|
|
179
|
-
zec: "zcash"
|
|
211
|
+
zec: "zcash",
|
|
212
|
+
hypercore: "hyperliquid",
|
|
213
|
+
hood: "robinhood"
|
|
180
214
|
};
|
|
181
215
|
var suiSUI = createToken("sui", "SUI", "nep141:sui.omft.near", 9);
|
|
182
216
|
var suiUSDC = createToken("sui", "USDC", "nep141:sui-c1b81ecaf27933252d31a963bc5e9458f13c18ce.omft.near", 6, "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC");
|
|
@@ -194,7 +228,10 @@ var ethereumTURBO = createToken("eth", "TURBO", "nep141:eth-0xa35923162c49cf95e6
|
|
|
194
228
|
var ethereumSAFE = createToken("eth", "SAFE", "nep141:eth-0x5afe3855358e112b5647b952709e6165e1c1eeee.omft.near", 18, "0x5afe3855358e112b5647b952709e6165e1c1eeee");
|
|
195
229
|
var arbitrumETH = createToken("arb", "ETH", "nep141:arb.omft.near", 18);
|
|
196
230
|
var arbitrumUSDC = createToken("arb", "USDC", "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near", 6, "0xaf88d065e77c8cc2239327c5edb3a432268e5831");
|
|
197
|
-
var arbitrumUSDT = createToken("arb", "
|
|
231
|
+
var arbitrumUSDT = createToken("arb", "USDT0", "nep141:arb-0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9.omft.near", 6, "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", {
|
|
232
|
+
name: "arbitrumUSDT",
|
|
233
|
+
aliases: ["arbUSDT", "arbitrumUSDT0"]
|
|
234
|
+
});
|
|
198
235
|
var arbitrumARB = createToken("arb", "ARB", "nep141:arb-0x912ce59144191c1204e64559fe8253a0e49e6548.omft.near", 18, "0x912ce59144191c1204e64559fe8253a0e49e6548");
|
|
199
236
|
var arbitrumGMX = createToken("arb", "GMX", "nep141:arb-0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a.omft.near", 18, "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a");
|
|
200
237
|
var baseETH = createToken("base", "ETH", "nep141:base.omft.near", 18);
|
|
@@ -210,9 +247,7 @@ var optimismOP = createToken("op", "OP", "nep245:v2_1.omni.hot.tg:10_vLAiSt9KfUG
|
|
|
210
247
|
var solanaSOL = createToken("sol", "SOL", "nep141:sol.omft.near", 9);
|
|
211
248
|
var solanaUSDC = createToken("sol", "USDC", "nep141:sol-5ce3bf3a31af18be40ba30f721101b4341690186.omft.near", 6, "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
212
249
|
var solanaUSDT = createToken("sol", "USDT", "nep141:sol-c800a4bd850783ccb82c2b2c7e84175443606352.omft.near", 6, "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
|
|
213
|
-
var solanaTRUMP = createToken("sol", "TRUMP", "nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near", 6, "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN");
|
|
214
250
|
var solanaWIF = createToken("sol", "$WIF", "nep141:sol-b9c68f94ec8fd160137af8cdfe5e61cd68e2afba.omft.near", 6, "EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm");
|
|
215
|
-
var solanaMELANIA = createToken("sol", "MELANIA", "nep141:sol-d600e625449a4d9380eaf5e3265e54c90d34e260.omft.near", 6, "FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P");
|
|
216
251
|
var bitcoinBTC = createToken("btc", "BTC", "nep141:btc.omft.near", 8);
|
|
217
252
|
var polygonPOL = createToken("pol", "POL", "nep245:v2_1.omni.hot.tg:137_11111111111111111111", 18);
|
|
218
253
|
var polygonUSDC = createToken("pol", "USDC", "nep245:v2_1.omni.hot.tg:137_qiStmoQJDQPTebaPjgx5VBxZv6L", 6, "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359");
|
|
@@ -223,7 +258,10 @@ var avalancheUSDT = createToken("avax", "USDT", "nep245:v2_1.omni.hot.tg:43114_3
|
|
|
223
258
|
var bscBNB = createToken("bsc", "BNB", "nep245:v2_1.omni.hot.tg:56_11111111111111111111", 18);
|
|
224
259
|
var bscUSDC = createToken("bsc", "USDC", "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r", 18, "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d");
|
|
225
260
|
var bscUSDT = createToken("bsc", "USDT", "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g", 18, "0x55d398326f99059ff775485246999027b3197955");
|
|
226
|
-
var tonTON = createToken("ton", "
|
|
261
|
+
var tonTON = createToken("ton", "GRAM", "nep245:v2_1.omni.hot.tg:1117_", 9, void 0, {
|
|
262
|
+
name: "tonTON",
|
|
263
|
+
aliases: ["tonGRAM"]
|
|
264
|
+
});
|
|
227
265
|
var tonUSDT = createToken("ton", "USDT", "nep245:v2_1.omni.hot.tg:1117_3tsdfyziyc7EJbP2aULWSKU4toBaAcN4FdTgfm5W1mC4ouR", 6, "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs");
|
|
228
266
|
var tronTRX = createToken("tron", "TRX", "nep141:tron.omft.near", 6);
|
|
229
267
|
var tronUSDT = createToken("tron", "USDT", "nep141:tron-d28a265909efecdcee7c5028585214ea0b96f015.omft.near", 6, "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t");
|
|
@@ -244,6 +282,30 @@ var nearNEAR = createToken("near", "wNEAR", "nep141:wrap.near", 24, "wrap.near",
|
|
|
244
282
|
});
|
|
245
283
|
var nearUSDC = createToken("near", "USDC", "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", 6, "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1");
|
|
246
284
|
var nearUSDT = createToken("near", "USDT", "nep141:usdt.tether-token.near", 6, "usdt.tether-token.near");
|
|
285
|
+
var gnosisUSDC = createToken("gnosis", "USDC", "nep141:gnosis-0x2a22f9c3b484c3629090feed35f17ff8f88f76f0.omft.near", 6, "0x2a22f9c3b484c3629090feed35f17ff8f88f76f0");
|
|
286
|
+
var gnosisUSDT = createToken("gnosis", "USDT", "nep141:gnosis-0x4ecaba5870353805a9f068101a40e0f32ed605c6.omft.near", 6, "0x4ecaba5870353805a9f068101a40e0f32ed605c6");
|
|
287
|
+
var gnosisXDAI = createToken("gnosis", "xDAI", "nep141:gnosis.omft.near", 18, void 0, { name: "gnosisXDAI" });
|
|
288
|
+
var gnosisEURe = createToken("gnosis", "EURe", "nep141:gnosis-0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430.omft.near", 18, "0x420ca0f9b9b604ce0fd9c18ef134c705e5fa3430");
|
|
289
|
+
var gnosisGNO = createToken("gnosis", "GNO", "nep141:gnosis-0x9c58bacc331c9aa871afd802db6379a98e80cedb.omft.near", 18, "0x9c58bacc331c9aa871afd802db6379a98e80cedb");
|
|
290
|
+
var gnosisCOW = createToken("gnosis", "COW", "nep141:gnosis-0x177127622c4a00f3d409b75571e12cb3c8973d3c.omft.near", 18, "0x177127622c4a00f3d409b75571e12cb3c8973d3c");
|
|
291
|
+
var gnosisWETH = createToken("gnosis", "WETH", "nep141:gnosis-0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1.omft.near", 18, "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1");
|
|
292
|
+
var hyperliquidUSDC = createToken("hypercore", "USDC", "1cs_v1:hypercore:hip1:0x6d1e7cde53ba9467b783cb7c530ce054", 8, "0x6d1e7cde53ba9467b783cb7c530ce054");
|
|
293
|
+
var hyperliquidNEAR = createToken("hypercore", "wNEAR", "1cs_v1:hypercore:hip1:0x20b8c9d2f022ffd2aea4f7962b7b1d8b", 8, "0x20b8c9d2f022ffd2aea4f7962b7b1d8b", {
|
|
294
|
+
name: "hyperliquidNEAR",
|
|
295
|
+
aliases: ["hyperliquidwNEAR"]
|
|
296
|
+
});
|
|
297
|
+
var plasmaUSDT0 = createToken("plasma", "USDT0", "nep141:plasma-0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb.omft.near", 6, "0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb");
|
|
298
|
+
var plasmaXPL = createToken("plasma", "XPL", "nep141:plasma.omft.near", 18);
|
|
299
|
+
var monadMON = createToken("monad", "MON", "nep245:v2_1.omni.hot.tg:143_11111111111111111111", 18);
|
|
300
|
+
var monadUSDC = createToken("monad", "USDC", "nep245:v2_1.omni.hot.tg:143_2dmLwYWkCQKyTjeUPAsGJuiVLbFx", 6, "0x754704bc059f8c67012fed69bc8a327a5aafb603");
|
|
301
|
+
var monadUSDT0 = createToken("monad", "USDT0", "nep245:v2_1.omni.hot.tg:143_4EJiJxSALvGoTZbnc8K7Ft9533et", 6, "0xe7cd86e13ac4309349f30b3435a9d337750fc82d");
|
|
302
|
+
var robinhoodETH = createToken("hood", "ETH", "nep141:hood.omft.near", 18);
|
|
303
|
+
var robinhoodUSDG = createToken("hood", "USDG", "nep141:hood-0x5fc5360d0400a0fd4f2af552add042d716f1d168.omft.near", 6, "0x5fc5360d0400a0fd4f2af552add042d716f1d168");
|
|
304
|
+
var robinhoodCASHCAT = createToken("hood", "CASHCAT", "nep141:hood-0x020bfc650a365f8bb26819deaabf3e21291018b4.omft.near", 18, "0x020bfc650a365f8bb26819deaabf3e21291018b4");
|
|
305
|
+
var xlayerUSDC = createToken("xlayer", "USDC", "nep245:v2_1.omni.hot.tg:196_2dK9kLNR7Ekq7su8FxNGiUW3djTw", 6, "0x74b7f16337b8972027f6196a17a631ac6de26d22");
|
|
306
|
+
var xlayerUSDT0 = createToken("xlayer", "USDT0", "nep245:v2_1.omni.hot.tg:196_2fezDCvVYRsG8wrK6deJ2VRPiAS1", 6, "0x779ded0c9e1022225f8e0630b35a9b54be713736");
|
|
307
|
+
var dashDASH = createToken("dash", "DASH", "nep141:dash.omft.near", 8);
|
|
308
|
+
var adiADI = createToken("adi", "ADI", "nep245:v2_1.omni.hot.tg:36900_11111111111111111111", 18);
|
|
247
309
|
var CHAINS = {
|
|
248
310
|
stellar: {
|
|
249
311
|
id: "stellar",
|
|
@@ -285,7 +347,7 @@ var CHAINS = {
|
|
|
285
347
|
id: "sol",
|
|
286
348
|
name: "Solana",
|
|
287
349
|
icon: CHAIN_ICONS.sol,
|
|
288
|
-
tokens: [solanaSOL, solanaUSDC, solanaUSDT,
|
|
350
|
+
tokens: [solanaSOL, solanaUSDC, solanaUSDT, solanaWIF]
|
|
289
351
|
},
|
|
290
352
|
btc: {
|
|
291
353
|
id: "btc",
|
|
@@ -387,19 +449,55 @@ var CHAINS = {
|
|
|
387
449
|
id: "gnosis",
|
|
388
450
|
name: "Gnosis",
|
|
389
451
|
icon: CHAIN_ICONS.gnosis,
|
|
390
|
-
tokens: []
|
|
452
|
+
tokens: [gnosisUSDC, gnosisUSDT, gnosisXDAI, gnosisEURe, gnosisGNO, gnosisCOW, gnosisWETH]
|
|
391
453
|
},
|
|
392
454
|
monad: {
|
|
393
455
|
id: "monad",
|
|
394
456
|
name: "Monad",
|
|
395
457
|
icon: CHAIN_ICONS.monad,
|
|
396
|
-
tokens: []
|
|
458
|
+
tokens: [monadMON, monadUSDC, monadUSDT0]
|
|
397
459
|
},
|
|
398
460
|
scroll: {
|
|
399
461
|
id: "scroll",
|
|
400
462
|
name: "Scroll",
|
|
401
463
|
icon: CHAIN_ICONS.scroll,
|
|
402
464
|
tokens: [scrollETH, scrollUSDT]
|
|
465
|
+
},
|
|
466
|
+
hypercore: {
|
|
467
|
+
id: "hypercore",
|
|
468
|
+
name: "Hyperliquid",
|
|
469
|
+
icon: CHAIN_ICONS.hypercore,
|
|
470
|
+
tokens: [hyperliquidUSDC, hyperliquidNEAR]
|
|
471
|
+
},
|
|
472
|
+
plasma: {
|
|
473
|
+
id: "plasma",
|
|
474
|
+
name: "Plasma",
|
|
475
|
+
icon: CHAIN_ICONS.plasma,
|
|
476
|
+
tokens: [plasmaUSDT0, plasmaXPL]
|
|
477
|
+
},
|
|
478
|
+
hood: {
|
|
479
|
+
id: "hood",
|
|
480
|
+
name: "Robinhood Chain",
|
|
481
|
+
icon: CHAIN_ICONS.hood,
|
|
482
|
+
tokens: [robinhoodETH, robinhoodUSDG, robinhoodCASHCAT]
|
|
483
|
+
},
|
|
484
|
+
xlayer: {
|
|
485
|
+
id: "xlayer",
|
|
486
|
+
name: "X Layer",
|
|
487
|
+
icon: CHAIN_ICONS.xlayer,
|
|
488
|
+
tokens: [xlayerUSDC, xlayerUSDT0]
|
|
489
|
+
},
|
|
490
|
+
dash: {
|
|
491
|
+
id: "dash",
|
|
492
|
+
name: "Dash",
|
|
493
|
+
icon: CHAIN_ICONS.dash,
|
|
494
|
+
tokens: [dashDASH]
|
|
495
|
+
},
|
|
496
|
+
adi: {
|
|
497
|
+
id: "adi",
|
|
498
|
+
name: "ADI Chain",
|
|
499
|
+
icon: CHAIN_ICONS.adi,
|
|
500
|
+
tokens: [adiADI]
|
|
403
501
|
}
|
|
404
502
|
};
|
|
405
503
|
var ALL_TOKENS = Object.values(CHAINS).flatMap((chain) => chain.tokens);
|
|
@@ -489,6 +587,29 @@ function toSmallestUnits(amount, decimals) {
|
|
|
489
587
|
const paddedFraction = fraction.padEnd(decimals, "0").slice(0, decimals);
|
|
490
588
|
return `${whole}${paddedFraction}`.replace(/^0+/, "") || "0";
|
|
491
589
|
}
|
|
590
|
+
function fromSmallestUnits(amount, decimals) {
|
|
591
|
+
if (decimals === 0) return amount;
|
|
592
|
+
const padded = amount.padStart(decimals + 1, "0");
|
|
593
|
+
const whole = padded.slice(0, -decimals) || "0";
|
|
594
|
+
const fraction = padded.slice(-decimals).replace(/0+$/, "");
|
|
595
|
+
return fraction ? `${whole}.${fraction}` : whole;
|
|
596
|
+
}
|
|
597
|
+
var MAX_EXACT_OUTPUT_ROUNDING_BPS = 25;
|
|
598
|
+
function roundUpInputAmount(amount, decimals, maxIncreaseBps = MAX_EXACT_OUTPUT_ROUNDING_BPS) {
|
|
599
|
+
if (!/^[1-9]\d*$/.test(amount) || !Number.isInteger(decimals) || decimals < 0 || !Number.isInteger(maxIncreaseBps) || maxIncreaseBps < 0) {
|
|
600
|
+
return amount;
|
|
601
|
+
}
|
|
602
|
+
const value = BigInt(amount);
|
|
603
|
+
const maxBps = BigInt(maxIncreaseBps);
|
|
604
|
+
for (let displayDecimals = 0; displayDecimals <= decimals; displayDecimals++) {
|
|
605
|
+
const unit = 10n ** BigInt(decimals - displayDecimals);
|
|
606
|
+
const rounded = (value + unit - 1n) / unit * unit;
|
|
607
|
+
if ((rounded - value) * 10000n <= value * maxBps) {
|
|
608
|
+
return rounded.toString();
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return amount;
|
|
612
|
+
}
|
|
492
613
|
function generateDeadline(hoursFromNow = 1) {
|
|
493
614
|
const deadline = new Date(Date.now() + hoursFromNow * 60 * 60 * 1e3);
|
|
494
615
|
return deadline.toISOString();
|
|
@@ -519,7 +640,10 @@ async function getQuote(options) {
|
|
|
519
640
|
referral = "uniport",
|
|
520
641
|
signal
|
|
521
642
|
} = options;
|
|
522
|
-
const amountInSmallestUnits = toSmallestUnits(
|
|
643
|
+
const amountInSmallestUnits = toSmallestUnits(
|
|
644
|
+
amount,
|
|
645
|
+
swapType === "EXACT_OUTPUT" ? destinationToken.decimals : originToken.decimals
|
|
646
|
+
);
|
|
523
647
|
const { backendUrl, requestTimeoutMs } = getUniportConfig();
|
|
524
648
|
const { signal: requestSignal, cleanup, didTimeout } = createTimeoutSignal(
|
|
525
649
|
requestTimeoutMs,
|
|
@@ -569,10 +693,24 @@ async function getQuote(options) {
|
|
|
569
693
|
}
|
|
570
694
|
const data = await response.json();
|
|
571
695
|
const quote = data.quote;
|
|
696
|
+
const paymentAmountIn = swapType === "EXACT_OUTPUT" ? roundUpInputAmount(quote.amountIn, originToken.decimals) : quote.amountIn;
|
|
697
|
+
const roundingRemainder = (BigInt(paymentAmountIn) - BigInt(quote.amountIn)).toString();
|
|
572
698
|
return {
|
|
573
699
|
depositAddress: quote.depositAddress || "",
|
|
574
700
|
memo: quote.depositMemo,
|
|
575
701
|
amountIn: quote.amountIn,
|
|
702
|
+
amountInFormatted: quote.amountInFormatted || fromSmallestUnits(quote.amountIn, originToken.decimals),
|
|
703
|
+
minAmountIn: quote.minAmountIn,
|
|
704
|
+
paymentAmountIn,
|
|
705
|
+
paymentAmountInFormatted: fromSmallestUnits(
|
|
706
|
+
paymentAmountIn,
|
|
707
|
+
originToken.decimals
|
|
708
|
+
),
|
|
709
|
+
roundingRemainder,
|
|
710
|
+
roundingRemainderFormatted: fromSmallestUnits(
|
|
711
|
+
roundingRemainder,
|
|
712
|
+
originToken.decimals
|
|
713
|
+
),
|
|
576
714
|
amountOut: quote.amountOut,
|
|
577
715
|
amountOutFormatted: quote.amountOutFormatted,
|
|
578
716
|
amountOutUsd: quote.amountOutUsd,
|
|
@@ -656,6 +794,13 @@ function getUniportDefaultRefundAddress() {
|
|
|
656
794
|
}
|
|
657
795
|
|
|
658
796
|
// src/hooks/useUniportPayment.ts
|
|
797
|
+
function normalizeError(error, fallback) {
|
|
798
|
+
if (error instanceof Error) return error;
|
|
799
|
+
if (typeof error === "object" && error !== null && "message" in error && typeof error.message === "string") {
|
|
800
|
+
return new Error(error.message);
|
|
801
|
+
}
|
|
802
|
+
return new Error(fallback);
|
|
803
|
+
}
|
|
659
804
|
function useUniportPayment(options) {
|
|
660
805
|
const {
|
|
661
806
|
recipient,
|
|
@@ -665,6 +810,7 @@ function useUniportPayment(options) {
|
|
|
665
810
|
onSuccess,
|
|
666
811
|
onError
|
|
667
812
|
} = options;
|
|
813
|
+
const swapType = initialAmount === void 0 ? "EXACT_INPUT" : "EXACT_OUTPUT";
|
|
668
814
|
const destToken = getToken(destinationToken);
|
|
669
815
|
if (!destToken) {
|
|
670
816
|
throw new Error(
|
|
@@ -684,6 +830,7 @@ function useUniportPayment(options) {
|
|
|
684
830
|
const [refundAddress, setRefundAddressState] = react.useState(
|
|
685
831
|
initialRefundAddress ?? ""
|
|
686
832
|
);
|
|
833
|
+
react.useEffect(() => setAmountState(initialAmount ?? ""), [initialAmount]);
|
|
687
834
|
const [evmDefaultRefundAddress, setEvmDefaultRefundAddress] = react.useState(
|
|
688
835
|
UNIPORT_FALLBACK_REFUND_ADDRESS
|
|
689
836
|
);
|
|
@@ -696,7 +843,7 @@ function useUniportPayment(options) {
|
|
|
696
843
|
cancelled = true;
|
|
697
844
|
};
|
|
698
845
|
}, []);
|
|
699
|
-
const effectiveRefundAddress = refundAddress.trim() || (selectedChain &&
|
|
846
|
+
const effectiveRefundAddress = swapType === "EXACT_OUTPUT" ? "" : refundAddress.trim() || (selectedChain && usesEvmAddress(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
700
847
|
const pollingRef = react.useRef(null);
|
|
701
848
|
const lastStatusRef = react.useRef(null);
|
|
702
849
|
const previewDebounceRef = react.useRef(null);
|
|
@@ -714,7 +861,7 @@ function useUniportPayment(options) {
|
|
|
714
861
|
previewAbortRef.current.abort();
|
|
715
862
|
previewAbortRef.current = null;
|
|
716
863
|
}
|
|
717
|
-
if (!nextAmount || !nextSelectedToken || !nextRefundAddress) {
|
|
864
|
+
if (!nextAmount || !nextSelectedToken || swapType !== "EXACT_OUTPUT" && !nextRefundAddress) {
|
|
718
865
|
setIsLoadingPreview(false);
|
|
719
866
|
return;
|
|
720
867
|
}
|
|
@@ -729,6 +876,7 @@ function useUniportPayment(options) {
|
|
|
729
876
|
amount: nextAmount,
|
|
730
877
|
recipient,
|
|
731
878
|
refundTo: nextRefundAddress,
|
|
879
|
+
swapType,
|
|
732
880
|
dry: true,
|
|
733
881
|
signal: controller.signal
|
|
734
882
|
});
|
|
@@ -737,7 +885,10 @@ function useUniportPayment(options) {
|
|
|
737
885
|
if (err instanceof Error && err.name === "AbortError") {
|
|
738
886
|
return;
|
|
739
887
|
}
|
|
740
|
-
const previewFailure =
|
|
888
|
+
const previewFailure = normalizeError(
|
|
889
|
+
err,
|
|
890
|
+
"Failed to fetch estimate"
|
|
891
|
+
);
|
|
741
892
|
setPreviewError(previewFailure);
|
|
742
893
|
console.warn("Preview quote failed:", previewFailure);
|
|
743
894
|
} finally {
|
|
@@ -748,7 +899,7 @@ function useUniportPayment(options) {
|
|
|
748
899
|
}
|
|
749
900
|
}, 250);
|
|
750
901
|
},
|
|
751
|
-
[destToken, recipient]
|
|
902
|
+
[destToken, recipient, swapType]
|
|
752
903
|
);
|
|
753
904
|
const setAmount = react.useCallback(
|
|
754
905
|
(newAmount) => {
|
|
@@ -760,7 +911,7 @@ function useUniportPayment(options) {
|
|
|
760
911
|
const setRefundAddress = react.useCallback(
|
|
761
912
|
(newRefundAddress) => {
|
|
762
913
|
setRefundAddressState(newRefundAddress);
|
|
763
|
-
const nextEffective = newRefundAddress.trim() || (selectedChain &&
|
|
914
|
+
const nextEffective = newRefundAddress.trim() || (selectedChain && usesEvmAddress(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
764
915
|
schedulePreviewQuote(amount, nextEffective, selectedToken);
|
|
765
916
|
},
|
|
766
917
|
[amount, evmDefaultRefundAddress, schedulePreviewQuote, selectedChain, selectedToken]
|
|
@@ -770,7 +921,7 @@ function useUniportPayment(options) {
|
|
|
770
921
|
setSelectedChain(chain);
|
|
771
922
|
setSelectedToken(nextToken);
|
|
772
923
|
setPaymentState("selecting");
|
|
773
|
-
const nextEffective = refundAddress.trim() || (
|
|
924
|
+
const nextEffective = refundAddress.trim() || (usesEvmAddress(chain.id) ? evmDefaultRefundAddress : "");
|
|
774
925
|
schedulePreviewQuote(amount, nextEffective, nextToken);
|
|
775
926
|
}, [amount, evmDefaultRefundAddress, refundAddress, schedulePreviewQuote]);
|
|
776
927
|
const handleTokenSelect = react.useCallback((token) => {
|
|
@@ -779,7 +930,7 @@ function useUniportPayment(options) {
|
|
|
779
930
|
schedulePreviewQuote(amount, effectiveRefundAddress, token);
|
|
780
931
|
}, [amount, effectiveRefundAddress, schedulePreviewQuote]);
|
|
781
932
|
const fetchQuote = react.useCallback(async () => {
|
|
782
|
-
if (!selectedToken || !amount || !effectiveRefundAddress) {
|
|
933
|
+
if (!selectedToken || !amount || swapType !== "EXACT_OUTPUT" && !effectiveRefundAddress) {
|
|
783
934
|
setError(new Error("Missing required fields"));
|
|
784
935
|
return;
|
|
785
936
|
}
|
|
@@ -792,12 +943,13 @@ function useUniportPayment(options) {
|
|
|
792
943
|
amount,
|
|
793
944
|
recipient,
|
|
794
945
|
refundTo: effectiveRefundAddress,
|
|
946
|
+
swapType,
|
|
795
947
|
dry: false
|
|
796
948
|
});
|
|
797
949
|
setQuote(result);
|
|
798
950
|
setPaymentState("awaiting_deposit");
|
|
799
951
|
} catch (err) {
|
|
800
|
-
const error2 = err
|
|
952
|
+
const error2 = normalizeError(err, "Failed to get quote");
|
|
801
953
|
setError(error2);
|
|
802
954
|
setPaymentState("error");
|
|
803
955
|
onError?.(error2);
|
|
@@ -808,6 +960,7 @@ function useUniportPayment(options) {
|
|
|
808
960
|
effectiveRefundAddress,
|
|
809
961
|
recipient,
|
|
810
962
|
destToken,
|
|
963
|
+
swapType,
|
|
811
964
|
onError
|
|
812
965
|
]);
|
|
813
966
|
const stopPolling = react.useCallback(() => {
|
|
@@ -917,7 +1070,7 @@ function useUniportPayment(options) {
|
|
|
917
1070
|
amount,
|
|
918
1071
|
refundAddress,
|
|
919
1072
|
effectiveRefundAddress,
|
|
920
|
-
isUsingDefaultRefundAddress: !refundAddress.trim() && !!effectiveRefundAddress,
|
|
1073
|
+
isUsingDefaultRefundAddress: swapType !== "EXACT_OUTPUT" && !refundAddress.trim() && !!effectiveRefundAddress,
|
|
921
1074
|
destinationToken: destToken,
|
|
922
1075
|
chains,
|
|
923
1076
|
tokens,
|
|
@@ -1124,6 +1277,9 @@ function formatPreviewError(error) {
|
|
|
1124
1277
|
return "Could not fetch estimate. Please try again.";
|
|
1125
1278
|
}
|
|
1126
1279
|
const normalized = error.message.toLowerCase();
|
|
1280
|
+
if (normalized.includes("trustline")) {
|
|
1281
|
+
return "This Stellar recipient must enable the selected asset before it can receive funds.";
|
|
1282
|
+
}
|
|
1127
1283
|
if (normalized.includes("recipient is not valid")) {
|
|
1128
1284
|
return "Recipient address does not match the selected destination chain.";
|
|
1129
1285
|
}
|
|
@@ -1136,34 +1292,7 @@ function formatPreviewError(error) {
|
|
|
1136
1292
|
return "Could not fetch estimate. Check the details and try again.";
|
|
1137
1293
|
}
|
|
1138
1294
|
function formatChainLabel(chainId) {
|
|
1139
|
-
|
|
1140
|
-
sui: "Sui",
|
|
1141
|
-
eth: "Ethereum",
|
|
1142
|
-
sol: "Solana",
|
|
1143
|
-
arb: "Arbitrum",
|
|
1144
|
-
base: "Base",
|
|
1145
|
-
op: "Optimism",
|
|
1146
|
-
pol: "Polygon",
|
|
1147
|
-
avax: "Avalanche",
|
|
1148
|
-
bsc: "BNB Chain",
|
|
1149
|
-
near: "NEAR",
|
|
1150
|
-
btc: "Bitcoin",
|
|
1151
|
-
ton: "TON",
|
|
1152
|
-
tron: "Tron",
|
|
1153
|
-
stellar: "Stellar",
|
|
1154
|
-
cardano: "Cardano",
|
|
1155
|
-
xrp: "XRP Ledger",
|
|
1156
|
-
doge: "Dogecoin",
|
|
1157
|
-
ltc: "Litecoin",
|
|
1158
|
-
bch: "Bitcoin Cash",
|
|
1159
|
-
aptos: "Aptos",
|
|
1160
|
-
starknet: "Starknet",
|
|
1161
|
-
bera: "Berachain",
|
|
1162
|
-
zec: "Zcash",
|
|
1163
|
-
gnosis: "Gnosis",
|
|
1164
|
-
monad: "Monad"
|
|
1165
|
-
};
|
|
1166
|
-
return labels[chainId] || chainId.toUpperCase();
|
|
1295
|
+
return CHAINS[chainId]?.name ?? chainId.toUpperCase();
|
|
1167
1296
|
}
|
|
1168
1297
|
function UniportModal({
|
|
1169
1298
|
open,
|
|
@@ -1231,8 +1360,9 @@ function UniportModal({
|
|
|
1231
1360
|
const isSuccess = paymentState === "success";
|
|
1232
1361
|
const isError = paymentState === "error";
|
|
1233
1362
|
const isQuoting = paymentState === "quoting";
|
|
1234
|
-
const
|
|
1235
|
-
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
|
|
1363
|
+
const isExactOutput = initialAmount !== void 0;
|
|
1364
|
+
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && (isExactOutput || payment.effectiveRefundAddress));
|
|
1365
|
+
const canSubmit = !!(canPreviewEstimate && payment.previewQuote && !payment.previewError && !payment.isLoadingPreview);
|
|
1236
1366
|
const showBack = !isSuccess && !isError && (showQR || modalStep !== "chain");
|
|
1237
1367
|
const iconBtn = {
|
|
1238
1368
|
width: 36,
|
|
@@ -1422,7 +1552,7 @@ function UniportModal({
|
|
|
1422
1552
|
"\u2192 ",
|
|
1423
1553
|
payment.destinationToken.symbol,
|
|
1424
1554
|
" on ",
|
|
1425
|
-
payment.destinationToken.chain
|
|
1555
|
+
formatChainLabel(payment.destinationToken.chain)
|
|
1426
1556
|
] })
|
|
1427
1557
|
] })
|
|
1428
1558
|
] }),
|
|
@@ -1453,9 +1583,9 @@ function UniportModal({
|
|
|
1453
1583
|
autoFocus: true
|
|
1454
1584
|
}
|
|
1455
1585
|
),
|
|
1456
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: tok?.symbol })
|
|
1586
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: isExactOutput ? payment.destinationToken.symbol : tok?.symbol })
|
|
1457
1587
|
] }),
|
|
1458
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "18px" }, children: [
|
|
1588
|
+
!isExactOutput && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "18px" }, children: [
|
|
1459
1589
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1460
1590
|
"label",
|
|
1461
1591
|
{
|
|
@@ -1469,7 +1599,7 @@ function UniportModal({
|
|
|
1469
1599
|
children: [
|
|
1470
1600
|
"Refund address on ",
|
|
1471
1601
|
ch?.name || "the source chain",
|
|
1472
|
-
ch &&
|
|
1602
|
+
ch && usesEvmAddress(ch.id) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 400, color: t.textMuted }, children: " (optional)" })
|
|
1473
1603
|
]
|
|
1474
1604
|
}
|
|
1475
1605
|
),
|
|
@@ -1479,7 +1609,7 @@ function UniportModal({
|
|
|
1479
1609
|
type: "text",
|
|
1480
1610
|
value: payment.refundAddress,
|
|
1481
1611
|
onChange: (e) => payment.setRefundAddress(e.target.value),
|
|
1482
|
-
placeholder: ch &&
|
|
1612
|
+
placeholder: ch && usesEvmAddress(ch.id) ? `Optional \u2014 defaults to ${UNIPORT_ENS_NAME}` : `Enter a ${ch?.name || "source chain"} refund address`,
|
|
1483
1613
|
spellCheck: false,
|
|
1484
1614
|
autoCapitalize: "off",
|
|
1485
1615
|
autoCorrect: "off",
|
|
@@ -1542,22 +1672,21 @@ function UniportModal({
|
|
|
1542
1672
|
animation: `uniport-pulse 1s ease infinite ${delay}s`
|
|
1543
1673
|
} }, i)),
|
|
1544
1674
|
canPreviewEstimate && !payment.isLoadingPreview && payment.previewQuote && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "15px", color: t.textSecondary }, children: [
|
|
1545
|
-
"You will receive",
|
|
1546
|
-
" ",
|
|
1675
|
+
isExactOutput ? "You will send " : "You will receive ",
|
|
1547
1676
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { style: { color: t.text }, children: [
|
|
1548
|
-
formatDisplayAmount(payment.previewQuote.amountOutFormatted),
|
|
1677
|
+
isExactOutput ? payment.previewQuote.paymentAmountInFormatted : formatDisplayAmount(payment.previewQuote.amountOutFormatted),
|
|
1549
1678
|
" ",
|
|
1550
|
-
payment.destinationToken.symbol
|
|
1679
|
+
isExactOutput ? tok?.symbol : payment.destinationToken.symbol
|
|
1551
1680
|
] }),
|
|
1552
1681
|
" ",
|
|
1553
1682
|
"on",
|
|
1554
1683
|
" ",
|
|
1555
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { color: t.text }, children: formatChainLabel(payment.destinationToken.chain) })
|
|
1684
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { style: { color: t.text }, children: isExactOutput ? ch?.name : formatChainLabel(payment.destinationToken.chain) })
|
|
1556
1685
|
] }),
|
|
1557
1686
|
canPreviewEstimate && !payment.isLoadingPreview && payment.previewError && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.error }, children: formatPreviewError(payment.previewError) }),
|
|
1558
1687
|
canPreviewEstimate && !payment.isLoadingPreview && !payment.previewQuote && !payment.previewError && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "Fetching estimate\u2026" })
|
|
1559
1688
|
] }),
|
|
1560
|
-
!!payment.amount && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1689
|
+
!!payment.amount && !isExactOutput && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1561
1690
|
/* @__PURE__ */ jsxRuntime.jsx(WarningTriangle, { color: t.warning }),
|
|
1562
1691
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
|
|
1563
1692
|
"You must send",
|
|
@@ -1574,6 +1703,34 @@ function UniportModal({
|
|
|
1574
1703
|
". Sending a different amount or asset may result in loss of funds."
|
|
1575
1704
|
] })
|
|
1576
1705
|
] }),
|
|
1706
|
+
isExactOutput && payment.previewQuote && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...warningBox, marginBottom: "20px" }, children: [
|
|
1707
|
+
/* @__PURE__ */ jsxRuntime.jsx(WarningTriangle, { color: t.warning }),
|
|
1708
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: 0, fontSize: "13px", color: t.warningText, lineHeight: 1.55 }, children: [
|
|
1709
|
+
"To receive ",
|
|
1710
|
+
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
1711
|
+
"exactly ",
|
|
1712
|
+
payment.amount,
|
|
1713
|
+
" ",
|
|
1714
|
+
payment.destinationToken.symbol
|
|
1715
|
+
] }),
|
|
1716
|
+
", send ",
|
|
1717
|
+
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
1718
|
+
payment.previewQuote.paymentAmountInFormatted,
|
|
1719
|
+
" ",
|
|
1720
|
+
tok?.symbol
|
|
1721
|
+
] }),
|
|
1722
|
+
" on ",
|
|
1723
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: ch?.name }),
|
|
1724
|
+
".",
|
|
1725
|
+
payment.previewQuote.roundingRemainder !== "0" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1726
|
+
" The rounded surplus is ",
|
|
1727
|
+
payment.previewQuote.roundingRemainderFormatted,
|
|
1728
|
+
" ",
|
|
1729
|
+
tok?.symbol,
|
|
1730
|
+
"."
|
|
1731
|
+
] })
|
|
1732
|
+
] })
|
|
1733
|
+
] }),
|
|
1577
1734
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1578
1735
|
"button",
|
|
1579
1736
|
{
|
|
@@ -1586,7 +1743,7 @@ function UniportModal({
|
|
|
1586
1743
|
] }) : "Confirm Payment"
|
|
1587
1744
|
}
|
|
1588
1745
|
),
|
|
1589
|
-
!payment.effectiveRefundAddress && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
|
|
1746
|
+
!isExactOutput && !payment.effectiveRefundAddress && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
|
|
1590
1747
|
"Enter a refund address on ",
|
|
1591
1748
|
ch?.name || "the source chain",
|
|
1592
1749
|
" to continue."
|
|
@@ -1597,8 +1754,9 @@ function UniportModal({
|
|
|
1597
1754
|
const renderPaymentStep = () => {
|
|
1598
1755
|
const { quote } = payment;
|
|
1599
1756
|
const isProcessing = paymentState === "processing";
|
|
1757
|
+
const sendAmount = quote?.paymentAmountInFormatted || payment.amount;
|
|
1600
1758
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1601
|
-
renderHeader(`Send ${
|
|
1759
|
+
renderHeader(`Send ${sendAmount} ${payment.selectedToken?.symbol ?? ""} on ${payment.selectedChain?.name ?? ""}`),
|
|
1602
1760
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "4px 20px 24px" }, children: quote && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1603
1761
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: {
|
|
1604
1762
|
background: "#ffffff",
|
|
@@ -1707,7 +1865,7 @@ function UniportModal({
|
|
|
1707
1865
|
"Only send",
|
|
1708
1866
|
" ",
|
|
1709
1867
|
/* @__PURE__ */ jsxRuntime.jsxs("strong", { children: [
|
|
1710
|
-
|
|
1868
|
+
sendAmount,
|
|
1711
1869
|
" ",
|
|
1712
1870
|
payment.selectedToken?.symbol
|
|
1713
1871
|
] }),
|
|
@@ -1728,7 +1886,7 @@ function UniportModal({
|
|
|
1728
1886
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", marginBottom: "10px" }, children: [
|
|
1729
1887
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: "13px", color: t.textMuted }, children: "You'll receive" }),
|
|
1730
1888
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "13px", fontWeight: 600, color: t.text }, children: [
|
|
1731
|
-
"\u2248",
|
|
1889
|
+
isExactOutput ? "" : "\u2248",
|
|
1732
1890
|
formatDisplayAmount(quote.amountOutFormatted),
|
|
1733
1891
|
" ",
|
|
1734
1892
|
payment.destinationToken.symbol
|
|
@@ -1761,6 +1919,7 @@ function UniportModal({
|
|
|
1761
1919
|
] }) })
|
|
1762
1920
|
] });
|
|
1763
1921
|
};
|
|
1922
|
+
const txUrl = (reported, chain, hash) => reported?.startsWith("https://") ? reported : chain ? getExplorerTxUrl(chain, hash) : void 0;
|
|
1764
1923
|
const renderTxHash = (hash, url) => url ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1765
1924
|
"a",
|
|
1766
1925
|
{
|
|
@@ -1818,11 +1977,11 @@ function UniportModal({
|
|
|
1818
1977
|
) }) }),
|
|
1819
1978
|
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: t.text, letterSpacing: "-0.02em" }, children: "Payment sent!" }),
|
|
1820
1979
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { margin: "0 0 24px", fontSize: "14px", color: t.textMuted, lineHeight: 1.6 }, children: [
|
|
1821
|
-
payment.amount,
|
|
1980
|
+
payment.quote?.paymentAmountInFormatted || payment.amount,
|
|
1822
1981
|
" ",
|
|
1823
1982
|
payment.selectedToken?.symbol,
|
|
1824
1983
|
" \u2192 ",
|
|
1825
|
-
"\u2248",
|
|
1984
|
+
isExactOutput ? "" : "\u2248",
|
|
1826
1985
|
formatDisplayAmount(payment.quote?.amountOutFormatted),
|
|
1827
1986
|
" ",
|
|
1828
1987
|
payment.destinationToken.symbol
|
|
@@ -1850,14 +2009,14 @@ function UniportModal({
|
|
|
1850
2009
|
"Source TX \xB7 ",
|
|
1851
2010
|
payment.selectedChain?.name
|
|
1852
2011
|
] }),
|
|
1853
|
-
renderTxHash(hash, payment.
|
|
2012
|
+
renderTxHash(hash, txUrl(payment.status?.originTxExplorerUrls?.[i], payment.selectedChain?.id, hash))
|
|
1854
2013
|
] }, `o${i}`)),
|
|
1855
2014
|
payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1856
2015
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: [
|
|
1857
2016
|
"Destination TX \xB7 ",
|
|
1858
2017
|
CHAINS[payment.destinationToken.chain].name
|
|
1859
2018
|
] }),
|
|
1860
|
-
renderTxHash(hash,
|
|
2019
|
+
renderTxHash(hash, txUrl(payment.status?.destinationTxExplorerUrls?.[i], payment.destinationToken.chain, hash))
|
|
1861
2020
|
] }, `d${i}`)),
|
|
1862
2021
|
!payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: t.textMuted, fontSize: "13px", margin: 0 }, children: "Loading transaction details\u2026" })
|
|
1863
2022
|
] }),
|