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

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 (518) hide show
  1. package/dist/cjs/clients/decorators/subgraph.js.map +1 -1
  2. package/dist/cjs/clients/decorators/wallet.js +2 -0
  3. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  4. package/dist/cjs/clients/public.js.map +1 -1
  5. package/dist/cjs/clients/subgraph.js.map +1 -1
  6. package/dist/cjs/contracts/consts.js +53 -2
  7. package/dist/cjs/contracts/consts.js.map +1 -1
  8. package/dist/cjs/dns.js +3 -3
  9. package/dist/cjs/dns.js.map +1 -1
  10. package/dist/cjs/errors/subgraph.js.map +1 -1
  11. package/dist/cjs/errors/utils.js +27 -18
  12. package/dist/cjs/errors/utils.js.map +1 -1
  13. package/dist/cjs/errors/version.js +1 -1
  14. package/dist/cjs/errors/version.js.map +1 -1
  15. package/dist/cjs/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +3 -3
  16. package/dist/cjs/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
  17. package/dist/cjs/functions/dns/importDnsName.js +7 -7
  18. package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
  19. package/dist/cjs/functions/public/_getAbi.js +2 -2
  20. package/dist/cjs/functions/public/_getAbi.js.map +1 -1
  21. package/dist/cjs/functions/public/_getAddr.js +9 -19
  22. package/dist/cjs/functions/public/_getAddr.js.map +1 -1
  23. package/dist/cjs/functions/public/_getContentHash.js +1 -1
  24. package/dist/cjs/functions/public/batch.js.map +1 -1
  25. package/dist/cjs/functions/public/getAbiRecord.js.map +1 -1
  26. package/dist/cjs/functions/public/getAddressRecord.js.map +1 -1
  27. package/dist/cjs/functions/public/getAvailable.js.map +1 -1
  28. package/dist/cjs/functions/public/getContentHashRecord.js.map +1 -1
  29. package/dist/cjs/functions/public/getExpiry.js.map +1 -1
  30. package/dist/cjs/functions/public/getName.js.map +1 -1
  31. package/dist/cjs/functions/public/getOwner.js.map +1 -1
  32. package/dist/cjs/functions/public/getPrice.js.map +1 -1
  33. package/dist/cjs/functions/public/getRecords.js +51 -37
  34. package/dist/cjs/functions/public/getRecords.js.map +1 -1
  35. package/dist/cjs/functions/public/getResolver.js.map +1 -1
  36. package/dist/cjs/functions/public/getSupportedInterfaces.js +1 -1
  37. package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
  38. package/dist/cjs/functions/public/getTextRecord.js.map +1 -1
  39. package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
  40. package/dist/cjs/functions/public/getWrapperName.js.map +1 -1
  41. package/dist/cjs/functions/public/multicallWrapper.js.map +1 -1
  42. package/dist/cjs/functions/public/universalWrapper.js.map +1 -1
  43. package/dist/cjs/functions/subgraph/client.js.map +1 -1
  44. package/dist/cjs/functions/subgraph/filters.js +3 -0
  45. package/dist/cjs/functions/subgraph/filters.js.map +1 -0
  46. package/dist/cjs/functions/subgraph/getDecodedName.js.map +1 -1
  47. package/dist/cjs/functions/subgraph/getNameHistory.js +4 -3
  48. package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
  49. package/dist/cjs/functions/subgraph/getNamesForAddress.js +155 -190
  50. package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
  51. package/dist/cjs/functions/subgraph/getSubgraphRecords.js +34 -26
  52. package/dist/cjs/functions/subgraph/getSubgraphRecords.js.map +1 -1
  53. package/dist/cjs/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  54. package/dist/cjs/functions/subgraph/getSubnames.js +95 -108
  55. package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
  56. package/dist/cjs/functions/subgraph/types.js +3 -0
  57. package/dist/cjs/functions/subgraph/types.js.map +1 -0
  58. package/dist/cjs/functions/subgraph/utils.js.map +1 -1
  59. package/dist/cjs/functions/wallet/clearRecords.js +26 -0
  60. package/dist/cjs/functions/wallet/clearRecords.js.map +1 -0
  61. package/dist/cjs/functions/wallet/commitName.js.map +1 -1
  62. package/dist/cjs/functions/wallet/createSubname.js +1 -1
  63. package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
  64. package/dist/cjs/functions/wallet/deleteSubname.js.map +1 -1
  65. package/dist/cjs/functions/wallet/registerName.js.map +1 -1
  66. package/dist/cjs/functions/wallet/renewNames.js.map +1 -1
  67. package/dist/cjs/functions/wallet/setAbiRecord.js.map +1 -1
  68. package/dist/cjs/functions/wallet/setAddressRecord.js.map +1 -1
  69. package/dist/cjs/functions/wallet/setChildFuses.js +1 -1
  70. package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
  71. package/dist/cjs/functions/wallet/setContentHashRecord.js.map +1 -1
  72. package/dist/cjs/functions/wallet/setFuses.js +1 -1
  73. package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
  74. package/dist/cjs/functions/wallet/setPrimaryName.js.map +1 -1
  75. package/dist/cjs/functions/wallet/setRecords.js.map +1 -1
  76. package/dist/cjs/functions/wallet/setResolver.js.map +1 -1
  77. package/dist/cjs/functions/wallet/setTextRecord.js.map +1 -1
  78. package/dist/cjs/functions/wallet/transferName.js.map +1 -1
  79. package/dist/cjs/functions/wallet/unwrapName.js.map +1 -1
  80. package/dist/cjs/functions/wallet/wrapName.js +3 -1
  81. package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
  82. package/dist/cjs/index.js +1 -2
  83. package/dist/cjs/index.js.map +1 -1
  84. package/dist/cjs/subgraph.js +4 -1
  85. package/dist/cjs/subgraph.js.map +1 -1
  86. package/dist/cjs/utils/contentHash.js +60 -131
  87. package/dist/cjs/utils/contentHash.js.map +1 -1
  88. package/dist/cjs/utils/encoders/encodeAbi.js +33 -3
  89. package/dist/cjs/utils/encoders/encodeAbi.js.map +1 -1
  90. package/dist/cjs/utils/encoders/encodeClearRecords.js +12 -0
  91. package/dist/cjs/utils/encoders/encodeClearRecords.js.map +1 -0
  92. package/dist/cjs/utils/encoders/encodeSetAddr.js +5 -16
  93. package/dist/cjs/utils/encoders/encodeSetAddr.js.map +1 -1
  94. package/dist/cjs/utils/encoders/encodeSetContentHash.js +1 -4
  95. package/dist/cjs/utils/encoders/encodeSetContentHash.js.map +1 -1
  96. package/dist/cjs/utils/format.js +1 -5
  97. package/dist/cjs/utils/format.js.map +1 -1
  98. package/dist/cjs/utils/fuses.js +184 -200
  99. package/dist/cjs/utils/fuses.js.map +1 -1
  100. package/dist/cjs/utils/generateRecordCallArray.js +2 -7
  101. package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
  102. package/dist/cjs/utils/index.js +31 -7
  103. package/dist/cjs/utils/index.js.map +1 -1
  104. package/dist/cjs/utils/normaliseCoinId.js +35 -0
  105. package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
  106. package/dist/cjs/utils/registerHelpers.js +3 -1
  107. package/dist/cjs/utils/registerHelpers.js.map +1 -1
  108. package/dist/cjs/wallet.js +3 -1
  109. package/dist/cjs/wallet.js.map +1 -1
  110. package/dist/esm/clients/decorators/subgraph.js.map +1 -1
  111. package/dist/esm/clients/decorators/wallet.js +2 -0
  112. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  113. package/dist/esm/clients/public.js.map +1 -1
  114. package/dist/esm/clients/subgraph.js.map +1 -1
  115. package/dist/esm/contracts/consts.js +53 -2
  116. package/dist/esm/contracts/consts.js.map +1 -1
  117. package/dist/esm/dns.js +1 -1
  118. package/dist/esm/dns.js.map +1 -1
  119. package/dist/esm/errors/subgraph.js.map +1 -1
  120. package/dist/esm/errors/utils.js +24 -16
  121. package/dist/esm/errors/utils.js.map +1 -1
  122. package/dist/esm/errors/version.js +1 -1
  123. package/dist/esm/errors/version.js.map +1 -1
  124. package/dist/esm/functions/dns/{prepareDnsImport.js → getDnsImportData.js} +10 -10
  125. package/dist/esm/functions/dns/{prepareDnsImport.js.map → getDnsImportData.js.map} +1 -1
  126. package/dist/esm/functions/dns/getDnsOwner.js +1 -1
  127. package/dist/esm/functions/dns/importDnsName.js +13 -12
  128. package/dist/esm/functions/dns/importDnsName.js.map +1 -1
  129. package/dist/esm/functions/public/_getAbi.js +2 -2
  130. package/dist/esm/functions/public/_getAbi.js.map +1 -1
  131. package/dist/esm/functions/public/_getAddr.js +10 -20
  132. package/dist/esm/functions/public/_getAddr.js.map +1 -1
  133. package/dist/esm/functions/public/_getContentHash.js +2 -2
  134. package/dist/esm/functions/public/batch.js +2 -1
  135. package/dist/esm/functions/public/batch.js.map +1 -1
  136. package/dist/esm/functions/public/getAbiRecord.js +2 -1
  137. package/dist/esm/functions/public/getAbiRecord.js.map +1 -1
  138. package/dist/esm/functions/public/getAddressRecord.js +2 -1
  139. package/dist/esm/functions/public/getAddressRecord.js.map +1 -1
  140. package/dist/esm/functions/public/getAvailable.js +2 -1
  141. package/dist/esm/functions/public/getAvailable.js.map +1 -1
  142. package/dist/esm/functions/public/getContentHashRecord.js +2 -1
  143. package/dist/esm/functions/public/getContentHashRecord.js.map +1 -1
  144. package/dist/esm/functions/public/getExpiry.js +2 -1
  145. package/dist/esm/functions/public/getExpiry.js.map +1 -1
  146. package/dist/esm/functions/public/getName.js +2 -1
  147. package/dist/esm/functions/public/getName.js.map +1 -1
  148. package/dist/esm/functions/public/getOwner.js +3 -2
  149. package/dist/esm/functions/public/getOwner.js.map +1 -1
  150. package/dist/esm/functions/public/getPrice.js +3 -2
  151. package/dist/esm/functions/public/getPrice.js.map +1 -1
  152. package/dist/esm/functions/public/getRecords.js +54 -39
  153. package/dist/esm/functions/public/getRecords.js.map +1 -1
  154. package/dist/esm/functions/public/getResolver.js +2 -1
  155. package/dist/esm/functions/public/getResolver.js.map +1 -1
  156. package/dist/esm/functions/public/getSupportedInterfaces.js +24 -2
  157. package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
  158. package/dist/esm/functions/public/getTextRecord.js +2 -1
  159. package/dist/esm/functions/public/getTextRecord.js.map +1 -1
  160. package/dist/esm/functions/public/getWrapperData.js +2 -1
  161. package/dist/esm/functions/public/getWrapperData.js.map +1 -1
  162. package/dist/esm/functions/public/getWrapperName.js +2 -1
  163. package/dist/esm/functions/public/getWrapperName.js.map +1 -1
  164. package/dist/esm/functions/public/multicallWrapper.js.map +1 -1
  165. package/dist/esm/functions/public/universalWrapper.js.map +1 -1
  166. package/dist/esm/functions/subgraph/client.js.map +1 -1
  167. package/dist/esm/functions/subgraph/filters.js +2 -0
  168. package/dist/esm/functions/subgraph/filters.js.map +1 -0
  169. package/dist/esm/functions/subgraph/getDecodedName.js +2 -1
  170. package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
  171. package/dist/esm/functions/subgraph/getNameHistory.js +8 -6
  172. package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
  173. package/dist/esm/functions/subgraph/getNamesForAddress.js +163 -192
  174. package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
  175. package/dist/esm/functions/subgraph/getSubgraphRecords.js +36 -27
  176. package/dist/esm/functions/subgraph/getSubgraphRecords.js.map +1 -1
  177. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js +2 -1
  178. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  179. package/dist/esm/functions/subgraph/getSubnames.js +103 -112
  180. package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
  181. package/dist/esm/functions/subgraph/types.js +2 -0
  182. package/dist/esm/functions/subgraph/types.js.map +1 -0
  183. package/dist/esm/functions/subgraph/utils.js.map +1 -1
  184. package/dist/esm/functions/wallet/clearRecords.js +44 -0
  185. package/dist/esm/functions/wallet/clearRecords.js.map +1 -0
  186. package/dist/esm/functions/wallet/commitName.js +3 -1
  187. package/dist/esm/functions/wallet/commitName.js.map +1 -1
  188. package/dist/esm/functions/wallet/createSubname.js +3 -2
  189. package/dist/esm/functions/wallet/createSubname.js.map +1 -1
  190. package/dist/esm/functions/wallet/deleteSubname.js +2 -1
  191. package/dist/esm/functions/wallet/deleteSubname.js.map +1 -1
  192. package/dist/esm/functions/wallet/registerName.js +4 -1
  193. package/dist/esm/functions/wallet/registerName.js.map +1 -1
  194. package/dist/esm/functions/wallet/renewNames.js +3 -1
  195. package/dist/esm/functions/wallet/renewNames.js.map +1 -1
  196. package/dist/esm/functions/wallet/setAbiRecord.js +3 -1
  197. package/dist/esm/functions/wallet/setAbiRecord.js.map +1 -1
  198. package/dist/esm/functions/wallet/setAddressRecord.js +2 -1
  199. package/dist/esm/functions/wallet/setAddressRecord.js.map +1 -1
  200. package/dist/esm/functions/wallet/setChildFuses.js +3 -2
  201. package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
  202. package/dist/esm/functions/wallet/setContentHashRecord.js +2 -1
  203. package/dist/esm/functions/wallet/setContentHashRecord.js.map +1 -1
  204. package/dist/esm/functions/wallet/setFuses.js +4 -3
  205. package/dist/esm/functions/wallet/setFuses.js.map +1 -1
  206. package/dist/esm/functions/wallet/setPrimaryName.js +2 -1
  207. package/dist/esm/functions/wallet/setPrimaryName.js.map +1 -1
  208. package/dist/esm/functions/wallet/setRecords.js +2 -1
  209. package/dist/esm/functions/wallet/setRecords.js.map +1 -1
  210. package/dist/esm/functions/wallet/setResolver.js +2 -1
  211. package/dist/esm/functions/wallet/setResolver.js.map +1 -1
  212. package/dist/esm/functions/wallet/setTextRecord.js +2 -1
  213. package/dist/esm/functions/wallet/setTextRecord.js.map +1 -1
  214. package/dist/esm/functions/wallet/transferName.js +2 -1
  215. package/dist/esm/functions/wallet/transferName.js.map +1 -1
  216. package/dist/esm/functions/wallet/unwrapName.js +2 -1
  217. package/dist/esm/functions/wallet/unwrapName.js.map +1 -1
  218. package/dist/esm/functions/wallet/wrapName.js +6 -3
  219. package/dist/esm/functions/wallet/wrapName.js.map +1 -1
  220. package/dist/esm/index.js +1 -1
  221. package/dist/esm/index.js.map +1 -1
  222. package/dist/esm/subgraph.js +1 -0
  223. package/dist/esm/subgraph.js.map +1 -1
  224. package/dist/esm/utils/contentHash.js +56 -128
  225. package/dist/esm/utils/contentHash.js.map +1 -1
  226. package/dist/esm/utils/encoders/encodeAbi.js +30 -2
  227. package/dist/esm/utils/encoders/encodeAbi.js.map +1 -1
  228. package/dist/esm/utils/encoders/encodeClearRecords.js +8 -0
  229. package/dist/esm/utils/encoders/encodeClearRecords.js.map +1 -0
  230. package/dist/esm/utils/encoders/encodeSetAddr.js +5 -16
  231. package/dist/esm/utils/encoders/encodeSetAddr.js.map +1 -1
  232. package/dist/esm/utils/encoders/encodeSetContentHash.js +2 -5
  233. package/dist/esm/utils/encoders/encodeSetContentHash.js.map +1 -1
  234. package/dist/esm/utils/format.js +0 -2
  235. package/dist/esm/utils/format.js.map +1 -1
  236. package/dist/esm/utils/fuses.js +183 -201
  237. package/dist/esm/utils/fuses.js.map +1 -1
  238. package/dist/esm/utils/generateRecordCallArray.js +3 -7
  239. package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
  240. package/dist/esm/utils/index.js +5 -3
  241. package/dist/esm/utils/index.js.map +1 -1
  242. package/dist/esm/utils/normaliseCoinId.js +30 -0
  243. package/dist/esm/utils/normaliseCoinId.js.map +1 -0
  244. package/dist/esm/utils/registerHelpers.js +4 -2
  245. package/dist/esm/utils/registerHelpers.js.map +1 -1
  246. package/dist/esm/wallet.js +1 -0
  247. package/dist/esm/wallet.js.map +1 -1
  248. package/dist/types/clients/decorators/public.d.ts +1 -519
  249. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  250. package/dist/types/clients/decorators/subgraph.d.ts +2 -520
  251. package/dist/types/clients/decorators/subgraph.d.ts.map +1 -1
  252. package/dist/types/clients/decorators/wallet.d.ts +66 -47
  253. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  254. package/dist/types/clients/public.d.ts +24 -265
  255. package/dist/types/clients/public.d.ts.map +1 -1
  256. package/dist/types/clients/subgraph.d.ts +19 -260
  257. package/dist/types/clients/subgraph.d.ts.map +1 -1
  258. package/dist/types/clients/wallet.d.ts +54 -86
  259. package/dist/types/clients/wallet.d.ts.map +1 -1
  260. package/dist/types/contracts/consts.d.ts +52 -3
  261. package/dist/types/contracts/consts.d.ts.map +1 -1
  262. package/dist/types/dns.d.ts +2 -2
  263. package/dist/types/dns.d.ts.map +1 -1
  264. package/dist/types/errors/subgraph.d.ts +4 -4
  265. package/dist/types/errors/subgraph.d.ts.map +1 -1
  266. package/dist/types/errors/utils.d.ts +16 -13
  267. package/dist/types/errors/utils.d.ts.map +1 -1
  268. package/dist/types/errors/version.d.ts +1 -1
  269. package/dist/types/errors/version.d.ts.map +1 -1
  270. package/dist/types/functions/dns/getDnsImportData.d.ts +39 -0
  271. package/dist/types/functions/dns/{prepareDnsImport.d.ts.map → getDnsImportData.d.ts.map} +1 -1
  272. package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
  273. package/dist/types/functions/dns/importDnsName.d.ts +88 -102
  274. package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
  275. package/dist/types/functions/public/_getAddr.d.ts.map +1 -1
  276. package/dist/types/functions/public/batch.d.ts +2 -1
  277. package/dist/types/functions/public/batch.d.ts.map +1 -1
  278. package/dist/types/functions/public/getAbiRecord.d.ts +2 -1
  279. package/dist/types/functions/public/getAbiRecord.d.ts.map +1 -1
  280. package/dist/types/functions/public/getAddressRecord.d.ts +2 -1
  281. package/dist/types/functions/public/getAddressRecord.d.ts.map +1 -1
  282. package/dist/types/functions/public/getAvailable.d.ts +2 -1
  283. package/dist/types/functions/public/getAvailable.d.ts.map +1 -1
  284. package/dist/types/functions/public/getContentHashRecord.d.ts +2 -1
  285. package/dist/types/functions/public/getContentHashRecord.d.ts.map +1 -1
  286. package/dist/types/functions/public/getExpiry.d.ts +2 -1
  287. package/dist/types/functions/public/getExpiry.d.ts.map +1 -1
  288. package/dist/types/functions/public/getName.d.ts +2 -1
  289. package/dist/types/functions/public/getName.d.ts.map +1 -1
  290. package/dist/types/functions/public/getOwner.d.ts +19 -9
  291. package/dist/types/functions/public/getOwner.d.ts.map +1 -1
  292. package/dist/types/functions/public/getPrice.d.ts +3 -2
  293. package/dist/types/functions/public/getPrice.d.ts.map +1 -1
  294. package/dist/types/functions/public/getRecords.d.ts +3 -2
  295. package/dist/types/functions/public/getRecords.d.ts.map +1 -1
  296. package/dist/types/functions/public/getResolver.d.ts +2 -1
  297. package/dist/types/functions/public/getResolver.d.ts.map +1 -1
  298. package/dist/types/functions/public/getSupportedInterfaces.d.ts +41 -4
  299. package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
  300. package/dist/types/functions/public/getTextRecord.d.ts +2 -1
  301. package/dist/types/functions/public/getTextRecord.d.ts.map +1 -1
  302. package/dist/types/functions/public/getWrapperData.d.ts +4 -3
  303. package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
  304. package/dist/types/functions/public/getWrapperName.d.ts +2 -1
  305. package/dist/types/functions/public/getWrapperName.d.ts.map +1 -1
  306. package/dist/types/functions/subgraph/client.d.ts +2 -2
  307. package/dist/types/functions/subgraph/client.d.ts.map +1 -1
  308. package/dist/types/functions/subgraph/filters.d.ts +693 -0
  309. package/dist/types/functions/subgraph/filters.d.ts.map +1 -0
  310. package/dist/types/functions/subgraph/getDecodedName.d.ts +2 -1
  311. package/dist/types/functions/subgraph/getDecodedName.d.ts.map +1 -1
  312. package/dist/types/functions/subgraph/getNameHistory.d.ts +2 -1
  313. package/dist/types/functions/subgraph/getNameHistory.d.ts.map +1 -1
  314. package/dist/types/functions/subgraph/getNamesForAddress.d.ts +7 -2
  315. package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
  316. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts +2 -1
  317. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts.map +1 -1
  318. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts +2 -1
  319. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts.map +1 -1
  320. package/dist/types/functions/subgraph/getSubnames.d.ts +5 -2
  321. package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
  322. package/dist/types/functions/subgraph/types.d.ts +13 -0
  323. package/dist/types/functions/subgraph/types.d.ts.map +1 -0
  324. package/dist/types/functions/subgraph/utils.d.ts +2 -2
  325. package/dist/types/functions/subgraph/utils.d.ts.map +1 -1
  326. package/dist/types/functions/wallet/clearRecords.d.ts +555 -0
  327. package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
  328. package/dist/types/functions/wallet/commitName.d.ts +80 -93
  329. package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
  330. package/dist/types/functions/wallet/createSubname.d.ts +82 -96
  331. package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
  332. package/dist/types/functions/wallet/deleteSubname.d.ts +79 -93
  333. package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
  334. package/dist/types/functions/wallet/registerName.d.ts +80 -89
  335. package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
  336. package/dist/types/functions/wallet/renewNames.d.ts +79 -89
  337. package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
  338. package/dist/types/functions/wallet/setAbiRecord.d.ts +80 -93
  339. package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
  340. package/dist/types/functions/wallet/setAddressRecord.d.ts +79 -93
  341. package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
  342. package/dist/types/functions/wallet/setChildFuses.d.ts +81 -95
  343. package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
  344. package/dist/types/functions/wallet/setContentHashRecord.d.ts +79 -93
  345. package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
  346. package/dist/types/functions/wallet/setFuses.d.ts +81 -95
  347. package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
  348. package/dist/types/functions/wallet/setPrimaryName.d.ts +79 -93
  349. package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
  350. package/dist/types/functions/wallet/setRecords.d.ts +79 -93
  351. package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
  352. package/dist/types/functions/wallet/setResolver.d.ts +79 -93
  353. package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
  354. package/dist/types/functions/wallet/setTextRecord.d.ts +79 -93
  355. package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
  356. package/dist/types/functions/wallet/transferName.d.ts +80 -94
  357. package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
  358. package/dist/types/functions/wallet/unwrapName.d.ts +79 -93
  359. package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
  360. package/dist/types/functions/wallet/wrapName.d.ts +81 -95
  361. package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
  362. package/dist/types/index.d.ts +1 -1
  363. package/dist/types/index.d.ts.map +1 -1
  364. package/dist/types/subgraph.d.ts +1 -0
  365. package/dist/types/subgraph.d.ts.map +1 -1
  366. package/dist/types/types.d.ts +3 -1
  367. package/dist/types/types.d.ts.map +1 -1
  368. package/dist/types/utils/contentHash.d.ts +10 -11
  369. package/dist/types/utils/contentHash.d.ts.map +1 -1
  370. package/dist/types/utils/encoders/encodeAbi.d.ts +8 -5
  371. package/dist/types/utils/encoders/encodeAbi.d.ts.map +1 -1
  372. package/dist/types/utils/encoders/encodeClearRecords.d.ts +3 -0
  373. package/dist/types/utils/encoders/encodeClearRecords.d.ts.map +1 -0
  374. package/dist/types/utils/encoders/encodeSetAddr.d.ts.map +1 -1
  375. package/dist/types/utils/encoders/encodeSetContentHash.d.ts.map +1 -1
  376. package/dist/types/utils/format.d.ts +0 -2
  377. package/dist/types/utils/format.d.ts.map +1 -1
  378. package/dist/types/utils/fuses.d.ts +164 -125
  379. package/dist/types/utils/fuses.d.ts.map +1 -1
  380. package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
  381. package/dist/types/utils/index.d.ts +5 -3
  382. package/dist/types/utils/index.d.ts.map +1 -1
  383. package/dist/types/utils/normaliseCoinId.d.ts +10 -0
  384. package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
  385. package/dist/types/utils/registerHelpers.d.ts +2 -2
  386. package/dist/types/utils/registerHelpers.d.ts.map +1 -1
  387. package/dist/types/wallet.d.ts +18 -17
  388. package/dist/types/wallet.d.ts.map +1 -1
  389. package/package.json +8 -8
  390. package/src/clients/decorators/subgraph.ts +1 -0
  391. package/src/clients/decorators/wallet.ts +41 -3
  392. package/src/clients/public.ts +3 -2
  393. package/src/clients/subgraph.ts +3 -2
  394. package/src/clients/wallet.ts +1 -1
  395. package/src/contracts/consts.ts +58 -13
  396. package/src/dns.ts +7 -5
  397. package/src/errors/subgraph.ts +4 -4
  398. package/src/errors/utils.ts +29 -18
  399. package/src/errors/version.ts +1 -1
  400. package/src/functions/dns/{prepareDnsImport.ts → getDnsImportData.ts} +13 -13
  401. package/src/functions/dns/getDnsOwner.ts +1 -1
  402. package/src/functions/dns/importDnsName.ts +21 -15
  403. package/src/functions/public/_getAbi.ts +2 -2
  404. package/src/functions/public/_getAddr.ts +16 -23
  405. package/src/functions/public/_getContentHash.ts +2 -2
  406. package/src/functions/public/batch.ts +2 -1
  407. package/src/functions/public/getAbiRecord.ts +2 -1
  408. package/src/functions/public/getAddressRecord.ts +2 -1
  409. package/src/functions/public/getAvailable.ts +2 -1
  410. package/src/functions/public/getContentHashRecord.ts +2 -1
  411. package/src/functions/public/getExpiry.ts +2 -1
  412. package/src/functions/public/getName.ts +3 -2
  413. package/src/functions/public/getOwner.ts +54 -33
  414. package/src/functions/public/getPrice.ts +3 -2
  415. package/src/functions/public/getRecords.ts +125 -105
  416. package/src/functions/public/getResolver.ts +3 -2
  417. package/src/functions/public/getSupportedInterfaces.ts +70 -10
  418. package/src/functions/public/getTextRecord.ts +2 -1
  419. package/src/functions/public/getWrapperData.ts +5 -4
  420. package/src/functions/public/getWrapperName.ts +3 -2
  421. package/src/functions/public/multicallWrapper.ts +1 -1
  422. package/src/functions/public/universalWrapper.ts +1 -1
  423. package/src/functions/subgraph/client.ts +2 -2
  424. package/src/functions/subgraph/filters.ts +702 -0
  425. package/src/functions/subgraph/getDecodedName.ts +2 -1
  426. package/src/functions/subgraph/getNameHistory.ts +8 -6
  427. package/src/functions/subgraph/getNamesForAddress.ts +199 -195
  428. package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
  429. package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
  430. package/src/functions/subgraph/getSubnames.ts +123 -114
  431. package/src/functions/subgraph/types.ts +13 -0
  432. package/src/functions/subgraph/utils.ts +2 -2
  433. package/src/functions/wallet/clearRecords.ts +97 -0
  434. package/src/functions/wallet/commitName.ts +3 -1
  435. package/src/functions/wallet/createSubname.ts +6 -5
  436. package/src/functions/wallet/deleteSubname.ts +2 -1
  437. package/src/functions/wallet/registerName.ts +4 -1
  438. package/src/functions/wallet/renewNames.ts +3 -1
  439. package/src/functions/wallet/setAbiRecord.ts +3 -1
  440. package/src/functions/wallet/setAddressRecord.ts +2 -1
  441. package/src/functions/wallet/setChildFuses.ts +5 -4
  442. package/src/functions/wallet/setContentHashRecord.ts +2 -1
  443. package/src/functions/wallet/setFuses.ts +8 -4
  444. package/src/functions/wallet/setPrimaryName.ts +2 -1
  445. package/src/functions/wallet/setRecords.ts +2 -1
  446. package/src/functions/wallet/setResolver.ts +2 -1
  447. package/src/functions/wallet/setTextRecord.ts +2 -1
  448. package/src/functions/wallet/transferName.ts +3 -2
  449. package/src/functions/wallet/unwrapName.ts +2 -1
  450. package/src/functions/wallet/wrapName.ts +10 -4
  451. package/src/index.ts +0 -1
  452. package/src/subgraph.ts +5 -0
  453. package/src/types.ts +6 -3
  454. package/src/utils/contentHash.ts +65 -113
  455. package/src/utils/encoders/encodeAbi.ts +37 -8
  456. package/src/utils/encoders/encodeClearRecords.ts +9 -0
  457. package/src/utils/encoders/encodeSetAddr.ts +5 -16
  458. package/src/utils/encoders/encodeSetContentHash.ts +2 -4
  459. package/src/utils/format.ts +0 -6
  460. package/src/utils/fuses.ts +312 -308
  461. package/src/utils/generateRecordCallArray.ts +3 -9
  462. package/src/utils/index.ts +37 -5
  463. package/src/utils/normaliseCoinId.ts +36 -0
  464. package/src/utils/registerHelpers.ts +5 -3
  465. package/src/wallet.ts +41 -0
  466. package/dist/types/functions/dns/prepareDnsImport.d.ts +0 -39
  467. package/src/@types/@ensdomains/content-hash.d.ts +0 -1
  468. package/src/functions/dns/getDnsOwner.test.ts +0 -195
  469. package/src/functions/dns/importDnsName.test.ts +0 -117
  470. package/src/functions/dns/prepareDnsImport.test.ts +0 -115
  471. package/src/functions/public/batch.test.ts +0 -67
  472. package/src/functions/public/ccip.test.ts +0 -78
  473. package/src/functions/public/getAbiRecord.test.ts +0 -174
  474. package/src/functions/public/getAddressRecord.test.ts +0 -83
  475. package/src/functions/public/getAvailable.test.ts +0 -17
  476. package/src/functions/public/getContentHashRecord.test.ts +0 -28
  477. package/src/functions/public/getExpiry.test.ts +0 -48
  478. package/src/functions/public/getName.test.ts +0 -66
  479. package/src/functions/public/getOwner.test.ts +0 -87
  480. package/src/functions/public/getPrice.test.ts +0 -45
  481. package/src/functions/public/getRecords.test.ts +0 -49
  482. package/src/functions/public/getResolver.test.ts +0 -12
  483. package/src/functions/public/getTextRecord.test.ts +0 -20
  484. package/src/functions/public/getWrapperData.test.ts +0 -79
  485. package/src/functions/public/getWrapperName.test.ts +0 -19
  486. package/src/functions/subgraph/client.test.ts +0 -170
  487. package/src/functions/subgraph/getDecodedName.test.ts +0 -31
  488. package/src/functions/subgraph/getNameHistory.test.ts +0 -39
  489. package/src/functions/subgraph/getNamesForAddress.test.ts +0 -244
  490. package/src/functions/subgraph/getSubgraphRecords.test.ts +0 -74
  491. package/src/functions/subgraph/getSubgraphRegistrant.test.ts +0 -34
  492. package/src/functions/subgraph/getSubnames.test.ts +0 -202
  493. package/src/functions/wallet/commitName.test.ts +0 -58
  494. package/src/functions/wallet/createSubname.test.ts +0 -73
  495. package/src/functions/wallet/deleteSubname.test.ts +0 -150
  496. package/src/functions/wallet/registerName.test.ts +0 -81
  497. package/src/functions/wallet/renewNames.test.ts +0 -92
  498. package/src/functions/wallet/setAbiRecord.test.ts +0 -156
  499. package/src/functions/wallet/setAddressRecord.test.ts +0 -121
  500. package/src/functions/wallet/setChildFuses.test.ts +0 -97
  501. package/src/functions/wallet/setContentHashRecord.test.ts +0 -69
  502. package/src/functions/wallet/setFuses.test.ts +0 -287
  503. package/src/functions/wallet/setPrimaryName.test.ts +0 -71
  504. package/src/functions/wallet/setRecords.test.ts +0 -127
  505. package/src/functions/wallet/setResolver.test.ts +0 -114
  506. package/src/functions/wallet/setTextRecord.test.ts +0 -67
  507. package/src/functions/wallet/transferName.test.ts +0 -201
  508. package/src/functions/wallet/unwrapName.test.ts +0 -93
  509. package/src/functions/wallet/wrapName.test.ts +0 -195
  510. package/src/utils/generateRecordCallArray.test.ts +0 -84
  511. package/src/utils/labels.test.ts +0 -163
  512. package/src/utils/makeLabelNodeAndParent.test.ts +0 -11
  513. package/src/utils/makeSafeSecondsDate.test.ts +0 -14
  514. package/src/utils/normalise.test.ts +0 -35
  515. package/src/utils/ownerFromContract.test.ts +0 -52
  516. package/src/utils/registerHelpers.test.ts +0 -159
  517. package/src/utils/validation.test.ts +0 -170
  518. package/src/utils/wrapper.test.ts +0 -46
@@ -73,7 +73,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
73
73
  * @example
74
74
  * import { createPublicClient, http } from 'viem'
75
75
  * import { mainnet } from 'viem/chains'
76
- * import { addEnsContracts, getAvailable } from '@ensdomains/ensjs'
76
+ * import { addEnsContracts } from '@ensdomains/ensjs'
77
+ * import { getAvailable } from '@ensdomains/ensjs/public'
77
78
  *
78
79
  * const client = createPublicClient({
79
80
  * chain: addEnsContracts(mainnet),
@@ -49,7 +49,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
49
49
  * @example
50
50
  * import { createPublicClient, http } from 'viem'
51
51
  * import { mainnet } from 'viem/chains'
52
- * import { addEnsContracts, getContentHashRecord } from '@ensdomains/ensjs'
52
+ * import { addEnsContracts } from '@ensdomains/ensjs'
53
+ * import { getContentHashRecord } from '@ensdomains/ensjs/public'
53
54
  *
54
55
  * const client = createPublicClient({
55
56
  * chain: addEnsContracts(mainnet),
@@ -181,7 +181,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
181
181
  * @example
182
182
  * import { createPublicClient, http } from 'viem'
183
183
  * import { mainnet } from 'viem/chains'
184
- * import { addEnsContracts, getExpiry } from '@ensdomains/ensjs'
184
+ * import { addEnsContracts } from '@ensdomains/ensjs'
185
+ * import { getExpiry } from '@ensdomains/ensjs/public'
185
186
  *
186
187
  * const client = createPublicClient({
187
188
  * chain: addEnsContracts(mainnet),
@@ -83,7 +83,7 @@ const decode = async (
83
83
  functionName: 'reverse',
84
84
  args: passthrough.args,
85
85
  address: passthrough.address,
86
- })
86
+ }) as BaseError
87
87
  }
88
88
  const result = decodeFunctionResult({
89
89
  abi: universalResolverReverseSnippet,
@@ -110,7 +110,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
110
110
  * @example
111
111
  * import { createPublicClient, http } from 'viem'
112
112
  * import { mainnet } from 'viem/chains'
113
- * import { addEnsContracts, getName } from '@ensdomains/ensjs'
113
+ * import { addEnsContracts } from '@ensdomains/ensjs'
114
+ * import { getName } from '@ensdomains/ensjs/public'
114
115
  *
115
116
  * const client = createPublicClient({
116
117
  * chain: addEnsContracts(mainnet),
@@ -3,10 +3,7 @@ import type { ClientWithEns } from '../../contracts/consts.js'
3
3
  import { getChainContractAddress } from '../../contracts/getChainContractAddress.js'
4
4
  import type { SimpleTransactionRequest } from '../../types.js'
5
5
  import { EMPTY_ADDRESS } from '../../utils/consts.js'
6
- import {
7
- generateFunction,
8
- type GeneratedFunction,
9
- } from '../../utils/generateFunction.js'
6
+ import { generateFunction } from '../../utils/generateFunction.js'
10
7
  import { namehash as makeNamehash } from '../../utils/normalise.js'
11
8
  import {
12
9
  ownerFromContract,
@@ -15,11 +12,13 @@ import {
15
12
  import { checkIsDotEth } from '../../utils/validation.js'
16
13
  import multicallWrapper from './multicallWrapper.js'
17
14
 
18
- export type GetOwnerParameters = {
15
+ export type GetOwnerParameters<
16
+ TContract extends OwnerContract | undefined = undefined,
17
+ > = {
19
18
  /** Name to get owner for */
20
19
  name: string
21
20
  /** Optional specific contract to get ownership value from */
22
- contract?: OwnerContract
21
+ contract?: TContract
23
22
  }
24
23
 
25
24
  type BaseGetOwnerReturnType = {
@@ -55,19 +54,22 @@ type UnwrappedOwnership = {
55
54
  ownershipLevel: 'registry'
56
55
  }
57
56
 
58
- export type GetOwnerReturnType =
57
+ export type GetOwnerReturnType<
58
+ TContract extends OwnerContract | undefined = undefined,
59
+ > =
59
60
  | (BaseGetOwnerReturnType &
60
- (
61
- | RegistrarOnlyOwnership
62
- | WrappedOwnership
63
- | UnwrappedEth2ldOwnership
64
- | UnwrappedOwnership
65
- ))
61
+ (TContract extends 'registrar'
62
+ ? RegistrarOnlyOwnership
63
+ : TContract extends 'nameWrapper'
64
+ ? WrappedOwnership
65
+ : TContract extends 'registry'
66
+ ? UnwrappedOwnership
67
+ : WrappedOwnership | UnwrappedEth2ldOwnership | UnwrappedOwnership))
66
68
  | null
67
69
 
68
- const encode = (
70
+ const encode = <TContract extends OwnerContract | undefined = undefined>(
69
71
  client: ClientWithEns,
70
- { name, contract }: GetOwnerParameters,
72
+ { name, contract }: GetOwnerParameters<TContract>,
71
73
  ): SimpleTransactionRequest => {
72
74
  const namehash = makeNamehash(name)
73
75
  const labels = name.split('.')
@@ -102,13 +104,13 @@ const encode = (
102
104
  }
103
105
 
104
106
  const addressDecode = (data: Hex) =>
105
- decodeAbiParameters([{ type: 'address' }], data)[0]
107
+ decodeAbiParameters([{ type: 'address' }], data)[0] as Address
106
108
 
107
- const decode = async (
109
+ const decode = async <TContract extends OwnerContract | undefined = undefined>(
108
110
  client: ClientWithEns,
109
111
  data: Hex | BaseError,
110
- { name, contract }: GetOwnerParameters,
111
- ): Promise<GetOwnerReturnType> => {
112
+ { name, contract }: GetOwnerParameters<TContract>,
113
+ ): Promise<GetOwnerReturnType<TContract>> => {
112
114
  if (typeof data === 'object') throw data
113
115
  const labels = name.split('.')
114
116
  if (contract || labels.length === 1) {
@@ -117,12 +119,12 @@ const decode = async (
117
119
  return {
118
120
  ownershipLevel: 'registrar',
119
121
  registrant: singleOwner,
120
- } as RegistrarOnlyOwnership
122
+ } as GetOwnerReturnType<TContract>
121
123
  }
122
124
  return {
123
125
  ownershipLevel: contract || 'registry',
124
126
  owner: singleOwner,
125
- } as UnwrappedOwnership | WrappedOwnership
127
+ } as GetOwnerReturnType<TContract>
126
128
  }
127
129
 
128
130
  const result = await multicallWrapper.decode(client, data, [])
@@ -150,7 +152,7 @@ const decode = async (
150
152
  return {
151
153
  owner: nameWrapperOwner,
152
154
  ownershipLevel: 'nameWrapper',
153
- } as WrappedOwnership
155
+ } as GetOwnerReturnType<TContract>
154
156
  }
155
157
  // if there is a registrar owner, then it's not a subdomain but we have also passed the namewrapper clause
156
158
  // this means that it's an unwrapped second-level name
@@ -161,7 +163,7 @@ const decode = async (
161
163
  registrant: registrarOwner!,
162
164
  owner: registryOwner!,
163
165
  ownershipLevel: 'registrar',
164
- } as UnwrappedEth2ldOwnership
166
+ } as GetOwnerReturnType<TContract>
165
167
  }
166
168
  if (registryOwner !== EMPTY_ADDRESS) {
167
169
  // if there is no registrar owner, but the label length is two, then the domain is an expired 2LD .eth
@@ -171,7 +173,7 @@ const decode = async (
171
173
  registrant: null,
172
174
  owner: registryOwner,
173
175
  ownershipLevel: 'registrar',
174
- } as UnwrappedEth2ldOwnership
176
+ } as GetOwnerReturnType<TContract>
175
177
  }
176
178
  // this means that the subname is wrapped
177
179
  if (
@@ -182,13 +184,13 @@ const decode = async (
182
184
  return {
183
185
  owner: nameWrapperOwner,
184
186
  ownershipLevel: 'nameWrapper',
185
- } as WrappedOwnership
187
+ } as GetOwnerReturnType<TContract>
186
188
  }
187
189
  // unwrapped subnames do not have NFTs associated, so do not have a registrant
188
190
  return {
189
191
  owner: registryOwner,
190
192
  ownershipLevel: 'registry',
191
- } as UnwrappedOwnership
193
+ } as GetOwnerReturnType<TContract>
192
194
  }
193
195
  // .eth names with no registrar owner are either unregistered or expired
194
196
  return null
@@ -206,7 +208,7 @@ const decode = async (
206
208
  return {
207
209
  owner: nameWrapperOwner,
208
210
  ownershipLevel: 'nameWrapper',
209
- } as WrappedOwnership
211
+ } as GetOwnerReturnType<TContract>
210
212
  }
211
213
 
212
214
  // for unwrapped non .eth names, the owner is the registry owner
@@ -214,14 +216,30 @@ const decode = async (
214
216
  return {
215
217
  owner: registryOwner,
216
218
  ownershipLevel: 'registry',
217
- } as UnwrappedOwnership
219
+ } as GetOwnerReturnType<TContract>
218
220
  }
219
221
 
220
222
  // for anything else, return
221
223
  return null
222
224
  }
223
225
 
224
- type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
226
+ type EncoderFunction = typeof encode
227
+ type DecoderFunction = typeof decode
228
+
229
+ type BatchableFunctionObject = {
230
+ encode: EncoderFunction
231
+ decode: DecoderFunction
232
+ batch: <
233
+ TContract extends OwnerContract | undefined = undefined,
234
+ TParams extends GetOwnerParameters<TContract> = GetOwnerParameters<TContract>,
235
+ >(
236
+ args: TParams,
237
+ ) => {
238
+ args: [TParams]
239
+ encode: EncoderFunction
240
+ decode: typeof decode<TContract>
241
+ }
242
+ }
225
243
 
226
244
  /**
227
245
  * Gets the owner(s) of a name.
@@ -232,7 +250,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
232
250
  * @example
233
251
  * import { createPublicClient, http } from 'viem'
234
252
  * import { mainnet } from 'viem/chains'
235
- * import { addEnsContracts, getOwner } from '@ensdomains/ensjs'
253
+ * import { addEnsContracts } from '@ensdomains/ensjs'
254
+ * import { getOwner } from '@ensdomains/ensjs/public'
236
255
  *
237
256
  * const client = createPublicClient({
238
257
  * chain: addEnsContracts(mainnet),
@@ -241,10 +260,12 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
241
260
  * const result = await getOwner(client, { name: 'ens.eth' })
242
261
  * // { owner: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', registrant: '0xb6E040C9ECAaE172a89bD561c5F73e1C48d28cd9', ownershipLevel: 'registrar }
243
262
  */
244
- const getOwner = generateFunction({ encode, decode }) as ((
263
+ const getOwner = generateFunction({ encode, decode }) as (<
264
+ TContract extends OwnerContract | undefined = undefined,
265
+ >(
245
266
  client: ClientWithEns,
246
- { name, contract }: GetOwnerParameters,
247
- ) => Promise<GetOwnerReturnType>) &
267
+ { name, contract }: GetOwnerParameters<TContract>,
268
+ ) => Promise<GetOwnerReturnType<TContract>>) &
248
269
  BatchableFunctionObject
249
270
 
250
271
  export default getOwner
@@ -129,13 +129,14 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
129
129
  * @example
130
130
  * import { createPublicClient, http } from 'viem'
131
131
  * import { mainnet } from 'viem/chains'
132
- * import { addEnsContracts, getPrice } from '@ensdomains/ensjs'
132
+ * import { addEnsContracts } from '@ensdomains/ensjs'
133
+ * import { getPrice } from '@ensdomains/ensjs/public'
133
134
  *
134
135
  * const client = createPublicClient({
135
136
  * chain: addEnsContracts(mainnet),
136
137
  * transport: http(),
137
138
  * })
138
- * const result = await getPrice(client, { nameOrNames: 'ens.eth' })
139
+ * const result = await getPrice(client, { nameOrNames: 'ens.eth', duration: 31536000 })
139
140
  * // { base: 352828971668930335n, premium: 0n }
140
141
  */
141
142
  const getPrice = generateFunction({ encode, decode }) as ((
@@ -5,6 +5,7 @@ import {
5
5
  decodeFunctionResult,
6
6
  encodeFunctionData,
7
7
  getContractError,
8
+ hexToBigInt,
8
9
  toHex,
9
10
  type Address,
10
11
  type Hex,
@@ -106,39 +107,55 @@ const encode = (
106
107
  client: ClientWithEns,
107
108
  { name, resolver, records }: GetRecordsParameters,
108
109
  ): TransactionRequestWithPassthrough => {
109
- const calls: (CallObj | null)[] = []
110
- if (records.texts) {
111
- for (const key of records.texts) {
112
- calls.push({
113
- key,
114
- call: _getText.encode(client, { name, key }),
115
- type: 'text',
116
- })
110
+ const calls = Object.keys(records).reduce((prev, key) => {
111
+ if (key === 'texts') {
112
+ return [
113
+ ...prev,
114
+ ...records.texts!.map(
115
+ (text) =>
116
+ ({
117
+ key: text,
118
+ call: _getText.encode(client, { name, key: text }),
119
+ type: 'text',
120
+ } as const),
121
+ ),
122
+ ]
117
123
  }
118
- }
119
- if (records.coins) {
120
- for (const coin of records.coins) {
121
- calls.push({
122
- key: coin,
123
- call: _getAddr.encode(client, { name, coin }),
124
- type: 'coin',
125
- })
124
+ if (key === 'coins') {
125
+ return [
126
+ ...prev,
127
+ ...records.coins!.map(
128
+ (coin) =>
129
+ ({
130
+ key: coin,
131
+ call: _getAddr.encode(client, { name, coin }),
132
+ type: 'coin',
133
+ } as const),
134
+ ),
135
+ ]
126
136
  }
127
- }
128
- if (records.contentHash) {
129
- calls.push({
130
- key: 'contentHash',
131
- call: _getContentHash.encode(client, { name }),
132
- type: 'contentHash',
133
- })
134
- }
135
- if (records.abi) {
136
- calls.push({
137
- key: 'abi',
138
- call: _getAbi.encode(client, { name }),
139
- type: 'abi',
140
- })
141
- }
137
+ if (key === 'contentHash') {
138
+ return [
139
+ ...prev,
140
+ {
141
+ key: 'contentHash',
142
+ call: _getContentHash.encode(client, { name }),
143
+ type: 'contentHash',
144
+ } as const,
145
+ ]
146
+ }
147
+ if (key === 'abi') {
148
+ return [
149
+ ...prev,
150
+ {
151
+ key: 'abi',
152
+ call: _getAbi.encode(client, { name }),
153
+ type: 'abi',
154
+ } as const,
155
+ ]
156
+ }
157
+ return prev
158
+ }, [] as (CallObj | null)[])
142
159
 
143
160
  const passthrough = calls
144
161
 
@@ -174,7 +191,7 @@ const decode = async <TParams extends GetRecordsParameters>(
174
191
  client: ClientWithEns,
175
192
  data: Hex | BaseError,
176
193
  passthrough: (CallObj | null)[],
177
- { name, resolver }: TParams,
194
+ { name, resolver, records: recordsParams }: TParams,
178
195
  ): Promise<GetRecordsReturnType<TParams>> => {
179
196
  const calls = passthrough
180
197
  let recordData: (Hex | null)[] = []
@@ -231,7 +248,7 @@ const decode = async <TParams extends GetRecordsParameters>(
231
248
  client,
232
249
  contract: 'ensUniversalResolver',
233
250
  }),
234
- })
251
+ }) as BaseError
235
252
  }
236
253
  const result = decodeFunctionResult({
237
254
  abi: universalResolverResolveArraySnippet,
@@ -255,82 +272,84 @@ const decode = async <TParams extends GetRecordsParameters>(
255
272
  const filteredCalls = calls.filter((x) => x) as CallObj[]
256
273
  const filteredRecordData = recordData.filter((x) => x) as Hex[]
257
274
 
258
- const returnedRecords: GetRecordsReturnType<GetRecordsParameters> =
259
- await Promise.all(
260
- filteredRecordData.map(async (item, i) => {
261
- const { key, type } = filteredCalls[i]
262
- const baseItem = { key, type }
263
- if (type === 'contentHash') {
264
- const decodedFromAbi = decodeAbiParameters(
265
- [{ type: 'bytes' }] as const,
266
- item,
267
- )[0]
268
- if (BigInt(decodedFromAbi) === 0n) {
269
- return { ...baseItem, value: null }
270
- }
275
+ const decodedRecords = await Promise.all(
276
+ filteredRecordData.map(async (item, i) => {
277
+ const { key, type } = filteredCalls[i]
278
+ const baseItem = { key, type }
279
+ if (type === 'contentHash') {
280
+ const decodedFromAbi = decodeAbiParameters(
281
+ [{ type: 'bytes' }] as const,
282
+ item,
283
+ )[0]
284
+ if (decodedFromAbi === '0x' || hexToBigInt(decodedFromAbi) === 0n) {
285
+ return { ...baseItem, value: null }
286
+ }
287
+ }
288
+ if (type === 'text') {
289
+ const decodedFromAbi = await _getText.decode(client, item)
290
+ return { ...baseItem, value: decodedFromAbi }
291
+ }
292
+ if (type === 'coin') {
293
+ const decodedFromAbi = await _getAddr.decode(client, item, {
294
+ name,
295
+ coin: key,
296
+ })
297
+ return { ...baseItem, value: decodedFromAbi }
298
+ }
299
+ if (type === 'contentHash') {
300
+ const decodedFromAbi = await _getContentHash.decode(client, item)
301
+ return { ...baseItem, value: decodedFromAbi }
302
+ }
303
+ // abi
304
+ const decodedFromAbi = await _getAbi.decode(client, item)
305
+ return { ...baseItem, value: decodedFromAbi }
306
+ }),
307
+ )
308
+
309
+ const records = decodedRecords.reduce(
310
+ (prev, curr) => {
311
+ if (curr.type === 'text' || curr.type === 'coin') {
312
+ if (!curr.value) {
313
+ return prev
271
314
  }
272
- if (type === 'text') {
273
- const decodedFromAbi = await _getText.decode(client, item)
274
- return { ...baseItem, value: decodedFromAbi }
315
+ }
316
+ if (curr.type === 'text') {
317
+ return {
318
+ ...prev,
319
+ texts: [
320
+ ...(prev.texts || []),
321
+ { key: curr.key, value: curr.value } as DecodedText,
322
+ ],
275
323
  }
276
- if (type === 'coin') {
277
- const decodedFromAbi = await _getAddr.decode(client, item, {
278
- name,
279
- coin: key,
280
- })
281
- return { ...baseItem, value: decodedFromAbi }
324
+ }
325
+ if (curr.type === 'coin') {
326
+ return {
327
+ ...prev,
328
+ coins: [...(prev.coins || []), curr.value as DecodedAddr],
282
329
  }
283
- if (type === 'contentHash') {
284
- const decodedFromAbi = await _getContentHash.decode(client, item)
285
- return { ...baseItem, value: decodedFromAbi }
330
+ }
331
+ if (curr.type === 'contentHash') {
332
+ return {
333
+ ...prev,
334
+ contentHash: curr.value as InternalGetContentHashReturnType,
286
335
  }
287
- // abi
288
- const decodedFromAbi = await _getAbi.decode(client, item)
289
- return { ...baseItem, value: decodedFromAbi }
290
- }),
291
- ).then((results) =>
292
- results.reduce(
293
- (prev, curr) => {
294
- if (curr.type === 'text' || curr.type === 'coin') {
295
- if (!curr.value) {
296
- return prev
297
- }
298
- }
299
- if (curr.type === 'text') {
300
- return {
301
- ...prev,
302
- texts: [
303
- ...(prev.texts || []),
304
- { key: curr.key, value: curr.value } as DecodedText,
305
- ],
306
- }
307
- }
308
- if (curr.type === 'coin') {
309
- return {
310
- ...prev,
311
- coins: [...(prev.coins || []), curr.value as DecodedAddr],
312
- }
313
- }
314
- if (curr.type === 'contentHash') {
315
- return {
316
- ...prev,
317
- contentHash: curr.value as InternalGetContentHashReturnType,
318
- }
319
- }
320
- // abi
321
- return { ...prev, abi: curr.value as InternalGetAbiReturnType }
322
- },
323
- {
324
- resolverAddress,
325
- } as GetRecordsReturnType<
326
- GetRecordsParameters & {
327
- records: Required<GetRecordsParameters['records']>
328
- }
329
- >,
330
- ),
331
- )
336
+ }
337
+ // abi
338
+ return { ...prev, abi: curr.value as InternalGetAbiReturnType }
339
+ },
340
+ {
341
+ resolverAddress,
342
+ ...('texts' in recordsParams ? { texts: [] } : {}),
343
+ ...('coins' in recordsParams ? { coins: [] } : {}),
344
+ ...('contentHash' in recordsParams ? { contentHash: null } : {}),
345
+ } as GetRecordsReturnType<
346
+ GetRecordsParameters & {
347
+ records: Required<GetRecordsParameters['records']>
348
+ }
349
+ >,
350
+ )
332
351
 
333
- return returnedRecords as GetRecordsReturnType<TParams>
352
+ return records as GetRecordsReturnType<TParams>
334
353
  }
335
354
 
336
355
  type EncoderFunction = typeof encode
@@ -357,7 +376,8 @@ type BatchableFunctionObject = {
357
376
  * @example
358
377
  * import { createPublicClient, http } from 'viem'
359
378
  * import { mainnet } from 'viem/chains'
360
- * import { addEnsContracts, getRecords } from '@ensdomains/ensjs'
379
+ * import { addEnsContracts } from '@ensdomains/ensjs'
380
+ * import { getRecords } from '@ensdomains/ensjs/public'
361
381
  *
362
382
  * const client = createPublicClient({
363
383
  * chain: addEnsContracts(mainnet),
@@ -59,7 +59,7 @@ const decode = async (
59
59
  functionName: 'findResolver',
60
60
  args: passthrough.args,
61
61
  address: passthrough.address,
62
- })
62
+ }) as BaseError
63
63
  const response = decodeFunctionResult({
64
64
  abi: universalResolverFindResolverSnippet,
65
65
  functionName: 'findResolver',
@@ -82,7 +82,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
82
82
  * @example
83
83
  * import { createPublicClient, http } from 'viem'
84
84
  * import { mainnet } from 'viem/chains'
85
- * import { addEnsContracts, getResolver } from '@ensdomains/ensjs'
85
+ * import { addEnsContracts } from '@ensdomains/ensjs'
86
+ * import { getResolver } from '@ensdomains/ensjs/public'
86
87
  *
87
88
  * const client = createPublicClient({
88
89
  * chain: addEnsContracts(mainnet),