defineComposite(...), createShield(...), grant the clone its manager role, then call shield.morpho.reallocate(...). For Morpho-specific curator guidance, including Base Sepolia setup and MetaMorpho role requirements, see Morpho. For Euler-specific typed overlays, see Euler and Euler Earn. For lower-level examples, see Examples.
Prerequisites
- Node 22 or newer
pnpm10 or newer, or the package manager your app already uses- A funded curator EOA or Safe-controlled signer on the target chain
- A Newton Gateway API key from the dashboard
- The vault protocol SDKs your integration uses
Install Packages
VaultKit integrations use a core SDK package, a shared policy-pack helper package, one or more individual policy packs, and optionally a vendor SDK.Core Packages
Install these for every VaultKit integration:| Package | When you need it |
|---|---|
@newton-xyz/vaultkit | Always. Provides createShield, the Shield client, typed vendor overlays, generic sendCall, and SDK errors. |
@newton-xyz/policy-pack-shared | Always when using published policy packs. Provides helpers such as defineComposite(...) for combining one or more policy modules into the pack object passed to createShield. |
viem | Always. VaultKit uses Viem clients for chain reads, signing, and transaction submission. |
zod | Usually. Policy packs use Zod schemas to validate typed params and secrets. |
Individual Policy Packs
Install each policy pack your Shield should enforce. For the Vaults.fyi example in this guide:| Package | When you need it |
|---|---|
@newton-xyz/policy-pack-vaultsfyi | Use when enforcing Vaults.fyi vault-risk checks such as risk score, APY movement, TVL drawdown, critical flags, or corrupted data. |
@newton-xyz/policy-pack-chainalysis | Use when enforcing Chainalysis sanctions, AML, or high-risk address screening. |
@newton-xyz/policy-pack-redstone | Use when enforcing RedStone oracle-divergence checks for stale, divergent, or sustained price-feed issues. |
@newton-xyz/policy-pack-webacy | Use when enforcing Webacy depeg-risk checks for pegged assets. |
| Other policy packs | Add only when your policy uses another data source or guardrail. |
Vendor SDKs
Install vendor SDKs only when your app uses them directly. The typed Morpho overlay uses Morpho’s published SDK under the hood, so Morpho integrations install the Morpho peer dependency:shield.sendCall(...) and encode calldata yourself, you do not need a vendor SDK. Prefer typed vendor overlays when VaultKit ships one for your protocol.
1. Create Viem Clients
VaultKit reads chain state through apublicClient and submits transactions through a walletClient.
2. Build a Policy Pack
Policy packs define the typed params, secrets, and per-callwasmArgs used during Newton operator evaluation. For composite policies, wrap the modules you want to enforce:
3. Create or Attach to a Shield
createShield is idempotent. It predicts the deterministic Shield address from the curator, vault, and version. If a clone exists with compatible configuration, the SDK attaches to it; otherwise it deploys a new clone through ShieldFactory.
If you expect an existing clone, pass the known address and expected params:
expectedParams, the SDK throws a typed configuration error instead of silently using the wrong Shield.
4. Configure Policy Params and Secrets
setParams writes typed policy params onchain through the Shield’s bound Newton policy. uploadSecrets encrypts API secrets in the SDK and stores them with Newton Gateway so operators can evaluate policies without exposing credentials onchain.
5. Grant the Shield Its Roles
execute and executeDirect are gated by Shield’s approved-delegate map. The initial owner is approved at clone initialization, but any hot key or Safe module that will submit actions through the Shield must be explicitly approved:
reallocate, grant the clone allocator authority, or make it the curator:
6. Execute a Morpho Action
For Morpho, use the typed overlay. It builds the MetaMorpho calldata through Morpho’s SDK, lets the composite pack derivewasmArgs, requests the Newton attestation, and submits executeDirect.
Intent, signs it with the curator wallet, asks Newton operators to evaluate the configured policy, and submits the attested call through the Shield. If the policy denies the action, the SDK raises a typed policy error and the vault call is not forwarded.
Use shield.sendCall(...) only for vendors or actions without a typed overlay. With sendCall, your integration owns the target, calldata, function signature, and any pack-specific per-call inputs.
7. Handle Policy Errors
Next Steps
Concepts
Learn how
Intent, wasmArgs, policy packs, and vendor modules fit together.Examples
Copy patterns for idempotent deploys, generic calls, retries, and read-only inspection.
Reference
Review the SDK API surface.