@unstoppabledomains/resolution
Advanced tools
Comparing version 9.1.0 to 9.2.0
@@ -16,3 +16,4 @@ import { ResolutionMethod } from '../types/publicTypes'; | ||
CustomNetworkConfigMissing = "CustomNetworkConfigMissing", | ||
InvalidConfigurationField = "InvalidProxyReader" | ||
InvalidConfigurationField = "InvalidProxyReader", | ||
DependencyMissing = "DependencyMissing" | ||
} | ||
@@ -19,0 +20,0 @@ /** |
@@ -28,2 +28,3 @@ "use strict"; | ||
ConfigurationErrorCode["InvalidConfigurationField"] = "InvalidProxyReader"; | ||
ConfigurationErrorCode["DependencyMissing"] = "DependencyMissing"; | ||
})(ConfigurationErrorCode = exports.ConfigurationErrorCode || (exports.ConfigurationErrorCode = {})); | ||
@@ -49,2 +50,5 @@ /** | ||
_a[ConfigurationErrorCode.InvalidConfigurationField] = function (params) { return "Invalid '".concat(params.field, "' in Resolution ").concat(params.method); }, | ||
_a[ConfigurationErrorCode.DependencyMissing] = function (params) { | ||
return "Missing dependency for this functionality. Please install ".concat(params.dependency, " @ ").concat(params.version, " via npm or yarn"); | ||
}, | ||
_a); | ||
@@ -51,0 +55,0 @@ /** |
@@ -50,2 +50,4 @@ import { ResolutionMethod, UnsLocation, ResolutionConfig } from '../types/publicTypes'; | ||
readonly method?: string; | ||
readonly methodName?: string; | ||
readonly recordName?: string; | ||
readonly currencyTicker?: string; | ||
@@ -52,0 +54,0 @@ constructor(code: ResolutionErrorCode, options?: ResolutionErrorOptions); |
@@ -99,3 +99,3 @@ "use strict"; | ||
var resolutionErrorHandler = HandlersByCode[code]; | ||
var domain = options.domain, method = options.method, currencyTicker = options.currencyTicker; | ||
var domain = options.domain, method = options.method, currencyTicker = options.currencyTicker, methodName = options.methodName, recordName = options.recordName; | ||
var message = resolutionErrorHandler(options); | ||
@@ -108,2 +108,4 @@ _this = _super.call(this, message) || this; | ||
_this.name = 'ResolutionError'; | ||
_this.methodName = methodName; | ||
_this.recordName = recordName; | ||
Object.setPrototypeOf(_this, ResolutionError.prototype); | ||
@@ -110,0 +112,0 @@ return _this; |
import { Locations, UnsLocation } from './types/publicTypes'; | ||
export declare abstract class NamingService { | ||
abstract name?: string; | ||
abstract owner(domain: string): Promise<string>; | ||
@@ -4,0 +5,0 @@ abstract resolver(domain: string): Promise<string>; |
@@ -0,1 +1,2 @@ | ||
import Ens from './Ens'; | ||
import Zns from './Zns'; | ||
@@ -13,3 +14,3 @@ import UdApi from './UdApi'; | ||
* uns: { | ||
* url: "https://mainnet.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39", | ||
* url: "https://mainnet.infura.io/v3/<infura_api_key>", | ||
* network: "mainnet" | ||
@@ -30,5 +31,5 @@ * } | ||
/** | ||
* AutoConfigure the blockchain network for UNS | ||
* AutoConfigure the blockchain network between different testnets for ENS and UNS | ||
* We make a "net_version" JSON RPC call to the blockchain either via url or with the help of given provider. | ||
* @param sourceConfig - configuration object for uns | ||
* @param sourceConfig - configuration object for ens and uns | ||
* @returns configured Resolution object | ||
@@ -38,7 +39,10 @@ */ | ||
/** | ||
* Creates a resolution with configured infura id for uns | ||
* Creates a resolution with configured infura id for ens and uns | ||
* @param infura - infura project id | ||
* @param networks - an optional object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an optional object that describes what network to use when connecting ENS or UNS default is mainnet | ||
*/ | ||
static infura(infura: string, networks?: { | ||
ens?: { | ||
network: string; | ||
}; | ||
uns?: { | ||
@@ -74,6 +78,10 @@ locations: { | ||
* Creates a resolution instance with configured provider | ||
* @param networks - an object that describes what network to use when connecting UNS or ZNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting UNS, ENS, or ZNS default is mainnet | ||
* @see https://eips.ethereum.org/EIPS/eip-1193 | ||
*/ | ||
static fromResolutionProvider(networks: { | ||
ens?: { | ||
provider: Provider; | ||
network: string; | ||
}; | ||
uns?: { | ||
@@ -98,6 +106,10 @@ locations: { | ||
* Creates a resolution instance with configured provider | ||
* @param networks - an object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting UNS and ENS default is mainnet | ||
* @see https://eips.ethereum.org/EIPS/eip-1193 | ||
*/ | ||
static fromEthereumEip1193Provider(networks: { | ||
ens?: { | ||
network?: string; | ||
provider: Provider; | ||
}; | ||
uns?: { | ||
@@ -133,2 +145,6 @@ locations: { | ||
static fromWeb3Version0Provider(networks: { | ||
ens?: { | ||
provider: Web3Version0Provider; | ||
network: string; | ||
}; | ||
uns?: { | ||
@@ -149,3 +165,3 @@ locations: { | ||
* Create a resolution instance from web3 1.x version provider | ||
* @param networks - an optional object with 1.x version provider from web3 ( must implement send(payload, callback) ) that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an optional object with 1.x version provider from web3 ( must implement send(payload, callback) ) that describes what network to use when connecting ENS or UNS default is mainnet | ||
* @see https://github.com/ethereum/web3.js/blob/1.x/packages/web3-core-helpers/types/index.d.ts#L165 | ||
@@ -155,2 +171,6 @@ * @see https://github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-http/src/index.js#L95 | ||
static fromWeb3Version1Provider(networks: { | ||
ens?: { | ||
provider: Web3Version1Provider; | ||
network: string; | ||
}; | ||
uns?: { | ||
@@ -172,3 +192,3 @@ locations: { | ||
* This wrapper support only `eth_call` method for now, which is enough for all the current Resolution functionality | ||
* @param networks - an object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting ENS or UNS default is mainnet | ||
* @see https://github.com/ethers-io/ethers.js/blob/v4-legacy/providers/abstract-provider.d.ts#L91 | ||
@@ -180,2 +200,6 @@ * @see https://github.com/ethers-io/ethers.js/blob/v5.0.4/packages/abstract-provider/src.ts/index.ts#L224 | ||
static fromEthersProvider(networks: { | ||
ens?: { | ||
network: string; | ||
provider: EthersProvider; | ||
}; | ||
uns?: { | ||
@@ -202,3 +226,3 @@ locations: { | ||
*/ | ||
addr(domain: string, ticker: string): Promise<string>; | ||
addr(domain: string, ticker: string): Promise<string | undefined>; | ||
/** | ||
@@ -213,3 +237,3 @@ * Read multi-chain currency address if exists | ||
*/ | ||
multiChainAddr(domain: string, ticker: string, chain: string): Promise<string>; | ||
multiChainAddr(domain: string, ticker: string, chain: string): Promise<string | undefined>; | ||
/** | ||
@@ -296,3 +320,3 @@ * Resolves given domain name to a verified twitter handle | ||
* @returns Produces a namehash from supported naming service in hex format with 0x prefix. | ||
* Corresponds to ERC721 token id in case of Ethereum based naming service like UNS. | ||
* Corresponds to ERC721 token id in case of Ethereum based naming service like ENS or UNS. | ||
* @param domain domain name to be converted | ||
@@ -308,3 +332,3 @@ * @param namingService "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param label subdomain name | ||
* @param namingService "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param namingService "ENS", "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param options formatting options | ||
@@ -324,2 +348,3 @@ */ | ||
* for valid domain names. | ||
* Example: ENS doesn't allow domains that start from '-' symbol. | ||
* @param domain - domain name to be checked | ||
@@ -331,2 +356,3 @@ */ | ||
* This method is strongly unrecommended for production use due to lack of support for many ethereum service providers and low performance | ||
* Method is not supported by ENS | ||
* @param domain - domain name | ||
@@ -357,6 +383,6 @@ * @deprecated | ||
* Retrieves the domain name from tokenId by parsing registry smart contract event logs. | ||
* @throws {ResolutionError} if returned domain name doesn't match the original namhash. | ||
* @returns the domain name retrieved from token metadata | ||
* @param hash - domain hash | ||
* @param service - nameservice which is used for lookup | ||
* @throws {ResolutionError} if returned domain name doesn't match the original namehash. | ||
* @returns the domain name retrieved from token metadata. | ||
* @param hash - domain name hash or label hash. | ||
* @param service - name service which is used for lookup. | ||
*/ | ||
@@ -375,7 +401,7 @@ unhash(hash: string, service: NamingServiceName): Promise<string>; | ||
*/ | ||
reverseTokenId(address: string, options?: ReverseResolutionOptions): Promise<string>; | ||
reverseTokenId(address: string, options?: ReverseResolutionOptions): Promise<string | null>; | ||
/** | ||
* Returns the domain that is the primary resolution of the provided address | ||
* @param address - owner's address | ||
* @returns Promise<URL> - domain URL that is the primary resolution of the provided addresss | ||
* @returns Promise<URL> - domain URL that is the primary resolution of the provided address | ||
*/ | ||
@@ -391,3 +417,4 @@ reverse(address: string, options?: ReverseResolutionOptions): Promise<string | null>; | ||
getZnsConfig(config: ResolutionConfig): Zns | UdApi; | ||
getEnsConfig(config: ResolutionConfig): Ens | UdApi; | ||
} | ||
export { Resolution }; |
@@ -67,2 +67,3 @@ "use strict"; | ||
var bn_js_1 = __importDefault(require("bn.js")); | ||
var Ens_1 = __importDefault(require("./Ens")); | ||
var Zns_1 = __importDefault(require("./Zns")); | ||
@@ -76,2 +77,4 @@ var Uns_1 = __importDefault(require("./Uns")); | ||
var Eip1993Factories_1 = require("./utils/Eip1993Factories"); | ||
var configurationError_1 = __importDefault(require("./errors/configurationError")); | ||
var configurationError_2 = require("./errors/configurationError"); | ||
var Networking_1 = __importDefault(require("./utils/Networking")); | ||
@@ -89,3 +92,3 @@ var prepareAndValidate_1 = require("./utils/prepareAndValidate"); | ||
* uns: { | ||
* url: "https://mainnet.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39", | ||
* url: "https://mainnet.infura.io/v3/<infura_api_key>", | ||
* network: "mainnet" | ||
@@ -106,2 +109,3 @@ * } | ||
var zns = this.getZnsConfig(config); | ||
var ens = this.getEnsConfig(config); | ||
// If both UNS and ZNS use the same UdApi providers, we don't want to call the API twice as it would return same | ||
@@ -121,8 +125,12 @@ // responses. It should be enough to compare just the URLs, as the network param isn't actually used in the calls. | ||
}, | ||
_a[publicTypes_1.NamingServiceName.ENS] = { | ||
usedServices: [ens], | ||
native: ens instanceof Ens_1.default ? ens : new Ens_1.default(), | ||
}, | ||
_a); | ||
} | ||
/** | ||
* AutoConfigure the blockchain network for UNS | ||
* AutoConfigure the blockchain network between different testnets for ENS and UNS | ||
* We make a "net_version" JSON RPC call to the blockchain either via url or with the help of given provider. | ||
* @param sourceConfig - configuration object for uns | ||
* @param sourceConfig - configuration object for ens and uns | ||
* @returns configured Resolution object | ||
@@ -132,3 +140,3 @@ */ | ||
return __awaiter(this, void 0, void 0, function () { | ||
var resolution, uns; | ||
var resolution, uns, ens; | ||
return __generator(this, function (_a) { | ||
@@ -138,2 +146,5 @@ switch (_a.label) { | ||
resolution = new this(); | ||
if (!sourceConfig.uns && !sourceConfig.ens) { | ||
throw new configurationError_1.default(configurationError_2.ConfigurationErrorCode.UnsupportedNetwork); | ||
} | ||
if (!sourceConfig.uns) return [3 /*break*/, 2]; | ||
@@ -148,3 +159,13 @@ return [4 /*yield*/, Uns_1.default.autoNetwork(sourceConfig.uns)]; | ||
_a.label = 2; | ||
case 2: return [2 /*return*/, resolution]; | ||
case 2: | ||
if (!sourceConfig.ens) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, Ens_1.default.autoNetwork(sourceConfig.ens)]; | ||
case 3: | ||
ens = _a.sent(); | ||
resolution.serviceMap[publicTypes_1.NamingServiceName.ENS] = { | ||
usedServices: [ens], | ||
native: ens, | ||
}; | ||
_a.label = 4; | ||
case 4: return [2 /*return*/, resolution]; | ||
} | ||
@@ -155,19 +176,23 @@ }); | ||
/** | ||
* Creates a resolution with configured infura id for uns | ||
* Creates a resolution with configured infura id for ens and uns | ||
* @param infura - infura project id | ||
* @param networks - an optional object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an optional object that describes what network to use when connecting ENS or UNS default is mainnet | ||
*/ | ||
Resolution.infura = function (infura, networks) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e, _f; | ||
return new this({ | ||
sourceConfig: { | ||
ens: { | ||
url: (0, utils_1.signedInfuraLink)(infura, (_a = networks === null || networks === void 0 ? void 0 : networks.ens) === null || _a === void 0 ? void 0 : _a.network), | ||
network: ((_b = networks === null || networks === void 0 ? void 0 : networks.ens) === null || _b === void 0 ? void 0 : _b.network) || 'mainnet', | ||
}, | ||
uns: { | ||
locations: { | ||
Layer1: { | ||
url: (0, utils_1.signedLink)(infura, ((_a = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _a === void 0 ? void 0 : _a.locations.Layer1.network) || 'mainnet', 'infura'), | ||
network: ((_b = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _b === void 0 ? void 0 : _b.locations.Layer1.network) || 'mainnet', | ||
url: (0, utils_1.signedLink)(infura, ((_c = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _c === void 0 ? void 0 : _c.locations.Layer1.network) || 'mainnet', 'infura'), | ||
network: ((_d = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _d === void 0 ? void 0 : _d.locations.Layer1.network) || 'mainnet', | ||
}, | ||
Layer2: { | ||
url: (0, utils_1.signedLink)(infura, ((_c = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _c === void 0 ? void 0 : _c.locations.Layer2.network) || 'polygon-mainnet', 'infura'), | ||
network: ((_d = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _d === void 0 ? void 0 : _d.locations.Layer2.network) || 'polygon-mainnet', | ||
url: (0, utils_1.signedLink)(infura, ((_e = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _e === void 0 ? void 0 : _e.locations.Layer2.network) || 'polygon-mainnet', 'infura'), | ||
network: ((_f = networks === null || networks === void 0 ? void 0 : networks.uns) === null || _f === void 0 ? void 0 : _f.locations.Layer2.network) || 'polygon-mainnet', | ||
}, | ||
@@ -205,8 +230,9 @@ }, | ||
* Creates a resolution instance with configured provider | ||
* @param networks - an object that describes what network to use when connecting UNS or ZNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting UNS, ENS, or ZNS default is mainnet | ||
* @see https://eips.ethereum.org/EIPS/eip-1193 | ||
*/ | ||
Resolution.fromResolutionProvider = function (networks) { | ||
if (networks.uns) { | ||
if (networks.ens || networks.uns) { | ||
return this.fromEthereumEip1193Provider({ | ||
ens: networks.ens, | ||
uns: networks.uns, | ||
@@ -219,3 +245,3 @@ }); | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.ServiceProviderError, { | ||
providerMessage: 'Must specify network for uns or zns', | ||
providerMessage: 'Must specify network for uns, ens, or zns', | ||
}); | ||
@@ -225,7 +251,14 @@ }; | ||
* Creates a resolution instance with configured provider | ||
* @param networks - an object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting UNS and ENS default is mainnet | ||
* @see https://eips.ethereum.org/EIPS/eip-1193 | ||
*/ | ||
Resolution.fromEthereumEip1193Provider = function (networks) { | ||
var _a; | ||
var sourceConfig = {}; | ||
if (networks.ens) { | ||
sourceConfig.ens = { | ||
provider: networks.ens.provider, | ||
network: ((_a = networks === null || networks === void 0 ? void 0 : networks.ens) === null || _a === void 0 ? void 0 : _a.network) || 'mainnet', | ||
}; | ||
} | ||
if (networks.uns) { | ||
@@ -270,2 +303,8 @@ sourceConfig.uns = { | ||
return this.fromEthereumEip1193Provider({ | ||
ens: networks.ens | ||
? { | ||
network: networks.ens.network, | ||
provider: Eip1993Factories_1.Eip1993Factories.fromWeb3Version0Provider(networks.ens.provider), | ||
} | ||
: undefined, | ||
uns: networks.uns | ||
@@ -289,3 +328,3 @@ ? { | ||
* Create a resolution instance from web3 1.x version provider | ||
* @param networks - an optional object with 1.x version provider from web3 ( must implement send(payload, callback) ) that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an optional object with 1.x version provider from web3 ( must implement send(payload, callback) ) that describes what network to use when connecting ENS or UNS default is mainnet | ||
* @see https://github.com/ethereum/web3.js/blob/1.x/packages/web3-core-helpers/types/index.d.ts#L165 | ||
@@ -296,2 +335,8 @@ * @see https://github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-http/src/index.js#L95 | ||
return this.fromEthereumEip1193Provider({ | ||
ens: networks.ens | ||
? { | ||
network: networks.ens.network, | ||
provider: Eip1993Factories_1.Eip1993Factories.fromWeb3Version1Provider(networks.ens.provider), | ||
} | ||
: undefined, | ||
uns: networks.uns | ||
@@ -316,3 +361,3 @@ ? { | ||
* This wrapper support only `eth_call` method for now, which is enough for all the current Resolution functionality | ||
* @param networks - an object that describes what network to use when connecting UNS default is mainnet | ||
* @param networks - an object that describes what network to use when connecting ENS or UNS default is mainnet | ||
* @see https://github.com/ethers-io/ethers.js/blob/v4-legacy/providers/abstract-provider.d.ts#L91 | ||
@@ -325,2 +370,8 @@ * @see https://github.com/ethers-io/ethers.js/blob/v5.0.4/packages/abstract-provider/src.ts/index.ts#L224 | ||
return this.fromEthereumEip1193Provider({ | ||
ens: networks.ens | ||
? { | ||
network: networks.ens.network, | ||
provider: Eip1993Factories_1.Eip1993Factories.fromEthersProvider(networks.ens.provider), | ||
} | ||
: undefined, | ||
uns: networks.uns | ||
@@ -352,4 +403,21 @@ ? { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.record(domain, "crypto.".concat(ticker.toUpperCase(), ".address"))]; | ||
switch (_a.label) { | ||
case 0: | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
return [4 /*yield*/, this.callServiceForDomain(domain, function (service) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(service instanceof Ens_1.default)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, service.addr(domain, ticker)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: return [4 /*yield*/, this.record(domain, "crypto.".concat(ticker.toUpperCase(), ".address"))]; | ||
case 3: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
@@ -370,8 +438,22 @@ }); | ||
var recordKey; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
recordKey = "crypto.".concat(ticker.toUpperCase(), ".version.").concat(chain.toUpperCase(), ".address"); | ||
return [2 /*return*/, this.callServiceForDomain(domain, function (service) { | ||
return service.record(domain, recordKey); | ||
})]; | ||
return [2 /*return*/, this.callServiceForDomain(domain, function (service) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (service instanceof Ens_1.default) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedMethod, { | ||
methodName: 'multiChainAddr', | ||
domain: domain, | ||
method: service.name, | ||
}); | ||
} | ||
return [4 /*yield*/, service.record(domain, recordKey)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); })]; | ||
}); | ||
@@ -405,4 +487,22 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var err_1; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.record(domain, 'gundb.username.value')]; | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.record(domain, 'gundb.username.value')]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
err_1 = _a.sent(); | ||
if (err_1.code === resolutionError_1.ResolutionErrorCode.RecordNotFound) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound, { | ||
domain: domain, | ||
method: err_1.method, | ||
methodName: 'chatId', | ||
recordName: err_1.recordName, | ||
}); | ||
} | ||
throw err_1; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -419,4 +519,22 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var err_2; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.record(domain, 'gundb.public_key.value')]; | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, this.record(domain, 'gundb.public_key.value')]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: | ||
err_2 = _a.sent(); | ||
if (err_2.code === resolutionError_1.ResolutionErrorCode.RecordNotFound) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound, { | ||
domain: domain, | ||
method: err_2.method, | ||
methodName: 'chatId', | ||
recordName: err_2.recordName, | ||
}); | ||
} | ||
throw err_2; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -432,5 +550,24 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
return [2 /*return*/, this.getPreferableNewRecord(domain, 'dweb.ipfs.hash', 'ipfs.html.value')]; | ||
switch (_a.label) { | ||
case 0: | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
return [4 /*yield*/, this.callServiceForDomain(domain, function (service) { return __awaiter(_this, void 0, void 0, function () { | ||
var contentHash; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(service instanceof Ens_1.default)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, service.record(domain, 'contenthash')]; | ||
case 1: | ||
contentHash = _a.sent(); | ||
return [2 /*return*/, "ipfs://".concat(contentHash)]; | ||
case 2: return [4 /*yield*/, this.getPreferableNewRecord(domain, 'dweb.ipfs.hash', 'ipfs.html.value')]; | ||
case 3: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
@@ -445,5 +582,21 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
return [2 /*return*/, this.getPreferableNewRecord(domain, 'browser.redirect_url', 'ipfs.redirect_domain.value')]; | ||
switch (_a.label) { | ||
case 0: | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
return [4 /*yield*/, this.callServiceForDomain(domain, function (service) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!(service instanceof Ens_1.default)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, service.record(domain, 'url')]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: return [4 /*yield*/, this.getPreferableNewRecord(domain, 'browser.redirect_url', 'ipfs.redirect_domain.value')]; | ||
case 3: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); })]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
@@ -460,4 +613,27 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var key, serviceName, err_3; | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.record(domain, 'whois.email.value')]; | ||
switch (_a.label) { | ||
case 0: | ||
domain = (0, prepareAndValidate_1.prepareAndValidateDomain)(domain); | ||
key = 'whois.email.value'; | ||
serviceName = (0, utils_1.findNamingServiceName)(domain); | ||
if (serviceName === 'ENS') { | ||
key = 'email'; | ||
} | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.record(domain, key)]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
case 3: | ||
err_3 = _a.sent(); | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.RecordNotFound, { | ||
domain: domain, | ||
method: err_3.method, | ||
methodName: 'email', | ||
recordName: err_3.recordName, | ||
}); | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
@@ -584,3 +760,3 @@ }); | ||
* @returns Produces a namehash from supported naming service in hex format with 0x prefix. | ||
* Corresponds to ERC721 token id in case of Ethereum based naming service like UNS. | ||
* Corresponds to ERC721 token id in case of Ethereum based naming service like ENS or UNS. | ||
* @param domain domain name to be converted | ||
@@ -606,3 +782,3 @@ * @param namingService "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param label subdomain name | ||
* @param namingService "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param namingService "ENS", "UNS" or "ZNS" (uses keccak256 or sha256 algorithm respectively) | ||
* @param options formatting options | ||
@@ -648,2 +824,3 @@ */ | ||
* for valid domain names. | ||
* Example: ENS doesn't allow domains that start from '-' symbol. | ||
* @param domain - domain name to be checked | ||
@@ -665,2 +842,3 @@ */ | ||
* This method is strongly unrecommended for production use due to lack of support for many ethereum service providers and low performance | ||
* Method is not supported by ENS | ||
* @param domain - domain name | ||
@@ -705,6 +883,14 @@ * @deprecated | ||
return __awaiter(this, void 0, void 0, function () { | ||
var namehash; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
namehash = this.namehash(domain, publicTypes_1.NamingServiceName.UNS); | ||
// The `getTokenUri` method isn't supported in ZNS (it'll throw in the next call) | ||
return [2 /*return*/, this.callServiceForDomain(domain, function (service) { | ||
if (service.name === publicTypes_1.NamingServiceName.UNS) { | ||
var namehash_2 = _this.namehash(domain, publicTypes_1.NamingServiceName.UNS); | ||
return service.getTokenUri(namehash_2); | ||
} | ||
else if (service.name === publicTypes_1.NamingServiceName.ENS) { | ||
return service.getTokenUri(domain); | ||
} | ||
var namehash = _this.namehash(domain, publicTypes_1.NamingServiceName.ZNS); | ||
return service.getTokenUri(namehash); | ||
@@ -749,6 +935,6 @@ })]; | ||
* Retrieves the domain name from tokenId by parsing registry smart contract event logs. | ||
* @throws {ResolutionError} if returned domain name doesn't match the original namhash. | ||
* @returns the domain name retrieved from token metadata | ||
* @param hash - domain hash | ||
* @param service - nameservice which is used for lookup | ||
* @throws {ResolutionError} if returned domain name doesn't match the original namehash. | ||
* @returns the domain name retrieved from token metadata. | ||
* @param hash - domain name hash or label hash. | ||
* @param service - name service which is used for lookup. | ||
*/ | ||
@@ -773,3 +959,3 @@ Resolution.prototype.unhash = function (hash, service) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var zilDomains, unsPromise, znsServices, znsService, znsPromise, unsLocations, emptyZilEntries, znsLocations, _i, emptyZilEntries_1, domain; | ||
var zilDomains, ensDomains, nonEnsDomains, unsPromise, unsLocations, znsServices, znsService_1, znsPromise, emptyZilEntries, znsLocations, _i, emptyZilEntries_1, domain, ensLocations, ensDomain; | ||
return __generator(this, function (_a) { | ||
@@ -779,12 +965,14 @@ switch (_a.label) { | ||
zilDomains = domains.filter(function (domain) { return domain.endsWith('.zil'); }); | ||
unsPromise = this.serviceMap.UNS.usedServices[0].locations(domains); | ||
if (!zilDomains.length) { | ||
return [2 /*return*/, unsPromise]; | ||
} | ||
znsServices = this.serviceMap.ZNS.usedServices; | ||
znsService = znsServices[znsServices.length - 1]; | ||
znsPromise = (0, utils_1.wrapResult)(function () { return znsService.locations(zilDomains); }); | ||
ensDomains = domains.filter(function (domain) { | ||
return domain.match(/^([^\s\\.]+\.)+(eth|luxe|xyz|kred)+$/); | ||
}); | ||
nonEnsDomains = domains.filter(function (domain) { return !domain.match(/^([^\s\\.]+\.)+(eth|luxe|xyz|kred)+$/); }); | ||
unsPromise = this.serviceMap.UNS.usedServices[0].locations(nonEnsDomains); | ||
return [4 /*yield*/, unsPromise]; | ||
case 1: | ||
unsLocations = _a.sent(); | ||
if (!zilDomains.length) return [3 /*break*/, 3]; | ||
znsServices = this.serviceMap.ZNS.usedServices; | ||
znsService_1 = znsServices[znsServices.length - 1]; | ||
znsPromise = (0, utils_1.wrapResult)(function () { return znsService_1.locations(zilDomains); }); | ||
emptyZilEntries = Object.entries(unsLocations).filter(function (_a) { | ||
@@ -794,5 +982,2 @@ var domain = _a[0], location = _a[1]; | ||
}); | ||
if (!emptyZilEntries.length) { | ||
return [2 /*return*/, unsLocations]; | ||
} | ||
return [4 /*yield*/, znsPromise.then(utils_1.unwrapResult)]; | ||
@@ -805,3 +990,13 @@ case 2: | ||
} | ||
return [2 /*return*/, unsLocations]; | ||
_a.label = 3; | ||
case 3: | ||
if (!ensDomains.length) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, this.serviceMap.ENS.usedServices[0].locations(ensDomains)]; | ||
case 4: | ||
ensLocations = _a.sent(); | ||
for (ensDomain in ensLocations) { | ||
unsLocations[ensDomain] = ensLocations[ensDomain]; | ||
} | ||
_a.label = 5; | ||
case 5: return [2 /*return*/, unsLocations]; | ||
} | ||
@@ -818,6 +1013,21 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var tokenId; | ||
var tokenId, ensService, ensDomainName, ensNameHash; | ||
return __generator(this, function (_a) { | ||
tokenId = this.reverseGetTokenId(address, options === null || options === void 0 ? void 0 : options.location); | ||
return [2 /*return*/, tokenId]; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.reverseGetTokenId(address, options === null || options === void 0 ? void 0 : options.location)]; | ||
case 1: | ||
tokenId = _a.sent(); | ||
if (tokenId) { | ||
return [2 /*return*/, tokenId]; | ||
} | ||
ensService = this.serviceMap['ENS'].native; | ||
return [4 /*yield*/, ensService.reverseOf(address)]; | ||
case 2: | ||
ensDomainName = _a.sent(); | ||
if (ensDomainName) { | ||
ensNameHash = ensService.namehash(ensDomainName); | ||
return [2 /*return*/, "".concat(BigInt(ensNameHash))]; | ||
} | ||
return [2 /*return*/, null]; | ||
} | ||
}); | ||
@@ -829,7 +1039,7 @@ }); | ||
* @param address - owner's address | ||
* @returns Promise<URL> - domain URL that is the primary resolution of the provided addresss | ||
* @returns Promise<URL> - domain URL that is the primary resolution of the provided address | ||
*/ | ||
Resolution.prototype.reverse = function (address, options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var tokenId; | ||
var tokenId, ensService, ensDomainName; | ||
return __generator(this, function (_a) { | ||
@@ -843,2 +1053,9 @@ switch (_a.label) { | ||
} | ||
ensService = this.serviceMap['ENS'].native; | ||
return [4 /*yield*/, ensService.reverseOf(address)]; | ||
case 2: | ||
ensDomainName = _a.sent(); | ||
if (ensDomainName) { | ||
return [2 /*return*/, ensDomainName]; | ||
} | ||
return [2 /*return*/, null]; | ||
@@ -1029,2 +1246,15 @@ } | ||
}; | ||
Resolution.prototype.getEnsConfig = function (config) { | ||
var _a, _b, _c; | ||
if (config.apiKey) { | ||
return new Ens_1.default({ | ||
url: "".concat(DEFAULT_UNS_PROXY_SERVICE_URL, "/chains/eth/rpc"), | ||
network: 'mainnet', | ||
proxyServiceApiKey: config.apiKey, | ||
}); | ||
} | ||
return isApi((_a = config.sourceConfig) === null || _a === void 0 ? void 0 : _a.ens) | ||
? new UdApi_1.default((_b = config.sourceConfig) === null || _b === void 0 ? void 0 : _b.ens) | ||
: new Ens_1.default((_c = config.sourceConfig) === null || _c === void 0 ? void 0 : _c.ens); | ||
}; | ||
return Resolution; | ||
@@ -1031,0 +1261,0 @@ }()); |
@@ -5,2 +5,5 @@ import { Provider } from './publicTypes'; | ||
}; | ||
export declare type EnsNetworkIdMap = { | ||
[key: number]: string; | ||
}; | ||
export interface ProxyReaderMap { | ||
@@ -88,2 +91,3 @@ [key: string]: string; | ||
} | ||
export declare const EthCoinIndex = "60"; | ||
export declare const UnsSupportedNetwork: Readonly<{ | ||
@@ -97,2 +101,9 @@ guard: (value: string) => value is "mainnet" | "goerli" | "polygon-mainnet" | "polygon-mumbai"; | ||
export declare type UnsSupportedNetwork = typeof UnsSupportedNetwork.type; | ||
export declare const EnsSupportedNetwork: Readonly<{ | ||
guard: (value: string) => value is "mainnet" | "goerli"; | ||
check: (value: string) => "mainnet" | "goerli"; | ||
values: ("mainnet" | "goerli")[]; | ||
} & { | ||
type: "mainnet" | "goerli"; | ||
}>; | ||
export declare const ZnsSupportedNetwork: Readonly<{ | ||
@@ -99,0 +110,0 @@ guard: (value: string) => value is "mainnet" | "testnet"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hasProvider = exports.ZnsSupportedNetwork = exports.UnsSupportedNetwork = exports.NullAddresses = exports.NullAddress = void 0; | ||
exports.hasProvider = exports.ZnsSupportedNetwork = exports.EnsSupportedNetwork = exports.UnsSupportedNetwork = exports.EthCoinIndex = exports.NullAddresses = exports.NullAddress = void 0; | ||
exports.NullAddress = '0x0000000000000000000000000000000000000000'; | ||
@@ -11,2 +11,3 @@ var NullAddresses; | ||
})(NullAddresses = exports.NullAddresses || (exports.NullAddresses = {})); | ||
exports.EthCoinIndex = '60'; | ||
// TypeScript will infer a string union type from the literal values passed to | ||
@@ -38,2 +39,3 @@ // this function. Without `extends string`, it would instead generalize them | ||
exports.UnsSupportedNetwork = StringUnion('mainnet', 'goerli', 'polygon-mainnet', 'polygon-mumbai'); | ||
exports.EnsSupportedNetwork = StringUnion('mainnet', 'goerli'); | ||
exports.ZnsSupportedNetwork = StringUnion('mainnet', 'testnet'); | ||
@@ -40,0 +42,0 @@ function hasProvider(obj) { |
@@ -23,2 +23,7 @@ import { EventFilter, RequestArguments, RpcProviderLogEntry, TransactionRequest } from './index'; | ||
}; | ||
export declare type EnsSource = NamingServiceSource & { | ||
network: string; | ||
registryAddress?: string; | ||
proxyServiceApiKey?: string; | ||
}; | ||
export declare type ZnsSource = NamingServiceSource & { | ||
@@ -31,2 +36,3 @@ network: string; | ||
zns?: ZnsSource | Api; | ||
ens?: EnsSource | Api; | ||
}; | ||
@@ -43,2 +49,3 @@ export declare type ResolutionConfig = { | ||
UNS = "UNS", | ||
ENS = "ENS", | ||
ZNS = "ZNS" | ||
@@ -62,2 +69,7 @@ } | ||
}; | ||
ens?: { | ||
url: string; | ||
} | { | ||
provider: Provider; | ||
}; | ||
zns?: { | ||
@@ -64,0 +76,0 @@ url: string; |
@@ -12,2 +12,3 @@ "use strict"; | ||
NamingServiceName["UNS"] = "UNS"; | ||
NamingServiceName["ENS"] = "ENS"; | ||
NamingServiceName["ZNS"] = "ZNS"; | ||
@@ -14,0 +15,0 @@ })(NamingServiceName = exports.NamingServiceName || (exports.NamingServiceName = {})); |
@@ -119,3 +119,3 @@ "use strict"; | ||
function fromWeb3Version1Provider(provider) { | ||
if (provider.send === undefined) { | ||
if (provider && provider.send === undefined) { | ||
throw new configurationError_1.ConfigurationError(configurationError_1.ConfigurationErrorCode.IncorrectProvider); | ||
@@ -122,0 +122,0 @@ } |
@@ -5,2 +5,3 @@ import { CryptoRecords, NamingServiceName } from '../types/publicTypes'; | ||
export declare function getLibAgent(): string; | ||
export declare function signedInfuraLink(infura: string, network?: string): string; | ||
export declare function signedLink(key: string, network?: UnsSupportedNetwork, provider?: Providers): string; | ||
@@ -13,2 +14,7 @@ export declare function hexToBytes(hexString: string): number[]; | ||
zil: NamingServiceName; | ||
eth: NamingServiceName; | ||
luxe: NamingServiceName; | ||
xyz: NamingServiceName; | ||
kred: NamingServiceName; | ||
reverse: NamingServiceName; | ||
}; | ||
@@ -15,0 +21,0 @@ export declare const findNamingServiceName: (domain: string) => NamingServiceName | ''; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.unwrapResult = exports.wrapResult = exports.EthereumNetworksInverted = exports.EthereumNetworks = exports.findNamingServiceName = exports.domainExtensionToNamingServiceName = exports.constructRecords = exports.isNullAddress = exports.hexToBytes = exports.signedLink = exports.getLibAgent = void 0; | ||
exports.unwrapResult = exports.wrapResult = exports.EthereumNetworksInverted = exports.EthereumNetworks = exports.findNamingServiceName = exports.domainExtensionToNamingServiceName = exports.constructRecords = exports.isNullAddress = exports.hexToBytes = exports.signedLink = exports.signedInfuraLink = exports.getLibAgent = void 0; | ||
var publicTypes_1 = require("../types/publicTypes"); | ||
@@ -33,2 +33,7 @@ var types_1 = require("../types"); | ||
exports.getLibAgent = getLibAgent; | ||
function signedInfuraLink(infura, network) { | ||
if (network === void 0) { network = 'mainnet'; } | ||
return "https://".concat(network, ".infura.io/v3/").concat(infura); | ||
} | ||
exports.signedInfuraLink = signedInfuraLink; | ||
function signedLink(key, network, provider) { | ||
@@ -69,2 +74,7 @@ if (network === void 0) { network = 'mainnet'; } | ||
zil: publicTypes_1.NamingServiceName.ZNS, | ||
eth: publicTypes_1.NamingServiceName.ENS, | ||
luxe: publicTypes_1.NamingServiceName.ENS, | ||
xyz: publicTypes_1.NamingServiceName.ENS, | ||
kred: publicTypes_1.NamingServiceName.ENS, | ||
reverse: publicTypes_1.NamingServiceName.ENS, | ||
}; | ||
@@ -71,0 +81,0 @@ var findNamingServiceName = function (domain) { |
@@ -7,1 +7,7 @@ export declare function eip137Namehash(domain: string): string; | ||
export declare function fromDecStringToHex(value: string): string; | ||
export declare const splitDomainName: (domain: string) => { | ||
label: string; | ||
tld: string; | ||
}; | ||
export declare const labelNameHash: (domain: string) => string; | ||
export declare const getParentDomain: (domain: string) => string; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fromDecStringToHex = exports.fromHexStringToDecimals = exports.znsChildhash = exports.znsNamehash = exports.eip137Childhash = exports.eip137Namehash = void 0; | ||
exports.getParentDomain = exports.labelNameHash = exports.splitDomainName = exports.fromDecStringToHex = exports.fromHexStringToDecimals = exports.znsChildhash = exports.znsNamehash = exports.eip137Childhash = exports.eip137Namehash = void 0; | ||
var sha256_1 = __importDefault(require("crypto-js/sha256")); | ||
@@ -13,2 +13,3 @@ var sha3_1 = __importDefault(require("crypto-js/sha3")); | ||
var bn_js_1 = __importDefault(require("bn.js")); | ||
var js_sha3_1 = require("js-sha3"); | ||
function eip137Namehash(domain) { | ||
@@ -71,1 +72,26 @@ var arr = hashArray(domain, 'sha3'); | ||
exports.fromDecStringToHex = fromDecStringToHex; | ||
var splitDomainName = function (domain) { | ||
var splitDomain = domain.split('.'); | ||
var label = splitDomain[0]; | ||
var tld = splitDomain[1]; | ||
if (splitDomain.length - 1 < 2) { | ||
return { label: label, tld: tld }; | ||
} | ||
tld = splitDomain[-1]; | ||
label = splitDomain.slice(0, -1).join('.'); | ||
return { label: label, tld: tld }; | ||
}; | ||
exports.splitDomainName = splitDomainName; | ||
// returns the tokenId of an ens domain name. | ||
// @see https://docs.ens.domains/dapp-developer-guide/ens-as-nft#deriving-tokenid-from-ens-name | ||
var labelNameHash = function (domain) { | ||
var splitDomain = (0, exports.splitDomainName)(domain); | ||
var labelHash = (0, js_sha3_1.keccak256)(Buffer.from(splitDomain.label, 'utf8')); | ||
return "0x".concat(labelHash); | ||
}; | ||
exports.labelNameHash = labelNameHash; | ||
var getParentDomain = function (domain) { | ||
var splitDomain = domain.split('.'); | ||
return "".concat(splitDomain[-2], ".").concat(splitDomain[-1]); | ||
}; | ||
exports.getParentDomain = getParentDomain; |
@@ -0,1 +1,5 @@ | ||
## 9.2.0 | ||
- Add ENS support | ||
## 9.1.0 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "@unstoppabledomains/resolution", | ||
"version": "9.1.0", | ||
"version": "9.2.0", | ||
"description": "Domain Resolution for blockchain domains", | ||
@@ -48,2 +48,3 @@ "main": "./build/index.js", | ||
"zns", | ||
"ens", | ||
"ethereum", | ||
@@ -63,2 +64,3 @@ "zilliqa", | ||
"devDependencies": { | ||
"@ensdomains/address-encoder": "0.2.18", | ||
"@ethersproject/providers": "^5.4.5", | ||
@@ -73,5 +75,7 @@ "@types/bn.js": "^4.11.6", | ||
"@typescript-eslint/parser": "^3.9.0", | ||
"@unstoppabledomains/sizecheck": "^4.0.0", | ||
"@unstoppabledomains/sizecheck": "^4.0.4", | ||
"@zilliqa-js/core": "^3.3.4", | ||
"audit-ci": "^3.1.1", | ||
"bip44-constants": "^8.0.103", | ||
"content-hash": "^2.5.2", | ||
"dotenv": "^8.2.0", | ||
@@ -103,5 +107,8 @@ "eslint": "^7.7.0", | ||
"bn.js": "^4.4.0", | ||
"cross-fetch": "^3.1.4", | ||
"cross-fetch": "4.0.0", | ||
"crypto-js": "^4.1.1", | ||
"elliptic": "^6.5.4" | ||
"elliptic": "^6.5.4", | ||
"ethereum-ens-network-map": "^1.0.2", | ||
"js-sha256": "^0.9.0", | ||
"js-sha3": "^0.8.0" | ||
}, | ||
@@ -108,0 +115,0 @@ "lint-staged": { |
@@ -127,2 +127,6 @@ # Resolution | ||
}, | ||
ens: { | ||
url: 'https://mainnet.infura.io/v3/<infura_api_key>', | ||
network: 'mainnet', | ||
}, | ||
}, | ||
@@ -167,2 +171,3 @@ }); | ||
resolve('brad.zil', 'ZIL'); | ||
resolve('vitalik.eth', 'ETH'); | ||
``` | ||
@@ -187,2 +192,3 @@ | ||
resolveIpfsHash('homecakes.crypto'); | ||
resolveIpfsHash('vitalik.eth'); | ||
``` | ||
@@ -195,2 +201,4 @@ | ||
```javascript | ||
// Does not support ENS | ||
function resolveCustomRecord(domain, record) { | ||
@@ -225,5 +233,7 @@ resolution | ||
// Domain homecakes.crypto has address for ETH: 0xe7474D07fD2FA286e7e0aa23cd107F8379085037 | ||
getWalletAddr('vitalik.eth', 'ETH'); | ||
// Domain homecakes.crypto has address for ETH: 0xe7474D07fD2FA286e7e0aa23cd107F8379085037 | ||
``` | ||
**Resolve multi-chain address format (similar to **`multiChainAddr`** API)** | ||
### Resolve multi-chain address format using `multiChainAddr` | ||
@@ -237,2 +247,4 @@ This API is used to retrieve wallet address for multi-chain address records. | ||
```javascript | ||
// Does not support ENS | ||
function getMultiChainWalletAddr(domain, ticker, network) { | ||
@@ -295,3 +307,3 @@ resolution | ||
centralized exchanges, users have same wallet addresses on different networks | ||
with same wallet family. | ||
with same wallet family. (See [Blockchain Family, Network, Token Level Addresses](https://apidocs.unstoppabledomains.com/resolution/guides/records-reference/#blockchain-family-network-token-level-addresses) section for the record format) | ||
@@ -345,2 +357,3 @@ With `blockchain-family-keys.x` only has `token.EVM.address` record on-chain. | ||
`getAddress(domain, 'ETH', 'USDC')` will lookup records in the following order: | ||
// Not supported with ENS | ||
@@ -355,11 +368,2 @@ ``` | ||
> **Warning** please use the API with caution as it's still in beta. Please | ||
> submit an issue if you find a bug. | ||
### Command Line Interface | ||
CLI support was removed from the Resolution library starting from version 6.0. | ||
Please use the | ||
[standalone CLI tool](https://github.com/unstoppabledomains/resolution-cli). | ||
## Error Handling | ||
@@ -401,3 +405,2 @@ | ||
#### To update: | ||
- Network config: `$ yarn network-config:pull` | ||
@@ -404,0 +407,0 @@ - Resolver keys: `$ yarn resolver-keys:pull` |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
623236
77
15702
438
8
34
1
1
+ Addedjs-sha256@^0.9.0
+ Addedjs-sha3@^0.8.0
+ Addedcross-fetch@4.0.0(transitive)
+ Addedethereum-ens-network-map@1.0.2(transitive)
+ Addedjs-sha256@0.9.0(transitive)
- Removedcross-fetch@3.1.8(transitive)
Updatedcross-fetch@4.0.0