# SDK Concepts \[How VaultKit 2.1 models policies, resolved modules, vendor extensions, intents, and verification.]

## Policy Inputs and Resolved Policies

`createShield(...)` accepts either a `PolicyDraft` created with `definePolicy({ chainId, env }).with(...)` or a `BarePolicy` created with `policyFromAddress(...)`.

After onchain resolution, both become a `ResolvedPolicy` exposed as `client.policy`. It contains the deployed address, chain, environment, optional params codec, and `modules`.

## Policy Packs and Oracles

A policy pack is a typed TypeScript wrapper for one policy-data oracle. It provides schemas, deployment records, `prepareQuery(...)`, and metadata. Published `@newton-xyz/policy-pack-*` packages and locally authored `defineOracle(...)` values share this interface.

The SDK packages do not contain the oracle's Rego or WASM. Those artifacts are built and deployed separately.

## Params, Secrets, and `wasmArgs`

* Params are curator-controlled configuration encoded into the onchain policy manifest.
* Secrets are encrypted locally and uploaded per oracle.
* `wasmArgs` are per-call evaluation inputs produced by each oracle's `prepareQuery(...)`.

Callers pass typed overrides under `prepareQueryOptions.<shortId>`. The policy pack, not the vendor module, owns the resulting `wasmArgs`.

## Vendor Modules and `.extend(...)`

```typescript
import { morphoActions } from '@newton-xyz/vaultkit/vendors/morpho'

const client = (await createShield(config)).extend(morphoActions)
await client.morpho.reallocate(vault, allocations)
```

| Import | Namespace | Scope |
| --- | --- | --- |
| `vendors/morpho` | `client.morpho.*` | MetaMorpho curator and allocator actions |
| `vendors/morpho-blue` | `client.morphoBlue.*` | Morpho Blue position operations for managed sleeves |
| `vendors/euler` | `client.euler.*` | Euler Earn manager and allocator actions |
| `vendors/euler-vault` | `client.eulerVault.*` | EVault governor actions |
| `vendors/superform` | `client.superform.*` | SuperVault strategy-manager actions and typed hooks |

`euler` and `eulerVault` are distinct APIs. Likewise, `morpho` targets MetaMorpho aggregation vaults while `morphoBlue` targets the Morpho Blue singleton.

## Generic Calls

`sendCall(...)` is the escape hatch for an unwrapped action:

```typescript
await client.sendCall({
  to,
  data,
  value,
  functionSignature: 'someManagerAction(uint256)',
  prepareQueryOptions,
})
```

The integration owns calldata integrity when using this method.

## Intent

An `Intent` binds the caller, target, value, calldata, chain, and human-readable function signature. Operators evaluate that exact action; the SDK rejects task and response data that do not match.

## Verification Ladder

Attachment verification is monotonic:

1. Policy address
2. Oracle set and WASM identities
3. Parameter decoding
4. Canonical byte equality against `expectedParams`

`client.verification` is a snapshot. Call `client.reverify()` after configuration changes. A bare policy with no modules can satisfy address and codec checks but does not prove that an oracle set exists.

## Blocked-Intent Assertions

`assertIntentBlocked(...)` expects a policy denial and confirms through `eth_call` that the denied attestation cannot execute. It is a negative assertion for integration tests and monitoring, not a transaction.

## Browser Safety

VaultKit core avoids `node:*` imports. A vendor SDK or custom oracle helper may introduce its own runtime requirements; check those dependencies before bundling for the browser.
