Socket
Socket
Sign inDemoInstall

@unstoppabledomains/resolution

Package Overview
Dependencies
Maintainers
11
Versions
107
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 8.5.0 to 9.0.0

206

build/config/uns-config.json
{
"version": "0.4.0",
"version": "0.6.8",
"networks": {

@@ -8,5 +8,5 @@ "1": {

"address": "0x049aba7510f45BA5b64ea9E658E342F904DB358D",
"implementation": "0xa715562307AA8AEDCba976b3793b3337F371c14a",
"implementation": "0x952254Ca7925ABAdd9E141AAbcCD6e1cF684147F",
"legacyAddresses": [],
"deploymentBlock": "0xd62e9d",
"deploymentBlock": "0xc2fede",
"forwarder": "0x049aba7510f45BA5b64ea9E658E342F904DB358D"

@@ -22,3 +22,3 @@ },

"address": "0x2a7084870bB724175a3C96Da8FaA55128fa3E19D",
"implementation": "0x8caAeaD19aab5f54C94BB9F4be32e200E54AC8D7",
"implementation": "0x347Fbb51Aa74c531472995884cC4B8116feFA0ef",
"legacyAddresses": [],

@@ -72,4 +72,7 @@ "deploymentBlock": "0xc2fee0",

"ProxyReader": {
"address": "0x1BDc0fD4fbABeed3E611fd6195fCd5d41dcEF393",
"address": "0x578853aa776Eef10CeE6c4dd2B5862bdcE767A8B",
"implementation": "0xfE97D99558BDe54FB9Cb20F0C45f9199bB8df0a0",
"legacyAddresses": [
"0x6E68f3EaAD2CC946C6CC7f4859251d8D70Dd3EDB",
"0x1BDc0fD4fbABeed3E611fd6195fCd5d41dcEF393",
"0x58034A288D2E56B661c9056A0C27273E5460B63c",

@@ -81,3 +84,3 @@ "0xc3C2BAB5e3e52DBF311b2aAcEf2e40344f19494E",

],
"deploymentBlock": "0xde71cd"
"deploymentBlock": "0xf2f03c"
},

@@ -104,86 +107,7 @@ "TwitterValidationOperator": {

"deploymentBlock": "0xa3cf4d"
}
}
},
"4": {
"contracts": {
"UNSRegistry": {
"address": "0x7fb83000B8eD59D3eAD22f0D584Df3a85fBC0086",
"implementation": "0xc479D7A65243f7Eb1641F06a6C04E5F06cb5c4F7",
"legacyAddresses": [],
"deploymentBlock": "0x85e628",
"forwarder": "0x7fb83000B8eD59D3eAD22f0D584Df3a85fBC0086"
},
"CNSRegistry": {
"address": "0xAad76bea7CFEc82927239415BB18D2e93518ecBB",
"DotCoinBurner": {
"address": "0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",
"legacyAddresses": [],
"deploymentBlock": "0x7232bc",
"forwarder": "0xdf5CC97216785398D5C77348e68fc9461108f85d"
},
"MintingManager": {
"address": "0xdAAf99A920D31F4f5720e4667b12b24e54A03070",
"implementation": "0x38Fa95a0AC0E59D6e2845eFADBc17aF0FF9c7089",
"legacyAddresses": [],
"deploymentBlock": "0x85e629",
"forwarder": "0xfB13e29C4D31a48B4Cd61131Cf3b681416e11681"
},
"ProxyAdmin": {
"address": "0xaf9815005A208d1460b6fC60B4f90B9f2185E88c",
"legacyAddresses": [],
"deploymentBlock": "0x85e627"
},
"SignatureController": {
"address": "0x66a5e3e2C27B4ce4F46BBd975270BE154748D164",
"legacyAddresses": [],
"deploymentBlock": "0x7232be"
},
"MintingController": {
"address": "0x51765307AeB3Df2E647014a2C501d5324212467c",
"legacyAddresses": [],
"deploymentBlock": "0x7232bf",
"deprecated": true
},
"WhitelistedMinter": {
"address": "0xbcB32f13f90978a9e059E8Cb40FaA9e6619d98e7",
"legacyAddresses": [],
"deploymentBlock": "0x7232c6",
"deprecated": true
},
"URIPrefixController": {
"address": "0xe1d2e4B9f0518CA5c803073C3dFa886470627237",
"legacyAddresses": [],
"deploymentBlock": "0x7232c0",
"deprecated": true
},
"DomainZoneController": {
"address": "0x6f8F96A566663C1d4fEe70edD37E9b62Fe39dE5D",
"legacyAddresses": [],
"deploymentBlock": "0x7232c2",
"deprecated": true
},
"Resolver": {
"address": "0x95AE1515367aa64C462c71e87157771165B1287A",
"legacyAddresses": [],
"deploymentBlock": "0x7232cf",
"forwarder": "0xE172D8557d6F342b1b2976dE784F6Dff6ABC0a37"
},
"ProxyReader": {
"address": "0xE6729D224D00b3dd4FC731C4Ee3274E35Da06578",
"legacyAddresses": [
"0x299974AeD8911bcbd2C61262605b89F591a53E83",
"0x9F19473F6a98a715176291c930558E1954fd3D1e",
"0x3A2e74CF832cbA3d77E72708d55370119E4323a6"
],
"deploymentBlock": "0x8dc79a"
},
"TwitterValidationOperator": {
"address": "0x9ea4A63184ebE9CBA55CD1af473D98075Aa02b4C",
"legacyAddresses": ["0x1CB337b3b208dc29a6AcE8d11Bb591b66c5Dd83d"],
"deploymentBlock": "0x86935e"
},
"FreeMinter": {
"address": "0x84214215904cDEbA9044ECf95F3eBF009185AAf4",
"legacyAddresses": [],
"deploymentBlock": "0x740d93",
"deprecated": true
"deploymentBlock": "0xf335e0"
}

@@ -196,3 +120,3 @@ }

"address": "0x070e83FCed225184E67c86302493ffFCDB953f71",
"implementation": "0x4473e84898E3F58feEFb7529dfF9E83Ff26CCae9",
"implementation": "0x21cb8483557dcF7638496f6389b7f9E074429aB8",
"legacyAddresses": [],

@@ -210,3 +134,3 @@ "deploymentBlock": "0x5b57ea",

"address": "0x9ee42D3EB042e06F8Cd241890C4fA0d51e4DA345",
"implementation": "0xFB11410f3067BB6Db61bC335f0de23bE87A1767e",
"implementation": "0xA46EBC92D5ff97684d966D2ccD7E3980fEF14E05",
"legacyAddresses": [],

@@ -216,2 +140,8 @@ "deploymentBlock": "0x5b57ec",

},
"UNSOperator": {
"address": "0xd484eF427E87462F8ee816B0eA219c841f802eF6",
"legacyAddresses": [],
"deploymentBlock": "0x7ff335",
"implementation": "0x7DB4481290635743721FbDB9f96b1b0Cdf5CaE69"
},
"ProxyAdmin": {

@@ -258,8 +188,11 @@ "address": "0xf4906E210523F9dA79E33811A44EE000441F4E04",

"ProxyReader": {
"address": "0xE3b961856C417d081a02cBa0161a051268F52677",
"address": "0x76007c52C73972A441aFA1A0E1016B140ffdE689",
"implementation": "0x0B0A42A7FeA63e75396D0dcD77626F706AB9Fdfb",
"legacyAddresses": [
"0x77cb0e7503Ea82315421BcF0eE9603451cd285F6",
"0xE3b961856C417d081a02cBa0161a051268F52677",
"0x9A70ff906D422C2FD0F7B94244D6b36DB62Ee982",
"0xFc5f608149f4D9e2Ed0733efFe9DD57ee24BCF68"
],
"deploymentBlock": "0x65bdfe"
"deploymentBlock": "0x78b972"
},

@@ -286,2 +219,7 @@ "TwitterValidationOperator": {

"deploymentBlock": "0x2dc9b9"
},
"DotCoinBurner": {
"address": "0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",
"legacyAddresses": [],
"deploymentBlock": "0x78f5ac"
}

@@ -294,5 +232,5 @@ }

"address": "0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f",
"implementation": "0x3F72a5647295e857C6a90a071Aed99B2A0534fE2",
"legacyAddresses": [],
"deploymentBlock": "0x019d6188",
"implementation": "0x5442953b0BFFf69FC945f5f1387cbFD2e2673447",
"deploymentBlock": "0x01272eb5",
"forwarder": "0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f"

@@ -308,5 +246,5 @@ },

