@uniswap/token-list-bridge-utils 1.1.0 → 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/src/index.test.ts CHANGED
@@ -4,6 +4,7 @@ import { ChainId } from './constants/chainId'
4
4
  import {
5
5
  DAI,
6
6
  DAI_ARBITRUM_ONE,
7
+ DAI_BNB,
7
8
  DAI_OPTIMISM,
8
9
  DAI_POLYGON,
9
10
  } from './constants/tokens'
@@ -11,6 +12,7 @@ import {
11
12
  arbedSampleTokenList,
12
13
  optimizedSampleTokenList,
13
14
  polygonedSampleTokenList,
15
+ bnbedSampleTokenList,
14
16
  sampleL1TokenList,
15
17
  Tokens,
16
18
  } from './fixtures'
@@ -83,6 +85,19 @@ describe(chainifyTokenList, () => {
83
85
  })
84
86
  })
85
87
 
88
+ it('outputs bnb list correctly', async () => {
89
+ const tokenList = await chainifyTokenList([ChainId.BNB], sampleL1TokenList)
90
+ console.log('heeeeeeee', JSON.stringify(tokenList.tokens, null, 2))
91
+ expect(tokenList).toBeDefined()
92
+ expect(tokenList?.version).toEqual(bnbedSampleTokenList.version)
93
+ expect(
94
+ tokenList?.tokens.map((t) => [t.address, t.chainId, t.extensions])
95
+ ).toEqual(
96
+ // ignores other metadata
97
+ bnbedSampleTokenList.tokens.map((t) => [t.address, t.chainId, t.extensions])
98
+ )
99
+ })
100
+
86
101
  describe(mergeTokenLists, () => {
87
102
  it('correctly deduplicates', () => {
88
103
  const merged = mergeTokenLists(sampleL1TokenList, sampleL1TokenList)
@@ -186,6 +201,9 @@ describe(chainify, () => {
186
201
  ...Tokens[ChainId.MAINNET]!.DAI,
187
202
  extensions: {
188
203
  bridgeInfo: {
204
+ [ChainId.BNB]: {
205
+ tokenAddress: DAI_BNB.address,
206
+ },
189
207
  [ChainId.OPTIMISM]: {
190
208
  tokenAddress: DAI_OPTIMISM.address,
191
209
  },
@@ -211,6 +229,16 @@ describe(chainify, () => {
211
229
  },
212
230
  },
213
231
  },
232
+ {
233
+ ...Tokens[ChainId.BNB]!.DAI,
234
+ extensions: {
235
+ bridgeInfo: {
236
+ [ChainId.MAINNET]: {
237
+ tokenAddress: DAI.address,
238
+ },
239
+ },
240
+ },
241
+ },
214
242
  {
215
243
  ...Tokens[ChainId.POLYGON]!.DAI,
216
244
  extensions: {
package/src/index.ts CHANGED
@@ -23,6 +23,7 @@ export async function chainify(
23
23
  ChainId.ARBITRUM_ONE,
24
24
  ChainId.OPTIMISM,
25
25
  ChainId.CELO,
26
+ ChainId.BNB,
26
27
  ]
27
28
 
28
29
  const chainified = await chainifyTokenList(l2Chains, l1TokenListOrPathOrUrl)