diff --git a/packages/ensjs/package.json b/packages/ensjs/package.json index cabf66db..616155e8 100644 --- a/packages/ensjs/package.json +++ b/packages/ensjs/package.json @@ -99,10 +99,9 @@ "dependencies": { "@adraffy/ens-normalize": "1.9.0", "@ensdomains/address-encoder": "1.0.0-rc.2", - "@ensdomains/content-hash": "^3.0.0-beta.5", - "@ensdomains/dnsprovejs": "^0.4.1", + "@ensdomains/content-hash": "3.1.0-rc.0", + "@ensdomains/dnsprovejs": "^0.5.0", "abitype": "^0.8.0", - "cbor": "^8.1.0", "dns-packet": "^5.3.1", "graphql": "^16.3.0", "graphql-request": "6.1.0", @@ -123,6 +122,7 @@ "@types/jest": "^27.4.1", "@types/node": "^20.3.3", "@types/pako": "^2.0.0", + "cbor": "^8.1.0", "@types/traverse": "^0.6.32", "dotenv": "^16.0.0", "esbuild": "^0.15.6", diff --git a/packages/ensjs/src/functions/public/_getAbi.ts b/packages/ensjs/src/functions/public/_getAbi.ts index 7c3e655d..be0b55fe 100644 --- a/packages/ensjs/src/functions/public/_getAbi.ts +++ b/packages/ensjs/src/functions/public/_getAbi.ts @@ -84,8 +84,8 @@ const decode = async ( } // CBOR case 4: { - const { decodeFirst } = await import('cbor') - abiData = await decodeFirst(hexToBytes(encodedAbiData)) + const { cborDecode } = await import('@ensdomains/address-encoder/utils') + abiData = await cborDecode(hexToBytes(encodedAbiData).buffer) decoded = true break } diff --git a/packages/ensjs/src/utils/encoders/encodeAbi.ts b/packages/ensjs/src/utils/encoders/encodeAbi.ts index 35f3d1f2..2cd13c3e 100644 --- a/packages/ensjs/src/utils/encoders/encodeAbi.ts +++ b/packages/ensjs/src/utils/encoders/encodeAbi.ts @@ -86,8 +86,8 @@ export const encodeAbi = async < } case 'cbor': { contentType = 4 - const { encode } = await import('cbor') - encodedData = bytesToHex(encode(data)) + const { cborEncode } = await import('@ensdomains/address-encoder/utils') + encodedData = bytesToHex(new Uint8Array(cborEncode(data))) break } default: { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3cfa9c31..01e296e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -100,8 +100,8 @@ importers: '@adraffy/ens-normalize': 1.9.0 '@ensdomains/address-encoder': 1.0.0-rc.2 '@ensdomains/buffer': ^0.0.13 - '@ensdomains/content-hash': ^3.0.0-beta.5 - '@ensdomains/dnsprovejs': ^0.4.1 + '@ensdomains/content-hash': 3.1.0-rc.0 + '@ensdomains/dnsprovejs': ^0.5.0 '@ensdomains/ens-contracts': 0.0.22 '@ensdomains/ens-test-env': workspace:* '@nomiclabs/hardhat-ethers': npm:hardhat-deploy-ethers@0.3.0-beta.13 @@ -146,10 +146,9 @@ importers: dependencies: '@adraffy/ens-normalize': 1.9.0 '@ensdomains/address-encoder': 1.0.0-rc.2 - '@ensdomains/content-hash': 3.0.0-beta.5 - '@ensdomains/dnsprovejs': 0.4.1 + '@ensdomains/content-hash': 3.1.0-rc.0 + '@ensdomains/dnsprovejs': 0.5.0 abitype: 0.8.0_typescript@5.1.6 - cbor: 8.1.0 dns-packet: 5.4.0 graphql: 16.6.0 graphql-request: 6.1.0_graphql@16.6.0 @@ -170,6 +169,7 @@ importers: '@types/node': 20.3.3 '@types/pako': 2.0.0 '@types/traverse': 0.6.32 + cbor: 8.1.0 dotenv: 16.0.1 esbuild: 0.15.6 eslint-plugin-jest: 27.0.1_tiloc3ejst55n76oty5rbi22ra @@ -638,18 +638,20 @@ packages: resolution: {integrity: sha512-92SfSiNS8XorgU7OUBHo/i1ZU7JV7iz/6bKuLPNVsMxV79/eI7fJR6jfJJc40zAHjs3ha+Xo965Idomlq3rqnw==} dev: true - /@ensdomains/content-hash/3.0.0-beta.5: - resolution: {integrity: sha512-mvc3hqYc29PpBg0y7wiNVwa1lIAzTTUR/vMBEYgkcopNhDL6bONQK/BPOvg0ma9YRYqleevfjAfOQefR0rHUdg==} + /@ensdomains/content-hash/3.1.0-rc.0: + resolution: {integrity: sha512-TK+ug8axECoT6sEMhgD9EhpLAFEqGM1UpvGLVapXYqt+VhBSDpUrg5udP9G0irRFBGsHZItYSJTnBHuy4EpmQg==} dependencies: - '@multiformats/sha3': 2.0.17 - multiformats: 12.0.1 + '@ensdomains/address-encoder': 1.0.0-rc.2 + '@noble/curves': 1.2.0 + '@scure/base': 1.1.3 dev: false - /@ensdomains/dnsprovejs/0.4.1: - resolution: {integrity: sha512-q1SiQeuV3dzYt4yS5/Ig1AIKEXqzLpI6RV/tvSdirKg0Y8VdsEag9gpKXu+SoTzmaXT8J+mB0ZPwrV5gb/SbaA==} + /@ensdomains/dnsprovejs/0.5.0: + resolution: {integrity: sha512-JbiS0w7CsYENsVLfnKliI/ppDAodWXk95RCjSCfc2LP7hNesQc/QYnHdBnlh19RXyiDmvenItdy4yj+UHYBqwg==} + engines: {node: '>=16.8'} dependencies: - dns-packet: 5.4.0 - ethereumjs-util: 7.1.5 + '@noble/hashes': 1.3.2 + dns-packet: 5.6.1 typescript-logging: 1.0.1 dev: false @@ -1515,13 +1517,6 @@ packages: tweetnacl-util: 0.15.1 dev: true - /@multiformats/sha3/2.0.17: - resolution: {integrity: sha512-7ik6pk178qLO2cpNucgf48UnAOBMkq/2H92DP4SprZOJqM9zqbVaKS7XyYW6UvhRsDJ3wi921fYv1ihTtQHLtA==} - dependencies: - js-sha3: 0.8.0 - multiformats: 9.7.1 - dev: false - /@noble/curves/1.0.0: resolution: {integrity: sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw==} dependencies: @@ -2481,6 +2476,7 @@ packages: resolution: {integrity: sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==} dependencies: '@types/node': 20.3.3 + dev: true /@types/prettier/2.7.0: resolution: {integrity: sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==} @@ -2506,6 +2502,7 @@ packages: resolution: {integrity: sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==} dependencies: '@types/node': 20.3.3 + dev: true /@types/seedrandom/3.0.1: resolution: {integrity: sha512-giB9gzDeiCeloIXDgzFBCgjj1k4WxcDrZtGl6h1IqmUPlxF+Nx8Ve+96QCyDZ/HseB/uvDsKbpib9hU5cU53pw==} @@ -3149,6 +3146,7 @@ packages: resolution: {integrity: sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==} dependencies: safe-buffer: 5.2.1 + dev: true /base64-js/1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -3204,6 +3202,7 @@ packages: /blakejs/1.2.1: resolution: {integrity: sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==} + dev: true /bluebird/3.7.2: resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} @@ -3288,6 +3287,7 @@ packages: evp_bytestokey: 1.0.3 inherits: 2.0.4 safe-buffer: 5.2.1 + dev: true /browserify-cipher/1.0.1: resolution: {integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==} @@ -3349,6 +3349,7 @@ packages: resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} dependencies: base-x: 3.0.9 + dev: true /bs58check/2.1.2: resolution: {integrity: sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==} @@ -3356,6 +3357,7 @@ packages: bs58: 4.0.1 create-hash: 1.2.0 safe-buffer: 5.2.1 + dev: true /bser/2.1.1: resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} @@ -3373,6 +3375,7 @@ packages: /buffer-xor/1.0.3: resolution: {integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==} + dev: true /buffer/5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} @@ -3513,7 +3516,7 @@ packages: engines: {node: '>=12.19'} dependencies: nofilter: 3.1.0 - dev: false + dev: true /chai-bn/0.2.2_chai@4.3.6: resolution: {integrity: sha512-MzjelH0p8vWn65QKmEq/DLBG1Hle4WeyqT79ANhXZhn/UxRWO0OogkAxi5oGGtfzwU9bZR8mvbvYdoqNVWQwFg==} @@ -3652,6 +3655,7 @@ packages: dependencies: inherits: 2.0.4 safe-buffer: 5.2.1 + dev: true /cjs-module-lexer/1.2.2: resolution: {integrity: sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==} @@ -3891,6 +3895,7 @@ packages: md5.js: 1.3.5 ripemd160: 2.0.2 sha.js: 2.4.11 + dev: true /create-hmac/1.1.7: resolution: {integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==} @@ -3901,6 +3906,7 @@ packages: ripemd160: 2.0.2 safe-buffer: 5.2.1 sha.js: 2.4.11 + dev: true /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} @@ -4186,6 +4192,13 @@ packages: dependencies: '@leichtgewicht/ip-codec': 2.0.4 + /dns-packet/5.6.1: + resolution: {integrity: sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==} + engines: {node: '>=6'} + dependencies: + '@leichtgewicht/ip-codec': 2.0.4 + dev: false + /docker-compose/0.23.17: resolution: {integrity: sha512-YJV18YoYIcxOdJKeFcCFihE6F4M2NExWM/d4S1ITcS9samHKnNUihz9kjggr0dNtsrbpFNc7/Yzd19DWs+m1xg==} engines: {node: '>= 6.0.0'} @@ -4985,6 +4998,7 @@ packages: scrypt-js: 3.0.1 secp256k1: 4.0.3 setimmediate: 1.0.5 + dev: true /ethereum-cryptography/1.1.2: resolution: {integrity: sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ==} @@ -5039,6 +5053,7 @@ packages: create-hash: 1.2.0 ethereum-cryptography: 0.1.3 rlp: 2.2.7 + dev: true /ethers/4.0.49: resolution: {integrity: sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==} @@ -5131,6 +5146,7 @@ packages: dependencies: md5.js: 1.3.5 safe-buffer: 5.2.1 + dev: true /execa/5.1.1: resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} @@ -5964,6 +5980,7 @@ packages: inherits: 2.0.4 readable-stream: 3.6.0 safe-buffer: 5.2.1 + dev: true /hash-test-vectors/1.3.2: resolution: {integrity: sha512-PKd/fitmsrlWGh3OpKbgNLE04ZQZsvs1ZkuLoQpeIKuwx+6CYVNdW6LaPIS1QAdZvV40+skk0w4YomKnViUnvQ==} @@ -7062,6 +7079,7 @@ packages: node-addon-api: 2.0.2 node-gyp-build: 4.5.0 readable-stream: 3.6.0 + dev: true /keyv/3.1.0: resolution: {integrity: sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==} @@ -7311,6 +7329,7 @@ packages: hash-base: 3.1.0 inherits: 2.0.4 safe-buffer: 5.2.1 + dev: true /media-typer/0.3.0: resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} @@ -7559,10 +7578,7 @@ packages: /multiformats/12.0.1: resolution: {integrity: sha512-s01wijBJoDUqESWSzePY0lvTw7J3PVO9x2Cc6ASI5AMZM2Gnhh7BC17+nlFhHKU7dDzaCaRfb+NiqNzOsgPUoQ==} engines: {node: '>=16.0.0', npm: '>=7.0.0'} - - /multiformats/9.7.1: - resolution: {integrity: sha512-TaVmGEBt0fhxiNJMGphBfB+oGvUxFs8KgGvgl8d3C+GWtrFcvXdJ2196eg+dYhmSFClmgFfSfJEklo+SZzdNuw==} - dev: false + dev: true /multihashes/0.4.21: resolution: {integrity: sha512-uVSvmeCWf36pU2nB4/1kzYZjsXD9vofZKpgudqkceYY5g2aZZXJ5r9lxuzoRLl1OAp28XljXsEJ/X/85ZsKmKw==} @@ -7678,7 +7694,7 @@ packages: /nofilter/3.1.0: resolution: {integrity: sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g==} engines: {node: '>=12.19'} - dev: false + dev: true /normalize-package-data/2.5.0: resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} @@ -8063,6 +8079,7 @@ packages: ripemd160: 2.0.2 safe-buffer: 5.2.1 sha.js: 2.4.11 + dev: true /performance-now/2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} @@ -8262,6 +8279,7 @@ packages: resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} dependencies: safe-buffer: 5.2.1 + dev: true /randomfill/1.0.4: resolution: {integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==} @@ -8475,12 +8493,14 @@ packages: dependencies: hash-base: 3.1.0 inherits: 2.0.4 + dev: true /rlp/2.2.7: resolution: {integrity: sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==} hasBin: true dependencies: bn.js: 5.2.1 + dev: true /run-parallel-limit/1.1.0: resolution: {integrity: sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==} @@ -8538,6 +8558,7 @@ packages: elliptic: 6.5.4 node-addon-api: 2.0.2 node-gyp-build: 4.5.0 + dev: true /semver/5.7.1: resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} @@ -8642,6 +8663,7 @@ packages: /setimmediate/1.0.5: resolution: {integrity: sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==} + dev: true /setprototypeof/1.2.0: resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} @@ -8653,6 +8675,7 @@ packages: dependencies: inherits: 2.0.4 safe-buffer: 5.2.1 + dev: true /sha3/2.1.4: resolution: {integrity: sha512-S8cNxbyb0UGUM2VhRD4Poe5N58gJnJsLJ5vC7FYWGUmGhcsj4++WaIOBFVDxlG0W3To6xBuiRh+i0Qp2oNCOtg==}