> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zyf.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Claim rZFI

rZFI rewards accrue to the user's Safe on Base. Build the claim as an unsigned
transaction and sign and send it with your own signer, like
[`buildDepositTransfer`](https://docs.zyf.ai/docs/sdk/api/external-deposit-building-blocks).

## `buildRzfiClaimTransaction`

```typescript theme={null}
buildRzfiClaimTransaction(userAddress: string): Promise<{
  safeAddress: Address;
  chainId: 8453;
  claimableAmount: string; // wei, 18 decimals
  to: Address;
  data: Hex;
  value: "0";
}>
```

```typescript theme={null}
const tx = await sdk.buildRzfiClaimTransaction(userAddress);

const hash = await walletClient.sendTransaction({
  account: userAddress,
  chain: base,
  to: tx.to,
  data: tx.data,
  value: BigInt(tx.value),
});
```

* Send it from `userAddress` on Base (8453). Any other sender reverts.
* The sender pays the gas (about 250k on Base).
* It claims all unclaimed rZFI into the user's Safe.
* Throws `No rZFI available to claim` when there is nothing to claim.
* Throws a retry message while Merkl's reward tree is updating on-chain; retry
  in a few minutes.

## Gas-sponsored alternative

To have Zyfai pay the gas instead, sign a hash rather than a transaction:

1. `prepareRzfiClaim(userAddress)` returns `userOpHashToSign` and
   `claimableAmount`.
2. Sign `userOpHashToSign` with the owner wallet (`personal_sign` of the raw
   32-byte hash).
3. `submitRzfiClaim(userAddress, signature)` sends the claim and returns
   `txHash`.

Requires an authenticated user session (`connectAccount()` or `forUser()`).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.