88from starknet_py .common import create_casm_class , create_sierra_compiled_contract
99from starknet_py .contract import Contract
1010from starknet_py .hash .casm_class_hash import compute_casm_class_hash
11+ from starknet_py .hash .hash_method import HashMethod
1112from starknet_py .net .account .base_account import BaseAccount
1213from starknet_py .net .models import DeclareV3
1314from starknet_py .net .udc_deployer .deployer import Deployer
1819async def declare_contract (
1920 account : BaseAccount , compiled_contract : str , compiled_contract_casm : str
2021) -> Tuple [int , int ]:
21- casm_class_hash = compute_casm_class_hash (create_casm_class (compiled_contract_casm ))
22+ casm_class_hash = compute_casm_class_hash (
23+ # TODO(#1659): Use blake
24+ create_casm_class (compiled_contract_casm ),
25+ HashMethod .POSEIDON ,
26+ )
2227
2328 declare_tx = await account .sign_declare_v3 (
2429 compiled_contract = compiled_contract ,
@@ -66,7 +71,11 @@ def constructor_with_arguments_abi() -> List:
6671@pytest_asyncio .fixture (scope = "package" )
6772async def declare_v3_hello_starknet (account : BaseAccount ) -> DeclareV3 :
6873 contract = load_contract ("HelloStarknet" )
69- casm_class_hash = compute_casm_class_hash (create_casm_class (contract ["casm" ]))
74+ casm_class_hash = compute_casm_class_hash (
75+ # TODO(#1659): Use blake
76+ create_casm_class (contract ["casm" ]),
77+ HashMethod .POSEIDON ,
78+ )
7079
7180 declare_tx = await account .sign_declare_v3 (
7281 contract ["sierra" ], casm_class_hash , resource_bounds = MAX_RESOURCE_BOUNDS
@@ -232,7 +241,11 @@ def map_compiled_contract_and_class_hash() -> Tuple[str, int]:
232241
233242 return (
234243 contract ["sierra" ],
235- compute_casm_class_hash (create_casm_class (contract ["casm" ])),
244+ compute_casm_class_hash (
245+ # TODO(#1659): Use blake
246+ create_casm_class (contract ["casm" ]),
247+ HashMethod .POSEIDON ,
248+ ),
236249 )
237250
238251
@@ -242,7 +255,11 @@ def map_compiled_contract_and_class_hash_copy_1() -> Tuple[str, int]:
242255
243256 return (
244257 contract ["sierra" ],
245- compute_casm_class_hash (create_casm_class (contract ["casm" ])),
258+ compute_casm_class_hash (
259+ # TODO(#1659): Use blake
260+ create_casm_class (contract ["casm" ]),
261+ HashMethod .POSEIDON ,
262+ ),
246263 )
247264
248265
@@ -252,7 +269,11 @@ def map_compiled_contract_and_class_hash_copy_2() -> Tuple[str, int]:
252269
253270 return (
254271 contract ["sierra" ],
255- compute_casm_class_hash (create_casm_class (contract ["casm" ])),
272+ compute_casm_class_hash (
273+ # TODO(#1659): Use blake
274+ create_casm_class (contract ["casm" ]),
275+ HashMethod .POSEIDON ,
276+ ),
256277 )
257278
258279
@@ -304,7 +325,11 @@ def sierra_minimal_compiled_contract_and_class_hash() -> Tuple[str, int]:
304325
305326 return (
306327 contract ["sierra" ],
307- compute_casm_class_hash (create_casm_class (contract ["casm" ])),
328+ compute_casm_class_hash (
329+ # TODO(#1659): Use blake
330+ create_casm_class (contract ["casm" ]),
331+ HashMethod .POSEIDON ,
332+ ),
308333 )
309334
310335
@@ -317,7 +342,11 @@ def abi_types_compiled_contract_and_class_hash() -> Tuple[str, int]:
317342
318343 return (
319344 contract ["sierra" ],
320- compute_casm_class_hash (create_casm_class (contract ["casm" ])),
345+ compute_casm_class_hash (
346+ # TODO(#1659): Use blake
347+ create_casm_class (contract ["casm" ]),
348+ HashMethod .POSEIDON ,
349+ ),
321350 )
322351
323352
@@ -349,7 +378,8 @@ async def account_declare_class_hash(
349378 """
350379
351380 casm_class = create_casm_class (compiled_account_contract_casm )
352- casm_class_hash = compute_casm_class_hash (casm_class )
381+ # TODO(#1659): Use blake
382+ casm_class_hash = compute_casm_class_hash (casm_class , HashMethod .POSEIDON )
353383 declare_v3_transaction = await account .sign_declare_v3 (
354384 compiled_contract = compiled_account_contract ,
355385 compiled_class_hash = casm_class_hash ,
@@ -365,7 +395,9 @@ async def account_with_validate_deploy_class_hash(
365395 pre_deployed_account_with_validate_deploy : BaseAccount ,
366396) -> int :
367397 contract = load_contract ("Account" )
368- casm_class_hash = compute_casm_class_hash (create_casm_class (contract ["casm" ]))
398+ casm_class_hash = compute_casm_class_hash (
399+ create_casm_class (contract ["casm" ]), HashMethod .POSEIDON
400+ )
369401
370402 return await declare_account (
371403 pre_deployed_account_with_validate_deploy , contract ["sierra" ], casm_class_hash
0 commit comments