Skip to main content

Claim a web3name

A web3name can be claimed if it currently has no owner, using the following snippet as reference.

import * as Kilt from '@kiltprotocol/sdk-js'

export async function claimWeb3Name(
did: Kilt.DidUri,
submitterAccount: Kilt.KiltKeyringPair,
name: Kilt.Did.Web3Name,
signCallback: Kilt.SignExtrinsicCallback
): Promise<void> {
const api = Kilt.ConfigService.get('api')

const web3NameClaimTx = api.tx.web3Names.claim(name)
const authorizedWeb3NameClaimTx = await Kilt.Did.authorizeTx(
did,
web3NameClaimTx,
signCallback,
submitterAccount.address
)
await Kilt.Blockchain.signAndSubmitTx(
authorizedWeb3NameClaimTx,
submitterAccount
)
}

The claiming process requires the reservation of a deposit that is freed upon web3name release.

Once claimed, the web3name will start appearing whenever the DID of its owner is resolved, for instance via the Universal Resolver. For more information about web3names and DIDs, see the official KILT DID Specification.