Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unstoppabledomains/resolution

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unstoppabledomains/resolution - npm Package Compare versions

Comparing version 1.0.20 to 1.0.22

build/size.d.ts

10

build/cns.js

@@ -67,4 +67,4 @@ "use strict";

var namehash_1 = __importStar(require("./cns/namehash"));
var _1 = require(".");
var resolutionError_1 = require("./resolutionError");
var resolutionError_1 = __importDefault(require("./resolutionError"));
var resolutionError_2 = require("./resolutionError");
/**

@@ -98,3 +98,3 @@ * Class to support connection with Crypto naming service

switch (_a.label) {
case 0: return [4 /*yield*/, this.ignoreResolutionError(resolutionError_1.ResolutionErrorCode.RecordNotFound, this.callMethod(this.registryContract, 'resolverOf', [tokenId]))];
case 0: return [4 /*yield*/, this.ignoreResolutionError(resolutionError_2.ResolutionErrorCode.RecordNotFound, this.callMethod(this.registryContract, 'resolverOf', [tokenId]))];
case 1: return [2 /*return*/, _a.sent()];

@@ -170,3 +170,3 @@ }

if (!addr)
throw new _1.ResolutionError(resolutionError_1.ResolutionErrorCode.UnspecifiedCurrency, {
throw new resolutionError_1.default(resolutionError_2.ResolutionErrorCode.UnspecifiedCurrency, {
domain: domain,

@@ -298,3 +298,3 @@ currencyTicker: currencyTicker,

if (!record || types_1.isNullAddress(record))
throw new _1.ResolutionError(resolutionError_1.ResolutionErrorCode.RecordNotFound, {
throw new resolutionError_1.default(resolutionError_2.ResolutionErrorCode.RecordNotFound, {
recordName: key,

@@ -301,0 +301,0 @@ domain: domain,

@@ -42,6 +42,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var _1 = __importDefault(require("."));
var index_1 = __importDefault(require("./index"));
var testHelpers_1 = require("./utils/testHelpers");
var resolutionError_1 = require("./resolutionError");
var dotenv_1 = __importDefault(require("dotenv"));
var types_1 = require("./types");
dotenv_1.default.config();

@@ -52,3 +53,3 @@ var labelDomain = 'reseller-test-braden-6.crypto';

jest.restoreAllMocks();
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { cns: { url: testHelpers_1.secretInfuraLink() } },

@@ -91,7 +92,13 @@ });

it('Should return NoRecord Resolution error', function () { return __awaiter(void 0, void 0, void 0, function () {
var spies;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.record(labelDomain, 'No.such.record'), resolutionError_1.ResolutionErrorCode.RecordNotFound)];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.cns, {
getResolver: undefined
});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.record(labelDomain, 'No.such.record'), resolutionError_1.ResolutionErrorCode.RecordNotFound)];
case 1:
_a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
return [2 /*return*/];

@@ -135,8 +142,13 @@ }

it('should return a valid resolver address', function () { return __awaiter(void 0, void 0, void 0, function () {
var resolverAddress;
var spies, resolverAddress;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, resolution.cns.resolver('brad.crypto')];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.cns, {
getResolver: '0xA1cAc442Be6673C49f8E74FFC7c4fD746f3cBD0D'
});
return [4 /*yield*/, resolution.cns.resolver('brad.crypto')];
case 1:
resolverAddress = _a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
expect(resolverAddress).toBe('0xA1cAc442Be6673C49f8E74FFC7c4fD746f3cBD0D');

@@ -148,7 +160,14 @@ return [2 /*return*/];

it('should not find a resolver address', function () { return __awaiter(void 0, void 0, void 0, function () {
var spies;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.resolver('empty.crypto'), resolutionError_1.ResolutionErrorCode.UnregisteredDomain)];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.cns, {
getResolver: undefined,
owner: types_1.NullAddress[1]
});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.resolver('empty.crypto'), resolutionError_1.ResolutionErrorCode.UnregisteredDomain)];
case 1:
_a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
return [2 /*return*/];

@@ -159,7 +178,14 @@ }

it('should throw ResolutionError.UnspecifiedResolver', function () { return __awaiter(void 0, void 0, void 0, function () {
var spies;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.resolver('pandorapay.crypto'), resolutionError_1.ResolutionErrorCode.UnspecifiedResolver)];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.cns, {
getResolver: undefined,
owner: 'someowneraddress'
});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.cns.resolver('pandorapay.crypto'), resolutionError_1.ResolutionErrorCode.UnspecifiedResolver)];
case 1:
_a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
return [2 /*return*/];

@@ -356,8 +382,13 @@ }

it('should resolve with ipfs stored on cns', function () { return __awaiter(void 0, void 0, void 0, function () {
var ipfsHash;
var spies, ipfsHash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, resolution.ipfsHash(domain)];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.cns, {
getRecord: '0x033dc48b5db4ca62861643e9d2c411d9eb6d1975@gmail.com'
});
return [4 /*yield*/, resolution.ipfsHash(domain)];
case 1:
ipfsHash = _a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
expect(ipfsHash).toBe('0x033dc48b5db4ca62861643e9d2c411d9eb6d1975@gmail.com');

@@ -364,0 +395,0 @@ return [2 /*return*/];

@@ -50,3 +50,3 @@ "use strict";

var nock_1 = __importDefault(require("nock"));
var _1 = __importStar(require("."));
var index_1 = __importStar(require("./index"));
var ens_1 = __importDefault(require("./ens"));

@@ -61,3 +61,3 @@ var types_1 = require("./types");

jest.restoreAllMocks();
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { url: testHelpers_1.secretInfuraLink() } },

@@ -70,3 +70,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { network: 'mainnet' } },

@@ -84,3 +84,3 @@ });

case 0:
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { url: testHelpers_1.secretInfuraLink() } },

@@ -195,7 +195,13 @@ });

it('resolves .luxe name using ENS blockchain with thrown error', function () { return __awaiter(void 0, void 0, void 0, function () {
var spies;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('something.luxe', 'ETH'), _1.ResolutionErrorCode.UnregisteredDomain)];
case 0:
spies = testHelpers_1.mockAsyncMethods(resolution.ens, {
getResolver: undefined
});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('something.luxe', 'ETH'), index_1.ResolutionErrorCode.UnregisteredDomain)];
case 1:
_a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
return [2 /*return*/];

@@ -245,3 +251,3 @@ }

return __generator(this, function (_a) {
resolution = new _1.default({ blockchain: { ens: true } });
resolution = new index_1.default({ blockchain: { ens: true } });
expect(resolution.ens.network).toBe('mainnet');

@@ -272,3 +278,3 @@ expect(resolution.ens.url).toBe('https://mainnet.infura.io');

return __generator(this, function (_a) {
resolution = new _1.default({ blockchain: { ens: { network: 3 } } });
resolution = new index_1.default({ blockchain: { ens: { network: 3 } } });
expect(resolution.ens.network).toBe('ropsten');

@@ -283,3 +289,3 @@ expect(resolution.ens.url).toBe('https://ropsten.infura.io');

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { url: 'https://rinkeby.infura.io' } },

@@ -295,3 +301,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { url: 'https://goerli.infura.io', network: 5 } },

@@ -307,3 +313,3 @@ });

return __generator(this, function (_a) {
expect(function () { return new _1.default({ blockchain: { ens: { network: 7543 } } }); }).toThrowError('Unspecified network in Resolution ENS configuration');
expect(function () { return new index_1.default({ blockchain: { ens: { network: 7543 } } }); }).toThrowError('Unspecified network in Resolution ENS configuration');
return [2 /*return*/];

@@ -314,3 +320,3 @@ });

return __generator(this, function (_a) {
expect(function () { return new _1.default({ blockchain: { ens: { network: 'invalid' } } }); }).toThrowError('Unspecified url in Resolution ENS configuration');
expect(function () { return new index_1.default({ blockchain: { ens: { network: 'invalid' } } }); }).toThrowError('Unspecified url in Resolution ENS configuration');
return [2 /*return*/];

@@ -322,3 +328,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { network: 'mainnet' } },

@@ -334,3 +340,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { ens: { network: 'kovan' } },

@@ -346,3 +352,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -361,3 +367,3 @@ ens: { registry: '0x314159265dd8dbb310642f98f50c066173c1259b' },

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -379,3 +385,3 @@ ens: {

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -394,3 +400,3 @@ ens: { registry: '0xabcffff1231586348194fcabbeff1231240234fc' },

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -561,5 +567,5 @@ ens: { network: 'custom', url: 'https://custom.notinfura.io' },

switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(new _1.default({
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(new index_1.default({
blockchain: { ens: { url: testHelpers_1.secretInfuraLink() } },
}).addressOrThrow('testthing.eth', 'bnb'), _1.ResolutionErrorCode.UnsupportedCurrency)];
}).addressOrThrow('testthing.eth', 'bnb'), index_1.ResolutionErrorCode.UnsupportedCurrency)];
case 1:

