cosmpy.aerial.tx
Transaction.
TxState Objects
class TxState(Enum)
Transaction state.
Arguments:
Enum
: Draft, Sealed, Final.
SigningMode Objects
class SigningMode(Enum)
Signing Mode.
Arguments:
Enum
: Direct.
SigningConfig Objects
@dataclass class SigningCfg()
Transaction signing configuration.
Direct
@staticmethod def direct(public_key: PublicKey, sequence_num: int) -> "SigningCfg"
Transaction signing configuration using Direct Mode.
Arguments:
public_key
: Public key.sequence_num
: Sequence number.
Returns:
Transaction signing configuration.
Transaction Objects
class Transaction()
Transaction.
init
def __init__()
Init the transaction with transaction message, state, fee and body.
State
@property def state() -> TxState
Get the transaction state.
Returns:
Current state of the transaction.
Msgs
@property def msgs()
Get the transaction messages.
Returns:
Transaction messages.
fee
@property def fee() -> Optional[str]
Get the transaction fee.
Returns:
Transaction fee.
tx
@property def tx()
Initialize.
Raises:
RuntimeError
: If the transaction has not been completed.
Returns:
Transaction.
add_message
def add_message(msg: Any) -> "Transaction"
Initialize.
Arguments:
msg
: Transaction message(memo).
Raises:
RuntimeError
: If the transaction is not in the draft state.
Returns:
Transaction with message added.
Seal
def seal(signing_cfgs: Union[signing_cfg, List[SigningCfg]], fee: str, gas_limit: int, memo: Optional[str] = None) -> "Transaction"
Seal the transaction.
Arguments:
signing_cfgs
: signing configs.fee
: transaction fee.gas_limit
: transaction gas limit.memo
: transaction memo, defaults to None.
Returns: Sealed transaction.
sign
def sign(signer: Signer, chain_id: str, account_number: int, deterministic: bool = False) -> "Transaction"
Sign the transaction.
Arguments:
signer
: signer.chain_id
: chain id.account_number
: account number.deterministic
: deterministic, defaults to False.
Raises:
RuntimeError
: If transaction is not sealed.
Returns:
Signed transaction
complete
def complete() -> "Transaction"
Update transaction state to Final.
Returns:
Transaction with updated state.