Refunds
executeRefund is for private EVM-origin orders whose gateway refund window has opened. It
fetches fresh order state, validates preconditions, dry-runs the contract call, broadcasts,
and waits for the receipt.
import {
RefundNotAllowedError,
RefundRevertedError,
type SilentSwapClient,
} from '@silentswap/sdk';
import type { PrivateOrderReference } from '@silentswap/sdk';
declare const client: SilentSwapClient;
declare const reference: PrivateOrderReference;
try {
const { refundTxHash } = await client.executeRefund(reference);
console.log(refundTxHash);
} catch (error) {
if (error instanceof RefundNotAllowedError) {
console.warn(error.message);
} else if (error instanceof RefundRevertedError) {
console.error(error.refundTxHash);
} else {
throw error;
}
}Refunds are rejected for non-EVM origins, non-OPEN/FAILED states,
unexpired orders, a different depositor wallet, already fulfilled/refunded orders, or any split
where a recipient is paid or in flight.
Do not implement a local timer as the authorization source. Let the fresh API state and the SDK simulation decide whether the wallet may open.