@tradetrust-tt/dnsprove 2.14.1 → 2.15.0
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/records/dnsTxt.js +6 -26
- package/dist/ts/records/dnsTxt.d.ts +5 -20
- package/dist/ts/util/logger.d.ts +7 -6
- package/package.json +2 -2
- package/src/index.test.ts +0 -45
- package/src/records/dnsTxt.ts +7 -31
package/dist/records/dnsTxt.js
CHANGED
|
@@ -3,18 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.RecordTypesT = exports.OpenAttestationDNSTextRecordT = exports.
|
|
6
|
+
exports.RecordTypesT = exports.OpenAttestationDNSTextRecordT = exports.EthereumNetworks = exports.EthereumNetworkIdT = exports.EthereumAddressT = exports.BlockchainNetworkT = void 0;
|
|
7
7
|
var _runtypes = require("runtypes");
|
|
8
8
|
const RecordTypesT = exports.RecordTypesT = (0, _runtypes.Literal)("openatts");
|
|
9
|
-
|
|
10
|
-
// export const BlockchainNetworkT = Literal("ethereum");
|
|
11
|
-
const BlockchainNetworkT = exports.BlockchainNetworkT = (0, _runtypes.Union)((0, _runtypes.Literal)("ethereum"), (0, _runtypes.Literal)("hedera"));
|
|
9
|
+
const BlockchainNetworkT = exports.BlockchainNetworkT = (0, _runtypes.Literal)("ethereum");
|
|
12
10
|
const EthereumAddressT = exports.EthereumAddressT = _runtypes.String.withConstraint(maybeAddress => {
|
|
13
11
|
return /0x[a-fA-F0-9]{40}/.test(maybeAddress) || `${maybeAddress} is not a valid ethereum address`;
|
|
14
12
|
});
|
|
15
|
-
const HederaAccountIDT = exports.HederaAccountIDT = _runtypes.String.withConstraint(maybeAddress => {
|
|
16
|
-
return /0x[a-fA-F0-9]{40}/.test(maybeAddress) || `${maybeAddress} is not a valid hedera address`;
|
|
17
|
-
});
|
|
18
13
|
let EthereumNetworks = exports.EthereumNetworks = void 0;
|
|
19
14
|
(function (EthereumNetworks) {
|
|
20
15
|
EthereumNetworks["homestead"] = "1";
|
|
@@ -29,29 +24,14 @@ let EthereumNetworks = exports.EthereumNetworks = void 0;
|
|
|
29
24
|
EthereumNetworks["xdcapothem"] = "51";
|
|
30
25
|
EthereumNetworks["stabilityTestnet"] = "20180427";
|
|
31
26
|
EthereumNetworks["stability"] = "101010";
|
|
32
|
-
EthereumNetworks["hedera"] = "295";
|
|
33
|
-
EthereumNetworks["hederatestnet"] = "296";
|
|
34
27
|
EthereumNetworks["astron"] = "1338";
|
|
35
28
|
})(EthereumNetworks || (exports.EthereumNetworks = EthereumNetworks = {}));
|
|
36
|
-
|
|
37
|
-
(
|
|
38
|
-
HederaNetworks["mainnet"] = "295";
|
|
39
|
-
HederaNetworks["testnet"] = "296";
|
|
40
|
-
})(HederaNetworks || (exports.HederaNetworks = HederaNetworks = {}));
|
|
41
|
-
const HederaNetworkIdT = exports.HederaNetworkIdT = (0, _runtypes.Union)((0, _runtypes.Literal)(HederaNetworks.mainnet), (0, _runtypes.Literal)(HederaNetworks.testnet));
|
|
42
|
-
const EthereumNetworkIdT = exports.EthereumNetworkIdT = (0, _runtypes.Union)((0, _runtypes.Literal)(EthereumNetworks.homestead), (0, _runtypes.Literal)(EthereumNetworks.ropsten), (0, _runtypes.Literal)(EthereumNetworks.rinkeby), (0, _runtypes.Literal)(EthereumNetworks.goerli), (0, _runtypes.Literal)(EthereumNetworks.sepolia), (0, _runtypes.Literal)(EthereumNetworks.polygon), (0, _runtypes.Literal)(EthereumNetworks.polygonAmoy), (0, _runtypes.Literal)(EthereumNetworks.xdc), (0, _runtypes.Literal)(EthereumNetworks.xdcapothem), (0, _runtypes.Literal)(EthereumNetworks.stabilityTestnet), (0, _runtypes.Literal)(EthereumNetworks.stability), (0, _runtypes.Literal)(EthereumNetworks.local), (0, _runtypes.Literal)(EthereumNetworks.hedera), (0, _runtypes.Literal)(EthereumNetworks.hederatestnet), (0, _runtypes.Literal)(EthereumNetworks.astron));
|
|
43
|
-
const OpenAttestationDNSTextRecordT = exports.OpenAttestationDNSTextRecordT = (0, _runtypes.Union)((0, _runtypes.Record)({
|
|
29
|
+
const EthereumNetworkIdT = exports.EthereumNetworkIdT = (0, _runtypes.Union)((0, _runtypes.Literal)(EthereumNetworks.homestead), (0, _runtypes.Literal)(EthereumNetworks.ropsten), (0, _runtypes.Literal)(EthereumNetworks.rinkeby), (0, _runtypes.Literal)(EthereumNetworks.goerli), (0, _runtypes.Literal)(EthereumNetworks.sepolia), (0, _runtypes.Literal)(EthereumNetworks.polygon), (0, _runtypes.Literal)(EthereumNetworks.polygonAmoy), (0, _runtypes.Literal)(EthereumNetworks.xdc), (0, _runtypes.Literal)(EthereumNetworks.xdcapothem), (0, _runtypes.Literal)(EthereumNetworks.stabilityTestnet), (0, _runtypes.Literal)(EthereumNetworks.stability), (0, _runtypes.Literal)(EthereumNetworks.local), (0, _runtypes.Literal)(EthereumNetworks.astron));
|
|
30
|
+
const OpenAttestationDNSTextRecordT = exports.OpenAttestationDNSTextRecordT = (0, _runtypes.Record)({
|
|
44
31
|
type: RecordTypesT,
|
|
45
|
-
net:
|
|
32
|
+
net: BlockchainNetworkT,
|
|
46
33
|
netId: EthereumNetworkIdT,
|
|
47
34
|
addr: EthereumAddressT
|
|
48
35
|
}).And((0, _runtypes.Partial)({
|
|
49
36
|
dnssec: _runtypes.Boolean
|
|
50
|
-
}))
|
|
51
|
-
type: RecordTypesT,
|
|
52
|
-
net: (0, _runtypes.Literal)("hedera"),
|
|
53
|
-
netId: HederaNetworkIdT,
|
|
54
|
-
addr: HederaAccountIDT
|
|
55
|
-
}).And((0, _runtypes.Partial)({
|
|
56
|
-
dnssec: _runtypes.Boolean
|
|
57
|
-
})));
|
|
37
|
+
}));
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Static, Boolean, String, Literal, Record, Union, Partial } from "runtypes";
|
|
2
2
|
export declare const RecordTypesT: Literal<"openatts">;
|
|
3
|
-
export declare const BlockchainNetworkT:
|
|
3
|
+
export declare const BlockchainNetworkT: Literal<"ethereum">;
|
|
4
4
|
export declare const EthereumAddressT: import("runtypes").Constraint<String, string, unknown>;
|
|
5
|
-
export declare const HederaAccountIDT: import("runtypes").Constraint<String, string, unknown>;
|
|
6
5
|
export declare enum EthereumNetworks {
|
|
7
6
|
homestead = "1",
|
|
8
7
|
ropsten = "3",
|
|
@@ -16,31 +15,17 @@ export declare enum EthereumNetworks {
|
|
|
16
15
|
xdcapothem = "51",
|
|
17
16
|
stabilityTestnet = "20180427",
|
|
18
17
|
stability = "101010",
|
|
19
|
-
hedera = "295",
|
|
20
|
-
hederatestnet = "296",
|
|
21
18
|
astron = "1338"
|
|
22
19
|
}
|
|
23
|
-
export declare
|
|
24
|
-
|
|
25
|
-
testnet = "296"
|
|
26
|
-
}
|
|
27
|
-
export declare const HederaNetworkIdT: Union<[Literal<HederaNetworks.mainnet>, Literal<HederaNetworks.testnet>]>;
|
|
28
|
-
export declare const EthereumNetworkIdT: Union<[Literal<EthereumNetworks.homestead>, Literal<EthereumNetworks.ropsten>, Literal<EthereumNetworks.rinkeby>, Literal<EthereumNetworks.goerli>, Literal<EthereumNetworks.sepolia>, Literal<EthereumNetworks.polygon>, Literal<EthereumNetworks.polygonAmoy>, Literal<EthereumNetworks.xdc>, Literal<EthereumNetworks.xdcapothem>, Literal<EthereumNetworks.stabilityTestnet>, Literal<EthereumNetworks.stability>, Literal<EthereumNetworks.local>, Literal<EthereumNetworks.hedera>, Literal<EthereumNetworks.hederatestnet>, Literal<EthereumNetworks.astron>]>;
|
|
29
|
-
export declare const OpenAttestationDNSTextRecordT: Union<[import("runtypes").Intersect<[Record<{
|
|
20
|
+
export declare const EthereumNetworkIdT: Union<[Literal<EthereumNetworks.homestead>, Literal<EthereumNetworks.ropsten>, Literal<EthereumNetworks.rinkeby>, Literal<EthereumNetworks.goerli>, Literal<EthereumNetworks.sepolia>, Literal<EthereumNetworks.polygon>, Literal<EthereumNetworks.polygonAmoy>, Literal<EthereumNetworks.xdc>, Literal<EthereumNetworks.xdcapothem>, Literal<EthereumNetworks.stabilityTestnet>, Literal<EthereumNetworks.stability>, Literal<EthereumNetworks.local>, Literal<EthereumNetworks.astron>]>;
|
|
21
|
+
export declare const OpenAttestationDNSTextRecordT: import("runtypes").Intersect<[Record<{
|
|
30
22
|
type: Literal<"openatts">;
|
|
31
23
|
net: Literal<"ethereum">;
|
|
32
|
-
netId: Union<[Literal<EthereumNetworks.homestead>, Literal<EthereumNetworks.ropsten>, Literal<EthereumNetworks.rinkeby>, Literal<EthereumNetworks.goerli>, Literal<EthereumNetworks.sepolia>, Literal<EthereumNetworks.polygon>, Literal<EthereumNetworks.polygonAmoy>, Literal<EthereumNetworks.xdc>, Literal<EthereumNetworks.xdcapothem>, Literal<EthereumNetworks.stabilityTestnet>, Literal<EthereumNetworks.stability>, Literal<EthereumNetworks.local>, Literal<EthereumNetworks.
|
|
33
|
-
addr: import("runtypes").Constraint<String, string, unknown>;
|
|
34
|
-
}, false>, Partial<{
|
|
35
|
-
dnssec: Boolean;
|
|
36
|
-
}, false>]>, import("runtypes").Intersect<[Record<{
|
|
37
|
-
type: Literal<"openatts">;
|
|
38
|
-
net: Literal<"hedera">;
|
|
39
|
-
netId: Union<[Literal<HederaNetworks.mainnet>, Literal<HederaNetworks.testnet>]>;
|
|
24
|
+
netId: Union<[Literal<EthereumNetworks.homestead>, Literal<EthereumNetworks.ropsten>, Literal<EthereumNetworks.rinkeby>, Literal<EthereumNetworks.goerli>, Literal<EthereumNetworks.sepolia>, Literal<EthereumNetworks.polygon>, Literal<EthereumNetworks.polygonAmoy>, Literal<EthereumNetworks.xdc>, Literal<EthereumNetworks.xdcapothem>, Literal<EthereumNetworks.stabilityTestnet>, Literal<EthereumNetworks.stability>, Literal<EthereumNetworks.local>, Literal<EthereumNetworks.astron>]>;
|
|
40
25
|
addr: import("runtypes").Constraint<String, string, unknown>;
|
|
41
26
|
}, false>, Partial<{
|
|
42
27
|
dnssec: Boolean;
|
|
43
|
-
}, false>]
|
|
28
|
+
}, false>]>;
|
|
44
29
|
export type BlockchainNetwork = Static<typeof BlockchainNetworkT>;
|
|
45
30
|
export type EthereumAddress = Static<typeof EthereumAddressT>;
|
|
46
31
|
export type OpenAttestationDNSTextRecord = Static<typeof OpenAttestationDNSTextRecordT>;
|
package/dist/ts/util/logger.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
1
|
+
import debug from "debug";
|
|
2
|
+
export declare const trace: (namespace: string) => debug.Debugger;
|
|
3
|
+
export declare const info: (namespace: string) => debug.Debugger;
|
|
4
|
+
export declare const error: (namespace: string) => debug.Debugger;
|
|
4
5
|
export declare const getLogger: (namespace: string) => {
|
|
5
|
-
trace:
|
|
6
|
-
info:
|
|
7
|
-
error:
|
|
6
|
+
trace: debug.Debugger;
|
|
7
|
+
info: debug.Debugger;
|
|
8
|
+
error: debug.Debugger;
|
|
8
9
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tradetrust-tt/dnsprove",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.0",
|
|
4
4
|
"description": "Helper utility for retrieving OpenAttestations document store address records from DNS",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -92,6 +92,6 @@
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
"engines": {
|
|
95
|
-
"node": "18.x"
|
|
95
|
+
"node": ">=18.x"
|
|
96
96
|
}
|
|
97
97
|
}
|
package/src/index.test.ts
CHANGED
|
@@ -284,51 +284,6 @@ describe("queryDns", () => {
|
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
286
|
|
|
287
|
-
describe("getDocumentStoreRecords for Hedera", () => {
|
|
288
|
-
const sampleDnsTextRecord = [
|
|
289
|
-
{
|
|
290
|
-
type: "openatts",
|
|
291
|
-
net: "hedera",
|
|
292
|
-
netId: "295",
|
|
293
|
-
addr: "0x222B69788e2e9B7FB93a3a0fE258D4604Dc7df21",
|
|
294
|
-
dnssec: false,
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
type: "openatts",
|
|
298
|
-
net: "hedera",
|
|
299
|
-
netId: "296",
|
|
300
|
-
addr: "0x222B69788e2e9B7FB93a3a0fE258D4604Dc7df21",
|
|
301
|
-
dnssec: false,
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
type: "openatts",
|
|
305
|
-
net: "hedera",
|
|
306
|
-
netId: "296",
|
|
307
|
-
addr: "0x3DE43bfd3D771931E46CbBd4EDE0D3d95C85f81A",
|
|
308
|
-
dnssec: false,
|
|
309
|
-
},
|
|
310
|
-
{
|
|
311
|
-
type: "openatts",
|
|
312
|
-
net: "hedera",
|
|
313
|
-
netId: "296",
|
|
314
|
-
addr: "0xB9cf2eFcBeCdF96E6A7E46AECd79A784B41Bcf6B",
|
|
315
|
-
dnssec: false,
|
|
316
|
-
},
|
|
317
|
-
];
|
|
318
|
-
|
|
319
|
-
test("it should work with trustlv.org", async () => {
|
|
320
|
-
const records = (await getDocumentStoreRecords("trustlv.org")).sort((a, b) => {
|
|
321
|
-
if (a.netId < b.netId) return -1;
|
|
322
|
-
if (a.netId > b.netId) return 1;
|
|
323
|
-
if (a.addr < b.addr) return -1;
|
|
324
|
-
if (a.addr > b.addr) return 1;
|
|
325
|
-
return 0;
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
expect(records).toStrictEqual(sampleDnsTextRecord);
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
287
|
describe("getDocumentStoreRecords for Astron", () => {
|
|
333
288
|
const sampleDnsTextRecord = [
|
|
334
289
|
{
|
package/src/records/dnsTxt.ts
CHANGED
|
@@ -2,17 +2,12 @@ import { Static, Boolean, String, Literal, Record, Union, Partial } from "runtyp
|
|
|
2
2
|
|
|
3
3
|
export const RecordTypesT = Literal("openatts");
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
export const BlockchainNetworkT = Union(Literal("ethereum"), Literal("hedera"));
|
|
5
|
+
export const BlockchainNetworkT = Literal("ethereum");
|
|
7
6
|
|
|
8
7
|
export const EthereumAddressT = String.withConstraint((maybeAddress: string) => {
|
|
9
8
|
return /0x[a-fA-F0-9]{40}/.test(maybeAddress) || `${maybeAddress} is not a valid ethereum address`;
|
|
10
9
|
});
|
|
11
10
|
|
|
12
|
-
export const HederaAccountIDT = String.withConstraint((maybeAddress: string) => {
|
|
13
|
-
return /0x[a-fA-F0-9]{40}/.test(maybeAddress) || `${maybeAddress} is not a valid hedera address`;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
11
|
export enum EthereumNetworks {
|
|
17
12
|
homestead = "1",
|
|
18
13
|
ropsten = "3",
|
|
@@ -26,18 +21,9 @@ export enum EthereumNetworks {
|
|
|
26
21
|
xdcapothem = "51",
|
|
27
22
|
stabilityTestnet = "20180427",
|
|
28
23
|
stability = "101010",
|
|
29
|
-
hedera = "295",
|
|
30
|
-
hederatestnet = "296",
|
|
31
24
|
astron = "1338",
|
|
32
25
|
}
|
|
33
26
|
|
|
34
|
-
export enum HederaNetworks {
|
|
35
|
-
mainnet = "295",
|
|
36
|
-
testnet = "296",
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export const HederaNetworkIdT = Union(Literal(HederaNetworks.mainnet), Literal(HederaNetworks.testnet));
|
|
40
|
-
|
|
41
27
|
export const EthereumNetworkIdT = Union(
|
|
42
28
|
Literal(EthereumNetworks.homestead),
|
|
43
29
|
Literal(EthereumNetworks.ropsten),
|
|
@@ -51,25 +37,15 @@ export const EthereumNetworkIdT = Union(
|
|
|
51
37
|
Literal(EthereumNetworks.stabilityTestnet),
|
|
52
38
|
Literal(EthereumNetworks.stability),
|
|
53
39
|
Literal(EthereumNetworks.local),
|
|
54
|
-
Literal(EthereumNetworks.hedera),
|
|
55
|
-
Literal(EthereumNetworks.hederatestnet),
|
|
56
40
|
Literal(EthereumNetworks.astron)
|
|
57
41
|
);
|
|
58
42
|
|
|
59
|
-
export const OpenAttestationDNSTextRecordT =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}).And(Partial({ dnssec: Boolean })),
|
|
66
|
-
Record({
|
|
67
|
-
type: RecordTypesT,
|
|
68
|
-
net: Literal("hedera"),
|
|
69
|
-
netId: HederaNetworkIdT,
|
|
70
|
-
addr: HederaAccountIDT,
|
|
71
|
-
}).And(Partial({ dnssec: Boolean }))
|
|
72
|
-
);
|
|
43
|
+
export const OpenAttestationDNSTextRecordT = Record({
|
|
44
|
+
type: RecordTypesT,
|
|
45
|
+
net: BlockchainNetworkT,
|
|
46
|
+
netId: EthereumNetworkIdT,
|
|
47
|
+
addr: EthereumAddressT,
|
|
48
|
+
}).And(Partial({ dnssec: Boolean }));
|
|
73
49
|
|
|
74
50
|
export type BlockchainNetwork = Static<typeof BlockchainNetworkT>;
|
|
75
51
|
export type EthereumAddress = Static<typeof EthereumAddressT>;
|