Last active
December 23, 2021 21:04
-
-
Save puyu-eth/5078f7c214d61eb42c9772035216cdf8 to your computer and use it in GitHub Desktop.
ENS commitment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const send_commitment = async(ens_name, owner_address, secret, resolver, pub_key) => { | |
console.debug(`Check if ENS is available for ${ens_name}.eth.`); | |
const available = await contract.available(ens_name); | |
if (! available) { console.debug("Name is not available"); return }; | |
console.debug("Get commitment object."); | |
const commitment = await contract.makeCommitmentWithConfig( | |
ens_name, // name | |
owner_address, // owner | |
secret, // secret | |
resolver, // resolver | |
owner_address, // addr | |
); | |
console.debug("Send commitment."); | |
const resp = await contractConnected.commit(commitment, { | |
value: 0, | |
maxFeePerGas: ethers.utils.parseUnits(MAX_FEE, "gwei"), | |
maxPriorityFeePerGas: ethers.utils.parseUnits(PRIORITY_FEE, "gwei"), | |
}); | |
console.debug(resp); | |
const receipt = await provider.waitForTransaction(resp.hash); | |
console.debug(receipt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment