Get Status of Transaction

/v2/app/transaction/status

MetaKeep transactions have 4 possible states:

  • QUEUED: The transaction has been queued and is being processed on the blockchain.
  • FAILED: The transaction has been successfully mined but failed on the blockchain. This can happen if an error is thrown during smart contract execution.
  • COMPLETED: The transaction has been successfully mined on the blockchain and execution was successful.
  • CANCELLED: MetaKeep canceled the transaction because the blockchain could not process the transaction and the mining was not possible. Note that this is different from the FAILED state.
    • EVM: On EVM chains, this only happens in extremely rare cases when the transaction data is invalid and will never be processed by the blockchain. MetaKeep infrastructure has multiple safeguards built in to minimize the probability of this ever happening.
    • Solana: On Solana, the transaction is marked as CANCELLED if the transaction could not be processed within the latest blockhash expiry window (~1 minute) after the transaction request was issued to MetaKeep. Support for transaction retry to prevent transaction cancellation on Solana is coming soon.

Response

The response will have the status of the transaction along with useful debugging information such as the transaction signature, transaction hash, transaction chain scan URL, etc.

{
  "status": "COMPLETED",
  "transactionHash": "0xcc6a3df639a4361b9c323aba69fbc369598b0714d5941324933e709da8ad5272",
  "transactionChainScanUrl": "https://mumbai.polygonscan.com/tx/0xcc6a3df639a4361b9c323aba69fbc369598b0714d5941324933e709da8ad5272",
  "events": [
    {
      "name": "Transfer",
      "args": {
        "from": "0x0000000000000000000000000000000000000000",
        "to": "0x6B40cA2814198A37BA5798B0C5EE1A2E029b997f",
        "tokenId": "89914053664554730348174448685275928445958338951135829250306983855676716119374"
      }
    }
  ]
}
{
  "status": "COMPLETED",
  "transactionSignature": "kGH2XP7KXtrPCvf9QBN5Q3fqzwRSYsrrgbHU4Fh5X3TYH2QBanUsYdapsWsSDJoRZVooBxcU4StPjjvZCQAYyjV",
  "transactionChainScanUrl": "https://explorer.solana.com/tx/kGH2XP7KXtrPCvf9QBN5Q3fqzwRSYsrrgbHU4Fh5X3TYH2QBanUsYdapsWsSDJoRZVooBxcU4StPjjvZCQAYyjV?cluster=devnet",
  "logs": [
    {
      "status": "COMPLETED",
      "lambda": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
      "messages": [
        "CreateIdempotent"
      ]
    },
    {
      "status": "COMPLETED",
      "lambda": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      "messages": [
        "Instruction: Transfer"
      ]
    }
  ]
}

Transaction Failure

If a transaction is marked FAILED, it would mean that MetaKeep has exhausted all feasible smart AI-based strategies to recover from failure, that would have been attempted by humans and so the "FAILED" status, if shown, is final.

The reason for failure, if available, will be returned in the failureReason field. Here's how the response will look like if the transaction has failed:

{
    "status": "FAILED",
    "transactionHash": "0x8e11b9b97f82086d68a8bbb6ee3fe2e97aaea5d67a0cbefa29a6bed697f5eb9a",
    "transactionChainScanUrl": "https://mumbai.polygonscan.com/tx/0x8e11b9b97f82086d68a8bbb6ee3fe2e97aaea5d67a0cbefa29a6bed697f5eb9a",
    "failureReason": "ERC721: Token does not exist for this contract"
}
{
  "status": "FAILED",
  "transactionSignature": "5pGSVVBS8xxc94mMhLaKpnuLNd2JrZR9kmHVKXPGBWsqJeCX8GDzpCs4eb4F7d7U1n7NZNiFB6DBAseVUE74kYKr",
  "transactionChainScanUrl": "https://explorer.solana.com/tx/5pGSVVBS8xxc94mMhLaKpnuLNd2JrZR9kmHVKXPGBWsqJeCX8GDzpCs4eb4F7d7U1n7NZNiFB6DBAseVUE74kYKr?cluster=devnet",
  "failureReason": "Instruction #2 failed with custom error: 0x1",
  "logs": [
    {
      "status": "COMPLETED",
      "lambda": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
      "messages": [
        "CreateIdempotent",
        "Initialize the associated token account"
      ]
    },
    {
      "status": "FAILED",
      "lambda": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      "messages": [
        "Instruction: Transfer",
        "Error: insufficient funds"
      ],
      "failureReason": "custom program error: 0x1"
    }
  ]
}

