tinybot-eth 0.2.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinybot-eth
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Minimal Python framework for building crypto bots
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -174,15 +174,18 @@ bot = TinyBot(rpc_url, name="my bot", private_key=os.environ["PRIVATE_KEY"])
174
174
 
175
175
  tx_hash = bot.executor.execute(
176
176
  contract.functions.tend(strategy_addr),
177
- gas_limit=5_000_000,
178
- max_fee_gwei=100,
179
- max_priority_fee_gwei=3,
177
+ gas_limit=0, # default: 0 — auto-estimates with 1.5x buffer
178
+ max_fee_gwei=100, # default: 100
179
+ max_priority_fee_gwei=0, # default: 0
180
+ simulate=True, # default: True — dry-run via eth_call before sending
180
181
  )
181
182
  ```
182
183
 
183
184
  - `executor.address` — signer address
184
185
  - `executor.balance` — signer ETH balance in wei
185
186
  - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
187
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
188
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
186
189
 
187
190
  ---
188
191
 
@@ -163,15 +163,18 @@ bot = TinyBot(rpc_url, name="my bot", private_key=os.environ["PRIVATE_KEY"])
163
163
 
164
164
  tx_hash = bot.executor.execute(
165
165
  contract.functions.tend(strategy_addr),
166
- gas_limit=5_000_000,
167
- max_fee_gwei=100,
168
- max_priority_fee_gwei=3,
166
+ gas_limit=0, # default: 0 — auto-estimates with 1.5x buffer
167
+ max_fee_gwei=100, # default: 100
168
+ max_priority_fee_gwei=0, # default: 0
169
+ simulate=True, # default: True — dry-run via eth_call before sending
169
170
  )
170
171
  ```
171
172
 
172
173
  - `executor.address` — signer address
173
174
  - `executor.balance` — signer ETH balance in wei
174
175
  - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
176
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
177
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
175
178
 
176
179
  ---
177
180
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tinybot-eth"
3
- version = "0.2.0"
3
+ version = "0.4.0"
4
4
  description = "Minimal Python framework for building crypto bots"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -19,11 +19,18 @@ class Executor:
19
19
  def execute(
20
20
  self,
21
21
  call,
22
- gas_limit: int = 500_000,
22
+ gas_limit: int = 0,
23
23
  max_fee_gwei: int = 100,
24
- max_priority_fee_gwei: int = 3,
24
+ max_priority_fee_gwei: int = 0,
25
25
  value: int = 0,
26
+ simulate: bool = True,
26
27
  ) -> str:
28
+ if simulate:
29
+ call.call({"from": self._account.address, "value": value})
30
+
31
+ if gas_limit == 0:
32
+ gas_limit = int(call.estimate_gas({"from": self._account.address, "value": value}) * 1.5)
33
+
27
34
  tx = call.build_transaction(
28
35
  {
29
36
  "from": self._account.address,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinybot-eth
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: Minimal Python framework for building crypto bots
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -174,15 +174,18 @@ bot = TinyBot(rpc_url, name="my bot", private_key=os.environ["PRIVATE_KEY"])
174
174
 
175
175
  tx_hash = bot.executor.execute(
176
176
  contract.functions.tend(strategy_addr),
177
- gas_limit=5_000_000,
178
- max_fee_gwei=100,
179
- max_priority_fee_gwei=3,
177
+ gas_limit=0, # default: 0 — auto-estimates with 1.5x buffer
178
+ max_fee_gwei=100, # default: 100
179
+ max_priority_fee_gwei=0, # default: 0
180
+ simulate=True, # default: True — dry-run via eth_call before sending
180
181
  )
181
182
  ```
182
183
 
183
184
  - `executor.address` — signer address
184
185
  - `executor.balance` — signer ETH balance in wei
185
186
  - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
187
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
188
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
186
189
 
187
190
  ---
188
191
 
File without changes
File without changes
File without changes