@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.
- package/dist/constants/types.d.ts +0 -30
- package/dist/providers/PolygonMappingProvider.d.ts +0 -4
- package/dist/token-list-bridge-utils.cjs.development.js +11810 -33
- 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 +11810 -33
- package/dist/token-list-bridge-utils.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/constants/types.ts +1 -31
- package/src/local_mappings/polygon.json +11807 -0
- package/src/providers/PolygonMappingProvider.ts +4 -32
- package/src/utils.ts +1 -1
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
1
|
import { MappingProvider } from './MappingProvider'
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|