> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Real Time Funding from User Wallet

> Real Time Funding lets card authorizations draw funds directly from a user's associated wallet into their Rain collateral contract.

<Info>
  Real Time Funding is in **beta** and available in both **sandbox** and **production**.
</Info>

When a card authorization comes in for a user whose tenant is enabled for Real Time Funding, Rain pulls the full authorization amount from the user's associated wallet into their Rain collateral contract before the authorization is approved.

To use Real Time Funding, your tenant must be enabled by Rain, the user must have a wallet associated with their Rain account, and the wallet must hold sufficient balance of a supported asset on a supported chain and have approved the Rain operator to spend it.

## Supported Chains

Real Time Funding supports the chains listed below. Additional chain support is actively being developed.

### Sandbox

| Chain            | Chain ID         |
| ---------------- | ---------------- |
| Arbitrum Sepolia | 421614 (0x66eee) |
| Base Sepolia     | 84532 (0x14a34)  |
| Plasma Testnet   | 9746 (0x2612)    |

### Production

| Chain            | Chain ID       |
| ---------------- | -------------- |
| Arbitrum Mainnet | 42161 (0xa4b1) |
| Base Mainnet     | 8453 (0x2105)  |
| Plasma Mainnet   | 9745 (0x2611)  |

## Supported Assets

The supported asset depends on the chain. The user's wallet must hold — and approve the Rain operator to spend — the asset listed for the chain you are using. Additional assets will be added as the feature exits beta.

### Sandbox