"address": "0x7be83293BeeDc9Eba1bd76c66A65F10F3efaeC26",
"implementation": "0x61bEFAe878d7066Ffad4b90615C18665460eE558",
"legacyAddresses": [],
"deploymentBlock": "0x01272f41",
"implementation": "0xBb45a6E10224Aa36EAcd812205F3763D353e9783",
"forwarder": "0xC37d3c4326ab0E1D2b9D8b916bBdf5715f780fcF"

@@ -355,8 +293,11 @@ },

"ProxyReader": {
"address": "0x3E67b8c702a1292d1CEb025494C84367fcb12b45",
"address": "0x91EDd8708062bd4233f4Dd0FCE15A7cb4d500091",
"implementation": "0x9D0F27232b5c364488083e3B10F6963F635Ae521",
"legacyAddresses": [
"0x68Af8fFFCdC6218836C62Bc2Fd2D35dA544471dD",
"0x3E67b8c702a1292d1CEb025494C84367fcb12b45",
"0x423F2531bd5d3C3D4EF7C318c2D1d9BEDE67c680",
"0xA3f32c8cd786dc089Bd1fC175F2707223aeE5d00"
],
"deploymentBlock": "0x019d61a9"
"deploymentBlock": "0x021b1c05"
},

@@ -383,2 +324,7 @@ "TwitterValidationOperator": {

"deploymentBlock": "0x0"
},
"DotCoinBurner": {
"address": "0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",
"legacyAddresses": [],
"deploymentBlock": "0x021cac00"
}

@@ -390,7 +336,7 @@ }

