SDK overview
This page describes @erc7730/sdk@0.9.0 from this repository checkout. The CLI is versioned independently.
npm install @erc7730/sdk# optional peer for PublicClient / adaptersnpm install viemEntry points
Section titled “Entry points”| Import | What you get |
|---|---|
@erc7730/sdk |
Full runtime. Sourcify is opt-in (enableSourcifyAbiLoader or loadVerifiedAbi); import does not register a loader. useSourcifyFallback defaults to false |
@erc7730/sdk/lite |
Deprecated narrower entry of the same install. Omits the Sourcify client and generateDescriptor from that graph. Descriptor lookup is still createOfficialRegistry() / { pin } |
@erc7730/sdk/viem |
decodeViemTransaction / decodeViemTypedData adapters (does not register a Sourcify loader) |
Quick start
Section titled “Quick start”1. Smallest call (intent + fields)
Section titled “1. Smallest call (intent + fields)”import { createOfficialRegistry, decodeTransaction } from '@erc7730/sdk';
const registry = createOfficialRegistry();
const result = await decodeTransaction( { to: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', data: '0xd0e30db0', value: 10n ** 18n, chainId: 1, }, { registry });
console.log(result.interpolatedIntent ?? result.intent);console.log(result.fields);2. Production (explicit pin + trust)
Section titled “2. Production (explicit pin + trust)”Same call with a frozen SHA and officialOnlyPolicy(). That policy rejects Sourcify / generateDescriptor / inferred / basic as high confidence:
import { createOfficialRegistry, decodeTransaction, officialOnlyPolicy, VENDORED_REGISTRY_COMMIT,} from '@erc7730/sdk';
const registry = createOfficialRegistry({ pin: VENDORED_REGISTRY_COMMIT });
const tx = { to: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', data: '0xd0e30db0', value: 10n ** 18n, chainId: 1,} as const;
const result = await decodeTransaction(tx, { registry, trust: officialOnlyPolicy(),});
console.log(result.interpolatedIntent ?? result.intent);console.log(result.source, result.confidence, result.trust.accepted);The tarball does not ship a descriptor catalog. With no network, pass indexes and cache. ERC-20, ERC-721, and WETH builtins stay as local fallbacks.
Prefer the wallet guide for prefetch, extend(), ExternalDataProvider (token / ENS / NFT — the SDK does no RPC), trustedTokens, batch, and UserOp.
- Decode —
decodeTransaction/decodeTypedData/decodeBatch/decodeUserOp - Validate & resolve — schema, includes, path engine
- viem adapters
- Generated API — TypeDoc from exported symbols
- Trust · Registry