> ## 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.

# MEE Client Functions

> Connect to MEE and execute transactions

## createMeeClient

Creates a client connected to the Modular Execution Environment for gasless, cross-chain execution.

```typescript theme={null}
const meeClient = await createMeeClient(options);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `account` | `MultichainSmartAccount` | Yes | The multichain account |
| `apiKey` | `string` | No | API key for sponsorship |
| `url` | `string` | No | Custom MEE node URL |
| `isDebugMode` | `boolean` | No | When `true`, enables extra logging for HTTP calls, receipt polling, permit checks and etc. |

### Returns

`MeeClient`

### Example

```typescript theme={null}
import { createMeeClient, toMultichainNexusAccount } from "@biconomy/abstractjs";

const account = await toMultichainNexusAccount({ /* ... */ });
const meeClient = await createMeeClient({ account });

// With API key for sponsorship
const meeClient = await createMeeClient({ 
  account,
  apiKey: "your-api-key"
});
```

***

## MeeClient Methods

### getQuote

Get a quote for executing instructions. Returns cost estimates and payloads to sign.

```typescript theme={null}
const quote = await meeClient.getQuote(options);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `instructions` | `Instruction[]` | Yes | Array of instructions |
| `feeToken` | `FeeTokenInfo` | Yes\* | Token to pay gas with |
| `sponsorship` | `boolean` | No | Enable gas sponsorship |
| `delegate` | `boolean` | No | Enable EIP-7702 mode |
| `authorization` | `Authorization` | No | EIP-7702 authorization |
| `lowerBoundTimestamp` | `number` | No | Earliest execution time |
| `upperBoundTimestamp` | `number` | No | Latest execution time |
| `cleanUps` | `CleanUp[]` | No | Cleanup instructions |

\*Not required if `sponsorship: true`

### Returns

```typescript theme={null}
type Quote = {
  hash: Hex;
  paymentInfo: {
    tokenAmount: string;
    tokenAddress: Address;
    chainId: number;
  };
  userOps: UserOp[];
  // ... signing payloads
};
```

### Example

```typescript theme={null}
const quote = await meeClient.getQuote({
  instructions: [instruction1, instruction2],
  feeToken: {
    address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    chainId: 8453
  }
});

console.log("Fee:", quote.paymentInfo.tokenAmount);
```

***

### getFusionQuote

Get a quote for Fusion mode (external wallets like MetaMask).

```typescript theme={null}
const fusionQuote = await meeClient.getFusionQuote(options);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `trigger` | `Trigger` | Yes | Token pull trigger |
| `instructions` | `Instruction[]` | Yes | Array of instructions |
| `feeToken` | `FeeTokenInfo` | Yes\* | Token to pay gas with |
| `sponsorship` | `boolean` | No | Enable gas sponsorship |
| `cleanUps` | `CleanUp[]` | No | Cleanup instructions |
| `upperBoundTimestamp` | `number` | No | Latest execution time |
| `simulation` | `SimulationOptions` | No | Simulation config |

### Example

```typescript theme={null}
const fusionQuote = await meeClient.getFusionQuote({
  trigger: {
    chainId: 8453,
    tokenAddress: USDC,
    amount: parseUnits("100", 6)
  },
  instructions: [swap, deposit],
  feeToken: { address: USDC, chainId: 8453 }
});
```

***

### executeQuote

Execute a quote by signing and submitting it.

```typescript theme={null}
const { hash } = await meeClient.executeQuote({ quote });
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `quote` | `Quote` | Yes | Quote from `getQuote` |

### Returns

```typescript theme={null}
{ hash: Hex }
```

***

### executeFusionQuote

Execute a Fusion quote.

