@bonfida/spl-name-service 0.1.52 → 0.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resolve.js +6 -2
- package/dist/resolve.js.map +1 -1
- package/package.json +1 -1
- package/src/resolve.ts +6 -1
package/dist/resolve.js
CHANGED
|
@@ -25,7 +25,6 @@ exports.checkSolRecord = checkSolRecord;
|
|
|
25
25
|
* @returns
|
|
26
26
|
*/
|
|
27
27
|
const resolve = async (connection, domain) => {
|
|
28
|
-
var _a;
|
|
29
28
|
const { pubkey } = await (0, utils_1.getDomainKey)(domain);
|
|
30
29
|
const { registry, nftOwner } = await state_1.NameRegistryState.retrieve(connection, pubkey);
|
|
31
30
|
if (nftOwner) {
|
|
@@ -34,7 +33,7 @@ const resolve = async (connection, domain) => {
|
|
|
34
33
|
try {
|
|
35
34
|
const recordKey = await (0, utils_1.getDomainKey)(record_2.Record.SOL + "." + domain, true);
|
|
36
35
|
const solRecord = await (0, record_1.getSolRecord)(connection, domain);
|
|
37
|
-
if (
|
|
36
|
+
if (!solRecord.data) {
|
|
38
37
|
throw new Error("Invalid SOL record data");
|
|
39
38
|
}
|
|
40
39
|
const encoder = new TextEncoder();
|
|
@@ -50,6 +49,11 @@ const resolve = async (connection, domain) => {
|
|
|
50
49
|
return new web3_js_1.PublicKey(solRecord.data.slice(0, 32));
|
|
51
50
|
}
|
|
52
51
|
catch (err) {
|
|
52
|
+
if (err instanceof Error) {
|
|
53
|
+
if (err.name === "FetchError") {
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
53
57
|
console.log(err);
|
|
54
58
|
}
|
|
55
59
|
return registry.owner;
|
package/dist/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AACxD,qCAAwC;AACxC,mCAAuC;AACvC,mCAA4C;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E,MAAM,SAAS,GAAG,MAAM,IAAA,qBAAY,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;QAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;YACnC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAC3B,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE;SAC5B,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAEhE,MAAM,KAAK,GAAG,IAAA,sBAAc,EAC1B,QAAQ,EACR,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EACxB,QAAQ,CAAC,KAAK,CACf,CAAC;QAEF,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;SACtC;QAED,OAAO,IAAI,mBAAS,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;KACnD;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE;gBAC7B,MAAM,GAAG,CAAC;aACX;SACF;QACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KAClB;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,CAAC,CAAC;AAhDW,QAAA,OAAO,WAgDlB"}
|
package/package.json
CHANGED
package/src/resolve.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const resolve = async (connection: Connection, domain: string) => {
|
|
|
42
42
|
const recordKey = await getDomainKey(Record.SOL + "." + domain, true);
|
|
43
43
|
const solRecord = await getSolRecord(connection, domain);
|
|
44
44
|
|
|
45
|
-
if (solRecord.data
|
|
45
|
+
if (!solRecord.data) {
|
|
46
46
|
throw new Error("Invalid SOL record data");
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -65,6 +65,11 @@ export const resolve = async (connection: Connection, domain: string) => {
|
|
|
65
65
|
|
|
66
66
|
return new PublicKey(solRecord.data.slice(0, 32));
|
|
67
67
|
} catch (err) {
|
|
68
|
+
if (err instanceof Error) {
|
|
69
|
+
if (err.name === "FetchError") {
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
68
73
|
console.log(err);
|
|
69
74
|
}
|
|
70
75
|
|