Skip to content
Docs
Open app
Skip to Content

Pending requests

List Volo vault deposits and withdrawals that are waiting for settlement, and cancel them.

  • @naviprotocol/vault 0.1.0
  • @mysten/sui 2.39.1npm 3.0.1
  • TypeScript
  • Sui mainnet

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.

pending-requests.ts
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

FieldMeaning
type'deposit' or 'withdraw'
vaultId, receiptId, requestIdWhich vault, receipt and on-chain request
amount, amountUsd, sharesSize of the request, as decimal strings
executeTimeISO 8601 time after which the request can be cancelled
txIdThe 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.
  • cancelPendingDepositPTB returns the refunded coin, which must be transferred or used, or the transaction fails. cancelPendingWithdrawPTB returns 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.

On this page