AGENT RING - register an identity (instructions for an AI agent) =============================================================== What you are doing ------------------ Registering a free on-chain identity for the user's SPACE ID `.ai` Agent ID, then taking the 10,000 starter credits that come with it. Nothing is paid in this file. Chain: BNB Smart Chain (chain 56). Read https://demo2.zk0x.app/config.js first. It holds the deployed addresses. If `identity` or `shop` is empty, the contracts are not deployed yet: say so and stop. Send nothing. Contracts --------- .ai Agent ID registry (SPACE ID): 0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F IdentityNFT: CreditShop: Step 1 - the Agent ID tokenId ----------------------------- The registry is ERC-721 but NOT enumerable and `totalSupply()` reverts, so you cannot list a wallet's names. Ask the user for the Agent ID name (for example `ss678`, the part before `.ai`). tokenId = keccak256(utf8 name) // 32 bytes, lowercase the name first `handleOf(address)` is not available on this registry, so do not try to reverse it from the wallet. If the user pastes a 32-byte hex value instead of a name, treat it as the tokenId. Step 2 - prove ownership ------------------------ ownerOf(tokenId) 0x6352211e on 0x60B9262456dE011F7d15a54CdD8c48bAaa8B022F It must equal the user's wallet. If it does not, the wallet does not hold that Agent ID - stop and say that plainly. Do not try another tokenId by guessing. Step 3 - mint the identity -------------------------- IdentityNFT.mint(uint256 agentTokenId) 0xa0712d68 value 0 Free. Show the user the target address, the calldata and the gas estimate, wait for approval, then send. One identity per Agent ID, locked forever in `claimedAgentId[agentTokenId]`: - moving the Agent ID to another wallet does not re-open the mint - a second attempt reverts `AgentIdAlreadyUsed()` - a wallet holding several Agent IDs may mint one identity for each The mint gives you `identityTokenId` = the NFT id. Confirm it: IdentityNFT.identityAgentId(identityTokenId) 0xafc4f525 == agentTokenId Step 4 - starter credits ------------------------ CreditShop.claimStarter(uint256 identityTokenId) 0xd6921aa3 value 0 Free, once per Agent ID (tracked by Agent ID, not by wallet). If it reverts `StarterAlreadyUsed()`, the starter was already taken - say so and move on, do not retry. Confirm the balance: CreditShop.freeCredit(user) 0x44128e5b CreditShop.credit(user) 0xd5d44d80 Step 5 - report --------------- For each transaction: hash, the identity tokenId, and the credit balance after. If a step was skipped because it was already done, say which step and why. Guardrails ---------- Never send a transaction the user has not approved. Never guess a name, a tokenId or an address. Use only the addresses in config.js and this file. If the chain contradicts this file, trust the chain and tell the user. Credits are a game balance, not a coin: they cannot be transferred or withdrawn. Never promise a user they can sell them.