Sign Up
Skip to content

Response Payloads

When interacting with the Sequence Embedded Wallet API, each intent payload will trigger a corresponding response payload. This could be either a successful response or a prompt for a different action.

General Response Structure

Regardless of the specific response type, all responses have a standard structure with the following fields:

NameTypeDescriptionOptional
codestringIdentifies the type of responseNo
dataobjectHolds content defined by response typeNo

Types of Responses

Transaction Receipt Response

Triggered upon successful execution of a send transaction intent. The code for this response is transactionReceipt.

The data field contains:

NameTypeDescriptionOptional
txHashstringTransaction hash of the Ethereum transactionNo
metaTxHashstringHash of the meta transactionNo
requestSendTransactionPayloadThe original request packet of the transactionNo
receiptMetaTxnReceiptReceipt of the meta transactionNo
nativeReceiptanyNative receipt of the Ethereum transactionYes
simulationsSimulateResult[]Array of simulation resultsYes

MetaTxnReceipt:

NameTypeDescriptionOptional
idstringUnique identifier for the receiptNo
statusstringStatus of the transactionNo
revertReasonstring | nullReason for transaction revert, if anyYes
indexnumberIndex number of the receiptNo
logsMetaTxnReceiptLog[]Array of logs for the meta transactionNo
receiptsMetaTxnReceipt[]Array of meta transaction receiptsNo
txnReceiptstringString representation of the transactionNo

MetaTxnReceiptLog:

NameTypeDescriptionOptional
addressstringThe address that generated the logNo
topicsstring[]List of topics associated with the logNo
datastringData sent with the logNo
blockNumbernumberThe block number where this log was emittedNo
transactionHashstringHash of the transaction that generated the logNo
transactionIndexnumberIndex of the transaction in the blockNo
blockHashstringHash of the block containing the logNo
logIndexnumberIndex of the log in the blockNo
removedbooleanWhether the log was removed due to a chain reorganizationNo

SimulateResult:

NameTypeDescriptionOptional
executedbooleanWhether the simulation was executedNo
succeededbooleanWhether the simulation succeededNo
resultstring | nullThe result of the simulationYes
reasonstring | nullReason for failure, if simulation failedYes
gasUsednumberAmount of gas used in the simulationNo
gasLimitnumberGas limit for the simulationNo

Example

