2020-01-09 04:34:58 +01:00
|
|
|
import EthJsEns from 'ethjs-ens'
|
2020-01-31 14:26:50 +01:00
|
|
|
import ensNetworkMap from 'ethereum-ens-network-map'
|
2019-11-01 18:54:00 +01:00
|
|
|
|
2020-05-06 00:19:38 +02:00
|
|
|
export default class Ens {
|
2020-11-03 00:41:28 +01:00
|
|
|
static getNetworkEnsSupport(network) {
|
2019-11-01 18:54:00 +01:00
|
|
|
return Boolean(ensNetworkMap[network])
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
constructor({ network, provider } = {}) {
|
2019-11-01 18:54:00 +01:00
|
|
|
this._ethJsEns = new EthJsEns({
|
|
|
|
network,
|
|
|
|
provider,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
lookup(ensName) {
|
2019-11-01 18:54:00 +01:00
|
|
|
return this._ethJsEns.lookup(ensName)
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
reverse(address) {
|
2019-11-01 18:54:00 +01:00
|
|
|
return this._ethJsEns.reverse(address)
|
|
|
|
}
|
|
|
|
}
|