Skip to content

Commit

Permalink
Fixes for underlying eth-account release (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
slundqui authored May 20, 2024
1 parent 854e939 commit 6f7dd81
Show file tree
Hide file tree
Showing 17 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ dependencies = [
"dill",
"docker",
"eth-typing==4.1.0",
"eth-account",
"fixedpointmath",
"flask",
"flask-expects-json",
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/core/base/make_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ def make_private_key(extra_entropy: str = "SOME STRING") -> str:
"""
extra_key_bytes = text_if_str(to_bytes, extra_entropy)
key_bytes = keccak(os.urandom(32) + extra_key_bytes)
key = Account()._parsePrivateKey(key_bytes) # pylint: disable=protected-access
key = Account()._parse_private_key(key_bytes) # pylint: disable=protected-access
return str(key)
8 changes: 4 additions & 4 deletions src/agent0/ethpy/base/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ async def _async_send_transaction_and_wait_for_receipt(
a TypedDict; success can be checked via tx_receipt["status"]
"""
signed_txn = signer.sign_transaction(unsent_txn)
tx_hash = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
tx_receipt = await async_wait_for_transaction_receipt(web3, tx_hash, timeout=timeout)

# Error checking when transaction doesn't throw an error, but instead
Expand Down Expand Up @@ -691,7 +691,7 @@ def send_transaction_and_wait_for_receipt(
a TypedDict; success can be checked via tx_receipt["status"]
"""
signed_txn = signer.sign_transaction(unsent_txn)
tx_hash = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
tx_receipt = wait_for_transaction_receipt(web3, tx_hash, timeout=timeout)

# Error checking when transaction doesn't throw an error, but instead
Expand Down Expand Up @@ -927,7 +927,7 @@ async def async_eth_transfer(
unsent_txn["maxFeePerGas"] = Wei(max_fee_per_gas)
unsent_txn["maxPriorityFeePerGas"] = Wei(max_priority_fee)
signed_txn = signer.sign_transaction(unsent_txn)
tx_hash = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
return await async_wait_for_transaction_receipt(web3, tx_hash)


Expand Down Expand Up @@ -991,7 +991,7 @@ def eth_transfer(
unsent_txn["maxPriorityFeePerGas"] = Wei(max_priority_fee)
signed_txn = signer.sign_transaction(unsent_txn)

tx_hash = web3.eth.send_raw_transaction(signed_txn.rawTransaction)
tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
return web3.eth.wait_for_transaction_receipt(tx_hash)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_set_variable_rate(self, hyperdrive_read_write_interface_fixture: Hyperd
# TODO: Setup a fixture to create a funded local account
extra_key_bytes = text_if_str(to_bytes, "extra_entropy")
key_bytes = keccak(os.urandom(32) + extra_key_bytes)
private_key = Account()._parsePrivateKey(key_bytes) # pylint: disable=protected-access
private_key = Account()._parse_private_key(key_bytes) # pylint: disable=protected-access
sender: LocalAccount = Account().from_key(private_key)
set_anvil_account_balance(hyperdrive_read_write_interface_fixture.web3, sender.address, 10**19)
hyperdrive_read_write_interface_fixture.set_variable_rate(sender, new_rate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/ERC20MintableContract.py
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress, constructorAr
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2404,7 +2404,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress, constructorAr
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/HyperdriveFactoryContract.py
Original file line number Diff line number Diff line change
Expand Up @@ -7042,7 +7042,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress, constructorAr
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/HyperdriveRegistryContract.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress, constructorAr
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/IHyperdriveContract.py
Original file line number Diff line number Diff line change
Expand Up @@ -6790,7 +6790,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/LPMathContract.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress) -> Self:
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down
2 changes: 1 addition & 1 deletion src/agent0/hypertypes/types/MockERC4626Contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -3542,7 +3542,7 @@ def deploy(cls, w3: Web3, account: LocalAccount | ChecksumAddress, constructorAr
signed_tx = account.sign_transaction(deployment_tx)

# Send the signed transaction and wait for receipt
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)

deployed_contract = deployer(address=tx_receipt.contractAddress) # type: ignore
Expand Down

0 comments on commit 6f7dd81

Please sign in to comment.