Skip to main content

renounceOwnership

The renounceOwnership method is part of the ownership management feature common to some ERC-721 token implementations. By invoking this method, the current owner of the contract relinquishes control, effectively making the contract ownerless. This action is irreversible, and once executed, certain administrative functionalities originally reserved for the owner will be permanently inaccessible. This method is a part of the ERC721Instance object.

Method Signature

async renounceOwnership(signer: WalletSigner): Promise<TransactionResponse>

Parameters

ParameterTypeDescription
signerWalletSignerAn instance of the wallet signer responsible for initiating the transaction. It must correspond to the current owner of the ERC-721 contract.

Returns

  • A Promise that resolves to a TransactionResponse object. This object provides details about the transaction, including its status, transaction hash, and more.

Usage Example

First, instantiate the desired ERC-721 token contract:

const erc721 = edexaClient.getERC721Instance("your ERC-721 contract address here");

Then, call the renounceOwnership method with the appropriate signer:

const signer = edexaClient.createWalletSigner("your private key corresponding to the owner");
const transactionResponse = await erc721.renounceOwnership(signer);
console.log(`Transaction Hash: ${transactionResponse.hash}`);

Notes

  • Caution: renounceOwnership is an irreversible action. Once executed, the contract will become ownerless and any functionality exclusive to the owner will be permanently locked. Always ensure you truly intend to renounce ownership before calling this method.

  • Ensure the signer provided is indeed the current owner of the contract. Otherwise, the transaction will fail.

  • Given the gravity of this operation, it's advisable to have multiple confirmations or checks in place (especially in user interfaces) before this method is executed.