@ensdomains/ensjs 3.0.0-beta.1 → 3.0.0-beta.11

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.
Files changed (534) hide show
  1. package/contracts/OldestResolver.json +170 -0
  2. package/contracts/UniversalResolverv2.json +628 -0
  3. package/dist/cjs/clients/decorators/subgraph.js.map +1 -1
  4. package/dist/cjs/clients/decorators/wallet.js +2 -0
  5. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  6. package/dist/cjs/clients/public.js.map +1 -1
  7. package/dist/cjs/clients/subgraph.js.map +1 -1
  8. package/dist/cjs/contracts/consts.js +53 -2
  9. package/dist/cjs/contracts/consts.js.map +1 -1
  10. package/dist/cjs/contracts/universalResolver.js +46 -1
  11. package/dist/cjs/contracts/universalResolver.js.map +1 -1
  12. package/dist/cjs/dns.js +3 -3
  13. package/dist/cjs/dns.js.map +1 -1
  14. package/dist/cjs/errors/subgraph.js.map +1 -1
  15. package/dist/cjs/errors/utils.js +27 -18
  16. package/dist/cjs/errors/utils.js.map +1 -1
  17. package/dist/cjs/errors/version.js +1 -1
  18. package/dist/cjs/errors/version.js.map +1 -1
  19. package/dist/cjs/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +3 -3
  20. package/dist/cjs/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
  21. package/dist/cjs/functions/dns/importDnsName.js +7 -7
  22. package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
  23. package/dist/cjs/functions/public/_getAbi.js +2 -2
  24. package/dist/cjs/functions/public/_getAbi.js.map +1 -1
  25. package/dist/cjs/functions/public/_getAddr.js +9 -19
  26. package/dist/cjs/functions/public/_getAddr.js.map +1 -1
  27. package/dist/cjs/functions/public/_getContentHash.js +1 -1
  28. package/dist/cjs/functions/public/batch.js.map +1 -1
  29. package/dist/cjs/functions/public/getAbiRecord.js.map +1 -1
  30. package/dist/cjs/functions/public/getAddressRecord.js.map +1 -1
  31. package/dist/cjs/functions/public/getAvailable.js.map +1 -1
  32. package/dist/cjs/functions/public/getContentHashRecord.js.map +1 -1
  33. package/dist/cjs/functions/public/getExpiry.js.map +1 -1
  34. package/dist/cjs/functions/public/getName.js.map +1 -1
  35. package/dist/cjs/functions/public/getOwner.js.map +1 -1
  36. package/dist/cjs/functions/public/getPrice.js.map +1 -1
  37. package/dist/cjs/functions/public/getRecords.js +56 -42
  38. package/dist/cjs/functions/public/getRecords.js.map +1 -1
  39. package/dist/cjs/functions/public/getResolver.js.map +1 -1
  40. package/dist/cjs/functions/public/getSupportedInterfaces.js +1 -1
  41. package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
  42. package/dist/cjs/functions/public/getTextRecord.js.map +1 -1
  43. package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
  44. package/dist/cjs/functions/public/getWrapperName.js.map +1 -1
  45. package/dist/cjs/functions/public/multicallWrapper.js.map +1 -1
  46. package/dist/cjs/functions/public/universalWrapper.js.map +1 -1
  47. package/dist/cjs/functions/subgraph/client.js.map +1 -1
  48. package/dist/cjs/functions/subgraph/filters.js +3 -0
  49. package/dist/cjs/functions/subgraph/filters.js.map +1 -0
  50. package/dist/cjs/functions/subgraph/getDecodedName.js.map +1 -1
  51. package/dist/cjs/functions/subgraph/getNameHistory.js +4 -3
  52. package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
  53. package/dist/cjs/functions/subgraph/getNamesForAddress.js +155 -190
  54. package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
  55. package/dist/cjs/functions/subgraph/getSubgraphRecords.js +34 -26
  56. package/dist/cjs/functions/subgraph/getSubgraphRecords.js.map +1 -1
  57. package/dist/cjs/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  58. package/dist/cjs/functions/subgraph/getSubnames.js +95 -108
  59. package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
  60. package/dist/cjs/functions/subgraph/types.js +3 -0
  61. package/dist/cjs/functions/subgraph/types.js.map +1 -0
  62. package/dist/cjs/functions/subgraph/utils.js.map +1 -1
  63. package/dist/cjs/functions/wallet/clearRecords.js +26 -0
  64. package/dist/cjs/functions/wallet/clearRecords.js.map +1 -0
  65. package/dist/cjs/functions/wallet/commitName.js.map +1 -1
  66. package/dist/cjs/functions/wallet/createSubname.js +1 -1
  67. package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
  68. package/dist/cjs/functions/wallet/deleteSubname.js.map +1 -1
  69. package/dist/cjs/functions/wallet/registerName.js.map +1 -1
  70. package/dist/cjs/functions/wallet/renewNames.js.map +1 -1
  71. package/dist/cjs/functions/wallet/setAbiRecord.js.map +1 -1
  72. package/dist/cjs/functions/wallet/setAddressRecord.js.map +1 -1
  73. package/dist/cjs/functions/wallet/setChildFuses.js +1 -1
  74. package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
  75. package/dist/cjs/functions/wallet/setContentHashRecord.js.map +1 -1
  76. package/dist/cjs/functions/wallet/setFuses.js +1 -1
  77. package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
  78. package/dist/cjs/functions/wallet/setPrimaryName.js.map +1 -1
  79. package/dist/cjs/functions/wallet/setRecords.js.map +1 -1
  80. package/dist/cjs/functions/wallet/setResolver.js.map +1 -1
  81. package/dist/cjs/functions/wallet/setTextRecord.js.map +1 -1
  82. package/dist/cjs/functions/wallet/transferName.js.map +1 -1
  83. package/dist/cjs/functions/wallet/unwrapName.js.map +1 -1
  84. package/dist/cjs/functions/wallet/wrapName.js +3 -1
  85. package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
  86. package/dist/cjs/index.js +1 -2
  87. package/dist/cjs/index.js.map +1 -1
  88. package/dist/cjs/subgraph.js +4 -1
  89. package/dist/cjs/subgraph.js.map +1 -1
  90. package/dist/cjs/utils/contentHash.js +60 -131
  91. package/dist/cjs/utils/contentHash.js.map +1 -1
  92. package/dist/cjs/utils/encoders/encodeAbi.js +33 -3
  93. package/dist/cjs/utils/encoders/encodeAbi.js.map +1 -1
  94. package/dist/cjs/utils/encoders/encodeClearRecords.js +12 -0
  95. package/dist/cjs/utils/encoders/encodeClearRecords.js.map +1 -0
  96. package/dist/cjs/utils/encoders/encodeSetAddr.js +5 -16
  97. package/dist/cjs/utils/encoders/encodeSetAddr.js.map +1 -1
  98. package/dist/cjs/utils/encoders/encodeSetContentHash.js +1 -4
  99. package/dist/cjs/utils/encoders/encodeSetContentHash.js.map +1 -1
  100. package/dist/cjs/utils/format.js +1 -5
  101. package/dist/cjs/utils/format.js.map +1 -1
  102. package/dist/cjs/utils/fuses.js +184 -200
  103. package/dist/cjs/utils/fuses.js.map +1 -1
  104. package/dist/cjs/utils/generateRecordCallArray.js +6 -10
  105. package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
  106. package/dist/cjs/utils/getRevertErrorData.js +4 -1
  107. package/dist/cjs/utils/getRevertErrorData.js.map +1 -1
  108. package/dist/cjs/utils/index.js +31 -7
  109. package/dist/cjs/utils/index.js.map +1 -1
  110. package/dist/cjs/utils/normaliseCoinId.js +35 -0
  111. package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
  112. package/dist/cjs/utils/registerHelpers.js +3 -1
  113. package/dist/cjs/utils/registerHelpers.js.map +1 -1
  114. package/dist/cjs/wallet.js +3 -1
  115. package/dist/cjs/wallet.js.map +1 -1
  116. package/dist/esm/clients/decorators/subgraph.js.map +1 -1
  117. package/dist/esm/clients/decorators/wallet.js +2 -0
  118. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  119. package/dist/esm/clients/public.js.map +1 -1
  120. package/dist/esm/clients/subgraph.js.map +1 -1
  121. package/dist/esm/contracts/consts.js +53 -2
  122. package/dist/esm/contracts/consts.js.map +1 -1
  123. package/dist/esm/contracts/universalResolver.js +46 -1
  124. package/dist/esm/contracts/universalResolver.js.map +1 -1
  125. package/dist/esm/dns.js +1 -1
  126. package/dist/esm/dns.js.map +1 -1
  127. package/dist/esm/errors/subgraph.js.map +1 -1
  128. package/dist/esm/errors/utils.js +24 -16
  129. package/dist/esm/errors/utils.js.map +1 -1
  130. package/dist/esm/errors/version.js +1 -1
  131. package/dist/esm/errors/version.js.map +1 -1
  132. package/dist/esm/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +10 -10
  133. package/dist/esm/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
  134. package/dist/esm/functions/dns/getDnsOwner.js +1 -1
  135. package/dist/esm/functions/dns/importDnsName.js +13 -12
  136. package/dist/esm/functions/dns/importDnsName.js.map +1 -1
  137. package/dist/esm/functions/public/_getAbi.js +2 -2
  138. package/dist/esm/functions/public/_getAbi.js.map +1 -1
  139. package/dist/esm/functions/public/_getAddr.js +10 -20
  140. package/dist/esm/functions/public/_getAddr.js.map +1 -1
  141. package/dist/esm/functions/public/_getContentHash.js +2 -2
  142. package/dist/esm/functions/public/batch.js +2 -1
  143. package/dist/esm/functions/public/batch.js.map +1 -1
  144. package/dist/esm/functions/public/getAbiRecord.js +2 -1
  145. package/dist/esm/functions/public/getAbiRecord.js.map +1 -1
  146. package/dist/esm/functions/public/getAddressRecord.js +2 -1
  147. package/dist/esm/functions/public/getAddressRecord.js.map +1 -1
  148. package/dist/esm/functions/public/getAvailable.js +2 -1
  149. package/dist/esm/functions/public/getAvailable.js.map +1 -1
  150. package/dist/esm/functions/public/getContentHashRecord.js +2 -1
  151. package/dist/esm/functions/public/getContentHashRecord.js.map +1 -1
  152. package/dist/esm/functions/public/getExpiry.js +2 -1
  153. package/dist/esm/functions/public/getExpiry.js.map +1 -1
  154. package/dist/esm/functions/public/getName.js +2 -1
  155. package/dist/esm/functions/public/getName.js.map +1 -1
  156. package/dist/esm/functions/public/getOwner.js +3 -2
  157. package/dist/esm/functions/public/getOwner.js.map +1 -1
  158. package/dist/esm/functions/public/getPrice.js +3 -2
  159. package/dist/esm/functions/public/getPrice.js.map +1 -1
  160. package/dist/esm/functions/public/getRecords.js +59 -48
  161. package/dist/esm/functions/public/getRecords.js.map +1 -1
  162. package/dist/esm/functions/public/getResolver.js +2 -1
  163. package/dist/esm/functions/public/getResolver.js.map +1 -1
  164. package/dist/esm/functions/public/getSupportedInterfaces.js +24 -2
  165. package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
  166. package/dist/esm/functions/public/getTextRecord.js +2 -1
  167. package/dist/esm/functions/public/getTextRecord.js.map +1 -1
  168. package/dist/esm/functions/public/getWrapperData.js +2 -1
  169. package/dist/esm/functions/public/getWrapperData.js.map +1 -1
  170. package/dist/esm/functions/public/getWrapperName.js +2 -1
  171. package/dist/esm/functions/public/getWrapperName.js.map +1 -1
  172. package/dist/esm/functions/public/multicallWrapper.js.map +1 -1
  173. package/dist/esm/functions/public/universalWrapper.js.map +1 -1
  174. package/dist/esm/functions/subgraph/client.js.map +1 -1
  175. package/dist/esm/functions/subgraph/filters.js +2 -0
  176. package/dist/esm/functions/subgraph/filters.js.map +1 -0
  177. package/dist/esm/functions/subgraph/getDecodedName.js +2 -1
  178. package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
  179. package/dist/esm/functions/subgraph/getNameHistory.js +8 -6
  180. package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
  181. package/dist/esm/functions/subgraph/getNamesForAddress.js +163 -192
  182. package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
  183. package/dist/esm/functions/subgraph/getSubgraphRecords.js +36 -27
  184. package/dist/esm/functions/subgraph/getSubgraphRecords.js.map +1 -1
  185. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js +2 -1
  186. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  187. package/dist/esm/functions/subgraph/getSubnames.js +103 -112
  188. package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
  189. package/dist/esm/functions/subgraph/types.js +2 -0
  190. package/dist/esm/functions/subgraph/types.js.map +1 -0
  191. package/dist/esm/functions/subgraph/utils.js.map +1 -1
  192. package/dist/esm/functions/wallet/clearRecords.js +44 -0
  193. package/dist/esm/functions/wallet/clearRecords.js.map +1 -0
  194. package/dist/esm/functions/wallet/commitName.js +3 -1
  195. package/dist/esm/functions/wallet/commitName.js.map +1 -1
  196. package/dist/esm/functions/wallet/createSubname.js +3 -2
  197. package/dist/esm/functions/wallet/createSubname.js.map +1 -1
  198. package/dist/esm/functions/wallet/deleteSubname.js +2 -1
  199. package/dist/esm/functions/wallet/deleteSubname.js.map +1 -1
  200. package/dist/esm/functions/wallet/registerName.js +4 -1
  201. package/dist/esm/functions/wallet/registerName.js.map +1 -1
  202. package/dist/esm/functions/wallet/renewNames.js +3 -1
  203. package/dist/esm/functions/wallet/renewNames.js.map +1 -1
  204. package/dist/esm/functions/wallet/setAbiRecord.js +3 -1
  205. package/dist/esm/functions/wallet/setAbiRecord.js.map +1 -1
  206. package/dist/esm/functions/wallet/setAddressRecord.js +2 -1
  207. package/dist/esm/functions/wallet/setAddressRecord.js.map +1 -1
  208. package/dist/esm/functions/wallet/setChildFuses.js +3 -2
  209. package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
  210. package/dist/esm/functions/wallet/setContentHashRecord.js +2 -1
  211. package/dist/esm/functions/wallet/setContentHashRecord.js.map +1 -1
  212. package/dist/esm/functions/wallet/setFuses.js +4 -3
  213. package/dist/esm/functions/wallet/setFuses.js.map +1 -1
  214. package/dist/esm/functions/wallet/setPrimaryName.js +2 -1
  215. package/dist/esm/functions/wallet/setPrimaryName.js.map +1 -1
  216. package/dist/esm/functions/wallet/setRecords.js +2 -1
  217. package/dist/esm/functions/wallet/setRecords.js.map +1 -1
  218. package/dist/esm/functions/wallet/setResolver.js +2 -1
  219. package/dist/esm/functions/wallet/setResolver.js.map +1 -1
  220. package/dist/esm/functions/wallet/setTextRecord.js +2 -1
  221. package/dist/esm/functions/wallet/setTextRecord.js.map +1 -1
  222. package/dist/esm/functions/wallet/transferName.js +2 -1
  223. package/dist/esm/functions/wallet/transferName.js.map +1 -1
  224. package/dist/esm/functions/wallet/unwrapName.js +2 -1
  225. package/dist/esm/functions/wallet/unwrapName.js.map +1 -1
  226. package/dist/esm/functions/wallet/wrapName.js +6 -3
  227. package/dist/esm/functions/wallet/wrapName.js.map +1 -1
  228. package/dist/esm/index.js +1 -1
  229. package/dist/esm/index.js.map +1 -1
  230. package/dist/esm/subgraph.js +1 -0
  231. package/dist/esm/subgraph.js.map +1 -1
  232. package/dist/esm/utils/contentHash.js +56 -128
  233. package/dist/esm/utils/contentHash.js.map +1 -1
  234. package/dist/esm/utils/encoders/encodeAbi.js +30 -2
  235. package/dist/esm/utils/encoders/encodeAbi.js.map +1 -1
  236. package/dist/esm/utils/encoders/encodeClearRecords.js +8 -0
  237. package/dist/esm/utils/encoders/encodeClearRecords.js.map +1 -0
  238. package/dist/esm/utils/encoders/encodeSetAddr.js +5 -16
  239. package/dist/esm/utils/encoders/encodeSetAddr.js.map +1 -1
  240. package/dist/esm/utils/encoders/encodeSetContentHash.js +2 -5
  241. package/dist/esm/utils/encoders/encodeSetContentHash.js.map +1 -1
  242. package/dist/esm/utils/format.js +0 -2
  243. package/dist/esm/utils/format.js.map +1 -1
  244. package/dist/esm/utils/fuses.js +183 -201
  245. package/dist/esm/utils/fuses.js.map +1 -1
  246. package/dist/esm/utils/generateRecordCallArray.js +7 -10
  247. package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
  248. package/dist/esm/utils/getRevertErrorData.js +4 -1
  249. package/dist/esm/utils/getRevertErrorData.js.map +1 -1
  250. package/dist/esm/utils/index.js +5 -3
  251. package/dist/esm/utils/index.js.map +1 -1
  252. package/dist/esm/utils/normaliseCoinId.js +30 -0
  253. package/dist/esm/utils/normaliseCoinId.js.map +1 -0
  254. package/dist/esm/utils/registerHelpers.js +4 -2
  255. package/dist/esm/utils/registerHelpers.js.map +1 -1
  256. package/dist/esm/wallet.js +1 -0
  257. package/dist/esm/wallet.js.map +1 -1
  258. package/dist/types/clients/decorators/public.d.ts +1 -519
  259. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  260. package/dist/types/clients/decorators/subgraph.d.ts +2 -520
  261. package/dist/types/clients/decorators/subgraph.d.ts.map +1 -1
  262. package/dist/types/clients/decorators/wallet.d.ts +66 -47
  263. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  264. package/dist/types/clients/public.d.ts +24 -265
  265. package/dist/types/clients/public.d.ts.map +1 -1
  266. package/dist/types/clients/subgraph.d.ts +19 -260
  267. package/dist/types/clients/subgraph.d.ts.map +1 -1
  268. package/dist/types/clients/wallet.d.ts +60 -92
  269. package/dist/types/clients/wallet.d.ts.map +1 -1
  270. package/dist/types/contracts/consts.d.ts +52 -3
  271. package/dist/types/contracts/consts.d.ts.map +1 -1
  272. package/dist/types/contracts/universalResolver.d.ts +133 -1
  273. package/dist/types/contracts/universalResolver.d.ts.map +1 -1
  274. package/dist/types/dns.d.ts +2 -2
  275. package/dist/types/dns.d.ts.map +1 -1
  276. package/dist/types/errors/subgraph.d.ts +4 -4
  277. package/dist/types/errors/subgraph.d.ts.map +1 -1
  278. package/dist/types/errors/utils.d.ts +16 -13
  279. package/dist/types/errors/utils.d.ts.map +1 -1
  280. package/dist/types/errors/version.d.ts +1 -1
  281. package/dist/types/errors/version.d.ts.map +1 -1
  282. package/dist/types/functions/dns/getDnsImportData.d.ts +39 -0
  283. package/dist/types/functions/dns/{prepareDnsImport.d.ts.map → getDnsImportData.d.ts.map} +1 -1
  284. package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
  285. package/dist/types/functions/dns/importDnsName.d.ts +88 -102
  286. package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
  287. package/dist/types/functions/public/_getAddr.d.ts.map +1 -1
  288. package/dist/types/functions/public/batch.d.ts +2 -1
  289. package/dist/types/functions/public/batch.d.ts.map +1 -1
  290. package/dist/types/functions/public/getAbiRecord.d.ts +2 -1
  291. package/dist/types/functions/public/getAbiRecord.d.ts.map +1 -1
  292. package/dist/types/functions/public/getAddressRecord.d.ts +2 -1
  293. package/dist/types/functions/public/getAddressRecord.d.ts.map +1 -1
  294. package/dist/types/functions/public/getAvailable.d.ts +2 -1
  295. package/dist/types/functions/public/getAvailable.d.ts.map +1 -1
  296. package/dist/types/functions/public/getContentHashRecord.d.ts +2 -1
  297. package/dist/types/functions/public/getContentHashRecord.d.ts.map +1 -1
  298. package/dist/types/functions/public/getExpiry.d.ts +2 -1
  299. package/dist/types/functions/public/getExpiry.d.ts.map +1 -1
  300. package/dist/types/functions/public/getName.d.ts +2 -1
  301. package/dist/types/functions/public/getName.d.ts.map +1 -1
  302. package/dist/types/functions/public/getOwner.d.ts +19 -9
  303. package/dist/types/functions/public/getOwner.d.ts.map +1 -1
  304. package/dist/types/functions/public/getPrice.d.ts +3 -2
  305. package/dist/types/functions/public/getPrice.d.ts.map +1 -1
  306. package/dist/types/functions/public/getRecords.d.ts +3 -2
  307. package/dist/types/functions/public/getRecords.d.ts.map +1 -1
  308. package/dist/types/functions/public/getResolver.d.ts +2 -1
  309. package/dist/types/functions/public/getResolver.d.ts.map +1 -1
  310. package/dist/types/functions/public/getSupportedInterfaces.d.ts +41 -4
  311. package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
  312. package/dist/types/functions/public/getTextRecord.d.ts +2 -1
  313. package/dist/types/functions/public/getTextRecord.d.ts.map +1 -1
  314. package/dist/types/functions/public/getWrapperData.d.ts +4 -3
  315. package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
  316. package/dist/types/functions/public/getWrapperName.d.ts +2 -1
  317. package/dist/types/functions/public/getWrapperName.d.ts.map +1 -1
  318. package/dist/types/functions/subgraph/client.d.ts +2 -2
  319. package/dist/types/functions/subgraph/client.d.ts.map +1 -1
  320. package/dist/types/functions/subgraph/filters.d.ts +693 -0
  321. package/dist/types/functions/subgraph/filters.d.ts.map +1 -0
  322. package/dist/types/functions/subgraph/getDecodedName.d.ts +2 -1
  323. package/dist/types/functions/subgraph/getDecodedName.d.ts.map +1 -1
  324. package/dist/types/functions/subgraph/getNameHistory.d.ts +2 -1
  325. package/dist/types/functions/subgraph/getNameHistory.d.ts.map +1 -1
  326. package/dist/types/functions/subgraph/getNamesForAddress.d.ts +7 -2
  327. package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
  328. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts +2 -1
  329. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts.map +1 -1
  330. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts +2 -1
  331. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts.map +1 -1
  332. package/dist/types/functions/subgraph/getSubnames.d.ts +5 -2
  333. package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
  334. package/dist/types/functions/subgraph/types.d.ts +13 -0
  335. package/dist/types/functions/subgraph/types.d.ts.map +1 -0
  336. package/dist/types/functions/subgraph/utils.d.ts +2 -2
  337. package/dist/types/functions/subgraph/utils.d.ts.map +1 -1
  338. package/dist/types/functions/wallet/clearRecords.d.ts +555 -0
  339. package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
  340. package/dist/types/functions/wallet/commitName.d.ts +80 -93
  341. package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
  342. package/dist/types/functions/wallet/createSubname.d.ts +82 -96
  343. package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
  344. package/dist/types/functions/wallet/deleteSubname.d.ts +79 -93
  345. package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
  346. package/dist/types/functions/wallet/registerName.d.ts +80 -89
  347. package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
  348. package/dist/types/functions/wallet/renewNames.d.ts +79 -89
  349. package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
  350. package/dist/types/functions/wallet/setAbiRecord.d.ts +80 -93
  351. package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
  352. package/dist/types/functions/wallet/setAddressRecord.d.ts +79 -93
  353. package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
  354. package/dist/types/functions/wallet/setChildFuses.d.ts +81 -95
  355. package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
  356. package/dist/types/functions/wallet/setContentHashRecord.d.ts +79 -93
  357. package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
  358. package/dist/types/functions/wallet/setFuses.d.ts +81 -95
  359. package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
  360. package/dist/types/functions/wallet/setPrimaryName.d.ts +79 -93
  361. package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
  362. package/dist/types/functions/wallet/setRecords.d.ts +79 -93
  363. package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
  364. package/dist/types/functions/wallet/setResolver.d.ts +79 -93
  365. package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
  366. package/dist/types/functions/wallet/setTextRecord.d.ts +79 -93
  367. package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
  368. package/dist/types/functions/wallet/transferName.d.ts +80 -94
  369. package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
  370. package/dist/types/functions/wallet/unwrapName.d.ts +79 -93
  371. package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
  372. package/dist/types/functions/wallet/wrapName.d.ts +81 -95
  373. package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
  374. package/dist/types/index.d.ts +1 -1
  375. package/dist/types/index.d.ts.map +1 -1
  376. package/dist/types/subgraph.d.ts +1 -0
  377. package/dist/types/subgraph.d.ts.map +1 -1
  378. package/dist/types/types.d.ts +3 -1
  379. package/dist/types/types.d.ts.map +1 -1
  380. package/dist/types/utils/contentHash.d.ts +10 -11
  381. package/dist/types/utils/contentHash.d.ts.map +1 -1
  382. package/dist/types/utils/encoders/encodeAbi.d.ts +8 -5
  383. package/dist/types/utils/encoders/encodeAbi.d.ts.map +1 -1
  384. package/dist/types/utils/encoders/encodeClearRecords.d.ts +3 -0
  385. package/dist/types/utils/encoders/encodeClearRecords.d.ts.map +1 -0
  386. package/dist/types/utils/encoders/encodeSetAddr.d.ts.map +1 -1
  387. package/dist/types/utils/encoders/encodeSetContentHash.d.ts.map +1 -1
  388. package/dist/types/utils/format.d.ts +0 -2
  389. package/dist/types/utils/format.d.ts.map +1 -1
  390. package/dist/types/utils/fuses.d.ts +164 -125
  391. package/dist/types/utils/fuses.d.ts.map +1 -1
  392. package/dist/types/utils/generateRecordCallArray.d.ts +5 -5
  393. package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
  394. package/dist/types/utils/getRevertErrorData.d.ts.map +1 -1
  395. package/dist/types/utils/index.d.ts +5 -3
  396. package/dist/types/utils/index.d.ts.map +1 -1
  397. package/dist/types/utils/normaliseCoinId.d.ts +10 -0
  398. package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
  399. package/dist/types/utils/registerHelpers.d.ts +2 -2
  400. package/dist/types/utils/registerHelpers.d.ts.map +1 -1
  401. package/dist/types/wallet.d.ts +18 -17
  402. package/dist/types/wallet.d.ts.map +1 -1
  403. package/package.json +9 -9
  404. package/src/clients/decorators/subgraph.ts +1 -0
  405. package/src/clients/decorators/wallet.ts +41 -3
  406. package/src/clients/public.ts +3 -2
  407. package/src/clients/subgraph.ts +3 -2
  408. package/src/clients/wallet.ts +1 -1
  409. package/src/contracts/consts.ts +58 -13
  410. package/src/contracts/universalResolver.ts +46 -1
  411. package/src/dns.ts +7 -5
  412. package/src/errors/subgraph.ts +4 -4
  413. package/src/errors/utils.ts +29 -18
  414. package/src/errors/version.ts +1 -1
  415. package/src/functions/dns/{prepareDnsImport.ts → getDnsImportData.ts} +13 -13
  416. package/src/functions/dns/getDnsOwner.ts +1 -1
  417. package/src/functions/dns/importDnsName.ts +21 -15
  418. package/src/functions/public/_getAbi.ts +2 -2
  419. package/src/functions/public/_getAddr.ts +16 -23
  420. package/src/functions/public/_getContentHash.ts +2 -2
  421. package/src/functions/public/batch.ts +2 -1
  422. package/src/functions/public/getAbiRecord.ts +2 -1
  423. package/src/functions/public/getAddressRecord.ts +2 -1
  424. package/src/functions/public/getAvailable.ts +2 -1
  425. package/src/functions/public/getContentHashRecord.ts +2 -1
  426. package/src/functions/public/getExpiry.ts +2 -1
  427. package/src/functions/public/getName.ts +3 -2
  428. package/src/functions/public/getOwner.ts +54 -33
  429. package/src/functions/public/getPrice.ts +3 -2
  430. package/src/functions/public/getRecords.ts +130 -114
  431. package/src/functions/public/getResolver.ts +3 -2
  432. package/src/functions/public/getSupportedInterfaces.ts +70 -10
  433. package/src/functions/public/getTextRecord.ts +2 -1
  434. package/src/functions/public/getWrapperData.ts +5 -4
  435. package/src/functions/public/getWrapperName.ts +3 -2
  436. package/src/functions/public/multicallWrapper.ts +1 -1
  437. package/src/functions/public/universalWrapper.ts +1 -1
  438. package/src/functions/subgraph/client.ts +2 -2
  439. package/src/functions/subgraph/filters.ts +702 -0
  440. package/src/functions/subgraph/getDecodedName.ts +2 -1
  441. package/src/functions/subgraph/getNameHistory.ts +8 -6
  442. package/src/functions/subgraph/getNamesForAddress.ts +199 -195
  443. package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
  444. package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
  445. package/src/functions/subgraph/getSubnames.ts +123 -114
  446. package/src/functions/subgraph/types.ts +13 -0
  447. package/src/functions/subgraph/utils.ts +2 -2
  448. package/src/functions/wallet/clearRecords.ts +97 -0
  449. package/src/functions/wallet/commitName.ts +3 -1
  450. package/src/functions/wallet/createSubname.ts +6 -5
  451. package/src/functions/wallet/deleteSubname.ts +2 -1
  452. package/src/functions/wallet/registerName.ts +4 -1
  453. package/src/functions/wallet/renewNames.ts +3 -1
  454. package/src/functions/wallet/setAbiRecord.ts +3 -1
  455. package/src/functions/wallet/setAddressRecord.ts +2 -1
  456. package/src/functions/wallet/setChildFuses.ts +5 -4
  457. package/src/functions/wallet/setContentHashRecord.ts +2 -1
  458. package/src/functions/wallet/setFuses.ts +8 -4
  459. package/src/functions/wallet/setPrimaryName.ts +2 -1
  460. package/src/functions/wallet/setRecords.ts +2 -1
  461. package/src/functions/wallet/setResolver.ts +2 -1
  462. package/src/functions/wallet/setTextRecord.ts +2 -1
  463. package/src/functions/wallet/transferName.ts +3 -2
  464. package/src/functions/wallet/unwrapName.ts +2 -1
  465. package/src/functions/wallet/wrapName.ts +10 -4
  466. package/src/index.ts +0 -1
  467. package/src/subgraph.ts +5 -0
  468. package/src/types.ts +6 -3
  469. package/src/utils/contentHash.ts +65 -113
  470. package/src/utils/encoders/encodeAbi.ts +37 -8
  471. package/src/utils/encoders/encodeClearRecords.ts +9 -0
  472. package/src/utils/encoders/encodeSetAddr.ts +5 -16
  473. package/src/utils/encoders/encodeSetContentHash.ts +2 -4
  474. package/src/utils/format.ts +0 -6
  475. package/src/utils/fuses.ts +312 -308
  476. package/src/utils/generateRecordCallArray.ts +10 -14
  477. package/src/utils/getRevertErrorData.ts +3 -1
  478. package/src/utils/index.ts +37 -5
  479. package/src/utils/normaliseCoinId.ts +36 -0
  480. package/src/utils/registerHelpers.ts +5 -3
  481. package/src/wallet.ts +41 -0
  482. package/dist/types/functions/dns/prepareDnsImport.d.ts +0 -39
  483. package/src/@types/@ensdomains/content-hash.d.ts +0 -1
  484. package/src/functions/dns/getDnsOwner.test.ts +0 -195
  485. package/src/functions/dns/importDnsName.test.ts +0 -117
  486. package/src/functions/dns/prepareDnsImport.test.ts +0 -115
  487. package/src/functions/public/batch.test.ts +0 -67
  488. package/src/functions/public/ccip.test.ts +0 -78
  489. package/src/functions/public/getAbiRecord.test.ts +0 -174
  490. package/src/functions/public/getAddressRecord.test.ts +0 -83
  491. package/src/functions/public/getAvailable.test.ts +0 -17
  492. package/src/functions/public/getContentHashRecord.test.ts +0 -28
  493. package/src/functions/public/getExpiry.test.ts +0 -48
  494. package/src/functions/public/getName.test.ts +0 -66
  495. package/src/functions/public/getOwner.test.ts +0 -87
  496. package/src/functions/public/getPrice.test.ts +0 -45
  497. package/src/functions/public/getRecords.test.ts +0 -49
  498. package/src/functions/public/getResolver.test.ts +0 -12
  499. package/src/functions/public/getTextRecord.test.ts +0 -20
  500. package/src/functions/public/getWrapperData.test.ts +0 -79
  501. package/src/functions/public/getWrapperName.test.ts +0 -19
  502. package/src/functions/subgraph/client.test.ts +0 -170
  503. package/src/functions/subgraph/getDecodedName.test.ts +0 -31
  504. package/src/functions/subgraph/getNameHistory.test.ts +0 -39
  505. package/src/functions/subgraph/getNamesForAddress.test.ts +0 -244
  506. package/src/functions/subgraph/getSubgraphRecords.test.ts +0 -74
  507. package/src/functions/subgraph/getSubgraphRegistrant.test.ts +0 -34
  508. package/src/functions/subgraph/getSubnames.test.ts +0 -202
  509. package/src/functions/wallet/commitName.test.ts +0 -58
  510. package/src/functions/wallet/createSubname.test.ts +0 -73
  511. package/src/functions/wallet/deleteSubname.test.ts +0 -150
  512. package/src/functions/wallet/registerName.test.ts +0 -81
  513. package/src/functions/wallet/renewNames.test.ts +0 -92
  514. package/src/functions/wallet/setAbiRecord.test.ts +0 -156
  515. package/src/functions/wallet/setAddressRecord.test.ts +0 -121
  516. package/src/functions/wallet/setChildFuses.test.ts +0 -97
  517. package/src/functions/wallet/setContentHashRecord.test.ts +0 -69
  518. package/src/functions/wallet/setFuses.test.ts +0 -287
  519. package/src/functions/wallet/setPrimaryName.test.ts +0 -71
  520. package/src/functions/wallet/setRecords.test.ts +0 -127
  521. package/src/functions/wallet/setResolver.test.ts +0 -114
  522. package/src/functions/wallet/setTextRecord.test.ts +0 -67
  523. package/src/functions/wallet/transferName.test.ts +0 -201
  524. package/src/functions/wallet/unwrapName.test.ts +0 -93
  525. package/src/functions/wallet/wrapName.test.ts +0 -195
  526. package/src/utils/generateRecordCallArray.test.ts +0 -84
  527. package/src/utils/labels.test.ts +0 -163
  528. package/src/utils/makeLabelNodeAndParent.test.ts +0 -11
  529. package/src/utils/makeSafeSecondsDate.test.ts +0 -14
  530. package/src/utils/normalise.test.ts +0 -35
  531. package/src/utils/ownerFromContract.test.ts +0 -52
  532. package/src/utils/registerHelpers.test.ts +0 -159
  533. package/src/utils/validation.test.ts +0 -170
  534. package/src/utils/wrapper.test.ts +0 -46
