const { ethers } = require('ethers');
const provider = new ethers.JsonRpcProvider('https://forno.celo.org');
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
const contract = new ethers.Contract('0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
  ['function setAgentURI(uint256 agentId, string uri)'], wallet);
contract.setAgentURI(17, process.env.NEW_URI)
  .then(tx => { console.log('TX:', tx.hash); return tx.wait(); })
  .then(() => console.log('✅ On-chain updated!'))
  .catch(console.error);
