# stx\_deployContract

You can use the `stx_deployContract` method to request the signature of any contract deployment transaction from the user's wallet. The method lets you specify the contract code and the contract name:

<table><thead><tr><th width="200">Request parameters</th><th>Description</th></tr></thead><tbody><tr><td><code>name</code></td><td>a string representing the name under which to deploy the contract<br>Example: <code>ST000000000000000000002AMW42H.pox-3</code></td></tr><tr><td><code>clarityCode</code></td><td>a string representing the code of the contract to deploy, in Clarity language</td></tr><tr><td><code>clarityVersion</code></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2139">ℹ️</span> Optional<br>The Clarity version used for the contract code. Will default to the latest Clarity version if <code>undefined</code></td></tr><tr><td><code>postConditions?</code></td><td><p>an array of strings representing the post conditions to be applied on the transaction. <br><br> post conditions are expected as hex-encoded strings <br></p><p>To convert post conditions values to their hex representation, you can use the <code>postConditionToHex</code> helper from the <code>@stacks/transactions</code> package.</p></td></tr><tr><td><code>postConditionMode?</code></td><td>'allow' | 'deny'</td></tr></tbody></table>

You can use any Stacks library to construct these transaction. See examples using helpers from the `@stacks/transactions` package

```typescript
    import { request } from "sats-connect";
    
    try {
      const response = await request("stx_deployContract", {
        clarityCode,
        name: contractName,
      });
      if (response.status === "success") {
        alert("Success. Check console for response");
        console.log(response.result);
      } else {
        alert(errorMessage);
        console.error(response.error);
      }
    } catch (error) {
      alert(errorMessage);
      console.error(error);
    }
```

The user will see a Stacks contract deployment transaction signing request prompt in the wallet.&#x20;

The transaction will be signed and broadcasted upon user approval.

The `stx_deployContract` method returns a Promise that resolves to the `DeployContractResult` object:

<table><thead><tr><th width="162">Property</th><th>Description</th></tr></thead><tbody><tr><td><code>txid</code></td><td>a hex-encoded string representing the ID of the Stacks contract deployment transaction signed</td></tr><tr><td><code>transaction</code></td><td>a hex-encoded string representing the Stacks contract deployment transaction signed</td></tr></tbody></table>


---

# 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://docs.xverse.app/sats-connect/stacks-methods/stx_deploycontract.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.
