API References v20
Smart Contracts & DEFI
/getLidoStakingApproveContractData
1 min
POST
/getLidoStakingApproveContractData
Prepares the contract call data required to interact with the Lido staking smart contract on
Ethereum-based networks. This function formats the parameters and destination address for the
submit function of the Lido contract, enabling users to stake ETH via Lido on the supported networks.
Supported Chain IDs:
- 1 → Ethereum Mainnet
- 17000 → Holesky (testnet)
- 11155111 → Sepolia (testnet)
- 560048 → Hoodi (testnet)
How to Stake with Lido using sendTransactionToEvmContractWithContractInfo
The staking flow consists of three steps:
- Prepare contract call data (this function)
- Estimate gas with
getGasLimitSuggestedForTransactionToEvmContractWithContractInfo - Send the transaction with
sendTransactionToEvmContractWithContractInfo
Inputs you need:
account_id(int): Internal account identifier that will source the ETH.amount(str): Amount of ETH to stake, in wei, as a string (e.g.,"1000000000000000000"for 1 ETH).gas_price(int or None): Gas price in wei. If your environment supports a separate base fee and priority fee, pass an appropriate value per your infrastructure’s requirements.
Step-by-step:
.. code-block:: python
# Step 1: Prepare Lido call data
lido = self.getLidoStakingApproveContractData()
function_name = lido["ContractData"]["FunctionName"] # "submit"
params = lido["ContractData"]["ParametersFieldsTypesAndValues"] # e.g., [["address", "<referral>"]]
contract_address = lido["ContractDestinationAddress"] # Lido contract per chain
# Required staking inputs
account_id = 123
amount_wei = "1000000000000000000" # 1 ETH in wei (string)
gas_price_wei = 15000000000 # 15 gwei, example
fee_wei = 1000000000 # 10 gwei
# Step 2: Estimate gas for the call
gas_limit = self.getGasLimitSuggestedForTransactionToEvmContractWithContractInfo(
account_id=account_id,
contract_address=contract_address,
amount=amount_wei,
gas_price=gas_price_wei, # Optional in signature; pass when available
function_name=function_name,
parameters_fields_types_and_values=params,
validate_transaction=True,
evm_coin_symbol="ETH",
specificFromAddress=None,
multiplier=None, # Optionally inflate gas limit via multiplier in your implementation
)
# Step 3: Send the staking transaction
tx = self.sendTransactionToEvmContractWithContractInfo(
account_id=account_id,
contract_address=contract_address,
amount=amount_wei,
gas_price=gas_price_wei,
gas_limit=gas_limit,
function_name=function_name,
parameters_fields_types_and_values=params,
validate_transaction=True,
description="Lido stake 1 ETH",
specificFromAddress=None,
max_priority_fee=fee_wei,
evm_coin_symbol="ETH",
)
# The transaction should contain your backend's transaction submission result/identifier
Notes & Best Practices:
amountmust be provided in wei (string). Convert from ETH to wei before calling.- Always estimate gas with the exact same function name, params, and amount you will send.
- If your stack uses EIP-1559, ensure
gas_price/max_priority_feeare provided according to your backend’s expectations. - If the current chain isn’t supported, this function raises an exception with the offending chain id.
Raises: - Exception: If there is no Lido staking contract address configured for the current chain ID.
Return: JSON object containing the function name and parameters for the approve operation.
-----------Request--------------
getLidoStakingApproveContractData()
----------------response ------------
{
Function Data:{
"ContractData": {
"FunctionName": "submit",
"ParametersFieldsTypesAndValues": [
["address", "0x474B38204d6f636b20526566657272616C000000"]
]
},
"ContractDestinationAddress": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84"
},
"Meta": {
"AccessToken": "6276...79fe",
"Destination": "0453...9d56",
"Source": "fc581...42f3",
"Time": "2025-02-10 13:05:23.729"
}
}
chain_idinteger<p>The chain ID on which to perform staking. If None, the chain ID will be deduced from the active Ethereum network. <strong>Supported Chain IDs:</strong> - 1 → Ethereum Mainnet - 17000 → Holesky (testnet) - 11155111 → Sepolia (testnet) - 560048 → Hoodi (testnet)</p>
acceptstringGenerated from available response content types
200success
curl --request POST \
--url '/getLidoStakingApproveContractData?chain_id=None' \
--header 'accept: application/json'