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

@newton-xyz/vaultkit

v3.0.1

Published

VaultKit — the TypeScript SDK for vault curators. Wraps every vault-management action behind a Newton Protocol policy attestation, enforced on-chain by the Shield executor.

Readme

@newton-xyz/vaultkit

VaultKit is the TypeScript SDK for vault curators. It wraps every vault-management action behind a Newton Protocol policy attestation, so the curator's manager role is structurally incapable of executing actions that violate the policy.

Curators don't write calldata by hand and don't integrate a new vault product. They use the vendor's existing SDK (@morpho-org/blue-sdk-viem) to produce calldata, and VaultKit plus the on-chain Shield contract handle the policy gating.

VaultKit and Shield

VaultKit is the product — the SDK you install (@newton-xyz/vaultkit) and the brand for the whole vault-protection / vault-compliance toolkit. Shield is the core on-chain mechanism it's built on: a NewtonPolicyClient executor contract that enforces the Newton policy on every call before it reaches the vault. That's why the SDK's entry point is createShield(...) and its client is ShieldClient — you're constructing and driving a Shield, the primitive that makes VaultKit protect your vault. VaultKit is the kit; Shield is the engine inside it. The naming is intentional and stable: install @newton-xyz/vaultkit, call createShield.


Highlights (target shape)

  • createShield({ apiKey, walletClient, rpc, policyClientAddress, policy, policies, vault }) - pairs a deployed Shield clone address with a policy set (a composite's module policies and optional gate, or one bare policy), deploying the clone if necessary. On Newton protocol 0.7 a Shield binds a policy set (fail-closed AND), and each oracle is its own NewtonPolicy. For a composite of N oracle modules, declare the policy synchronously with definePolicy({ chainId, env }).with(vaultsfyi).with(chainalysis) (a PolicyDraft) and pass each module's deployed policy as policies: { vaultsfyi: '0x…', chainalysis: '0x…' }; createShield checks each one serves its pack's WASM on-chain. For a bare deployed policy, pass policyFromAddress({ address, chainId, env }) (a BarePolicy) and no policies. A policy composes any mix of published packs and custom oracles (a custom oracle is authored with defineOracle(...) from @newton-xyz/policy-core); a single-oracle curator passes one module: definePolicy({ chainId, env }).with(vaultsfyi). Add composite-level params no oracle owns (a source allowlist, a fee ceiling) with .withPolicyParams(schema), carried by a pure-Rego gate policy (policies._policy). Returns a ShieldClient with setup functions (.setParams(paramsByShortId), which binds the set via setPolicies, and .uploadSecrets(secretsByShortId), keyed by BARE_POLICY_ID for a bare policy with its own oracle) and the execution entrypoint .sendCall({ to, data, functionSignature, prepareQueryOptions }) that runs the policy's aggregated prepareQuery -> wasmArgsSchema -> newt_createTask (one wasm_args entry per policy) -> shield.executeDirect on every call. client.policy is a ResolvedPolicy (introspect .policies for the set and .modules for the resolved oracles' objective facts - id, policyAddress, wasmCid, policyCodeHash, schemas; derive a trust label with the re-exported classifyProvenance, injecting the audited registry you trust). See docs/sdk/composites.md.
  • Deployment process Configuration order: definePolicy().with() -> createShield -> setParams -> uploadSecrets -> sendCall is needed for first-time configuration ONLY. By passing a configured Shield contract, the client runs the verification ladder (client.verification), detecting and binding to the existing deployment; client.reverify() re-runs it after setParams. Functions setParams and uploadSecrets can be called later to update configuration. Use param mustDeploy to ensure not binding to existing contracts that you didn't deploy. Use param expectedParams to assert the on-chain params byte-for-byte (verification rung 4); attachWithoutVerify: true is the sole escape below rung 1, for attaching to a freshly-deployed clone before setParams. Increment version to replace unusable or abandoned shield deployments. For testing on a non-production network where an oracle's external data source has no coverage (e.g. vaults.fyi indexes mainnets only), a module may expose its own data-source override in sendCall's prepareQueryOptions (e.g. { vaultsfyi: { network, vaultAddress } }) to point its lookup at a real mainnet target while the Shield executes on a testnet - a testing affordance only; leave it unset in production so the policy describes the same vault it gates.
  • NewtonShield — lower-level runtime exposed via .guardedCall({ to, data, functionSignature, wasmArgs, expectedPolicies? }). Use this when you want to drive intent submission yourself. wasmArgs is either one JSON value (a string or object), sent to every oracle-backed policy of the Shield's set as read at call time (0x to each pure-Rego one), or the per-policy Hex[] (one entry per policy, in set order), which REQUIRES expectedPolicies, the ordered set it was built for (IntentArgs = JsonIntentArgs | PerPolicyIntentArgs). Either way the call fails closed with PolicyMismatchError unless the task the gateway returns is frozen to that set and those wasm_args.
  • Policy packs ship as separate npm packages. Install only the ones you integrate, e.g. pnpm add @newton-xyz/policy-pack-vaultsfyi. A pack is a ready-made oracle; a custom oracle you author with defineOracle(...) (from @newton-xyz/policy-core) is the same kind of thing, and a policy freely mixes them. The SDK declares @newton-xyz/policy-core (the foundational policy contract) as a peer dep. Build the policy with definePolicy({ chainId, env }).with(...) (add composite-level params with .withPolicyParams(schema)), deploy one NewtonPolicy per module (the pack's reference Rego + its WASM), then pass the policy and those policies to createShield. The low-level defineComposite resolver createShield calls internally is not re-exported from vaultkit; import it from @newton-xyz/policy-core only for standalone composition.
  • A typed error hierarchy (PolicyDeniedError, PolicyMismatchError, GatewayHttpError, GatewayRpcError, GatewayTimeoutError, RpcReadError, NewtonTaskEvaluationError, TransactionFailedError, InvalidConfigurationError, ConcurrentIntentError, UnsupportedChainError, ShieldDeploymentNotFoundError). Composite resolution errors from @newton-xyz/policy-core (CompositeBuilderError, CompositeModuleSetMismatchError, PolicyWasmCidMismatchError, PinnedWasmCidMismatchError, PinnedWasmCidNotInModuleHistoryError, CompositePrepareQueryError) pass through createShield / sendCall unchanged and are re-exported from vaultkit, so one import narrows them all.
  • Browser-safe core. No node:* imports.

Install

pnpm add @newton-xyz/vaultkit @newton-xyz/policy-core viem zod

# Plus one or more policy packs:
pnpm add @newton-xyz/policy-pack-vaultsfyi

@newton-xyz/policy-core, viem, and zod are peer dependencies — the SDK uses whatever versions your application has installed. @newton-xyz/policy-core is the foundational policy contract (the PolicyPack interface, the composite's per-policy params codec and schema generation, policy-set introspection, defineOracle); vaultkit and every @newton-xyz/policy-pack-* depend on it. Per-pack packages (@newton-xyz/policy-pack-vaultsfyi, @newton-xyz/policy-pack-blockaid, …) are independent: install only the packs you integrate. Vendor SDKs (@morpho-org/blue-sdk-viem, etc.) are also peer deps; install only the ones you use.


Supported chains

SUPPORTED_CHAINS (in sdk/src/chains.ts) covers two mainnets and two testnets:

| Chain | Chain id | Network | Status | | ------------- | ----------- | ------- | ----------------------------------------------- | | Ethereum | 1 | Mainnet | 0.7 deployment pending | | Base | 8453 | Mainnet | 0.7 deployment pending | | Sepolia | 11155111 | Testnet | 0.7 deployment pending | | Base Sepolia | 84532 | Testnet | 0.7 deployment pending |

No Newton protocol 0.7 Shield factory is recorded yet: every SHIELD_DEPLOYMENTS slot is null, so on every chain createShield throws ShieldDeploymentNotFoundError wherever it needs the factory (predicting the clone address when no policyClientAddress is passed, the other-version clone scan, and deploying) until the 0.7 deployment for that (chainId, env) is recorded, or you pass createShield({ deployment }) for a factory you deployed yourself. Attaching to an existing clone by policyClientAddress never needs the factory and works without a deployment. A policyClientAddress with no code is deployed only if it is the factory's predicted clone for (curator, vault, version); any other address - or any no-code address when no deployment is recorded or passed, since it then cannot be the predicted clone - is an InvalidConfigurationError. The pre-0.7 rollout's audit-trail JSON (including the prod mainnet factories) lives at deployments/{chainId}-{env}.json; vaultkit 3 does not use those factories. See docs/deployment/chains.md for the add-a-chain procedure.

The SDK's per-chain registry lives in sdk/src/deployments.ts (SHIELD_DEPLOYMENTS, keyed by (chainId, env)). The audit trail per (chainId, env) slot lives in deployments/{chainId}-{env}.json at the repo root — those JSON files travel with the source repo and are not loaded at SDK runtime. Calling createShield on an unsupported chain throws UnsupportedChainError; calling against a supported chain with no deployment recorded yet throws ShieldDeploymentNotFoundError wherever the factory is needed (no policyClientAddress to attach to, or a deploy) - attaching to an existing clone by policyClientAddress still works. Either way, the SDK fails before any tx is sent.


Repository structure

sdk/
├── src/
│   ├── index.ts            ← top-level exports
│   ├── builder.ts          ← `createShield(...)` factory
│   ├── pack-runtime.ts     ← `buildIntentArgs` / `encodePackParams` helpers
│   ├── shield.ts           ← `NewtonShield` low-level runtime
│   ├── factory.ts          ← `predictShieldAddress` (CREATE2 derivation)
│   ├── gateway.ts          ← Newton Gateway HTTP/JSON-RPC client
│   └── vendors/<name>/     ← vendor module subpath modules
├── test/
├── package.json
├── tsconfig.json
├── tsup.config.ts          ← ESM + CJS + .d.ts build
├── vitest.config.ts
└── README.md

Pack code lives in newton-policy-packs; each pack publishes as its own @newton-xyz/policy-pack-<name> npm package on its own release cadence.


Local development

Requires Node ≥22 and pnpm ≥10. The SDK lives in a pnpm monorepo at the repo root.

# from repo root
pnpm install
pnpm --filter @newton-xyz/vaultkit build
pnpm --filter @newton-xyz/vaultkit typecheck
pnpm --filter @newton-xyz/vaultkit test

To test against a consumer app without publishing:

"@newton-xyz/vaultkit": "link:../vaultkit/sdk"

Versioning

Changesets for semver bumps. Public-surface changes get a .changeset/*.md entry per PR via pnpm changeset.

Vendor SDK breaking changes cascade through. Peer-dep versions are tracked, and any vendor-side breaking change is treated as a VaultKit SDK semver-major.


License

Apache-2.0