âĄī¸ZNS Registration Integration
ZNS Registration Integration guide
Registration Process with WalletConnect
This guide outlines how to integrate the domain registration process with WalletConnect, enabling users to authenticate and register domains using their cryptocurrency wallets.
Steps Overview
Initialize the WalletConnect client.
Prompt the user to connect their wallet using a QR code modal.
Authenticate the user based on the wallet address.
Register domains under a specific TLD to the authenticated wallet addresses.
Confirm the registration and provide feedback to the user.
Prerequisites
Before starting, ensure you have installed the necessary WalletConnect packages:
Initializing WalletConnect Client
Create a new file named WalletConnectInit.js
and add the following code to initialize the WalletConnect client:
Connecting to a Wallet
Invoke walletConnectInit
from your application to establish a connection with the user's wallet. This step will prompt the user with a QR code modal to connect their wallet.
Handling Wallet Responses
Upon successful connection, the wallet address obtained from the connect
event can be used for user authentication. This authenticated wallet address is crucial for the domain registration process.
Domain Registration
After authenticating the user, proceed with the domain registration process. The register
function allows registering a list of domains under a specific TLD to the authenticated owner addresses.
register
Function
Registers a list of domains under a specific TLD to specified owner addresses.
walletClient
WalletClient
The wallet client instance.
domainNames
string[]
The list of domains to register.
ownerAddresses
string[]
The list of owner addresses for the domains.
tld
string
The top-level domain.
Returns: Promise<any>
- The registration result.
Example:
Confirmation and Feedback
After the registration process is complete, provide the user with confirmation and any relevant details about their new domain(s). This could include transaction IDs, links to view the domain on a blockchain explorer, or next steps for setting up their domain.
Security Considerations
Always validate wallet addresses on the server side.
Implement rate limiting to prevent abuse.
Troubleshooting
QR Code Modal Does Not Appear: Ensure the WalletConnect library is correctly installed and initialized.
Connection Fails: Check the bridge server status and ensure your internet connection is stable.
Last updated