@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,9 +1,11 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
1
2
  import { gql } from 'graphql-request'
2
3
  import type { ClientWithEns } from '../../contracts/consts.js'
3
4
  import { InvalidOrderByError } from '../../errors/subgraph.js'
4
- import { GRACE_PERIOD_SECONDS } from '../../utils/consts.js'
5
+ import { EMPTY_ADDRESS, GRACE_PERIOD_SECONDS } from '../../utils/consts.js'
5
6
  import { namehash } from '../../utils/normalise.js'
6
7
  import { createSubgraphClient } from './client.js'
8
+ import type { DomainFilter } from './filters.js'
7
9
  import {
8
10
  domainDetailsWithoutParentFragment,
9
11
  registrationDetailsFragment,
@@ -21,6 +23,8 @@ export type GetSubnamesParameters = {
21
23
  searchString?: string
22
24
  /** Allows expired names to be included (default: false) */
23
25
  allowExpired?: boolean
26
+ /** Allows deleted names to be included (default: false) */
27
+ allowDeleted?: boolean
24
28
  /** Parameter to order names by (default: name) */
25
29
  orderBy?: GetSubnamesOrderBy
26
30
  /** Direction to order names in (default: asc) */
@@ -39,6 +43,71 @@ type SubgraphResult = {
39
43
  }
40
44
  }
41
45
 
46
+ const getOrderByFilter = ({
47
+ name,
48
+ orderBy,
49
+ orderDirection,
50
+ previousPage,
51
+ }: Required<
52
+ Pick<
53
+ GetSubnamesParameters,
54
+ 'name' | 'orderBy' | 'orderDirection' | 'previousPage'
55
+ >
56
+ >): DomainFilter => {
57
+ const lastDomain = previousPage[previousPage.length - 1]
58
+ const operator = orderDirection === 'asc' ? 'gt' : 'lt'
59
+
60
+ switch (orderBy) {
61
+ case 'expiryDate': {
62
+ let lastExpiryDate = lastDomain.expiryDate?.value
63
+ ? lastDomain.expiryDate.value / 1000
64
+ : 0
65
+ if (name === 'eth' && lastExpiryDate) {
66
+ lastExpiryDate += GRACE_PERIOD_SECONDS
67
+ }
68
+
69
+ if (orderDirection === 'asc' && lastExpiryDate === 0) {
70
+ return {
71
+ and: [{ expiryDate: null }, { [`id_${operator}`]: lastDomain.id }],
72
+ }
73
+ }
74
+ if (orderDirection === 'desc' && lastExpiryDate !== 0) {
75
+ return {
76
+ [`expiryDate_${operator}`]: `${lastExpiryDate}`,
77
+ }
78
+ }
79
+ return {
80
+ or: [
81
+ {
82
+ [`expiryDate_${operator}`]: `${lastExpiryDate}`,
83
+ },
84
+ { expiryDate: null },
85
+ ],
86
+ }
87
+ }
88
+ case 'name': {
89
+ return {
90
+ [`name_${operator}`]: lastDomain.name ?? '',
91
+ }
92
+ }
93
+ case 'labelName': {
94
+ return {
95
+ [`labelName_${operator}`]: lastDomain.labelName ?? '',
96
+ }
97
+ }
98
+ case 'createdAt': {
99
+ return {
100
+ [`createdAt_${operator}`]: `${lastDomain.createdAt.value / 1000}`,
101
+ }
102
+ }
103
+ default:
104
+ throw new InvalidOrderByError({
105
+ orderBy: orderBy || '<no orderBy provided>',
106
+ supportedOrderBys: ['expiryDate', 'name', 'labelName', 'createdAt'],
107
+ })
108
+ }
109
+ }
110
+
42
111
  /**
43
112
  * Gets the subnames for a name from the subgraph.
44
113
  * @param client - {@link ClientWithEns}
@@ -48,7 +117,8 @@ type SubgraphResult = {
48
117
  * @example
49
118
  * import { createPublicClient, http } from 'viem'
50
119
  * import { mainnet } from 'viem/chains'
51
- * import { addEnsContracts, getSubnames } from '@ensdomains/ensjs'
120
+ * import { addEnsContracts } from '@ensdomains/ensjs'
121
+ * import { getSubnames } from '@ensdomains/ensjs/subgraph'
52
122
  *
53
123
  * const client = createPublicClient({
54
124
  * chain: addEnsContracts(mainnet),
@@ -62,6 +132,7 @@ const getSubnames = async (
62
132
  name,
63
133
  searchString,
64
134
  allowExpired = false,
135
+ allowDeleted = false,
65
136
  orderBy = 'name',
66
137
  orderDirection = 'asc',
67
138
  pageSize = 100,
@@ -70,119 +141,68 @@ const getSubnames = async (
70
141
  ): Promise<GetSubnamesReturnType> => {
71
142
  const subgraphClient = createSubgraphClient({ client })
72
143
 
73
- const whereFilters: string[] = []
74
-
75
- let orderByFilter = ''
76
- let orderByStringVar = ''
77
-
78
- if (previousPage && previousPage.length > 0) {
79
- const lastDomain = previousPage[previousPage.length - 1]
80
- const operator = orderDirection === 'asc' ? 'gt' : 'lt'
81
- switch (orderBy) {
82
- case 'expiryDate': {
83
- let lastExpiryDate = lastDomain.expiryDate?.value
84
- ? lastDomain.expiryDate.value / 1000
85
- : 0
86
- if (name === 'eth' && lastExpiryDate) {
87
- lastExpiryDate += GRACE_PERIOD_SECONDS
88
- }
89
- if (orderDirection === 'asc' && lastExpiryDate === 0) {
90
- orderByFilter = `
91
- {
92
- and: [
93
- { expiryDate: null }
94
- { id_${operator}: "${lastDomain.id}" }
95
- ]
96
- }
97
- `
98
- } else if (orderDirection === 'desc' && lastExpiryDate !== 0) {
99
- orderByFilter = `
100
- {
101
- expiryDate_${operator}: ${lastExpiryDate}
102
- }
103
- `
104
- } else {
105
- orderByFilter = `
106
- {
107
- or: [
108
- {
109
- expiryDate_${operator}: ${lastExpiryDate}
110
- }
111
- { expiryDate: null }
112
- ]
113
- }
114
- `
115
- }
116
- break
117
- }
118
- case 'name': {
119
- orderByFilter = `
120
- {
121
- name_${operator}: $orderByStringVar
122
- }
123
- `
124
- orderByStringVar = lastDomain.name ?? ''
125
- break
126
- }
127
- case 'labelName': {
128
- orderByFilter = `
129
- {
130
- labelName_${operator}: $orderByStringVar
131
- }
132
- `
133
- orderByStringVar = lastDomain.labelName ?? ''
134
- break
135
- }
136
- case 'createdAt': {
137
- orderByFilter = `
138
- {
139
- createdAt_${operator}: ${lastDomain.createdAt.value / 1000}
140
- }
141
- `
142
- break
143
- }
144
- default:
145
- throw new InvalidOrderByError({
146
- orderBy,
147
- supportedOrderBys: ['expiryDate', 'name', 'labelName', 'createdAt'],
148
- })
149
- }
150
- whereFilters.push(orderByFilter)
144
+ const whereFilters: DomainFilter[] = []
145
+
146
+ if (previousPage?.length) {
147
+ whereFilters.push(
148
+ getOrderByFilter({
149
+ name,
150
+ orderBy,
151
+ orderDirection,
152
+ previousPage,
153
+ }),
154
+ )
151
155
  }
152
156
 
153
157
  if (!allowExpired) {
154
158
  // Exclude domains that are expired
155
159
  // if expiryDate is null, there is no expiry on the domain (registration or wrapped)
156
- whereFilters.push(`
157
- {
158
- or: [
159
- { expiryDate_gt: $expiryDate }
160
- { expiryDate: null }
161
- ]
162
- }
163
- `)
160
+ whereFilters.push({
161
+ or: [
162
+ { expiryDate_gt: `${Math.floor(Date.now() / 1000)}` },
163
+ { expiryDate: null },
164
+ ],
165
+ })
166
+ }
167
+
168
+ if (!allowDeleted) {
169
+ // exclude "deleted" domains
170
+ // when owner/resolver/registrant = null
171
+ whereFilters.push({
172
+ or: [
173
+ {
174
+ owner_not: EMPTY_ADDRESS,
175
+ },
176
+ {
177
+ resolver_not: null,
178
+ },
179
+ ...(name.toLowerCase() === 'eth'
180
+ ? [
181
+ {
182
+ registrant_not: EMPTY_ADDRESS,
183
+ },
184
+ ]
185
+ : []),
186
+ ],
187
+ })
164
188
  }
165
189
 
166
190
  if (searchString) {
167
191
  // using labelName_contains instead of name_contains because name_contains
168
192
  // includes the parent name
169
- whereFilters.push(`
170
- {
171
- labelName_contains: $searchString
172
- }
173
- `)
193
+ whereFilters.push({
194
+ labelName_contains: searchString,
195
+ })
174
196
  }
175
197
 
176
- let whereFilter = ''
198
+ let whereFilter: DomainFilter = {}
177
199
 
178
200
  if (whereFilters.length > 1) {
179
- whereFilter = `
180
- and: [
181
- ${whereFilters.join('\n')}
182
- ]
183
- `
201
+ whereFilter = {
202
+ and: whereFilters,
203
+ }
184
204
  } else if (whereFilters.length === 1) {
185
- whereFilter = whereFilters[0].replace(/{(.*)}/gs, '$1')
205
+ ;[whereFilter] = whereFilters
186
206
  }
187
207
 
188
208
  const query = gql`
@@ -190,24 +210,15 @@ const getSubnames = async (
190
210
  $id: String!
191
211
  $orderBy: Domain_orderBy
192
212
  $orderDirection: OrderDirection
213
+ $whereFilter: Domain_filter
193
214
  $first: Int
194
- $expiryDate: Int
195
- $searchString: String
196
- $orderByStringVar: String
197
215
  ) {
198
216
  domain(id: $id) {
199
217
  subdomains(
200
218
  orderBy: $orderBy
201
219
  orderDirection: $orderDirection
202
220
  first: $first
203
- ${
204
- whereFilter &&
205
- `
206
- where: {
207
- ${whereFilter}
208
- }
209
- `
210
- }
221
+ where: $whereFilter
211
222
  ) {
212
223
  ...DomainDetailsWithoutParent
213
224
  registration {
@@ -229,9 +240,7 @@ const getSubnames = async (
229
240
  orderBy,
230
241
  orderDirection,
231
242
  first: pageSize,
232
- expiryDate: Math.floor(Date.now() / 1000),
233
- searchString,
234
- orderByStringVar,
243
+ whereFilter,
235
244
  }
236
245
 
237
246
  const result = await subgraphClient.request<SubgraphResult, typeof queryVars>(
@@ -0,0 +1,13 @@
1
+ import type { Hex } from 'viem'
2
+
3
+ export type InputMaybe<T> = T | null
4
+ /** All built-in and custom scalars, mapped to their actual values */
5
+ export type Scalars = {
6
+ ID: string
7
+ String: string
8
+ Boolean: boolean
9
+ Int: number
10
+ Float: number
11
+ Bytes: Hex
12
+ BigInt: string
13
+ }
@@ -1,7 +1,7 @@
1
1
  import { getAddress, type Address, type Hex } from 'viem'
2
2
  import type { DateWithValue } from '../../types.js'
3
3
  import { truncateFormat } from '../../utils/format.js'
4
- import { decodeFuses, type AllCurrentFuses } from '../../utils/fuses.js'
4
+ import { decodeFuses, type DecodedFuses } from '../../utils/fuses.js'
5
5
  import { decryptName } from '../../utils/labels.js'
6
6
  import type { SubgraphDomain } from './fragments.js'
7
7
 
@@ -27,7 +27,7 @@ export type Name = {
27
27
  /** Expiry date of name */
28
28
  expiryDate: DateWithValue<number> | null
29
29
  /** Fuse values for name */
30
- fuses: AllCurrentFuses | null
30
+ fuses: DecodedFuses | null
31
31
  /** Owner address */
32
32
  owner: Address
33
33
  /** Registrant address */
@@ -0,0 +1,97 @@
1
+ import type {
2
+ Account,
3
+ Address,
4
+ Hash,
5
+ SendTransactionParameters,
6
+ Transport,
7
+ } from 'viem'
8
+ import type { ChainWithEns, WalletWithEns } from '../../contracts/consts.js'
9
+ import type {
10
+ Prettify,
11
+ SimpleTransactionRequest,
12
+ WriteTransactionParameters,
13
+ } from '../../types.js'
14
+ import { encodeClearRecords } from '../../utils/encoders/encodeClearRecords.js'
15
+ import { namehash } from '../../utils/normalise.js'
16
+
17
+ export type ClearRecordsDataParameters = {
18
+ /** The name to clear records for */
19
+ name: string
20
+ /** The resolver address to use */
21
+ resolverAddress: Address
22
+ }
23
+
24
+ export type ClearRecordsDataReturnType = SimpleTransactionRequest
25
+
26
+ export type ClearRecordsParameters<
27
+ TChain extends ChainWithEns,
28
+ TAccount extends Account | undefined,
29
+ TChainOverride extends ChainWithEns | undefined,
30
+ > = Prettify<
31
+ ClearRecordsDataParameters &
32
+ WriteTransactionParameters<TChain, TAccount, TChainOverride>
33
+ >
34
+
35
+ export type ClearRecordsReturnType = Hash
36
+
37
+ export const makeFunctionData = <
38
+ TChain extends ChainWithEns,
39
+ TAccount extends Account | undefined,
40
+ >(
41
+ _wallet: WalletWithEns<Transport, TChain, TAccount>,
42
+ { name, resolverAddress }: ClearRecordsDataParameters,
43
+ ): ClearRecordsDataReturnType => {
44
+ return {
45
+ to: resolverAddress,
46
+ data: encodeClearRecords(namehash(name)),
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Clears the records for a name on a resolver.
52
+ * @param wallet - {@link WalletWithEns}
53
+ * @param parameters - {@link ClearRecordsParameters}
54
+ * @returns Transaction hash. {@link ClearRecordsReturnType}
55
+ *
56
+ * @example
57
+ * import { createWalletClient, custom } from 'viem'
58
+ * import { mainnet } from 'viem/chains'
59
+ * import { addEnsContracts } from '@ensdomains/ensjs'
60
+ * import { clearRecords } from '@ensdomains/ensjs/wallet'
61
+ *
62
+ * const wallet = createWalletClient({
63
+ * chain: addEnsContracts(mainnet),
64
+ * transport: custom(window.ethereum),
65
+ * })
66
+ * const hash = await clearRecords(wallet, {
67
+ * name: 'ens.eth',
68
+ * resolverAddress: '0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41',
69
+ * })
70
+ * // 0x...
71
+ */
72
+ async function clearRecords<
73
+ TChain extends ChainWithEns,
74
+ TAccount extends Account | undefined,
75
+ TChainOverride extends ChainWithEns | undefined = ChainWithEns,
76
+ >(
77
+ wallet: WalletWithEns<Transport, TChain, TAccount>,
78
+ {
79
+ name,
80
+ resolverAddress,
81
+ ...txArgs
82
+ }: ClearRecordsParameters<TChain, TAccount, TChainOverride>,
83
+ ): Promise<ClearRecordsReturnType> {
84
+ const data = makeFunctionData(wallet, {
85
+ name,
86
+ resolverAddress,
87
+ })
88
+ const writeArgs = {
89
+ ...data,
90
+ ...txArgs,
91
+ } as SendTransactionParameters<TChain, TAccount, TChainOverride>
92
+ return wallet.sendTransaction(writeArgs)
93
+ }
94
+
95
+ clearRecords.makeFunctionData = makeFunctionData
96
+
97
+ export default clearRecords
@@ -74,7 +74,9 @@ export const makeFunctionData = <
74
74
  * @example
75
75
  * import { createWalletClient, custom } from 'viem'
76
76
  * import { mainnet } from 'viem/chains'
77
- * import { addEnsContracts, commitName, randomSecret } from '@ensdomains/ensjs'
77
+ * import { addEnsContracts } from '@ensdomains/ensjs'
78
+ * import { commitName } from '@ensdomains/ensjs/wallet'
79
+ * import { randomSecret } from '@ensdomains/ensjs/utils'
78
80
  *
79
81
  * const wallet = createWalletClient({
80
82
  * chain: addEnsContracts(mainnet),
@@ -20,7 +20,7 @@ import type {
20
20
  SimpleTransactionRequest,
21
21
  WriteTransactionParameters,
22
22
  } from '../../types.js'
23
- import { encodeFuses, type CombinedFuseInput } from '../../utils/fuses.js'
23
+ import { encodeFuses, type EncodeFusesInputObject } from '../../utils/fuses.js'
24
24
  import { getNameType } from '../../utils/getNameType.js'
25
25
  import { makeLabelNodeAndParent } from '../../utils/makeLabelNodeAndParent.js'
26
26
  import {
@@ -41,7 +41,7 @@ type BaseCreateSubnameDataParameters = {
41
41
  /** Expiry to set (only on NameWrapper) */
42
42
  expiry?: AnyDate
43
43
  /** Fuses to set (only on NameWrapper) */
44
- fuses?: CombinedFuseInput
44
+ fuses?: EncodeFusesInputObject
45
45
  }
46
46
 
47
47
  type RegistryCreateSubnameDataParameters = {
@@ -53,7 +53,7 @@ type RegistryCreateSubnameDataParameters = {
53
53
  type NameWrapperCreateSubnameDataParameters = {
54
54
  contract: 'nameWrapper'
55
55
  expiry?: AnyDate
56
- fuses?: CombinedFuseInput
56
+ fuses?: EncodeFusesInputObject
57
57
  }
58
58
 
59
59
  export type CreateSubnameDataParameters = BaseCreateSubnameDataParameters &
@@ -119,7 +119,7 @@ export const makeFunctionData = <
119
119
  }
120
120
  case 'nameWrapper': {
121
121
  wrappedLabelLengthCheck(label)
122
- const generatedFuses = fuses ? encodeFuses(fuses) : 0
122
+ const generatedFuses = fuses ? encodeFuses({ input: fuses }) : 0
123
123
  const generatedExpiry = expiry ? expiryToBigInt(expiry) : MAX_EXPIRY
124
124
  return {
125
125
  to: getChainContractAddress({
@@ -158,7 +158,8 @@ export const makeFunctionData = <
158
158
  * @example
159
159
  * import { createWalletClient, custom } from 'viem'
160
160
  * import { mainnet } from 'viem/chains'
161
- * import { addEnsContracts, createSubname } from '@ensdomains/ensjs'
161
+ * import { addEnsContracts } from '@ensdomains/ensjs'
162
+ * import { createSubname } from '@ensdomains/ensjs/wallet'
162
163
  *
163
164
  * const wallet = createWalletClient({
164
165
  * chain: addEnsContracts(mainnet),
@@ -148,7 +148,8 @@ export const makeFunctionData = <
148
148
  * @example
149
149
  * import { createWalletClient, custom } from 'viem'
150
150
  * import { mainnet } from 'viem/chains'
151
- * import { addEnsContracts, deleteSubname } from '@ensdomains/ensjs'
151
+ * import { addEnsContracts } from '@ensdomains/ensjs'
152
+ * import { deleteSubname } from '@ensdomains/ensjs/wallet'
152
153
  *
153
154
  * const wallet = createWalletClient({
154
155
  * chain: mainnetWithEns,
@@ -82,7 +82,10 @@ export const makeFunctionData = <
82
82
  * @example
83
83
  * import { createPublicClient, createWalletClient, http, custom } from 'viem'
84
84
  * import { mainnet } from 'viem/chains'
85
- * import { addEnsContracts, commitName, randomSecret, getPrice, registerName } from '@ensdomains/ensjs'
85
+ * import { addEnsContracts } from '@ensdomains/ensjs'
86
+ * import { getPrice } from '@ensdomains/ensjs/public'
87
+ * import { randomSecret } from '@ensdomains/ensjs/utils'
88
+ * import { commitName, registerName } from '@ensdomains/ensjs/wallet'
86
89
  *
87
90
  * const mainnetWithEns = addEnsContracts(mainnet)
88
91
  * const client = createPublicClient({
@@ -99,7 +99,9 @@ export const makeFunctionData = <
99
99
  * @example
100
100
  * import { createPublicClient, createWalletClient, http, custom } from 'viem'
101
101
  * import { mainnet } from 'viem/chains'
102
- * import { addEnsContracts, renewNames, getPrice } from '@ensdomains/ensjs'
102
+ * import { addEnsContracts } from '@ensdomains/ensjs'
103
+ * import { getPrice } from '@ensdomains/ensjs/public'
104
+ * import { renewNames } from '@ensdomains/ensjs/wallet'
103
105
  *
104
106
  * const mainnetWithEns = addEnsContracts(mainnet)
105
107
  * const client = createPublicClient({
@@ -67,7 +67,9 @@ export const makeFunctionData = <
67
67
  * import abi from './abi.json'
68
68
  * import { createWalletClient, custom } from 'viem'
69
69
  * import { mainnet } from 'viem/chains'
70
- * import { addEnsContracts, encodeAbi, setAbiRecord } from '@ensdomains/ensjs'
70
+ * import { addEnsContracts } from '@ensdomains/ensjs'
71
+ * import { encodeAbi } from '@ensdomains/ensjs/utils'
72
+ * import { setAbiRecord } from '@ensdomains/ensjs/wallet'
71
73
  *
72
74
  * const wallet = createWalletClient({
73
75
  * chain: addEnsContracts(mainnet),
@@ -60,7 +60,8 @@ export const makeFunctionData = <
60
60
  * @example
61
61
  * import { createWalletClient, custom } from 'viem'
62
62
  * import { mainnet } from 'viem/chains'
63
- * import { addEnsContracts, setAddressRecord } from '@ensdomains/ensjs'
63
+ * import { addEnsContracts } from '@ensdomains/ensjs'
64
+ * import { setAddressRecord } from '@ensdomains/ensjs/wallet'
64
65
  *
65
66
  * const wallet = createWalletClient({
66
67
  * chain: addEnsContracts(mainnet),
@@ -14,14 +14,14 @@ import type {
14
14
  SimpleTransactionRequest,
15
15
  WriteTransactionParameters,
16
16
  } from '../../types.js'
17
- import { encodeFuses, type CombinedFuseInput } from '../../utils/fuses.js'
17
+ import { encodeFuses, type EncodeFusesInputObject } from '../../utils/fuses.js'
18
18
  import { namehash } from '../../utils/normalise.js'
19
19
 
20
20
  export type SetChildFusesDataParameters = {
21
21
  /** Name to set child fuses for */
22
22
  name: string
23
23
  /** Fuse object or number value to set to */
24
- fuses: Partial<CombinedFuseInput> | number
24
+ fuses: EncodeFusesInputObject
25
25
  /** Expiry to set for fuses */
26
26
  expiry?: number | bigint
27
27
  }
@@ -46,7 +46,7 @@ export const makeFunctionData = <
46
46
  wallet: WalletWithEns<Transport, TChain, TAccount>,
47
47
  { name, fuses, expiry }: SetChildFusesDataParameters,
48
48
  ): SetChildFusesDataReturnType => {
49
- const encodedFuses = encodeFuses(fuses)
49
+ const encodedFuses = encodeFuses({ input: fuses })
50
50
  const labels = name.split('.')
51
51
  const labelHash = labelhash(labels.shift()!)
52
52
  const parentNode = namehash(labels.join('.'))
@@ -69,7 +69,8 @@ export const makeFunctionData = <
69
69
  * @example
70
70
  * import { createWalletClient, custom } from 'viem'
71
71
  * import { mainnet } from 'viem/chains'
72
- * import { addEnsContracts, setChildFuses } from '@ensdomains/ensjs'
72
+ * import { addEnsContracts } from '@ensdomains/ensjs'
73
+ * import { setChildFuses } from '@ensdomains/ensjs/wallet'
73
74
  *
74
75
  * const wallet = createWalletClient({
75
76
  * chain: addEnsContracts(mainnet),
@@ -58,7 +58,8 @@ export const makeFunctionData = <
58
58
  * @example
59
59
  * import { createWalletClient, custom } from 'viem'
60
60
  * import { mainnet } from 'viem/chains'
61
- * import { addEnsContracts, setContentHashRecord } from '@ensdomains/ensjs'
61
+ * import { addEnsContracts } from '@ensdomains/ensjs'
62
+ * import { setContentHashRecord } from '@ensdomains/ensjs/wallet'
62
63
  *
63
64
  * const wallet = createWalletClient({
64
65
  * chain: addEnsContracts(mainnet),
@@ -13,14 +13,17 @@ import type {
13
13
  SimpleTransactionRequest,
14
14
  WriteTransactionParameters,
15
15
  } from '../../types.js'
16
- import { encodeFuses, type CombinedFuseInput } from '../../utils/fuses.js'
16
+ import {
17
+ encodeFuses,
18
+ type EncodeChildFusesInputObject,
19
+ } from '../../utils/fuses.js'
17
20
  import { namehash } from '../../utils/normalise.js'
18
21
 
19
22
  export type SetFusesDataParameters = {
20
23
  /** Name to set fuses for */
21
24
  name: string
22
25
  /** Fuse object to set to */
23
- fuses: Prettify<CombinedFuseInput['child']>
26
+ fuses: EncodeChildFusesInputObject
24
27
  }
25
28
 
26
29
  export type SetFusesDataReturnType = SimpleTransactionRequest
@@ -43,7 +46,7 @@ export const makeFunctionData = <
43
46
  wallet: WalletWithEns<Transport, TChain, TAccount>,
44
47
  { name, fuses }: SetFusesDataParameters,
45
48
  ): SetFusesDataReturnType => {
46
- const encodedFuses = encodeFuses(fuses, 'child')
49
+ const encodedFuses = encodeFuses({ restriction: 'child', input: fuses })
47
50
  return {
48
51
  to: getChainContractAddress({ client: wallet, contract: 'ensNameWrapper' }),
49
52
  data: encodeFunctionData({
@@ -63,7 +66,8 @@ export const makeFunctionData = <
63
66
  * @example
64
67
  * import { createWalletClient, custom } from 'viem'
65
68
  * import { mainnet } from 'viem/chains'
66
- * import { addEnsContracts, setFuses } from '@ensdomains/ensjs'
69
+ * import { addEnsContracts } from '@ensdomains/ensjs'
70
+ * import { setFuses } from '@ensdomains/ensjs/wallet'
67
71
  *
68
72
  * const wallet = createWalletClient({
69
73
  * chain: addEnsContracts(mainnet),
@@ -111,7 +111,8 @@ export const makeFunctionData = <
111
111
  * @example
112
112
  * import { createWalletClient, custom } from 'viem'
113
113
  * import { mainnet } from 'viem/chains'
114
- * import { addEnsContracts, setPrimaryName } from '@ensdomains/ensjs'
114
+ * import { addEnsContracts } from '@ensdomains/ensjs'
115
+ * import { setPrimaryName } from '@ensdomains/ensjs/wallet'
115
116
  *
116
117
  * const wallet = createWalletClient({
117
118
  * chain: addEnsContracts(mainnet),
@@ -76,7 +76,8 @@ export const makeFunctionData = <
76
76
  * @example
77
77
  * import { createWalletClient, custom } from 'viem'
78
78
  * import { mainnet } from 'viem/chains'
79
- * import { addEnsContracts, setRecords } from '@ensdomains/ensjs'
79
+ * import { addEnsContracts } from '@ensdomains/ensjs'
80
+ * import { setRecords } from '@ensdomains/ensjs/wallet'
80
81
  *
81
82
  * const wallet = createWalletClient({
82
83
  * chain: addEnsContracts(mainnet),
@@ -86,7 +86,8 @@ export const makeFunctionData = <
86
86
  * @example
87
87
  * import { createWalletClient, custom } from 'viem'
88
88
  * import { mainnet } from 'viem/chains'
89
- * import { addEnsContracts, setResolver } from '@ensdomains/ensjs'
89
+ * import { addEnsContracts } from '@ensdomains/ensjs'
90
+ * import { setResolver } from '@ensdomains/ensjs/wallet'
90
91
  *
91
92
  * const wallet = createWalletClient({
92
93
  * chain: addEnsContracts(mainnet),