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

touchstone-sdk

v0.1.0

Published

Read Touchstone RWA policy gates and Registry v2 reports on X Layer, and execute guarded actions only when a gate permits

Downloads

33

Readme

Touchstone SDK

The SDK is the small external-consumer surface for Touchstone policy gates and Registry v2 events. The checked-in deployment table carries the live addresses for both chains — the legacy registries and, since 2026-08-19, the Registry v2 deployments the owner approved — so a consumer reads real contracts out of the box.

Five-minute integration

npm install touchstone-sdk ethers

Or from a checkout of this repository:

cd sdk
npm ci
npm run build
npm test

Read a policy gate and execute only when it permits:

import { JsonRpcProvider, Wallet } from "ethers";
import {
  AssetGateClient,
  DEPLOYMENTS,
  GuardedActionClient,
  POLICIES,
} from "touchstone-sdk";

const provider = new JsonRpcProvider(process.env.RPC_URL, 1952);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);
const gate = new AssetGateClient(
  process.env.GATE_ADDRESS!,
  POLICIES.disclosureFreshness.registryKey,
  wallet
);
const action = new GuardedActionClient(
  process.env.GUARDED_ACTION_ADDRESS!,
  wallet
);

const decision = await gate.check();
if (decision.allowed) await action.execute();

The example at examples/check-and-act.ts uses the same path with explicit environment variables. AssetGateClient.demand() separately exercises the gate's state-changing demand method and rejects a known refusal before submitting. Only GuardedActionClient.execute() executes the guarded action.

Registry event indexing

import { JsonRpcProvider } from "ethers";
import { DEPLOYMENTS, indexPublished } from "touchstone-sdk";

const deployment = DEPLOYMENTS.xlayerMainnet;
const events = await indexPublished(
  new JsonRpcProvider("https://rpc.xlayer.tech", deployment.chainId),
  deployment.v2RegistryAddress!,
  deployment.v2RegistryDeploymentBlock!,
  "latest"
);

The indexer reads logs in windows of 100 blocks because the public X Layer RPC rejects wider eth_getLogs ranges; pass { blockRange } as a fifth argument for a provider that allows more. Start from v2RegistryDeploymentBlock (or a checkpoint you persist) rather than block 0. The result includes both Published and Corrected events in canonical log order. Corrections carry kind: "corrected" and their non-null correctedSequence; consumers must process both kinds so a correction cannot leave cached permissive state behind.

Use policyRegistryKey(assetKey, policyId, version) rather than hand-hashing policy keys. The included policy ids are disclosure-freshness:1 and nav-settlement:1; they are the policy keys produced by this repository's committed manifests.

The SDK does not embed private keys, submit owner actions, or treat legacy v1 reports as v2 attestations. The Solidity interface in solidity/ITouchstoneGuard.sol is the minimum dependency for a consumer contract that wants to read a gate directly.

Registry v2 policy mapping

Use registryAssetKey(fullReportAssetKey) for the onchain asset key, including the complete #policy:<id>:<version> suffix. Use policyIdDigest(id, version) for the onchain policy id and policyDigestRoot(report.policy.policy_digest) for the policy root. The shared vector in fixtures/registry-v2-policy-vector.json locks these derivations to the Python publisher.

ERC-8021 attribution

Pass a registered Builder Code to GuardedActionClient.execute([code]). The SDK appends the canonical ERC-8021 schema-0 suffix to the action calldata. Touchstone's registered code is f0axgs7smtk2nfa7; its first attributed mainnet admission execution is public. External applications must register and pass their own code rather than reusing Touchstone's attribution.