olas-operate-middleware 0.13.2__py3-none-any.whl → 0.13.4__py3-none-any.whl
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.
- {olas_operate_middleware-0.13.2.dist-info → olas_operate_middleware-0.13.4.dist-info}/METADATA +8 -27
- {olas_operate_middleware-0.13.2.dist-info → olas_operate_middleware-0.13.4.dist-info}/RECORD +40 -40
- operate/bridge/providers/provider.py +23 -31
- operate/cli.py +4 -17
- operate/constants.py +1 -0
- operate/data/contracts/dual_staking_token/contract.py +3 -3
- operate/data/contracts/dual_staking_token/contract.yaml +2 -2
- operate/data/contracts/foreign_omnibridge/contract.yaml +1 -1
- operate/data/contracts/home_omnibridge/contract.py +2 -2
- operate/data/contracts/home_omnibridge/contract.yaml +2 -2
- operate/data/contracts/l1_standard_bridge/contract.yaml +1 -1
- operate/data/contracts/l2_standard_bridge/contract.py +4 -4
- operate/data/contracts/l2_standard_bridge/contract.yaml +2 -2
- operate/data/contracts/mech_activity/contract.yaml +1 -1
- operate/data/contracts/optimism_mintable_erc20/contract.yaml +1 -1
- operate/data/contracts/recovery_module/contract.yaml +1 -1
- operate/data/contracts/requester_activity_checker/contract.yaml +1 -1
- operate/data/contracts/staking_token/contract.py +3 -3
- operate/data/contracts/staking_token/contract.yaml +2 -2
- operate/data/contracts/uniswap_v2_erc20/contract.yaml +3 -3
- operate/data/contracts/uniswap_v2_erc20/tests/test_contract.py +5 -5
- operate/keys.py +5 -3
- operate/ledger/__init__.py +1 -7
- operate/ledger/profiles.py +0 -1
- operate/operate_http/__init__.py +0 -2
- operate/operate_types.py +3 -93
- operate/quickstart/run_service.py +63 -6
- operate/quickstart/utils.py +8 -4
- operate/resource.py +2 -2
- operate/services/agent_runner.py +3 -3
- operate/services/manage.py +14 -17
- operate/services/protocol.py +124 -169
- operate/services/utils/mech.py +3 -3
- operate/services/utils/tendermint.py +5 -3
- operate/utils/gnosis.py +76 -101
- operate/wallet/master.py +42 -47
- operate/wallet/wallet_recovery_manager.py +8 -6
- {olas_operate_middleware-0.13.2.dist-info → olas_operate_middleware-0.13.4.dist-info}/WHEEL +0 -0
- {olas_operate_middleware-0.13.2.dist-info → olas_operate_middleware-0.13.4.dist-info}/entry_points.txt +0 -0
- {olas_operate_middleware-0.13.2.dist-info → olas_operate_middleware-0.13.4.dist-info}/licenses/LICENSE +0 -0
operate/utils/gnosis.py
CHANGED
|
@@ -170,9 +170,7 @@ def create_safe(
|
|
|
170
170
|
"""Create gnosis safe."""
|
|
171
171
|
salt_nonce = salt_nonce or _get_nonce()
|
|
172
172
|
|
|
173
|
-
def _build(
|
|
174
|
-
*args: t.Any, **kwargs: t.Any
|
|
175
|
-
) -> t.Dict:
|
|
173
|
+
def _build() -> t.Dict:
|
|
176
174
|
tx = registry_contracts.gnosis_safe.get_deploy_transaction(
|
|
177
175
|
ledger_api=ledger_api,
|
|
178
176
|
deployer_address=crypto.address,
|
|
@@ -183,30 +181,26 @@ def create_safe(
|
|
|
183
181
|
del tx["contract_address"]
|
|
184
182
|
return tx
|
|
185
183
|
|
|
186
|
-
tx_settler =
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
)
|
|
199
|
-
receipt = tx_settler.transact(
|
|
200
|
-
method=lambda: {},
|
|
201
|
-
contract="",
|
|
202
|
-
kwargs={},
|
|
184
|
+
tx_settler = (
|
|
185
|
+
TxSettler(
|
|
186
|
+
ledger_api=ledger_api,
|
|
187
|
+
crypto=crypto,
|
|
188
|
+
chain_type=ChainProfile.CUSTOM,
|
|
189
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
190
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
191
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
192
|
+
tx_builder=_build,
|
|
193
|
+
)
|
|
194
|
+
.transact()
|
|
195
|
+
.settle()
|
|
203
196
|
)
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
197
|
+
(event,) = tx_settler.get_events(
|
|
198
|
+
contract=registry_contracts.gnosis_safe_proxy_factory.get_instance(
|
|
199
|
+
ledger_api=ledger_api,
|
|
200
|
+
contract_address="0xa6b71e26c5e0845f74c812102ca7114b6a896ab2",
|
|
201
|
+
),
|
|
202
|
+
event_name="ProxyCreation",
|
|
208
203
|
)
|
|
209
|
-
(event,) = instance.events.ProxyCreation().process_receipt(receipt)
|
|
210
204
|
safe_address = event["args"]["proxy"]
|
|
211
205
|
|
|
212
206
|
if backup_owner is not None:
|
|
@@ -231,7 +225,7 @@ def create_safe(
|
|
|
231
225
|
)
|
|
232
226
|
time.sleep(next_delay)
|
|
233
227
|
|
|
234
|
-
return safe_address, salt_nonce, tx_hash
|
|
228
|
+
return safe_address, salt_nonce, tx_settler.tx_hash
|
|
235
229
|
|
|
236
230
|
|
|
237
231
|
def get_owners(ledger_api: LedgerApi, safe: str) -> t.List[str]:
|
|
@@ -248,16 +242,14 @@ def send_safe_txs(
|
|
|
248
242
|
ledger_api: LedgerApi,
|
|
249
243
|
crypto: Crypto,
|
|
250
244
|
to: t.Optional[str] = None,
|
|
251
|
-
) ->
|
|
245
|
+
) -> str:
|
|
252
246
|
"""Send internal safe transaction."""
|
|
253
247
|
owner = ledger_api.api.to_checksum_address(
|
|
254
248
|
crypto.address,
|
|
255
249
|
)
|
|
256
250
|
to_address = to or safe
|
|
257
251
|
|
|
258
|
-
def _build_tx(
|
|
259
|
-
*args: t.Any, **kwargs: t.Any
|
|
260
|
-
) -> t.Optional[str]:
|
|
252
|
+
def _build_tx() -> t.Optional[str]:
|
|
261
253
|
safe_tx_hash = registry_contracts.gnosis_safe.get_raw_safe_transaction_hash(
|
|
262
254
|
ledger_api=ledger_api,
|
|
263
255
|
contract_address=safe,
|
|
@@ -290,25 +282,22 @@ def send_safe_txs(
|
|
|
290
282
|
nonce=ledger_api.api.eth.get_transaction_count(owner),
|
|
291
283
|
)
|
|
292
284
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
dry_run=False,
|
|
285
|
+
return (
|
|
286
|
+
TxSettler(
|
|
287
|
+
ledger_api=ledger_api,
|
|
288
|
+
crypto=crypto,
|
|
289
|
+
chain_type=Chain.from_id(
|
|
290
|
+
ledger_api._chain_id # pylint: disable=protected-access
|
|
291
|
+
),
|
|
292
|
+
tx_builder=_build_tx,
|
|
293
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
294
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
295
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
296
|
+
)
|
|
297
|
+
.transact()
|
|
298
|
+
.settle()
|
|
299
|
+
.tx_hash
|
|
309
300
|
)
|
|
310
|
-
tx_hash = tx_receipt.get("transactionHash", "").hex()
|
|
311
|
-
return tx_hash
|
|
312
301
|
|
|
313
302
|
|
|
314
303
|
def add_owner(
|
|
@@ -322,8 +311,8 @@ def add_owner(
|
|
|
322
311
|
ledger_api=ledger_api,
|
|
323
312
|
contract_address=safe,
|
|
324
313
|
)
|
|
325
|
-
txd = instance.
|
|
326
|
-
|
|
314
|
+
txd = instance.encode_abi(
|
|
315
|
+
abi_element_identifier="addOwnerWithThreshold",
|
|
327
316
|
args=[
|
|
328
317
|
owner,
|
|
329
318
|
1,
|
|
@@ -368,8 +357,8 @@ def swap_owner(
|
|
|
368
357
|
ledger_api=ledger_api,
|
|
369
358
|
contract_address=safe,
|
|
370
359
|
)
|
|
371
|
-
txd = instance.
|
|
372
|
-
|
|
360
|
+
txd = instance.encode_abi(
|
|
361
|
+
abi_element_identifier="swapOwner",
|
|
373
362
|
args=[
|
|
374
363
|
prev_owner,
|
|
375
364
|
old_owner,
|
|
@@ -398,8 +387,8 @@ def remove_owner(
|
|
|
398
387
|
ledger_api=ledger_api,
|
|
399
388
|
contract_address=safe,
|
|
400
389
|
)
|
|
401
|
-
txd = instance.
|
|
402
|
-
|
|
390
|
+
txd = instance.encode_abi(
|
|
391
|
+
abi_element_identifier="removeOwner",
|
|
403
392
|
args=[
|
|
404
393
|
prev_owner,
|
|
405
394
|
owner,
|
|
@@ -420,16 +409,14 @@ def transfer(
|
|
|
420
409
|
safe: str,
|
|
421
410
|
to: str,
|
|
422
411
|
amount: t.Union[float, int],
|
|
423
|
-
) ->
|
|
412
|
+
) -> str:
|
|
424
413
|
"""Transfer assets from safe to given address."""
|
|
425
414
|
amount = int(amount)
|
|
426
415
|
owner = ledger_api.api.to_checksum_address(
|
|
427
416
|
crypto.address,
|
|
428
417
|
)
|
|
429
418
|
|
|
430
|
-
def _build_tx(
|
|
431
|
-
*args: t.Any, **kwargs: t.Any
|
|
432
|
-
) -> t.Optional[str]:
|
|
419
|
+
def _build_tx() -> t.Optional[str]:
|
|
433
420
|
safe_tx_hash = registry_contracts.gnosis_safe.get_raw_safe_transaction_hash(
|
|
434
421
|
ledger_api=ledger_api,
|
|
435
422
|
contract_address=safe,
|
|
@@ -462,25 +449,22 @@ def transfer(
|
|
|
462
449
|
nonce=ledger_api.api.eth.get_transaction_count(owner),
|
|
463
450
|
)
|
|
464
451
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
dry_run=False,
|
|
452
|
+
return (
|
|
453
|
+
TxSettler(
|
|
454
|
+
ledger_api=ledger_api,
|
|
455
|
+
crypto=crypto,
|
|
456
|
+
chain_type=Chain.from_id(
|
|
457
|
+
ledger_api._chain_id # pylint: disable=protected-access
|
|
458
|
+
),
|
|
459
|
+
tx_builder=_build_tx,
|
|
460
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
461
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
462
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
463
|
+
)
|
|
464
|
+
.transact()
|
|
465
|
+
.settle()
|
|
466
|
+
.tx_hash
|
|
481
467
|
)
|
|
482
|
-
tx_hash = tx_receipt.get("transactionHash", "").hex()
|
|
483
|
-
return tx_hash
|
|
484
468
|
|
|
485
469
|
|
|
486
470
|
def transfer_erc20_from_safe(
|
|
@@ -497,8 +481,8 @@ def transfer_erc20_from_safe(
|
|
|
497
481
|
ledger_api=ledger_api,
|
|
498
482
|
contract_address=token,
|
|
499
483
|
)
|
|
500
|
-
txd = instance.
|
|
501
|
-
|
|
484
|
+
txd = instance.encode_abi(
|
|
485
|
+
abi_element_identifier="transfer",
|
|
502
486
|
args=[
|
|
503
487
|
to,
|
|
504
488
|
amount,
|
|
@@ -547,18 +531,8 @@ def drain_eoa(
|
|
|
547
531
|
chain_id: int,
|
|
548
532
|
) -> t.Optional[str]:
|
|
549
533
|
"""Drain all the native tokens from the crypto wallet."""
|
|
550
|
-
tx_helper = TxSettler(
|
|
551
|
-
ledger_api=ledger_api,
|
|
552
|
-
crypto=crypto,
|
|
553
|
-
chain_type=ChainProfile.CUSTOM,
|
|
554
|
-
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
555
|
-
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
556
|
-
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
557
|
-
)
|
|
558
534
|
|
|
559
|
-
def _build_tx(
|
|
560
|
-
*args: t.Any, **kwargs: t.Any
|
|
561
|
-
) -> t.Dict:
|
|
535
|
+
def _build_tx() -> t.Dict:
|
|
562
536
|
"""Build transaction"""
|
|
563
537
|
chain_fee = estimate_transfer_tx_fee(
|
|
564
538
|
chain=Chain.from_id(chain_id),
|
|
@@ -595,13 +569,20 @@ def drain_eoa(
|
|
|
595
569
|
|
|
596
570
|
return tx
|
|
597
571
|
|
|
598
|
-
setattr(tx_helper, "build", _build_tx) # noqa: B010
|
|
599
572
|
try:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
573
|
+
return (
|
|
574
|
+
TxSettler(
|
|
575
|
+
ledger_api=ledger_api,
|
|
576
|
+
crypto=crypto,
|
|
577
|
+
chain_type=ChainProfile.CUSTOM,
|
|
578
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
579
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
580
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
581
|
+
tx_builder=_build_tx,
|
|
582
|
+
)
|
|
583
|
+
.transact()
|
|
584
|
+
.settle()
|
|
585
|
+
.tx_hash
|
|
605
586
|
)
|
|
606
587
|
except ChainInteractionError as e:
|
|
607
588
|
if "No balance to drain from wallet" in str(e):
|
|
@@ -610,12 +591,6 @@ def drain_eoa(
|
|
|
610
591
|
|
|
611
592
|
raise e
|
|
612
593
|
|
|
613
|
-
tx_hash = tx_receipt.get("transactionHash", None)
|
|
614
|
-
if tx_hash is not None:
|
|
615
|
-
return tx_hash.hex()
|
|
616
|
-
|
|
617
|
-
return None
|
|
618
|
-
|
|
619
594
|
|
|
620
595
|
def get_asset_balance(
|
|
621
596
|
ledger_api: LedgerApi,
|
operate/wallet/master.py
CHANGED
|
@@ -75,14 +75,12 @@ class MasterWallet(LocalResource):
|
|
|
75
75
|
|
|
76
76
|
path: Path
|
|
77
77
|
address: str
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
safe_chains: t.List[Chain] = field(default_factory=list)
|
|
78
|
+
safes: t.Dict[Chain, str]
|
|
79
|
+
safe_chains: t.List[Chain]
|
|
81
80
|
ledger_type: LedgerType
|
|
82
81
|
safe_nonce: t.Optional[int] = None
|
|
83
82
|
|
|
84
83
|
_key: str
|
|
85
|
-
_mnemonic: str
|
|
86
84
|
_crypto: t.Optional[Crypto] = None
|
|
87
85
|
_password: t.Optional[str] = None
|
|
88
86
|
_crypto_cls: t.Type[Crypto]
|
|
@@ -111,10 +109,15 @@ class MasterWallet(LocalResource):
|
|
|
111
109
|
"""Key path."""
|
|
112
110
|
return self.path / self._key
|
|
113
111
|
|
|
112
|
+
@classmethod
|
|
113
|
+
def mnemonic_filename(cls) -> str:
|
|
114
|
+
"""Return deterministic mnemonic filename per ledger type."""
|
|
115
|
+
return f"{cls.ledger_type.value.lower()}.mnemonic.json"
|
|
116
|
+
|
|
114
117
|
@property
|
|
115
118
|
def mnemonic_path(self) -> Path:
|
|
116
119
|
"""Mnemonic path."""
|
|
117
|
-
return self.path / self.
|
|
120
|
+
return self.path / self.__class__.mnemonic_filename()
|
|
118
121
|
|
|
119
122
|
@staticmethod
|
|
120
123
|
def ledger_api(
|
|
@@ -250,7 +253,6 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
250
253
|
|
|
251
254
|
_file = ledger_type.config_file
|
|
252
255
|
_key = ledger_type.key_file
|
|
253
|
-
_mnemonic = ledger_type.mnemonic_file
|
|
254
256
|
_crypto_cls = EthereumCrypto
|
|
255
257
|
|
|
256
258
|
def _pre_transfer_checks(
|
|
@@ -284,7 +286,7 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
284
286
|
|
|
285
287
|
def _transfer_from_eoa(
|
|
286
288
|
self, to: str, amount: int, chain: Chain, rpc: t.Optional[str] = None
|
|
287
|
-
) ->
|
|
289
|
+
) -> str:
|
|
288
290
|
"""Transfer funds from EOA wallet."""
|
|
289
291
|
balance = self.get_balance(chain=chain, from_safe=False)
|
|
290
292
|
tx_fee = estimate_transfer_tx_fee(
|
|
@@ -306,18 +308,8 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
306
308
|
)
|
|
307
309
|
|
|
308
310
|
ledger_api = t.cast(EthereumApi, self.ledger_api(chain=chain, rpc=rpc))
|
|
309
|
-
tx_helper = TxSettler(
|
|
310
|
-
ledger_api=ledger_api,
|
|
311
|
-
crypto=self.crypto,
|
|
312
|
-
chain_type=ChainProfile.CUSTOM,
|
|
313
|
-
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
314
|
-
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
315
|
-
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
316
|
-
)
|
|
317
311
|
|
|
318
|
-
def _build_tx(
|
|
319
|
-
*args: t.Any, **kwargs: t.Any
|
|
320
|
-
) -> t.Dict:
|
|
312
|
+
def _build_tx() -> t.Dict:
|
|
321
313
|
"""Build transaction"""
|
|
322
314
|
max_priority_fee_per_gas = os.getenv("MAX_PRIORITY_FEE_PER_GAS", None)
|
|
323
315
|
max_fee_per_gas = os.getenv("MAX_FEE_PER_GAS", None)
|
|
@@ -339,10 +331,20 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
339
331
|
raise_on_try=True,
|
|
340
332
|
)
|
|
341
333
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
334
|
+
return (
|
|
335
|
+
TxSettler(
|
|
336
|
+
ledger_api=ledger_api,
|
|
337
|
+
crypto=self.crypto,
|
|
338
|
+
chain_type=ChainProfile.CUSTOM,
|
|
339
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
340
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
341
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
342
|
+
tx_builder=_build_tx,
|
|
343
|
+
)
|
|
344
|
+
.transact()
|
|
345
|
+
.settle()
|
|
346
|
+
.tx_hash
|
|
347
|
+
)
|
|
346
348
|
|
|
347
349
|
def _transfer_from_safe(
|
|
348
350
|
self, to: str, amount: int, chain: Chain, rpc: t.Optional[str] = None
|
|
@@ -389,7 +391,7 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
389
391
|
amount: int,
|
|
390
392
|
chain: Chain,
|
|
391
393
|
rpc: t.Optional[str] = None,
|
|
392
|
-
) ->
|
|
394
|
+
) -> str:
|
|
393
395
|
"""Transfer erc20 from EOA wallet."""
|
|
394
396
|
to = self._pre_transfer_checks(
|
|
395
397
|
to=to, amount=amount, chain=chain, from_safe=False, asset=token
|
|
@@ -397,18 +399,8 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
397
399
|
|
|
398
400
|
wallet_address = self.address
|
|
399
401
|
ledger_api = t.cast(EthereumApi, self.ledger_api(chain=chain, rpc=rpc))
|
|
400
|
-
tx_settler = TxSettler(
|
|
401
|
-
ledger_api=ledger_api,
|
|
402
|
-
crypto=self.crypto,
|
|
403
|
-
chain_type=ChainProfile.CUSTOM,
|
|
404
|
-
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
405
|
-
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
406
|
-
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
407
|
-
)
|
|
408
402
|
|
|
409
|
-
def _build_transfer_tx(
|
|
410
|
-
*args: t.Any, **kargs: t.Any
|
|
411
|
-
) -> t.Dict:
|
|
403
|
+
def _build_transfer_tx() -> t.Dict:
|
|
412
404
|
# TODO Backport to OpenAEA
|
|
413
405
|
instance = registry_contracts.erc20.get_instance(
|
|
414
406
|
ledger_api=ledger_api,
|
|
@@ -427,15 +419,20 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
427
419
|
update_tx_with_gas_estimate(tx, ledger_api)
|
|
428
420
|
return tx
|
|
429
421
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
422
|
+
return (
|
|
423
|
+
TxSettler(
|
|
424
|
+
ledger_api=ledger_api,
|
|
425
|
+
crypto=self.crypto,
|
|
426
|
+
chain_type=ChainProfile.CUSTOM,
|
|
427
|
+
timeout=ON_CHAIN_INTERACT_TIMEOUT,
|
|
428
|
+
retries=ON_CHAIN_INTERACT_RETRIES,
|
|
429
|
+
sleep=ON_CHAIN_INTERACT_SLEEP,
|
|
430
|
+
tx_builder=_build_transfer_tx,
|
|
431
|
+
)
|
|
432
|
+
.transact()
|
|
433
|
+
.settle()
|
|
434
|
+
.tx_hash
|
|
436
435
|
)
|
|
437
|
-
tx_hash = tx_receipt.get("transactionHash", "").hex()
|
|
438
|
-
return tx_hash
|
|
439
436
|
|
|
440
437
|
def transfer( # pylint: disable=too-many-arguments
|
|
441
438
|
self,
|
|
@@ -572,7 +569,7 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
572
569
|
# Backport support on aea
|
|
573
570
|
|
|
574
571
|
eoa_wallet_path = path / cls._key
|
|
575
|
-
eoa_mnemonic_path = path / cls.
|
|
572
|
+
eoa_mnemonic_path = path / cls.mnemonic_filename()
|
|
576
573
|
|
|
577
574
|
if eoa_wallet_path.exists():
|
|
578
575
|
raise FileExistsError(f"Wallet file already exists at {eoa_wallet_path}.")
|
|
@@ -611,12 +608,10 @@ class EthereumMasterWallet(MasterWallet):
|
|
|
611
608
|
|
|
612
609
|
def decrypt_mnemonic(self, password: str) -> t.Optional[t.List[str]]:
|
|
613
610
|
"""Retrieve the mnemonic"""
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
if not eoa_mnemonic_path.exists():
|
|
611
|
+
if not self.mnemonic_path.exists():
|
|
617
612
|
return None
|
|
618
613
|
|
|
619
|
-
encrypted_mnemonic = EncryptedData.load(
|
|
614
|
+
encrypted_mnemonic = EncryptedData.load(self.mnemonic_path)
|
|
620
615
|
mnemonic = encrypted_mnemonic.decrypt(password).decode("utf-8")
|
|
621
616
|
return mnemonic.split()
|
|
622
617
|
|
|
@@ -240,12 +240,14 @@ class WalletRecoveryManager:
|
|
|
240
240
|
safe: {
|
|
241
241
|
"owners": owners,
|
|
242
242
|
"backup_owners": backup_owners,
|
|
243
|
-
"owner_to_remove":
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"owner_to_add":
|
|
247
|
-
|
|
248
|
-
|
|
243
|
+
"owner_to_remove": (
|
|
244
|
+
wallet.address if wallet.address in owners else None
|
|
245
|
+
),
|
|
246
|
+
"owner_to_add": (
|
|
247
|
+
new_wallet.address
|
|
248
|
+
if new_wallet.address not in owners
|
|
249
|
+
else None
|
|
250
|
+
),
|
|
249
251
|
}
|
|
250
252
|
}
|
|
251
253
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|