Add settled transaction callback to execute()#946
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
6096680 to
6f3d4c6
Compare
|
Claude finished @0xTxbi's task in 2m 11s —— View job Code Review — 2 issue(s) found
Reviewed 5 files, ~290 lines added. Checked correctness, abort/lifecycle handling, error handling, and repo guidelines. The two prior reviewer comments ( |
|
Claude finished @0xTxbi's task in 1m 54s —— View job 📝 Docs Drift Check — Confidence: HIGH What changed: Docs impact: The existing Affected pages (paths inside
Draft: > Replace section: `## Parameters`
## Parameters
| Property | Description | Required |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| **quote** | A valid quote retrieved using the [getQuote](/references/relay-kit/sdk/actions/getQuote) action | ✅ |
| **wallet** | A valid WalletClient from viem or an adapted wallet generated from an adapter that meets this [interface](https://github.com/reservoirprotocol/relay-sdk/blob/main/packages/sdk/src/types/AdaptedWallet.ts). | ✅ |
| **depositGasLimit** | The gas limit used for the deposit transaction. | ❌ |
| **onProgress** | Callback to update UI state as execution progresses. Can also be used to get the transaction hash for a given step item. The following data points are returned: `steps`, `fees`, `breakdown`, `txHashes`, `currentStep`, `currentStepItem`, `details` | ❌ |
| **onTransactionReceived** | Callback fired asynchronously after execution settles, once request metadata is available. Receives a `RelayTransaction` whose `data.metadata` contains the settled `currencyIn`, `currencyOut`, `sender`, and `recipient`. | ❌ |
| **disableCapabilitiesCheck** | Skip `wallet.getCapabilities` calls used for EIP-5792 atomic-batch detection and smart-wallet detection. Set this for wallets with a broken `getCapabilities` implementation that hangs or never resolves. When true, execution falls back to sequential transactions. | ❌ |> Replace section: `## Example`
## Example
```typescript
import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk";
import { useWalletClient } from 'wagmi'
...
const wallet = useWalletClient()
const options = ... //define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet,
onProgress: ({steps, fees, breakdown, currentStep, currentStepItem, txHashes, details}) => {
//custom handling
},
onTransactionReceived: (transaction) => {
// fired once the request has settled with finalized metadata
},
})
```> Replace section: `## Handling onProgress updates`
## Handling onProgress updates
The state of progress is updated as users are moved through the flow. The onProgress callback will fire every time there are changes to the status. Below is a breakdown of the data returned and how it may be useful in representing the status:
* __steps__: This is the full steps object as it's returned by the api and enhanced with some additional properties on the client. Notably the step status has been updated as well as any errors have been attached.
* __fees__: This is the full fees object as it's returned by the api
* __breakdown__: This is the full breakdown object as it's returned by the api
* __currentStep__: We've conveniently pinpointed the current step that's being processed and made it accessible in this callback.
* __currentStepItem__: Similarly to the step we've hoisted the current step item that is being processed so it's more easily accessible. A step can contain multiple items that are processed in parallel as a batch.
* __txHashes__: A full list of all the transaction hashes that have been processed so far during execution.
* __details__: A summary of the swap action being performed (`currencyIn`, `currencyOut`, swap rate, etc.). After the request settles, if the settled `currencyOut.amount` differs from the quoted amount, `onProgress` fires once more with `details.currencyOut` updated to reflect the actual settled amount.Needs human input:
To publish as a draft PR in
A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review. |
onTransactionReceived|
Claude finished @0xTxbi's task in 2m 23s —— View job Code Review — No issues foundReviewed 5 files, ~290 lines added. Checked correctness, abort/lifecycle handling, error handling, and repo guidelines. The two prior reviewer concerns and the prior automated-review findings have been addressed in commit
Other things I checked (no issues)
Minor NOTE (carry-over from prior automated review, non-blocking)
• Branch |
|
Claude finished @0xTxbi's task in 1m 20s —— View job 📝 Docs Drift Check — Confidence: HIGH What changed: Docs impact: The existing Affected pages (paths inside
Draft: > Replace section: `## Parameters`
## Parameters
| Property | Description | Required |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| **quote** | A valid quote retrieved using the [getQuote](/references/relay-kit/sdk/actions/getQuote) action | ✅ |
| **wallet** | A valid WalletClient from viem or an adapted wallet generated from an adapter that meets this [interface](https://github.com/reservoirprotocol/relay-sdk/blob/main/packages/sdk/src/types/AdaptedWallet.ts). | ✅ |
| **depositGasLimit** | The gas limit used for the deposit transaction. | ❌ |
| **onProgress** | Callback to update UI state as execution progresses. Can also be used to get the transaction hash for a given step item. The following data points are returned: `steps`, `fees`, `breakdown`, `txHashes`, `currentStep`, `currentStepItem`, `details` | ❌ |
| **onTransactionReceived** | Callback fired asynchronously after execution settles, once request metadata is available. Receives a `RelayTransaction` whose `data.metadata` contains the settled `currencyIn`, `currencyOut`, `sender`, and `recipient`. | ❌ |
| **disableCapabilitiesCheck** | Skip `wallet.getCapabilities` calls used for EIP-5792 atomic-batch detection and smart-wallet detection. Set this for wallets with a broken `getCapabilities` implementation that hangs or never resolves. When true, execution falls back to sequential transactions. | ❌ |> Replace section: `## Example`
## Example
```typescript
import { getClient, Execute, getQuote } from "@relayprotocol/relay-sdk";
import { useWalletClient } from 'wagmi'
...
const wallet = useWalletClient()
const options = ... //define this based on getQuote options
const quote = await getClient().actions.getQuote(options)
getClient().actions.execute({
quote,
wallet,
onProgress: ({steps, fees, breakdown, currentStep, currentStepItem, txHashes, details}) => {
//custom handling
},
onTransactionReceived: (transaction) => {
// fired once the request has settled with finalized metadata
},
})
```> Replace section: `## Handling onProgress updates`
## Handling onProgress updates
The state of progress is updated as users are moved through the flow. The onProgress callback will fire every time there are changes to the status. Below is a breakdown of the data returned and how it may be useful in representing the status:
* __steps__: This is the full steps object as it's returned by the api and enhanced with some additional properties on the client. Notably the step status has been updated as well as any errors have been attached.
* __fees__: This is the full fees object as it's returned by the api
* __breakdown__: This is the full breakdown object as it's returned by the api
* __currentStep__: We've conveniently pinpointed the current step that's being processed and made it accessible in this callback.
* __currentStepItem__: Similarly to the step we've hoisted the current step item that is being processed so it's more easily accessible. A step can contain multiple items that are processed in parallel as a batch.
* __txHashes__: A full list of all the transaction hashes that have been processed so far during execution.
* __details__: A summary of the swap action being performed (`currencyIn`, `currencyOut`, swap rate, etc.). After the request settles, if the settled `currencyOut.amount` differs from the quoted amount, `onProgress` fires once more with `details.currencyOut` updated to reflect the actual settled amount.Needs human input:
To publish as a draft PR in
A separate workflow will open a draft PR attributed to you. Edit the draft freely before marking it ready for review. |
No description provided.