@unstoppabledomains/resolution
Advanced tools
Comparing version 1.19.0 to 1.20.0
{ | ||
"name": "@unstoppabledomains/resolution", | ||
"version": "1.18.0", | ||
"version": "1.19.0", | ||
"description": "Domain Resolution for blockchain domains", | ||
@@ -77,2 +77,3 @@ "main": "./build/index.js", | ||
"@unstoppabledomains/sizecheck": "^4.0.0", | ||
"audit-ci": "^3.1.1", | ||
"eslint": "^7.7.0", | ||
@@ -79,0 +80,0 @@ "eslint-plugin-jest": "^24.1.0", |
@@ -169,2 +169,3 @@ import { EventFilter, RequestArguments, RpcProviderLogEntry, TransactionRequest } from './types'; | ||
}; | ||
/** @deprecated */ | ||
export declare enum TickerVersion { | ||
@@ -171,0 +172,0 @@ ERC20 = "ERC20", |
@@ -79,2 +79,4 @@ "use strict"; | ||
})(DnsRecordType = exports.DnsRecordType || (exports.DnsRecordType = {})); | ||
// TODO remove in 2.0 | ||
/** @deprecated */ | ||
var TickerVersion; | ||
@@ -81,0 +83,0 @@ (function (TickerVersion) { |
@@ -86,5 +86,16 @@ import { Blockchain, ResolutionResponse, API, NamingServiceName, Web3Version0Provider, Web3Version1Provider, Provider, NamehashOptions, DnsRecordType, DnsRecord, CryptoRecords, TickerVersion } from './publicTypes'; | ||
*/ | ||
addr(domain: string, currrencyTicker: string): Promise<string>; | ||
addr(domain: string, ticker: string): Promise<string>; | ||
/** | ||
* Read multi-chain currency address if exists | ||
* @async | ||
* @param domain - domain name to be resolved | ||
* @param ticker - currency ticker (USDT, FTM, etc.) | ||
* @param chain - chain version, usually means blockchain ( ERC20, BEP2, OMNI, etc. ) | ||
* @throws [[ResolutionError]] if address is not found | ||
* @returns A promise that resolves in an adress | ||
*/ | ||
multiChainAddr(domain: string, ticker: string, chain: string): Promise<string>; | ||
/** | ||
* Resolves given domain name to a specific USDT chain address if exists | ||
* @deprecated | ||
* @async | ||
@@ -91,0 +102,0 @@ * @param domain - domain name to be resolved |
@@ -236,7 +236,7 @@ "use strict"; | ||
*/ | ||
Resolution.prototype.addr = function (domain, currrencyTicker) { | ||
Resolution.prototype.addr = function (domain, ticker) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.record(domain, "crypto." + currrencyTicker.toUpperCase() + ".address")]; | ||
case 0: return [4 /*yield*/, this.record(domain, "crypto." + ticker.toUpperCase() + ".address")]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
@@ -248,3 +248,31 @@ } | ||
/** | ||
* Read multi-chain currency address if exists | ||
* @async | ||
* @param domain - domain name to be resolved | ||
* @param ticker - currency ticker (USDT, FTM, etc.) | ||
* @param chain - chain version, usually means blockchain ( ERC20, BEP2, OMNI, etc. ) | ||
* @throws [[ResolutionError]] if address is not found | ||
* @returns A promise that resolves in an adress | ||
*/ | ||
Resolution.prototype.multiChainAddr = function (domain, ticker, chain) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var method, recordKey; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
domain = this.prepareDomain(domain); | ||
method = this.getNamingMethodOrThrow(domain); | ||
if (method.name === publicTypes_1.NamingServiceName.ENS) { | ||
throw new resolutionError_1.default(resolutionError_1.ResolutionErrorCode.UnsupportedMethod, { methodName: publicTypes_1.NamingServiceName.ENS, domain: domain }); | ||
} | ||
recordKey = "crypto." + ticker.toUpperCase() + ".version." + chain.toUpperCase() + ".address"; | ||
return [4 /*yield*/, method.record(domain, recordKey)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Resolves given domain name to a specific USDT chain address if exists | ||
* @deprecated | ||
* @async | ||
@@ -251,0 +279,0 @@ * @param domain - domain name to be resolved |
@@ -1,2 +0,7 @@ | ||
## 1.18.1 | ||
## 1.20.0 | ||
* Introduced Resolution#multiChainAddr(domain: string, ticker: string, chain: string) - More general method to fetch multi chain records. | ||
* Deprecated Resolution#usdt method in favor of multiChainAddr | ||
* Deprecated TickerVersion | ||
## 1.19.0 | ||
* Update @ensdomains/address-encoder dependency to remove security audit issues | ||
@@ -3,0 +8,0 @@ * Remove webpack dependency to remove security audit issues |
{ | ||
"name": "@unstoppabledomains/resolution", | ||
"version": "1.19.0", | ||
"version": "1.20.0", | ||
"description": "Domain Resolution for blockchain domains", | ||
@@ -77,2 +77,3 @@ "main": "./build/index.js", | ||
"@unstoppabledomains/sizecheck": "^4.0.0", | ||
"audit-ci": "^3.1.1", | ||
"eslint": "^7.7.0", | ||
@@ -79,0 +80,0 @@ "eslint-plugin-jest": "^24.1.0", |
@@ -73,4 +73,13 @@ # Resolution | ||
function resolveMultiChain(domain, currency, chain) { | ||
resolution | ||
.multiChainAddr(domain, currency, chain) | ||
.then((address) => console.log(domain, 'resolves to', address, version)) | ||
.catch(console.error); | ||
} | ||
resolve('brad.crypto', 'ETH'); | ||
resolve('brad.zil', 'ZIL'); | ||
resolveMultiChain('brad.crypto', 'USDT', 'ERC20'); | ||
resolveMultiChain('brad.crypto', 'USDT', 'OMNI'); | ||
``` | ||
@@ -77,0 +86,0 @@ |
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
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
374143
9386
228
24