Deployer#

class starknet_py.net.udc_deployer.deployer.Deployer#

Deployer used to deploy contracts through Universal Deployer Contract (UDC)

__init__(*, deployer_address: int | str = '0x041a78e741e5aF2fEc34B695679bC6891742439f7AFB8484Ecd7766661aD02BF', account_address: int | str | None = None)#
Parameters:
  • deployer_address – Address of the UDC. Is set to the address of the default UDC (same address on real nets and devnet) by default. Must be set when using custom network other than devnet.

  • account_address – Should be equal to the address of the account which will send the transaction. If passed, it will be used to modify the salt, otherwise, salt will not be affected.

Example

deployer = Deployer()
# or
deployer = Deployer(deployer_address=0x123)
# or
deployer = Deployer(deployer_address=0x123, account_address=0x321)
create_contract_deployment(class_hash: int | str, *, salt: int | None = None, abi: List | None = None, cairo_version: int = 0, calldata: List | dict | None = None) ContractDeployment#

Creates ContractDeployment with a call to the UDC contract.

Parameters:
  • class_hash – The class_hash of the contract to be deployed.

  • salt – The salt for a contract to be deployed. Random value is selected if it is not provided.

  • abi – ABI of the contract to be deployed.

  • cairo_version – Version of the Cairo [0 or 1] in which contract to be deployed is written. Used when abi is provided.

  • calldata – Constructor args of the contract to be deployed.

Returns:

NamedTuple with call and address of the contract to be deployed.

create_contract_deployment_raw(class_hash: int | str, *, salt: int | None = None, raw_calldata: List[int] | None = None) ContractDeployment#

Creates ContractDeployment with a call to the UDC contract with plain Cairo calldata.

Parameters:
  • class_hash – The class_hash of the contract to be deployed.

  • salt – The salt for a contract to be deployed. Random value is selected if it is not provided.

  • raw_calldata – Plain Cairo constructor args of the contract to be deployed.

Returns:

NamedTuple with call and address of the contract to be deployed.

Example


class starknet_py.net.udc_deployer.deployer.ContractDeployment#

NamedTuple containing call that can be executed to deploy a contract and an address of the contract that will be deployed.

address: int#

An address of the contract after deployment.

call: Call#

A call that can be executed to deploy a contract on Starknet.