@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/dist/constants/chainId.d.ts +2 -1
- package/dist/constants/tokens.d.ts +1 -0
- package/dist/constants/types.d.ts +3 -25
- 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 +918 -32
- 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 +918 -32
- 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/constants/types.ts +4 -26
- 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/PolygonMappingProvider.ts +9 -15
- package/src/providers/index.ts +5 -2
- package/src/utils.ts +2 -0
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: {
|