Otterspace Docs
Search
K
🪂

Airdrop a Badge

Install the contracts
npm -i @otterspace-xyz/otterspace-contracts
Call the airdrop function on the contracts to mint an non-consented Badge
import { Contract, Signer } from 'ethers'
import Badges from '@otterspace-xyz/contracts/out/Badges.sol/Badges.json' assert { type: 'json' }
const BADGES_CONTRACT_ADDRESS = '0x7F9279B24D1c36Fa3E517041fdb4E8788dc63D25'
const mintBadge = async (
toAddress: string,
fromAddress: Signer,
badgeSpecURI: string
): Promise<ContractCallResult> => {
const contract = new Contract(BADGES_CONTRACT_ADDRESS, Badges.abi, fromAddress)
const doAirdrop = contract['airdrop']
return await doAirdrop([toAddress], badgeSpecURI)
}