Skip to content

Commit e4812e7

Browse files
authored
Add cross-chain mappings to default token list (#1130)
* Add cross-chain mappings to default token list * move test timeout setting to before hook * remove unnecessary asyncs * use updated token-list-bridge-utils version * increase test timeout
1 parent a27d373 commit e4812e7

File tree

5 files changed

+3308
-24
lines changed

5 files changed

+3308
-24
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"devDependencies": {
3131
"@ethersproject/address": "^5.0.2",
3232
"@uniswap/token-lists": "^1.0.0-beta.29",
33+
"@uniswap/token-list-bridge-utils": "^1.0.8",
3334
"ajv": "^6.12.3",
3435
"chai": "^4.2.0",
3536
"mocha": "^8.0.1",

src/buildList.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ const goerli = require("./tokens/goerli.json");
66
const kovan = require("./tokens/kovan.json");
77
const polygon = require("./tokens/polygon.json");
88
const mumbai = require("./tokens/mumbai.json");
9+
const bridgeUtils = require('@uniswap/token-list-bridge-utils');
910

1011
module.exports = function buildList() {
1112
const parsed = version.split(".");
12-
return {
13+
const l1List = {
1314
name: "Uniswap Labs Default List",
1415
timestamp: new Date().toISOString(),
1516
version: {
@@ -29,4 +30,5 @@ module.exports = function buildList() {
2930
return t1.chainId < t2.chainId ? -1 : 1;
3031
}),
3132
};
33+
return bridgeUtils.chainify(l1List);
3234
};

src/write.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
const buildList = require('./buildList');
2-
console.log(JSON.stringify(buildList(), null, 2));
2+
3+
buildList().then(data => console.log(JSON.stringify(data, null, 2)));

test/uniswap-default.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ const buildList = require('../src/buildList');
77

88
const ajv = new Ajv({ allErrors: true, format: 'full' });
99
const validator = ajv.compile(schema);
10+
let defaultTokenList;
11+
12+
before(async function () {
13+
this.timeout(60000);
14+
defaultTokenList = await buildList();
15+
});
1016

1117
describe('buildList', () => {
12-
const defaultTokenList = buildList();
1318

1419
it('validates', () => {
1520
expect(validator(defaultTokenList)).to.equal(true);

0 commit comments

Comments
 (0)