uniport-sdk 0.0.3 → 0.0.5
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 +5 -0
- package/dist/components/index.cjs +237 -94
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +237 -94
- package/dist/components/index.js.map +1 -1
- package/dist/core/index.cjs +95 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +38 -1
- package/dist/core/index.d.ts +38 -1
- package/dist/core/index.js +89 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +247 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +242 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -87,6 +87,51 @@ var CHAIN_ICONS = {
|
|
|
87
87
|
xrp: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ripple/info/logo.png",
|
|
88
88
|
zec: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/zcash/info/logo.png"
|
|
89
89
|
};
|
|
90
|
+
var EVM_CHAINS = [
|
|
91
|
+
"eth",
|
|
92
|
+
"arb",
|
|
93
|
+
"base",
|
|
94
|
+
"op",
|
|
95
|
+
"pol",
|
|
96
|
+
"avax",
|
|
97
|
+
"bsc",
|
|
98
|
+
"gnosis",
|
|
99
|
+
"bera",
|
|
100
|
+
"monad"
|
|
101
|
+
];
|
|
102
|
+
function isEvmChain(chain) {
|
|
103
|
+
return EVM_CHAINS.includes(chain);
|
|
104
|
+
}
|
|
105
|
+
var EXPLORER_TX_URLS = {
|
|
106
|
+
eth: (h) => `https://etherscan.io/tx/${h}`,
|
|
107
|
+
arb: (h) => `https://arbiscan.io/tx/${h}`,
|
|
108
|
+
base: (h) => `https://basescan.org/tx/${h}`,
|
|
109
|
+
op: (h) => `https://optimistic.etherscan.io/tx/${h}`,
|
|
110
|
+
pol: (h) => `https://polygonscan.com/tx/${h}`,
|
|
111
|
+
avax: (h) => `https://snowtrace.io/tx/${h}`,
|
|
112
|
+
bsc: (h) => `https://bscscan.com/tx/${h}`,
|
|
113
|
+
gnosis: (h) => `https://gnosisscan.io/tx/${h}`,
|
|
114
|
+
bera: (h) => `https://berascan.com/tx/${h}`,
|
|
115
|
+
monad: (h) => `https://monadvision.com/tx/${h}`,
|
|
116
|
+
sui: (h) => `https://suivision.xyz/txblock/${h}`,
|
|
117
|
+
sol: (h) => `https://solscan.io/tx/${h}`,
|
|
118
|
+
btc: (h) => `https://mempool.space/tx/${h}`,
|
|
119
|
+
near: (h) => `https://nearblocks.io/txns/${h}`,
|
|
120
|
+
ton: (h) => `https://tonviewer.com/transaction/${h}`,
|
|
121
|
+
tron: (h) => `https://tronscan.org/#/transaction/${h}`,
|
|
122
|
+
stellar: (h) => `https://stellar.expert/explorer/public/tx/${h}`,
|
|
123
|
+
cardano: (h) => `https://cardanoscan.io/transaction/${h}`,
|
|
124
|
+
aptos: (h) => `https://explorer.aptoslabs.com/txn/${h}?network=mainnet`,
|
|
125
|
+
starknet: (h) => `https://voyager.online/tx/${h}`,
|
|
126
|
+
doge: (h) => `https://dogechain.info/tx/${h}`,
|
|
127
|
+
ltc: (h) => `https://litecoinspace.org/tx/${h}`,
|
|
128
|
+
bch: (h) => `https://blockchair.com/bitcoin-cash/transaction/${h}`,
|
|
129
|
+
xrp: (h) => `https://xrpscan.com/tx/${h}`,
|
|
130
|
+
zec: (h) => `https://blockchair.com/zcash/transaction/${h}`
|
|
131
|
+
};
|
|
132
|
+
function getExplorerTxUrl(chain, hash) {
|
|
133
|
+
return EXPLORER_TX_URLS[chain]?.(hash);
|
|
134
|
+
}
|
|
90
135
|
function createToken(chain, symbol, assetId, decimals, contractAddress, options) {
|
|
91
136
|
const normalizedSymbol = symbol.replace("$", "").replace(" ", "");
|
|
92
137
|
const canonicalPrefix = TOKEN_NAME_PREFIXES[chain] || chain;
|
|
@@ -613,6 +658,49 @@ async function pollExecutionStatus(depositAddress, options) {
|
|
|
613
658
|
}
|
|
614
659
|
throw new Error(`Timeout waiting for swap completion after ${timeout}ms`);
|
|
615
660
|
}
|
|
661
|
+
|
|
662
|
+
// src/core/ens.ts
|
|
663
|
+
var ENSIDEAS_BASE_URL = "https://api.ensideas.com/ens/resolve";
|
|
664
|
+
var UNIPORT_ENS_NAME = "uniport.eth";
|
|
665
|
+
var UNIPORT_FALLBACK_REFUND_ADDRESS = "0x2f43A54f931b95053c3DDa5f4637065AA0c3c494";
|
|
666
|
+
async function resolveEnsName(name, options) {
|
|
667
|
+
const controller = new AbortController();
|
|
668
|
+
const timeoutId = setTimeout(
|
|
669
|
+
() => controller.abort(),
|
|
670
|
+
options?.timeoutMs ?? 1e4
|
|
671
|
+
);
|
|
672
|
+
options?.signal?.addEventListener("abort", () => controller.abort(), {
|
|
673
|
+
once: true
|
|
674
|
+
});
|
|
675
|
+
try {
|
|
676
|
+
const response = await fetch(
|
|
677
|
+
`${ENSIDEAS_BASE_URL}/${encodeURIComponent(name)}`,
|
|
678
|
+
{ signal: controller.signal }
|
|
679
|
+
);
|
|
680
|
+
if (!response.ok) return null;
|
|
681
|
+
const data = await response.json();
|
|
682
|
+
if (!data.address) return null;
|
|
683
|
+
return {
|
|
684
|
+
address: data.address,
|
|
685
|
+
name: data.name ?? name,
|
|
686
|
+
displayName: data.displayName ?? name,
|
|
687
|
+
avatar: data.avatar ?? null
|
|
688
|
+
};
|
|
689
|
+
} catch {
|
|
690
|
+
return null;
|
|
691
|
+
} finally {
|
|
692
|
+
clearTimeout(timeoutId);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
var uniportRefundAddressPromise = null;
|
|
696
|
+
function getUniportDefaultRefundAddress() {
|
|
697
|
+
if (!uniportRefundAddressPromise) {
|
|
698
|
+
uniportRefundAddressPromise = resolveEnsName(UNIPORT_ENS_NAME).then(
|
|
699
|
+
(result) => result?.address ?? UNIPORT_FALLBACK_REFUND_ADDRESS
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
return uniportRefundAddressPromise;
|
|
703
|
+
}
|
|
616
704
|
function useUniportPayment(options) {
|
|
617
705
|
const {
|
|
618
706
|
recipient,
|
|
@@ -641,6 +729,19 @@ function useUniportPayment(options) {
|
|
|
641
729
|
const [refundAddress, setRefundAddressState] = react.useState(
|
|
642
730
|
initialRefundAddress ?? ""
|
|
643
731
|
);
|
|
732
|
+
const [evmDefaultRefundAddress, setEvmDefaultRefundAddress] = react.useState(
|
|
733
|
+
UNIPORT_FALLBACK_REFUND_ADDRESS
|
|
734
|
+
);
|
|
735
|
+
react.useEffect(() => {
|
|
736
|
+
let cancelled = false;
|
|
737
|
+
getUniportDefaultRefundAddress().then((address) => {
|
|
738
|
+
if (!cancelled) setEvmDefaultRefundAddress(address);
|
|
739
|
+
});
|
|
740
|
+
return () => {
|
|
741
|
+
cancelled = true;
|
|
742
|
+
};
|
|
743
|
+
}, []);
|
|
744
|
+
const effectiveRefundAddress = refundAddress.trim() || (selectedChain && isEvmChain(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
644
745
|
const pollingRef = react.useRef(null);
|
|
645
746
|
const lastStatusRef = react.useRef(null);
|
|
646
747
|
const previewDebounceRef = react.useRef(null);
|
|
@@ -697,31 +798,33 @@ function useUniportPayment(options) {
|
|
|
697
798
|
const setAmount = react.useCallback(
|
|
698
799
|
(newAmount) => {
|
|
699
800
|
setAmountState(newAmount);
|
|
700
|
-
schedulePreviewQuote(newAmount,
|
|
801
|
+
schedulePreviewQuote(newAmount, effectiveRefundAddress, selectedToken);
|
|
701
802
|
},
|
|
702
|
-
[
|
|
803
|
+
[effectiveRefundAddress, schedulePreviewQuote, selectedToken]
|
|
703
804
|
);
|
|
704
805
|
const setRefundAddress = react.useCallback(
|
|
705
806
|
(newRefundAddress) => {
|
|
706
807
|
setRefundAddressState(newRefundAddress);
|
|
707
|
-
|
|
808
|
+
const nextEffective = newRefundAddress.trim() || (selectedChain && isEvmChain(selectedChain.id) ? evmDefaultRefundAddress : "");
|
|
809
|
+
schedulePreviewQuote(amount, nextEffective, selectedToken);
|
|
708
810
|
},
|
|
709
|
-
[amount, schedulePreviewQuote, selectedToken]
|
|
811
|
+
[amount, evmDefaultRefundAddress, schedulePreviewQuote, selectedChain, selectedToken]
|
|
710
812
|
);
|
|
711
813
|
const handleChainSelect = react.useCallback((chain) => {
|
|
712
814
|
const nextToken = chain.tokens[0] || null;
|
|
713
815
|
setSelectedChain(chain);
|
|
714
816
|
setSelectedToken(nextToken);
|
|
715
817
|
setPaymentState("selecting");
|
|
716
|
-
|
|
717
|
-
|
|
818
|
+
const nextEffective = refundAddress.trim() || (isEvmChain(chain.id) ? evmDefaultRefundAddress : "");
|
|
819
|
+
schedulePreviewQuote(amount, nextEffective, nextToken);
|
|
820
|
+
}, [amount, evmDefaultRefundAddress, refundAddress, schedulePreviewQuote]);
|
|
718
821
|
const handleTokenSelect = react.useCallback((token) => {
|
|
719
822
|
setSelectedToken(token);
|
|
720
823
|
setPaymentState("selecting");
|
|
721
|
-
schedulePreviewQuote(amount,
|
|
722
|
-
}, [amount,
|
|
824
|
+
schedulePreviewQuote(amount, effectiveRefundAddress, token);
|
|
825
|
+
}, [amount, effectiveRefundAddress, schedulePreviewQuote]);
|
|
723
826
|
const fetchQuote = react.useCallback(async () => {
|
|
724
|
-
if (!selectedToken || !amount || !
|
|
827
|
+
if (!selectedToken || !amount || !effectiveRefundAddress) {
|
|
725
828
|
setError(new Error("Missing required fields"));
|
|
726
829
|
return;
|
|
727
830
|
}
|
|
@@ -733,7 +836,7 @@ function useUniportPayment(options) {
|
|
|
733
836
|
destinationToken: destToken,
|
|
734
837
|
amount,
|
|
735
838
|
recipient,
|
|
736
|
-
refundTo:
|
|
839
|
+
refundTo: effectiveRefundAddress,
|
|
737
840
|
dry: false
|
|
738
841
|
});
|
|
739
842
|
setQuote(result);
|
|
@@ -747,7 +850,7 @@ function useUniportPayment(options) {
|
|
|
747
850
|
}, [
|
|
748
851
|
selectedToken,
|
|
749
852
|
amount,
|
|
750
|
-
|
|
853
|
+
effectiveRefundAddress,
|
|
751
854
|
recipient,
|
|
752
855
|
destToken,
|
|
753
856
|
onError
|
|
@@ -858,6 +961,8 @@ function useUniportPayment(options) {
|
|
|
858
961
|
selectedToken,
|
|
859
962
|
amount,
|
|
860
963
|
refundAddress,
|
|
964
|
+
effectiveRefundAddress,
|
|
965
|
+
isUsingDefaultRefundAddress: !refundAddress.trim() && !!effectiveRefundAddress,
|
|
861
966
|
destinationToken: destToken,
|
|
862
967
|
chains,
|
|
863
968
|
tokens,
|
|
@@ -1173,8 +1278,8 @@ function UniportModal({
|
|
|
1173
1278
|
const isSuccess = paymentState === "success";
|
|
1174
1279
|
const isError = paymentState === "error";
|
|
1175
1280
|
const isQuoting = paymentState === "quoting";
|
|
1176
|
-
const canSubmit = !!(payment.selectedToken && payment.amount && payment.
|
|
1177
|
-
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.
|
|
1281
|
+
const canSubmit = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
|
|
1282
|
+
const canPreviewEstimate = !!(payment.selectedToken && payment.amount && payment.effectiveRefundAddress);
|
|
1178
1283
|
const showBack = !isSuccess && !isError && (showQR || modalStep !== "chain");
|
|
1179
1284
|
const iconBtn = {
|
|
1180
1285
|
width: 36,
|
|
@@ -1410,7 +1515,8 @@ function UniportModal({
|
|
|
1410
1515
|
},
|
|
1411
1516
|
children: [
|
|
1412
1517
|
"Refund address on ",
|
|
1413
|
-
ch?.name || "the source chain"
|
|
1518
|
+
ch?.name || "the source chain",
|
|
1519
|
+
ch && isEvmChain(ch.id) && /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontWeight: 400, color: t.textMuted }, children: " (optional)" })
|
|
1414
1520
|
]
|
|
1415
1521
|
}
|
|
1416
1522
|
),
|
|
@@ -1420,7 +1526,7 @@ function UniportModal({
|
|
|
1420
1526
|
type: "text",
|
|
1421
1527
|
value: payment.refundAddress,
|
|
1422
1528
|
onChange: (e) => payment.setRefundAddress(e.target.value),
|
|
1423
|
-
placeholder: `Enter a ${ch?.name || "source chain"} refund address`,
|
|
1529
|
+
placeholder: ch && isEvmChain(ch.id) ? `Optional \u2014 defaults to ${UNIPORT_ENS_NAME}` : `Enter a ${ch?.name || "source chain"} refund address`,
|
|
1424
1530
|
spellCheck: false,
|
|
1425
1531
|
autoCapitalize: "off",
|
|
1426
1532
|
autoCorrect: "off",
|
|
@@ -1446,7 +1552,7 @@ function UniportModal({
|
|
|
1446
1552
|
color: t.textMuted,
|
|
1447
1553
|
lineHeight: 1.5
|
|
1448
1554
|
},
|
|
1449
|
-
children: "Used only if the swap fails. This address must live on the chain the payer is sending from."
|
|
1555
|
+
children: payment.isUsingDefaultRefundAddress ? `Used only if the swap fails. You can enter your own address, or leave blank to use Uniport's default (${UNIPORT_ENS_NAME}).` : "Used only if the swap fails. This address must live on the chain the payer is sending from."
|
|
1450
1556
|
}
|
|
1451
1557
|
)
|
|
1452
1558
|
] }),
|
|
@@ -1511,7 +1617,7 @@ function UniportModal({
|
|
|
1511
1617
|
] }) : "Confirm Payment"
|
|
1512
1618
|
}
|
|
1513
1619
|
),
|
|
1514
|
-
!payment.
|
|
1620
|
+
!payment.effectiveRefundAddress && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: { textAlign: "center", fontSize: "12px", color: t.error, margin: "10px 0 0" }, children: [
|
|
1515
1621
|
"Enter a refund address on ",
|
|
1516
1622
|
ch?.name || "the source chain",
|
|
1517
1623
|
" to continue."
|
|
@@ -1637,6 +1743,25 @@ function UniportModal({
|
|
|
1637
1743
|
] }) })
|
|
1638
1744
|
] });
|
|
1639
1745
|
};
|
|
1746
|
+
const renderTxHash = (hash, url) => url ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1747
|
+
"a",
|
|
1748
|
+
{
|
|
1749
|
+
href: url,
|
|
1750
|
+
target: "_blank",
|
|
1751
|
+
rel: "noopener noreferrer",
|
|
1752
|
+
style: { color: t.accent, fontSize: "12px", fontFamily: "monospace", textDecoration: "none" },
|
|
1753
|
+
children: [
|
|
1754
|
+
hash.slice(0, 12),
|
|
1755
|
+
"\u2026",
|
|
1756
|
+
hash.slice(-8),
|
|
1757
|
+
" \u2197"
|
|
1758
|
+
]
|
|
1759
|
+
}
|
|
1760
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { color: t.textSecondary, fontSize: "12px", fontFamily: "monospace" }, children: [
|
|
1761
|
+
hash.slice(0, 12),
|
|
1762
|
+
"\u2026",
|
|
1763
|
+
hash.slice(-8)
|
|
1764
|
+
] });
|
|
1640
1765
|
const renderSuccessStep = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
|
|
1641
1766
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1642
1767
|
"button",
|
|
@@ -1707,29 +1832,14 @@ function UniportModal({
|
|
|
1707
1832
|
"Source TX \xB7 ",
|
|
1708
1833
|
payment.selectedChain?.name
|
|
1709
1834
|
] }),
|
|
1710
|
-
|
|
1711
|
-
"a",
|
|
1712
|
-
{
|
|
1713
|
-
href: `https://etherscan.io/tx/${hash}`,
|
|
1714
|
-
target: "_blank",
|
|
1715
|
-
rel: "noopener noreferrer",
|
|
1716
|
-
style: { color: t.accent, fontSize: "12px", fontFamily: "monospace", textDecoration: "none" },
|
|
1717
|
-
children: [
|
|
1718
|
-
hash.slice(0, 12),
|
|
1719
|
-
"\u2026",
|
|
1720
|
-
hash.slice(-8),
|
|
1721
|
-
" \u2197"
|
|
1722
|
-
]
|
|
1723
|
-
}
|
|
1724
|
-
)
|
|
1835
|
+
renderTxHash(hash, payment.selectedChain ? getExplorerTxUrl(payment.selectedChain.id, hash) : void 0)
|
|
1725
1836
|
] }, `o${i}`)),
|
|
1726
1837
|
payment.status?.destinationTxHashes?.map((hash, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1727
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
] })
|
|
1838
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: { color: t.textMuted, fontSize: "11px", margin: "0 0 3px", textTransform: "uppercase", letterSpacing: "0.05em" }, children: [
|
|
1839
|
+
"Destination TX \xB7 ",
|
|
1840
|
+
CHAINS[payment.destinationToken.chain].name
|
|
1841
|
+
] }),
|
|
1842
|
+
renderTxHash(hash, getExplorerTxUrl(payment.destinationToken.chain, hash))
|
|
1733
1843
|
] }, `d${i}`)),
|
|
1734
1844
|
!payment.status?.originTxHashes?.length && !payment.status?.destinationTxHashes?.length && /* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: t.textMuted, fontSize: "13px", margin: 0 }, children: "Loading transaction details\u2026" })
|
|
1735
1845
|
] }),
|
|
@@ -1845,62 +1955,101 @@ function UniportModal({
|
|
|
1845
1955
|
portalRoot
|
|
1846
1956
|
);
|
|
1847
1957
|
}
|
|
1958
|
+
var sharedButtonStyle = {
|
|
1959
|
+
display: "inline-flex",
|
|
1960
|
+
alignItems: "center",
|
|
1961
|
+
justifyContent: "center",
|
|
1962
|
+
cursor: "pointer",
|
|
1963
|
+
transition: "all 0.2s ease",
|
|
1964
|
+
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1965
|
+
};
|
|
1848
1966
|
var buttonStyles = {
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
alignItems: "center",
|
|
1886
|
-
justifyContent: "center",
|
|
1887
|
-
gap: "8px",
|
|
1888
|
-
padding: "12px 24px",
|
|
1889
|
-
fontSize: "14px",
|
|
1890
|
-
fontWeight: 500,
|
|
1891
|
-
color: "#4F46E5",
|
|
1892
|
-
background: "transparent",
|
|
1893
|
-
border: "2px solid #4F46E5",
|
|
1894
|
-
borderRadius: "12px",
|
|
1895
|
-
cursor: "pointer",
|
|
1896
|
-
transition: "all 0.2s ease",
|
|
1897
|
-
fontFamily: "'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
|
|
1967
|
+
light: {
|
|
1968
|
+
default: {
|
|
1969
|
+
...sharedButtonStyle,
|
|
1970
|
+
gap: "8px",
|
|
1971
|
+
padding: "12px 24px",
|
|
1972
|
+
fontSize: "14px",
|
|
1973
|
+
fontWeight: 600,
|
|
1974
|
+
color: "#ffffff",
|
|
1975
|
+
background: "#1c1c1e",
|
|
1976
|
+
border: "1px solid #1c1c1e",
|
|
1977
|
+
borderRadius: "12px",
|
|
1978
|
+
boxShadow: "0 8px 24px rgba(28, 28, 30, 0.18)"
|
|
1979
|
+
},
|
|
1980
|
+
compact: {
|
|
1981
|
+
...sharedButtonStyle,
|
|
1982
|
+
gap: "6px",
|
|
1983
|
+
padding: "8px 16px",
|
|
1984
|
+
fontSize: "13px",
|
|
1985
|
+
fontWeight: 600,
|
|
1986
|
+
color: "#ffffff",
|
|
1987
|
+
background: "#1c1c1e",
|
|
1988
|
+
border: "1px solid #1c1c1e",
|
|
1989
|
+
borderRadius: "8px",
|
|
1990
|
+
boxShadow: "0 6px 18px rgba(28, 28, 30, 0.16)"
|
|
1991
|
+
},
|
|
1992
|
+
outline: {
|
|
1993
|
+
...sharedButtonStyle,
|
|
1994
|
+
gap: "8px",
|
|
1995
|
+
padding: "12px 24px",
|
|
1996
|
+
fontSize: "14px",
|
|
1997
|
+
fontWeight: 600,
|
|
1998
|
+
color: "#1c1c1e",
|
|
1999
|
+
background: "transparent",
|
|
2000
|
+
border: "1px solid #1c1c1e",
|
|
2001
|
+
borderRadius: "12px"
|
|
2002
|
+
}
|
|
1898
2003
|
},
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2004
|
+
dark: {
|
|
2005
|
+
default: {
|
|
2006
|
+
...sharedButtonStyle,
|
|
2007
|
+
gap: "8px",
|
|
2008
|
+
padding: "12px 24px",
|
|
2009
|
+
fontSize: "14px",
|
|
2010
|
+
fontWeight: 600,
|
|
2011
|
+
color: "#111113",
|
|
2012
|
+
background: "#ffffff",
|
|
2013
|
+
border: "1px solid rgba(255, 255, 255, 0.9)",
|
|
2014
|
+
borderRadius: "12px",
|
|
2015
|
+
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.32)"
|
|
2016
|
+
},
|
|
2017
|
+
compact: {
|
|
2018
|
+
...sharedButtonStyle,
|
|
2019
|
+
gap: "6px",
|
|
2020
|
+
padding: "8px 16px",
|
|
2021
|
+
fontSize: "13px",
|
|
2022
|
+
fontWeight: 600,
|
|
2023
|
+
color: "#111113",
|
|
2024
|
+
background: "#ffffff",
|
|
2025
|
+
border: "1px solid rgba(255, 255, 255, 0.9)",
|
|
2026
|
+
borderRadius: "8px",
|
|
2027
|
+
boxShadow: "0 6px 18px rgba(0, 0, 0, 0.28)"
|
|
2028
|
+
},
|
|
2029
|
+
outline: {
|
|
2030
|
+
...sharedButtonStyle,
|
|
2031
|
+
gap: "8px",
|
|
2032
|
+
padding: "12px 24px",
|
|
2033
|
+
fontSize: "14px",
|
|
2034
|
+
fontWeight: 600,
|
|
2035
|
+
color: "#ffffff",
|
|
2036
|
+
background: "transparent",
|
|
2037
|
+
border: "1px solid rgba(255, 255, 255, 0.72)",
|
|
2038
|
+
borderRadius: "12px"
|
|
2039
|
+
}
|
|
1902
2040
|
}
|
|
1903
2041
|
};
|
|
2042
|
+
var disabledButtonStyle = {
|
|
2043
|
+
opacity: 0.5,
|
|
2044
|
+
cursor: "not-allowed",
|
|
2045
|
+
boxShadow: "none"
|
|
2046
|
+
};
|
|
2047
|
+
function getButtonStyle(variant, theme, disabled) {
|
|
2048
|
+
return {
|
|
2049
|
+
...buttonStyles[theme][variant],
|
|
2050
|
+
...disabled ? disabledButtonStyle : {}
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
1904
2053
|
function UniportButton({
|
|
1905
2054
|
recipient,
|
|
1906
2055
|
refundAddress,
|
|
@@ -1926,10 +2075,7 @@ function UniportButton({
|
|
|
1926
2075
|
setIsOpen(false);
|
|
1927
2076
|
onOpenChange?.(false);
|
|
1928
2077
|
};
|
|
1929
|
-
const style =
|
|
1930
|
-
...buttonStyles[variant],
|
|
1931
|
-
...disabled ? buttonStyles.disabled : {}
|
|
1932
|
-
};
|
|
2078
|
+
const style = getButtonStyle(variant, theme, disabled);
|
|
1933
2079
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1934
2080
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1935
2081
|
"button",
|
|
@@ -2011,7 +2157,10 @@ exports.CHAINS = CHAINS;
|
|
|
2011
2157
|
exports.CHAIN_ICONS = CHAIN_ICONS;
|
|
2012
2158
|
exports.DEFAULT_HOSTED_BACKEND_URL = DEFAULT_HOSTED_BACKEND_URL;
|
|
2013
2159
|
exports.DEFAULT_REQUEST_TIMEOUT_MS = DEFAULT_REQUEST_TIMEOUT_MS;
|
|
2160
|
+
exports.EVM_CHAINS = EVM_CHAINS;
|
|
2014
2161
|
exports.TOKEN_ICONS = TOKEN_ICONS;
|
|
2162
|
+
exports.UNIPORT_ENS_NAME = UNIPORT_ENS_NAME;
|
|
2163
|
+
exports.UNIPORT_FALLBACK_REFUND_ADDRESS = UNIPORT_FALLBACK_REFUND_ADDRESS;
|
|
2015
2164
|
exports.UniportButton = UniportButton;
|
|
2016
2165
|
exports.UniportError = UniportError;
|
|
2017
2166
|
exports.UniportModal = UniportModal;
|
|
@@ -2052,12 +2201,15 @@ exports.ethereumWBTC = ethereumWBTC;
|
|
|
2052
2201
|
exports.fromSmallestUnits = fromSmallestUnits;
|
|
2053
2202
|
exports.generateDeadline = generateDeadline;
|
|
2054
2203
|
exports.getExecutionStatus = getExecutionStatus;
|
|
2204
|
+
exports.getExplorerTxUrl = getExplorerTxUrl;
|
|
2055
2205
|
exports.getQuote = getQuote;
|
|
2056
2206
|
exports.getSupportedChains = getSupportedChains;
|
|
2057
2207
|
exports.getToken = getToken;
|
|
2058
2208
|
exports.getTokenByAssetId = getTokenByAssetId;
|
|
2059
2209
|
exports.getTokensByChain = getTokensByChain;
|
|
2060
2210
|
exports.getUniportConfig = getUniportConfig;
|
|
2211
|
+
exports.getUniportDefaultRefundAddress = getUniportDefaultRefundAddress;
|
|
2212
|
+
exports.isEvmChain = isEvmChain;
|
|
2061
2213
|
exports.litecoinLTC = litecoinLTC;
|
|
2062
2214
|
exports.nearNEAR = nearNEAR;
|
|
2063
2215
|
exports.nearUSDC = nearUSDC;
|
|
@@ -2070,6 +2222,7 @@ exports.pollExecutionStatus = pollExecutionStatus;
|
|
|
2070
2222
|
exports.polygonPOL = polygonPOL;
|
|
2071
2223
|
exports.polygonUSDC = polygonUSDC;
|
|
2072
2224
|
exports.polygonUSDT = polygonUSDT;
|
|
2225
|
+
exports.resolveEnsName = resolveEnsName;
|
|
2073
2226
|
exports.rippleXRP = rippleXRP;
|
|
2074
2227
|
exports.solanaMELANIA = solanaMELANIA;
|
|
2075
2228
|
exports.solanaSOL = solanaSOL;
|