@@ -574,5 +580,5 @@ _a.sent();

switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(new _1.default({
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(new index_1.default({
blockchain: { ens: { url: testHelpers_1.secretInfuraLink() } },
}).addressOrThrow('testthing.eth', 'UNREALTICKER'), _1.ResolutionErrorCode.UnsupportedCurrency)];
}).addressOrThrow('testthing.eth', 'UNREALTICKER'), index_1.ResolutionErrorCode.UnsupportedCurrency)];
case 1:

@@ -621,3 +627,3 @@ _a.sent();

getTTL: 0,
fetchAddressOrThrow: new _1.ResolutionError(_1.ResolutionErrorCode.RecordNotFound),
fetchAddressOrThrow: new index_1.ResolutionError(index_1.ResolutionErrorCode.RecordNotFound),
});

@@ -655,3 +661,3 @@ return [4 /*yield*/, resolution.resolve('matthewgould.eth')];

switch (_a.label) {
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.resolver('empty.eth'), _1.ResolutionErrorCode.UnspecifiedResolver)];
case 0: return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.resolver('empty.eth'), index_1.ResolutionErrorCode.UnspecifiedResolver)];
case 1:

@@ -685,3 +691,3 @@ _a.sent();

expect(resolution.ens.isSupportedDomain('-hello.eth')).toEqual(false);
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello.eth'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello.eth'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -698,3 +704,3 @@ _a.sent();

expect(resolution.isSupportedDomain('hello-.eth')).toEqual(false);
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('hello-.eth'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('hello-.eth'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -711,3 +717,3 @@ _a.sent();

expect(resolution.isSupportedDomain('-hello-.eth')).toEqual(false);
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello-.eth'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello-.eth'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -767,3 +773,3 @@ _a.sent();

httpUrlPromise = resolution.httpUrl('matthewgould.eth');
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(httpUrlPromise, _1.ResolutionErrorCode.RecordNotFound)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(httpUrlPromise, index_1.ResolutionErrorCode.RecordNotFound)];
case 1:

@@ -786,3 +792,3 @@ _a.sent();

testHelpers_1.expectSpyToBeCalled(eyes);
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(emailPromise, _1.ResolutionErrorCode.RecordNotFound)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(emailPromise, index_1.ResolutionErrorCode.RecordNotFound)];
case 1:

@@ -789,0 +795,0 @@ _a.sent();

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var _1 = require("../../.");
var resolutionError_1 = require("../../resolutionError");
var newResolver_1 = __importDefault(require("./newResolver"));

@@ -17,3 +17,3 @@ var oldResolver_1 = __importDefault(require("./oldResolver"));

if (coinType !== types_1.EthCoinIndex) {
throw new _1.ResolutionError(_1.ResolutionErrorCode.IncorrectResolverInterface, { method: types_1.NamingServiceName.ENS });
throw new resolutionError_1.ResolutionError(resolutionError_1.ResolutionErrorCode.IncorrectResolverInterface, { method: types_1.NamingServiceName.ENS });
}

@@ -20,0 +20,0 @@ return oldResolver_1.default;

