RejectedTransaction
type RejectedTransaction: Pick<PendingTransaction,
| "transaction"
| "toJSON"
| "toPretty"
| "hash"
| "data"> & {
"errors": string[];
"status": "rejected";
};
Represents a transaction that has been rejected and not included in a blockchain block.
Type declaration
errors
errors: string[];
status
status: "rejected";
Example
try {
const txResult = await pendingTransaction.wait();
// This line will not execute if the transaction is rejected, as `.wait()` will throw an error instead.
console.log(`Transaction ${txResult.hash} was successfully included in a block.`);
} catch (error) {
console.error(`Transaction ${error.transaction.hash} was rejected.`);
error.errors.forEach((error, i) => {
console.error(`Error ${i + 1}: ${error}`);
});
}