> For the complete documentation index, see [llms.txt](https://sodex.com/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sodex.com/documentation/for-developers/developers/wealth/vault-lifecycle/settlement-and-claims.md).

# Settlement and Claims

Track the submitted request before claiming. Follow the [settlement conditions](/documentation/for-developers/developers/wealth/vault-lifecycle.md#settlement-and-claims) to distinguish indexing, pending settlement, automatic delivery, and delayed redemption.

## Query settlement status

The following read-only Node.js 18+ example locates the original request and prints its settlement indicators. Set `USER_ADDRESS`, `FUND_ID`, `REQUEST_TX_HASH`, and `KIND` (`deposit` or `redeem`), save as `settlement.mjs`, and run `node settlement.mjs`.

```javascript
const { USER_ADDRESS, FUND_ID, REQUEST_TX_HASH, KIND } = process.env;
if (!USER_ADDRESS || !FUND_ID || !REQUEST_TX_HASH ||
    !["deposit", "redeem"].includes(KIND)) {
  throw new Error("Set USER_ADDRESS, FUND_ID, REQUEST_TX_HASH, and KIND");
}
const url = new URL(
  "https://mainnet-gw.sodex.dev/api/v1/wealth/users/" +
  encodeURIComponent(USER_ADDRESS) + "/fund-details"
);
url.searchParams.set("fundId", FUND_ID);
const response = await fetch(url, { signal: AbortSignal.timeout(15000) });
const body = await response.json();
if (!response.ok || body.code !== 0) throw new Error("Fund history query failed");
const entries = body.data.entries.filter(entry =>
  entry.fundId === FUND_ID && entry.kind === KIND &&
  entry.txHash?.toLowerCase() === REQUEST_TX_HASH.toLowerCase()
);
if (entries.length === 0) console.log("Request not indexed; query again later");
for (const entry of entries) {
  console.log({
    entryId: entry.entryId ?? "unknown",
    status: entry.status,
    claimable: entry.claimable ?? "unknown",
    delayedPending: entry.delayedPending ?? "unknown",
    shares: entry.shares,
    proceeds: entry.proceeds,
  });
}
```

Use the verified on-chain request ID with the claim functions below. Do not assume an upstream `entryId` is interchangeable with the contract request ID. Re-query after confirmation and verify the received shares or assets; simulation is a preflight check, not a guarantee against state changes before execution.

## Claim settled assets or shares

Skip this step when settlement already auto-claimed for the owner. Otherwise, use the owner wallet, the actual request ID, and the appropriate method after settlement:

| Operation                         | Method                                    |
| --------------------------------- | ----------------------------------------- |
| Deposit shares                    | `claimDeposit(receiver, requestId)`       |
| Immediate redemption assets       | `claimRedeem(receiver, requestId)`        |
| Settled delayed redemption assets | `claimDelayedRedeem(receiver, requestId)` |

The following functions use the same `account`, `publicClient`, `walletClient`, `VAULT`, and `vaultAbi` setup as [Direct Deposits](/documentation/for-developers/developers/wealth/vault-lifecycle/direct-deposits.md) and [Direct Redemptions](/documentation/for-developers/developers/wealth/vault-lifecycle/direct-redemptions.md). Use the matching page's setup and ABI. The owner wallet pays gas in SOSO.

```typescript
/** Step 2: after market fulfill (and if not auto-claimed), claim shares. */
async function claimVaultDeposit(requestId: bigint) {
  const hash = await walletClient.writeContract({
    address: VAULT,
    abi: vaultAbi,
    functionName: "claimDeposit",
    args: [account.address, requestId],
  });
  return publicClient.waitForTransactionReceipt({ hash });
}
```

```typescript
/** Step 2a: claim immediate (non-delayed) assets after fulfill. */
async function claimVaultRedeem(requestId: bigint) {
  const hash = await walletClient.writeContract({
    address: VAULT,
    abi: vaultAbi,
    functionName: "claimRedeem",
    args: [account.address, requestId],
  });
  return publicClient.waitForTransactionReceipt({ hash });
}

/** Step 2b: claim delayed assets after delayed redeem is settled. */
async function claimVaultDelayedRedeem(requestId: bigint) {
  const hash = await walletClient.writeContract({
    address: VAULT,
    abi: vaultAbi,
    functionName: "claimDelayedRedeem",
    args: [account.address, requestId],
  });
  return publicClient.waitForTransactionReceipt({ hash });
}
```

Call only the function for the settled, unclaimed portion, with its verified on-chain request ID. Do not invoke all three functions in sequence. Submit the request with [Direct Deposits](/documentation/for-developers/developers/wealth/vault-lifecycle/direct-deposits.md) or [Direct Redemptions](/documentation/for-developers/developers/wealth/vault-lifecycle/direct-redemptions.md); claim only from this page after settlement.

After claiming, query the owner's share or asset balance and reconcile the fund timeline. Do not resend the original deposit or redemption request to retry a failed claim.
