1818from pyk .prelude .collections import set_of
1919from pykwasm .kwasm_ast import KBytes , KInt , KString
2020
21- from kmultiversx .utils import flatten , kast_to_json_str , krun_config , load_wasm , read_mandos_runtime
21+ from kmultiversx .utils import (
22+ flatten ,
23+ kast_to_json_str ,
24+ krun_config ,
25+ load_wasm ,
26+ load_wasm_from_mxsc ,
27+ read_mandos_runtime ,
28+ )
2229
2330if TYPE_CHECKING :
2431 from pyk .kast .inner import KInner
@@ -445,7 +452,7 @@ def mandos_to_deploy_tx(tx: dict, filename: str, output_dir: str) -> KInner:
445452 value = mandos_int_to_kint (get_egld_value (tx ))
446453 arguments = mandos_arguments_to_klist (tx ['arguments' ])
447454 gas_limit = mandos_int_to_kint (tx ['gasLimit' ])
448- gas_price = mandos_int_to_kint (tx [ 'gasPrice' ] , default_when_empty = 0 )
455+ gas_price = mandos_int_to_kint (tx . get ( 'gasPrice' , '0' ) , default_when_empty = 0 )
449456
450457 code = get_contract_code (tx ['contractCode' ], filename )
451458 assert isinstance (code , str )
@@ -462,7 +469,7 @@ def mandos_to_call_tx(tx: dict) -> KInner:
462469 function = KWasmString (tx ['function' ])
463470 arguments = mandos_arguments_to_klist (tx .get ('arguments' , []))
464471 gas_limit = mandos_int_to_kint (tx ['gasLimit' ])
465- gas_price = mandos_int_to_kint (tx [ 'gasPrice' ] , default_when_empty = 0 )
472+ gas_price = mandos_int_to_kint (tx . get ( 'gasPrice' , '0' ) , default_when_empty = 0 )
466473
467474 return KApply ('callTx' , [sender , to , value , esdt_value , function , arguments , gas_limit , gas_price ])
468475
@@ -574,6 +581,9 @@ def file_to_module_decl(filename: str, output_dir: str) -> KInner:
574581 return load_wasm (filename )
575582 if filename [- 5 :] == '.wast' or filename [- 4 :] == '.wat' :
576583 return wat_file_to_module_decl (filename , output_dir )
584+ if filename [- 10 :] == '.mxsc.json' :
585+ return load_wasm_from_mxsc (filename )
586+
577587 raise ValueError (f'Filetype not yet supported: { filename } ' )
578588
579589
@@ -602,7 +612,7 @@ def get_external_file_path(test_file: str, rel_path_to_new_file: str) -> str:
602612
603613
604614def get_contract_code (code : str , filename : str ) -> Optional [str ]:
605- if code [0 :5 ] == 'file:' :
615+ if code [0 :5 ] in ( 'file:' , 'mxsc:' ) :
606616 return get_external_file_path (filename , code [5 :])
607617 if code == '' :
608618 return None
0 commit comments