getAllWithdrawQueueRequests(owner)
Fetches all withdrawal-queue requests for a given owner address, and returns an array of request objects. Each request includes status metadata and two executable actions:
cancel()— cancels the request (whencancelable: true)claim()— claims the withdrawal (whenclaimable: true)
The returned cancel() / claim() functions are write actions and therefore require a signer.
Signature
getAllWithdrawQueueRequests(owner: Address): Promise<
{
recipient: `0x${string}`;
epoch: number;
epochState: "inactive" | "active" | "processing" | "processed";
claimable: boolean;
cancelable: boolean;
cancel: () => Promise<ContractTransactionResponse>;
claim: () => Promise<ContractTransactionResponse>;
amount: bigint;
version: 2;
vaultAddress: string;
chainId: number;
}[]
>;
Returns
An array of withdrawal-queue requests:
recipient— where the underlying will be sent when claimedepoch— epoch index for the requestepochState— current epoch status (inactive | active | processing | processed)claimable— whetherclaim()can be called right nowcancelable— whethercancel()can be called right nowamount— requested amount (in vault share units unless your implementation states otherwise)version— always2for these requestsvaultAddress,chainId— identifies the vault/networkcancel()/claim()— callable functions that send transactions
Parameters
owner(Address, required) The wallet address whose withdrawal requests you want to load.
Example
import { getVault } from "@concrete-xyz/sdk";
import { ethers } from "ethers";
async function main() {
const provider = new ethers.JsonRpcProvider(process.env.RPC_URL!);
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const vault = getVault("0xYourVault", "Ethereum", provider, signer);
const owner = await signer.getAddress();
const requests = await vault.getAllWithdrawQueueRequests(owner);
// Render list
for (const r of requests) {
console.log({
recipient: r.recipient,
epoch: r.epoch,
epochState: r.epochState,
amount: r.amount.toString(),
claimable: r.claimable,
cancelable: r.cancelable,
vaultAddress: r.vaultAddress,
chainId: r.chainId,
version: r.version,
});
}
// Claim the first claimable request (if any)
const firstClaimable = requests.find((r) => r.claimable);
if (firstClaimable) {
console.log("Claiming request in epoch", firstClaimable.epoch);
const tx = await firstClaimable.claim();
const receipt = await tx.wait();
console.log("Claim confirmed:", receipt?.hash ?? receipt?.transactionHash);
return;
}
// Otherwise, cancel the first cancelable request (if any)
const firstCancelable = requests.find((r) => r.cancelable);
if (firstCancelable) {
console.log("Canceling request in epoch", firstCancelable.epoch);
const tx = await firstCancelable.cancel();
const receipt = await tx.wait();
console.log("Cancel confirmed:", receipt?.hash ?? receipt?.transactionHash);
return;
}
console.log("No claimable or cancelable requests found.");
}
main().catch((err) => {
console.error("Failed:", err);
process.exit(1);
});