# cancel_transfer · FT4 Rell API · Chromia Docs (concept)

> @mount("ft4.crosschain.cancel_ transfer")
operation cancel_ transfer(init_ transfer_ tx: gtx_ transaction, init_ tx_ op_ index: integer, previous_ hop_ tx:

Source: https://docs.chromia.com/pages/ft4-rell/-f-t4-library/lib.ft4.external.crosschain/cancel_transfer/

OPERATION

# cancel\_transfer

```signature
@mount("ft4.crosschain.cancel_transfer")
operation cancel_transfer(init_transfer_tx: gtx_transaction, init_tx_op_index: integer, previous_hop_tx: gtx_transaction, op_index: integer, hop_index: integer)
```

[Source](https://gitlab.com/chromaway/ft4-lib/-/blob/development/rell/src/lib/ft4/external/crosschain/operations.rell#lines-446)

Cancels a crosschain transfer that has expired. This operation must be called in place
of `apply_transfer` to start the transfer canceling process. `unapply_transfer` must
then be called on all previous chains to bring the funds back to the sender account.

Throws `"TRANSFER NOT EXPIRED"` if the transfer has not yet expired.

Throws in various cases of misconfiguration. Some examples:

* the transfer has already been applied, canceled or unapplied on this chain.
* the chain at `hop_index` on the init transaction is not this chain
* the `op_index` on `previous_hop_tx` does not point to:
  + `init_transfer` when `hop_index` is 0
  + `apply_transfer` otherwise
* the `init_tx_op_index` does not point to `init_transfer` on its `init_transfer_tx`
* the operation preceding `init_transfer` is not an auth operation
* arguments found in `init_transfer_tx` and `previous_hop_tx` do not match
* `hop_index` is out of bounds
* `previous_hop_tx` has not been sent to the chain that comes before this one on the
  transfer hops

Throws if the transaction is missing the `iccf_proof` operation, which demonstrates that
the block containing the `previous_hop_tx` has been anchored from the previous chain.

Anyone can call this operation, but it needs to include an `iccf_proof` operation that
`apply_transfer` was performed on the previous chain.

**Parameters**

* **init\_transfer\_tx** — the transaction containing the `init_transfer` operation which corresponds to the transfer to cancel
* **init\_tx\_op\_index** — the index of the `init_transfer` operation in `init_transfer_tx`
* **previous\_hop\_tx** — the transaction containing the `apply_transfer` operation of the previous hop
* **op\_index** — the index of the `apply_transfer` or `init_transfer` operation in `previous_hop_tx`
* **hop\_index** — which index in the hops array provided in the original transaction this chain represents.

**See Also**

* `core.auth.is_auth_op` — for information on auth operations
* `core.crosschain.applied_transfers` — to know more about the crosschain transfer workflow
* `core.crosschain.canceled_transfers` — to know more about transfer canceling
* `crosschain.unapply_transfer` — for information on

[View this page on docs.chromia.com](https://docs.chromia.com/pages/ft4-rell/-f-t4%20-library/lib.ft4.external.crosschain/cancel_transfer.html)Generated API reference, mirrored from the live docs