@@ -1,6 +1,7 @@
1
- import { encodeFunctionData, type Hex } from 'viem'
2
- import { publicResolverClearRecordsSnippet } from '../contracts/publicResolver.js'
1
+ import { type Hex } from 'viem'
3
2
  import type { Prettify } from '../types.js'
3
+ import type { EncodedAbi } from './encoders/encodeAbi.js'
4
+ import { encodeClearRecords } from './encoders/encodeClearRecords.js'
4
5
  import {
5
6
  encodeSetAbi,
6
7
  type EncodeSetAbiParameters,
@@ -19,13 +20,13 @@ export type RecordOptions = Prettify<{
19
20
  /** Clears all current records */
20
21
  clearRecords?: boolean
21
22
  /** ContentHash value */
22
- contentHash?: string
23
+ contentHash?: string | null
23
24
  /** Array of text records */
24
25
  texts?: Omit<EncodeSetTextParameters, 'namehash'>[]
25
26
  /** Array of coin records */
26
27
  coins?: Omit<EncodeSetAddrParameters, 'namehash'>[]
27
28
  /** ABI value */
28
- abi?: Omit<EncodeSetAbiParameters, 'namehash'>
29
+ abi?: EncodedAbi | null
29
30
  }>
30
31
 
31
32
  export const generateRecordCallArray = ({
@@ -39,22 +40,17 @@ export const generateRecordCallArray = ({
39
40
  const calls: Hex[] = []
40
41
 
41
42
  if (clearRecords) {
42
- calls.push(
43
- encodeFunctionData({
44
- abi: publicResolverClearRecordsSnippet,
45
- functionName: 'clearRecords',
46
- args: [namehash],
47
- }),
48
- )
43
+ calls.push(encodeClearRecords(namehash))
49
44
  }
50
45
 
51
- if (typeof contentHash === 'string') {
46
+ if (contentHash !== undefined) {
52
47
  const data = encodeSetContentHash({ namehash, contentHash })
53
48
  if (data) calls.push(data)
54
49
  }
55
50
 
56
- if (abi) {
57
- const data = encodeSetAbi({ namehash, ...abi } as EncodeSetAbiParameters)
51
+ if (abi !== undefined) {
52
+ const abi_ = abi ?? { contentType: 0, encodedData: null }
53
+ const data = encodeSetAbi({ namehash, ...abi_ } as EncodeSetAbiParameters)
58
54
  if (data) calls.push(data)
59
55
  }
60
56
 
@@ -3,5 +3,7 @@ import { BaseError, RawContractError } from 'viem'
3
3
  export const getRevertErrorData = (err: unknown) => {
4
4
  if (!(err instanceof BaseError)) return undefined
5
5
  const error = err.walk() as RawContractError
6
- return typeof error.data === 'object' ? error.data.data : error.data
6
+ const hex = typeof error.data === 'object' ? error.data.data : error.data
7
+ if (hex === '0x') return undefined
8
+ return hex
7
9
  }
@@ -1,9 +1,12 @@
1
1
  export {
2
+ contentTypeToEncodeAs,
2
3
  encodeAbi,
4
+ encodeAsToContentType,
3
5
  type EncodeAbiParameters,
4
6
  type EncodeAbiReturnType,
5
7
  type EncodedAbi,
6
8
  } from './encoders/encodeAbi.js'
9
+ export { encodeClearRecords } from './encoders/encodeClearRecords.js'
7
10
  export {
8
11
  encodeSetAbi,
9
12
  type EncodeSetAbiParameters,
@@ -32,17 +35,46 @@ export {
32
35
  MAX_INT_64,
33
36
  MINIMUM_DOT_ETH_CHARS,
34
37
  } from './consts.js'
38
+ export {
39
+ ChildFuseKeys,
40
+ ChildFuseReference,
41
+ ChildFuses,
42
+ FullParentFuseKeys,
43
+ FullParentFuseReference,
44
+ FullParentFuses,
45
+ FuseRanges,
46
+ ParentFuseKeys,
47
+ ParentFuseReference,
48
+ ParentFuses,
49
+ UnnamedChildFuseKeys,
50
+ UnnamedChildFuses,
51
+ UnnamedParentFuseKeys,
52
+ UnnamedParentFuses,
53
+ UserSettableFuseKeys,
54
+ UserSettableFuses,
55
+ checkPccBurned,
56
+ decodeFuses,
57
+ encodeFuses,
58
+ type ChildFuseReferenceType,
59
+ type DecodedFuses,
60
+ type EncodeChildFusesInputObject,
61
+ type EncodeFusesInputObject,
62
+ type EncodeParentFusesInputObject,
63
+ type FullParentFuseReferenceType,
64
+ type ParentFuseReferenceType,
65
+ } from './fuses.js'
35
66
 
36
67
  export {
37
- decodeContenthash,
38
- encodeContenthash,
68
+ decodeContentHash,
69
+ encodeContentHash,
70
+ getDisplayCodec,
71
+ getInternalCodec,
39
72
  getProtocolType,
40
- isValidContenthash,
41
- validateContent,
73
+ isValidContentHash,
42
74
  type DecodedContentHash,
43
75
  type ProtocolType,
44
76
  } from './contentHash.js'
45
- export { bracketFormat, formatHashed, truncateFormat } from './format.js'
77
+ export { truncateFormat } from './format.js'
46
78
  export {
47
79
  generateRecordCallArray,
48
80
  type RecordOptions,
@@ -0,0 +1,36 @@
1
+ import {
2
+ getCoderByCoinName,
3
+ getCoderByCoinType,
4
+ type Coin,
5
+ } from '@ensdomains/address-encoder'
6
+ import { CoinFormatterNotFoundError } from '../errors/public.js'
7
+
8
+ export const normaliseCoinId = (coinId: string | number) => {
9
+ const isString = typeof coinId === 'string'
10
+
11
+ if (isString && Number.isNaN(parseInt(coinId))) {
12
+ return {
13
+ type: 'name',
14
+ value: coinId.toLowerCase().replace(/legacy$/, 'Legacy'),
15
+ } as const
16
+ }
17
+ return {
18
+ type: 'id',
19
+ value: isString ? parseInt(coinId as string) : (coinId as number),
20
+ } as const
21
+ }
22
+
23
+ export const getCoderFromCoin = (coinId: string | number): Coin => {
24
+ const normalisedCoin = normaliseCoinId(coinId)
25
+ let coder: Coin
26
+ try {
27
+ coder =
28
+ normalisedCoin.type === 'id'
29
+ ? getCoderByCoinType(normalisedCoin.value)
30
+ : getCoderByCoinName(normalisedCoin.value)
31
+ } catch {
32
+ throw new CoinFormatterNotFoundError({ coinType: coinId })
33
+ }
34
+
35
+ return coder
36
+ }
@@ -10,7 +10,7 @@ import {
10
10
  } from 'viem'
11
11
  import { CampaignReferenceTooLargeError } from '../errors/utils.js'
12
12
  import { EMPTY_ADDRESS } from './consts.js'
13
- import { encodeFuses, hasFuses, type CombinedFuseInput } from './fuses.js'
13
+ import { encodeFuses, type EncodeChildFusesInputObject } from './fuses.js'
14
14
  import {
15
15
  generateRecordCallArray,
16
16
  type RecordOptions,
@@ -33,7 +33,7 @@ export type RegistrationParameters = {
33
33
  /** Sets primary name upon registration */
34
34
  reverseRecord?: boolean
35
35
  /** Fuses to set upon registration */
36
- fuses?: CombinedFuseInput['child']
36
+ fuses?: EncodeChildFusesInputObject
37
37
  }
38
38
 
39
39
  export type CommitmentTuple = [
@@ -95,7 +95,9 @@ export const makeCommitmentTuple = ({
95
95
  }: RegistrationParameters): CommitmentTuple => {
96
96
  const labelHash = labelhash(name.split('.')[0])
97
97
  const hash = namehash(name)
98
- const fuseData = hasFuses(fuses) ? encodeFuses(fuses!, 'child') : 0
98
+ const fuseData = fuses
99
+ ? encodeFuses({ restriction: 'child', input: fuses })
100
+ : 0
99
101
 
100
102
  if (
101
103
  reverseRecord &&
package/src/wallet.ts CHANGED
@@ -1,85 +1,126 @@
1
+ export {
2
+ default as clearRecords,
3
+ type ClearRecordsDataParameters,
4
+ type ClearRecordsDataReturnType,
5
+ type ClearRecordsParameters,
6
+ type ClearRecordsReturnType,
7
+ } from './functions/wallet/clearRecords.js'
1
8
  export {
2
9
  default as commitName,
10
+ type CommitNameDataParameters,
11
+ type CommitNameDataReturnType,
3
12
  type CommitNameParameters,
4
13
  type CommitNameReturnType,
5
14
  } from './functions/wallet/commitName.js'
6
15
  export {
7
16
  default as createSubname,
17
+ type CreateSubnameDataParameters,
18
+ type CreateSubnameDataReturnType,
8
19
  type CreateSubnameParameters,
9
20
  type CreateSubnameReturnType,
10
21
  } from './functions/wallet/createSubname.js'
11
22
  export {
12
23
  default as deleteSubname,
24
+ type DeleteSubnameDataParameters,
25
+ type DeleteSubnameDataReturnType,
13
26
  type DeleteSubnameParameters,
14
27
  type DeleteSubnameReturnType,
15
28
  } from './functions/wallet/deleteSubname.js'
16
29
  export {
17
30
  default as registerName,
31
+ type RegisterNameDataParameters,
32
+ type RegisterNameDataReturnType,
18
33
  type RegisterNameParameters,
19
34
  type RegisterNameReturnType,
20
35
  } from './functions/wallet/registerName.js'
21
36
  export {
22
37
  default as renewNames,
38
+ type RenewNamesDataParameters,
39
+ type RenewNamesDataReturnType,
23
40
  type RenewNamesParameters,
24
41
  type RenewNamesReturnType,
25
42
  } from './functions/wallet/renewNames.js'
26
43
  export {
27
44
  default as setAbiRecord,
45
+ type SetAbiRecordDataParameters,
46
+ type SetAbiRecordDataReturnType,
28
47
  type SetAbiRecordParameters,
29
48
  type SetAbiRecordReturnType,
30
49
  } from './functions/wallet/setAbiRecord.js'
31
50
  export {
32
51
  default as setAddressRecord,
52
+ type SetAddressRecordDataParameters,
53
+ type SetAddressRecordDataReturnType,
33
54
  type SetAddressRecordParameters,
34
55
  type SetAddressRecordReturnType,
35
56
  } from './functions/wallet/setAddressRecord.js'
36
57
  export {
37
58
  default as setChildFuses,
59
+ type SetChildFusesDataParameters,
60
+ type SetChildFusesDataReturnType,
38
61
  type SetChildFusesParameters,
39
62
  type SetChildFusesReturnType,
40
63
  } from './functions/wallet/setChildFuses.js'
41
64
  export {
42
65
  default as setContentHashRecord,
66
+ type SetContentHashRecordDataParameters,
67
+ type SetContentHashRecordDataReturnType,
43
68
  type SetContentHashRecordParameters,
44
69
  type SetContentHashRecordReturnType,
45
70
  } from './functions/wallet/setContentHashRecord.js'
46
71
  export {
47
72
  default as setFuses,
73
+ type SetFusesDataParameters,
74
+ type SetFusesDataReturnType,
48
75
  type SetFusesParameters,
49
76
  type SetFusesReturnType,
50
77
  } from './functions/wallet/setFuses.js'
51
78
  export {
52
79
  default as setPrimaryName,
80
+ type SetPrimaryNameDataParameters,
81
+ type SetPrimaryNameDataReturnType,
53
82
  type SetPrimaryNameParameters,
54
83
  type SetPrimaryNameReturnType,
55
84
  } from './functions/wallet/setPrimaryName.js'
56
85
  export {
57
86
  default as setRecords,
87
+ type SetRecordsDataParameters,
88
+ type SetRecordsDataReturnType,
58
89
  type SetRecordsParameters,
59
90
  type SetRecordsReturnType,
60
91
  } from './functions/wallet/setRecords.js'
61
92
  export {
62
93
  default as setResolver,
94
+ type SetResolverDataParameters,
95
+ type SetResolverDataReturnType,
63
96
  type SetResolverParameters,
64
97
  type SetResolverReturnType,
65
98
  } from './functions/wallet/setResolver.js'
66
99
  export {
67
100
  default as setTextRecord,
101
+ type SetTextRecordDataParameters,
102
+ type SetTextRecordDataReturnType,
68
103
  type SetTextRecordParameters,
69
104
  type SetTextRecordReturnType,
70
105
  } from './functions/wallet/setTextRecord.js'
71
106
  export {
72
107
  default as transferName,
108
+ type TransferNameDataParameters,
109
+ type TransferNameDataReturnType,
73
110
  type TransferNameParameters,
74
111
  type TransferNameReturnType,
75
112
  } from './functions/wallet/transferName.js'
76
113
  export {
77
114
  default as unwrapName,
115
+ type UnwrapNameDataParameters,
116
+ type UnwrapNameDataReturnType,
78
117
  type UnwrapNameParameters,
79
118
  type UnwrapNameReturnType,
80
119
  } from './functions/wallet/unwrapName.js'
81
120
  export {
82
121
  default as wrapName,
122
+ type WrapNameDataParameters,
123
+ type WrapNameDataReturnType,
83
124
  type WrapNameParameters,
84
125
  type WrapNameReturnType,
85
126
  } from './functions/wallet/wrapName.js'
@@ -1,39 +0,0 @@
1
- import type { ClientWithEns } from '../../contracts/consts.js';
2
- import type { Endpoint } from './types.js';
3
- export type PrepareDnsImportParameters = {
4
- /** Name to prepare for DNS import */
5
- name: string;
6
- /** An RFC-1035 compatible DNS endpoint to use (default: `https://cloudflare-dns.com/dns-query`) */
7
- endpoint?: Endpoint;
8
- };
9
- export type RrSetWithSig = {
10
- rrset: Uint8Array;
11
- sig: Uint8Array;
12
- };
13
- export type PrepareDnsImportReturnType = {
14
- rrsets: RrSetWithSig[];
15
- proof: Uint8Array;
16
- };
17
- /**
18
- * Creates prepared data for `importDnsName()`
19
- * @param client - {@link ClientWithEns}
20
- * @param parameters - {@link PrepareDnsImportParameters}
21
- * @returns Prepared data object
22
- *
23
- * @example
24
- * import { createPublicClient, http } from 'viem'
25
- * import { mainnet } from 'viem/chains'
26
- * import { addContracts, prepareDnsImport } from '@ensdomains/ensjs'
27
- *
28
- * const mainnetWithEns = addContracts([mainnet])
29
- * const client = createPublicClient({
30
- * chain: mainnetWithEns,
31
- * transport: http(),
32
- * })
33
- * const preparedData = await prepareDnsImport(client, {
34
- * name: 'example.eth',
35
- * })
36
- */
37
- declare const prepareDnsImport: (client: ClientWithEns, { name, endpoint, }: PrepareDnsImportParameters) => Promise<PrepareDnsImportReturnType>;
38
- export default prepareDnsImport;
39
- //# sourceMappingURL=prepareDnsImport.d.ts.map
@@ -1 +0,0 @@
1
- declare module '@ensdomains/content-hash'
@@ -1,195 +0,0 @@
1
- /* eslint-disable @typescript-eslint/naming-convention */
2
- import type { RequestListener } from 'http'
3
- import { getVersion } from '../../errors/error-utils.js'
4
- import { createHttpServer } from '../../tests/createHttpServer.js'
5
- import getDnsOwner from './getDnsOwner.js'
6
-
7
- const handler: jest.MockedFunction<RequestListener> = jest.fn()
8
- let closeServer: () => Promise<unknown>
9
- let serverUrl: `http://${string}` = 'http://'
10
-
11
- beforeAll(async () => {
12
- const { close, url } = await createHttpServer(handler)
13
- closeServer = close
14
- serverUrl = url
15
- })
16
-
17
- afterAll(async () => {
18
- await closeServer()
19
- })
20
-
21
- beforeEach(() => {
22
- handler.mockReset()
23
- })
24
-
25
- it('returns valid address from valid domain and record', async () => {
26
- let name
27
- let type
28
- handler.mockImplementation((req, res) => {
29
- const url = new URL(req.url!, `http://${req.headers.host!}`)
30
- name = url.searchParams.get('name')
31
- type = url.searchParams.get('type')
32
-
33
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
34
- res.end(
35
- JSON.stringify({
36
- Status: 0,
37
- AD: true,
38
- Answer: [
39
- {
40
- name: '_ens.example.com',
41
- type: 16,
42
- TTL: 0,
43
- data: '"a=0x8e8Db5CcEF88cca9d624701Db544989C996E3216"',
44
- },
45
- ],
46
- }),
47
- )
48
- res.destroy()
49
- })
50
-
51
- const result = await getDnsOwner({ name: 'example.com', endpoint: serverUrl })
52
- expect(handler).toHaveBeenCalled()
53
- expect(name).toBe('_ens.example.com.')
54
- expect(type).toBe('TXT')
55
- expect(result).toEqual('0x8e8Db5CcEF88cca9d624701Db544989C996E3216')
56
- })
57
-
58
- it('throws error if .eth', async () => {
59
- await expect(getDnsOwner({ name: 'example.eth' })).rejects
60
- .toThrowErrorMatchingInlineSnapshot(`
61
- "Unsupported name type: eth-2ld
62
-
63
- - Supported name types: other-2ld
64
-
65
- Version: ${getVersion()}"
66
- `)
67
- })
68
- it('throws error if >2ld', async () => {
69
- await expect(getDnsOwner({ name: 'subdomain.example.com' })).rejects
70
- .toThrowErrorMatchingInlineSnapshot(`
71
- "Unsupported name type: other-subname
72
-
73
- - Supported name types: other-2ld
74
-
75
- Version: ${getVersion()}"
76
- `)
77
- })
78
- it('returns error if DnsResponseStatus is not NOERROR', async () => {
79
- handler.mockImplementation((_req, res) => {
80
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
81
- res.end(
82
- JSON.stringify({
83
- Status: 3, // NXDOMAIN
84
- AD: true,
85
- }),
86
- )
87
- res.destroy()
88
- })
89
-
90
- await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
91
- .rejects.toThrowErrorMatchingInlineSnapshot(`
92
- "DNS query failed with status: NXDOMAIN
93
-
94
- Version: ${getVersion()}"
95
- `)
96
- })
97
- it('returns error if AD is false', async () => {
98
- handler.mockImplementation((_req, res) => {
99
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
100
- res.end(
101
- JSON.stringify({
102
- Status: 0,
103
- AD: false,
104
- }),
105
- )
106
- res.destroy()
107
- })
108
-
109
- await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
110
- .rejects.toThrowErrorMatchingInlineSnapshot(`
111
- "DNSSEC verification failed
112
-
113
- Version: ${getVersion()}"
114
- `)
115
- })
116
- it('returns error if no TXT record', async () => {
117
- handler.mockImplementation((_req, res) => {
118
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
119
- res.end(
120
- JSON.stringify({
121
- Status: 0,
122
- AD: true,
123
- Answer: [],
124
- }),
125
- )
126
- res.destroy()
127
- })
128
-
129
- await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
130
- .rejects.toThrowErrorMatchingInlineSnapshot(`
131
- "No TXT record found
132
-
133
- Version: ${getVersion()}"
134
- `)
135
- })
136
- it('returns error if TXT record is not formatted correctly', async () => {
137
- handler.mockImplementation((_req, res) => {
138
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
139
- res.end(
140
- JSON.stringify({
141
- Status: 0,
142
- AD: true,
143
- Answer: [
144
- {
145
- name: '_ens.example.com',
146
- type: 16,
147
- TTL: 0,
148
- data: '"0x8e8Db5CcEF88cca9d624701Db544989C996E3216"',
149
- },
150
- ],
151
- }),
152
- )
153
- res.destroy()
154
- })
155
-
156
- await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
157
- .rejects.toThrowErrorMatchingInlineSnapshot(`
158
- "Invalid TXT record: 0x8e8Db5CcEF88cca9d624701Db544989C996E3216
159
-
160
- Version: ${getVersion()}"
161
- `)
162
- })
163
- it('returns error if address is not checksummed', async () => {
164
- handler.mockImplementation((_req, res) => {
165
- res.writeHead(200, { 'Content-Type': 'application/dns-json' })
166
- res.end(
167
- JSON.stringify({
168
- Status: 0,
169
- AD: true,
170
- Answer: [
171
- {
172
- name: '_ens.example.com',
173
- type: 16,
174
- TTL: 0,
175
- data: '"a=0x8e8db5CcEF88cca9d624701Db544989C996E3216"',
176
- },
177
- ],
178
- }),
179
- )
180
- res.destroy()
181
- })
182
-
183
- await expect(getDnsOwner({ name: 'example.com', endpoint: serverUrl }))
184
- .rejects.toThrowErrorMatchingInlineSnapshot(`
185
- "Invalid address checksum: 0x8e8db5CcEF88cca9d624701Db544989C996E3216
186
-
187
- Version: ${getVersion()}"
188
- `)
189
- })
190
- it('real test', async () => {
191
- const result = await getDnsOwner({
192
- name: 'taytems.xyz',
193
- })
194
- expect(result).toEqual('0x8e8Db5CcEF88cca9d624701Db544989C996E3216')
195
- })
@@ -1,117 +0,0 @@
1
- import { parseEther, type Address, type Hex } from 'viem'
2
- import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
3
- import { getVersion } from '../../errors/error-utils.js'
4
- import {
5
- publicClient,
6
- testClient,
7
- waitForTransaction,
8
- walletClient,
9
- } from '../../tests/addTestContracts.js'
10
- import getOwner from '../public/getOwner.js'
11
- import getResolver from '../public/getResolver.js'
12
- import importDnsName from './importDnsName.js'
13
- import prepareDnsImport from './prepareDnsImport.js'
14
-
15
- const name = 'taytems.xyz'
16
- const address = '0x8e8Db5CcEF88cca9d624701Db544989C996E3216'
17
-
18
- let snapshot: Hex
19
- let accounts: Address[]
20
-
21
- beforeAll(async () => {
22
- accounts = await walletClient.getAddresses()
23
- })
24
-
25
- beforeEach(async () => {
26
- snapshot = await testClient.snapshot()
27
- })
28
-
29
- afterEach(async () => {
30
- await testClient.revert({ id: snapshot })
31
- })
32
-
33
- it('should import a DNS name with no address', async () => {
34
- const tx = await importDnsName(walletClient, {
35
- name,
36
- preparedData: await prepareDnsImport(publicClient, { name }),
37
- account: accounts[0],
38
- })
39
- expect(tx).toBeTruthy()
40
- const receipt = await waitForTransaction(tx)
41
- expect(receipt.status).toBe('success')
42
-
43
- const owner = await getOwner(publicClient, { name })
44
- expect(owner!.owner).toBe(address)
45
- })
46
- it('should import a DNS name with an address, using default resolver', async () => {
47
- await testClient.impersonateAccount({ address })
48
- await testClient.setBalance({
49
- address,
50
- value: parseEther('1'),
51
- })
52
-
53
- const tx = await importDnsName(walletClient, {
54
- name,
55
- address,
56
- preparedData: await prepareDnsImport(publicClient, { name }),
57
- account: address,
58
- })
59
- expect(tx).toBeTruthy()
60
- const receipt = await waitForTransaction(tx)
61
- expect(receipt.status).toBe('success')
62
-
63
- const owner = await getOwner(publicClient, { name })
64
- expect(owner!.owner).toBe(address)
65
- const resolver = await getResolver(publicClient, { name })
66
- expect(resolver).toBe(
67
- getChainContractAddress({
68
- client: publicClient,
69
- contract: 'ensPublicResolver',
70
- }),
71
- )
72
- })
73
- it('should import a DNS name with an address, using a custom resolver', async () => {
74
- await testClient.impersonateAccount({ address })
75
- await testClient.setBalance({
76
- address,
77
- value: parseEther('1'),
78
- })
79
-
80
- const legacyResolverAddress = JSON.parse(
81
- process.env.DEPLOYMENT_ADDRESSES!,
82
- ).LegacyPublicResolver
83
-
84
- const tx = await importDnsName(walletClient, {
85
- name,
86
- address,
87
- preparedData: await prepareDnsImport(publicClient, { name }),
88
- account: address,
89
- resolverAddress: legacyResolverAddress,
90
- })
91
- expect(tx).toBeTruthy()
92
- const receipt = await waitForTransaction(tx)
93
- expect(receipt.status).toBe('success')
94
-
95
- const owner = await getOwner(publicClient, { name })
96
- expect(owner!.owner).toBe(address)
97
- const resolver = await getResolver(publicClient, { name })
98
- expect(resolver).toBe(legacyResolverAddress)
99
- })
100
- it('should throw error if resolver is specified when claiming without an address', async () => {
101
- await expect(
102
- importDnsName(walletClient, {
103
- name,
104
- resolverAddress: address,
105
- preparedData: await prepareDnsImport(publicClient, { name }),
106
- account: accounts[0],
107
- } as any),
108
- ).rejects.toThrowErrorMatchingInlineSnapshot(`
109
- "Additional parameter specified: resolverAddress
110
-
111
- - Allowed parameters: name, preparedData
112
-
113
- Details: resolverAddress cannot be specified when claiming without an address
114
-
115
- Version: ${getVersion()}"
116
- `)
117
- })