Skip to content

Instantly share code, notes, and snippets.

@TateB

TateB/commit.ts Secret

Created April 17, 2024 02:06
Show Gist options
  • Save TateB/bc01f2a9b10a2b35c16dbcd9d997a84b to your computer and use it in GitHub Desktop.
Save TateB/bc01f2a9b10a2b35c16dbcd9d997a84b to your computer and use it in GitHub Desktop.
import { createEnsWalletClient } from "@ensdomains/ensjs";
import {
ethRegistrarControllerCommitSnippet,
getChainContractAddress,
} from "@ensdomains/ensjs/contracts";
import { http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { waitForTransactionReceipt } from "viem/actions";
import { sepolia } from "viem/chains";
const account = privateKeyToAccount("0xINSERT_PRIVATE_KEY_HERE");
const client = createEnsWalletClient({
account,
chain: sepolia,
transport: http("https://sepolia.gateway.tenderly.co/4imxc4hQfRjxrVB2kWKvTo"),
});
const tx = await client.writeContract({
abi: ethRegistrarControllerCommitSnippet,
address: getChainContractAddress({
client,
contract: "ensEthRegistrarController",
}),
args: ["0xINSERT_COMMIT_HASH_HERE"],
functionName: "commit",
});
console.log(tx);
const receipt = await waitForTransactionReceipt(client, {
hash: tx,
});
console.log(receipt);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment