import {
  DocBlock,
  DocSideBySide,
  CodeParams,
  Parameter,
  Field,
  Values,
  CodeSnippets,
} from "../../../components/CodeDocBlock";

<DocBlock>

## getConfirmedTransaction

:::warning DEPRECATED
This method is expected to be removed in solana-core v2.0
**Please use [getTransaction](#gettransaction) instead**
:::

Returns transaction details for a confirmed transaction

<DocSideBySide>

<CodeParams>

### Parameters:

<Parameter type={"string"} required={true}>
  transaction signature, as base-58 encoded string
</Parameter>

<Parameter type={"object"} optional={true}>

Configuration object containing the following fields:

<Field
  name="commitment"
  type="string"
  optional={true}
  href="/api/http#configuring-state-commitment"
></Field>

<Field name="encoding" defaultValue="json" type="string" optional={true} href="/api/http#parsed-responses">

Encoding format for Account data

<Values values={["json", "base58", "base64", "jsonParsed"]} />

<details>

- `base58` is slow and limited to less than 129 bytes of Account data.
- `jsonParsed` encoding attempts to use program-specific instruction parsers
  to return more human-readable and explicit data in the `transaction.message.instructions` list.
- If `jsonParsed` is requested but a parser cannot be found, the instruction
  falls back to regular `json` encoding (`accounts`, `data`, and `programIdIndex` fields).

</details>

</Field>

</Parameter>

### Result:

- `<null>` - if transaction is not found or not confirmed
- `<object>` - if transaction is confirmed, an object with the following fields:
  - `slot: <u64>` - the slot this transaction was processed in
  - `transaction: <object|[string,encoding]>` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter
  - `blockTime: <i64|null>` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available
  - `meta: <object|null>` - transaction status metadata object:
    - `err: <object|null>` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/transaction/enum.TransactionError.html)
    - `fee: <u64>` - fee this transaction was charged, as u64 integer
    - `preBalances: <array>` - array of u64 account balances from before the transaction was processed
    - `postBalances: <array>` - array of u64 account balances after the transaction was processed
    - `innerInstructions: <array|null>` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction
    - `preTokenBalances: <array|undefined>` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
    - `postTokenBalances: <array|undefined>` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction
    - `logMessages: <array|null>` - array of string log messages or `null` if log message recording was not enabled during this transaction
    - DEPRECATED: `status: <object>` - Transaction status
      - `"Ok": <null>` - Transaction was successful
      - `"Err": <ERR>` - Transaction failed with TransactionError

</CodeParams>

<CodeSnippets>

### Code sample:

```bash
curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d '
  {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getConfirmedTransaction",
    "params": [
      "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv",
      "base64"
    ]
  }
'
```

### Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "meta": {
      "err": null,
      "fee": 5000,
      "innerInstructions": [],
      "postBalances": [499998932500, 26858640, 1, 1, 1],
      "postTokenBalances": [],
      "preBalances": [499998937500, 26858640, 1, 1, 1],
      "preTokenBalances": [],
      "status": {
        "Ok": null
      }
    },
    "slot": 430,
    "transaction": [
      "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==",
      "base64"
    ]
  },
  "id": 1
}
```

</CodeSnippets>
</DocSideBySide>
</DocBlock>
