Configuration
Create the client with defaults for Liquidium mainnet:
import { LiquidiumClient } from "@liquidium/client";
const client = new LiquidiumClient();
Pass config when your app needs custom transports, headers, canister IDs, or EVM read support:
const client = new LiquidiumClient({
apiBaseUrl: "https://app.liquidium.fi/api/sdk",
headers: {
"x-client-name": "my-app",
},
evmRpcUrl: import.meta.env.VITE_EVM_RPC_URL,
});
Config Fields
| Field | Use |
|---|---|
environment | Select bundled canister IDs. The SDK currently bundles only "mainnet". |
icHost | Override the ICP replica host. |
identity | Send signed canister calls with a caller identity. |
apiBaseUrl | Override the Liquidium SDK HTTP API root. Defaults to https://app.liquidium.fi/api/sdk. |
headers | Add headers to SDK HTTP API requests. |
canisterIds | Partially override lending, ethDeposit, simpleLoans, or pools.{btc,usdt,usdc,icp} for custom deployments. |
fetch | Provide a custom fetch implementation. |
timeoutMs | Set the SDK API request timeout in milliseconds. Defaults to 30_000. |
evmRpcUrl | Create a viem public client for EVM reads. |
evmRpcHeaders | Add headers to EVM RPC requests. |
evmPublicClient | Use an existing viem-compatible read client. When supplied, it takes precedence over evmRpcUrl and evmRpcHeaders. |
Use nested canister overrides:
const client = new LiquidiumClient({
canisterIds: {
lending: "aaaaa-aa",
simpleLoans: "u5rm3-niaaa-aaaar-qb7eq-cai",
pools: {
btc: "bbbbb-bb",
},
},
});
Removed flat keys such as instantLoans, btcPool, and ercPool are rejected with LiquidiumErrorCode.VALIDATION_ERROR.
Set VITE_INFURA_API_KEY or VITE_EVM_RPC_URL when you run an example that needs Ethereum reads.