@uniswap/token-list-bridge-utils 3.0.0 → 3.0.1

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.
@@ -1,38 +1,10 @@
1
- import axios from 'axios'
2
1
  import { MappingProvider } from './MappingProvider'
3
- import {
4
- PolygonMappedTokenData,
5
- PolygonTokenListResponse,
6
- PolygonWrappedToken,
7
- } from '../constants/types'
2
+ import { PolygonMappedTokenData } from '../constants/types'
3
+ import polygonMappings from '../local_mappings/polygon.json'
8
4
 
9
- const url =
10
- 'https://api-polygon-tokens.polygon.technology/tokenlists/mapped.tokenlist.json'
11
-
12
- const POS_BRIDGE_TAG = 'pos'
13
-
14
- /**
15
- *
16
- * This provider provides the l1->l2(Polygon) token mappings.
17
- */
5
+ // Polygon shut down its mapped token list API, so we use a snapshot of its PoS mappings
18
6
  export class PolygonMappingProvider implements MappingProvider {
19
7
  async provide(): Promise<PolygonMappedTokenData> {
20
- const response = await axios.get<PolygonTokenListResponse>(url)
21
- const tokens: PolygonMappedTokenData = {}
22
-
23
- for (const token of response.data.tokens) {
24
- const posToken = token.wrappedTokens.find(
25
- (wrapped: PolygonWrappedToken) => wrapped.tags.includes(POS_BRIDGE_TAG)
26
- )
27
-
28
- if (posToken) {
29
- tokens[token.originTokenAddress.toLowerCase()] = {
30
- rootToken: token.originTokenAddress,
31
- childToken: posToken.wrappedTokenAddress,
32
- isPos: true,
33
- }
34
- }
35
- }
36
- return tokens
8
+ return polygonMappings as PolygonMappedTokenData
37
9
  }
38
10
  }
package/src/utils.ts CHANGED
@@ -105,7 +105,7 @@ export function getRpcUrl(chainId: ChainId): string {
105
105
  case ChainId.ARBITRUM_RINKEBY:
106
106
  return 'https://rinkeby.arbitrum.io/rpc'
107
107
  case ChainId.POLYGON:
108
- return 'https://polygon-rpc.com/'
108
+ return 'https://polygon-bor-rpc.publicnode.com'
109
109
  case ChainId.POLYGON_MUMBAI:
110
110
  return 'https://rpc-endpoints.superfluid.dev/mumbai'
111
111
  case ChainId.BNB: