Skip to content

Instantly share code, notes, and snippets.

@dhadrien
Last active September 24, 2021 11:01
Show Gist options
  • Save dhadrien/b71505210b4cd014af81dee12a9c0034 to your computer and use it in GitHub Desktop.
Save dhadrien/b71505210b4cd014af81dee12a9c0034 to your computer and use it in GitHub Desktop.
const subdomain = 'subdomain.sismo.eth';
const userLabel = 'newUser';
const userLabelHash = getLabelhash(userLabel);
const subdomainNode = nameHash.hash(subdomain);
const userNode = nameHash.hash(`${userLabel}.${subdomain}`);
const userNode2 = keccak256(
ethers.utils.solidityPack(
['bytes', 'bytes'],
[subdomainNode, userLabelHash]
)
);
await nameWrapper.setSubnodeRecordAndWrap(
subdomainNode,
'newUser',
ownerSigner.address,
publicResolver.address,
0,
0
);
// This is ok with userNode2
expect(
await nameWrapper.balanceOf(ownerSigner.address, userNode2)
).to.be.equal(1);
// This is not ok with userNode
expect(
await nameWrapper.balanceOf(ownerSigner.address, userNode)
).to.be.equal(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment