Contract Module
Contract module handles interactions related to smart contracts, such as fetching contract ABI and bytecode.
5.1 Get Contract Code
Fetches the bytecode of a smart contract.
Function Name
get_contract_codeArguments
contract_address (str): The address of the smart contract.Example Code
from crypto_com_developer_platform_client import Contract code = Contract.get_contract_code('example-contract') print(code)
Returns
The bytecode of the smart contract.Errors
ValueError: If the Contract class is not initialized with a Client instance.Example Return
{'status': 'Success', 'data': {'code': 'example-code'}}
Function Name
getContractCodeArguments
{string} {string} contractAddress: The smart contract address.Example Code
import { Contract } from '@crypto.com/developer-platform-client'; try { const bytecode = await Contract.getContractCode('example-address'); console.log(bytecode); } catch(err) { console.log(err); }
Returns
{Promise<ApiResponse<ContractCode>>}: A promise that resolves to the bytecode of the contract.Errors
{Error} If the bytecode retrieval fails.Example Return
{ status: 'Success', data: { code: 'example-byte-code' } }
Last updated
Was this helpful?