Deposit Collateral
Deposit pUSD when the account needs collateral for opening or maintaining Perps positions.- TypeScript
- Python
- API
1
Create a Secure Client
Create a
SecureClient for the wallet that will fund the Perps account. If you
already have a Polymarket wallet, pass it as wallet and include a Relayer API
key so the SDK can submit gasless transactions. If you are creating a wallet
programmatically, use a Builder API key so the SDK can create the Deposit Wallet
for that signer.2
Set Up Deposit Approvals
Set up the approvals required for Perps collateral deposits. The SDK skips work
that is already complete.
3
Deposit Collateral
Deposit pUSD from the user’s Polymarket wallet into the Perps account. Make sure
the wallet has pUSD before depositing. The minimum Perps deposit is 10 pUSD.
Amounts use raw pUSD base units, so 10 pUSD is
10_000_000n.deposit.wait() confirms that the chain transaction settled. Perps may take a
moment to credit the account after that.4
Verify the Deposit
Open a Perps session and read account state after the deposit settles.Use
portfolio.withdrawable to check collateral available for withdrawal and
deposits.items to reconcile deposit history. The withdrawable value already
accounts for the 10% notional reserve.Withdraw Collateral
Withdraw pUSD when the account has available collateral that should return to the authenticated wallet. Withdrawals must satisfy the withdrawal margin requirements, including the 10% reserve against open-position notional. Collateral available for trading can therefore exceed collateral available for withdrawal.- TypeScript
- Python
- API
Request a withdrawal to the authenticated wallet.
Amounts use raw pUSD base units, so 10 pUSD is The SDK signs the withdrawal request with the Polymarket account signer and
returns the Perps withdrawal ID.To track the withdrawal, open a Perps session and list withdrawals.To narrow the results to a single state, pass a For what each status means, see
Withdrawals.For more details on authenticated sessions, see Authenticated
Sessions.
10_000_000n.withdrawalStatus filter with
a PerpsKnownWithdrawalStatus member. The filter accepts one status per
request. For example, list the withdrawals that are still pending:Transfer Between Your Accounts
Move pUSD between two Perps accounts with an internal transfer. The transfer settles on the exchange ledger, with no onchain transaction and no fee. The source owner can transfer to another Perps account. Transfers are limited to withdrawable collateral after accounting for pending withdrawals and transfers.- TypeScript
- Python
- API
Use The result is a
client.transferPerpsCollateral() on the owner-signed SecureClient from
Set Up Perps Access.PerpsInternalTransferId. amount is decimal pUSD, and its exact
string is signed unchanged. Choose a recipient distinct from the owner’s address.
label accepts 1 to 64 UTF-8 bytes and helps identify the transfer in history.
The SDK signs with the owner and attempts the submission once.Reconcile a Transfer
Use authenticated account history to locate the collateral movement and compare its recipient, amount, and direction with your intended transfer.- TypeScript
- Python
- API
Use Each item is a
session.listInternalTransfers() with the authenticated session from
Set Up Perps Access.PerpsInternalTransfer. amount is a decimal string in pUSD units;
direction is "in" or "out" relative to this account. counterparty is the
other account’s owner address.The default window is the past 90 days. Set start and end in epoch milliseconds
to choose a window, or pass a returned nextCursor as cursor to resume it.
The paginator deduplicates overlapping records and raises UnexpectedResponseError
if a full millisecond cannot be paged without skipping records.Review Funding History
Use deposit and withdrawal history to reconcile collateral movements after your integration submits funding requests. See Authenticated Sessions for how to create an authenticated session for private account history reads.- TypeScript
- Python
- API
List deposit or withdrawal history from an authenticated Perps session.