Transactions
cancel-order
Cancel a order and any unfilled remainder using its complete terms.
| Signer | Origin | Pallet | Wraps |
|---|---|---|---|
coldkey | signed account (pallet role may apply) | LimitOrders | LimitOrders.cancel_order |
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
nonce | integer | yes | Permanent owner-local u64 order nonce. |
order | object | yes | Complete V1 or V2 VersionedOrder, including every economic term. |
order_data | string | no | Optional pinned canonical VersionedOrder SCALE bytes as hex. |
Address parameters (--hotkey, --coldkey, --dest, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.
CLI
Preview with --dry-run (shows fee, effects, and policy result without
submitting), then submit:
btcli tx cancel-order \
--nonce <int> \
--order '<json>' --dry-run
btcli tx cancel-order \
--nonce <int> \
--order '<json>' -w my_coldkeyPython
import bittensor as bt
from bittensor.wallet import Wallet
wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.CancelOrder(nonce=0, order={...})
sub = bt.Subtensor()
plan = sub.plan(intent, wallet) # fee, effects, policy — no submission
result = sub.execute(intent, wallet)
if not result.success:
print(result.error.code, result.error.remediation)(bt.Subtensor is also the async client — async with bt.Subtensor() as client:
— see The client.) Or build the intent by op name, as
an agent would:
result = sub.execute_tool("cancel_order", {...}, wallet)On-chain implementation
LimitOrders.cancel_order — pallets/limit-orders/src/lib.rs#L690:
#[pallet::call_index(2)]
#[pallet::weight(if order.is_authorized() { T::WeightInfo::cancel_authenticated_order() } else { T::WeightInfo::cancel_order() })]
pub fn cancel_order(
origin: OriginFor<T>,
order: VersionedOrder<T::AccountId>,
) -> DispatchResult {
let who = ensure_signed(origin)?;
ensure!(order.signer() == &who, Error::<T>::Unauthorized);
if let Some((nonce, terms)) = order.authorized_terms() {
return Self::cancel_authenticated_order(who, nonce, terms);
}
let order_id = Self::derive_order_id(&order);
ensure!(
Orders::<T>::get(order_id).is_none(),
Error::<T>::OrderAlreadyProcessed
);
Orders::<T>::insert(order_id, OrderStatus::Cancelled);
Self::deposit_event(Event::OrderCancelled {
order_id,
signer: who,
});
Ok(())
}Delegates to cancel_authenticated_order, derive_order_id.
Every file is browsable under /code exactly as built into the runtime, or as plain text under /code/raw/<path> (index: /code/index.json).