# Magicspend++

## Overview

Normally, if a user wants to transact on a new chain, they need to:

1. Bridge tokens across chains
2. Manage gas on each chain
3. Wait for settlement before taking action

This creates friction, slows down activity, and reduces usability across chains.

**Magicspend++** lets users spend their token balances across multiple chains in one seamless transaction without bridging delays or worrying about gas fees:

* No bridging needed – funds are instantly available on the target chain
* No gas headaches – gas fees are sponsored
* Fast transactions – executed at the speed of the destination chain

## How it works

**Magicspend++** removes this friction with a borrow-and-settle model:

1. Resource Lock
   * Locks part of the user’s tokens on source chains.
   * Those funds can’t be spent elsewhere until settlement.
   * Enforced differently depending on wallet type:
     * **Turnkey Signers:** [Turnkey policies](https://docs.turnkey.com/concepts/policies/overview) prevent wallets from spending locked tokens.
     * **Privy Authorized Keys and Policies**:  [Privy policies](https://docs.privy.io/controls/policies/overview) prevent wallets from spending locked tokens.
     * **Smart contract wallets (e.g. Safe)**: Co-signer must approve spending of locked tokens.
2. Enclave Vault
   * Instantly lends tokens on the target chain so the user can transact right away.
   * The loan is repaid later using the locked funds across chains.

### Example

Let's say the user wants to buy 10 GMX tokens on Arbitrum but only has funds on Optimism and Base.

<figure><img src="/files/fZQjiEQGbimClP8RQ51k" alt=""><figcaption></figcaption></figure>

**Magicspend++ flow:**

1. Borrow USDC on Arbitrum vault
2. Instantly swap on Arbitrum DEX
3. Settlement takes place later and deducts from Base and Optimism

<figure><img src="/files/ORTi10Si7On9zxEhCXBT" alt=""><figcaption></figcaption></figure>

### Wallet Support

Enclave supports Magicspend++ with the following wallet types:

1. Turnkey EOA Wallets
2. Privy EOA Wallets
3. Smart Contract Wallets (ERC4337, ERC7579 Smart Accounts)

### Batched Transactions and Gas Abstraction

Enclave leverages ERC4337 paymasters to abstract gas for users. ERC4337 /7579 accounts are also able to execute batched transactions which allows the end user to borrow from Enclave's vault and execute the desired action (ex. swap on Uniswap) in a single atomic on-chain transaction.

**EOA Support**

In order to support Turnkey EOAs, Enclave leverages EIP7702 to convert the EOA into a smart contract wallet, allowing it to inherit the properties of a smart contract wallet which supports gas sponsorship and transaction batching.

### Quote Types

#### Amount In

User specifies **exactly how much to spend** (inclusive of fees).&#x20;

For example: User wants to spend exactly $10 to buy a memecoin.

Enclave gives **$9.90 on target chain, settles $10 across balances** on other chains.

#### Amount Out

User specifies **how much they need on the target chain**

For example: User needs $10 on Base to lend on Morpho

Enclave gives **$10 on target chain**, **settles $10.10 across balances** on other chains.

{% hint style="info" %}
**Note on fees:** The quote includes fees for both the borrow cost as well as sponsoring the gas fees to be paid on the target chain for execution of the user's desired action, and the gas fees to be paid on the settlement chains for settlement transactions.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.enclave.money/introducing-enclave-money/magicspend++.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
