ZNS Connect Name Service
AppWeb SiteTwitter DiscordLink3
  • 🔰Welcome
  • â„šī¸Introduction
  • 💹Tokenomics and Revenue
  • đŸ›Ŗī¸Roadmap
  • đŸ’ŧPartners
  • USER GUIDE
    • 👨‍đŸĢGuide to ZNS Application
    • 🎁ZNS Gift Cards
    • 🎨NFT Marketplaces
    • đŸĻŠZNS on MetaMask Snap
      • đŸĢKnowledge Base
      • ⏊General FAQ
  • PROGRAMS
    • đŸ”ŖZNS Referral Program
    • Human Identity Pass
    • 🎓ZNS Grant Program
  • Developer Guide
    • âš’ī¸What we build?
    • âžĄī¸ZNS SDK
    • âžĄī¸ZNS API
    • âžĄī¸ZNS Subgraph
    • âžĄī¸ZNS Registration Integration
    • â›“ī¸ZNS Contract Address
  • MEDIA TOOLS
    • 📃Pitch Deck
    • 👾One Pager | ZNS
    • 📜Whitepaper
    • 📖Brand Book of ZNS
    • 🔗All links
  • LEGAL
    • â†˜ī¸Terms of Use
    • â†˜ī¸Refund Policy
    • â†˜ī¸Privacy Policy
    • đŸ•´ī¸Audit by Solidproof
  • LINKS
    • Website
    • Application
    • Twitter
    • Discord
    • Telegram
    • All Links
Powered by GitBook
On this page

Was this helpful?

  1. Developer Guide

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

  1. Initialize the WalletConnect client.

  2. Prompt the user to connect their wallet using a QR code modal.

  3. Authenticate the user based on the wallet address.

  4. Register domains under a specific TLD to the authenticated wallet addresses.

  5. Confirm the registration and provide feedback to the user.

Prerequisites

Before starting, ensure you have installed the necessary WalletConnect packages:

npm install @walletconnect/client @walletconnect/qrcode-modal

Initializing WalletConnect Client

Create a new file named WalletConnectInit.js and add the following code to initialize the WalletConnect client:

import WalletConnect from "@walletconnect/client";
import QRCodeModal from "@walletconnect/qrcode-modal";

const walletConnectInit = () => {
    const connector = new WalletConnect({
        bridge: "https://bridge.walletconnect.org",
        qrcodeModal: QRCodeModal,
    });

    if (!connector.connected) {
        connector.createSession();
    }

    connector.on("connect", (error, payload) => {
        if (error) {
            throw error;
        }
        const { accounts } = payload.params[0];
        console.log(`Connected to ${accounts[0]}`);
    });

    return connector;
};

export default walletConnectInit;

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.

Parameter
Type
Description

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:

await ZNSConnectClass.register(walletClient, ['example1', 'example2'], ['0x123...', '0x456...'], 'nft');

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.

PreviousZNS SubgraphNextZNS Contract Address

Last updated 9 months ago

Was this helpful?

âžĄī¸
Page cover image