NameService contract guide
We can use the Relation NameService contract deployed by Relation Protocol to store and query a user's identity data. The Relation NameService contract is an implementation of the Name Service defined by the Contract Standard.
Construct a Contract object
Via Relation Protocol's resources, you can acquire the contract address and the abi file of the NameService contract. Then you can construct a Contract object with "ethers".
How to call the contract
Register a name
A user can call the "register" to register a name. Or, a minter specified by an administrator can also register names for other users. On registration, you can select whether to set a resolve record. Once a name is linked to an address, you can query the mapping with methods like "addr" and "nameOf".
Below are two examples:
Register a name for yourself, and set a resolve record.
A minter register a name for a specified address without setting a resolve record.
Query the names held by a user
You can query the list of names held by a user through the tokens in said user's possession.
Set a resolve record for a name
A user can set a resolve record for a name (without a resolve record) in his possession. After this setting, the token cannot be transferred.
Query the address mapped to a name
After a resolve record is set, you can query a name's mapped address via "addr".
Query the name mapped to am address
After a resolve record is set, you can query an address mapped to a name via "nameOf".
Configure the profileURI
Users can upload their avatar information to Arweave with the following json format:
The subsequent transaction hash will be stored to a contract as the profileURI.
Query a user's profileURI
Last updated