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
    });

Last updated