Closed alextnetto closed 2 months ago
const name = normalize('edu.blockful.eth')
const node = namehash(name)
const signer = privateKeyToAccount(privateKey as Hex)
if (!resolver) {
resolver = getChainContractAddress({
chain: client.chain,
contract: 'ensUniversalResolver',
})
}
const [resolverAddr] = (await client.readContract({
address: resolver as Hex,
functionName: 'findResolver',
abi: uAbi,
args: [toHex(packetToBytes(name))],
})) as Hash[]
// REGISTER NEW DOMAIN
try {
await client.simulateContract({
functionName: 'register',
abi: dbAbi,
args: [toHex(name), 300, signer.address],
account: signer.address,
address: resolverAddr,
})
} catch (err) {
const data = getRevertErrorData(err)
if (data?.errorName === 'StorageHandledByOffChainDatabase') {
const [domain, url, message] = data.args as [
DomainData,
string,
MessageData,
]
await handleDBStorage({ domain, url, message, signer })
} else {
console.error('writing failed: ', { err })
}
}
@alextnetto
subdomains should not be created through SubGraph
SubGraph is a tool indexing data from the blockchain, in context of ENS is used for getting domain data. So there is no write operation possible, for creating a subdomain. That's done directly in ENS contracts.
Blockchain transaction statuses are correctly reflecting in user's Ui;
In this case is not a blockchain transaction, it's a signature.
Besides that all looks good!
Feature Request
Describe the Feature Request
Create the modal user-flow for registering a subdomain (with records).
Figma designs and prototype is available here.
Must:
This modal user-flow should only be reachable when a domain uses our new ENSIP for Off-Chain resolvers, meaning that subdomains should not be created through SubGraph.
Definition of Done:
This issue will be considered as done when: