Otterspace Docs
  • Overview
    • 🦦Intro to Otterspace
    • 🔑Key Concepts
      • 🔥Burning and revocation
      • ⏳Expiration
      • 🤓Metadata schemas
    • ❓F.A.Q
  • Documentation
    • 🔌API
      • 🔐Authentication
    • 🐙Subgraph
    • 🛠️Contracts
      • 🎨Create a Badge Spec
      • 🪂Airdrop a Badge
      • ✅Adding to allowlist
      • 🤝Minting allowlisted Badges
      • ➕Add/Remove Admins
  • Guides
    • 🔏Token-gating using badges
  • Integrations
    • Using badges with Snapshot
    • Guild.xyz for token gating
    • Using with Gnosis Safe
    • On OpenSea, Metamask etc
  • Get Help
    • 🕺Discord/Twitter
Powered by GitBook
On this page

Was this helpful?

  1. Documentation
  2. Contracts

Adding to allowlist

Approve someone to mint this Badge using EIP-712

In order to approve someone to mint a Badge, a signature using EIP-712 is necessary

import { utils } from "ethers"

const typedData = {
    domain: {
      name: 'BADGES',
      version: '1.0.0',
      chainId: 10, // optimism chainId
      verifyingContract: '0x7F9279B24D1c36Fa3E517041fdb4E8788dc63D25',
    },
    types: {
      Agreement: [
        { name: 'active', type: 'address' },
        { name: 'passive', type: 'address' },
        { name: 'tokenURI', type: 'string' },
      ],
    },
    value: {
      active: claimant.address, // issuer of badge 
      passive: issuer.address, // receiver of badge
      tokenURI: specUri, // uri of badge
    },
  }

// See: <https://docs.ethers.io/v5/api/signer/#Signer-signTypedData> for more detailed instructions.
const signature = await signer._signTypedData(typedData.domain, typedData.types, typedData.value)
const { compactSignature } = utils.splitSignature(signature)
PreviousAirdrop a BadgeNextMinting allowlisted Badges

Last updated 1 year ago

Was this helpful?

🛠️
✅