hypnex-registry
v0.3.0
Published
TypeScript SDK for the Hypnex agent registry — proposed MRC 58 implementation for the Morpheus AI network.
Downloads
352
Maintainers
Readme
hypnex-registry (TypeScript)
TypeScript SDK for the Hypnex agent registry — proposed MRC 58 implementation for the Morpheus AI network.
npm install hypnex-registryAffiliation & monetization
This SDK is published by Hypnex Labs and is monetized via the v2 registry's register() fee. Each registration costs 1 MOR (configurable on-chain by the claim-admin) and is forwarded directly to the Hypnex Labs treasury at 0x22B5C0075372E743042b2d62b3D254425Eb957D8 inside the same registration tx. The SDK auto-approves the MOR allowance for you on first use. Hypnex is not affiliated with the Morpheus AI Foundation.
Status
Two contract versions are deployed on Arbitrum + Base mainnet:
| Version | Arbitrum | Base | Notes |
|---|---|---|---|
| v2 (default) — paid registry | 0x5563Be0a302885eE3e454be42DC12c177DA3625B | 0x191630a3d190B6f67cC7fB1325aD97D2CeB82697 | 1 MOR fee per register() |
| v1 (deprecated) — fee-free reference | 0xCC258a7BBF361fd824e87D4b3C0D394De6Fd454F | 0xd4D014De1e0D6287BeeD39CD6de99E3A73645ca4 | MRC 58 reference impl |
By default new Registry({ chain: "arbitrum" }) connects to v2. Pass version: "v1" to read the legacy registry instead.
| Chain | Address | Verified source |
|---|---|---|
| Arbitrum One | 0xCC258a7BBF361fd824e87D4b3C0D394De6Fd454F | Arbiscan ↗ |
| Base mainnet | 0xd4D014De1e0D6287BeeD39CD6de99E3A73645ca4 | BaseScan ↗ |
Reference Solidity: registry-contracts/contracts/HypnexAgentRegistry.sol
Deploy record: registry-contracts/DEPLOYMENT.md
Spec: docs/MRC-58-DRAFT.md
Quickstart
Pure helpers (no RPC)
import { agentId, capabilityTag, modelIdFor } from "hypnex-registry";
agentId("hypnex", "summarizer"); // bytes32
capabilityTag("chat"); // bytes32
modelIdFor("glm-5"); // bytes32These match the Solidity contract's encoding exactly.
Read
import { Registry } from "hypnex-registry";
const r = await Registry.fromFallbacks({
address: "0xYourTestnetDeployment",
chain: "base",
});
const total = await r.totalAgents();
const ids = await r.listAgents(0n, 50n);
for (const id of ids) {
const agent = await r.getAgent(id);
console.log(`${agent.namespace}/${agent.name}`);
}Write (signer required)
import { Registry } from "hypnex-registry";
const r = Registry.withPrivateKey(process.env.PRIVATE_KEY as `0x${string}`, {
address: "0xYourTestnetDeployment",
chain: "base",
});
const tx = await r.register({
namespace: "hypnex",
name: "summarizer",
metadataURI: "ipfs://Qm...",
capabilities: ["chat", "summarize"], // auto-keccak'd
pricePerCallWei: 100_000_000_000_000n, // 0.0001 MOR
modelId: "glm-5", // auto-keccak'd
});Discovery by capability
const ids = await r.agentsWithCapability("chat");
const agents = await Promise.all(ids.map((id) => r.getAgent(id)));
const active = agents.filter((a) => a.isActive);Public API
new Registry({ address?, chain?, rpcUrl?, publicClient?, walletClient? })
// static factories
Registry.fromFallbacks(opts)
Registry.withPrivateKey(pk, opts)
Registry.fromEnv(opts)
// read
.agentIdOf(namespace, name)
.isRegistered(agentId)
.totalAgents()
.listAgents(offset, limit)
.agentsOf(owner)
.agentsWithCapability(capability)
.getAgent(agentId)
// write (require walletClient)
.register({ namespace, name, metadataURI, capabilities, pricePerCallWei?, modelId? })
.updateMetadata({ agentId, metadataURI, pricePerCallWei, modelId })
.setCapabilities(agentId, capabilities)
.deactivate(agentId)
.reactivate(agentId)
.transferOwnership(agentId, newOwner)
// pure helpers
agentId(namespace, name)
capabilityTag(label)
modelIdFor(modelName)Environment variables
HYPNEX_REGISTRY_ADDRESS— registry contract addressHYPNEX_REGISTRY_CHAIN—base|arbitrum|ethereum|base-sepolia(default:base)HYPNEX_REGISTRY_RPC_URL— override RPCPRIVATE_KEY— for writes only
Tests
npm install
npm test # off-chain helper testsLicense
MIT