{
  "code": "transactionReceipt",
  "data": {
    "txHash": "0xf2e9f728abd65089f25efda5852e605ced377f4e2c89dbf143b124623ed09b2c",
    "metaTxHash": "acc36ed4ef40db74137266e48d863083a5c7e85e2735d69adafcb5b362b6cfc0",
    "nativeReceipt": {
      "blockHash": "0x49be8c81414fae655f1f4615f5b437ca5160bdd4e4d8ce06275338ec6fe2e20b",
      "blockNumber": "0x2f63834",
      "contractAddress": "0x0000000000000000000000000000000000000000",
      "cumulativeGasUsed": "0xdb374",
      "gasUsed": "0x14a00",
      "logs": [
        {
          "address": "0x4d4ee1b8583e31fe789eaf2e1b6e011c220c10b6",
          "blockHash": "0x49be8c81414fae655f1f4615f5b437ca5160bdd4e4d8ce06275338ec6fe2e20b",
          "blockNumber": "0x2f63834",
          "data": "0x0000000000000000000000001119e72b4af230becebd933d0e07f0eec51d8c2a0000000000000000000000000000000000000000000000000000000000000001",
          "logIndex": "0x14",
          "removed": false,
          "topics": [
            "0x1f180c27086c7a39ea2a7b25239d1ab92348f07ca7bb59d1438fcf527568f881"
          ],
          "transactionHash": "0xf2e9f728abd65089f25efda5852e605ced377f4e2c89dbf143b124623ed09b2c",
          "transactionIndex": "0x5"
        },
        {
          "address": "0x4d4ee1b8583e31fe789eaf2e1b6e011c220c10b6",
          "blockHash": "0x49be8c81414fae655f1f4615f5b437ca5160bdd4e4d8ce06275338ec6fe2e20b",
          "blockNumber": "0x2f63834",
          "data": "0x0000000000000000000000000000000000000000000000000000000000000000",
          "logIndex": "0x15",
          "removed": false,
          "topics": [
            "0x5c4eeb02dabf8976016ab414d617f9a162936dcace3cdef8c69ef6e262ad5ae7",
            "0xacc36ed4ef40db74137266e48d863083a5c7e85e2735d69adafcb5b362b6cfc0"
          ],
          "transactionHash": "0xf2e9f728abd65089f25efda5852e605ced377f4e2c89dbf143b124623ed09b2c",
          "transactionIndex": "0x5"
        },
        {
          "address": "0x0000000000000000000000000000000000001010",
          "blockHash": "0x49be8c81414fae655f1f4615f5b437ca5160bdd4e4d8ce06275338ec6fe2e20b",
          "blockNumber": "0x2f63834",
          "data": "0x000000000000000000000000000000000000000000000000001284e7c67266000000000000000000000000000000000000000000000000014c0fa753f2298415000000000000000000000000000000000000000000001386f7e2c243dcc978070000000000000000000000000000000000000000000000014bfd226c2bb71e15000000000000000000000000000000000000000000001386f7f5472ba33bde07",
          "logIndex": "0x16",
          "removed": false,
          "topics": [
            "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
            "0x0000000000000000000000000000000000000000000000000000000000001010",
            "0x00000000000000000000000000e91788bcb998379027d36e6407a9187d7f313c",
            "0x000000000000000000000000959c65b72147faf3450d8b50a0de57e72ffc5e0d"
          ],
          "transactionHash": "0xf2e9f728abd65089f25efda5852e605ced377f4e2c89dbf143b124623ed09b2c",
          "transactionIndex": "0x5"
        }
      ],
      "logsBloom": "0x00000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000008800000002000000000001004000000000000000000000000000000000800000000000000000000100000000400000000200400000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000002000000000000000000000000000000004000008000000000000001000000000000000000000000000000100000020000000000000000000000002000000020020002020040000000000000000040100000",
      "root": "0x",
      "status": "0x1",
      "transactionHash": "0xf2e9f728abd65089f25efda5852e605ced377f4e2c89dbf143b124623ed09b2c",
      "transactionIndex": "0x5"
    },
    "receipt": {
      "id": "acc36ed4ef40db74137266e48d863083a5c7e85e2735d69adafcb5b362b6cfc0",
      "index": 0,
      "logs": [
        {
          "address": "0x4d4EE1b8583e31fe789eAF2e1b6e011C220c10B6",
          "data": "0x0000000000000000000000001119e72b4af230becebd933d0e07f0eec51d8c2a0000000000000000000000000000000000000000000000000000000000000001",
          "topics": [
            "0x1f180c27086c7a39ea2a7b25239d1ab92348f07ca7bb59d1438fcf527568f881"
          ]
        },
        {
          "address": "0x4d4EE1b8583e31fe789eAF2e1b6e011C220c10B6",
          "data": "0x0000000000000000000000000000000000000000000000000000000000000000",
          "topics": [
            "0x5c4eeb02dabf8976016ab414d617f9a162936dcace3cdef8c69ef6e262ad5ae7",
            "0xacc36ed4ef40db74137266e48d863083a5c7e85e2735d69adafcb5b362b6cfc0"
          ]
        }
      ],
      "receipts": [
        {
          "id": "acc36ed4ef40db74137266e48d863083a5c7e85e2735d69adafcb5b362b6cfc0",
          "index": 0,
          "logs": null,
          "receipts": null,
          "revertReason": null,
          "status": "SUCCEEDED",
          "txnReceipt": ""
        }
      ],
      "revertReason": null,
      "status": "SUCCEEDED"
    },
    "request": {
      "code": "sendTransaction",
      "expires": 1699440762,
      "identifier": "ts-sdk-1699440462686-0x153824576D03629b264683B430bBF9AcEA1d0975",
      "issued": 1699440462,
      "network": "137",
      "transactions": [
        {
          "data": "0x",
          "to": "0x4d4EE1b8583e31fe789eAF2e1b6e011C220c10B6",
          "type": "transaction",
          "value": "0x00"
        }
      ],
      "wallet": "0x4d4EE1b8583e31fe789eAF2e1b6e011C220c10B6"
    },
    "simulations": [
      {
        "executed": true,
        "gasLimit": 1147,
        "gasUsed": 860,
        "reason": null,
        "result": "0x",
        "succeeded": true
      }
    ]
  }
}

