# stx\_callContract

You can use the `stx_callContract` method to request the signature of any contract call transaction from the user's wallet. The method lets you specify the contract to call, the function to execute on the contract and the arguments to pass to the function.

<table><thead><tr><th width="200">Request parameters</th><th>Description</th></tr></thead><tbody><tr><td><code>contract</code></td><td>a string representing the contract's Crockford base-32 encoded Stacks address, and the contract name, separated by a . <br>Example: <code>ST000000000000000000002AMW42H.pox-3</code></td></tr><tr><td><code>functionName</code></td><td>a string representing the name of the contract function to call</td></tr><tr><td><code>arguments</code><br><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>Deprecated</strong></td><td><p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>This request param is now deprecated. Use <code>functionArgs</code>.</strong></p><p>an array of strings representing the arguments to pass to the function called. <br><br>The arguments are expected as hex-encoded strings of Clarity values.<br></p><p>To convert Clarity values to their hex representation, you can use the <code>cvToString</code>helper from the <code>@stacks/transactions</code> package.</p><ul><li><pre class="language-js" data-overflow="wrap"><code class="lang-js">import { cvToString } from '@stacks/transactions';
const functionArgs = [someClarityValue1, someClarityValue2];
const hexArgs = functionArgs.map(cvToString);
</code></pre></li></ul></td></tr><tr><td><code>functionArgs</code></td><td><p>an array of strings representing the arguments to pass to the function called. <br><br>The arguments are expected as hex-encoded strings of Clarity values.<br></p><p>To convert Clarity values to their hex representation, you can use the <code>cvToString</code>helper from the <code>@stacks/transactions</code> package.</p><ul><li><pre class="language-js" data-overflow="wrap"><code class="lang-js">import { cvToString } from '@stacks/transactions';
const functionArgs = [someClarityValue1, someClarityValue2];
const hexArgs = functionArgs.map(cvToString);
</code></pre></li></ul></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><p>a string representing the post condition mode to evaluate post-conditions:</p><ul><li><code>allow</code> -> in "allow" mode, other asset transfers not covered by the post-conditions are permitted</li><li> <code>deny</code> -> in "deny" mode, no other asset transfers are permitted besides those named in the post-conditions.</li></ul></td></tr></tbody></table>

```typescript
    import { request } from "sats-connect";

      const response = await request("stx_callContract", {
        contract: `${contractAddress}.${contractName}`,
        functionName,
        functionArgs: JSON.parse(functionArgs),
      });
      if (response.status === "success") {
        console.log(response.result);
      } else {
        console.error(response.error);
      }
    } catch (error) {
      console.error(error);
      alert(error);
    }
```

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

The transaction will be signed and broadcasted upon user approval.

The `stx_callContract` method returns a Promise that resolves to the `CallContractResult` 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 call transaction signed</td></tr><tr><td><code>transaction</code></td><td>a hex-encoded string representing the Stacks contract call 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_callcontract.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.
