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

# Config

The `getDepositAddress` function generates a smart account address that facilitates user operations. In this section, we’ll explore how to use this function to seamlessly bridge funds across chains.

## Expected parameters

`getDepositAddress` accepts the following parameters:

<Tabs>
  <Tab title="payload">
    <table><thead><tr><th width="316">Parameter</th><th width="137">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>destinationChainId</code></td><td>string</td><td> Destination chain id</td></tr><tr><td><code>destinationTokenAddress</code></td><td>string</td><td> Address of the final token on the destination chain</td></tr><tr><td><code>toAmount</code></td><td>BigInt</td><td>Desired amount on destination chain</td></tr><tr><td><code>destinationRecipient</code></td><td>string</td><td>Target contract address on destination chain</td></tr><tr><td><code>transferType</code></td><td>"onramp" | "cex" | "wallet"</td><td>Specifies the type of the transfer</td></tr><tr><td><code>routeType</code></td><td>string</td><td>Default route is <code>Value</code>. The type of route to be preferred. It can be <code>Value</code>,<code>Fee</code> and <code>Time</code></td></tr><tr><td><code>provider (optional)</code></td><td>"moonpay" | "mesh-connect" | "kado"</td><td>Specifies the provider used for execution</td></tr><tr><td><code>fromChainId (optional)</code></td><td>number</td><td>Source chain id</td></tr><tr><td><code>fromTokenAddress (optional)</code></td><td>string</td><td>Address of initial token on source chain</td></tr><tr><td><code>fromAddress (optional)</code></td><td>string</td><td>Address of the sender on the source chain</td></tr><tr><td><code>fromAmount (optional)</code></td><td>BigInt</td><td>Amount of the initial token on the source chain</td></tr><tr><td><code>slippage (optional)</code></td><td>string</td><td /></tr><tr><td><code>transferOut (optional)</code></td><td>any\[]</td><td /></tr><tr><td><code>targetCalldata(optional)</code></td><td>string</td><td>Encoded calldata for execution on the destination chain</td></tr><tr><td><code>gasLimit (optional)</code></td><td>string</td><td>Custom gas limit</td></tr><tr><td><code>userOpHash (optional)</code></td><td>string</td><td /></tr><tr><td><code>userOperations (optional)</code></td><td>string</td><td /></tr></tbody></table>
  </Tab>
</Tabs>

## Function call

The `getDepositAddress` function generates an address based on the provided payload, which must then be funded and submitted on-chain.

<Tabs>
  <Tab title="ethers.js">
    ```typescript theme={null}
    const provider = new ethers.BrowserProvider(window.ethereum);
    const signer = await provider.getSigner();

    const payload: any = {
            userOpHash: "",
            transferType: TransferType.WALLET,
            destinationChainId: "8453",
            destinationTokenAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
            toAmount: BigInt(Math.floor(0.01 * 10 ** 8),
            destinationRecipient: "0x45c0470ef627a30efe30c06b13d883669b8fd3a8",
            fromTokenAddess: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
            fromChainId: "42161",
            fromAddress: "0xeDa8Dec60B6C2055B61939dDA41E9173Bab372b2",
    };

    const depositData = await aarcCoreSDK.getDepositAddress(payload); 

    // make client sign the generated tx
    const { to, value, data, gasLimit, chainId, from } = depositData.txData;
    const { hash } = await signer.sendTransaction({ to, value, data, gasLimit, chainId, from });
    ```
  </Tab>

  <Tab title="viem">
    ```typescript theme={null}
    import { createWalletClient, custom } from 'viem'
    import { mainnet } from 'viem/chains'
     
     const [account] = await window.ethereum.request({method: "eth_requestAccounts"});
     
    const walletClient = createWalletClient({
      chain: mainnet,
      account,
      transport: custom(window.ethereum!)
    });

    const payload: any = {
            userOpHash: "",
            transferType: "wallet",
            destinationChainId: 8453,
            destinationTokenAddress: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
            toAmount: 1000000, // decimal adjusted
            destinationRecipient: "0x45c0470ef627a30efe30c06b13d883669b8fd3a8",
            fromTokenAddess: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
            fromChainId: 42161,
            fromAddress: "0xeDa8Dec60B6C2055B61939dDA41E9173Bab372b2",
            fromAmount: 1000000
    };

    const depositData = await aarcCoreSDK.getDepositAddress(payload); 

    // make user sign the generated tx
    const { to, value, data, gasLimit, chainId, from } = depositData.txData;
    const txHash = await signer.sendTransaction({ to, value, data, gasLimit, chainId, from });
    ```
  </Tab>
</Tabs>

```typescript theme={null}
//OPTIONAL: postExecuteToAddress will update the aarc about the tx instanstly
await aarcCoreSDK.postExecuteToAddress({
          depositData,
          hash,
}); 
```

Using onramp

```typescript theme={null}
// Using moonpay for onramp (you can also use kado)
const payload = {
    // rest of the payload,
    transferType: "onramp"  
}

const provider = "moonpay";

const depositData = await aarcCoreSDK.getDepositAddress(payload);

 const fromToken = {
        chainId: 8453,
        token_address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
        amount_required: "35",
        decimals: 6,
      };

const url = await aarcCoreSDK.generateMoonpayOnrampUrl({
        walletAddress: depositData.depositAddress,
        defaultCryptoCurrencyCode: depositData.depositTokenSymbol,
        fiatAmount: fromToken.amount_required,
        fiatCurrencyCode: "USD",
        network: "BASE",
        cryptoTokenData: {
          tokenAmount: fromToken.amount_required,
          tokenCode: depositData.depositTokenSymbol ?? "ETH",
        },
      });

const windowRef = window.open(url, "_blank");
```

## Response

The response from the `getDepositAddress` is:

```typescript theme={null}
{
    requestId: string; // helps tracking the order status
    status: string;
    executionTime: string;
    gasFee: string;
    depositAddress: string;
    onChainID: string;
    depositTokenAddress: string;
    amount: string;
    usdFee?: string;
    depositTokenDecimals?: string;
    depositTokenName?: string;
    depositTokenSymbol?: string;
    depositTokenUsdPrice?: number;
    data?: {
        error?: string;
        message?: string;
    };
    txData: {
        chainId: string;
        from: string;
        to: string;
        data: string;
        value: string;
        gasLimit: string;
    };
}
```

For more comprehensive implementation, refer [cookbook](../cookbook/sdk-implementation-in-typescript-+-ethers) example.

## Support

If you face any trouble, feel free to reach out to our engineers in the [Telegram support group](https://t.me/aarcxyz).
