rendergate-mainnet / scripts /verify-8004.js
tantk's picture
initial deploy: hardened mainnet build
dcf8b6b verified
// Query the testnet Identity Registry to confirm our agent ID and owner.
import {
TESTNET_CONFIG,
createClients,
wrapBasicSigner,
} from "@trionlabs/stellar8004";
import { Keypair } from "@stellar/stellar-sdk";
const SECRET = process.env.AGENT_OWNER_SECRET_TESTNET;
if (!SECRET) {
console.error("Set AGENT_OWNER_SECRET_TESTNET");
process.exit(1);
}
const kp = Keypair.fromSecret(SECRET);
const signer = wrapBasicSigner(kp, TESTNET_CONFIG.networkPassphrase);
const { identity } = createClients(TESTNET_CONFIG, signer);
console.log(`My address: ${kp.publicKey()}`);
// Total agents
const totalTx = await identity.total_agents();
console.log(`total_agents(): ${totalTx.result}`);
// Walk back from total_agents()-1 to find ones we own
const total = Number(totalTx.result);
console.log(`\nScanning agents [0..${total - 1}] for ownership...`);
for (let id = Math.max(0, total - 5); id < total; id++) {
try {
const ownerTx = await identity.find_owner({ agent_id: id });
const uriTx = await identity.agent_uri({ agent_id: id });
const owner = ownerTx.result;
const uri = uriTx.result;
const mine = owner === kp.publicKey() ? " ← OWNED BY ME" : "";
console.log(
` agent ${id}: owner=${owner?.slice(0, 8) || "?"}... uri=${(uri || "").slice(0, 60)}...${mine}`,
);
} catch (err) {
console.log(` agent ${id}: ${err.message}`);
}
}