@uniswap/token-list-bridge-utils 1.1.1 → 1.2.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/constants/tokens.d.ts +1 -0
- package/dist/fixtures/index.d.ts +9 -0
- package/dist/providers/BnbMappingProvider.d.ts +5 -0
- package/dist/token-list-bridge-utils.cjs.development.js +902 -2
- 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 +902 -2
- package/dist/token-list-bridge-utils.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/chainId.ts +1 -0
- package/src/constants/tokens.ts +8 -0
- package/src/fixtures/index.ts +31 -0
- package/src/index.test.ts +28 -0
- package/src/index.ts +1 -0
- package/src/local_mappings/bnb.json +859 -0
- package/src/providers/BnbMappingProvider.ts +11 -0
- package/src/providers/index.ts +4 -0
- package/src/utils.ts +2 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MappingProvider } from './MappingProvider'
|
|
2
|
+
import { GenericMappedTokenData } from '../constants/types'
|
|
3
|
+
import bnbmappings from '../local_mappings/bnb.json'
|
|
4
|
+
|
|
5
|
+
// barring a better external source, we use a local source of mappings for bnb
|
|
6
|
+
export class BnbMappingProvider implements MappingProvider {
|
|
7
|
+
async provide(): Promise<GenericMappedTokenData> {
|
|
8
|
+
const tokens = bnbmappings as GenericMappedTokenData
|
|
9
|
+
return tokens
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/providers/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Contract } from 'web3-eth-contract'
|
|
|
3
3
|
import { ArbitrumMappingProvider } from './ArbitrumMappingProvider'
|
|
4
4
|
import { OptimismMappingProvider } from './OptimismMappingProvider'
|
|
5
5
|
import { PolygonMappingProvider } from './PolygonMappingProvider'
|
|
6
|
+
import { BnbMappingProvider } from './BnbMappingProvider'
|
|
6
7
|
import { TokenInfo, TokenList } from '@uniswap/token-lists'
|
|
7
8
|
import { ethers } from 'ethers'
|
|
8
9
|
import {
|
|
@@ -25,6 +26,7 @@ const SUPPORTED_L2_CHAINS = [
|
|
|
25
26
|
ChainId.ARBITRUM_ONE,
|
|
26
27
|
ChainId.POLYGON,
|
|
27
28
|
ChainId.OPTIMISM,
|
|
29
|
+
ChainId.BNB,
|
|
28
30
|
]
|
|
29
31
|
|
|
30
32
|
export async function buildList(
|
|
@@ -136,6 +138,8 @@ function getMappingProvider(chainId: ChainId, l1TokenList: TokenList) {
|
|
|
136
138
|
return new OptimismMappingProvider()
|
|
137
139
|
case ChainId.POLYGON:
|
|
138
140
|
return new PolygonMappingProvider()
|
|
141
|
+
case ChainId.BNB:
|
|
142
|
+
return new BnbMappingProvider()
|
|
139
143
|
default:
|
|
140
144
|
throw new Error(`Chain ${chainId} not supported for fetching mappings.`)
|
|
141
145
|
}
|
package/src/utils.ts
CHANGED
|
@@ -108,6 +108,8 @@ export function getRpcUrl(chainId: ChainId): string {
|
|
|
108
108
|
return 'https://polygon-rpc.com/'
|
|
109
109
|
case ChainId.POLYGON_MUMBAI:
|
|
110
110
|
return 'https://rpc-endpoints.superfluid.dev/mumbai'
|
|
111
|
+
case ChainId.BNB:
|
|
112
|
+
return 'https://bsc-dataseed1.binance.org'
|
|
111
113
|
default:
|
|
112
114
|
}
|
|
113
115
|
throw new Error('Unsupported ChainId')
|