```typescript theme={null}
const { hash } = await meeClient.executeFusionQuote({ fusionQuote });
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `fusionQuote` | `FusionQuote` | Yes | Quote from `getFusionQuote` |

***

## Session quote flow

Use these methods for the Smart Sessions flow: prepare or use a permission by getting a session quote, then sign and execute.

### getSessionQuote

Get a quote for preparing (deploy, fund, install module, enable session) or using a session.

```typescript theme={null}
const quote = await meeClient.getSessionQuote(params);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `mode` | `"PREPARE" \| "USE"` | Yes | `PREPARE` to enable a session; `USE` to run instructions with an existing session |
| `enableSession` | `EnableSession` | No | Required when `mode === "PREPARE"`. Redeemer, actions (`SessionAction[]`), optional `batchActions`, `maxPaymentAmount` |
| `sessionDetails` | `SessionDetail[]` | No | Required when `mode === "USE"`. From a previous prepare/enable flow |
| `instructions` | `Instruction[]` | No | Instructions to execute (use case or prepare with extra setup) |
| `trigger` | `Trigger` | No | Funding trigger (prepare with Fusion) |
| `feeToken` | `FeeTokenInfo` | Yes\* | Token to pay gas with |
| `sponsorship` | `boolean` | No | Enable gas sponsorship |
| `delegate` | `boolean` | No | Enable EIP-7702 mode |
| `authorization` | `Authorization` | No | EIP-7702 authorization |
| `simulation` | `SimulationOptions` | No | Simulation config |
| `lowerBoundTimestamp` | `number` | No | Earliest execution time |
| `upperBoundTimestamp` | `number` | No | Latest execution time |
| `cleanUps` | `CleanUp[]` | No | Cleanup instructions |

\*Not required if `sponsorship: true`

### Returns

`{ quoteType, quote, sessionDetails? }` or `undefined` when there is nothing to do (e.g. no enable, no instructions).

See [Smart Sessions](/sdk-reference/sessions) for full parameter details and examples.

***

### signSessionQuote

Sign the payload returned from `getSessionQuote`. Dispatches by `quoteType` to the appropriate signer (e.g. `signQuote` for simple, `signFusionQuote` for fusion).

```typescript theme={null}
const signed = await meeClient.signSessionQuote(params);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `params` | `GetSessionQuoteResponse` | Yes | The object returned from `getSessionQuote` |

Typically you use `executeSessionQuote`, which signs and executes in one step.

***

### executeSessionQuote

Sign and execute a session quote. Handles both simple and fusion quote types and trigger execution.

```typescript theme={null}
const { hash } = await meeClient.executeSessionQuote(params);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `params` | `GetSessionQuoteResponse` | Yes | The object returned from `getSessionQuote` |

See [Smart Sessions](/sdk-reference/sessions) for full parameter details and examples.

***

### waitForSupertransactionReceipt

Wait for a supertransaction to complete.

```typescript theme={null}
const receipt = await meeClient.waitForSupertransactionReceipt(options);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `hash` | `Hex` | Yes | Supertransaction hash |
| `mode` | `"default" \| "fast-block"` | No | Confirmation mode |
| `confirmations` | `number` | No | Confirmations to wait for |

### Returns

```typescript theme={null}
type Receipt = {
  transactionStatus: "PENDING" | "MINED_SUCCESS" | "MINED_FAILED" | "EXPIRED";
  userOps: UserOpReceipt[];
  explorerLinks: string[];
};
```

### Example

```typescript theme={null}
const { hash } = await meeClient.executeQuote({ quote });

const receipt = await meeClient.waitForSupertransactionReceipt({ 
  hash,
  mode: "default"
});

if (receipt.transactionStatus === "MINED_SUCCESS") {
  console.log("Success!");
}
```

***

### getSupertransactionReceipt

Get current status without waiting.

```typescript theme={null}
const receipt = await meeClient.getSupertransactionReceipt(options);
```

### Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `hash` | `Hex` | Yes | Supertransaction hash |
| `waitForReceipts` | `boolean` | No | Wait for on-chain receipts |
| `mode` | `"default" \| "fast-block"` | No | Confirmation mode |

### Example

```typescript theme={null}
// Poll for status
const receipt = await meeClient.getSupertransactionReceipt({ hash });

if (receipt.transactionStatus === "PENDING") {
  console.log("Still processing...");
}
```

***

## Cleanup Instructions

Return leftover tokens after execution.

```typescript theme={null}
const quote = await meeClient.getQuote({
  instructions: [...],
  feeToken: {...},
  cleanUps: [
    {
      chainId: 8453,
      tokenAddress: USDC,
      recipientAddress: userEOA,
      dependsOn: [userOp(2)]  // Optional: wait for specific instruction
    }
  ]
});
```

### CleanUp Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `chainId` | `number` | Yes | Chain to cleanup on |
| `tokenAddress` | `Address` | Yes | Token to return |
| `recipientAddress` | `Address` | Yes | Where to send tokens |
| `dependsOn` | `UserOpRef[]` | No | Instructions to wait for |
| `amount` | `bigint` | No | Specific amount (default: full balance) |


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