@uniswap/token-list-bridge-utils 2.11.0 → 2.12.0
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/constants/chainId.d.ts +2 -1
- package/dist/providers/MonadMappingProvider.d.ts +5 -0
- package/dist/token-list-bridge-utils.cjs.development.js +64 -5
- package/dist/token-list-bridge-utils.cjs.development.js.map +1 -1
- package/dist/token-list-bridge-utils.cjs.production.min.js +1 -1
- package/dist/token-list-bridge-utils.cjs.production.min.js.map +1 -1
- package/dist/token-list-bridge-utils.esm.js +64 -5
- package/dist/token-list-bridge-utils.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/constants/chainId.ts +2 -0
- package/src/index.ts +1 -0
- package/src/local_mappings/monad.json +22 -0
- package/src/providers/MonadMappingProvider.ts +11 -0
- package/src/providers/index.ts +5 -1
- package/src/utils.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"0xdac17f958d2ee523a2206206994597c13d831ec7": {
|
|
3
|
+
"childToken": "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
|
|
4
|
+
"decimals": 6
|
|
5
|
+
},
|
|
6
|
+
"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599": {
|
|
7
|
+
"childToken": "0x0555E30da8f98308EdB960aa94C0Db47230d2B9c",
|
|
8
|
+
"decimals": 8
|
|
9
|
+
},
|
|
10
|
+
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2": {
|
|
11
|
+
"childToken": "0xEE8c0E9f1BFFb4Eb878d8f15f368A02a35481242",
|
|
12
|
+
"decimals": 18
|
|
13
|
+
},
|
|
14
|
+
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
|
|
15
|
+
"childToken": "0x754704Bc059F8C67012fEd69BC8A327a5aafb603",
|
|
16
|
+
"decimals": 6
|
|
17
|
+
},
|
|
18
|
+
"0xd31a59c85ae9d8edefec411d448f90841571b89c": {
|
|
19
|
+
"childToken": "0xea17E5a9efEBf1477dB45082d67010E2245217f1",
|
|
20
|
+
"decimals": 9
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MappingProvider } from './MappingProvider'
|
|
2
|
+
import { MappedTokenData } from '../constants/types'
|
|
3
|
+
import monadMappings from '../local_mappings/monad.json'
|
|
4
|
+
|
|
5
|
+
// we use a local source of mappings for monad
|
|
6
|
+
export class MonadMappingProvider implements MappingProvider {
|
|
7
|
+
async provide(): Promise<MappedTokenData> {
|
|
8
|
+
const tokens = monadMappings as MappedTokenData
|
|
9
|
+
return tokens
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/providers/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { OptimismMappingProvider } from './OptimismMappingProvider'
|
|
|
5
5
|
import { PolygonMappingProvider } from './PolygonMappingProvider'
|
|
6
6
|
import { BnbMappingProvider } from './BnbMappingProvider'
|
|
7
7
|
import { UnichainMappingProvider } from './UnichainMappingProvider'
|
|
8
|
+
import { MonadMappingProvider } from './MonadMappingProvider'
|
|
8
9
|
import { TokenInfo, TokenList } from '@uniswap/token-lists'
|
|
9
10
|
import { ethers } from 'ethers'
|
|
10
11
|
import {
|
|
@@ -40,6 +41,7 @@ const CHAINS_WITH_MAPPING_PROVIDERS = [
|
|
|
40
41
|
ChainId.BASE,
|
|
41
42
|
ChainId.UNICHAIN,
|
|
42
43
|
ChainId.SONEIUM,
|
|
44
|
+
ChainId.MONAD,
|
|
43
45
|
]
|
|
44
46
|
|
|
45
47
|
export async function buildList(
|
|
@@ -184,6 +186,8 @@ function getMappingProvider(chainId: ChainId, l1TokenList: TokenList) {
|
|
|
184
186
|
return new UnichainMappingProvider()
|
|
185
187
|
case ChainId.SONEIUM:
|
|
186
188
|
return new SoneiumMappingProvider()
|
|
189
|
+
case ChainId.MONAD:
|
|
190
|
+
return new MonadMappingProvider()
|
|
187
191
|
default:
|
|
188
192
|
throw new Error(`Chain ${chainId} not supported for fetching mappings.`)
|
|
189
193
|
}
|
|
@@ -251,7 +255,7 @@ async function getChildTokenDetails(
|
|
|
251
255
|
: undefined
|
|
252
256
|
const childTokenValid = Boolean(
|
|
253
257
|
childTokenAddress &&
|
|
254
|
-
(chainId === ChainId.UNICHAIN // barring a unichain rpc url, we skip the contract call. Since we're using a manually curated list of tokens, we can assume they exist.
|
|
258
|
+
(chainId === ChainId.UNICHAIN || chainId === ChainId.MONAD // barring a unichain/monad rpc url, we skip the contract call. Since we're using a manually curated list of tokens, we can assume they exist.
|
|
255
259
|
? true
|
|
256
260
|
: await hasExistingTokenContract(childTokenAddress, chainId))
|
|
257
261
|
)
|
package/src/utils.ts
CHANGED
|
@@ -97,7 +97,7 @@ export function getRpcUrl(chainId: ChainId): string {
|
|
|
97
97
|
case ChainId.MAINNET:
|
|
98
98
|
return 'https://ethereum-rpc.publicnode.com'
|
|
99
99
|
case ChainId.OPTIMISM:
|
|
100
|
-
return 'https://
|
|
100
|
+
return 'https://mainnet.optimism.io'
|
|
101
101
|
case ChainId.OPTIMISTIC_KOVAN:
|
|
102
102
|
return 'https://kovan.optimism.io'
|
|
103
103
|
case ChainId.ARBITRUM_ONE:
|