Overview
The SDK provides deposit and withdrawal methods for managing USDC on Bison:- Deposits: Use
executeDepositFlowto deposit USDC instantly - Withdrawals: Use a two-step process with
scheduleWithdrawandclaimWithdrawto request and claim withdrawals - Balance Checking: Use
getDepositedUsdcBalanceto check your available balance
To avoid ambiguity, we denote the smallest possible multiple of USDC (0.000001 USDC) as one
uusdc,
which stands for µUSDC (micro-USDC), and denote the smallest possible multiple of a contract (0.01 contract)
as one ccontract (centicontract).User-facing USDC balances are specified as fixed-point strings (e.g. "1.2625" for USDC). Contract quantities
in the API and SDK are specified as integer ccontracts strings (e.g. "1050" for 10.50 contracts at precision 2).Depositing USDC
Deposit USDC to enable trading on Kalshi markets.executeDepositFlow
Parameters
WalletClient
required
Viem wallet client for signing transactions
PublicClient
required
Viem public client for reading contract state
string
required
User’s Ethereum address
string
required
Chain identifier (
"base" or "bsc"). Vault and USDC addresses are automatically resolved from the /info endpoint.string
required
Amount in µUSDC as an integer string (e.g.,
"100000000" for 100 USDC). Use usdcToUusdc() helper for conversion.Returns
Transaction hash of the deposit transaction.Example
Withdrawing USDC
Withdrawals use a two-step process for security and efficiency:- Schedule: Request a withdrawal with
scheduleWithdraw(no gas required, just a signature) - Claim: Execute the withdrawal on-chain with
claimWithdraw(requires gas)
scheduleWithdraw
Schedules a withdrawal request. This method requires only a signature and does not consume gas.
Parameters
WalletClient
required
Viem wallet client for signing the withdrawal request
string
required
User’s Ethereum address
string
required
Chain identifier (
"base" or "bsc")string
required
Amount in µUSDC as an integer string (e.g.,
"50000000" for 50 USDC). Must not exceed your deposited balance. Use usdcToUusdc() helper for conversion.Returns
Withdrawal details including the uniquewithdrawId and current status. Note that amountUusdc is returned as a string.
Example
getPendingWithdraws
Get all pending withdrawals for a user.
Example
claimWithdraw
Claim all available withdrawals on-chain. This method executes a blockchain transaction and requires gas.
Parameters
WalletClient
required
Viem wallet client for signing transactions
PublicClient
required
Viem public client for reading contract state
string
required
User’s Ethereum address
string
required
Chain identifier (
"base" or "bsc")Returns
Transaction hash of the withdrawal claim transaction.Example
Complete Withdrawal Example
Checking Balance
Get the user’s deposited USDC balance:getDepositedUsdcBalance
Example
Low-Level Methods
For advanced use cases, you can use the low-level authorization methods:getWithdrawAuthorization
Get a signed authorization for claiming withdrawals. This is used internally by claimWithdraw, but you can call it directly for custom implementations:
Example
Error Handling
All deposit and withdrawal methods throw errors when operations fail. Here’s how to handle common errors:Withdrawal Error Handling
Important Notes
Withdrawals
- Withdrawals use a two-step process: schedule then claim
scheduleWithdrawonly requires a signature (no gas)claimWithdrawexecutes the on-chain transaction (requires gas)- Withdrawal status transitions:
pending→fill-locked→unclaimed→claimed - You can only schedule withdrawals up to your available balance (deposited balance minus active positions)
- Multiple scheduled withdrawals are batched when claiming
- Withdrawal scheduling signatures expire after 10 minutes
Deposits
- The SDK handles USDC approval automatically for deposits
- After deposits, balances update automatically via blockchain events
General
- All amounts in the API are in µUSDC (6 decimal places: 1 USDC = 1,000,000 µUSDC)
- API responses return amounts as strings for precision
- Use
usdcToUusdc()to convert USDC to µUSDC, then call.toString()for API inputs - Use
uusdcToUsdc()to convert µUSDC to display format (returns string) - Vault and USDC addresses are automatically fetched from the
/infoendpoint and cached per client instance - Transaction confirmation can take 2-5 seconds on Base network