Badge Technical Implementation
Guide for games to integrate badges into Treasure
Before determining which use case suits your needs, please review the Treasure Badge Design Guide for how to prepare the image assets for your badge.
Choose one of the three use cases that best suits your needs.
For spinning up a badge quickly without your own Badge infra:
- Provide us a way to check "is wallet address
X
is eligible to claim your badgeB
?". Some options: (a) static list of addresses (WL) [examples: plaintext list, or JSON array of strings], (b) API call, (c) contract method, (d) whether the user possesses a particular ERC721/ERC1155/ERC20 token. - Send us the image assets designed according to the guidelines in Treasure Badge Guide.
- Provide us the metadata in the
REQUIRED
section described below in Metadata.
Best for decentralization:
- Send us the image assets designed according to the guidelines in Treasure Badge Guide.
- Provide us the metadata in both the
REQUIRED
+OPTIONAL
sections described in Metadata.
For decentralized hosting of badges w/ possibility to let users claim from Treasure app:
- Provide us a way to check "is wallet address
X
is eligible to claim your badgeB
?". Some options: (a) static list of addresses (WL) [examples: plaintext list, or JSON array of strings], (b) API call, (c) contract method, (d) whether the user possesses a particular ERC721/ERC1155/ERC20 token. - Send us the image assets designed according to the guidelines in Treasure Badge Guide.
- Provide us the metadata in both the
REQUIRED
+OPTIONAL
sections described in Metadata. - Tell us input parameters needed to call your badge contract to claim a badge. Example: for Treasure badges, eligible users are given a struct (
ClaimInfo
) and a signature to theTreasureBadges
contract to claim the badge on-chain.
The following is a subset of the TypeScript schema we use for representing Badge configurations in our backend.
interface BadgeInfo {
// REQUIRED: Basic info for the badge.
displayName: string; // Example: 'Socializer'
description?: string; // Example: 'Connect all socials'
descriptionGerund?: string; // Example: 'connecting my socials'
imageUri: string; // Send to us and we can host. Or provide your own URI.
externalUrl?: string; // Example: 'https://yourgame.io'
// OPTIONAL: If you are managing your own badge contract, these fields let
// Treasure check whether the badge has been claimed.
claimConfig?: {
// Supported chains:
// 'arb' (Arbitrum)
// 'arbnova' (Arbitrum Nova)
// 'eth' (Ethereum mainnet)
// 'arbgoerli' (Arbitrum Goerli)
// 'sepolia' (Sepolia)
chain: string;
// Contract address for your self-managed badge contract.
badgeAddress: string;
// Token ID within your badge contract.
badgeTokenId: string;
// And any other metadata relevant to checking your badge status.
};
}
Last modified 1mo ago