Skip to content

[SDK] Feature: Adds optional transactionId parameter to Bridge.status #7681

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/four-trams-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Bridge.status: Adds optional transactionId parameter
10 changes: 9 additions & 1 deletion packages/thirdweb/src/bridge/Status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
* @param options - The options for the quote.
* @param options.transactionHash - The hash of the origin transaction to get the bridge status for.
* @param options.chainId - The chain ID of the origin token.
* @param options.transactionId - The transaction ID received from the `prepare` request.
* @param options.client - Your thirdweb client.
*
* @returns A promise that resolves to a status object for the transaction.
Expand All @@ -105,13 +106,16 @@
* @beta
*/
export async function status(options: status.Options): Promise<status.Result> {
const { transactionHash, client } = options;
const { transactionHash, client, transactionId } = options;
const chainId = "chainId" in options ? options.chainId : options.chain.id;

const clientFetch = getClientFetch(client);
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/status`);
url.searchParams.set("transactionHash", transactionHash);
url.searchParams.set("chainId", chainId.toString());
if (transactionId) {
url.searchParams.set("transactionId", transactionId);
}

Check warning on line 118 in packages/thirdweb/src/bridge/Status.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/bridge/Status.ts#L117-L118

Added lines #L117 - L118 were not covered by tests

const response = await clientFetch(url.toString());
if (!response.ok) {
Expand Down Expand Up @@ -195,6 +199,8 @@
transactionHash: ox__Hex.Hex;
/** The chain ID where the transaction occurred */
chainId: number;
/** The transaction ID received from the `prepare` request */
transactionId?: string;
/** Your thirdweb client */
client: ThirdwebClient;
}
Expand All @@ -203,6 +209,8 @@
transactionHash: ox__Hex.Hex;
/** The chain object where the transaction occurred */
chain: Chain;
/** The transaction ID received from the `prepare` request */
transactionId?: string;
/** Your thirdweb client */
client: ThirdwebClient;
};
Expand Down
Loading