.degen smart contract: 0x4087fb91A1fBdef05761C02714335D232a2Bf3a1
There are only two functions in the .degen smart contract important for integrations:
- Resolver:
getDomainHolder(name)
(note: enter only name without extension, e.g.: tempe, not tempe.degen) - Reverse resolver:
defaultNames(address)
Useful when you have a name (e.g. tempe.degen
) and would like to learn which address is behind this name.
Note: When you enter domain name, enter only the name (e.g. tempe
✅) without extension (not tempe.degen
⛔️).
Example with ether.js:
const degenNameContract = new ethers.Contract(
"0x4087fb91A1fBdef05761C02714335D232a2Bf3a1",
new ethers.utils.Interface(["function getDomainHolder(string calldata _domainName) public view returns(address)"]),
provider
);
const userAddress = await degenNameContract.getDomainHolder("tempe"); // returns 0xb29050965A5AC70ab487aa47546cdCBc97dAE45D
Useful when you have an address (e.g. when user connects to your app), and you'd like to get a .degen
name of that address.
Example with ether.js:
const degenNameContract = new ethers.Contract(
"0x4087fb91A1fBdef05761C02714335D232a2Bf3a1",
new ethers.utils.Interface(["function defaultNames(address) public view returns(string memory)"]),
provider
);
const userName = await degenNameContract.defaultNames("0xb29050965A5AC70ab487aa47546cdCBc97dAE45D"); // returns "tempe"
const fullDegenName = username + ".degen"; // tempe.degen
If you'll have any questions regarding the integration, feel free to reach out to Tempe Techie via Farcaster: https://warpcast.com/tempetechie.eth