"UNSRegistry": {
"address": "0x58a175BEbc8ec21A94ea63Aa5a28743945940EE6",
"address": "0x107733feD96C4Cd390c944a31F5425A7FB98Ae5e",
"implementation": "0x62b11ad5F582a5C5d378fB310125b030042554F1",
"legacyAddresses": [],
"deploymentBlock": "0x0d",
"implementation": "0xe0aFC4e9E03e4aa67257Df7A2Eca77454309789D",
"forwarder": "0x58a175BEbc8ec21A94ea63Aa5a28743945940EE6"
"deploymentBlock": "0x15",
"forwarder": "0x107733feD96C4Cd390c944a31F5425A7FB98Ae5e"
},

@@ -404,10 +350,16 @@ "CNSRegistry": {

"MintingManager": {
"address": "0x27935e7e85db3c4e7885eB828B9e889BA69a4e7f",
"address": "0x39a27956B78d00a4E00EA8833Ff0947410A2933F",
"implementation": "0x229C56b7805aB5935a883207F6a6bD5847E65Aee",
"legacyAddresses": [],
"deploymentBlock": "0x0f",
"implementation": "0xa1A2114B0C4bDF9AEe05fdd80801e6267639FAd9",
"forwarder": "0xC20631145b77a58018E2b10f2282Dd048E12fC81"
"deploymentBlock": "0x17",
"forwarder": "0x7c3c91245769c8B7450aD522792deC4bd4bf797f"
},
"UNSOperator": {
"address": "0xCE4bb7Dc1Eb9DCe75743dE6a4B48534fD427Ef51",
"legacyAddresses": [],
"deploymentBlock": "0x19",
"implementation": "0xe85541865Bbb62A05064ce5C9F41cC293A8eA996"
},
"ProxyAdmin": {
"address": "0xbE5dEAC45dd1ca4ee18Dc2D585D84D3d3CB82B0D",
"address": "0x4e44E79e0cEc05D9e62e952B2088c02A3C450aeC",
"legacyAddresses": [],

@@ -452,5 +404,6 @@ "deploymentBlock": "0x01"

"ProxyReader": {
"address": "0x4e44E79e0cEc05D9e62e952B2088c02A3C450aeC",
"address": "0x5CC819C9915eADfcEBd76952B8C1BC36CADd7376",
"implementation": "0xBDeFCF6429D0AC68236A6BEb321cBD2Ce66B463C",
"legacyAddresses": [],
"deploymentBlock": "0x14"
"deploymentBlock": "0x1f"
},

@@ -469,10 +422,15 @@ "TwitterValidationOperator": {

"MintableERC721Predicate": {
"address": "0x7c3c91245769c8B7450aD522792deC4bd4bf797f",
"address": "0x58a175BEbc8ec21A94ea63Aa5a28743945940EE6",
"legacyAddresses": [],
"deploymentBlock": "0x1b"
"deploymentBlock": "0x0d"
},
"RootChainManager": {
"address": "0x2f5e6eed50C839835BD2873d428E1683793Ad09D",
"address": "0x27935e7e85db3c4e7885eB828B9e889BA69a4e7f",
"legacyAddresses": [],
"deploymentBlock": "0x1d"
"deploymentBlock": "0x0f"
},
"DotCoinBurner": {
"address": "0x54563a9e1cD2dCBD0BCA90D3CFA4A647e02C404a",
"legacyAddresses": [],
"deploymentBlock": "0x27"
}

@@ -485,5 +443,5 @@ }

"address": "0x2a93C52E7B6E7054870758e15A1446E769EdfB93",
"implementation": "0x4fec01ba3a4E0Df28c1A54b488be36370E0Bef85",
"legacyAddresses": [],
"deploymentBlock": "0x0189f713",
"implementation": "0xAc1a1F2136BfDe3a353a95C0676Cd0d55f311ee3",
"deploymentBlock": "0x01213f43",
"forwarder": "0x2a93C52E7B6E7054870758e15A1446E769EdfB93"

@@ -499,7 +457,13 @@ },

"address": "0x428189346bb3CC52f031A1092fd47C919AC30A9f",
"implementation": "0xcAe1B2CC867F53C2355dfcF4D98B359b1AdD94e1",
"legacyAddresses": [],
"deploymentBlock": "0x01213f4a",
"implementation": "0xCC17E698bA21bae4277579F22cA51135AaF00777",
"forwarder": "0xEf3a491A8750BEC2Dff5339CF6Df94436d432C4d"
},
"UNSOperator": {
"address": "0x576a376832181ddD19d17CD4505F6BF8FEdb428E",
"legacyAddresses": [],
"deploymentBlock": "0x01e03592",
"implementation": "0xaBB7934fFD76282dc9d5126A5549C2695C9b52A2"
},
"ProxyAdmin": {

@@ -546,8 +510,11 @@ "address": "0x460d63117c7Ab1624b7474C45BF46eC6702f57ce",

"ProxyReader": {
"address": "0x6fe7c857C1B0E54492C8762f27e0a45CA7ff264B",
"address": "0xBD4674F11d512120dFc8BAe5f84963d7419A5db2",
"implementation": "0xacE4C348E1703657201082Ba449aA45ADf8F936a",
"legacyAddresses": [
"0x71f7C0A978A541aB13Bd5783470f38b0dd71Cf78",
"0x6fe7c857C1B0E54492C8762f27e0a45CA7ff264B",
"0xbd9e01F6513E7C05f71Bf21d419a3bDF1EA9104b",
"0x332A8191905fA8E6eeA7350B5799F225B8ed30a9"
],
"deploymentBlock": "0x0189f72d"
"deploymentBlock": "0x01bb07d3"
},

@@ -574,2 +541,7 @@ "TwitterValidationOperator": {

"deploymentBlock": "0x0"
},
"DotCoinBurner": {
"address": "0x65c6abdf52aD08A53A77488D1Acc5c666ada840F",
"legacyAddresses": [],
"deploymentBlock": "0x01bbafc7"
}

@@ -576,0 +548,0 @@ }

@@ -9,3 +9,4 @@ import { Interface, JsonFragment } from '@ethersproject/abi';

readonly provider: Provider;
constructor(abi: JsonFragment[], address: string, provider: Provider);
readonly apiKey?: string;
constructor(abi: JsonFragment[], address: string, provider: Provider, apiKey?: string);
call(method: string, args: (string | string[])[]): Promise<ReadonlyArray<any>>;

@@ -12,0 +13,0 @@ multicall(callArgs: {

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

var EthereumContract = /** @class */ (function () {
function EthereumContract(abi, address, provider) {
function EthereumContract(abi, address, provider, apiKey) {
this.abi = abi;

@@ -47,2 +47,3 @@ this.address = address;

this.coder = new abi_1.Interface(this.abi);
this.apiKey = apiKey;
}

@@ -114,2 +115,3 @@ EthereumContract.prototype.call = function (method, args) {

params: params,
apiKey: this.apiKey,
};

@@ -138,2 +140,3 @@ return [4 /*yield*/, this.provider.request(request)];

params: params,
apiKey: this.apiKey,
};

@@ -140,0 +143,0 @@ return [4 /*yield*/, this.provider.request(request)];

@@ -1,2 +0,2 @@

import { ResolutionMethod, UnsLocation } from '../types/publicTypes';
import { ResolutionMethod, UnsLocation, ResolutionConfig } from '../types/publicTypes';
/** Explains Resolution Error options */

@@ -14,2 +14,3 @@ declare type ResolutionErrorOptions = {

tokenUri?: string;
config?: ResolutionConfig;
};

@@ -30,3 +31,4 @@ export declare enum ResolutionErrorCode {

InconsistentDomainArray = "InconsistentDomainArray",
InvalidDomainAddress = "InvalidDomainAddress"
InvalidDomainAddress = "InvalidDomainAddress",
InvalidUnsResolutionConfiguration = "InvalidResolutionConfiguration"
}

@@ -33,0 +35,0 @@ /**

@@ -36,2 +36,3 @@ "use strict";

ResolutionErrorCode["InvalidDomainAddress"] = "InvalidDomainAddress";
ResolutionErrorCode["InvalidUnsResolutionConfiguration"] = "InvalidResolutionConfiguration";
})(ResolutionErrorCode = exports.ResolutionErrorCode || (exports.ResolutionErrorCode = {}));

@@ -78,2 +79,3 @@ /**

},
_a[ResolutionErrorCode.InvalidUnsResolutionConfiguration] = function (params) { return "Resolution "; },
_a);

@@ -80,0 +82,0 @@ /**

@@ -67,2 +67,3 @@ "use strict";

var Networking_1 = __importDefault(require("./utils/Networking"));
var utils_1 = require("./utils");
var FetchProvider = /** @class */ (function () {

@@ -97,6 +98,7 @@ function FetchProvider(name, url) {

return __awaiter(this, void 0, void 0, function () {
var response;
var requestObject, response;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, Networking_1.default.fetch(this.url, {
case 0:
requestObject = {
method: 'POST',

@@ -112,3 +114,8 @@ body: JSON.stringify({

},
})];
};
if (args.apiKey) {
requestObject.headers['Authorization'] = "Bearer ".concat(args.apiKey);
requestObject.headers['X-Lib-Agent'] = (0, utils_1.getLibAgent)();
}
return [4 /*yield*/, Networking_1.default.fetch(this.url, requestObject)];
case 1:

@@ -115,0 +122,0 @@ response = _a.sent();

@@ -1,2 +0,4 @@

import { AutoNetworkConfigs, CryptoRecords, DnsRecord, DnsRecordType, EthersProvider, Locations, NamehashOptions, NamingServiceName, Provider, SourceConfig, TokenUriMetadata, Web3Version0Provider, Web3Version1Provider, ReverseResolutionOptions } from './types/publicTypes';
import Zns from './Zns';
import UdApi from './UdApi';
import { AutoNetworkConfigs, CryptoRecords, DnsRecord, DnsRecordType, EthersProvider, Locations, NamehashOptions, NamingServiceName, Provider, SourceConfig, ResolutionConfig, TokenUriMetadata, Web3Version0Provider, Web3Version1Provider, ReverseResolutionOptions } from './types/publicTypes';
import { UnsSupportedNetwork } from './types';

@@ -22,4 +24,5 @@ /**

export default class Resolution {
constructor({ sourceConfig }?: {
constructor(config?: {
sourceConfig?: SourceConfig;
apiKey?: string;
});

@@ -362,3 +365,5 @@ /**

private reverseGetTokenId;
private getUnsConfig;
getZnsConfig(config: ResolutionConfig): Zns | UdApi;
}
export { Resolution };

@@ -78,2 +78,3 @@ "use strict";

var namehash_1 = require("./utils/namehash");
var DEFAULT_UNS_PROXY_SERVICE_URL = 'https://api.unstoppabledomains.com/resolve';
/**

@@ -98,11 +99,7 @@ * Blockchain domain Resolution library - Resolution.

var Resolution = /** @class */ (function () {
function Resolution(_a) {
var _b;
var _c = _a === void 0 ? {} : _a, _d = _c.sourceConfig, sourceConfig = _d === void 0 ? undefined : _d;
var uns = isApi(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.uns)
? new UdApi_1.default(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.uns)
: new Uns_1.default(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.uns);
var zns = isApi(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.zns)
? new UdApi_1.default(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.zns)
: new Zns_1.default(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.zns);
function Resolution(config) {
var _a;
if (config === void 0) { config = {}; }
var uns = this.getUnsConfig(config);
var zns = this.getZnsConfig(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

@@ -113,12 +110,12 @@ // responses. It should be enough to compare just the URLs, as the network param isn't actually used in the calls.

// some non-async methods such as namehash, as they are unavailable in the UdApi service.
this.serviceMap = (_b = {},
_b[publicTypes_1.NamingServiceName.UNS] = {
this.serviceMap = (_a = {},
_a[publicTypes_1.NamingServiceName.UNS] = {
usedServices: [uns],
native: isApi(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.uns) ? new Uns_1.default() : uns,
native: uns instanceof Uns_1.default ? uns : new Uns_1.default(),
},
_b[publicTypes_1.NamingServiceName.ZNS] = {
_a[publicTypes_1.NamingServiceName.ZNS] = {
usedServices: equalUdApiProviders ? [uns] : [uns, zns],
native: isApi(sourceConfig === null || sourceConfig === void 0 ? void 0 : sourceConfig.zns) ? new Zns_1.default() : zns,
native: zns instanceof Zns_1.default ? zns : new Zns_1.default(),
},
_b);
_a);
}

@@ -954,2 +951,30 @@ /**

};
Resolution.prototype.getUnsConfig = function (config) {
var _a, _b, _c;
if (config.apiKey) {
return new Uns_1.default({
locations: {
Layer1: {
url: "".concat(DEFAULT_UNS_PROXY_SERVICE_URL, "/chains/eth/rpc"),
network: 'mainnet',
proxyServiceApiKey: config.apiKey,
},
Layer2: {
url: "".concat(DEFAULT_UNS_PROXY_SERVICE_URL, "/chains/matic/rpc"),
network: 'polygon-mainnet',
proxyServiceApiKey: config.apiKey,
},
},
});
}
return isApi((_a = config.sourceConfig) === null || _a === void 0 ? void 0 : _a.uns)
? new UdApi_1.default((_b = config.sourceConfig) === null || _b === void 0 ? void 0 : _b.uns)
: new Uns_1.default((_c = config.sourceConfig) === null || _c === void 0 ? void 0 : _c.uns);
};
Resolution.prototype.getZnsConfig = function (config) {
var _a, _b, _c;
return isApi((_a = config.sourceConfig) === null || _a === void 0 ? void 0 : _a.zns)
? new UdApi_1.default((_b = config.sourceConfig) === null || _b === void 0 ? void 0 : _b.zns)
: new Zns_1.default((_c = config.sourceConfig) === null || _c === void 0 ? void 0 : _c.zns);
};
return Resolution;

@@ -956,0 +981,0 @@ }());

@@ -5,5 +5,2 @@ import { Provider } from './publicTypes';

};
export interface BlockhainNetworkUrlMap {
[key: string]: string | undefined;
}
export interface ProxyReaderMap {

@@ -16,2 +13,3 @@ [key: string]: string;

params?: ProviderParams;
apiKey?: string;
}

@@ -92,7 +90,7 @@ export declare type TransactionRequest = {

export declare const UnsSupportedNetwork: Readonly<{
guard: (value: string) => value is "mainnet" | "rinkeby" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
check: (value: string) => "mainnet" | "rinkeby" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
values: ("mainnet" | "rinkeby" | "goerli" | "polygon-mainnet" | "polygon-mumbai")[];
guard: (value: string) => value is "mainnet" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
check: (value: string) => "mainnet" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
values: ("mainnet" | "goerli" | "polygon-mainnet" | "polygon-mumbai")[];
} & {
type: "mainnet" | "rinkeby" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
type: "mainnet" | "goerli" | "polygon-mainnet" | "polygon-mumbai";
}>;

@@ -99,0 +97,0 @@ export declare type UnsSupportedNetwork = typeof UnsSupportedNetwork.type;

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

};
exports.UnsSupportedNetwork = StringUnion('mainnet', 'rinkeby', 'goerli', 'polygon-mainnet', 'polygon-mumbai');
exports.UnsSupportedNetwork = StringUnion('mainnet', 'goerli', 'polygon-mainnet', 'polygon-mumbai');
exports.ZnsSupportedNetwork = StringUnion('mainnet', 'testnet');

@@ -39,0 +39,0 @@ function hasProvider(obj) {

@@ -14,2 +14,3 @@ import { EventFilter, RequestArguments, RpcProviderLogEntry, TransactionRequest } from './index';

network: string;
proxyServiceApiKey?: string;
proxyReaderAddress?: string;

@@ -31,2 +32,6 @@ };

};
export declare type ResolutionConfig = {
sourceConfig?: SourceConfig;
apiKey?: string;
};
export declare enum UnsLocation {

@@ -33,0 +38,0 @@ Layer1 = "UNSLayer1",

@@ -119,2 +119,28 @@ "use strict";

var resolver_keys_json_1 = __importDefault(require("./config/resolver-keys.json"));
var ensureValidSourceConfig = function (source) {
var _a;
if (!source.locations ||
!source.locations.Layer1 ||
!source.locations.Layer2) {
throw new configurationError_1.default(configurationError_1.ConfigurationErrorCode.NetworkConfigMissing, {
method: publicTypes_1.NamingServiceName.UNS,
config: !((_a = source === null || source === void 0 ? void 0 : source.locations) === null || _a === void 0 ? void 0 : _a.Layer1) ? 'Layer1' : 'Layer2',
});
}
var layer1Config = source.locations.Layer1;
if (!layer1Config['url'] && !layer1Config['provider']) {
throw new configurationError_1.default(configurationError_1.ConfigurationErrorCode.NetworkConfigMissing, {
method: publicTypes_1.NamingServiceName.UNS,
config: 'Layer1.url',
});
}
var layer2Config = source.locations.Layer2;
if (!layer2Config['url'] && !layer2Config['provider']) {
throw new configurationError_1.default(configurationError_1.ConfigurationErrorCode.NetworkConfigMissing, {
method: publicTypes_1.NamingServiceName.UNS,
config: 'Layer2.url',
});
}
return;
};
/**

@@ -128,19 +154,14 @@ * @internal

_this.name = publicTypes_1.NamingServiceName.UNS;
if (source &&
source.locations &&
(!source.locations.Layer1 || !source.locations.Layer2)) {
throw new configurationError_1.default(configurationError_1.ConfigurationErrorCode.NetworkConfigMissing, {
method: publicTypes_1.NamingServiceName.UNS,
config: !source.locations.Layer1 ? 'Layer1' : 'Layer2',
});
if (source) {
ensureValidSourceConfig(source);
}
if (!source) {
else {
source = {
locations: {
Layer1: {
url: UnsInternal_1.default.UrlMap['mainnet'],
url: '',
network: 'mainnet',
},
Layer2: {
url: UnsInternal_1.default.UrlMap['polygon-mainnet'],
url: '',
network: 'polygon-mainnet',

@@ -147,0 +168,0 @@ },

@@ -1,2 +0,2 @@

import { BlockhainNetworkUrlMap, ProxyReaderMap } from './types';
import { ProxyReaderMap } from './types';
import { UnsLayerSource } from './types/publicTypes';

@@ -8,3 +8,2 @@ import { BlockchainType, DomainData, Locations, UnsLocation } from './types/publicTypes';

static readonly ProxyReaderMap: ProxyReaderMap;
static readonly UrlMap: BlockhainNetworkUrlMap;
readonly network: string;

@@ -11,0 +10,0 @@ readonly url: string;

@@ -90,7 +90,7 @@ "use strict";

this.blockchain = blockchain;
this.url = source['url'] || UnsInternal.UrlMap[this.network];
this.url = source['url'];
this.provider =
source['provider'] || new FetchProvider_1.default(this.unsLocation, this.url);
this.readerContract = new EthereumContract_1.default(proxyReader_1.default, source.proxyReaderAddress ||
UnsInternal.ProxyReaderMap[utils_1.EthereumNetworks[this.network]], this.provider);
UnsInternal.ProxyReaderMap[utils_1.EthereumNetworks[this.network]], this.provider, source['proxyServiceApiKey']);
}

@@ -320,9 +320,2 @@ UnsInternal.prototype.exists = function (domain) {

UnsInternal.ProxyReaderMap = getProxyReaderMap();
UnsInternal.UrlMap = {
mainnet: 'https://mainnet.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39',
rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2/ZDERxOLIj120dh2-Io2Q9RTh9RfWEssT',
goerli: 'https://goerli.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39',
'polygon-mainnet': 'https://polygon-mainnet.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39',
'polygon-mumbai': 'https://polygon-mumbai.infura.io/v3/c4bb906ed6904c42b19c95825fe55f39',
};
return UnsInternal;

@@ -329,0 +322,0 @@ }());

import { CryptoRecords, NamingServiceName } from '../types/publicTypes';
import { UnsSupportedNetwork } from '../types';
declare type Providers = 'infura' | 'alchemy';
export declare function getLibAgent(): string;
export declare function signedLink(key: string, network?: UnsSupportedNetwork, provider?: Providers): string;

@@ -15,4 +16,2 @@ export declare function hexToBytes(hexString: string): number[];

readonly mainnet: 1;
readonly ropsten: 3;
readonly rinkeby: 4;
readonly goerli: 5;

@@ -24,4 +23,2 @@ readonly 'polygon-mainnet': 137;

readonly 1: "mainnet";
readonly 3: "ropsten";
readonly 4: "rinkeby";
readonly 5: "goerli";

@@ -28,0 +25,0 @@ readonly 137: "polygon-mainnet";

"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 = void 0;
exports.unwrapResult = exports.wrapResult = exports.EthereumNetworksInverted = exports.EthereumNetworks = exports.findNamingServiceName = exports.domainExtensionToNamingServiceName = exports.constructRecords = exports.isNullAddress = exports.hexToBytes = exports.signedLink = exports.getLibAgent = void 0;
var publicTypes_1 = require("../types/publicTypes");

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

mainnet: 'https://mainnet.infura.io/v3/',
rinkeby: 'https://rinkeby.infura.io/v3/',
goerli: 'https://goerli.infura.io/v3/',

@@ -17,3 +16,2 @@ 'polygon-mainnet': 'https://polygon-mainnet.infura.io/v3/',

mainnet: 'https://eth-mainnet.alchemyapi.io/v2/',
rinkeby: 'https://eth-rinkeby.alchemyapi.io/v2/',
goerli: 'https://eth-goerli.alchemyapi.io/v2/',

@@ -24,2 +22,15 @@ 'polygon-mainnet': 'https://polygon-mainnet.g.alchemy.com/v2/',

};
function getLibAgent() {
var libAgent = 'UnstoppableDomains/resolution-js';
try {
// eslint-disable-next-line @typescript-eslint/no-var-requires
var pjson = require('../../package.json');
libAgent += '/' + pjson.version;
return libAgent;
}
catch (e) {
return libAgent;
}
}
exports.getLibAgent = getLibAgent;
function signedLink(key, network, provider) {

@@ -76,4 +87,2 @@ if (network === void 0) { network = 'mainnet'; }

mainnet: 1,
ropsten: 3,
rinkeby: 4,
goerli: 5,

@@ -85,4 +94,2 @@ 'polygon-mainnet': 137,

1: 'mainnet',
3: 'ropsten',
4: 'rinkeby',
5: 'goerli',

@@ -89,0 +96,0 @@ 137: 'polygon-mainnet',

@@ -0,1 +1,10 @@

## 9.0.0
- Allow initialization with partner key
- Remove default RPC urls
## 8.5.1
- Update uns config dependency
## 8.5.0

@@ -2,0 +11,0 @@

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

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

@@ -13,4 +13,4 @@ # Resolution

- [Using Resolution](#using-resolution)
- [Default Ethereum Providers](#default-ethereum-providers)
- [Error Handling](#error-handling)
- [Development](#development)
- [Free advertising for integrated apps](#free-advertising-for-integrated-apps)

@@ -30,3 +30,3 @@

For more information, see our detailed
[API Referrence](https://unstoppabledomains.github.io/resolution/).
[API Reference](https://unstoppabledomains.github.io/resolution/).

@@ -62,18 +62,97 @@ ## Installing Resolution

Create a new project.
## Initialize with Unstoppable Domains' UNS Proxy Provider
```shell
mkdir resolution && cd $_
yarn init -y
yarn add @unstoppabledomains/resolution
```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
// obtain a key from https://unstoppabledomains.com/partner-api-dashboard if you are a partner
const resolution = new Resolution({ apiKey: "<api_key>" });
```
### Look up a domain's crypto address
> NOTE: The `apiKey` is only used resolve domains from UNS. Behind the scene, it still uses the default ZNS (Zilliqa) RPC url. For additional control, please specify your ZNS configuration.
Create a new file in your project, `address.js`.
```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
const resolution = new Resolution({
apiKey: "<api_key>",
sourceConfig: {
zns: {
url: 'https://api.zilliqa.com',
network: 'mainnet',
},
},
});
```
## Initialize with Custom Provider Configuration
You may want to specify a custom provider:
- if you want to use a dedicated blockchain node
- if you want to monitor app usage
- if you already have a provider in your app to re-use it for domain resolution
Default provider can be changed by changing constructor options
`new Resolution(options)` or by using one of the factory methods:
- `Resolution.alchemy()`
- `Resolution.infura()`
- `Resolution.fromWeb3Version1Provider()`
- `Resolution.fromEthersProvider()`
- etc.
```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
const resolution = new Resolution();
// obtain a key from https://www.infura.io
const resolution = new Resolution({
sourceConfig: {
uns: {
locations: {
Layer1: {
url: "https://mainnet.infura.io/v3/<infura_api_key>",
network: 'mainnet'
},
Layer2: {
url: "https://polygon-mainnet.infura.io/v3/<infura_api_key>",
network: 'polygon-mainnet',
},
},
},
zns: {
url: 'https://api.zilliqa.com',
network: 'mainnet',
},
},
});
```
## Initialize with Autoconfiguration of blockchain network
In some scenarios system might not be flexible enough to easy distinguish
between various Ethereum testnets at compilation time. In this case, Resolution
library provide a special async constructor
`await Resolution.autonetwork(options)`. This method makes a JSON RPC
"net_version" call to the provider to get the network id.
This method configures only Uns. Zns is supported only on Zilliqa mainnet which
is going to be used in any cases. You can provide a configured provider or a
blockchain url as in the following example:
```
await Resolution.autoNetwork({
uns: {provider},
});
```
### Examples
To see all constructor options and factory methods check
[Unstoppable API reference](https://unstoppabledomains.github.io/resolution).
#### Look up a domain's crypto address
```javascript
function resolve(domain, currency) {

@@ -90,10 +169,2 @@ resolution

Execute the script.
```shell
$ node address.js
brad.crypto resolves to 0x8aaD44321A86b170879d7A244c1e8d360c99DdA8
brad.zil resolves to zil1yu5u4hegy9v3xgluweg4en54zm8f8auwxu0xxj
```
### Find the IPFS hash for a decentralized website

@@ -104,5 +175,2 @@

```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
const resolution = new Resolution();
function resolveIpfsHash(domain) {

@@ -122,9 +190,2 @@ resolution

Execute the script.
```shell
$ node ipfs_hash.js
You can access this website via a public IPFS gateway: https://gateway.ipfs.io/ipfs/QmVJ26hBrwwNAPVmLavEFXDUunNDXeFSeMPmHuPxKe6dJv
```
### Find a custom record

@@ -135,5 +196,2 @@

```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
const resolution = new Resolution();
function resolveCustomRecord(domain, record) {

@@ -153,71 +211,2 @@ resolution

## Default Ethereum Providers
Resolution provides zero-configuration experience by using built-in
production-ready [Infura](https://www.infura.io/) endpoint by default.
Default Ethereum provider is free to use without restrictions and rate-limits
for `UNS` resolution.
## Custom Ethereum Provider configuration
You may want to specify a custom provider:
- if you want to use a dedicated blockchain node
- if you want to monitor app usage
- if you already have a provider in your app to re-use it for domain resolution
Default provider can be changed by changing constructor options
`new Resolution(options)` or by using one of the factory methods:
- `Resolution.alchemy()`
- `Resolution.infura()`
- `Resolution.fromWeb3Version1Provider()`
- `Resolution.fromEthersProvider()`
- etc.
To see all constructor options and factory methods check
[Unstoppable API reference](https://unstoppabledomains.github.io/resolution).
```javascript
const {default: Resolution} = require('@unstoppabledomains/resolution');
const ethereumProviderUrl = ALCHEMY_ETHEREUM_API;
const polygonProviderUrl = ALCHEMY_POLYGON_API;
// custom provider config using the `Resolution` constructor options
const resolution = new Resolution({
sourceConfig: {
uns: {
locations: {
Layer1: {
url: ethereumProviderUrl,
network: 'mainnet'
},
Layer2: {
url: polygonProviderUrl,
network: 'polygon-mainnet',
},
},
},
},
});
```
## Autoconfiguration of blockchain network
In some scenarios system might not be flexible enough to easy distinguish
between various Ethereum testnets on compile time. For this case Resolution
library provide a special async constructor which should be waited for
`await Resolution.autonetwork(options)`. This method makes a JSON RPC
"net_version" call to the provider to get the network id.
This method configures only Uns. Zns is supported only on Zilliqa mainnet which
is going to be used in any cases. You can provide a configured provider or a
blockchain url as in the following example:
```
await Resolution.autoNetwork({
uns: {provider},
});
```
## Error Handling

@@ -233,21 +222,9 @@

1. Install `nvm`
1. Recommended NodeJs version
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
```
* Node v16
2. Install concrete version of `node.js`
2. Clone the repository
```bash
nvm install 16.15.0
```
3. Install `yarn`
```bash
npm install -g yarn
```
4. Clone the repository
```bash
git clone https://github.com/unstoppabledomains/resolution.git

@@ -257,7 +234,13 @@ cd resolution

5. Install dependencies
```bash
yarn install
```
3. Install dependencies
```bash
yarn install
```
or
```bash
npm install
```
### Internal config

@@ -271,2 +254,13 @@

#### Unit tests:
Resolution library relies on environment variables to load **TestNet** RPC Urls. This way, our keys don't expose directly to the code. These environment variables are:
* L1_TEST_NET_RPC_URL
* L1_TEST_NET_RPC_WSS_URL
* L2_TEST_NET_RPC_URL
* L2_TEST_NET_RPC_WSS_URL
In order to validate the code change, copy `.env.example` file change the name to `.env`. Then, update the values of variables.
## Free advertising for integrated apps

@@ -282,3 +276,3 @@

Also, every week we select a newly-integrated app to feature in the Unstoppable
Update newsletter. This newsletter is delivered to straight into the inbox of
Update newsletter. This newsletter is delivered straight into the inbox of
~100,000 crypto fanatics — all of whom could be new customers to grow your

@@ -285,0 +279,0 @@ business.

Sorry, the diff of this file is too big to display

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