If the transaction fails for a reason other than contract execution failure, the failureReason field will UNKNOWN_ERROR. This can happen in the following cases:

  1. The transaction ran out of gas. MetaKeep infrastructure minimizes the chances of this ever happening.
  2. The lambda contract is not a valid deployed contract.
  3. The lambda abi doesn't match what's deployed on the chain.
  4. The user has insufficient balance for the payment(aka value transfer).
  5. The transaction is making a payment(aka value transfer) to a contract that doesn't have a payable fallback function.
  6. The transaction failed for a reason that couldn't be decoded to a human-readable string.

Support for more meaningful failure reasons to debug the failure cases mentioned above is coming soon :)

Transaction Events/Logs

If the transaction has emitted any events or logs, they will be returned in the response.

EVM

On EVM chains, all emitted events will be returned in the events field. Here's how the response will look like:

{
    "status": "COMPLETED",
    "transactionHash": "0xcc6a3df639a4361b9c323aba69fbc369598b0714d5941324933e709da8ad5272",
    "transactionChainScanUrl": "https://mumbai.polygonscan.com/tx/0xcc6a3df639a4361b9c323aba69fbc369598b0714d5941324933e709da8ad5272",
    "events": [
        {
            "name": "Transfer",
            "args": {
                "from": "0x0000000000000000000000000000000000000000",
                "to": "0x6B40cA2814198A37BA5798B0C5EE1A2E029b997f",
                "tokenId": "89914053664554730348174448685275928445958338951135829250306983855676716119374"
            }
        }
    ]
}

Solana

On Solana, all program logs will be returned in the logs field. The logs array contains a log JSON object for each instruction in the transaction. Here's how the response will look like:

{
  "status": "FAILED",
  "transactionChainScanUrl": "https://explorer.solana.com/tx/5pGSVVBS8xxc94mMhLaKpnuLNd2JrZR9kmHVKXPGBWsqJeCX8GDzpCs4eb4F7d7U1n7NZNiFB6DBAseVUE74kYKr?cluster=devnet",
  "failureReason": "Instruction #2 failed with custom error: 0x1",
  "transactionSignature": "5pGSVVBS8xxc94mMhLaKpnuLNd2JrZR9kmHVKXPGBWsqJeCX8GDzpCs4eb4F7d7U1n7NZNiFB6DBAseVUE74kYKr",
  "logs": [
    {
      "status": "COMPLETED",
      "lambda": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
      "calls": [
        {
          "status": "COMPLETED",
          "lambda": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "messages": [
            "Instruction: GetAccountDataSize"
          ]
        },
        {
          "status": "COMPLETED",
          "lambda": "11111111111111111111111111111111"
        }
      ],
      "messages": [
        "CreateIdempotent",
        "Initialize the associated token account"
      ]
    },
    {
      "status": "FAILED",
      "lambda": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      "messages": [
        "Instruction: Transfer",
        "Error: insufficient funds"
      ],
      "failureReason": "custom program error: 0x1"
    }
  ]
}

Here's a description of the fields in each log object:

  • status: The status of the program call. It can be one of the following:
    • COMPLETED: The program was successfully executed.
    • FAILED: The program failed to execute.
  • lambda: The address of the program that was called.
  • calls: The list of nested program calls aka Cross Program Invocation. This is useful for debugging nested program calls.
  • messages: The list of messages emitted by the program. This is useful for debugging the program execution.
  • failureReason: The reason for the program failure. This is only present if the program fails to execute.

🚧

Api Error Status

You can find error status returned by the api here.

© Copyright 2024, Passbird Research Inc.

Language
Authorization
Header
Click Try It! to start a request and see the response here!