I'm having trouble getting my ABI data registered with my ENS record. I am unable to find any examples which include ethers.
I have tried using the artifact's abi object, JSON.stringify(abi)
, various formats of the ethers.utils.Interface
object. They all fail arrayify
ing.
code
const hre = require('hardhat');
const ethers = require('ethers');
const namehash = require('eth-ens-namehash');
const [owner] = await hre.getSigners();
const resolver = hre.ethers.getContractAt("PublicResolver", "0x...", owner);
const artifact = hre.artifacts.readArtifact("Contract");
const node = namehash.hash('name.sub.foo.eth');
resolver['setABI(bytes32,uint256,bytes)'](node, 0x1, artifact.abi);
error
$ npx hardhat run scripts/abi.js
Uncaught:
Error: invalid arrayify value (argument="value", value=[...], code=INVALID_ARGUMENT, version=bytes/5.5.0)
at BytesCoder.DynamicBytesCoder.encode (.../node_modules/@ethersproject/abi/src.ts/coders/bytes.ts:17:25)
at arrayify (.../node_modules/@ethersproject/bytes/src.ts/index.ts:138:19)
at Logger.throwArgumentError (.../node_modules/@ethersproject/logger/src.ts/index.ts:241:21)
at Logger.throwError (.../node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
at Logger.makeError (.../node_modules/@ethersproject/logger/src.ts/index.ts:225:28) {
reason: 'invalid arrayify value',
code: 'INVALID_ARGUMENT',
argument: 'value',
value: [...]