Skip to content

Commit b4b0d4e

Browse files
committed
feat: optional transaction ID in bridge status
1 parent a491de4 commit b4b0d4e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/thirdweb/src/bridge/Status.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import type { Status } from "./types/Status.js";
9696
* @param options - The options for the quote.
9797
* @param options.transactionHash - The hash of the origin transaction to get the bridge status for.
9898
* @param options.chainId - The chain ID of the origin token.
99+
* @param options.transactionId - The transaction ID received from the `prepare` request.
99100
* @param options.client - Your thirdweb client.
100101
*
101102
* @returns A promise that resolves to a status object for the transaction.
@@ -105,13 +106,16 @@ import type { Status } from "./types/Status.js";
105106
* @beta
106107
*/
107108
export async function status(options: status.Options): Promise<status.Result> {
108-
const { transactionHash, client } = options;
109+
const { transactionHash, client, transactionId } = options;
109110
const chainId = "chainId" in options ? options.chainId : options.chain.id;
110111

111112
const clientFetch = getClientFetch(client);
112113
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/status`);
113114
url.searchParams.set("transactionHash", transactionHash);
114115
url.searchParams.set("chainId", chainId.toString());
116+
if (transactionId) {
117+
url.searchParams.set("transactionId", transactionId);
118+
}
115119

116120
const response = await clientFetch(url.toString());
117121
if (!response.ok) {
@@ -195,6 +199,8 @@ export declare namespace status {
195199
transactionHash: ox__Hex.Hex;
196200
/** The chain ID where the transaction occurred */
197201
chainId: number;
202+
/** The transaction ID received from the `prepare` request */
203+
transactionId?: string;
198204
/** Your thirdweb client */
199205
client: ThirdwebClient;
200206
}
@@ -203,6 +209,8 @@ export declare namespace status {
203209
transactionHash: ox__Hex.Hex;
204210
/** The chain object where the transaction occurred */
205211
chain: Chain;
212+
/** The transaction ID received from the `prepare` request */
213+
transactionId?: string;
206214
/** Your thirdweb client */
207215
client: ThirdwebClient;
208216
};

0 commit comments

Comments
 (0)