@uniswap/token-list-bridge-utils 2.8.0 → 2.9.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.
@@ -0,0 +1,11 @@
1
+ import { MappingProvider } from './MappingProvider'
2
+ import { MappedTokenData } from '../constants/types'
3
+ import soneiumMappings from '../local_mappings/soneium.json'
4
+
5
+ // we use a local source of mappings for soneium
6
+ export class SoneiumMappingProvider implements MappingProvider {
7
+ async provide(): Promise<MappedTokenData> {
8
+ const tokens = soneiumMappings as MappedTokenData
9
+ return tokens
10
+ }
11
+ }
@@ -24,6 +24,7 @@ import {
24
24
  import { AvalancheMappingProvider } from './AvalancheMappingProvider'
25
25
  import { BaseMappingProvider } from './BaseMappingProvider'
26
26
  import { CeloMappingProvider } from './CeloMappingProvider'
27
+ import { SoneiumMappingProvider } from './SoneiumMappingProvider'
27
28
 
28
29
  const web3 = new Web3()
29
30
 
@@ -37,6 +38,7 @@ const CHAINS_WITH_MAPPING_PROVIDERS = [
37
38
  ChainId.CELO,
38
39
  ChainId.BASE,
39
40
  ChainId.UNICHAIN,
41
+ ChainId.SONEIUM,
40
42
  ]
41
43
 
42
44
  export async function buildList(
@@ -162,6 +164,8 @@ function getMappingProvider(chainId: ChainId, l1TokenList: TokenList) {
162
164
  return new BaseMappingProvider()
163
165
  case ChainId.UNICHAIN:
164
166
  return new UnichainMappingProvider()
167
+ case ChainId.SONEIUM:
168
+ return new SoneiumMappingProvider()
165
169
  default:
166
170
  throw new Error(`Chain ${chainId} not supported for fetching mappings.`)
167
171
  }
package/src/utils.ts CHANGED
@@ -118,6 +118,8 @@ export function getRpcUrl(chainId: ChainId): string {
118
118
  return 'https://alfajores-forno.celo-testnet.org/'
119
119
  case ChainId.BASE:
120
120
  return 'https://mainnet.base.org'
121
+ case ChainId.SONEIUM:
122
+ return 'https://soneium.drpc.org'
121
123
  default:
122
124
  }
123
125
  throw new Error('Unsupported ChainId')