TransWikia.com

web3 ens library - purpose of setText, getText against ENS name

Ethereum Asked by TurbanMan on December 27, 2020

I am looking at web3.eth.ens library, I can see methods setText and getText, which allows you to set and get key value pairs against an ENS name. What is the purpose of this? Also is there a way to find all the keys against an ENS name?

One Answer

The functions setText() and text() allow ENS name holders to associate metadata with a ENS name.

Both are functions of the TextResolver.sol contract.


From ENS docs:

function setText(bytes32 node, string calldata key, string calldata value) external authorised(node)

Sets text metadata for node with the unique key key to value, overwriting anything previously stored for node and key. To clear a text field, set it to the empty string.

function text(bytes32 node, string calldata key) external view returns (string memory)

Retrieves text metadata for node. Each name may have multiple pieces of metadata, identified by a unique string key. If no text data exists for node with the key key, the empty string is returned.

Standard values for key

Answered by alberto on December 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP