tinybot-eth 0.3.0__tar.gz → 0.5.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.3.0
3
+ Version: 0.5.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,21 @@ 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
181
+ wait=120, # default: 120 — seconds to wait for mining (0 = fire and forget)
180
182
  )
181
183
  ```
182
184
 
183
185
  - `executor.address` — signer address
184
186
  - `executor.balance` — signer ETH balance in wei
185
- - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
187
+ - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash hex string
188
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
189
+ - `max_fee_gwei` / `max_priority_fee_gwei` — accept floats (e.g. `0.1`)
190
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
191
+ - `wait=120` (default) — wait up to N seconds for the tx to be mined; `0` for fire and forget
186
192
 
187
193
  ---
188
194
 
@@ -163,15 +163,21 @@ 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
170
+ wait=120, # default: 120 — seconds to wait for mining (0 = fire and forget)
169
171
  )
170
172
  ```
171
173
 
172
174
  - `executor.address` — signer address
173
175
  - `executor.balance` — signer ETH balance in wei
174
- - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
176
+ - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash hex string
177
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
178
+ - `max_fee_gwei` / `max_priority_fee_gwei` — accept floats (e.g. `0.1`)
179
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
180
+ - `wait=120` (default) — wait up to N seconds for the tx to be mined; `0` for fire and forget
175
181
 
176
182
  ---
177
183
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tinybot-eth"
3
- version = "0.3.0"
3
+ version = "0.5.0"
4
4
  description = "Minimal Python framework for building crypto bots"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -19,15 +19,19 @@ class Executor:
19
19
  def execute(
20
20
  self,
21
21
  call,
22
- gas_limit: int = 500_000,
23
- max_fee_gwei: int = 100,
24
- max_priority_fee_gwei: int = 3,
22
+ gas_limit: int = 0,
23
+ max_fee_gwei: float = 100,
24
+ max_priority_fee_gwei: float = 0,
25
25
  value: int = 0,
26
26
  simulate: bool = True,
27
+ wait: int = 120,
27
28
  ) -> str:
28
29
  if simulate:
29
30
  call.call({"from": self._account.address, "value": value})
30
31
 
32
+ if gas_limit == 0:
33
+ gas_limit = int(call.estimate_gas({"from": self._account.address, "value": value}) * 1.5)
34
+
31
35
  tx = call.build_transaction(
32
36
  {
33
37
  "from": self._account.address,
@@ -40,4 +44,6 @@ class Executor:
40
44
  )
41
45
  signed = self._w3.eth.account.sign_transaction(tx, self._account.key)
42
46
  tx_hash = self._w3.eth.send_raw_transaction(signed.raw_transaction)
47
+ if wait > 0:
48
+ self._w3.eth.wait_for_transaction_receipt(tx_hash, timeout=wait)
43
49
  return tx_hash.hex()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tinybot-eth
3
- Version: 0.3.0
3
+ Version: 0.5.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,21 @@ 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
181
+ wait=120, # default: 120 — seconds to wait for mining (0 = fire and forget)
180
182
  )
181
183
  ```
182
184
 
183
185
  - `executor.address` — signer address
184
186
  - `executor.balance` — signer ETH balance in wei
185
- - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash immediately (fire and forget)
187
+ - `executor.execute(call, ...)` — sign and broadcast a transaction, returns tx hash hex string
188
+ - `gas_limit=0` (default) — auto-estimates gas with 1.5x buffer; pass a value to override
189
+ - `max_fee_gwei` / `max_priority_fee_gwei` — accept floats (e.g. `0.1`)
190
+ - `simulate=True` (default) — runs `call.call()` first; reverts raise before the tx is sent
191
+ - `wait=120` (default) — wait up to N seconds for the tx to be mined; `0` for fire and forget
186
192
 
187
193
  ---
188
194
 
File without changes
File without changes
File without changes