> ## Documentation Index
> Fetch the complete documentation index at: https://grat.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sponsor Transaction

> Submit a transaction for sponsorship and submission.

Wraps the provided transaction XDR in a fee-bump envelope and submits it to the Stellar network.

### Request Body

<ParamField body="transaction" type="string" required>
  The base64-encoded XDR of the signed transaction or fee-bump transaction to sponsor.
</ParamField>

<ParamField body="network" type="string" required>
  The target network. Must be either `testnet` or `mainnet`.
</ParamField>

### Response Fields

<ResponseField name="hash" type="string">
  The transaction hash generated by the Stellar network.
</ResponseField>

<ResponseField name="feePaid" type="string">
  The total network fee paid by the relay in stroops.
</ResponseField>

<ResponseField name="ledger" type="number">
  The sequence number of the ledger that included the transaction.
</ResponseField>

<ResponseField name="resultXdr" type="string">
  The base64-encoded result XDR returned by the network.
</ResponseField>

### Error Codes

| Code                   | Description                                                |
| :--------------------- | :--------------------------------------------------------- |
| `VALIDATION_ERROR`     | The provided XDR is malformed or invalid.                  |
| `INSUFFICIENT_CREDITS` | Your project balance is too low to cover the fee.          |
| `SUBMISSION_FAILED`    | The network rejected the transaction (e.g., `tx_bad_seq`). |
| `RATE_LIMIT_EXCEEDED`  | You have exceeded your project's rate limit.               |

### SDK Example

```typescript theme={null}
import { Grat } from '@grat-official-sdk/sdk';
const grat = Grat.testnet();

const result = await grat.sponsor(transaction);
console.log(result.hash);
```

[View on GitHub](https://github.com/gratnetwork/grat)
