Skip to content

PreparedBridgeTx

PreparedBridgeTx

Bases: BaseModel

Attributes

amount instance-attribute

amount: int

value instance-attribute

value: int

currency instance-attribute

currency: Currency

source_chain instance-attribute

source_chain: ChainID

target_chain instance-attribute

target_chain: ChainID

bridge_type instance-attribute

bridge_type: BridgeType

tx_details instance-attribute

tx_details: BridgeTxDetails

fee_value instance-attribute

fee_value: int

fee_in_token instance-attribute

fee_in_token: int

tx_hash property

tx_hash: str

Pre-computed transaction hash.

nonce property

nonce: int

Transaction nonce.

gas property

gas: int

max_fee_per_gas property

max_fee_per_gas: int

max_total_fee property

max_total_fee: int

Functions

__post_init_post_parse__

__post_init_post_parse__() -> None
Source code in derive_client/data_types/models.py
465
466
467
468
469
470
471
472
473
474
475
476
477
478
def __post_init_post_parse__(self) -> None:
    # rule 1: don't allow both amount (erc20) and value (native) to be non-zero
    if self.amount and self.value:
        raise ValueError(
            f"Both amount ({self.amount}) and value ({self.value}) are non-zero; "
            "use `prepare_erc20_tx` or `prepare_eth_tx` instead."
        )

    # rule 2: don't allow both fee types to be non-zero simultaneously
    if self.fee_value and self.fee_in_token:
        raise ValueError(
            f"Both fee_value ({self.fee_value}) and fee_in_token ({self.fee_in_token}) are non-zero; "
            "fees must be expressed in only one currency."
        )