web3-eth-ens
Advanced tools
Comparing version 4.3.1-dev.7537f03.0 to 4.3.1-dev.962b99f.0
@@ -114,3 +114,3 @@ import { Web3Context, Web3ContextObject } from 'web3-core'; | ||
*/ | ||
getText(ENSName: string, key: string): Promise<string>; | ||
getText(ENSNameOrAddr: string | Address, key: string): Promise<string>; | ||
/** | ||
@@ -121,3 +121,3 @@ * Resolves the name of an ENS node. | ||
*/ | ||
getName(ENSName: string): Promise<string>; | ||
getName(ENSName: string, checkInterfaceSupport?: boolean): Promise<string>; | ||
/** | ||
@@ -209,2 +209,23 @@ * Returns the X and Y coordinates of the curve point for the public key. | ||
readonly internalType: "address"; | ||
/** | ||
* This class is designed to interact with the ENS system on the Ethereum blockchain. | ||
* For using ENS package, first install Web3 package using: `npm i web3` or `yarn add web3` based on your package manager, after that ENS features can be used as mentioned in following snippet. | ||
* ```ts | ||
* | ||
* import { Web3 } from 'web3'; | ||
* | ||
* const web3 = new Web3('https://127.0.0.1:4545'); | ||
* | ||
* console.log(await web3.eth.ens.getAddress('ethereum.eth')) | ||
* ``` | ||
* For using individual package install `web3-eth-ens` packages using: `npm i web3-eth-ens` or `yarn add web3-eth-ens`. This is more efficient approach for building lightweight applications. | ||
* | ||
* ```ts | ||
*import { ENS } from 'web3-eth-ens'; | ||
* | ||
* const ens = new ENS(undefined,'https://127.0.0.1:4545'); | ||
* | ||
* console.log(await ens.getAddress('vitalik.eth')); | ||
* ``` | ||
*/ | ||
readonly name: "resolver"; | ||
@@ -334,2 +355,23 @@ readonly type: "address"; | ||
readonly internalType: "address"; | ||
/** | ||
* This class is designed to interact with the ENS system on the Ethereum blockchain. | ||
* For using ENS package, first install Web3 package using: `npm i web3` or `yarn add web3` based on your package manager, after that ENS features can be used as mentioned in following snippet. | ||
* ```ts | ||
* | ||
* import { Web3 } from 'web3'; | ||
* | ||
* const web3 = new Web3('https://127.0.0.1:4545'); | ||
* | ||
* console.log(await web3.eth.ens.getAddress('ethereum.eth')) | ||
* ``` | ||
* For using individual package install `web3-eth-ens` packages using: `npm i web3-eth-ens` or `yarn add web3-eth-ens`. This is more efficient approach for building lightweight applications. | ||
* | ||
* ```ts | ||
*import { ENS } from 'web3-eth-ens'; | ||
* | ||
* const ens = new ENS(undefined,'https://127.0.0.1:4545'); | ||
* | ||
* console.log(await ens.getAddress('vitalik.eth')); | ||
* ``` | ||
*/ | ||
readonly name: "resolver"; | ||
@@ -336,0 +378,0 @@ readonly type: "address"; |
@@ -34,2 +34,3 @@ "use strict"; | ||
const web3_types_1 = require("web3-types"); | ||
const web3_validator_1 = require("web3-validator"); | ||
const config_js_1 = require("./config.js"); | ||
@@ -163,5 +164,7 @@ const registry_js_1 = require("./registry.js"); | ||
*/ | ||
getText(ENSName, key) { | ||
getText(ENSNameOrAddr, key) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._resolver.getText(ENSName, key); | ||
if ((0, web3_validator_1.isAddress)(ENSNameOrAddr)) | ||
return this._resolver.getText(yield (this._resolver.getName(ENSNameOrAddr, false)), key); | ||
return this._resolver.getText(ENSNameOrAddr, key); | ||
}); | ||
@@ -174,5 +177,5 @@ } | ||
*/ | ||
getName(ENSName) { | ||
getName(ENSName, checkInterfaceSupport = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._resolver.getName(ENSName); | ||
return this._resolver.getName(ENSName, checkInterfaceSupport); | ||
}); | ||
@@ -179,0 +182,0 @@ } |
@@ -65,3 +65,3 @@ import { Contract } from 'web3-eth-contract'; | ||
getText(ENSName: string, key: string): Promise<string>; | ||
getName(address: string): Promise<string>; | ||
getName(address: string, checkInterfaceSupport?: boolean): Promise<string>; | ||
} |
@@ -113,8 +113,10 @@ "use strict"; | ||
} | ||
getName(address) { | ||
getName(address, checkInterfaceSupport = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resolverContract = yield this.getResolverContractAdapter(address); | ||
yield this.checkInterfaceSupport(resolverContract, config_js_1.methodsInInterface.name); | ||
const reverseName = `${address.toLowerCase().substring(2)}.addr.reverse`; | ||
const resolverContract = yield this.getResolverContractAdapter(reverseName); | ||
if (checkInterfaceSupport) | ||
yield this.checkInterfaceSupport(resolverContract, config_js_1.methodsInInterface.name); | ||
return resolverContract.methods | ||
.name((0, utils_js_1.namehash)(address)).call(); | ||
.name((0, utils_js_1.namehash)(reverseName)).call(); | ||
}); | ||
@@ -121,0 +123,0 @@ } |
@@ -31,2 +31,3 @@ /* | ||
import { FMT_NUMBER, } from 'web3-types'; | ||
import { isAddress } from 'web3-validator'; | ||
import { networkIds, registryAddresses } from './config.js'; | ||
@@ -160,5 +161,7 @@ import { Registry } from './registry.js'; | ||
*/ | ||
getText(ENSName, key) { | ||
getText(ENSNameOrAddr, key) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._resolver.getText(ENSName, key); | ||
if (isAddress(ENSNameOrAddr)) | ||
return this._resolver.getText(yield (this._resolver.getName(ENSNameOrAddr, false)), key); | ||
return this._resolver.getText(ENSNameOrAddr, key); | ||
}); | ||
@@ -171,5 +174,5 @@ } | ||
*/ | ||
getName(ENSName) { | ||
getName(ENSName, checkInterfaceSupport = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this._resolver.getName(ENSName); | ||
return this._resolver.getName(ENSName, checkInterfaceSupport); | ||
}); | ||
@@ -176,0 +179,0 @@ } |
@@ -110,8 +110,10 @@ /* | ||
} | ||
getName(address) { | ||
getName(address, checkInterfaceSupport = true) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const resolverContract = yield this.getResolverContractAdapter(address); | ||
yield this.checkInterfaceSupport(resolverContract, methodsInInterface.name); | ||
const reverseName = `${address.toLowerCase().substring(2)}.addr.reverse`; | ||
const resolverContract = yield this.getResolverContractAdapter(reverseName); | ||
if (checkInterfaceSupport) | ||
yield this.checkInterfaceSupport(resolverContract, methodsInInterface.name); | ||
return resolverContract.methods | ||
.name(namehash(address)).call(); | ||
.name(namehash(reverseName)).call(); | ||
}); | ||
@@ -118,0 +120,0 @@ } |
@@ -114,3 +114,3 @@ import { Web3Context, Web3ContextObject } from 'web3-core'; | ||
*/ | ||
getText(ENSName: string, key: string): Promise<string>; | ||
getText(ENSNameOrAddr: string | Address, key: string): Promise<string>; | ||
/** | ||
@@ -121,3 +121,3 @@ * Resolves the name of an ENS node. | ||
*/ | ||
getName(ENSName: string): Promise<string>; | ||
getName(ENSName: string, checkInterfaceSupport?: boolean): Promise<string>; | ||
/** | ||
@@ -209,2 +209,23 @@ * Returns the X and Y coordinates of the curve point for the public key. | ||
readonly internalType: "address"; | ||
/** | ||
* This class is designed to interact with the ENS system on the Ethereum blockchain. | ||
* For using ENS package, first install Web3 package using: `npm i web3` or `yarn add web3` based on your package manager, after that ENS features can be used as mentioned in following snippet. | ||
* ```ts | ||
* | ||
* import { Web3 } from 'web3'; | ||
* | ||
* const web3 = new Web3('https://127.0.0.1:4545'); | ||
* | ||
* console.log(await web3.eth.ens.getAddress('ethereum.eth')) | ||
* ``` | ||
* For using individual package install `web3-eth-ens` packages using: `npm i web3-eth-ens` or `yarn add web3-eth-ens`. This is more efficient approach for building lightweight applications. | ||
* | ||
* ```ts | ||
*import { ENS } from 'web3-eth-ens'; | ||
* | ||
* const ens = new ENS(undefined,'https://127.0.0.1:4545'); | ||
* | ||
* console.log(await ens.getAddress('vitalik.eth')); | ||
* ``` | ||
*/ | ||
readonly name: "resolver"; | ||
@@ -334,2 +355,23 @@ readonly type: "address"; | ||
readonly internalType: "address"; | ||
/** | ||
* This class is designed to interact with the ENS system on the Ethereum blockchain. | ||
* For using ENS package, first install Web3 package using: `npm i web3` or `yarn add web3` based on your package manager, after that ENS features can be used as mentioned in following snippet. | ||
* ```ts | ||
* | ||
* import { Web3 } from 'web3'; | ||
* | ||
* const web3 = new Web3('https://127.0.0.1:4545'); | ||
* | ||
* console.log(await web3.eth.ens.getAddress('ethereum.eth')) | ||
* ``` | ||
* For using individual package install `web3-eth-ens` packages using: `npm i web3-eth-ens` or `yarn add web3-eth-ens`. This is more efficient approach for building lightweight applications. | ||
* | ||
* ```ts | ||
*import { ENS } from 'web3-eth-ens'; | ||
* | ||
* const ens = new ENS(undefined,'https://127.0.0.1:4545'); | ||
* | ||
* console.log(await ens.getAddress('vitalik.eth')); | ||
* ``` | ||
*/ | ||
readonly name: "resolver"; | ||
@@ -336,0 +378,0 @@ readonly type: "address"; |
@@ -65,4 +65,4 @@ import { Contract } from 'web3-eth-contract'; | ||
getText(ENSName: string, key: string): Promise<string>; | ||
getName(address: string): Promise<string>; | ||
getName(address: string, checkInterfaceSupport?: boolean): Promise<string>; | ||
} | ||
//# sourceMappingURL=resolver.d.ts.map |
{ | ||
"name": "web3-eth-ens", | ||
"version": "4.3.1-dev.7537f03.0+7537f03", | ||
"version": "4.3.1-dev.962b99f.0+962b99f", | ||
"description": "This package has ENS functions for interacting with Ethereum Name Service.", | ||
@@ -62,12 +62,12 @@ "main": "./lib/commonjs/index.js", | ||
"@adraffy/ens-normalize": "^1.8.8", | ||
"web3-core": "4.4.1-dev.7537f03.0+7537f03", | ||
"web3-errors": "1.2.1-dev.7537f03.0+7537f03", | ||
"web3-eth": "4.7.1-dev.7537f03.0+7537f03", | ||
"web3-eth-contract": "4.5.1-dev.7537f03.0+7537f03", | ||
"web3-net": "4.1.1-dev.7537f03.0+7537f03", | ||
"web3-types": "1.6.1-dev.7537f03.0+7537f03", | ||
"web3-utils": "4.3.1-dev.7537f03.0+7537f03", | ||
"web3-validator": "2.0.7-dev.7537f03.0+7537f03" | ||
"web3-core": "4.4.1-dev.962b99f.0+962b99f", | ||
"web3-errors": "1.2.1-dev.962b99f.0+962b99f", | ||
"web3-eth": "4.7.1-dev.962b99f.0+962b99f", | ||
"web3-eth-contract": "4.5.1-dev.962b99f.0+962b99f", | ||
"web3-net": "4.1.1-dev.962b99f.0+962b99f", | ||
"web3-types": "1.6.1-dev.962b99f.0+962b99f", | ||
"web3-utils": "4.3.1-dev.962b99f.0+962b99f", | ||
"web3-validator": "2.0.7-dev.962b99f.0+962b99f" | ||
}, | ||
"gitHead": "7537f03db3a2932a4f5c6f13ada1c3d6ca0217cd" | ||
"gitHead": "962b99fe54ede0d573dff69a7d1667b081ef3fd0" | ||
} |
@@ -36,2 +36,3 @@ /* | ||
} from 'web3-types'; | ||
import { isAddress } from 'web3-validator'; | ||
import { PublicResolverAbi } from './abi/ens/PublicResolver.js'; | ||
@@ -178,4 +179,6 @@ import { networkIds, registryAddresses } from './config.js'; | ||
*/ | ||
public async getText(ENSName: string, key: string): Promise<string> { | ||
return this._resolver.getText(ENSName, key); | ||
public async getText(ENSNameOrAddr: string | Address, key: string): Promise<string> { | ||
if(isAddress(ENSNameOrAddr)) | ||
return this._resolver.getText(await(this._resolver.getName(ENSNameOrAddr,false)), key); | ||
return this._resolver.getText(ENSNameOrAddr, key); | ||
} | ||
@@ -188,4 +191,4 @@ | ||
*/ | ||
public async getName(ENSName: string): Promise<string> { | ||
return this._resolver.getName(ENSName); | ||
public async getName(ENSName: string, checkInterfaceSupport = true): Promise<string> { | ||
return this._resolver.getName(ENSName, checkInterfaceSupport); | ||
} | ||
@@ -192,0 +195,0 @@ |
@@ -133,10 +133,15 @@ /* | ||
public async getName( | ||
address: string | ||
address: string, | ||
checkInterfaceSupport = true | ||
) { | ||
const resolverContract = await this.getResolverContractAdapter(address); | ||
await this.checkInterfaceSupport(resolverContract, methodsInInterface.name); | ||
const reverseName = `${address.toLowerCase().substring(2)}.addr.reverse`; | ||
const resolverContract = await this.getResolverContractAdapter(reverseName); | ||
if(checkInterfaceSupport) | ||
await this.checkInterfaceSupport(resolverContract, methodsInInterface.name); | ||
return resolverContract.methods | ||
.name(namehash(address)).call() | ||
.name(namehash(reverseName)).call() | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
312243
7948