@@ -46,3 +46,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var Index = __importStar(require("."));
var Index = __importStar(require("./index"));
describe('Exported variables', function () {

@@ -49,0 +49,0 @@ it('works', function () { return __awaiter(void 0, void 0, void 0, function () {

@@ -13,2 +13,3 @@ export declare const name: string;

"release:major": string;
"release:run": string;
"release:tag": string;

@@ -26,2 +27,3 @@ "test": string;

"analyze": string;
"size": string;
};

@@ -49,2 +51,3 @@ export declare const files: string[];

"ts-loader": string;
"ts-node": string;
"typedoc": string;

@@ -51,0 +54,0 @@ "typescript": string;

{
"name": "@unstoppabledomains/resolution",
"version": "1.0.19",
"version": "1.0.21",
"description": "Domain Resolution for blockchain domains",

@@ -11,5 +11,6 @@ "main": "./build/index.js",

"scripts": {
"release": "yarn build && yarn test && git push && yarn publish --patch && yarn docs && yarn docs:deploy && yarn release:tag",
"release:minor": "yarn build && yarn test && yarn publish --minor && yarn docs && yarn docs:deploy && yarn release:tag",
"release:major": "yarn build && yarn test && yarn publish --major && yarn docs && yarn docs:deploy && yarn release:tag",
"release": "RELEASE=patch yarn release:run",
"release:minor": "RELEASE=minor yarn release:run",
"release:major": "RELEASE=major yarn release:run",
"release:run": "yarn build && yarn size && yarn publish --$RELEASE && yarn docs && yarn docs:deploy && yarn release:tag",
"release:tag": "git push origin v$npm_package_version",

@@ -26,3 +27,4 @@ "test": "jest",

"docs:deploy": "./deploy-docs.sh",
"analyze": "webpack-cli"
"analyze": "webpack-cli",
"size": "ts-node ./src/size.ts"
},

@@ -52,2 +54,3 @@ "files": [

"ts-loader": "6.2.1",
"ts-node": "^8.6.2",
"typedoc": "0.15.4",

@@ -72,3 +75,3 @@ "typescript": "3.7.3",

"bip44-constants": "8.0.5",
"bn.js": "^5.1.1",
"bn.js": "5.1.1",
"content-hash": "2.5.2",

@@ -75,0 +78,0 @@ "hash.js": "1.1.7",

@@ -50,3 +50,3 @@ "use strict";

var nock_1 = __importDefault(require("nock"));
var _1 = __importStar(require("."));
var index_1 = __importStar(require("./index"));
var types_1 = require("./types");

@@ -64,4 +64,4 @@ var testHelpers_1 = require("./utils/testHelpers");

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('sdncdoncvdinvcsdncs.zil', 'ZIL'), _1.ResolutionErrorCode.UnregisteredDomain)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('sdncdoncvdinvcsdncs.zil', 'ZIL'), index_1.ResolutionErrorCode.UnregisteredDomain)];
case 1:

@@ -78,4 +78,4 @@ _a.sent();

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('brad.zil', 'INVALID_CURRENCY_SYMBOL'), _1.ResolutionErrorCode.UnspecifiedCurrency)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('brad.zil', 'INVALID_CURRENCY_SYMBOL'), index_1.ResolutionErrorCode.UnspecifiedCurrency)];
case 1:

@@ -92,4 +92,4 @@ _a.sent();

case 0:
resolution = new _1.default({ blockchain: true });
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('bogdangusiev.qq', 'ZIL'), _1.ResolutionErrorCode.UnsupportedDomain)];
resolution = new index_1.default({ blockchain: true });
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.addressOrThrow('bogdangusiev.qq', 'ZIL'), index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -106,3 +106,3 @@ _a.sent();

case 0:
resolution = new _1.default({ blockchain: true });
resolution = new index_1.default({ blockchain: true });
return [4 /*yield*/, resolution.address('bogdangusiev.qq', 'ZIL')];

@@ -128,3 +128,3 @@ case 1:

