Ejemplo n.º 1
0
    def from_dict(cls, data: Dict[str, Any]) -> 'EventUnlockSuccess':
        restored = cls(
            identifier=PaymentID(int(data['identifier'])),
            secrethash=deserialize_secret_hash(data['secrethash']),
        )

        return restored
Ejemplo n.º 2
0
    def from_dict(cls, data: Dict[str, Any]) -> "EventUnlockClaimSuccess":
        restored = cls(
            identifier=PaymentID(int(data["identifier"])),
            secrethash=deserialize_secret_hash(data["secrethash"]),
        )

        return restored
Ejemplo n.º 3
0
    def from_dict(cls, data: Dict[str, Any]) -> "EventUnlockFailed":
        restored = cls(
            identifier=PaymentID(int(data["identifier"])),
            secrethash=deserialize_secret_hash(data["secrethash"]),
            reason=data["reason"],
        )

        return restored
Ejemplo n.º 4
0
    def from_dict(cls, data: Dict[str, Any]) -> 'EventUnlockClaimFailed':
        restored = cls(
            identifier=PaymentID(int(data['identifier'])),
            secrethash=deserialize_secret_hash(data['secrethash']),
            reason=data['reason'],
        )

        return restored
Ejemplo n.º 5
0
    def from_dict(cls, data: Dict[str, Any]) -> "EventInvalidReceivedUnlock":
        restored = cls(
            secrethash=serialization.deserialize_secret_hash(
                data["secrethash"]),
            reason=data["reason"],
        )

        return restored
Ejemplo n.º 6
0
    def from_dict(cls, data: Dict[str, Any]) -> 'SendLockExpired':
        restored = cls(
            recipient=to_canonical_address(data['recipient']),
            message_identifier=MessageID(int(data['message_identifier'])),
            balance_proof=data['balance_proof'],
            secrethash=deserialize_secret_hash(data['secrethash']),
        )

        return restored
Ejemplo n.º 7
0
    def from_dict(cls, data: Dict[str, Any]) -> "SendLockExpired":
        restored = cls(
            recipient=to_canonical_address(data["recipient"]),
            message_identifier=MessageID(int(data["message_identifier"])),
            balance_proof=data["balance_proof"],
            secrethash=deserialize_secret_hash(data["secrethash"]),
        )

        return restored
Ejemplo n.º 8
0
 def from_dict(cls, data: Dict[str, Any]) -> 'ContractReceiveSecretReveal':
     return cls(
         transaction_hash=deserialize_transactionhash(data['transaction_hash']),
         secret_registry_address=to_canonical_address(data['secret_registry_address']),
         secrethash=deserialize_secret_hash(data['secrethash']),
         secret=deserialize_secret(data['secret']),
         block_number=BlockNumber(int(data['block_number'])),
         block_hash=BlockHash(deserialize_bytes(data['block_hash'])),
     )
Ejemplo n.º 9
0
    def from_dict(
        cls,
        data: Dict[str, Any],
    ) -> 'EventUnexpectedSecretReveal':
        restored = cls(
            secrethash=deserialize_secret_hash(data['secrethash']),
            reason=data['reason'],
        )

        return restored
Ejemplo n.º 10
0
    def from_dict(
            cls,
            data: Dict[str, Any],
    ) -> 'EventInvalidReceivedUnlock':
        restored = cls(
            secrethash=serialization.deserialize_secret_hash(data['secrethash']),
            reason=data['reason'],
        )

        return restored
Ejemplo n.º 11
0
    def from_dict(cls, data: Dict[str, Any]) -> "MediatorTransferState":
        restored = cls(secrethash=deserialize_secret_hash(data["secrethash"]),
                       routes=data["routes"])
        restored.transfers_pair = data["transfers_pair"]
        restored.waiting_transfer = data["waiting_transfer"]

        secret = data.get("secret")
        if secret is not None:
            restored.secret = deserialize_secret(secret)

        return restored
Ejemplo n.º 12
0
    def from_dict(cls, data: Dict[str, Any]) -> 'SendSecretRequest':
        restored = cls(
            recipient=to_canonical_address(data['recipient']),
            channel_identifier=ChannelID(int(data['channel_identifier'])),
            message_identifier=MessageID(int(data['message_identifier'])),
            payment_identifier=PaymentID(int(data['payment_identifier'])),
            amount=PaymentWithFeeAmount(int(data['amount'])),
            expiration=BlockExpiration(int(data['expiration'])),
            secrethash=deserialize_secret_hash(data['secrethash']),
        )

        return restored
Ejemplo n.º 13
0
    def from_dict(cls, data: Dict[str, Any]) -> "SendSecretRequest":
        restored = cls(
            recipient=to_canonical_address(data["recipient"]),
            channel_identifier=ChannelID(int(data["channel_identifier"])),
            message_identifier=MessageID(int(data["message_identifier"])),
            payment_identifier=PaymentID(int(data["payment_identifier"])),
            amount=PaymentWithFeeAmount(int(data["amount"])),
            expiration=BlockExpiration(int(data["expiration"])),
            secrethash=deserialize_secret_hash(data["secrethash"]),
        )

        return restored
Ejemplo n.º 14
0
    def from_dict(cls, data: Dict[str, Any]) -> 'MediatorTransferState':
        restored = cls(
            secrethash=deserialize_secret_hash(data['secrethash']),
            routes=data['routes'],
        )
        restored.transfers_pair = data['transfers_pair']
        restored.waiting_transfer = data['waiting_transfer']

        secret = data.get('secret')
        if secret is not None:
            restored.secret = deserialize_secret(secret)

        return restored
Ejemplo n.º 15
0
    def from_dict(
            cls, data: Dict[str,
                            Any]) -> "TransferDescriptionWithoutSecretState":
        if "payment_hash_invoice" not in data:
            data["payment_hash_invoice"] = EMPTY_PAYMENT_HASH_INVOICE

        restored = cls(payment_network_identifier=to_canonical_address(
            data["payment_network_identifier"]),
                       payment_identifier=PaymentID(
                           int(data["payment_identifier"])),
                       payment_hash_invoice=deserialize_payment_hash_invoice(
                           data["payment_hash_invoice"]),
                       amount=PaymentAmount(int(data["amount"])),
                       allocated_fee=FeeAmount(int(data["allocated_fee"])),
                       token_network_identifier=to_canonical_address(
                           data["token_network_identifier"]),
                       initiator=to_canonical_address(data["initiator"]),
                       target=to_canonical_address(data["target"]),
                       secrethash=deserialize_secret_hash(data["secrethash"]))

        return restored
Ejemplo n.º 16
0
    def from_dict(cls, data: Dict[str, Any]) -> "EventUnexpectedSecretReveal":
        restored = cls(secrethash=deserialize_secret_hash(data["secrethash"]),
                       reason=data["reason"])

        return restored
Ejemplo n.º 17
0
 def from_dict(cls, data: Dict[str, Any]) -> "EventRouteFailed":
     return cls(secrethash=deserialize_secret_hash(data["secrethash"]))