🥷
Namespace
  • [ Introduction ]
    • ENS
    • Namespace
  • Official Links
  • [ Dapps ]
    • Overview
    • Onchain Subs (App)
      • Search & Register
      • Wizard
        • Listing an ENS Name
        • Features List
      • ENS Widget
      • Farcaster Frames
        • Default Frame
        • Custom Frame
    • Offchain Subs (DevPortal)
      • Subname create/manage
      • Resolver set
      • API keys
  • How-to Guides and Demos
  • [ Dev Docs ]
    • SDK
      • Offchain Manager
        • Installation
        • Generate API key
        • Create or Update Subname
        • DeleteSubname
        • IsSubnameAvailable
        • GetFilteredSubnames
        • AddressRecords
          • ChainName
        • TextRecords
        • DataRecords
      • Indexer Manager
        • Installation
        • Methods
        • GetL2Subname
        • GetL2Subnames
      • Mint Manager
        • Installation
        • GetMintDetails
        • GetMintTransactionParameters
        • IsSubnameAvailable
        • How To Mint L1 & L2 subname via mint-manager
      • Namespace Client (deprecated)
        • Installation
        • GetListedName
        • GetMintDetails
        • GetMintTransactionParameters
        • IsSubnameAvailable
        • GenerateAuthToken
    • APIs
      • Offchain Manager
      • Mint Manager
    • Infrastructure
      • Namespace L2 Subnames
  • [ ecosystem ]
    • Use Cases
  • [ Jobs ]
    • 🧑‍💻 Full-Stack Dev
    • 🥷 Dev-Rel Lead
    • 💼 BD Lead
Powered by GitBook
On this page
  • Usage
  • Return Type
  1. [ Dev Docs ]
  2. SDK
  3. Namespace Client (deprecated)

GenerateAuthToken

GenerateAuthToken function

In order to mint a subnames for a certain listings, the minter needs to authenticate itself and prove the ownership of an address.

This will be the case when:

  • Listing uses whitelist and minter is whitelisted

  • Listing uses token gated access and minter has a required ERC token

Usage

index.ts
const wallet = "0x3E1e131E7e613D260F809E6BBE6Cbf7765EDC77f";
const signingMessage = "Verify your address"
const tokens = await NamespaceClient.generateAuthToken(wallet, signTypedDataFunction, "signingMessage ");

SignTypedDataFunction is function responsible for signing a typed data, generating a signature for proving ownership of an address. The function needs to be supplied by a client.

type SignTypedDataFunction = (params: {
  message: any
  domain: any
  primaryType: string
  types: any
}) => Hash | Promise<Hash>;

Return Type

export interface AuthTokenResponse {
    accessToken: string
    refreshToken: string
}

The access token is required for generating minting parameters, is case the listing requires a verification for minting.

index.ts
const wallet = "0x3E1e131E7e613D260F809E6BBE6Cbf7765EDC77f";
const signingMessage = "Verify your address"
const tokens = await NamespaceClient.generateAuthToken(wallet, signTypedDataFunction, "signingMessage ");

const transactionParameters =
    await NamespaceClient.getMintTransactionParameters(listedName, {
      minterAddress,
      subnameLabel,
      subnameOwner: minterAddress,
      token: tokens.accessToken
    });

PreviousIsSubnameAvailableNextAPIs

Last updated 9 months ago