From 06801e065fa58a143ad3b74d0766c5ef7c15265a Mon Sep 17 00:00:00 2001 From: Steve Albrechtsen Date: Tue, 15 Aug 2023 14:52:06 -0600 Subject: [PATCH 1/3] add calldata param --- .../_lambda/functions/eth_client_eip1559/lambda_function.py | 5 ++++- .../_lambda/functions/eth_client_eip1559/lambda_helper.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py index dbfc24f..c7108cc 100644 --- a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py +++ b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py @@ -58,6 +58,8 @@ def lambda_handler(event, context): amount = event.get('amount') nonce = event.get('nonce') + # get the call data + data = event.get('data') # optional params chainid = event.get('chainid') @@ -78,7 +80,8 @@ def lambda_handler(event, context): chainid=chainid, type=type, max_fee_per_gas=max_fee_per_gas, - max_priority_fee_per_gas=max_priority_fee_per_gas) + max_priority_fee_per_gas=max_priority_fee_per_gas, + data=data) # assemble Ethereum transaction and sign it offline raw_tx_signed_hash, raw_tx_signed_payload = assemble_tx(tx_params=tx_params, diff --git a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py index b528bf6..5bcc338 100644 --- a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py +++ b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py @@ -151,12 +151,12 @@ def get_recovery_id(msg_hash: bytes, r: int, s: int, eth_checksum_addr: str, cha def get_tx_params(dst_address: str, amount: int, nonce: int, - chainid: int, type: int, max_fee_per_gas: int, max_priority_fee_per_gas: int) -> dict: + chainid: int, type: int, max_fee_per_gas: int, max_priority_fee_per_gas: int, data: str) -> dict: transaction = { 'nonce': nonce, 'to': dst_address, 'value': w3.toWei(amount, 'ether'), - 'data': '0x00', + 'data': data, 'gas': 160000, 'maxFeePerGas': max_fee_per_gas, 'maxPriorityFeePerGas': max_priority_fee_per_gas, From 6c6f7bf653a1c12712ce6f3cf256ff3d13ada28c Mon Sep 17 00:00:00 2001 From: albydarned Date: Thu, 20 Mar 2025 11:29:09 -0600 Subject: [PATCH 2/3] Update lambda_function.py --- .../_lambda/functions/eth_client_eip1559/lambda_function.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py index c7108cc..dfc0b4e 100644 --- a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py +++ b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_function.py @@ -64,6 +64,7 @@ def lambda_handler(event, context): # optional params chainid = event.get('chainid') type = event.get('type') + gas_limit = event.get('gas_limit') max_fee_per_gas = event.get('max_fee_per_gas') max_priority_fee_per_gas = event.get('max_priority_fee_per_gas') @@ -79,6 +80,7 @@ def lambda_handler(event, context): nonce=nonce, chainid=chainid, type=type, + gas_limit=gas_limit, max_fee_per_gas=max_fee_per_gas, max_priority_fee_per_gas=max_priority_fee_per_gas, data=data) From 2f31e5cbb7d4aeeed547e7824b538a029d8fc6b1 Mon Sep 17 00:00:00 2001 From: albydarned Date: Thu, 20 Mar 2025 11:29:41 -0600 Subject: [PATCH 3/3] Update lambda_helper.py --- .../_lambda/functions/eth_client_eip1559/lambda_helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py index 5bcc338..4e25117 100644 --- a/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py +++ b/aws_kms_lambda_ethereum/_lambda/functions/eth_client_eip1559/lambda_helper.py @@ -151,13 +151,13 @@ def get_recovery_id(msg_hash: bytes, r: int, s: int, eth_checksum_addr: str, cha def get_tx_params(dst_address: str, amount: int, nonce: int, - chainid: int, type: int, max_fee_per_gas: int, max_priority_fee_per_gas: int, data: str) -> dict: + chainid: int, type: int, gas_limit: int, max_fee_per_gas: int, max_priority_fee_per_gas: int, data: str) -> dict: transaction = { 'nonce': nonce, 'to': dst_address, 'value': w3.toWei(amount, 'ether'), 'data': data, - 'gas': 160000, + 'gas': gas_limit, 'maxFeePerGas': max_fee_per_gas, 'maxPriorityFeePerGas': max_priority_fee_per_gas, 'type': type,