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

# Get Quote: Smart Account Mode

> Request quotes for Nexus smart account users

Use `mode: 'smart-account'` for users with Biconomy Nexus accounts or other ERC-4337 smart accounts. This is the simplest mode with native gas abstraction.

## How Smart Account Mode Works

Smart accounts have built-in gas abstraction. Users always sign just once, regardless of how complex the operation is.

<Steps>
  <Step title="Build your request">
    Define operations in `composeFlows`—no `fundingTokens` needed
  </Step>

  <Step title="Get quote">
    API returns a single payload to sign
  </Step>

  <Step title="User signs once">
    Always exactly one signature
  </Step>

  <Step title="MEE executes">
    Biconomy handles everything across all chains
  </Step>
</Steps>

## Basic Request

```typescript theme={null}
const quote = await fetch('https://api.biconomy.io/v1/quote', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    mode: 'smart-account',
    ownerAddress: '0xYourUserAddress',
    composeFlows: [{
      type: '/instructions/intent-simple',
      data: {
        srcChainId: 8453,
        dstChainId: 10,
        srcToken: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',
        dstToken: '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58',
        amount: '100000000',
        slippage: 0.01
      }
    }]
  })
}).then(r => r.json());
```

That's it! No `fundingTokens` required—the smart account already holds the tokens.

## Required Parameters

| Parameter      | Type              | Description                         |
| -------------- | ----------------- | ----------------------------------- |
| `mode`         | `'smart-account'` | Must be `'smart-account'`           |
| `ownerAddress` | string            | The EOA that owns the smart account |
| `composeFlows` | array             | Operations to execute               |

## Gas Options

<Tabs>
  <Tab title="Sponsored (Gasless)">
    **Omit `feeToken`** to use sponsorship—you pay for user's gas:

    ```typescript theme={null}
    {
      mode: 'smart-account',
      ownerAddress: '0x...',
      // No feeToken = sponsored
      composeFlows: [...]
    }
    ```

    <Note>
      Requires an API key with sponsorship enabled. Get one at [dashboard.biconomy.io](https://dashboard.biconomy.io)
    </Note>
  </Tab>

  <Tab title="User Pays in Token">
    **Include `feeToken`** to deduct gas from user's balance:

    ```typescript theme={null}
    {
      mode: 'smart-account',
      ownerAddress: '0x...',
      feeToken: {
        address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC
        chainId: 8453
      },
      composeFlows: [...]
    }
    ```

    Fee is automatically deducted from the user's USDC balance.
  </Tab>
</Tabs>

## Quote Response

Smart account mode always returns `quoteType: 'simple'`:

```json theme={null}
{
  "quoteType": "simple",
  "payloadToSign": [{
    "signablePayload": {
      "domain": { "name": "Nexus" },
      "types": { /* EIP-712 types */ },
      "primaryType": "SuperTx",
      "message": { /* transaction data */ }
    }
  }],
  "fee": { "amount": "50000", "token": "0x...", "chainId": 8453 },
  "returnedData": [{ "outputAmount": "99500000", "minOutputAmount": "98505000" }]
}
```

## Signing the Payload

Smart account mode uses EIP-712 typed data signing:

```typescript theme={null}
const payload = quote.payloadToSign[0];

const signature = await walletClient.signTypedData({
  ...payload.signablePayload,
  account
});
```

<Tip>
  EIP-712 shows users a human-readable breakdown of what they're signing—much better UX than raw hex messages.
</Tip>

## Complete Example

```typescript theme={null}
import { createWalletClient, http, parseUnits, formatUnits } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { base } from 'viem/chains';

const USDC_BASE = '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913';
const USDT_OP = '0x94b008aa00579c1307b0ef2c499ad98a8ce58e58';

async function swapWithSmartAccount(ownerAddress, walletClient) {
  // 1. Get quote (no fundingTokens needed!)
  const quote = await fetch('https://api.biconomy.io/v1/quote', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      mode: 'smart-account',
      ownerAddress,
      feeToken: {
        address: USDC_BASE,
        chainId: 8453
      },
      composeFlows: [{
        type: '/instructions/intent-simple',
        data: {
          srcChainId: 8453,
          dstChainId: 10,
          srcToken: USDC_BASE,
          dstToken: USDT_OP,
          amount: parseUnits('100', 6).toString(),
          slippage: 0.01
        }
      }]
    })
  }).then(r => r.json());

  // 2. Show user what they'll get
  const output = quote.returnedData[0];
  console.log('Expected output:', formatUnits(output.outputAmount, 6), 'USDT');
  console.log('Minimum output:', formatUnits(output.minOutputAmount, 6), 'USDT');
  console.log('Fee:', formatUnits(quote.fee.amount, 6), 'USDC');

  // 3. Sign (always EIP-712 typed data)
  const payload = quote.payloadToSign[0];
  const signature = await walletClient.signTypedData({
    ...payload.signablePayload,
    account: walletClient.account
  });

  // 4. Execute
  const result = await fetch('https://api.biconomy.io/v1/execute', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      ...quote,
      payloadToSign: [{ ...payload, signature }]
    })
  }).then(r => r.json());

  console.log('Track at:', `https://meescan.biconomy.io/details/${result.supertxHash}`);
  return result.supertxHash;
}
```

## Cross-Chain Gas Payment

Smart accounts can pay for gas on any chain using tokens from any other chain:

```typescript theme={null}
{
  mode: 'smart-account',
  ownerAddress: '0x...',
  feeToken: {
    address: USDC_BASE,  // Pay from Base
    chainId: 8453
  },
  composeFlows: [{
    type: '/instructions/build',
    data: {
      chainId: 42161,  // Execute on Arbitrum
      to: SOME_CONTRACT,
      functionSignature: 'function doSomething()',
      args: []
    }
  }]
}
```

User has USDC on Base, but the transaction executes on Arbitrum. Biconomy handles the cross-chain gas settlement.

## No Withdrawal Needed

Unlike EOA mode, smart account funds stay in the smart account after operations—which is usually what you want. Users can:

* Continue using funds for more operations
* Withdraw manually when needed
* Access via any dApp that supports smart accounts

## When to Use Smart Account Mode

<CardGroup cols={2}>
  <Card title="Best For" icon="check">
    * Apps with embedded smart accounts
    * Users who've deployed Nexus accounts
    * Maximum gas abstraction flexibility
    * Cross-chain gas payment
  </Card>

  <Card title="Not For" icon="xmark">
    * Users with only MetaMask/Rabby
    * One-time users (account deployment overhead)
    * Apps that don't manage accounts
  </Card>
</CardGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Sign Payload" icon="signature" href="/overview/supertransaction-api/sign-payload">
    Signing details
  </Card>

  <Card title="Execute" icon="play" href="/overview/supertransaction-api/execute">
    Submit and track
  </Card>
</CardGroup>
