Skip to Content
Symmio Trading-SDK — the SDK surface for builders on Arbitrum
CorePoolscancelWithdraw

cancelWithdraw

Cancel a queued LP withdrawal — remove a pending withdrawal from a pool’s withdrawal queue before it settles. The authed write that undoes a withdrawLp, keyed by the withdrawal’s id.

import { cancelWithdraw } from "@symmio/trading-core"; const receipt = await cancelWithdraw(config, { accessToken: token.accessToken, withdrawId: pendingWithdrawal.transactionId, });

The withdrawId is the transactionId of a still-PENDING withdraw row from getPoolTransactions. On success the shares return to the user’s available balance, so refetch getUserProfit to see availableLpAmount rise and pendingWithdrawLpAmount fall.

This is a REST write against the listing backend, not a contract call, and it is authed: the accessToken from authenticateListing is sent as an Authorization: Bearer <token> header, and a user may only cancel their own withdrawal. The backend is resolved from the config before the request, so a target without Pools fails immediately and without any network traffic — see resolveListingService.

No solver id

Pool listing is chain-level — one listing backend is served per chain — so cancelWithdraw takes only an optional chainId and no solverId. Pass a chainId to target a specific deployment’s listing backend; omit it to use the config’s default chain.

Parameters

accessTokenstringrequired

Bearer token from authenticateListing. Sent as Authorization: Bearer <token>. A bad or expired token yields a 401 (see Throws).

withdrawIdstringrequired

Id of the queued withdrawal to cancel — the transactionId of the pending withdraw row from getPoolTransactions, whose status is still PENDING.

chainIdnumberoptional

Target chain id. Defaults to the config’s defaultChainId. Selects which chain’s listing backend is used. There is no solverId — listing is resolved at chain level.

Returns

Promise<PoolCancelWithdrawResult>

The cancellation receipt. transactionId is the affected withdrawal’s id, echoed by the service; status is its resulting status (e.g. "canceled"), carried through as the service’s raw string.

Mutation options

import { cancelWithdrawMutationOptions } from "@symmio/trading-core"; import { useMutation } from "@tanstack/react-query"; const { mutateAsync } = useMutation(cancelWithdrawMutationOptions(config)); await mutateAsync({ accessToken, withdrawId: pending.transactionId });

cancelWithdrawMutationOptions(config) returns a { mutationKey, mutationFn } bag for useMutation. It is modeled as a mutation, not a query: it removes a queued withdrawal and returns the shares to the user’s available balance, so it is a one-shot write, not cached data.

Throws

  • LISTING_NOT_CONFIGURED — a SymmError (kind: "config") when the chain has no listing backend configured. Gate with supportsListingService to hide the cancel action instead of erroring.
  • CANCEL_WITHDRAW_FAILED — the request itself failed. Any axios failure becomes a SymmApiError carrying status, statusText, responseData, url and method; a non-axios throw becomes a plain SymmError (kind: "api"). A 401 means the accessToken was missing, malformed, or expired; a 404 an unknown id; and the service rejects a withdrawal that has already settled — each surfaces with the service’s message and status as-is.
Last updated on