integration-testing/client/CasperClient/casper_client/casper_client.py
def args_from_json(s: str) -> bytes:
        """
        Convert a string with JSON representation of deploy args to binary (ABI).

        The JSON should be a list of dictionaries {'type': 'value'} that represent type and value of the args,
        for example:

             [{"u32":1024}, {"account":"00000000000000000000000000000000"}, {"u64":1234567890}]
        """
        args = json.loads(s)

        for arg in args:
            if len(arg) != 1:
                raise Exception(f'Wrong encoding of value in {arg}. Only one pair of type and value allowed.')

        def python_value(typ, value: str):
            if typ in ('u32', 'u64'):
                return int(value)
            elif typ == 'account':
                return bytearray.fromhex(value)
            raise ValueError(f"Unknown type {typ}, expected ('u32', 'u64', 'account')")

        def encode(typ: str, value: str) -> bytes:
            v = python_value(typ, value)
            return getattr(ABI, typ)(v)

        def only_one(arg):
            items = list(arg.items())
            if len(items) != 1:
                raise Exception("Only one pair {'type', 'value'} allowed.")
            return items[0]

        return ABI.args([encode(*only_one(arg)) for arg in args])

        Convert a string with JSON representation of deploy args to binary (ABI).

        The JSON should be a list of dictionaries {'type': 'value'} that represent type and value of the args,
        for example:

             [{"u32":1024}, {"account":"00000000000000000000000000000000"}, {"u64":1234567890}]
        
Convert a string with JSON representation of deploy args to binary (ABI).
The JSON should be a list of dictionaries {'type': 'value'} that represent type and value of the args,
for example.


Convert a string with JSON representation of deploy args to binary ( ABI ) . The JSON should be a list of dictionaries { ' type ' : ' value ' } that represent type and value of the args for example .
def args_from_json(s: str) -> bytes:
        args = json.loads(s)
        for arg in args:
            if len(arg) != 1:
                raise Exception(f'Wrong encoding of value in {arg}. Only one pair of type and value allowed.')
        def python_value(typ, value: str):
            if typ in ('u32', 'u64'):
                return int(value)
            elif typ == 'account':
                return bytearray.fromhex(value)
            raise ValueError(f"Unknown type {typ}, expected ('u32', 'u64', 'account')")
        def encode(typ: str, value: str) -> bytes:
            v = python_value(typ, value)
            return getattr(ABI, typ)(v)
        def only_one(arg):
            items = list(arg.items())
            if len(items) != 1:
                raise Exception("Only one pair {'type', 'value'} allowed.")
            return items[0]
        return ABI.args([encode(*only_one(arg)) for arg in args])
def args_from_json ( s : str ) -> bytes : args = json . loads ( s ) for arg in args : if len ( arg ) != 1 : raise Exception ( f'Wrong encoding of value in {arg}. Only one pair of type and value allowed.' ) def python_value ( typ , value : str ) : if typ in ( 'u32' , 'u64' ) : return int ( value ) elif typ == 'account' : return bytearray . fromhex ( value ) raise ValueError ( f"Unknown type {typ}, expected ('u32', 'u64', 'account')" ) def encode ( typ : str , value : str ) -> bytes : v = python_value ( typ , value ) return getattr ( ABI , typ ) ( v ) def only_one ( arg ) : items = list ( arg . items ( ) ) if len ( items ) != 1 : raise Exception ( "Only one pair {'type', 'value'} allowed." ) return items [ 0 ] return ABI . args ( [ encode ( * only_one ( arg ) ) for arg in args ] )
Convert a string with JSON representation of deploy args to binary (ABI).
Convert a string with JSON representation of deploy args to binary ( ABI ) .
"""
        Convert a string with JSON representation of deploy args to binary (ABI).

        The JSON should be a list of dictionaries {'type': 'value'} that represent type and value of the args,
        for example:

             [{"u32":1024}, {"account":"00000000000000000000000000000000"}, {"u64":1234567890}]
        """
s
str