# Transact on Ethereum & L2s (WIP)

Uses the `@snowbridge/api` SDK.

### Agent Setup

To execute arbitrary contracts on Ethereum and L2s, you need to create an agent for your calling parachain or user. More details can be found in the [Agents section](broken://pages/gZd0UprOH4eSA5EYNy2H#agent).

### SDK Usage

The SDK uses the same sender pattern as token transfers, with the Ethereum contract call passed through the build options.

```typescript
import { createApi } from "@snowbridge/api"
import { EthersEthereumProvider } from "@snowbridge/provider-ethers"
import { polkadot_mainnet } from "@snowbridge/registry"

const {
    chains: { assetHub, ethereum },
} = polkadot_mainnet
const api = createApi({ info: polkadot_mainnet, ethereumProvider: new EthersEthereumProvider() })
const TARGET_CONTRACT = "0x1111111111111111111111111111111111111111"
const TARGET_CALLDATA = "0x"

const sender = api.sender(assetHub, ethereum)

const transfer = await sender.build(
    "5...", // source Polkadot account
    "0x...", // beneficiary Ethereum account
    "0x0000000000000000000000000000000000000000", // Ether address
    15_000_000_000_000n, // amount: 0.000015 ETH
    {
        fee: {
            contractCall: {
                target: TARGET_CONTRACT,
                calldata: TARGET_CALLDATA,
                value: 0n,
                gas: 500_000n,
            },
        },
    },
)
```

The returned `transfer.tx` can then be submitted to the wallet by your application.

For current route coverage, see [SDK Cases](/developers/snowbridge-v2/typescript-sdk/cases.md).


---

# 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.snowbridge.network/developers/snowbridge-v2/typescript-sdk/transact-ethereum.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.
