@openocean.finance/widget 1.0.41 → 1.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/App.js.map +1 -1
- package/dist/esm/AppDrawer.style.d.ts +1 -1
- package/dist/esm/components/ActiveTransactions/ActiveTransactions.style.d.ts +2 -2
- package/dist/esm/components/AmountInput/AmountInput.style.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -1
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +37 -33
- package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.style.d.ts +1 -1
- package/dist/esm/components/Avatar/SmallAvatar.d.ts +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js +1 -1
- package/dist/esm/components/BaseTransactionButton/BaseTransactionButton.js.map +1 -1
- package/dist/esm/components/ButtonTertiary.d.ts +1 -1
- package/dist/esm/components/Card/CardHeader.d.ts +1 -1
- package/dist/esm/components/Card/CardIconButton.d.ts +1 -1
- package/dist/esm/components/ContractComponent/NFT/NFT.style.d.ts +1 -1
- package/dist/esm/components/Header/Header.style.d.ts +2 -2
- package/dist/esm/components/Header/SettingsButton.style.d.ts +2 -2
- package/dist/esm/components/ListItem/ListItem.d.ts +1 -1
- package/dist/esm/components/Messages/WarningMessages.js +1 -0
- package/dist/esm/components/Messages/WarningMessages.js.map +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
- package/dist/esm/components/Search/SearchInput.style.d.ts +1 -1
- package/dist/esm/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
- package/dist/esm/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/dist/esm/components/Skeleton/WidgetSkeleton.style.d.ts +2 -2
- package/dist/esm/components/StepActions/StepActions.style.d.ts +1 -1
- package/dist/esm/components/Tabs/Tabs.style.d.ts +2 -2
- package/dist/esm/components/TokenList/TokenList.style.d.ts +2 -2
- package/dist/esm/components/TransactionDetails.js +1 -1
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/defaultChainIds.js +3 -0
- package/dist/esm/config/defaultChainIds.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/cross/adapters/AcrossAdapter.js +21 -22
- package/dist/esm/cross/adapters/AcrossAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/BaseSwapAdapter.d.ts +17 -9
- package/dist/esm/cross/adapters/BaseSwapAdapter.js +15 -4
- package/dist/esm/cross/adapters/BaseSwapAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/DebridgeAdapter.js +8 -7
- package/dist/esm/cross/adapters/DebridgeAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/LifiAdapter.js +7 -6
- package/dist/esm/cross/adapters/LifiAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/MayanAdapter.js +1 -2
- package/dist/esm/cross/adapters/MayanAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/NearIntentsAdapter.d.ts +13 -6
- package/dist/esm/cross/adapters/NearIntentsAdapter.js +252 -75
- package/dist/esm/cross/adapters/NearIntentsAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/OptimexAdapter.js +2 -1
- package/dist/esm/cross/adapters/OptimexAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/OrbiterAdapter.js +9 -8
- package/dist/esm/cross/adapters/OrbiterAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/RelayAdapter.js +46 -15
- package/dist/esm/cross/adapters/RelayAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/SymbiosisAdapter.js +13 -14
- package/dist/esm/cross/adapters/SymbiosisAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/XYFinanceAdapter.js +13 -17
- package/dist/esm/cross/adapters/XYFinanceAdapter.js.map +1 -1
- package/dist/esm/cross/adapters/index.d.ts +2 -0
- package/dist/esm/cross/adapters/index.js +2 -1
- package/dist/esm/cross/adapters/index.js.map +1 -1
- package/dist/esm/cross/constants/index.d.ts +3 -1
- package/dist/esm/cross/constants/index.js +2 -0
- package/dist/esm/cross/constants/index.js.map +1 -1
- package/dist/esm/cross/crossChainQuote.d.ts +1 -1
- package/dist/esm/cross/crossChainQuote.js +22 -12
- package/dist/esm/cross/crossChainQuote.js.map +1 -1
- package/dist/esm/cross/factory.d.ts +3 -1
- package/dist/esm/cross/factory.js +10 -12
- package/dist/esm/cross/factory.js.map +1 -1
- package/dist/esm/cross/registry.d.ts +1 -1
- package/dist/esm/hooks/useAvailableChains.js +47 -40
- package/dist/esm/hooks/useAvailableChains.js.map +1 -1
- package/dist/esm/hooks/useChains.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +11 -3
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/dist/esm/hooks/useTokens.d.ts +1 -0
- package/dist/esm/hooks/useTokens.js +14 -0
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pages/MainPage/MainPage.js +1 -2
- package/dist/esm/pages/MainPage/MainPage.js.map +1 -1
- package/dist/esm/pages/MainPage/MainWarningMessages.js.map +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js +1 -1
- package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +2 -2
- package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +2 -2
- package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
- package/dist/esm/pages/SendToWallet/SendToWalletPage.style.d.ts +4 -4
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCard.style.d.ts +1 -1
- package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
- package/dist/esm/services/ExecuteRoute.js +218 -9
- package/dist/esm/services/ExecuteRoute.js.map +1 -1
- package/dist/esm/services/OpenOceanService.js +30 -4
- package/dist/esm/services/OpenOceanService.js.map +1 -1
- package/dist/esm/stores/bookmarks/createBookmarkStore.js.map +1 -1
- package/dist/esm/utils/chainType.d.ts +1 -0
- package/dist/esm/utils/chainType.js +15 -0
- package/dist/esm/utils/chainType.js.map +1 -1
- package/dist/esm/utils/getPriceImpact.js +3 -3
- package/dist/esm/utils/getPriceImpact.js.map +1 -1
- package/package.json +18 -6
- package/src/App.tsx +0 -1
- package/src/components/AmountInput/AmountInputEndAdornment.tsx +39 -34
- package/src/components/BaseTransactionButton/BaseTransactionButton.tsx +3 -2
- package/src/components/Messages/WarningMessages.tsx +1 -0
- package/src/components/Messages/useMessageQueue.ts +1 -1
- package/src/components/TransactionDetails.tsx +4 -4
- package/src/config/defaultChainIds.ts +3 -0
- package/src/config/version.ts +1 -1
- package/src/cross/adapters/AcrossAdapter.ts +21 -22
- package/src/cross/adapters/BaseSwapAdapter.ts +24 -8
- package/src/cross/adapters/DebridgeAdapter.ts +11 -11
- package/src/cross/adapters/LifiAdapter.ts +11 -10
- package/src/cross/adapters/MayanAdapter.ts +1 -2
- package/src/cross/adapters/NearIntentsAdapter.ts +303 -129
- package/src/cross/adapters/OptimexAdapter.ts +12 -11
- package/src/cross/adapters/OrbiterAdapter.ts +17 -16
- package/src/cross/adapters/RelayAdapter.ts +50 -17
- package/src/cross/adapters/SymbiosisAdapter.ts +13 -14
- package/src/cross/adapters/XYFinanceAdapter.ts +15 -19
- package/src/cross/adapters/index.ts +2 -1
- package/src/cross/constants/index.ts +4 -0
- package/src/cross/crossChainQuote.ts +27 -21
- package/src/cross/factory.ts +12 -12
- package/src/cross/registry.ts +1 -1
- package/src/hooks/useAvailableChains.ts +50 -43
- package/src/hooks/useChains.ts +0 -1
- package/src/hooks/useExplorer.ts +6 -6
- package/src/hooks/useRoutes.ts +12 -4
- package/src/hooks/useTokenAddressBalance.ts +1 -1
- package/src/hooks/useTokens.ts +20 -5
- package/src/index.ts +0 -1
- package/src/pages/MainPage/MainPage.tsx +1 -1
- package/src/pages/MainPage/MainWarningMessages.tsx +0 -1
- package/src/pages/SendToWallet/BookmarksPage.tsx +1 -1
- package/src/pages/SendToWallet/RecentWalletsPage.tsx +2 -2
- package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +2 -2
- package/src/providers/WidgetProvider/WidgetProvider.tsx +0 -1
- package/src/services/ExecuteRoute.ts +315 -64
- package/src/services/OpenOceanService.ts +31 -7
- package/src/stores/bookmarks/createBookmarkStore.ts +15 -15
- package/src/utils/chainType.ts +25 -1
- package/src/utils/getPriceImpact.ts +3 -3
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ExtendedChain } from '@openocean.finance/widget-sdk'
|
|
2
|
-
import { ChainType, config, getChains } from '@openocean.finance/widget-sdk'
|
|
2
|
+
import { ChainType, CoinKey, ChainKey, config, getChains } from '@openocean.finance/widget-sdk'
|
|
3
|
+
// import type { ChainKey, CoinKey } from '@openocean.finance/widget-types'
|
|
3
4
|
import { useQuery } from '@tanstack/react-query'
|
|
4
5
|
import { useCallback } from 'react'
|
|
5
6
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
6
7
|
import { isItemAllowed } from '../utils/item.js'
|
|
7
|
-
import { CoinKey } from '../index.js'
|
|
8
8
|
import { DEFAULT_CHAIN_IDS } from '../config/defaultChainIds.js';
|
|
9
9
|
|
|
10
10
|
export type GetChainById = (
|
|
@@ -39,6 +39,53 @@ export const useAvailableChains = (chainTypes?: ChainType[]) => {
|
|
|
39
39
|
solanaChain.chainType = ChainType.SVM;
|
|
40
40
|
solanaChain.id = 1151111081099710;
|
|
41
41
|
}
|
|
42
|
+
const nearChain = availableChains.find((chain) => chain.key === 'near')
|
|
43
|
+
if (nearChain) {
|
|
44
|
+
nearChain.chainType = ChainType.NVM;
|
|
45
|
+
nearChain.id = 20000000000006;
|
|
46
|
+
}
|
|
47
|
+
availableChains.push({
|
|
48
|
+
key: 'btc' as ChainKey.BTC,
|
|
49
|
+
chainType: 'UTXO' as ChainType,
|
|
50
|
+
name: 'Bitcoin',
|
|
51
|
+
coin: 'BTC' as CoinKey.BTC as CoinKey,
|
|
52
|
+
id: 20000000000001,
|
|
53
|
+
mainnet: true,
|
|
54
|
+
logoURI: 'https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/bitcoin.svg',
|
|
55
|
+
tokenlistUrl: '',
|
|
56
|
+
multicallAddress: '',
|
|
57
|
+
relayerSupported: false,
|
|
58
|
+
metamask: {
|
|
59
|
+
"chainId": "20000000000001",
|
|
60
|
+
"blockExplorerUrls": [
|
|
61
|
+
"https://mempool.space/",
|
|
62
|
+
"https://blockchair.com/bitcoin/"
|
|
63
|
+
],
|
|
64
|
+
"chainName": "Bitcoin",
|
|
65
|
+
"nativeCurrency": {
|
|
66
|
+
"name": "BTC",
|
|
67
|
+
"symbol": "BTC",
|
|
68
|
+
"decimals": 8
|
|
69
|
+
},
|
|
70
|
+
"rpcUrls": [
|
|
71
|
+
"https://node-router.thorswap.net/bitcoin",
|
|
72
|
+
"https://rpc.ankr.com/btc",
|
|
73
|
+
"https://bitcoin-rpc.publicnode.com"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
nativeToken: {
|
|
77
|
+
address: "bitcoin",
|
|
78
|
+
chainId: 20000000000001,
|
|
79
|
+
symbol: "BTC",
|
|
80
|
+
decimals: 8,
|
|
81
|
+
name: "Bitcoin",
|
|
82
|
+
logoURI: "https://assets.coingecko.com/coins/images/1/standard/bitcoin.png",
|
|
83
|
+
priceUSD: "88366"
|
|
84
|
+
},
|
|
85
|
+
permit2: '',
|
|
86
|
+
permit2Proxy: '',
|
|
87
|
+
})
|
|
88
|
+
|
|
42
89
|
// allow chains "starknet","aptos","near","ont","sui",
|
|
43
90
|
const allowedChainsIds = chains?.allow?.length ? chains.allow : DEFAULT_CHAIN_IDS;
|
|
44
91
|
const allowedChains = availableChains.filter((chain) => {
|
|
@@ -47,46 +94,7 @@ export const useAvailableChains = (chainTypes?: ChainType[]) => {
|
|
|
47
94
|
}
|
|
48
95
|
return false
|
|
49
96
|
})
|
|
50
|
-
|
|
51
|
-
allowedChains.push({
|
|
52
|
-
"key":"eth",
|
|
53
|
-
"chainType":ChainType.EVM,
|
|
54
|
-
"name":"Ethereum",
|
|
55
|
-
"coin":CoinKey.WETH,
|
|
56
|
-
"id":1,
|
|
57
|
-
"mainnet":true,
|
|
58
|
-
"logoURI":"https://raw.githubusercontent.com/lifinance/types/main/src/assets/icons/chains/ethereum.svg",
|
|
59
|
-
"tokenlistUrl":"https://gateway.ipfs.io/ipns/tokens.uniswap.org",
|
|
60
|
-
"multicallAddress":"0xcA11bde05977b3631167028862bE2a173976CA11",
|
|
61
|
-
"relayerSupported":false,
|
|
62
|
-
"metamask":{
|
|
63
|
-
"chainId":"0x1",
|
|
64
|
-
"blockExplorerUrls":["https://etherscan.io/"],
|
|
65
|
-
"chainName":"Ethereum Mainnet",
|
|
66
|
-
"nativeCurrency":{
|
|
67
|
-
"name":"ETH",
|
|
68
|
-
"symbol":"ETH",
|
|
69
|
-
"decimals":18
|
|
70
|
-
},
|
|
71
|
-
"rpcUrls":[
|
|
72
|
-
"https://ethereum-rpc.publicnode.com",
|
|
73
|
-
"https://eth.drpc.org"
|
|
74
|
-
]
|
|
75
|
-
},
|
|
76
|
-
"nativeToken":{
|
|
77
|
-
"address":"0x0000000000000000000000000000000000000000",
|
|
78
|
-
"chainId":1,"symbol":
|
|
79
|
-
"ETH","decimals":18,
|
|
80
|
-
"name":"ETH",
|
|
81
|
-
"coinKey":"ETH",
|
|
82
|
-
"logoURI":"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
|
|
83
|
-
"priceUSD":"3804.11"
|
|
84
|
-
},
|
|
85
|
-
"diamondAddress":"0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
|
|
86
|
-
"permit2":"0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
87
|
-
"permit2Proxy":"0x89c6340B1a1f4b25D36cd8B063D49045caF3f818"
|
|
88
|
-
})
|
|
89
|
-
*/
|
|
97
|
+
|
|
90
98
|
config.setChains(allowedChains)
|
|
91
99
|
return allowedChains
|
|
92
100
|
},
|
|
@@ -104,7 +112,6 @@ export const useAvailableChains = (chainTypes?: ChainType[]) => {
|
|
|
104
112
|
},
|
|
105
113
|
[data]
|
|
106
114
|
)
|
|
107
|
-
|
|
108
115
|
return {
|
|
109
116
|
chains: data,
|
|
110
117
|
getChainById,
|
package/src/hooks/useChains.ts
CHANGED
|
@@ -25,7 +25,6 @@ export const useChains = (type?: FormType, chainTypes?: ChainType[]) => {
|
|
|
25
25
|
: availableChains?.filter((chain) => isItemAllowed(chain.id, chains))
|
|
26
26
|
return filteredChains
|
|
27
27
|
}, [availableChains, chainTypes, chains, type])
|
|
28
|
-
|
|
29
28
|
return {
|
|
30
29
|
chains: filteredChains,
|
|
31
30
|
getChainById,
|
package/src/hooks/useExplorer.ts
CHANGED
|
@@ -6,13 +6,13 @@ const sanitiseBaseUrl = (baseUrl: string) => baseUrl.trim().replace(/\/+$/, '')
|
|
|
6
6
|
|
|
7
7
|
export type TransactionLinkProps = { chain?: Chain | number } & (
|
|
8
8
|
| {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
txHash: string
|
|
10
|
+
txLink?: never
|
|
11
|
+
}
|
|
12
12
|
| {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
txHash?: never
|
|
14
|
+
txLink: string
|
|
15
|
+
}
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
export const useExplorer = () => {
|
package/src/hooks/useRoutes.ts
CHANGED
|
@@ -94,7 +94,7 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
94
94
|
|
|
95
95
|
const toAddress =
|
|
96
96
|
fromChainId === toChainId ||
|
|
97
|
-
|
|
97
|
+
(fromChain?.chainType === 'EVM' && toChain?.chainType === 'EVM')
|
|
98
98
|
? account.address
|
|
99
99
|
: _toAddress
|
|
100
100
|
// When bridging between ecosystems, we need to ensure toAddress is set and has the same chainType as toChain
|
|
@@ -197,6 +197,7 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
197
197
|
name: fromToken.name,
|
|
198
198
|
icon: fromToken.logoURI,
|
|
199
199
|
chainId: fromChainId,
|
|
200
|
+
isNative: fromToken.isNative,
|
|
200
201
|
}
|
|
201
202
|
const toMsg = {
|
|
202
203
|
address: toTokenAddress,
|
|
@@ -205,6 +206,7 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
205
206
|
name: toToken.name,
|
|
206
207
|
icon: toToken.logoURI,
|
|
207
208
|
chainId: toChainId,
|
|
209
|
+
isNative: toToken.isNative,
|
|
208
210
|
}
|
|
209
211
|
|
|
210
212
|
// Get appropriate wallet client based on chain type
|
|
@@ -244,7 +246,12 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
244
246
|
// })
|
|
245
247
|
// Add a flag or modify structure to indicate it's a Debridge route
|
|
246
248
|
if (quoteResult) {
|
|
247
|
-
quoteResult.
|
|
249
|
+
if (quoteResult.error) {
|
|
250
|
+
throw new Error(quoteResult.error)
|
|
251
|
+
}
|
|
252
|
+
if (quoteResult.data) {
|
|
253
|
+
quoteResult.isBridge = true
|
|
254
|
+
}
|
|
248
255
|
}
|
|
249
256
|
} else {
|
|
250
257
|
console.warn(
|
|
@@ -394,7 +401,8 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
394
401
|
return routes
|
|
395
402
|
} catch (error) {
|
|
396
403
|
console.error('Failed to fetch OpenOcean routes:', error)
|
|
397
|
-
|
|
404
|
+
useServerErrorStore.getState().setError((error as Error).message)
|
|
405
|
+
// throw new Error((error as Error).message)
|
|
398
406
|
}
|
|
399
407
|
},
|
|
400
408
|
enabled: isEnabled,
|
|
@@ -415,7 +423,7 @@ export const useRoutes = ({ observableRoute }: RoutesProps = {}) => {
|
|
|
415
423
|
if (error?.code === OpenOceanErrorCode.NotFound) {
|
|
416
424
|
return false
|
|
417
425
|
}
|
|
418
|
-
return
|
|
426
|
+
return false
|
|
419
427
|
},
|
|
420
428
|
})
|
|
421
429
|
|
|
@@ -12,7 +12,7 @@ export const useTokenAddressBalance = (
|
|
|
12
12
|
const token = useMemo(() => {
|
|
13
13
|
if (tokenAddress && chainId) {
|
|
14
14
|
const token = (tokensWithBalance ?? tokens)?.find(
|
|
15
|
-
(token) => token.address === tokenAddress && token.chainId === chainId
|
|
15
|
+
(token: any) => token.address === tokenAddress && token.chainId === chainId
|
|
16
16
|
)
|
|
17
17
|
return token as TokenAmount
|
|
18
18
|
}
|
package/src/hooks/useTokens.ts
CHANGED
|
@@ -5,6 +5,16 @@ import { OpenOceanService } from '../services/OpenOceanService.js'
|
|
|
5
5
|
import type { TokenAmount } from '../types/token.js'
|
|
6
6
|
import { useChains } from './useChains.js'
|
|
7
7
|
|
|
8
|
+
export const isNativeToken = (token: string) => {
|
|
9
|
+
return [
|
|
10
|
+
'0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
11
|
+
'0x0000000000000000000000000000000000001010',
|
|
12
|
+
'0x0000000000000000000000000000000000000000',
|
|
13
|
+
'0x1',
|
|
14
|
+
"bitcoin",
|
|
15
|
+
].indexOf(token.toLowerCase()) >= 0;
|
|
16
|
+
};
|
|
17
|
+
|
|
8
18
|
export const useTokens = (selectedChainId?: number) => {
|
|
9
19
|
const { tokens: configTokens } = useWidgetConfig()
|
|
10
20
|
const { data, isLoading } = useQuery({
|
|
@@ -16,6 +26,11 @@ export const useTokens = (selectedChainId?: number) => {
|
|
|
16
26
|
const tokens = await OpenOceanService.getTokenList(
|
|
17
27
|
selectedChainId.toString()
|
|
18
28
|
)
|
|
29
|
+
tokens.forEach((token: any) => {
|
|
30
|
+
if (!(token as any).isNative) {
|
|
31
|
+
(token as any).isNative = isNativeToken(token.address)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
19
34
|
return {
|
|
20
35
|
tokens: {
|
|
21
36
|
[selectedChainId]: tokens,
|
|
@@ -64,14 +79,14 @@ export const useTokens = (selectedChainId?: number) => {
|
|
|
64
79
|
|
|
65
80
|
if (allowedTokensSet.size || deniedTokenAddressesSet.size) {
|
|
66
81
|
filteredTokens = filteredTokens.filter(
|
|
67
|
-
(token) =>
|
|
82
|
+
(token: any) =>
|
|
68
83
|
(!allowedTokensSet.size || allowedTokensSet.has(token.address)) &&
|
|
69
84
|
!deniedTokenAddressesSet.has(token.address)
|
|
70
85
|
)
|
|
71
86
|
}
|
|
72
87
|
}
|
|
73
88
|
const filteredTokensMap = new Map(
|
|
74
|
-
filteredTokens.map((token) => [token.address, token])
|
|
89
|
+
filteredTokens.map((token: any) => [token.address, token])
|
|
75
90
|
)
|
|
76
91
|
|
|
77
92
|
const [popularTokens, featuredTokens] = (
|
|
@@ -83,7 +98,7 @@ export const useTokens = (selectedChainId?: number) => {
|
|
|
83
98
|
|
|
84
99
|
const populatedConfigTokens = typedConfigTokens?.map((token) => {
|
|
85
100
|
// Mark token as popular
|
|
86
|
-
token[tokenType] = true
|
|
101
|
+
(token as any)[tokenType] = true
|
|
87
102
|
// Check if this token exists in the filteredTokensMap and add priceUSD if it does
|
|
88
103
|
const matchingFilteredToken = filteredTokensMap.get(token.address)
|
|
89
104
|
if ((matchingFilteredToken as any)?.priceUSD) {
|
|
@@ -97,10 +112,10 @@ export const useTokens = (selectedChainId?: number) => {
|
|
|
97
112
|
|
|
98
113
|
if (populatedConfigTokens?.length) {
|
|
99
114
|
const configTokenAddresses = new Set(
|
|
100
|
-
populatedConfigTokens?.map((token) => token.address)
|
|
115
|
+
populatedConfigTokens?.map((token: any) => token.address)
|
|
101
116
|
)
|
|
102
117
|
filteredTokens = filteredTokens.filter(
|
|
103
|
-
(token) => !configTokenAddresses.has(token.address)
|
|
118
|
+
(token: any) => !configTokenAddresses.has(token.address)
|
|
104
119
|
)
|
|
105
120
|
populatedConfigTokens.push(...filteredTokens)
|
|
106
121
|
filteredTokens = populatedConfigTokens
|
package/src/index.ts
CHANGED
|
@@ -54,7 +54,7 @@ export const MainPage: React.FC = () => {
|
|
|
54
54
|
) : null} */}
|
|
55
55
|
{/* {!wideVariant ? <Routes sx={marginSx} /> : null} */}
|
|
56
56
|
{subvariantState === 'bridge' && <SendToWalletButton sx={marginSx} />}
|
|
57
|
-
<GasRefuelMessage mb={2} />
|
|
57
|
+
{/* <GasRefuelMessage mb={2} /> */}
|
|
58
58
|
<MainWarningMessages route={routes?.[0]} mb={2} />
|
|
59
59
|
{/*<Box
|
|
60
60
|
sx={{
|
|
@@ -99,7 +99,7 @@ export const RecentWalletsPage = () => {
|
|
|
99
99
|
window.open(
|
|
100
100
|
getAddressLink(
|
|
101
101
|
selectedRecent.address,
|
|
102
|
-
defaultChainIdsByType[selectedRecent.chainType]
|
|
102
|
+
defaultChainIdsByType[selectedRecent.chainType || '']
|
|
103
103
|
),
|
|
104
104
|
'_blank'
|
|
105
105
|
)
|
|
@@ -136,7 +136,7 @@ export const RecentWalletsPage = () => {
|
|
|
136
136
|
>
|
|
137
137
|
<ListItemAvatar>
|
|
138
138
|
<AccountAvatar
|
|
139
|
-
chainId={defaultChainIdsByType[recentWallet.chainType]}
|
|
139
|
+
chainId={defaultChainIdsByType[recentWallet.chainType || '']}
|
|
140
140
|
/>
|
|
141
141
|
</ListItemAvatar>
|
|
142
142
|
<ListItemText
|
|
@@ -71,7 +71,7 @@ export const SendToConfiguredWalletPage = () => {
|
|
|
71
71
|
window.open(
|
|
72
72
|
getAddressLink(
|
|
73
73
|
selectedToAddress.address,
|
|
74
|
-
defaultChainIdsByType[selectedToAddress.chainType]
|
|
74
|
+
defaultChainIdsByType[selectedToAddress.chainType || '']
|
|
75
75
|
),
|
|
76
76
|
'_blank'
|
|
77
77
|
)
|
|
@@ -93,7 +93,7 @@ export const SendToConfiguredWalletPage = () => {
|
|
|
93
93
|
>
|
|
94
94
|
<ListItemAvatar>
|
|
95
95
|
<AccountAvatar
|
|
96
|
-
chainId={defaultChainIdsByType[toAddress.chainType]}
|
|
96
|
+
chainId={defaultChainIdsByType[toAddress.chainType || '']}
|
|
97
97
|
toAddress={toAddress}
|
|
98
98
|
/>
|
|
99
99
|
</ListItemAvatar>
|