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

# Utility Functions

> Helper functions and constants

## getMeeScanLink

Generate a link to MEE Scan explorer for a supertransaction.

```typescript theme={null}
import { getMeeScanLink } from "@biconomy/abstractjs";

const link = getMeeScanLink(hash);
```

### Parameters

| Parameter | Type  | Required | Description           |
| --------- | ----- | -------- | --------------------- |
| `hash`    | `Hex` | Yes      | Supertransaction hash |

### Returns

`string` - URL to MEE Scan

### Example

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

console.log("View transaction:", link);
// https://meescan.biconomy.io/tx/0x...
```

***

## getMEEVersion

Get MEE version configuration for account setup.

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

const version = getMEEVersion(MEEVersion.V2_1_0);
```

### MEEVersion Enum

```typescript theme={null}
enum MEEVersion {
  V2_1_0 = "2.1.0",
  V2_2_0 = "2.2.0"
}
```

### Example

```typescript theme={null}
const account = await toMultichainNexusAccount({
  signer,
  chainConfigurations: [
    {
      chain: base,
      transport: http(),
      version: getMEEVersion(MEEVersion.V2_1_0)
    }
  ]
});
```

***

## userOp

Reference a specific user operation for dependencies.

```typescript theme={null}
import { userOp } from "@biconomy/abstractjs";

const ref = userOp(2);  // Reference to 3rd instruction (0-indexed)
```

### Usage

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

***

## toFeeToken

Helper to create FeeTokenInfo from multichain token.

```typescript theme={null}
import { toFeeToken } from "@biconomy/abstractjs";

const feeToken = toFeeToken({
  mcToken: mcUSDC,
  chainId: 8453
});
```

***

## Simulation Options

Configure simulation for gas estimation.

```typescript theme={null}
const quote = await meeClient.getFusionQuote({
  trigger,
  instructions,
  feeToken,
  simulation: {
    simulate: true,
    overrides: {
      tokenOverrides: [
        {
          tokenAddress: USDC,
          chainId: 8453,
          balance: parseUnits("1000", 6),
          accountAddress: account.addressOn(8453, true)
        }
      ]
    }
  }
});
```

### SimulationOptions

| Property    | Type        | Description       |
| ----------- | ----------- | ----------------- |
| `simulate`  | `boolean`   | Enable simulation |
| `overrides` | `Overrides` | State overrides   |

### Overrides

| Property          | Type                     | Description                                                    |
| ----------------- | ------------------------ | -------------------------------------------------------------- |
| `tokenOverrides`  | `TokenOverride[]`        | Mock token balances                                            |
| `customOverrides` | `CustomOverride[]`       | Custom storage slots                                           |
| `gasLimitBuffers` | `Record<number, bigint>` | Optional per-chain gas limit buffer (chain ID → buffer amount) |

***

## Constants

### Default URLs

```typescript theme={null}
import { 
  DEFAULT_PATHFINDER_URL,
  DEFAULT_MEE_TESTNET_SPONSORSHIP_PAYMASTER_ACCOUNT,
  DEFAULT_MEE_TESTNET_SPONSORSHIP_TOKEN_ADDRESS,
  DEFAULT_MEE_TESTNET_SPONSORSHIP_CHAIN_ID
} from "@biconomy/abstractjs";
```

### Nexus Singleton

```typescript theme={null}
const NEXUS_V120_SINGLETON = "0x000000004F43C49e93C970E84001853a70923B03";
```

***

## Type Exports

```typescript theme={null}
import type {
  MeeClient,
  MultichainSmartAccount,
  Instruction,
  FeeTokenInfo,
  Trigger,
  Quote,
  FusionQuote,
  Receipt,
  SessionDetails,
  Condition,
  RuntimeValue,
  CleanUp
} from "@biconomy/abstractjs";
```

***

## Viem Re-exports

AbstractJS re-exports commonly used viem utilities:

```typescript theme={null}
import { 
  parseUnits,
  parseEther,
  formatUnits,
  encodeFunctionData,
  decodeFunctionResult,
  toFunctionSelector,
  getAbiItem,
  pad,
  toHex
} from "viem";
```

***

## Error Handling

```typescript theme={null}
try {
  const { hash } = await meeClient.executeQuote({ quote });
  const receipt = await meeClient.waitForSupertransactionReceipt({ hash });
  
  if (receipt.transactionStatus === "MINED_SUCCESS") {
    console.log("Success!");
  } else if (receipt.transactionStatus === "MINED_FAILED") {
    console.error("Transaction failed on-chain");
    receipt.userOps.forEach(op => {
      console.log(`Chain ${op.chainId}: ${op.executionStatus}`);
    });
  }
} catch (error) {
  if (error.code === "INSUFFICIENT_FUNDS") {
    console.error("Not enough tokens for gas");
  } else if (error.code === "SIMULATION_FAILED") {
    console.error("Transaction would revert");
  } else {
    throw error;
  }
}
```
