# clear-coldkey-swap-announcement (/docs/tx/clear-coldkey-swap-announcement)

Withdraws this coldkey's own pending swap announcement so the swap can no
longer be executed — use it if you announced to the wrong key or changed
your mind. Only clearable once the current block reaches the swap's
execute block plus the reannouncement delay — i.e. roughly the
announcement delay (\~5 days) PLUS the reannouncement delay (\~1 day) after
announcing — so it cannot be used to rapidly cycle announcements. Nothing
moves; a fresh `announce_coldkey_swap` can be made afterwards. If the
announcement was made by an attacker, `dispute_coldkey_swap` is the
right call instead.

| Signer    | Origin                                 | Pallet          | Wraps                                                                                                             |
| --------- | -------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
| `coldkey` | signed account (pallet role may apply) | SubtensorModule | [`SubtensorModule.clear_coldkey_swap_announcement`](/code/pallets/subtensor/src/macros/dispatches.rs#L2184-L2201) |

## Parameters [#parameters]

This operation takes no parameters.

Address parameters (`--hotkey`, `--coldkey`, `--dest`, ...) accept a raw ss58
address, an address-book or proxy-book name, or a local wallet/hotkey name.

## CLI [#cli]

Preview with `--dry-run` (shows fee, effects, and policy result without
submitting), then submit:

```bash
btcli tx clear-coldkey-swap-announcement --dry-run
btcli tx clear-coldkey-swap-announcement -w my_coldkey
```

## Python [#python]

```python
import bittensor as bt
from bittensor.wallet import Wallet

wallet = Wallet(name="my_coldkey", hotkey="my_hotkey")
intent = bt.ClearColdkeySwapAnnouncement()

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](/docs/concepts/client).) Or build the intent by op name, as
an agent would:

```python
result = sub.execute_tool("clear_coldkey_swap_announcement", {...}, wallet)
```

## On-chain implementation [#on-chain-implementation]

`SubtensorModule.clear_coldkey_swap_announcement` — [`pallets/subtensor/src/macros/dispatches.rs#L2186`](/code/pallets/subtensor/src/macros/dispatches.rs#L2184-L2201):

```rust
#[pallet::call_index(133)]
#[pallet::weight(<T as crate::pallet::Config>::WeightInfo::clear_coldkey_swap_announcement())]
pub fn clear_coldkey_swap_announcement(origin: OriginFor<T>) -> DispatchResult {
    let who = ensure_signed(origin)?;
    let now = <frame_system::Pallet<T>>::block_number();

    let Some((when, _)) = ColdkeySwapAnnouncements::<T>::get(who.clone()) else {
        return Err(Error::<T>::ColdkeySwapAnnouncementNotFound.into());
    };
    let delay = ColdkeySwapReannouncementDelay::<T>::get();
    let min_when = when.saturating_add(delay);
    ensure!(now >= min_when, Error::<T>::ColdkeySwapClearTooEarly);

    ColdkeySwapAnnouncements::<T>::remove(&who);

    Self::deposit_event(Event::ColdkeySwapCleared { who });
    Ok(())
}
```

Every file is browsable under [/code](/code) exactly as built into the runtime, or as plain text under `/code/raw/<path>` (index: [`/code/index.json`](/code/index.json)).
