@anvilresearchlabs/sdk API reference
The SDK grouped by the import path each part comes from. Start from the entry point your code imports: each group’s overview explains how its APIs fit together, and the sidebar lists them by group and kind.
@anvilresearchlabs/sdk/core
Import from @anvilresearchlabs/sdk/core. The protocol surface with no React dependency: the
AnvilSDK class and its namespaced operations (sdk.loc, sdk.vault, sdk.pricing,
sdk.tokens). The package root, @anvilresearchlabs/sdk, exports exactly the same surface.
- Setup and configuration: Create an SDK instance from a network profile and viem clients.
- LOC lifecycle: Create, read, extend, redeem, convert, and cancel Letters of Credit.
- Tokens and balances: Look up ERC-20 token identity, metadata, and wallet balances.
- Vaults, collateral, and risk: Deposit, withdraw, and read collateral in the Collateral Vault, and size the collateral a LOC needs.
- Pricing and oracles: Read Pyth oracle prices between tokens and in USD.
- Transactions, wallets, and signatures: Run the multi-step workflow every write returns, and follow each step’s status.
- Validation: Check user input before a wallet is involved, without throwing.
- Errors: Catch the typed error classes the SDK throws at public boundaries.
- Advanced utilities and types: Convert between the shapes contracts use and the shapes an app shows.
@anvilresearchlabs/sdk/react
Import from @anvilresearchlabs/sdk/react. Headless hooks and the AnvilProvider for React
integration. UI components are not part of this entry point — import them from
@anvilresearchlabs/sdk/components.
- React provider and hooks: Connect React applications to the SDK: the provider and the read and workflow hooks.
@anvilresearchlabs/sdk/components (beta)
Import from @anvilresearchlabs/sdk/components. The beta UI components and the browser helper that
ships beside them. Render them under the AnvilProvider from @anvilresearchlabs/sdk/react.
- React components: Beta components that drop a whole LOC flow into a React app, and the helper that ships beside them.
A–Z
The complete API index lists the reference alphabetically, for when you know the exact name.