Skip to content

Commit 6450227

Browse files
maxufengmaxufeng
andauthored
feat: add astrontestnet nework to EthereumNetworks enum (#27)
* feat: add astrontestnet nework to EthereumNetworks enum * feat: update index.test.ts --------- Co-authored-by: maxufeng <maxufeng@caict.ac.cn>
1 parent a9c3d32 commit 6450227

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

src/index.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,37 @@ describe("queryDns", () => {
281281
});
282282
});
283283

284+
describe("getDocumentStoreRecords for AstronTestnet", () => {
285+
const sampleDnsTextRecord = [
286+
{
287+
type: "openatts",
288+
net: "ethereum",
289+
netId: "21002",
290+
addr: "0xb1Bf514b3893357813F366282E887eE221D5C2dA",
291+
dnssec: false,
292+
},
293+
{
294+
type: "openatts",
295+
net: "ethereum",
296+
netId: "21002",
297+
addr: "0xdAEe89A37fEEBCBFAc94aBA63Fb163808dAc38Fb",
298+
dnssec: false,
299+
},
300+
];
301+
302+
test("it should work with dev-astronlayer2.bitfactory.cn", async () => {
303+
const records = (await getDocumentStoreRecords("dev-astronlayer2.bitfactory.cn")).sort((a, b) => {
304+
if (a.netId < b.netId) return -1;
305+
if (a.netId > b.netId) return 1;
306+
if (a.addr < b.addr) return -1;
307+
if (a.addr > b.addr) return 1;
308+
return 0;
309+
});
310+
311+
expect(records).toStrictEqual(sampleDnsTextRecord);
312+
});
313+
});
314+
284315
describe("getDocumentStoreRecords for Astron", () => {
285316
const sampleDnsTextRecord = [
286317
{

src/records/dnsTxt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export enum EthereumNetworks {
2121
xdcapothem = "51",
2222
stabilityTestnet = "20180427",
2323
stability = "101010",
24+
astronTestnet = "21002",
2425
astron = "1338",
2526
}
2627

@@ -37,6 +38,7 @@ export const EthereumNetworkIdT = Union(
3738
Literal(EthereumNetworks.stabilityTestnet),
3839
Literal(EthereumNetworks.stability),
3940
Literal(EthereumNetworks.local),
41+
Literal(EthereumNetworks.astronTestnet),
4042
Literal(EthereumNetworks.astron)
4143
);
4244

0 commit comments

Comments
 (0)