SDK
This document mainly introduces the related APIs and usage methods of the SDK.
Use onjs SDK to interact with OpenName contracts
onjs
onjs integrates the OpenName contract, you will only need one unified SDK to integrate all domains across multiple chains. onjs will hide all the complicated cross-chain detail from the partners, making the integration very easy.
Overview of the onjs
Installation
Install @opennamedid/onjs.
This package exports bellows.
Getting Started
First,you need to create a new ON instance.
ON Interface
Retrieve a domain name by Evm address.
Name Interface
Returns a Record Object, The Record Object is an array object with a length of 6. [resolverAddr,expireTime,name,chainId,expireTime of grace,expire time of auction]
Index | Element | Explanation |
0 | resolverAddr | address of resolver |
1 | expireTime | The expiration time of a domain name based on the unit timestamp, accurate to the second, for example, 1689738089. |
2 | name | domain name |
3 | chainId | the ID of the chain where the domain name resides |
4 | expireTime of grace | grace period expiration time. The format is the same as expireTime. |
5 | expireTime of auction | auction period expiration time. The format is the same as expireTime. |
Returns the address for the current ON name for the coinType provided.
Other Interface
Returns the tokenId for the domain name provided.
The usage is as follows.
Appendix
Supported Chain List
No | ChainId | ChainName |
1 | 1 | Ethereum |
2 | 10 | Optimism |
3 | 56 | BNB Chain |
4 | 137 | Polygon |
5 | 324 | zkSync Era |
6 | 8453 | Base |
7 | 42161 | Arbitrum |
8 | 59144 | Linea |
9 | 1101 | Polygon zkEvm |
10 | 43114 | Avalanche |
11 | 204 | opBNB |
12 | 250 | Fantom |
13 | 534352 | Scroll |
14 | 1030 | Conflux eSpace |
15 | 5000 | Mantle |
16 | 122 | Fuse |
17 | 1088 | Metis |
18 | 169 | Manta Network |
19 | 42220 | Celo |
20 | 81457 | Blast |
21 | 34443 | Mode |
22 | 666666666 | Degen |
23 | 7777777 | Zora |
Supported CoinType List
No | CoinType | CoinName |
1 | 0 | Btc |
2 | 2 | Ltc |
3 | 3 | Doge |
4 | 4 | Rdd |
5 | 5 | Dash |
6 | 6 | Ppc |
7 | 14 | Via |
8 | 17 | Grs |
9 | 20 | Dgb |
10 | 42 | Dcr |
11 | 43 | Xem |
12 | 57 | Sys |
13 | 60 | Eth |
14 | 74 | Icx |
15 | 77 | Xvg |
16 | 105 | Strat |
17 | 111 | Ark |
18 | 118 | Atom |
19 | 121 | Zen |
20 | 128 | Xmr |
21 | 133 | Zec |
22 | 134 | Lsk |
23 | 135 | Steem |
24 | 141 | Kmd |
25 | 144 | Xrp |
26 | 145 | Bch |
27 | 148 | Xlm |
28 | 156 | Btg |
29 | 175 | Rvn |
30 | 178 | Poa |
31 | 194 | Eos |
32 | 195 | Trx |
33 | 204 | Bcn |
34 | 246 | Ewt |
35 | 256 | Nano |
36 | 270 | One |
37 | 283 | Algo |
38 | 291 | Iost |
39 | 301 | Divi |
40 | 304 | Iotx |
41 | 308 | Bts |
42 | 309 | Ckb |
43 | 313 | Zil |
44 | 330 | Luna |
45 | 354 | Dot |
46 | 360 | Vsys |
47 | 367 | Abbc |
48 | 394 | Cro |
49 | 397 | Near |
50 | 415 | Etn |
51 | 425 | Aion |
52 | 434 | Ksm |
53 | 457 | Ae |
54 | 459 | Kava |
55 | 461 | Fil |
56 | 472 | Ar |
57 | 500 | Theta |
58 | 501 | Sol |
59 | 508 | Egld |
60 | 535 | Xhv |
61 | 539 | Flow |
62 | 566 | Iris |
63 | 573 | Srm |
64 | 589 | Tfuel |
65 | 592 | Grin |
66 | 614 | Opt |
67 | 714 | Bnb |
68 | 818 | Vet |
69 | 820 | Clo |
70 | 888 | Neo |
71 | 889 | Tomo |
72 | 904 | Hnt |
73 | 931 | Rune |
74 | 966 | Matic |
75 | 999 | Bcd |
76 | 1007 | Ftm |
77 | 1024 | Ont |
78 | 1729 | Xtz |
79 | 1815 | Ada |
80 | 2301 | Qtum |
81 | 2305 | Ela |
82 | 2718 | Nas |
83 | 3030 | Hbar |
84 | 4218 | Iota |
85 | 5757 | Stx |
86 | 6060 | Go |
87 | 8964 | Nuls |
88 | 9000 | Avax |
89 | 9001 | Arb |
90 | 9797 | Nrg |
91 | 16754 | Ardr |
92 | 52752 | Celo |
93 | 5655640 | Vlx |
94 | 5718350 | Wan |
95 | 5741564 | Waves |
96 | 8453 | Base |
97 | 59144 | Linea |
98 | 1101 | Polygon_zkEVM |
99 | 20400 | Opbnb |
100 | 534352 | Scroll |
101 | 1030 | Cfx |
102 | 5000 | Mantle |
103 | 122 | FUSE |
104 | 1088 | Metis |
105 | 169 | MANTA |
106 | 42220 | CELO |
107 | 81457 | Blast |
108 | 1686 | Mint |
109 | 34443 | Mode |
110 | 666666666 | Degen |
111 | 7777777 | Zora |
Last updated