How to Detect

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isSentTransactionResponse(res)) {
  // It's a transaction receipt
}

Failed Transaction Response

Triggered upon failed to execute a send transaction intent. The code for this response is transactionFailed.

The data field contains:

FieldTypeDescription
errorstringThe error message describing why the transaction failed.
requestSendTransactionPayloadThe packet of transactions that were attempted.
simulationsSimulateResult[]Results from the transaction simulation attempts.

SimulateResult:

NameTypeDescriptionOptional
executedbooleanWhether the simulation was executedNo
succeededbooleanWhether the simulation succeededNo
resultstring | nullThe result of the simulationYes
reasonstring | nullReason for failure, if simulation failedYes
gasUsednumberAmount of gas used in the simulationNo
gasLimitnumberGas limit for the simulationNo
{
  "code": "transactionFailed",
  "data": {
    "error": "This is an error message",
    "request": {
      "code": "sendTransaction",
      "expires": 1699443005,
      "identifier": "ts-sdk-1699442705965-0x153824576D03629b264683B430bBF9AcEA1d0975",
      "issued": 1699442705,
      "network": "137",
      "transactions": [
        {
          "data": "0x",
          "to": "0x839eE023B21f4Ffe2294025DE0AC30Ba7278D6Fd",
          "type": "transaction",
          "value": "0x00"
        }
      ],
      "wallet": "0x4d4EE1b8583e31fe789eAF2e1b6e011C220c10B6"
    },
    "simulations": [
      {
        "executed": true,
        "gasLimit": 7908,
        "gasUsed": 5931,
        "reason": "This is an error message",
        "result": null,
        "succeeded": false
      }
    ]
  }
}

How to Detect

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isFailedTransactionResponse(res)) {
  // It's a failed transaction
}

Signed Message Response

Triggered after a successful sign message intent. The code is signedMessage.

The data field contains:

NameTypeDescriptionOptional
messagestringThe signed messageNo
signaturestringThe signatureNo

Example

{
  "code": "signedMessage",
  "data": {
    "message": "Hello World",
    "signature": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
  }
}

How to Detect

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isSignedMessageResponse(res)) {
  // It's a signed message
}

Session Opened Response

Occurs after successfully executing an open session intent. The code is sessionOpened.

The data field contains:

NameTypeDescriptionOptional
sessionIdstringSession ID (resembling an address)No
walletstringThe Sequence wallet addressNo

Example

{
  "code": "sessionOpened",
  "data": {
    "sessionId": "0xBdeAfd3ee0550a73f615D2BaEA2E3D6d48FC857D",
    "wallet": "0x44c2Ea42Fb006a613a7b41D142576eD6B5055902"
  }
}

How to Detect

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isOpenSessionResponse(res)) {
  // It's a session opened
}

Validation Required Response

Some actions may necessitate additional validation. In such cases, the response code is validationRequired.

The data field contains:

NameTypeDescriptionOptional
sessionIdstringSession ID (resembling an address)No

How to Detect

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isValidationRequiredResponse(res)) {
  // Validation is required
}

Note

Both sendTransaction and signMessage intents could require validation. Always check for a validationRequired response before assuming you've received a transaction receipt or a signed message.

import { payloads } from '@0xsequence/waas';
 
const res = ... // response from the Embedded Wallet API
 
if (payloads.responses.isValidationRequiredResponse(res)) {
  // Handle validation
}
 
if (payloads.responses.isSendTransactionResponse(res)) {
  // It's a transaction receipt
}