# send\_transaction\_by\_eip1559

发送自定义 EIP-1559 交易。

## 方法定义

```python
def send_transaction_by_eip1559(self, to: Optional[ChecksumAddress] = None, data: HexBytes = HexBytes("0x"), value: Wei = Wei(0), base_fee: Optional[Wei] = None, max_priority_fee: Optional[Wei] = None, gas_limit: int = 500000) -> Optional[TransactionReceiptData]
```

## 参数说明

| 参数                 | 类型                         | 说明                       |
| ------------------ | -------------------------- | ------------------------ |
| to                 | Optional\[ChecksumAddress] | 接收者地址,为 None 时表示创建合约     |
| data               | HexBytes                   | 交易数据,默认为空                |
| value              | Wei                        | 发送的原生代币数量,默认为 0          |
| base\_fee          | Optional\[Wei]             | 基础费用,默认使用链上当前 gas\_price |
| max\_priority\_fee | Optional\[Wei]             | 最高优先费用,默认使用链上建议值         |
| gas\_limit         | int                        | Gas 最大使用量,默认为 500000     |

## 返回值

返回值格式与 send\_transaction 相同。

## 示例代码

```python
# 发送 EIP-1559 交易
receipt = account.send_transaction_by_eip1559(
    to="0x...",
    value=Web3.to_wei(0.1, 'ether'),
    max_priority_fee=Web3.to_wei(2, 'gwei')
)
if receipt and receipt.transaction_status:
    print(f"Transaction successful: {receipt.transaction_hash.hex()}")
    print(f"Effective gas price: {Web3.from_wei(receipt.effective_gas_price, 'gwei')} Gwei")
```


---

# 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://poseidon.seaeye.cn/evm/account/send_transaction_by_eip1559.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.