return __generator(this, function (_a) {
resolution = new _1.default();
resolution = new index_1.default();
result = resolution.isSupportedDomainInNetwork('brad.zil');

@@ -140,4 +140,4 @@ expect(result).toBe(true);

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('something.hello.com'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('something.hello.com'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -150,10 +150,23 @@ _a.sent();

it('checks return of IPFS hash for brad.zil', function () { return __awaiter(void 0, void 0, void 0, function () {
var resolution, hash;
var resolution, spies, hash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
resolution = new _1.default();
resolution = new index_1.default();
spies = testHelpers_1.mockAsyncMethods(resolution.zns, {
records: { 'crypto.BCH.address': 'qrq4sk49ayvepqz7j7ep8x4km2qp8lauvcnzhveyu6',
'crypto.BTC.address': '1EVt92qQnaLDcmVFtHivRJaunG2mf2C3mB',
'crypto.DASH.address': 'XnixreEBqFuSLnDSLNbfqMH1GsZk7cgW4j',
'crypto.ETH.address': '0x45b31e01AA6f42F0549aD482BE81635ED3149abb',
'crypto.LTC.address': 'LetmswTW3b7dgJ46mXuiXMUY17XbK29UmL',
'crypto.XMR.address': '447d7TVFkoQ57k3jm3wGKoEAkfEym59mK96Xw5yWamDNFGaLKW5wL2qK5RMTDKGSvYfQYVN7dLSrLdkwtKH3hwbSCQCu26d',
'crypto.ZEC.address': 't1h7ttmQvWCSH1wfrcmvT4mZJfGw2DgCSqV',
'crypto.ZIL.address': 'zil1yu5u4hegy9v3xgluweg4en54zm8f8auwxu0xxj',
'ipfs.html.value': 'QmVaAtQbi3EtsfpKoLzALm6vXphdi2KjMgxEDKeGg6wHuK',
'ipfs.redirect_domain.value': 'www.unstoppabledomains.com' }
});
return [4 /*yield*/, resolution.ipfsHash('brad.zil')];
case 1:
hash = _a.sent();
testHelpers_1.expectSpyToBeCalled(spies);
expect(hash).toBe('QmVaAtQbi3EtsfpKoLzALm6vXphdi2KjMgxEDKeGg6wHuK');

@@ -169,3 +182,3 @@ return [2 /*return*/];

case 0:
resolution = new _1.default();
resolution = new index_1.default();
return [4 /*yield*/, resolution.email('ergergergerg.zil')];

@@ -184,4 +197,4 @@ case 1:

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.email('brad.zil'), _1.ResolutionErrorCode.RecordNotFound)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.email('brad.zil'), index_1.ResolutionErrorCode.RecordNotFound)];
case 1:

@@ -198,4 +211,4 @@ _a.sent();

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello.eth'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('-hello.eth'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -212,4 +225,4 @@ _a.sent();

case 0:
resolution = new _1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('whatever-.eth'); }, _1.ResolutionErrorCode.UnsupportedDomain)];
resolution = new index_1.default();
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(function () { return resolution.namehash('whatever-.eth'); }, index_1.ResolutionErrorCode.UnsupportedDomain)];
case 1:

@@ -223,3 +236,3 @@ _a.sent();

it('checks ens service name', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var serviceName = resolution.serviceName('domain.eth');

@@ -229,3 +242,3 @@ expect(serviceName).toBe('ENS');

it('checks ens service name 2', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var serviceName = resolution.serviceName('domain.luxe');

@@ -235,3 +248,3 @@ expect(serviceName).toBe('ENS');

it('checks ens service name', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var serviceName = resolution.serviceName('domain.xyz');

@@ -241,3 +254,3 @@ expect(serviceName).toBe('ENS');

it('checks zns service name', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var serviceName = resolution.serviceName('domain.zil');

@@ -247,3 +260,3 @@ expect(serviceName).toBe('ZNS');

it('checks cns service name', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var serviceName = resolution.serviceName('domain.crypto');

@@ -253,3 +266,3 @@ expect(serviceName).toBe('CNS');

it('checks naming service via api', function () {
var resolution = new _1.default({ blockchain: false });
var resolution = new index_1.default({ blockchain: false });
var serviceName = resolution.serviceName('domain.zil');

@@ -259,3 +272,3 @@ expect(serviceName).toBe('ZNS');

it('checks naming service via api 2', function () {
var resolution = new _1.default({ blockchain: false });
var resolution = new index_1.default({ blockchain: false });
var serviceName = resolution.serviceName('domain.luxe');

@@ -265,3 +278,3 @@ expect(serviceName).toBe('ENS');

it('checks naming service via api 3', function () {
var resolution = new _1.default({ blockchain: false });
var resolution = new index_1.default({ blockchain: false });
var serviceName = resolution.serviceName('domain.xyz');

@@ -271,3 +284,3 @@ expect(serviceName).toBe('ENS');

it('checks naming service via api 4', function () {
var resolution = new _1.default({ blockchain: false });
var resolution = new index_1.default({ blockchain: false });
var serviceName = resolution.serviceName('domain.eth');

@@ -277,3 +290,3 @@ expect(serviceName).toBe('ENS');

it('checks naming service via api 5', function () {
var resolution = new _1.default({ blockchain: false });
var resolution = new index_1.default({ blockchain: false });
var serviceName = resolution.serviceName('domain.crypto');

@@ -287,3 +300,3 @@ expect(serviceName).toBe('CNS');

return __generator(this, function (_a) {
resolution = new _1.default();
resolution = new index_1.default();
domain = 'hello.world.zil';

@@ -301,3 +314,3 @@ hash = resolution.namehash(domain);

it('checks childhash', function () {
var resolution = new _1.default();
var resolution = new index_1.default();
var domain = 'hello.world.zil';

@@ -309,3 +322,3 @@ var namehash = resolution.namehash(domain);

it('checks childhash multi level domain', function () {
var cns = new _1.default().cns;
var cns = new index_1.default().cns;
var domain = 'ich.ni.san.yon.hello.world.crypto';

@@ -312,0 +325,0 @@ var namehash = cns.namehash(domain);

@@ -50,3 +50,3 @@ "use strict";

var nock_1 = __importDefault(require("nock"));
var _1 = __importStar(require("."));
var index_1 = __importStar(require("./index"));
var testHelpers_1 = require("./utils/testHelpers");

@@ -64,3 +64,3 @@ beforeEach(function () {

testHelpers_1.mockAPICalls('ud_api_generic_test', testHelpers_1.DefaultUrl);
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
return [4 /*yield*/, resolution.address('cofounding.zil', 'eth')];

@@ -77,3 +77,3 @@ case 1:

return __generator(this, function (_a) {
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
expect(resolution.namehash('cofounding.zil')).toEqual('0x1cc365ffd60bb50538e01d24c1f1e26c887c36f26a0de250660b8a1465c60667');

@@ -86,3 +86,3 @@ return [2 /*return*/];

return __generator(this, function (_a) {
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
expect(resolution.isSupportedDomain('cofounding.zil')).toEqual(true);

@@ -99,7 +99,7 @@ expect(resolution.isSupportedDomain('cofounding.eth')).toEqual(true);

case 0:
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
error = new Error();
error.name = 'FetchError';
jest.spyOn(resolution.api, 'fetch').mockRejectedValue(error);
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.resolve('hello.zil'), _1.ResolutionErrorCode.NamingServiceDown)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.resolve('hello.zil'), index_1.ResolutionErrorCode.NamingServiceDown)];
case 1:

@@ -116,3 +116,3 @@ _a.sent();

case 0:
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
testHelpers_1.mockAPICalls('ud_api_generic_test', testHelpers_1.DefaultUrl);

@@ -132,3 +132,3 @@ _a = expect;

case 0:
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
eyes = testHelpers_1.mockAsyncMethod(resolution.api, 'resolve', {

@@ -170,3 +170,3 @@ addresses: {

case 0:
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
eyes = testHelpers_1.mockAsyncMethod(resolution.api, 'resolve', {

@@ -202,3 +202,3 @@ addresses: {},

case 0:
resolution = new _1.default({ blockchain: false });
resolution = new index_1.default({ blockchain: false });
eyes = testHelpers_1.mockAsyncMethod(resolution.api, 'resolve', {

@@ -205,0 +205,0 @@ addresses: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _1 = require(".");
var index_1 = require("./index");
describe('Lodash', function () {
describe('set', function () {
it('should set new values', function () {
expect(_1.set({}, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
expect(index_1.set({}, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
});
it('should set new property to the existing object', function () {
expect(_1.set({ a: 1 }, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
expect(index_1.set({ a: 1 }, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
});
it('should work on deeper levels', function () {
expect(_1.set({ a: { b: 2 } }, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
expect(index_1.set({ a: { b: 2 } }, "a.b", 1)).toStrictEqual({ a: { b: 1 } });
});
it('should just work', function () {
expect(_1.set({}, 'crypto.BCH.address', 'qrq4sk49ayvepqz7j7ep8x4km2qp8lauvcnzhveyu6')).toStrictEqual({ crypto: { BCH: { address: 'qrq4sk49ayvepqz7j7ep8x4km2qp8lauvcnzhveyu6' } } });
expect(index_1.set({}, 'crypto.BCH.address', 'qrq4sk49ayvepqz7j7ep8x4km2qp8lauvcnzhveyu6')).toStrictEqual({ crypto: { BCH: { address: 'qrq4sk49ayvepqz7j7ep8x4km2qp8lauvcnzhveyu6' } } });
});

@@ -25,3 +25,3 @@ });

};
expect(_1.invert(object)).toStrictEqual({
expect(index_1.invert(object)).toStrictEqual({
'https://api.zilliqa.com': 'mainnet',

@@ -28,0 +28,0 @@ 'https://dev-api.zilliqa.com': 'testnet',

@@ -46,3 +46,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var _1 = __importStar(require("."));
var index_1 = __importStar(require("./index"));
var testHelpers_1 = require("./utils/testHelpers");

@@ -53,3 +53,3 @@ var types_1 = require("./types");

jest.restoreAllMocks();
resolution = new _1.default();
resolution = new index_1.default();
});

@@ -68,3 +68,3 @@ describe('ZNS', function () {

return __generator(this, function (_a) {
resolution = new _1.default({ blockchain: { zns: false } });
resolution = new index_1.default({ blockchain: { zns: false } });
expect(resolution.zns).toBeUndefined();

@@ -83,3 +83,3 @@ return [2 /*return*/];

return __generator(this, function (_a) {
expect(function () { return new _1.default({ blockchain: { zns: 'https://wrongurl.com' } }); }).toThrowError('Unspecified network in Resolution ZNS configuration');
expect(function () { return new index_1.default({ blockchain: { zns: 'https://wrongurl.com' } }); }).toThrowError('Unspecified network in Resolution ZNS configuration');
return [2 /*return*/];

@@ -91,3 +91,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { url: 'https://api.zilliqa.com' } },

@@ -103,3 +103,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { network: 333 } },

@@ -116,3 +116,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { url: 'https://api.zilliqa.com' } },

@@ -128,3 +128,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { url: 'https://api.zilliqa.com', network: 1 } },

@@ -140,3 +140,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { url: 'https://api.zilliqa.com', network: 333 } },

@@ -152,3 +152,3 @@ });

return __generator(this, function (_a) {
expect(function () { return new _1.default({ blockchain: { zns: { network: 42 } } }); }).toThrowError('Unspecified network in Resolution ZNS configuration');
expect(function () { return new index_1.default({ blockchain: { zns: { network: 42 } } }); }).toThrowError('Unspecified network in Resolution ZNS configuration');
return [2 /*return*/];

@@ -159,3 +159,3 @@ });

return __generator(this, function (_a) {
expect(function () { return new _1.default({ blockchain: { zns: { network: 'invalid' } } }); }).toThrowError('Unspecified url in Resolution ZNS configuration');
expect(function () { return new index_1.default({ blockchain: { zns: { network: 'invalid' } } }); }).toThrowError('Unspecified url in Resolution ZNS configuration');
return [2 /*return*/];

@@ -167,3 +167,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { network: 'mainnet' } },

@@ -179,3 +179,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: { zns: { network: 'testnet' } },

@@ -192,3 +192,3 @@ });

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -207,3 +207,3 @@ zns: { registry: 'zil1jcgu2wlx6xejqk9jw3aaankw6lsjzeunx2j0jz' },

return __generator(this, function (_a) {
resolution = new _1.default({
resolution = new index_1.default({
blockchain: {

@@ -461,3 +461,3 @@ zns: { registry: '0xabcffff1231586348194fcabbeff1231240234fc' },

});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('sopmethingveryweirdthatnoonewilltakeever.zil'), _1.ResolutionErrorCode.UnregisteredDomain)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('sopmethingveryweirdthatnoonewilltakeever.zil'), index_1.ResolutionErrorCode.UnregisteredDomain)];
case 1:

@@ -479,3 +479,3 @@ _a.sent();

});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('uihui12d.zil'), _1.ResolutionErrorCode.UnspecifiedResolver)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('uihui12d.zil'), index_1.ResolutionErrorCode.UnspecifiedResolver)];
case 1:

@@ -497,3 +497,3 @@ _a.sent();

});
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('paulalcock.zil'), _1.ResolutionErrorCode.UnspecifiedResolver)];
return [4 /*yield*/, testHelpers_1.expectResolutionErrorCode(resolution.zns.resolver('paulalcock.zil'), index_1.ResolutionErrorCode.UnspecifiedResolver)];
case 1:

@@ -509,3 +509,3 @@ _a.sent();

it("doesn't support zil domain when zns is disabled", function () {
var resolution = new _1.default({ blockchain: { zns: false } });
var resolution = new index_1.default({ blockchain: { zns: false } });
expect(resolution.zns).toBeUndefined();

@@ -533,3 +533,3 @@ expect(resolution.isSupportedDomain('hello.zil')).toBeFalsy();

it('raises ResoltuionError when domain is not supported', function () {
testHelpers_1.expectResolutionErrorCode(function () { return resolution.zns.namehash('hello.world'); }, _1.ResolutionErrorCode.UnsupportedDomain);
testHelpers_1.expectResolutionErrorCode(function () { return resolution.zns.namehash('hello.world'); }, index_1.ResolutionErrorCode.UnsupportedDomain);
});

@@ -536,0 +536,0 @@ });

## Unreleased
* Added size check for the package with limit 500.00 KB

@@ -3,0 +4,0 @@ ## 1.0.20

{
"name": "@unstoppabledomains/resolution",
"version": "1.0.20",
"version": "1.0.22",
"description": "Domain Resolution for blockchain domains",

@@ -11,5 +11,6 @@ "main": "./build/index.js",

"scripts": {
"release": "yarn build && yarn test && git push && yarn publish --patch && yarn docs && yarn docs:deploy && yarn release:tag",
"release:minor": "yarn build && yarn test && yarn publish --minor && yarn docs && yarn docs:deploy && yarn release:tag",
"release:major": "yarn build && yarn test && yarn publish --major && yarn docs && yarn docs:deploy && yarn release:tag",
"release": "RELEASE=patch yarn release:run",
"release:minor": "RELEASE=minor yarn release:run",
"release:major": "RELEASE=major yarn release:run",
"release:run": "yarn build && yarn size && yarn publish --$RELEASE && yarn docs && yarn docs:deploy && yarn release:tag",
"release:tag": "git push origin v$npm_package_version",

@@ -26,3 +27,4 @@ "test": "jest",

"docs:deploy": "./deploy-docs.sh",
"analyze": "webpack-cli"
"analyze": "webpack-cli",
"size": "ts-node ./src/size.ts"
},

@@ -52,2 +54,3 @@ "files": [

"ts-loader": "6.2.1",
"ts-node": "^8.6.2",
"typedoc": "0.15.4",

@@ -72,3 +75,3 @@ "typescript": "3.7.3",

"bip44-constants": "8.0.5",
"bn.js": "^5.1.1",
"bn.js": "5.1.1",
"content-hash": "2.5.2",

@@ -75,0 +78,0 @@ "hash.js": "1.1.7",

# Resolution
[![NPM version](https://img.shields.io/npm/v/@unstoppabledomains/resolution.svg?style=flat)](https://www.npmjs.com/package/@unstoppabledomains/resolution)
[![CircleCI](https://circleci.com/gh/unstoppabledomains/resolution.svg?style=shield)](https://circleci.com/gh/unstoppabledomains/resolution)
[![Bundle Size Minified](https://img.shields.io/bundlephobia/min/@unstoppabledomains/resolution.svg)](https://bundlephobia.com/result?p=@unstoppabledomains/resolution)
[![Bundle Size Minified Zipped](https://img.shields.io/bundlephobia/minzip/@unstoppabledomains/resolution.svg)](https://bundlephobia.com/result?p=@unstoppabledomains/resolution)
A library for interacting with blockchain domain names.
You can use Resolution in a `<script>` tag from a
[CDN](https://unpkg.com/browse/Resolution/build/index.js), or as the `Resolution`
package on the [npm](https://www.npmjs.com/package/@unstoppabledomains/resolution) registry.

@@ -20,1 +23,4 @@ Supported domain zones:

[Documentation](https://docs.unstoppabledomains.com/#tag/Resolution)
You can use Resolution in a `<script>` tag from a
[CDN](https://unpkg.com/browse/@unstoppabledomains/resolution/build/index.js), or as the `Resolution`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc