@ensdomains/ensjs 3.0.0-beta.5 → 3.0.0-beta.6

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 (332) hide show
  1. package/dist/cjs/clients/decorators/wallet.js +2 -0
  2. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  3. package/dist/cjs/contracts/consts.js +1 -1
  4. package/dist/cjs/errors/version.js +1 -1
  5. package/dist/cjs/functions/dns/getDnsImportData.js.map +1 -1
  6. package/dist/cjs/functions/dns/importDnsName.js.map +1 -1
  7. package/dist/cjs/functions/public/_getAddr.js +15 -13
  8. package/dist/cjs/functions/public/_getAddr.js.map +1 -1
  9. package/dist/cjs/functions/public/batch.js.map +1 -1
  10. package/dist/cjs/functions/public/getAbiRecord.js.map +1 -1
  11. package/dist/cjs/functions/public/getAddressRecord.js.map +1 -1
  12. package/dist/cjs/functions/public/getAvailable.js.map +1 -1
  13. package/dist/cjs/functions/public/getContentHashRecord.js.map +1 -1
  14. package/dist/cjs/functions/public/getExpiry.js.map +1 -1
  15. package/dist/cjs/functions/public/getName.js.map +1 -1
  16. package/dist/cjs/functions/public/getOwner.js.map +1 -1
  17. package/dist/cjs/functions/public/getPrice.js.map +1 -1
  18. package/dist/cjs/functions/public/getRecords.js +51 -37
  19. package/dist/cjs/functions/public/getRecords.js.map +1 -1
  20. package/dist/cjs/functions/public/getResolver.js.map +1 -1
  21. package/dist/cjs/functions/public/getSupportedInterfaces.js.map +1 -1
  22. package/dist/cjs/functions/public/getTextRecord.js.map +1 -1
  23. package/dist/cjs/functions/public/getWrapperData.js.map +1 -1
  24. package/dist/cjs/functions/public/getWrapperName.js.map +1 -1
  25. package/dist/cjs/functions/subgraph/getDecodedName.js.map +1 -1
  26. package/dist/cjs/functions/subgraph/getNameHistory.js.map +1 -1
  27. package/dist/cjs/functions/subgraph/getNamesForAddress.js +17 -10
  28. package/dist/cjs/functions/subgraph/getNamesForAddress.js.map +1 -1
  29. package/dist/cjs/functions/subgraph/getSubgraphRecords.js +34 -26
  30. package/dist/cjs/functions/subgraph/getSubgraphRecords.js.map +1 -1
  31. package/dist/cjs/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  32. package/dist/cjs/functions/subgraph/getSubnames.js.map +1 -1
  33. package/dist/cjs/functions/wallet/clearRecords.js +26 -0
  34. package/dist/cjs/functions/wallet/clearRecords.js.map +1 -0
  35. package/dist/cjs/functions/wallet/commitName.js.map +1 -1
  36. package/dist/cjs/functions/wallet/createSubname.js.map +1 -1
  37. package/dist/cjs/functions/wallet/deleteSubname.js.map +1 -1
  38. package/dist/cjs/functions/wallet/registerName.js.map +1 -1
  39. package/dist/cjs/functions/wallet/renewNames.js.map +1 -1
  40. package/dist/cjs/functions/wallet/setAbiRecord.js.map +1 -1
  41. package/dist/cjs/functions/wallet/setAddressRecord.js.map +1 -1
  42. package/dist/cjs/functions/wallet/setChildFuses.js.map +1 -1
  43. package/dist/cjs/functions/wallet/setContentHashRecord.js.map +1 -1
  44. package/dist/cjs/functions/wallet/setFuses.js.map +1 -1
  45. package/dist/cjs/functions/wallet/setPrimaryName.js.map +1 -1
  46. package/dist/cjs/functions/wallet/setRecords.js.map +1 -1
  47. package/dist/cjs/functions/wallet/setResolver.js.map +1 -1
  48. package/dist/cjs/functions/wallet/setTextRecord.js.map +1 -1
  49. package/dist/cjs/functions/wallet/transferName.js.map +1 -1
  50. package/dist/cjs/functions/wallet/unwrapName.js.map +1 -1
  51. package/dist/cjs/functions/wallet/wrapName.js.map +1 -1
  52. package/dist/cjs/subgraph.js +4 -1
  53. package/dist/cjs/subgraph.js.map +1 -1
  54. package/dist/cjs/utils/contentHash.js +5 -3
  55. package/dist/cjs/utils/contentHash.js.map +1 -1
  56. package/dist/cjs/utils/encoders/encodeClearRecords.js +12 -0
  57. package/dist/cjs/utils/encoders/encodeClearRecords.js.map +1 -0
  58. package/dist/cjs/utils/fuses.js +12 -9
  59. package/dist/cjs/utils/fuses.js.map +1 -1
  60. package/dist/cjs/utils/generateRecordCallArray.js +2 -7
  61. package/dist/cjs/utils/generateRecordCallArray.js.map +1 -1
  62. package/dist/cjs/utils/index.js +9 -2
  63. package/dist/cjs/utils/index.js.map +1 -1
  64. package/dist/cjs/utils/normaliseCoinId.js +15 -0
  65. package/dist/cjs/utils/normaliseCoinId.js.map +1 -0
  66. package/dist/cjs/wallet.js +3 -1
  67. package/dist/cjs/wallet.js.map +1 -1
  68. package/dist/esm/clients/decorators/wallet.js +2 -0
  69. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  70. package/dist/esm/contracts/consts.js +1 -1
  71. package/dist/esm/errors/version.js +1 -1
  72. package/dist/esm/functions/dns/getDnsImportData.js +2 -1
  73. package/dist/esm/functions/dns/getDnsImportData.js.map +1 -1
  74. package/dist/esm/functions/dns/getDnsOwner.js +1 -1
  75. package/dist/esm/functions/dns/importDnsName.js +2 -1
  76. package/dist/esm/functions/dns/importDnsName.js.map +1 -1
  77. package/dist/esm/functions/public/_getAddr.js +15 -13
  78. package/dist/esm/functions/public/_getAddr.js.map +1 -1
  79. package/dist/esm/functions/public/batch.js +2 -1
  80. package/dist/esm/functions/public/batch.js.map +1 -1
  81. package/dist/esm/functions/public/getAbiRecord.js +2 -1
  82. package/dist/esm/functions/public/getAbiRecord.js.map +1 -1
  83. package/dist/esm/functions/public/getAddressRecord.js +2 -1
  84. package/dist/esm/functions/public/getAddressRecord.js.map +1 -1
  85. package/dist/esm/functions/public/getAvailable.js +2 -1
  86. package/dist/esm/functions/public/getAvailable.js.map +1 -1
  87. package/dist/esm/functions/public/getContentHashRecord.js +2 -1
  88. package/dist/esm/functions/public/getContentHashRecord.js.map +1 -1
  89. package/dist/esm/functions/public/getExpiry.js +2 -1
  90. package/dist/esm/functions/public/getExpiry.js.map +1 -1
  91. package/dist/esm/functions/public/getName.js +2 -1
  92. package/dist/esm/functions/public/getName.js.map +1 -1
  93. package/dist/esm/functions/public/getOwner.js +3 -2
  94. package/dist/esm/functions/public/getOwner.js.map +1 -1
  95. package/dist/esm/functions/public/getPrice.js +3 -2
  96. package/dist/esm/functions/public/getPrice.js.map +1 -1
  97. package/dist/esm/functions/public/getRecords.js +54 -39
  98. package/dist/esm/functions/public/getRecords.js.map +1 -1
  99. package/dist/esm/functions/public/getResolver.js +2 -1
  100. package/dist/esm/functions/public/getResolver.js.map +1 -1
  101. package/dist/esm/functions/public/getSupportedInterfaces.js +22 -0
  102. package/dist/esm/functions/public/getSupportedInterfaces.js.map +1 -1
  103. package/dist/esm/functions/public/getTextRecord.js +2 -1
  104. package/dist/esm/functions/public/getTextRecord.js.map +1 -1
  105. package/dist/esm/functions/public/getWrapperData.js +2 -1
  106. package/dist/esm/functions/public/getWrapperData.js.map +1 -1
  107. package/dist/esm/functions/public/getWrapperName.js +2 -1
  108. package/dist/esm/functions/public/getWrapperName.js.map +1 -1
  109. package/dist/esm/functions/subgraph/getDecodedName.js +2 -1
  110. package/dist/esm/functions/subgraph/getDecodedName.js.map +1 -1
  111. package/dist/esm/functions/subgraph/getNameHistory.js +2 -1
  112. package/dist/esm/functions/subgraph/getNameHistory.js.map +1 -1
  113. package/dist/esm/functions/subgraph/getNamesForAddress.js +21 -11
  114. package/dist/esm/functions/subgraph/getNamesForAddress.js.map +1 -1
  115. package/dist/esm/functions/subgraph/getSubgraphRecords.js +36 -27
  116. package/dist/esm/functions/subgraph/getSubgraphRecords.js.map +1 -1
  117. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js +2 -1
  118. package/dist/esm/functions/subgraph/getSubgraphRegistrant.js.map +1 -1
  119. package/dist/esm/functions/subgraph/getSubnames.js +2 -1
  120. package/dist/esm/functions/subgraph/getSubnames.js.map +1 -1
  121. package/dist/esm/functions/wallet/clearRecords.js +44 -0
  122. package/dist/esm/functions/wallet/clearRecords.js.map +1 -0
  123. package/dist/esm/functions/wallet/commitName.js +3 -1
  124. package/dist/esm/functions/wallet/commitName.js.map +1 -1
  125. package/dist/esm/functions/wallet/createSubname.js +2 -1
  126. package/dist/esm/functions/wallet/createSubname.js.map +1 -1
  127. package/dist/esm/functions/wallet/deleteSubname.js +2 -1
  128. package/dist/esm/functions/wallet/deleteSubname.js.map +1 -1
  129. package/dist/esm/functions/wallet/registerName.js +4 -1
  130. package/dist/esm/functions/wallet/registerName.js.map +1 -1
  131. package/dist/esm/functions/wallet/renewNames.js +3 -1
  132. package/dist/esm/functions/wallet/renewNames.js.map +1 -1
  133. package/dist/esm/functions/wallet/setAbiRecord.js +3 -1
  134. package/dist/esm/functions/wallet/setAbiRecord.js.map +1 -1
  135. package/dist/esm/functions/wallet/setAddressRecord.js +2 -1
  136. package/dist/esm/functions/wallet/setAddressRecord.js.map +1 -1
  137. package/dist/esm/functions/wallet/setChildFuses.js +2 -1
  138. package/dist/esm/functions/wallet/setChildFuses.js.map +1 -1
  139. package/dist/esm/functions/wallet/setContentHashRecord.js +2 -1
  140. package/dist/esm/functions/wallet/setContentHashRecord.js.map +1 -1
  141. package/dist/esm/functions/wallet/setFuses.js +2 -1
  142. package/dist/esm/functions/wallet/setFuses.js.map +1 -1
  143. package/dist/esm/functions/wallet/setPrimaryName.js +2 -1
  144. package/dist/esm/functions/wallet/setPrimaryName.js.map +1 -1
  145. package/dist/esm/functions/wallet/setRecords.js +2 -1
  146. package/dist/esm/functions/wallet/setRecords.js.map +1 -1
  147. package/dist/esm/functions/wallet/setResolver.js +2 -1
  148. package/dist/esm/functions/wallet/setResolver.js.map +1 -1
  149. package/dist/esm/functions/wallet/setTextRecord.js +2 -1
  150. package/dist/esm/functions/wallet/setTextRecord.js.map +1 -1
  151. package/dist/esm/functions/wallet/transferName.js +2 -1
  152. package/dist/esm/functions/wallet/transferName.js.map +1 -1
  153. package/dist/esm/functions/wallet/unwrapName.js +2 -1
  154. package/dist/esm/functions/wallet/unwrapName.js.map +1 -1
  155. package/dist/esm/functions/wallet/wrapName.js +2 -1
  156. package/dist/esm/functions/wallet/wrapName.js.map +1 -1
  157. package/dist/esm/subgraph.js +1 -0
  158. package/dist/esm/subgraph.js.map +1 -1
  159. package/dist/esm/utils/contentHash.js +2 -2
  160. package/dist/esm/utils/contentHash.js.map +1 -1
  161. package/dist/esm/utils/encoders/encodeClearRecords.js +8 -0
  162. package/dist/esm/utils/encoders/encodeClearRecords.js.map +1 -0
  163. package/dist/esm/utils/fuses.js +11 -8
  164. package/dist/esm/utils/fuses.js.map +1 -1
  165. package/dist/esm/utils/generateRecordCallArray.js +3 -7
  166. package/dist/esm/utils/generateRecordCallArray.js.map +1 -1
  167. package/dist/esm/utils/index.js +3 -2
  168. package/dist/esm/utils/index.js.map +1 -1
  169. package/dist/esm/utils/normaliseCoinId.js +11 -0
  170. package/dist/esm/utils/normaliseCoinId.js.map +1 -0
  171. package/dist/esm/wallet.js +1 -0
  172. package/dist/esm/wallet.js.map +1 -1
  173. package/dist/types/clients/decorators/wallet.d.ts +28 -3
  174. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  175. package/dist/types/clients/wallet.d.ts +10 -0
  176. package/dist/types/clients/wallet.d.ts.map +1 -1
  177. package/dist/types/contracts/consts.d.ts +1 -1
  178. package/dist/types/errors/version.d.ts +1 -1
  179. package/dist/types/functions/dns/getDnsImportData.d.ts +2 -1
  180. package/dist/types/functions/dns/getDnsImportData.d.ts.map +1 -1
  181. package/dist/types/functions/dns/getDnsOwner.d.ts +1 -1
  182. package/dist/types/functions/dns/importDnsName.d.ts +2 -1
  183. package/dist/types/functions/dns/importDnsName.d.ts.map +1 -1
  184. package/dist/types/functions/public/_getAddr.d.ts.map +1 -1
  185. package/dist/types/functions/public/batch.d.ts +2 -1
  186. package/dist/types/functions/public/batch.d.ts.map +1 -1
  187. package/dist/types/functions/public/getAbiRecord.d.ts +2 -1
  188. package/dist/types/functions/public/getAbiRecord.d.ts.map +1 -1
  189. package/dist/types/functions/public/getAddressRecord.d.ts +2 -1
  190. package/dist/types/functions/public/getAddressRecord.d.ts.map +1 -1
  191. package/dist/types/functions/public/getAvailable.d.ts +2 -1
  192. package/dist/types/functions/public/getAvailable.d.ts.map +1 -1
  193. package/dist/types/functions/public/getContentHashRecord.d.ts +2 -1
  194. package/dist/types/functions/public/getContentHashRecord.d.ts.map +1 -1
  195. package/dist/types/functions/public/getExpiry.d.ts +2 -1
  196. package/dist/types/functions/public/getExpiry.d.ts.map +1 -1
  197. package/dist/types/functions/public/getName.d.ts +2 -1
  198. package/dist/types/functions/public/getName.d.ts.map +1 -1
  199. package/dist/types/functions/public/getOwner.d.ts +19 -9
  200. package/dist/types/functions/public/getOwner.d.ts.map +1 -1
  201. package/dist/types/functions/public/getPrice.d.ts +3 -2
  202. package/dist/types/functions/public/getPrice.d.ts.map +1 -1
  203. package/dist/types/functions/public/getRecords.d.ts +3 -2
  204. package/dist/types/functions/public/getRecords.d.ts.map +1 -1
  205. package/dist/types/functions/public/getResolver.d.ts +2 -1
  206. package/dist/types/functions/public/getResolver.d.ts.map +1 -1
  207. package/dist/types/functions/public/getSupportedInterfaces.d.ts +22 -0
  208. package/dist/types/functions/public/getSupportedInterfaces.d.ts.map +1 -1
  209. package/dist/types/functions/public/getTextRecord.d.ts +2 -1
  210. package/dist/types/functions/public/getTextRecord.d.ts.map +1 -1
  211. package/dist/types/functions/public/getWrapperData.d.ts +2 -1
  212. package/dist/types/functions/public/getWrapperData.d.ts.map +1 -1
  213. package/dist/types/functions/public/getWrapperName.d.ts +2 -1
  214. package/dist/types/functions/public/getWrapperName.d.ts.map +1 -1
  215. package/dist/types/functions/subgraph/getDecodedName.d.ts +2 -1
  216. package/dist/types/functions/subgraph/getDecodedName.d.ts.map +1 -1
  217. package/dist/types/functions/subgraph/getNameHistory.d.ts +2 -1
  218. package/dist/types/functions/subgraph/getNameHistory.d.ts.map +1 -1
  219. package/dist/types/functions/subgraph/getNamesForAddress.d.ts +5 -2
  220. package/dist/types/functions/subgraph/getNamesForAddress.d.ts.map +1 -1
  221. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts +2 -1
  222. package/dist/types/functions/subgraph/getSubgraphRecords.d.ts.map +1 -1
  223. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts +2 -1
  224. package/dist/types/functions/subgraph/getSubgraphRegistrant.d.ts.map +1 -1
  225. package/dist/types/functions/subgraph/getSubnames.d.ts +2 -1
  226. package/dist/types/functions/subgraph/getSubnames.d.ts.map +1 -1
  227. package/dist/types/functions/wallet/clearRecords.d.ts +552 -0
  228. package/dist/types/functions/wallet/clearRecords.d.ts.map +1 -0
  229. package/dist/types/functions/wallet/commitName.d.ts +3 -1
  230. package/dist/types/functions/wallet/commitName.d.ts.map +1 -1
  231. package/dist/types/functions/wallet/createSubname.d.ts +2 -1
  232. package/dist/types/functions/wallet/createSubname.d.ts.map +1 -1
  233. package/dist/types/functions/wallet/deleteSubname.d.ts +2 -1
  234. package/dist/types/functions/wallet/deleteSubname.d.ts.map +1 -1
  235. package/dist/types/functions/wallet/registerName.d.ts +4 -1
  236. package/dist/types/functions/wallet/registerName.d.ts.map +1 -1
  237. package/dist/types/functions/wallet/renewNames.d.ts +3 -1
  238. package/dist/types/functions/wallet/renewNames.d.ts.map +1 -1
  239. package/dist/types/functions/wallet/setAbiRecord.d.ts +3 -1
  240. package/dist/types/functions/wallet/setAbiRecord.d.ts.map +1 -1
  241. package/dist/types/functions/wallet/setAddressRecord.d.ts +2 -1
  242. package/dist/types/functions/wallet/setAddressRecord.d.ts.map +1 -1
  243. package/dist/types/functions/wallet/setChildFuses.d.ts +2 -1
  244. package/dist/types/functions/wallet/setChildFuses.d.ts.map +1 -1
  245. package/dist/types/functions/wallet/setContentHashRecord.d.ts +2 -1
  246. package/dist/types/functions/wallet/setContentHashRecord.d.ts.map +1 -1
  247. package/dist/types/functions/wallet/setFuses.d.ts +2 -1
  248. package/dist/types/functions/wallet/setFuses.d.ts.map +1 -1
  249. package/dist/types/functions/wallet/setPrimaryName.d.ts +2 -1
  250. package/dist/types/functions/wallet/setPrimaryName.d.ts.map +1 -1
  251. package/dist/types/functions/wallet/setRecords.d.ts +2 -1
  252. package/dist/types/functions/wallet/setRecords.d.ts.map +1 -1
  253. package/dist/types/functions/wallet/setResolver.d.ts +2 -1
  254. package/dist/types/functions/wallet/setResolver.d.ts.map +1 -1
  255. package/dist/types/functions/wallet/setTextRecord.d.ts +2 -1
  256. package/dist/types/functions/wallet/setTextRecord.d.ts.map +1 -1
  257. package/dist/types/functions/wallet/transferName.d.ts +2 -1
  258. package/dist/types/functions/wallet/transferName.d.ts.map +1 -1
  259. package/dist/types/functions/wallet/unwrapName.d.ts +2 -1
  260. package/dist/types/functions/wallet/unwrapName.d.ts.map +1 -1
  261. package/dist/types/functions/wallet/wrapName.d.ts +2 -1
  262. package/dist/types/functions/wallet/wrapName.d.ts.map +1 -1
  263. package/dist/types/subgraph.d.ts +1 -0
  264. package/dist/types/subgraph.d.ts.map +1 -1
  265. package/dist/types/utils/contentHash.d.ts +3 -0
  266. package/dist/types/utils/contentHash.d.ts.map +1 -1
  267. package/dist/types/utils/encoders/encodeClearRecords.d.ts +3 -0
  268. package/dist/types/utils/encoders/encodeClearRecords.d.ts.map +1 -0
  269. package/dist/types/utils/fuses.d.ts +16 -16
  270. package/dist/types/utils/fuses.d.ts.map +1 -1
  271. package/dist/types/utils/generateRecordCallArray.d.ts.map +1 -1
  272. package/dist/types/utils/index.d.ts +3 -2
  273. package/dist/types/utils/index.d.ts.map +1 -1
  274. package/dist/types/utils/normaliseCoinId.d.ts +8 -0
  275. package/dist/types/utils/normaliseCoinId.d.ts.map +1 -0
  276. package/dist/types/wallet.d.ts +1 -0
  277. package/dist/types/wallet.d.ts.map +1 -1
  278. package/package.json +1 -1
  279. package/src/clients/decorators/wallet.ts +41 -3
  280. package/src/contracts/consts.ts +1 -1
  281. package/src/errors/version.ts +1 -1
  282. package/src/functions/dns/getDnsImportData.ts +2 -1
  283. package/src/functions/dns/getDnsOwner.ts +1 -1
  284. package/src/functions/dns/importDnsName.ts +2 -1
  285. package/src/functions/public/_getAddr.ts +21 -13
  286. package/src/functions/public/batch.ts +2 -1
  287. package/src/functions/public/getAbiRecord.ts +2 -1
  288. package/src/functions/public/getAddressRecord.ts +2 -1
  289. package/src/functions/public/getAvailable.ts +2 -1
  290. package/src/functions/public/getContentHashRecord.ts +2 -1
  291. package/src/functions/public/getExpiry.ts +2 -1
  292. package/src/functions/public/getName.ts +2 -1
  293. package/src/functions/public/getOwner.ts +54 -33
  294. package/src/functions/public/getPrice.ts +3 -2
  295. package/src/functions/public/getRecords.ts +124 -104
  296. package/src/functions/public/getResolver.ts +2 -1
  297. package/src/functions/public/getSupportedInterfaces.ts +22 -0
  298. package/src/functions/public/getTextRecord.ts +2 -1
  299. package/src/functions/public/getWrapperData.ts +2 -1
  300. package/src/functions/public/getWrapperName.ts +2 -1
  301. package/src/functions/subgraph/getDecodedName.ts +2 -1
  302. package/src/functions/subgraph/getNameHistory.ts +2 -1
  303. package/src/functions/subgraph/getNamesForAddress.ts +31 -11
  304. package/src/functions/subgraph/getSubgraphRecords.ts +65 -33
  305. package/src/functions/subgraph/getSubgraphRegistrant.ts +2 -1
  306. package/src/functions/subgraph/getSubnames.ts +2 -1
  307. package/src/functions/wallet/clearRecords.ts +97 -0
  308. package/src/functions/wallet/commitName.ts +3 -1
  309. package/src/functions/wallet/createSubname.ts +2 -1
  310. package/src/functions/wallet/deleteSubname.ts +2 -1
  311. package/src/functions/wallet/registerName.ts +4 -1
  312. package/src/functions/wallet/renewNames.ts +3 -1
  313. package/src/functions/wallet/setAbiRecord.ts +3 -1
  314. package/src/functions/wallet/setAddressRecord.ts +2 -1
  315. package/src/functions/wallet/setChildFuses.ts +2 -1
  316. package/src/functions/wallet/setContentHashRecord.ts +2 -1
  317. package/src/functions/wallet/setFuses.ts +2 -1
  318. package/src/functions/wallet/setPrimaryName.ts +2 -1
  319. package/src/functions/wallet/setRecords.ts +2 -1
  320. package/src/functions/wallet/setResolver.ts +2 -1
  321. package/src/functions/wallet/setTextRecord.ts +2 -1
  322. package/src/functions/wallet/transferName.ts +2 -1
  323. package/src/functions/wallet/unwrapName.ts +2 -1
  324. package/src/functions/wallet/wrapName.ts +2 -1
  325. package/src/subgraph.ts +5 -0
  326. package/src/utils/contentHash.ts +2 -2
  327. package/src/utils/encoders/encodeClearRecords.ts +9 -0
  328. package/src/utils/fuses.ts +27 -23
  329. package/src/utils/generateRecordCallArray.ts +3 -9
  330. package/src/utils/index.ts +9 -0
  331. package/src/utils/normaliseCoinId.ts +11 -0
  332. package/src/wallet.ts +7 -0
@@ -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)[] = []
@@ -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),
@@ -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),
@@ -81,6 +81,28 @@ type BatchableFunctionObject = {
81
81
  }
82
82
  }
83
83
 
84
+ /**
85
+ * Gets the supported interfaces for any contract address.
86
+ * @param client - {@link ClientWithEns}
87
+ * @param parameters - {@link GetSupportedInterfacesParameters}
88
+ * @returns Array of booleans matching the input array {@link GetSupportedInterfacesReturnType}
89
+ *
90
+ * @example
91
+ * import { createPublicClient, http } from 'viem'
92
+ * import { mainnet } from 'viem/chains'
93
+ * import { addEnsContracts } from '@ensdomains/ensjs'
94
+ * import { getSupportedInterfaces } from '@ensdomains/ensjs/public'
95
+ *
96
+ * const client = createPublicClient({
97
+ * chain: addEnsContracts(mainnet),
98
+ * transport: http(),
99
+ * })
100
+ * const result = await getSupportedInterfaces(client, {
101
+ * address: '0x58774Bb8acD458A640aF0B88238369A167546ef2',
102
+ * interfaces: ['0x2f435428', '0x23b872dd'],
103
+ * })
104
+ * // [true, false]
105
+ */
84
106
  const getSupportedInterfaces = generateFunction({ encode, decode }) as (<
85
107
  const TInterfaces extends readonly Hex[],
86
108
  >(
@@ -47,7 +47,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
47
47
  * @example
48
48
  * import { createPublicClient, http } from 'viem'
49
49
  * import { mainnet } from 'viem/chains'
50
- * import { addEnsContracts, getTextRecord } from '@ensdomains/ensjs'
50
+ * import { addEnsContracts } from '@ensdomains/ensjs'
51
+ * import { getTextRecord } from '@ensdomains/ensjs/public'
51
52
  *
52
53
  * const client = createPublicClient({
53
54
  * chain: addEnsContracts(mainnet),
@@ -111,7 +111,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
111
111
  * @example
112
112
  * import { createPublicClient, http } from 'viem'
113
113
  * import { mainnet } from 'viem/chains'
114
- * import { addEnsContracts, getWrapperData } from '@ensdomains/ensjs'
114
+ * import { addEnsContracts } from '@ensdomains/ensjs'
115
+ * import { getWrapperData } from '@ensdomains/ensjs/public'
115
116
  *
116
117
  * const client = createPublicClient({
117
118
  * chain: addEnsContracts(mainnet),
@@ -79,7 +79,8 @@ type BatchableFunctionObject = GeneratedFunction<typeof encode, typeof decode>
79
79
  * @example
80
80
  * import { createPublicClient, http } from 'viem'
81
81
  * import { mainnet } from 'viem/chains'
82
- * import { addEnsContracts, getWrapperName } from '@ensdomains/ensjs'
82
+ * import { addEnsContracts } from '@ensdomains/ensjs'
83
+ * import { getWrapperName } from '@ensdomains/ensjs/public'
83
84
  *
84
85
  * const client = createPublicClient({
85
86
  * chain: addEnsContracts(mainnet),
@@ -32,7 +32,8 @@ type SubgraphResult = {
32
32
  * @example
33
33
  * import { createPublicClient, http } from 'viem'
34
34
  * import { mainnet } from 'viem/chains'
35
- * import { addEnsContracts, getDecodedName } from '@ensdomains/ensjs'
35
+ * import { addEnsContracts } from '@ensdomains/ensjs'
36
+ * import { getDecodedName } from '@ensdomains/ensjs/subgraph'
36
37
  *
37
38
  * const client = createPublicClient({
38
39
  * chain: addEnsContracts(mainnet),
@@ -71,7 +71,8 @@ export type GetNameHistoryReturnType = {
71
71
  * @example
72
72
  * import { createPublicClient, http } from 'viem'
73
73
  * import { mainnet } from 'viem/chains'
74
- * import { addEnsContracts, getNameHistory } from '@ensdomains/ensjs'
74
+ * import { addEnsContracts } from '@ensdomains/ensjs'
75
+ * import { getNameHistory } from '@ensdomains/ensjs/subgraph'
75
76
  *
76
77
  * const client = createPublicClient({
77
78
  * chain: addEnsContracts(mainnet),
@@ -43,6 +43,8 @@ type GetNamesForAddressRelation = {
43
43
  }
44
44
 
45
45
  type GetNamesForAddressFilter = GetNamesForAddressRelation & {
46
+ /** Search string filter for subname label */
47
+ searchString?: string
46
48
  /** Allows expired names to be included (default: false) */
47
49
  allowExpired?: boolean
48
50
  /** Allows reverse record nodes to be included (default: false) */
@@ -149,7 +151,8 @@ const getOrderByFilter = ({
149
151
  * @example
150
152
  * import { createPublicClient, http } from 'viem'
151
153
  * import { mainnet } from 'viem/chains'
152
- * import { addEnsContracts, getNamesForAddress } from '@ensdomains/ensjs'
154
+ * import { addEnsContracts } from '@ensdomains/ensjs'
155
+ * import { getNamesForAddress } from '@ensdomains/ensjs/subgraph'
153
156
  *
154
157
  * const client = createPublicClient({
155
158
  * chain: addEnsContracts(mainnet),
@@ -161,24 +164,33 @@ const getNamesForAddress = async (
161
164
  client: ClientWithEns,
162
165
  {
163
166
  address,
164
- filter = {
165
- owner: true,
166
- registrant: true,
167
- resolvedAddress: true,
168
- wrappedOwner: true,
169
- allowExpired: false,
170
- allowDeleted: false,
171
- allowReverseRecord: false,
172
- },
167
+ filter: _filter,
173
168
  orderBy = 'name',
174
169
  orderDirection = 'asc',
175
170
  pageSize = 100,
176
171
  previousPage,
177
172
  }: GetNamesForAddressParameters,
178
173
  ): Promise<GetNamesForAddressReturnType> => {
174
+ const filter = {
175
+ owner: true,
176
+ registrant: true,
177
+ resolvedAddress: true,
178
+ wrappedOwner: true,
179
+ allowExpired: false,
180
+ allowDeleted: false,
181
+ allowReverseRecord: false,
182
+ ..._filter,
183
+ }
184
+
179
185
  const subgraphClient = createSubgraphClient({ client })
180
186
 
181
- const { allowExpired, allowDeleted, allowReverseRecord, ...filters } = filter
187
+ const {
188
+ allowExpired,
189
+ allowDeleted,
190
+ allowReverseRecord,
191
+ searchString,
192
+ ...filters
193
+ } = filter
182
194
  const ownerWhereFilters: DomainFilter[] = Object.entries(filters).reduce(
183
195
  (prev, [key, value]) => {
184
196
  if (value) {
@@ -268,6 +280,14 @@ const getNamesForAddress = async (
268
280
  })
269
281
  }
270
282
 
283
+ if (searchString) {
284
+ // using labelName_contains instead of name_contains because name_contains
285
+ // includes the parent name
286
+ whereFilters.push({
287
+ labelName_contains: searchString,
288
+ })
289
+ }
290
+
271
291
  const whereFilter: DomainFilter =
272
292
  whereFilters.length > 1 ? { and: whereFilters } : whereFilters[0]
273
293
 
@@ -1,5 +1,6 @@
1
+ import type { GraphQLClient } from 'graphql-request'
1
2
  import { gql } from 'graphql-request'
2
- import type { Address } from 'viem'
3
+ import type { Address, Hex } from 'viem'
3
4
  import type { ClientWithEns } from '../../contracts/consts.js'
4
5
  import type { DateWithValue } from '../../types.js'
5
6
  import { namehash } from '../../utils/normalise.js'
@@ -73,6 +74,59 @@ type CustomResolverSubgraphResult = {
73
74
  resolver?: ResolverResult
74
75
  }
75
76
 
77
+ type GetResolverResultReturnType = {
78
+ domain: DomainResult
79
+ resolver: ResolverResult | undefined
80
+ } | null
81
+
82
+ const getCustomResolverResult = async (
83
+ subgraphClient: GraphQLClient,
84
+ {
85
+ id,
86
+ resolverAddress,
87
+ }: {
88
+ id: Hex
89
+ resolverAddress: Address
90
+ },
91
+ ): Promise<GetResolverResultReturnType> => {
92
+ const resolverId = `${resolverAddress.toLowerCase()}-${id}`
93
+ const response = await subgraphClient.request<CustomResolverSubgraphResult>(
94
+ customResolverQuery,
95
+ {
96
+ id,
97
+ resolverId,
98
+ },
99
+ )
100
+ if (!response || !response.domain) return null
101
+ return {
102
+ domain: response.domain,
103
+ resolver: response.resolver,
104
+ }
105
+ }
106
+
107
+ const getInheritedResolverResult = async (
108
+ subgraphClient: GraphQLClient,
109
+ {
110
+ id,
111
+ }: {
112
+ id: Hex
113
+ },
114
+ ): Promise<GetResolverResultReturnType> => {
115
+ const response =
116
+ await subgraphClient.request<InheritedResolverSubgraphResult>(
117
+ inheritedResolverQuery,
118
+ {
119
+ id,
120
+ },
121
+ )
122
+ if (!response || !response.domain) return null
123
+ const { resolver, ...domain } = response.domain
124
+ return {
125
+ domain,
126
+ resolver,
127
+ }
128
+ }
129
+
76
130
  /**
77
131
  * Gets the records for a name from the subgraph
78
132
  * @param client - {@link ClientWithEns}
@@ -82,7 +136,8 @@ type CustomResolverSubgraphResult = {
82
136
  * @example
83
137
  * import { createPublicClient, http } from 'viem'
84
138
  * import { mainnet } from 'viem/chains'
85
- * import { addEnsContracts, getSubgraphRecords } from '@ensdomains/ensjs'
139
+ * import { addEnsContracts } from '@ensdomains/ensjs'
140
+ * import { getSubgraphRecords } from '@ensdomains/ensjs/subgraph'
86
141
  *
87
142
  * const client = createPublicClient({
88
143
  * chain: addEnsContracts(mainnet),
@@ -103,39 +158,16 @@ const getSubgraphRecords = async (
103
158
  const subgraphClient = createSubgraphClient({ client })
104
159
  const id = namehash(name)
105
160
 
106
- let domainResult: DomainResult
107
- let resolverResult: ResolverResult | undefined
108
-
109
- if (resolverAddress) {
110
- const resolverId = `${resolverAddress.toLowerCase()}-${id}`
111
- const response = await subgraphClient.request<CustomResolverSubgraphResult>(
112
- customResolverQuery,
113
- {
114
- id,
115
- resolverId,
116
- },
117
- )
118
- if (!response || !response.domain) return null
119
- domainResult = response.domain
120
- resolverResult = response.resolver
121
- } else {
122
- const response =
123
- await subgraphClient.request<InheritedResolverSubgraphResult>(
124
- inheritedResolverQuery,
125
- {
126
- id,
127
- },
128
- )
129
- if (!response || !response.domain) return null
130
- const { resolver, ...domain_ } = response.domain
131
- resolverResult = resolver
132
- domainResult = domain_
133
- }
161
+ const result = resolverAddress
162
+ ? await getCustomResolverResult(subgraphClient, { id, resolverAddress })
163
+ : await getInheritedResolverResult(subgraphClient, { id })
164
+ if (!result) return null
165
+ const { domain, resolver } = result
134
166
 
135
- const { isMigrated, createdAt: stringCreatedAt } = domainResult
167
+ const { isMigrated, createdAt: stringCreatedAt } = domain
136
168
  const intCreatedAt = parseInt(stringCreatedAt) * 1000
137
- const texts = resolverResult?.texts || []
138
- const coins = resolverResult?.coinTypes || []
169
+ const texts = resolver?.texts || []
170
+ const coins = resolver?.coinTypes || []
139
171
 
140
172
  return {
141
173
  isMigrated,
@@ -39,7 +39,8 @@ type SubgraphResult = {
39
39
  * @example
40
40
  * import { createPublicClient, http } from 'viem'
41
41
  * import { mainnet } from 'viem/chains'
42
- * import { addEnsContracts, getSubgraphRegistrant } from '@ensdomains/ensjs'
42
+ * import { addEnsContracts } from '@ensdomains/ensjs'
43
+ * import { getSubgraphRegistrant } from '@ensdomains/ensjs/subgraph'
43
44
  *
44
45
  * const client = createPublicClient({
45
46
  * chain: addEnsContracts(mainnet),
@@ -117,7 +117,8 @@ const getOrderByFilter = ({
117
117
  * @example
118
118
  * import { createPublicClient, http } from 'viem'
119
119
  * import { mainnet } from 'viem/chains'
120
- * import { addEnsContracts, getSubnames } from '@ensdomains/ensjs'
120
+ * import { addEnsContracts } from '@ensdomains/ensjs'
121
+ * import { getSubnames } from '@ensdomains/ensjs/subgraph'
121
122
  *
122
123
  * const client = createPublicClient({
123
124
  * chain: addEnsContracts(mainnet),