neojsonrpc/utils.py
def encode_invocation_params(params):
    """ Returns a list of paramaters meant to be passed to JSON-RPC endpoints. """
    final_params = []
    for p in params:
        if isinstance(p, bool):
            final_params.append({'type': ContractParameterTypes.BOOLEAN.value, 'value': p})
        elif isinstance(p, int):
            final_params.append({'type': ContractParameterTypes.INTEGER.value, 'value': p})
        elif is_hash256(p):
            final_params.append({'type': ContractParameterTypes.HASH256.value, 'value': p})
        elif is_hash160(p):
            final_params.append({'type': ContractParameterTypes.HASH160.value, 'value': p})
        elif isinstance(p, bytearray):
            final_params.append({'type': ContractParameterTypes.BYTE_ARRAY.value, 'value': p})
        elif isinstance(p, str):
            final_params.append({'type': ContractParameterTypes.STRING.value, 'value': p})
        elif isinstance(p, list):
            innerp = encode_invocation_params(p)
            final_params.append({'type': ContractParameterTypes.ARRAY.value, 'value': innerp})
    return final_params
def encode_invocation_params(params):
    """ Returns a list of paramaters meant to be passed to JSON-RPC endpoints. """
    final_params = []
    for p in params:
        if isinstance(p, bool):
            final_params.append({'type': ContractParameterTypes.BOOLEAN.value, 'value': p})
        elif isinstance(p, int):
            final_params.append({'type': ContractParameterTypes.INTEGER.value, 'value': p})
        elif is_hash256(p):
            final_params.append({'type': ContractParameterTypes.HASH256.value, 'value': p})
        elif is_hash160(p):
            final_params.append({'type': ContractParameterTypes.HASH160.value, 'value': p})
        elif isinstance(p, bytearray):
            final_params.append({'type': ContractParameterTypes.BYTE_ARRAY.value, 'value': p})
        elif isinstance(p, str):
            final_params.append({'type': ContractParameterTypes.STRING.value, 'value': p})
        elif isinstance(p, list):
            innerp = encode_invocation_params(p)
            final_params.append({'type': ContractParameterTypes.ARRAY.value, 'value': innerp})
    return final_params
def encode_invocation_params ( params ) : final_params = [ ] for p in params : if isinstance ( p , bool ) : final_params . append ( { 'type' : ContractParameterTypes . BOOLEAN . value , 'value' : p } ) elif isinstance ( p , int ) : final_params . append ( { 'type' : ContractParameterTypes . INTEGER . value , 'value' : p } ) elif is_hash256 ( p ) : final_params . append ( { 'type' : ContractParameterTypes . HASH256 . value , 'value' : p } ) elif is_hash160 ( p ) : final_params . append ( { 'type' : ContractParameterTypes . HASH160 . value , 'value' : p } ) elif isinstance ( p , bytearray ) : final_params . append ( { 'type' : ContractParameterTypes . BYTE_ARRAY . value , 'value' : p } ) elif isinstance ( p , str ) : final_params . append ( { 'type' : ContractParameterTypes . STRING . value , 'value' : p } ) elif isinstance ( p , list ) : innerp = encode_invocation_params ( p ) final_params . append ( { 'type' : ContractParameterTypes . ARRAY . value , 'value' : innerp } ) return final_params
Returns a list of paramaters meant to be passed to JSON-RPC endpoints.
Returns a list of paramaters meant to be passed to JSON - RPC endpoints .