tfchain/types/transactions/Transactions.py
def from_json(obj, id=None):
    """
    Create a TFChain transaction from a JSON string or dictionary.

    @param obj: JSON-encoded str, bytes, bytearray or JSON-decoded dict that contains a raw JSON Tx.
    """
    if isinstance(obj, (str, bytes, bytearray)):
        obj = json_loads(obj)
    if not isinstance(obj, dict):
        raise TypeError(
            "only a dictionary or JSON-encoded dictionary is supported as input: type {} is not supported", type(obj))
    tt = obj.get('version', -1)

    txn = None
    if tt == TransactionVersion.STANDARD:
        txn = TransactionV1.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_REGISTRATION:
        txn = TransactionV144.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_RECORD_UPDATE:
        txn = TransactionV145.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_NAME_TRANSFER:
        txn = TransactionV146.from_json(obj)
    elif tt == TransactionVersion.ERC20_CONVERT:
        txn = TransactionV208.from_json(obj)
    elif tt == TransactionVersion.ERC20_COIN_CREATION:
        txn = TransactionV209.from_json(obj)
    elif tt == TransactionVersion.ERC20_ADDRESS_REGISTRATION:
        txn = TransactionV210.from_json(obj)
    elif tt == TransactionVersion.MINTER_DEFINITION:
        txn = TransactionV128.from_json(obj)
    elif tt == TransactionVersion.MINTER_COIN_CREATION:
        txn = TransactionV129.from_json(obj)
    elif tt == TransactionVersion.LEGACY:
        txn = TransactionV1.legacy_from_json(obj)

    if isinstance(txn, TransactionBaseClass):
        txn.id = id
        return txn

    raise UnknownTransansactionVersion("transaction version {} is unknown".format(tt))

    Create a TFChain transaction from a JSON string or dictionary.

    @param obj: JSON-encoded str, bytes, bytearray or JSON-decoded dict that contains a raw JSON Tx.
    
Create a TFChain transaction from a JSON string or dictionary.
Create a TFChain transaction from a JSON string or dictionary .
def from_json(obj, id=None):
    if isinstance(obj, (str, bytes, bytearray)):
        obj = json_loads(obj)
    if not isinstance(obj, dict):
        raise TypeError(
            "only a dictionary or JSON-encoded dictionary is supported as input: type {} is not supported", type(obj))
    tt = obj.get('version', -1)
    txn = None
    if tt == TransactionVersion.STANDARD:
        txn = TransactionV1.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_REGISTRATION:
        txn = TransactionV144.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_RECORD_UPDATE:
        txn = TransactionV145.from_json(obj)
    elif tt == TransactionVersion.THREEBOT_NAME_TRANSFER:
        txn = TransactionV146.from_json(obj)
    elif tt == TransactionVersion.ERC20_CONVERT:
        txn = TransactionV208.from_json(obj)
    elif tt == TransactionVersion.ERC20_COIN_CREATION:
        txn = TransactionV209.from_json(obj)
    elif tt == TransactionVersion.ERC20_ADDRESS_REGISTRATION:
        txn = TransactionV210.from_json(obj)
    elif tt == TransactionVersion.MINTER_DEFINITION:
        txn = TransactionV128.from_json(obj)
    elif tt == TransactionVersion.MINTER_COIN_CREATION:
        txn = TransactionV129.from_json(obj)
    elif tt == TransactionVersion.LEGACY:
        txn = TransactionV1.legacy_from_json(obj)
    if isinstance(txn, TransactionBaseClass):
        txn.id = id
        return txn
    raise UnknownTransansactionVersion("transaction version {} is unknown".format(tt))
def from_json ( obj , id = None ) : if isinstance ( obj , ( str , bytes , bytearray ) ) : obj = json_loads ( obj ) if not isinstance ( obj , dict ) : raise TypeError ( "only a dictionary or JSON-encoded dictionary is supported as input: type {} is not supported" , type ( obj ) ) tt = obj . get ( 'version' , - 1 ) txn = None if tt == TransactionVersion . STANDARD : txn = TransactionV1 . from_json ( obj ) elif tt == TransactionVersion . THREEBOT_REGISTRATION : txn = TransactionV144 . from_json ( obj ) elif tt == TransactionVersion . THREEBOT_RECORD_UPDATE : txn = TransactionV145 . from_json ( obj ) elif tt == TransactionVersion . THREEBOT_NAME_TRANSFER : txn = TransactionV146 . from_json ( obj ) elif tt == TransactionVersion . ERC20_CONVERT : txn = TransactionV208 . from_json ( obj ) elif tt == TransactionVersion . ERC20_COIN_CREATION : txn = TransactionV209 . from_json ( obj ) elif tt == TransactionVersion . ERC20_ADDRESS_REGISTRATION : txn = TransactionV210 . from_json ( obj ) elif tt == TransactionVersion . MINTER_DEFINITION : txn = TransactionV128 . from_json ( obj ) elif tt == TransactionVersion . MINTER_COIN_CREATION : txn = TransactionV129 . from_json ( obj ) elif tt == TransactionVersion . LEGACY : txn = TransactionV1 . legacy_from_json ( obj ) if isinstance ( txn , TransactionBaseClass ) : txn . id = id return txn raise UnknownTransansactionVersion ( "transaction version {} is unknown" . format ( tt ) )
Create a TFChain transaction from a JSON string or dictionary.
Create a TFChain transaction from a JSON string or dictionary .
"""
    Create a TFChain transaction from a JSON string or dictionary.

    @param obj: JSON-encoded str, bytes, bytearray or JSON-decoded dict that contains a raw JSON Tx.
    """
obj
JSON-encoded str, bytes, bytearray or JSON-decoded dict that contains a raw JSON Tx.
JSON - encoded str bytes bytearray or JSON - decoded dict that contains a raw JSON Tx .
id