npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sovereignclaw/inft

v0.1.0

Published

ERC-7857 iNFT lifecycle helpers for SovereignClaw - mint, transfer with re-encryption, revoke, royalty events.

Readme

@sovereignclaw/inft

ERC-7857 iNFT lifecycle helpers for SovereignClaw — mint an agent as a token, transfer with oracle-mediated re-encryption, record usage events, and irrevocably revoke memory access. Wraps the deployed AgentNFT and MemoryRevocation contracts on 0G Galileo testnet.

Install

pnpm add @sovereignclaw/inft @sovereignclaw/memory ethers

The package imports ABIs from contracts/out/. Run forge build in contracts/ once before building this package — the quickstart covers this.

10-line quickstart

import { Wallet, JsonRpcProvider, randomBytes } from 'ethers';
import { loadDeployment, mintAgentNFT, revokeMemory, OracleClient } from '@sovereignclaw/inft';

const signer = new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(process.env.RPC_URL!));
const deployment = loadDeployment();
const oracle = new OracleClient({ url: 'http://localhost:8787' });

const minted = await mintAgentNFT({
  agent: { role: 'researcher', getPointer: () => process.env.MEMORY_POINTER! },
  owner: signer,
  wrappedDEK: randomBytes(32),
  deployment,
});
await revokeMemory({ tokenId: minted.tokenId, owner: signer, oracle, deployment });

API

| Export | Kind | Purpose | | ------------------------------------ | ----- | ------------------------------------------------------------------ | | mintAgentNFT | fn | Mints one iNFT. Commits pointer + wrappedDEK + metadata hash. | | transferAgentNFT | fn | Transfers via oracle re-encryption; updates wrappedDEK atomically. | | revokeMemory | fn | Owner signs → oracle registry → chain revoke. Irreversible. | | recordUsage | fn | Append a typed usage record for downstream analytics. | | OracleClient | class | HTTP client for /oracle/{pubkey,reencrypt,revoke,prove,healthz}. | | loadDeployment | fn | Reads deployments/0g-testnet.json. Throws if missing. | | AgentNFTAbi / MemoryRevocationAbi | const | Ethers-v6-compatible ABIs. Used internally; exposed for callers. | | explorerTxUrl / explorerAddressUrl | fn | Format chainscan links for mint/transfer/revoke receipts. | | digestForOracleProof etc. | fn | EIP-712 helpers — used by the oracle; exposed for audit tests. | | CONTRACT_LIMITS | const | On-chain field maxima (role/pointer/DEK byte lengths). |

Errors

All extend InftError:

| Error | When | | --------------------------------------------- | --------------------------------------------------------------------- | | MintError | Pre-flight validation failed or mint tx reverted. | | TransferError | Oracle rejected, chain reverted, or post-condition assertion failed. | | RevokeError | Oracle rejected, chain reverted, or post-condition assertion failed. | | RecordUsageError | Usage tx reverted or over field-length limit. | | OracleClientError | Generic oracle transport error (parent). | | OracleAuthError | 401/403 from oracle (auth token mismatch). | | OracleRevokedError | 410 from oracle — token is already revoked. | | OracleHttpError | Any other 4xx/5xx from oracle. | | OracleTimeoutError / OracleUnreachableError | Request timed out / couldn’t reach oracle. | | ContractRevertError | Parsed reason from a contract revert (wraps the underlying tx error). | | DeploymentNotFoundError | deployments/0g-testnet.json missing or malformed. |

Trust model

  • The oracle holds one EIP-712 signing key and is the only entity that can approve a transfer or a revoke. On-chain, AgentNFT checks the oracle signature before touching the wrappedDEK or the revoked bit.
  • revokeMemory is irreversible: the oracle flips its in-memory registry before returning the proof, so any concurrent /oracle/reencrypt for the same token 410s. The chain then permanently zeroes the DEK.
  • A misbehaving oracle cannot mint or transfer to someone else — those require the owner’s signature as well, enforced on-chain.

Further reading

License

MIT — see the repo root.