# Buy Consignment

Users can purchase the territories on consignment through transactions. After calling this transaction, the corresponding consignment order will be locked. During the lock-in period, users can cancel the purchase. When the lock-in period ends, the subsequent transaction content will be automatically executed.

```rust
/// Purchases a territory on consignment through a transaction. 
///
/// When this function is called, the corresponding consignment order will be locked.
/// During the lock-in period, users have the option to cancel the purchase. 
/// If the purchase is not canceled within the lock-in period, the subsequent 
/// transaction content will be automatically executed.
///
/// # Arguments
///
/// * `token` - A reference to a string slice that holds the authentication token.
/// * `rename` - A reference to a string slice that holds the name to be associated with the consignment order.
///
/// # Returns
///
/// This function returns a `Result` which is:
/// * `Ok((TxHash, BuyConsignment))` - A tuple containing the transaction hash and the `BuyConsignment` struct.
/// * `Err(Box<dyn std::error::Error>)` - An error if the transaction fails.
///
pub async fn buy_consignment(
        &self,
        token: &str,
        rename: &str,
    ) -> Result<(TxHash, BuyConsignment), Box<dyn std::error::Error>>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.cess.network/developer/cess-sdk/sdk-rust/chain/storage_handler/buy_consignment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
