-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate.js
30 lines (26 loc) · 850 Bytes
/
validate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const { schema } = require('@uniswap/token-lists')
const Ajv = require('ajv')
const addFormats = require('ajv-formats')
const tokenlist = require('./tokenlist.json')
function validate() {
const ajv = new Ajv({ allErrors: true, verbose: true })
addFormats(ajv)
const validator = ajv.compile(schema)
const valid = validator(tokenlist)
if (valid) {
console.log('valid\n')
} else {
console.log(validator.errors)
}
}
function printMintable() {
tokenlist.tokens.forEach((token) => {
if (token.extensions && token.extensions.mintable && token.extensions.mintable.default) {
const amount = token.extensions.mintable.default
const amountReadable = +amount / 10 ** token.decimals
console.log(token.chainId, '\t', token.address, '\t', token.symbol, '\t', amountReadable)
}
})
}
validate()
printMintable()