ABIs
Typed as const ABI arrays for the three Apyx contracts, exported for
use with viem directly.
import { ApxUSDAbi, ApyUSDAbi, ApyUSDRateViewAbi } from '@koed_jang/apyx-sdk';
When to reach for the raw ABIs
The first-class API on apyx.apxUSD / apyx.apyUSD / apyx.apyUSDRateView
covers every method shipped on these contracts. Reach for the raw ABIs
when you want one of:
-
viem’s typed contract instances for advanced patterns:
import { getContract } from 'viem'; const apx = getContract({ address: apyx.addresses.apxUSD, abi: ApxUSDAbi, client: apyx.publicClient, }); -
Multicall batching through
publicClient.multicall, where you pass{ address, abi, functionName, args }items directly. -
Event log decoding:
import { decodeEventLog } from 'viem'; const event = decodeEventLog({ abi: ApyUSDAbi, data: log.data, topics: log.topics, }); -
Permit / typed-data hashing that needs the EIP-712 domain separator constants embedded in the ABI’s
permitdefinition.
For everything else, the typed module wrappers are a shorter path.
Available ABIs
| Export | Contract | What it covers |
|---|---|---|
ApxUSDAbi | apxUSD | ERC-20 + EIP-2612 permit + supply cap views + pausability. |
ApyUSDAbi | apyUSD | Full ERC-4626 (deposit/mint/withdraw/redeem + their previews + max-views) plus the share-token ERC-20 surface. |
ApyUSDRateViewAbi | apyUSDRateView | apy(), annualizedYield(), precision(), vault(). |
Each is a readonly tuple typed as const, so passing it to viem
yields full type-narrowing on functionName, args, and the return.
Source provenance
JSON sources under abis/ in this repo are vendored from
apyx-labs/subquery at commit 651ba2c9f8d971547828b206f73008c850009028.
The typed as const wrappers are generated from the JSON by
pnpm gen:abis (a tsx script under scripts/gen-abis.ts). After
updating the JSON files, regenerate:
pnpm gen:abis
The generated wrappers land in src/generated/ and are committed —
consumers don’t need to run the generator themselves.
Related
- SDK Overview — how the ABIs feed into the typed contract modules.
- apxUSD, apyUSD, apyUSDRateView — wrapped, ready-to-use modules that internally use these same ABIs.