Pending requests
List Volo vault deposits and withdrawals that are waiting for settlement, and cancel them.
Until the operator settles a request, the user can cancel it: a cancelled deposit returns the coin, and a cancelled withdrawal returns the shares to the receipt.
import { Transaction } from '@mysten/sui/transactions';
import { cancelPendingDepositPTB, cancelPendingWithdrawPTB, getPendingRequests } from '@naviprotocol/vault';
export async function buildCancelAll(owner: string, vaultId?: string) {
const pending = await getPendingRequests(owner, vaultId ? { vault: vaultId } : undefined);
// The cancellation lock must have passed; the operator may still settle first
const cancellable = pending.filter((request) => new Date(request.executeTime).getTime() <= Date.now());
const tx = new Transaction();
tx.setSender(owner);
for (const request of cancellable) {
if (request.type === 'deposit') {
// The refunded deposit coin must be transferred or used
const refund = await cancelPendingDepositPTB(tx, request);
tx.transferObjects([refund], owner);
} else {
// The shares return to the receipt; nothing to transfer
await cancelPendingWithdrawPTB(tx, request);
}
}
return { tx, pending, cancelled: cancellable.length };
}Request fields
| Field | Meaning |
|---|---|
type | 'deposit' or 'withdraw' |
vaultId, receiptId, requestId | Which vault, receipt and on-chain request |
amount, amountUsd, shares | Size of the request, as decimal strings |
executeTime | ISO 8601 time after which the request can be cancelled |
txId | The transaction that created the request |
getPendingRequests reads the NAVI open API and is not cached, so it reflects new requests quickly.
Cancellation rules
- A request can be cancelled only after its cancellation lock, shown as
executeTime. Earlier attempts abort. - The operator can settle a request at any time in the window. If it does so first, the cancellation aborts. Read the list again after executing.
cancelPendingDepositPTBreturns the refunded coin, which must be transferred or used, or the transaction fails.cancelPendingWithdrawPTBreturns nothing to handle.- Passing a request of the wrong type throws
INVALID_REQUEST_TYPE.
Volo vaults have no separate reward ledger: returns accrue in the share price, so there is nothing to claim. getVaultRewards returns an empty list for Volo vaults.