Response Payloads
When utilizing the Sequence Embedded Wallet API, each intent payload will trigger a corresponding response payload, indicating success or prompting further action.
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:
Name | Type | Description | Optional |
---|---|---|---|
code | string | Identifies the type of response | No |
data | object | Holds content defined by response type | No |
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:
Name | Type | Description | Optional |
---|---|---|---|
txHash | string | Transaction hash of the Ethereum transaction | No |
metaTxHash | string | Hash of the meta transaction | No |
request | SendTransactionPayload | The original request packet of the transaction | No |
receipt | MetaTxnReceipt | Receipt of the meta transaction | No |
nativeReceipt | any | Native receipt of the Ethereum transaction | Yes |
simulations | SimulateResult[] | Array of simulation results | Yes |
MetaTxnReceipt
:
Name | Type | Description | Optional |
---|---|---|---|
id | string | Unique identifier for the receipt | No |
status | string | Status of the transaction | No |
revertReason | string | null | Reason for transaction revert, if any | Yes |
index | number | Index number of the receipt | No |
logs | MetaTxnReceiptLog[] | Array of logs for the meta transaction | No |
receipts | MetaTxnReceipt[] | Array of meta transaction receipts | No |
txnReceipt | string | String representation of the transaction | No |
MetaTxnReceiptLog
:
Name | Type | Description | Optional |
---|---|---|---|
address | string | The address that generated the log | No |
topics | string[] | List of topics associated with the log | No |
data | string | Data sent with the log | No |
blockNumber | number | The block number where this log was emitted | No |
transactionHash | string | Hash of the transaction that generated the log | No |
transactionIndex | number | Index of the transaction in the block | No |
blockHash | string | Hash of the block containing the log | No |
logIndex | number | Index of the log in the block | No |
removed | boolean | Whether the log was removed due to a chain reorganization | No |
SimulateResult
:
Name | Type | Description | Optional |
---|---|---|---|
executed | boolean | Whether the simulation was executed | No |
succeeded | boolean | Whether the simulation succeeded | No |
result | string | null | The result of the simulation | Yes |
reason | string | null | Reason for failure, if simulation failed | Yes |
gasUsed | number | Amount of gas used in the simulation | No |
gasLimit | number | Gas limit for the simulation | No |
Example
How to Detect
Failed Transaction Response
Triggered upon failed to execute a send transaction intent. The code for this response is transactionFailed
.
The data
field contains:
Field | Type | Description |
---|---|---|
error | string | The error message describing why the transaction failed. |
request | SendTransactionPayload | The packet of transactions that were attempted. |
simulations | SimulateResult[] | Results from the transaction simulation attempts. |
SimulateResult
:
Name | Type | Description | Optional |
---|---|---|---|
executed | boolean | Whether the simulation was executed | No |
succeeded | boolean | Whether the simulation succeeded | No |
result | string | null | The result of the simulation | Yes |
reason | string | null | Reason for failure, if simulation failed | Yes |
gasUsed | number | Amount of gas used in the simulation | No |
gasLimit | number | Gas limit for the simulation | No |
How to Detect
Signed Message Response
Triggered after a successful sign message intent. The code is signedMessage
.
The data
field contains:
Name | Type | Description | Optional |
---|---|---|---|
message | string | The signed message | No |
signature | string | The signature | No |
Example
How to Detect
Session Opened Response
Occurs after successfully executing an open session intent. The code is sessionOpened
.
The data
field contains:
Name | Type | Description | Optional |
---|---|---|---|
sessionId | string | Session ID (resembling an address) | No |
wallet | string | The Sequence wallet address | No |
Example
How to Detect
Validation Required Response
Some actions may necessitate additional validation. In such cases, the response code is validationRequired
.
The data
field contains:
Name | Type | Description | Optional |
---|---|---|---|
sessionId | string | Session ID (resembling an address) | No |
How to Detect
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.
Was this page helpful?