| Chain            | Asset | Token Address                                                                                                                   |
| ---------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------- |
| Arbitrum Sepolia | USDC  | [`0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d`](https://sepolia.arbiscan.io/address/0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d)  |
| Base Sepolia     | USDC  | [`0x036CbD53842c5426634e7929541eC2318f3dCF7e`](https://sepolia.basescan.org/address/0x036CbD53842c5426634e7929541eC2318f3dCF7e) |
| Plasma Testnet   | USDT0 | [`0x246A94A471348881071BB475bf318B7119aB7E2D`](https://testnet.plasmascan.to/token/0x246A94A471348881071BB475bf318B7119aB7E2D)  |

### Production

| Chain            | Asset | Token Address                                                                                                           |
| ---------------- | ----- | ----------------------------------------------------------------------------------------------------------------------- |
| Arbitrum Mainnet | USDC  | [`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`](https://arbiscan.io/token/0xaf88d065e77c8cC2239327C5EDb3A432268e5831)    |
| Base Mainnet     | USDC  | [`0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) |
| Plasma Mainnet   | USDT0 | [`0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb`](https://plasmascan.to/token/0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb)  |

<Warning>
  Plasma uses **USDT0**, not USDC. A wallet funded with USDC cannot be pulled from on Plasma, and a wallet funded with USDT0 cannot be pulled from on Arbitrum or Base. Fund and approve the asset that matches the chain.
</Warning>

## Prerequisites

Before Real Time Funding can run for a card, the following must be true:

* Your tenant is enabled for Real Time Funding. Contact Rain to request enablement.
* The user has a wallet address on the supported chain(s) associated with their Rain account.
* The user's wallet holds the supported asset for that chain and environment.
* The user's wallet has approved the Rain operator to spend that asset on their behalf.

## Funding the User Wallet

The user's associated wallet must hold the supported asset for the chain you are using. Send that asset to the wallet using the token address from the [Supported Assets](#supported-assets) tables above.

The wallet also needs the chain's native token to pay gas — ETH on Arbitrum and Base, XPL on Plasma.

### Getting Testnet Funds (Sandbox)

In sandbox, get Arbitrum Sepolia or Base Sepolia USDC from the [Circle faucet](https://faucet.circle.com/).

<Steps>
  <Step title="Open the faucet">
    Go to [https://faucet.circle.com/](https://faucet.circle.com/).
  </Step>

  <Step title="Select the network">
    Choose **Arbitrum Sepolia** or **Base Sepolia** as the network and **USDC** as the token.
  </Step>

  <Step title="Enter the wallet address">
    Paste the wallet address associated with the Rain user.
  </Step>

  <Step title="Request tokens">
    Submit the request and wait for the transaction to confirm. The USDC will appear in the wallet balance.
  </Step>
</Steps>

For Plasma Testnet, get XPL for gas from the [a Plasma testnet faucet](https://www.plasma.to/docs/plasma-chain/tools/faucets), then contact Rain to have testnet USDT0 sent to the user's wallet.

## Approving the Rain Operator

The user wallet must approve the Rain operator address to transfer the chain's supported asset on its behalf. We recommend approving the maximum `uint256` value (`115792089237316195423570985008687907853269984665640564039457584007913129639935`) so the user does not need to re-approve before each authorization.

### Operator Addresses

The operator address is the same across all chains within an environment.

| Environment | Operator Address                                                                                                               |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Sandbox     | [`0x5a6E6b0d5Ea051CfFF9b3dcC2Aa8Dac226458f29`](https://sepolia.arbiscan.io/address/0x5a6E6b0d5Ea051CfFF9b3dcC2Aa8Dac226458f29) |
| Production  | [`0xA3750f692BB9Fc5e62834f9291E3D508d7Ba4F74`](https://arbiscan.io/address/0xA3750f692BB9Fc5e62834f9291E3D508d7Ba4F74)         |

### Approve via Block Explorer

Use this flow if the user is approving manually from a wallet they control directly (for example, MetaMask).

<Steps>
  <Step title="Open the token contract on the block explorer">
    Navigate to the token contract on the block explorer for the chain you are using:

    * **Sandbox / Arbitrum Sepolia (USDC)**: [`https://sepolia.arbiscan.io/address/0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d`](https://sepolia.arbiscan.io/address/0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d)
    * **Sandbox / Base Sepolia (USDC)**: [`https://sepolia.basescan.org/address/0x036CbD53842c5426634e7929541eC2318f3dCF7e`](https://sepolia.basescan.org/address/0x036CbD53842c5426634e7929541eC2318f3dCF7e)
    * **Sandbox / Plasma Testnet (USDT0)**: [`https://testnet.plasmascan.to/token/0x246A94A471348881071BB475bf318B7119aB7E2D`](https://testnet.plasmascan.to/token/0x246A94A471348881071BB475bf318B7119aB7E2D)
    * **Production / Arbitrum Mainnet (USDC)**: [`https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831`](https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831)
    * **Production / Base Mainnet (USDC)**: [`https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913)
    * **Production / Plasma Mainnet (USDT0)**: [`https://plasmascan.to/token/0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb`](https://plasmascan.to/token/0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb)

    To use a different supported asset (once available), substitute its token address into the same URL pattern.
  </Step>

  <Step title="Connect the user's wallet">
    Open the **Contract** tab, select **Write Contract**, and click **Connect to Web3**. Connect the wallet that is associated with the Rain user.
  </Step>

  <Step title="Call approve">
    Locate the `approve` function and enter:

    * `spender` — the Rain operator address for your environment (see above).
    * `value` — the amount to approve, in the token's native units. We recommend `uint256` max: `115792089237316195423570985008687907853269984665640564039457584007913129639935`.
  </Step>

  <Step title="Submit and confirm">
    Click **Write**, confirm the transaction in the connected wallet, and wait for it to be mined.
  </Step>
</Steps>

### Approve Programmatically

Use this flow to script the approval as part of an automated onboarding step. Swap `TOKEN_ADDRESS` and the RPC URL for the chain you are targeting — the approval call is the same for USDC and USDT0.

```ts title="approveOperator.ts" theme={null}
import { ethers } from "ethers";

const TOKEN_ADDRESS = "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"; // Arbitrum Sepolia USDC
const RAIN_OPERATOR = "0x5a6E6b0d5Ea051CfFF9b3dcC2Aa8Dac226458f29"; // Sandbox

const ERC20_ABI = ["function approve(address spender, uint256 amount) returns (bool)"];

const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
const wallet = new ethers.Wallet(process.env.USER_WALLET_PRIVATE_KEY!, provider);

const token = new ethers.Contract(TOKEN_ADDRESS, ERC20_ABI, wallet);

const tx = await token.approve(RAIN_OPERATOR, ethers.MaxUint256);
const receipt = await tx.wait();

console.log(`Approval confirmed in block ${receipt?.blockNumber}`);
```

Make sure the wallet loaded from `USER_WALLET_PRIVATE_KEY` is the wallet associated with the user's Rain account, and that it holds enough of the chain's native token to pay gas before you run the script.

## What Happens at Authorization

Once the user's wallet is funded and the operator is approved, no further action is required. When an authorization comes in for one of the user's cards:

1. Rain pulls the **full authorization amount** in the chain's supported asset from the user's associated wallet using the operator's `transferFrom` allowance. The pull happens regardless of any spending power the user already has.
2. The pulled funds land in the user's Rain collateral contract.
3. The authorization proceeds against the topped-up collateral.

If the wallet does not hold enough of the supported asset, the allowance is insufficient, or any step of the pull fails, the authorization is declined.

## What's Next

<Card title="Supported Chains and Tokens" href="/docs/supported-chains-and-tokens">
  See the full list of chains and tokens supported across the Rain platform.
</Card>

<Card title="Transaction Lifecycle" href="/docs/transaction-lifecycle">
  Learn how authorizations and settlements flow through the system.
</Card>

<Card title="Managing Collateral" href="/docs/managing-collateral">
  Understand how collateral funds card authorizations and settlements.
</Card>
