Skip to main content

terra_sdk.client.lcd.api.tx

SignerOptions Objects


_2
@attr.s
_2
class SignerOptions()

SignerOptions specifies infomations about signers

Arguments:

  • address AccAddress - address of the signer
  • sequence int, optional - nonce of the messages from the signer
  • public_key PublicKey, optional - signer's PublicKey

CreateTxOptions Objects


_2
@attr.s
_2
class CreateTxOptions()

Arguments:

  • msgs List[Msg] - list of messages to include
  • fee Optional[Fee], optional - transaction fee. If None, will be estimated. See more on fee estimation_.
  • memo str, optional - optional short string to include with transaction.
  • gas str, optional - gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically
  • gas_prices Coins.Input, optional - gas prices for fee estimation.
  • gas_adjustment Numeric.Input, optional - gas adjustment for fee estimation.
  • fee_denoms List[str], optional - list of denoms to use for fee after estimation.
  • account_number int, optional - account number (overrides blockchain query if provided)
  • sequence int, optional - sequence (overrides blockchain qu ery if provided)
  • timeout_height int, optional - specifies a block timeout height to prevent the tx from being committed past a certain height.
  • sign_mode - (SignMode, optional): SignMode.SIGN_MODE_DIRECT by default. multisig needs SignMode.SIGN_MODE_LEGACY_AMINO_JSON.

AsyncTxAPI Objects


_1
class AsyncTxAPI(BaseAsyncAPI)

tx_info


_1
async def tx_info(tx_hash: str) -> TxInfo

Fetches information for an included transaction given a tx hash.

Arguments:

  • tx_hash str - hash of transaction to lookup

Returns:

  • TxInfo - transaction info

create


_1
async def create(signers: List[SignerOptions], options: CreateTxOptions) -> Tx

Create a new unsigned transaction, with helpful utilities such as lookup of chain ID, account number, sequence and fee estimation.

Arguments:

  • signers List[SignerOptions] - options about signers
  • options CreateTxOptions - options about creating a tx

Returns:

  • Tx - unsigned tx

estimate_fee


_1
async def estimate_fee(signers: List[SignerOptions], options: CreateTxOptions) -> Fee

Estimates the proper fee to apply by simulating it within the node.

Arguments:

  • signers [SignerOptions] - signers
  • options CreateTxOptions - transaction info to estimate fee

Returns:

  • Fee - estimated fee

encode


_1
async def encode(tx: Tx) -> str

Encode a Tx to base64 encoded proto string

decode


_1
async def decode(tx: str) -> Tx

Decode base64 encoded proto string to a Tx

hash


_1
async def hash(tx: Tx) -> str

Compute hash for a transaction.

Arguments:

  • tx Tx - transaction to hash

Returns:

  • str - transaction hash

broadcast_sync


_1
async def broadcast_sync(tx: Tx, options: BroadcastOptions = None) -> SyncTxBroadcastResult

Broadcasts a transaction using the sync broadcast mode.

Arguments:

  • tx Tx - transaction to broadcast
  • options BroadcastOptions - broacast options, optional

Returns:

  • SyncTxBroadcastResult - result

broadcast_async


_1
async def broadcast_async(tx: Tx, options: BroadcastOptions = None) -> AsyncTxBroadcastResult

Broadcasts a transaction using the async broadcast mode.

Arguments:

  • tx Tx - transaction to broadcast
  • options BroadcastOptions - broacast options, optional

Returns:

  • AsyncTxBroadcastResult - result

broadcast


_1
async def broadcast(tx: Tx, options: BroadcastOptions = None) -> BlockTxBroadcastResult

Broadcasts a transaction using the block broadcast mode.

Arguments:

  • tx Tx - transaction to broadcast
  • options BroadcastOptions - broacast options, optional

Returns:

  • BlockTxBroadcastResult - result

_1
async def search(events: List[list], params: Optional[APIParams] = None) -> dict

Searches for transactions given criteria.

Arguments:

  • events dict - dictionary containing options
  • params APIParams - optional parameters

Returns:

  • dict - transaction search results

tx_infos_by_height


_1
async def tx_infos_by_height(height: Optional[int] = None) -> List[TxInfo]

Fetches information for an included transaction given block height or latest

Arguments:

  • height int, optional - height to lookup. latest if height is None.

Returns:

  • List[TxInfo] - transaction info