tfchain/types/ConditionTypes.py
def from_recipient(recipient, lock=None):
    """
    Create automatically a recipient condition based on any accepted pythonic value (combo).
    """

    # define base condition
    if isinstance(recipient, ConditionBaseClass):
        condition = recipient
    else:
        condition = None
        if recipient is None:
            # free-for-all wallet
            condition = nil_new()
        elif isinstance(recipient, (UnlockHash, str)):
            # single sig wallet
            condition = unlockhash_new(unlockhash=recipient)
        elif isinstance(recipient, (bytes, bytearray)):
            # single sig wallet
            condition = unlockhash_new(unlockhash=recipient.hex())
        elif isinstance(recipient, list):
            # multisig to an all-for-all wallet
            condition = multi_signature_new(min_nr_sig=len(recipient), unlockhashes=recipient)
        elif isinstance(recipient, tuple):
            # multisig wallet with custom x-of-n definition
            if len(recipient) != 2:
                raise ValueError("recipient is expected to be a tupple of 2 values in the form (sigcount,hashes) or (hashes,sigcount), cannot be of length {}".format(len(recipient)))
            # allow (sigs,hashes) as well as (hashes,sigs)
            if isinstance(recipient[0], int):
                condition = multi_signature_new(min_nr_sig=recipient[0], unlockhashes=recipient[1])
            else:
                condition = multi_signature_new(min_nr_sig=recipient[1], unlockhashes=recipient[0])
        else:
            raise TypeError("invalid type for recipient parameter: {}", type(recipient))
    
    # if lock is defined, define it as a locktime value
    if lock is not None:
        condition = locktime_new(lock=lock, condition=condition)

    # return condition
    return condition

    Create automatically a recipient condition based on any accepted pythonic value (combo).
    
Create automatically a recipient condition based on any accepted pythonic value (combo).
Create automatically a recipient condition based on any accepted pythonic value ( combo ) .
def from_recipient(recipient, lock=None):
    if isinstance(recipient, ConditionBaseClass):
        condition = recipient
    else:
        condition = None
        if recipient is None:
            condition = nil_new()
        elif isinstance(recipient, (UnlockHash, str)):
            condition = unlockhash_new(unlockhash=recipient)
        elif isinstance(recipient, (bytes, bytearray)):
            condition = unlockhash_new(unlockhash=recipient.hex())
        elif isinstance(recipient, list):
            condition = multi_signature_new(min_nr_sig=len(recipient), unlockhashes=recipient)
        elif isinstance(recipient, tuple):
            if len(recipient) != 2:
                raise ValueError("recipient is expected to be a tupple of 2 values in the form (sigcount,hashes) or (hashes,sigcount), cannot be of length {}".format(len(recipient)))
            if isinstance(recipient[0], int):
                condition = multi_signature_new(min_nr_sig=recipient[0], unlockhashes=recipient[1])
            else:
                condition = multi_signature_new(min_nr_sig=recipient[1], unlockhashes=recipient[0])
        else:
            raise TypeError("invalid type for recipient parameter: {}", type(recipient))
    if lock is not None:
        condition = locktime_new(lock=lock, condition=condition)
    return condition
def from_recipient ( recipient , lock = None ) : if isinstance ( recipient , ConditionBaseClass ) : condition = recipient else : condition = None if recipient is None : condition = nil_new ( ) elif isinstance ( recipient , ( UnlockHash , str ) ) : condition = unlockhash_new ( unlockhash = recipient ) elif isinstance ( recipient , ( bytes , bytearray ) ) : condition = unlockhash_new ( unlockhash = recipient . hex ( ) ) elif isinstance ( recipient , list ) : condition = multi_signature_new ( min_nr_sig = len ( recipient ) , unlockhashes = recipient ) elif isinstance ( recipient , tuple ) : if len ( recipient ) != 2 : raise ValueError ( "recipient is expected to be a tupple of 2 values in the form (sigcount,hashes) or (hashes,sigcount), cannot be of length {}" . format ( len ( recipient ) ) ) if isinstance ( recipient [ 0 ] , int ) : condition = multi_signature_new ( min_nr_sig = recipient [ 0 ] , unlockhashes = recipient [ 1 ] ) else : condition = multi_signature_new ( min_nr_sig = recipient [ 1 ] , unlockhashes = recipient [ 0 ] ) else : raise TypeError ( "invalid type for recipient parameter: {}" , type ( recipient ) ) if lock is not None : condition = locktime_new ( lock = lock , condition = condition ) return condition
Create automatically a recipient condition based on any accepted pythonic value (combo).
Create automatically a recipient condition based on any accepted pythonic value ( combo ) .
"""
    Create automatically a recipient condition based on any accepted pythonic value (combo).
    """ # define base condition # free-for-all wallet # single sig wallet # single sig wallet # multisig to an all-for-all wallet # multisig wallet with custom x-of-n definition # allow (sigs,hashes) as well as (hashes,sigs) # if lock is defined, define it as a locktime value # return condition
recipient
lock