deleteQuoteTpSl
Cancel a live TP or SL order by its handler-issued cohQuoteId. Internally: resolves the handler URL + DELETE signing spec, builds a TpSlDeleteMessage bound to the target cohQuoteId + side, signs it with the session-key wallet, and calls DELETE /api/v5/ with { typedData, signature, signer }.
The handler returns 200 on accept; the cancel is only fully confirmed once the WebSocket reports state: "cancel" (or canceled / cancelled). Callers should subscribe via watchTpSlNotifications and reconcile.
import { deleteQuoteTpSl } from "@symmio/trading-core";
await deleteQuoteTpSl(config, {
from: sessionKey,
quoteId: 42n,
virtualAccount,
cohQuoteId: "coh4213",
conditionalOrderType: "take_profit",
});Parameters
quoteIdbigintrequiredOn-chain quote id the order belongs to (used for cache invalidation).
virtualAccountAddressrequiredPartyA (the VA address) that owns the quote.
cohQuoteIdstringrequiredHandler-issued conditional-order id targeted by the delete.
conditionalOrderType"take_profit" | "stop_loss"requiredWhich side is being canceled (TpSlConditionalOrderType).
fromAddressoptionalSession-key signer the wallet client resolves for. Defaults to the connected wallet in the React layer.
chainIdnumberoptionalTarget chain id. Defaults to the config’s defaultChainId.
Returns
DeleteQuoteTpSlReturnTypesuccesstrueAlways true on a resolved call (failures throw).
Throws
SymmErrorwhen the chain has notpslconfig or signing fails.SymmApiErrorwhen the handler request fails.
Mutation options
import { deleteQuoteTpSlMutationOptions } from "@symmio/trading-core";
import { useMutation } from "@tanstack/react-query";
useMutation(deleteQuoteTpSlMutationOptions(config));deleteQuoteTpSlMutationOptions returns { mutationKey, mutationFn }; the mutationFn takes the same parameters object as the action.
Related
TpSlDeleteMessage— the message body built and signed.watchTpSlNotifications— the confirmation stream.useDeleteQuoteTpSl— React binding.