Skip to content

Commit b9addfe

Browse files
committed
extra info cost endpoint
1 parent 72361da commit b9addfe

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

docs/sdk-and-tools/rest-api/transactions.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,16 @@ Example response for cross-shard transactions:
347347

348348
`https://gateway.multiversx.com/transaction/cost`
349349

350-
This endpoint allows one to estimate the cost of a transaction.
350+
351+
:::note
352+
This endpoint estimates the **gas cost** of a transaction. Use this value to determine the appropriate `gasLimit` before sending a transaction.
353+
354+
In the background, this endpoint simulates the transaction in a read-only environment to estimate its gas cost. Any resulting smart contract results and events will also be returned.
355+
:::
356+
357+
:::warning
358+
As the transaction is executed in a simulated environment, `providing the correct nonce is mandatory`.
359+
:::
351360

352361
<Tabs
353362
defaultValue="Request"
@@ -364,10 +373,12 @@ Body Parameters
364373
| value | <span class="text-danger">REQUIRED</span> | `string` | The Value to transfer, as a string representation of a Big Integer (can be "0"). |
365374
| receiver | <span class="text-danger">REQUIRED</span> | `string` | The Address (bech32) of the Receiver. |
366375
| sender | <span class="text-danger">REQUIRED</span> | `string` | The Address (bech32) of the Sender. |
367-
| data | <span class="text-normal">OPTIONAL</span> | `string` | The base64 string representation of the Transaction's message (data). |
368376
| chainID | <span class="text-danger">REQUIRED</span> | `string` | The Chain identifier. |
369377
| version | <span class="text-danger">REQUIRED</span> | `number` | The Version of the Transaction (e.g. 1). |
370-
| nonce | <span class="text-normal">OPTIONAL</span> | `number` | The Sender nonce. |
378+
| nonce | <span class="text-danger">REQUIRED</span> | `number` | The Sender nonce. |
379+
| options | <span class="text-normal">OPTIONAL</span> | `number` | The Options of the Transaction (e.g. 1). |
380+
| data | <span class="text-normal">OPTIONAL</span> | `string` | The base64 string representation of the Transaction's message (data). |
381+
371382

372383
</TabItem>
373384
<TabItem value="Response">
@@ -390,7 +401,12 @@ The cost is estimated successfully.
390401
</Tabs>
391402

392403
:::tip
393-
This endpoint returns the cost on the transaction in **gas units**. The returned value can be used to fill in **gasLimit** field of the transaction.
404+
- Use the returned `txGasUnits` value as the `gasLimit` in your actual transaction.
405+
- Make sure to provide the correct `nonce` of transaction
406+
:::
407+
408+
:::tip
409+
`Best practice:` when sending the transaction, add ~10% extra gas to the estimated value to avoid underestimation and failure due to insufficient gas.
394410
:::
395411

396412
Here's an example of a request:

0 commit comments

Comments
 (0)