status

Retrieves a Universal Bridge quote for the provided sell intent. The quote will specify the expected destinationAmount that will be received in exchange for the specified originAmount , which is specified with the sellAmountWei option.

    • The returned status will include both the origin and destination transactions and any finalized amounts for the route.

Example

import { Bridge } from "thirdweb";
const status = await Bridge.status({
transactionHash:
"0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
chainId: 8453,
client: thirdwebClient,
});

If the transaction is complete, a response might look like:

{
status: 'COMPLETED',
originAmount: 200000000000000n,
destinationAmount: 188625148000000n,
originChainId: 8453,
destinationChainId: 2741,
originTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
destinationTokenAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
transactions: [
{
chainId: 8453,
transactionHash: '0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d'
},
{
chainId: 2741,
transactionHash: '0xa70a82f42330f54be95a542e1fcfe6ed2dd9f07fb8c82ae67afb4342319f7433'
}
]
}

If the origin transaction hasn't been mined yet, a response might look like:

{
status: "NOT_FOUND",
}

This is to allow you to poll for the status without catching an error. Be sure your transaction hash and chain are correct though, as this could also represent a legitimate 404 if the transaction doesn't exist.

If the transaction is still pending, a response might look like:

{
status: "PENDING",
originAmount: 1000000000000000000n,
originChainId: 466,
destinationChainId: 1,
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
destinationTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
transactions: [
{
transactionHash: "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
chainId: 466,
}
]
}

If the transaction failed, a response might look like:

{
status: "FAILED",
transactions: [
{
transactionHash: "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
chainId: 466,
}
]
}

This status is for a single origin transaction only . If your route involves multiple transactions, you'll need to get the status for each of them individually.

If sending multiple dependent sequential transactions, wait until status returns COMPLETED before sending the next transaction.

You can access this function's input and output types with status.Options and status.Result , respectively.

function status(options: Options): Promise<Status>;

Parameters

The options for the quote.

Type

let options: Options;

Returns

let returnType:
| {
destinationAmount: bigint;
destinationChainId: number;
destinationTokenAddress: ox__Address.Address;
originAmount: bigint;
originChainId: number;
originTokenAddress: ox__Address.Address;
status: "COMPLETED";
transactions: Array<{
chainId: number;
transactionHash: ox__Hex.Hex;
}>;
}
| {
destinationChainId: number;
destinationTokenAddress: ox__Address.Address;
originAmount: bigint;
originChainId: number;
originTokenAddress: ox__Address.Address;
status: "PENDING";
transactions: Array<{
chainId: number;
transactionHash: ox__Hex.Hex;
}>;
}
| {
status: "FAILED";
transactions: Array<{
chainId: number;
transactionHash: ox__Hex.Hex;
}>;
}
| { status: "NOT_FOUND"; transactions: [] };

A promise that resolves to a status object for the transaction.